Strict Standards: Declaration of action_plugin_importoldchangelog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /nfsmnt/hosting1_2/b/7/b79009f8-4f60-4728-a6c4-67484c2431e0/ on line 8

Strict Standards: Declaration of action_plugin_safefnrecode::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /nfsmnt/hosting1_2/b/7/b79009f8-4f60-4728-a6c4-67484c2431e0/ on line 0

Strict Standards: Declaration of action_plugin_popularity::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /nfsmnt/hosting1_2/b/7/b79009f8-4f60-4728-a6c4-67484c2431e0/ on line 0

Strict Standards: Declaration of Doku_Renderer_metadata::table_open() should be compatible with Doku_Renderer::table_open($maxcols = NULL, $numrows = NULL, $pos = NULL) in /nfsmnt/hosting1_2/b/7/b79009f8-4f60-4728-a6c4-67484c2431e0/ on line 24

Strict Standards: Declaration of Doku_Renderer_metadata::table_close() should be compatible with Doku_Renderer::table_close($pos = NULL) in /nfsmnt/hosting1_2/b/7/b79009f8-4f60-4728-a6c4-67484c2431e0/ on line 24
tery:scripting [TeryWiki]

How does scripting work inside

There is array of 'script templates' which can be edited in level editor. You can edit script name, description and their script events, you can add or remove these scripts as you like.

Then there is array which is 'running scripts' queue which holds copies of the script templates which were executed. Script is placed here when it should be executed, which can happen for example on press of action key of creature, or when hero pushes wall-button in the game. Multiple copies of one script template can be placed here at same time.

When processing running scripts program goes through the array of running scripts one by one, on each script it gets next script event, processes it and moves to another event untill the event duration is longer than current time delta (for example Delay event pauses script, or Color Fade events have longer duration). When last event is processed script is removed from running scripts queue as it was all processed. Some scripts can be looped by 'goto label' events, and maybe they will never end.

Script is usually executed by one of these things:

  1. Level has properties containing script name which should be executed on start of level and on end of level. If you need to display animation on level start then this is where you set your script.
  2. Creature - if you press its action button. For example you can fire projectile by script or create some kind of magic by script. You can either hard-code this into creature c++ class (faster to execute - slower to write) , or soft-code it into script (faster to write(sometimes;) - slower to execute).
  3. Trigger area is rectangle area which executes script when any creature enters it, leaves it, or stands in it for some time. This is usable to detect creature touching something, stepping on something and such. If creature steps into lava pool you can assign script which takes 10 points of health repeatedly every 2 seconds.
  4. Follower - is entity that moves on path created from path points - it is probably used as either platform, elevator or moving door. Path point has a property 'script' which will be called when any follower passes that path point.
  5. script - can execute another script by script event. New script will be added to the running scripts queue and it will be executed along with other scripts.
tery/scripting.txt · Last modified: 2010/09/22 11:20 by mirex
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki