Difference between revisions of "Creating Multithreaded Skyrim Mods Part 3 - Callbacks"
Creating Multithreaded Skyrim Mods Part 3 - Callbacks (edit)
Revision as of 15:59, 27 January 2015
, 15:59, 27 January 2015no edit summary
imported>Chesko |
imported>Chesko |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category: Tutorials]] | [[Category: Tutorials]] | ||
[[Category: Community Tutorials]] | |||
{{Tutorial Index | {{Tutorial Index | ||
Line 9: | Line 10: | ||
We will be implementing a multithreaded solution to our example problem (a Conjuration mod that spawns many actors) using the '''Callback pattern'''. | We will be implementing a multithreaded solution to our example problem (a Conjuration mod that spawns many actors) using the '''Callback pattern'''. | ||
{{NewFeature| [http://www.creationkit.com/images/b/bd/TutorialExampleMod_Multithreading_Callbacks.zip Download Tutorial Example Plugin] - A fully functional, installable mod. Includes all tutorial files and source code.}} | |||
== Pattern Overview == | == Pattern Overview == | ||
Line 32: | Line 37: | ||
Here is a diagram of how the Callback pattern works. | Here is a diagram of how the Callback pattern works. | ||
[[File:Multithreading_fig3_1.png| | [[File:Multithreading_fig3_1.png|1056px|center|Fig. 3.1, 3.2]] | ||
Above, you can see that the sequence is: | Above, you can see that the sequence is: | ||
Line 47: | Line 52: | ||
<gallery widths="240px" heights="200px" perrow="3"> | <gallery widths="240px" heights="200px" perrow="3"> | ||
Image:Multithreading-fig1-1.JPG|<b>Fig. | Image:Multithreading-fig1-1.JPG|<b>Fig. 3.3</b>: <br> Create Quest | ||
</gallery> | </gallery> | ||
Line 221: | Line 226: | ||
function PlaceConjuredGuardAsync(ActorBase akGuard) | function PlaceConjuredGuardAsync(ActorBase akGuard) | ||
if !thread01.queued() | if !thread01.queued() | ||
thread01.get_async(akGuard, XMarker) | thread01.get_async(akGuard, XMarker) | ||
elseif !thread02.queued() | elseif !thread02.queued() | ||
thread02.get_async(akGuard, XMarker) | thread02.get_async(akGuard, XMarker) | ||
;...and so on | ;...and so on | ||
elseif !thread09.queued() | elseif !thread09.queued() | ||
thread09.get_async(akGuard, XMarker) | thread09.get_async(akGuard, XMarker) | ||
elseif !thread10.queued() | elseif !thread10.queued() | ||
thread10.get_async(akGuard, XMarker) | thread10.get_async(akGuard, XMarker) | ||
else | else | ||
Line 287: | Line 288: | ||
'''Compile and attach''' this script to your GuardPlacementQuest. then, double-click the Thread Manager script and '''fill the properties'''. Once you've done that, your quest's script section should look something like this: | '''Compile and attach''' this script to your GuardPlacementQuest. then, double-click the Thread Manager script and '''fill the properties'''. Once you've done that, your quest's script section should look something like this: | ||
[[File:Multithreading_quest_scripts.JPG|509px|center]] | |||
Line 357: | Line 358: | ||
ObjectReference myGuard = akGuard as ObjectReference | ObjectReference myGuard = akGuard as ObjectReference | ||
if !Guard1 | if !Guard1 | ||
Guard1 = myGuard | Guard1 = myGuard | ||
Line 393: | Line 393: | ||
== Playing the Example Plugin == | == Playing the Example Plugin == | ||
{{NewFeature| [http://www.creationkit.com/images/ | {{NewFeature| [http://www.creationkit.com/images/b/bd/TutorialExampleMod_Multithreading_Callbacks.zip Download Tutorial Example Plugin] - A fully functional, installable mod. Includes all tutorial files and source code.}} | ||
The example plugin can be installed using a mod manager, or by dragging all of the zipped files into the Skyrim\Data directory of your installation. | The example plugin can be installed using a mod manager, or by dragging all of the zipped files into the Skyrim\Data directory of your installation. |