User Tools

Site Tools


world_setup:game_features:tasks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
world_setup:game_features:tasks [2023/07/12 15:24] – [*dotask] mitworld_setup:game_features:tasks [2023/07/12 16:08] (current) – [Example task process] mit
Line 9: Line 9:
 ===== Example task process ===== ===== Example task process =====
 To implement the tree 'building' example given above : To implement the tree 'building' example given above :
-  * Unordered List ItemUsing the building editor, create the building as a 'Scripted-NoWindow' type. For the purposes of the example we'll say its building type 10.+  * Using the building editor, create the building as a 'Scripted-NoWindow' type. For the purposes of the example we'll say its building type 10.
   * Implement the building access script as shown:   * Implement the building access script as shown:
 <code> <code>
Line 68: Line 68:
  
 ==== *dotaskparam ==== ==== *dotaskparam ====
 +^ Format | *dotaskparam [PLAYER_NAME] [TASK_CODE/CALLBACK] [PARAM1] [PARAM2] [TEXT] |
 +^ Description | Activates the task display for the specified player, with parameters that can be access via script.  |
 +^ Example | ''*dotaskparam %PLAYER% CallbackName 199 210 Display message'' |
 +
 +''*dotaskparam'' is basically the same as ''*dotask'' with the addition of two parameter values, which you can access in the various task events through **$gParam[1]** and **$gParam[2]**
 +
 +e.g. : 
 +<code>
 +*dotaskparam %PLAYER% MyTask 100 150 Performing task
 +
 +Event( "CustomTaskStart", "MyTask" )
 +{
 +   $var1 = $gParam[1]
 +   $var2 = $gParam[2]
 +   
 +   *say Parameters were $var1 and $var2
 +}
 +</code>
 +would print ''Parameters were 100 and 150''
 +
  
 ==== *dobuildingtask ==== ==== *dobuildingtask ====
Line 73: Line 93:
 ^ Description | Activates the task display for the specified player in relation to the specified building.  | ^ Description | Activates the task display for the specified player in relation to the specified building.  |
 ^ Example | ''*dobuildingtask %PLAYER% $nearestBuildingID 99 Running building task'' | ^ Example | ''*dobuildingtask %PLAYER% $nearestBuildingID 99 Running building task'' |
 +
 ==== *dobuildingtaskparam ==== ==== *dobuildingtaskparam ====
 +^ Format | *dobuildingtask [PLAYER_NAME] [BUILDING_ID] [TASKCODE/CALLBACK] [PARAM1] [PARAM2] [DISPLAY_TEXT] |
 +^ Description | Activates the task display for the specified player in relation to the specified building.  |
 +^ Example | ''*dobuildingtask %PLAYER% $nearestBuildingID MyTask 333 444 Running building task'' |
  
-==== *docombitask ====+As with the *dotask equivalents, *dobuildingtaskparam just mirrors the *dobuildingtask command but allows the setting of some extra parameters that can be accessed in the task events.
  
 ==== *showtask ==== ==== *showtask ====
 +^ Format | *showtask [PLAYER_NAME] |
 +^ Description | This is a sysop/debug command that tells you the current state of the task for the specified player  |
  
 ===== Task scripting ===== ===== Task scripting =====
Line 84: Line 110:
  
 Call this function from one of the TaskStart events to set the number of seconds that the task will last for. \\ Call this function from one of the TaskStart events to set the number of seconds that the task will last for. \\
- 
-=== $gTaskItem1 === 
-=== $gTaskItem2 ===  
-=== $gTaskItem3 === 
  
 These script System Values provide the item numbers that were used in the ''*docombitask'' command These script System Values provide the item numbers that were used in the ''*docombitask'' command
  
 ***dobuildingtask** and ***dobuildingtaskparam** trigger: \\ ***dobuildingtask** and ***dobuildingtaskparam** trigger: \\
-''Event( "BuildingTaskStart", "[TASK_CODE/CALLBACK]" )''\\ +''Event( "BuildingTaskStart", "[BUILDING_CODE]" )''\\ 
-''Event( "BuildingTaskComplete", "[TASK_CODE/CALLBACK]" )''\\+''Event( "BuildingTaskComplete", "[BUILDING_CODE]" )''\\
  
 ***dotask** and ***dotaskparam** trigger: \\ ***dotask** and ***dotaskparam** trigger: \\
 ''Event( "CustomTaskStart", "[TASK_CODE/CALLBACK]" )''\\ ''Event( "CustomTaskStart", "[TASK_CODE/CALLBACK]" )''\\
 ''Event( "CustomTaskComplete", "[TASK_CODE/CALLBACK]" )''\\ ''Event( "CustomTaskComplete", "[TASK_CODE/CALLBACK]" )''\\
- 
-***docombitask** and ***docombitaskparam** trigger: \\ 
-''Event( "CombiTaskStart", "[TASK_CODE/CALLBACK]" )''\\ 
-''Event( "CombiTaskComplete", "[TASK_CODE/CALLBACK]" )''\\ 
- 
  
 TaskStart and TaskComplete events are triggered on all types of task (i.e. from all of the *do.. commands).  TaskStart and TaskComplete events are triggered on all types of task (i.e. from all of the *do.. commands). 
Line 123: Line 140:
  
  
 +==== Combination tasks ====
 +
 +You probably don't need to use combination tasks unless you're doing something very funky. (They were used on some early worlds to build a complex, but probably rather daft, crafting system which used the combination of items to generate a single code that could be looked up to find the resulting item - e.g. combining items 12, 39 and 41 would generate a code 12039041 and there'd be an event that granted a certain item when that code appeared. Whacky).
 +
 +Anyway.. for reference:
 +
 +==== *docombitask ====
 +^ Format | *docombitask [PLAYER_NAME] [ITEM1] [ITEM2] [ITEM3] |
 +^ Description | Activates the task display for the specified player with relation to the specified item numbers |
 +^ Example | ''*docombitask %PLAYER% $item1 $item2 $item3'' |
 +
 +
 +Combi tasks also make use of the system values : \\
 +**$gTaskItem1**, **$gTaskItem2**, **$gTaskItem3**\\
 +which correspond to the three values used in the combitask command
 +
 +
 +***docombitask** and ***docombitaskparam** trigger: \\
 +''Event( "CombiTaskStart", "[TASK_CODE/CALLBACK]" )''\\
 +''Event( "CombiTaskComplete", "[TASK_CODE/CALLBACK]" )''\\
  
  
world_setup/game_features/tasks.1689193462.txt.gz · Last modified: 2023/07/12 15:24 by mit

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki