LuaAPI.wiki
changeset 505 a79631e03c84
parent 503 87a36ae53518
child 515 8e9d86efc07b
equal deleted inserted replaced
504:fbc43fa808ff 505:a79631e03c84
   148 
   148 
   149 <blockquote>This function is called when the first round starts.
   149 <blockquote>This function is called when the first round starts.
   150 </blockquote>
   150 </blockquote>
   151 Can be used to show the mission and for more setup, for example initial target spawning.
   151 Can be used to show the mission and for more setup, for example initial target spawning.
   152 
   152 
   153 === <tt>onPreviewInit()</tt> ===
   153 === <tt>onPreviewInit()</tt> (0.9.21) ===
   154 This function is called when the map preview in the frontend is initialized. This happens when the script is selected or you change a map generator parameter.
   154 This function is called when the map preview in the frontend is initialized. This happens when the script is selected or you change a map generator parameter.
   155 
   155 
   156 It is useful for scripts which create their own maps (see `AddPoint` and `FlushPoints`). If you create a map in this function, a preview will be generated from this map and is exposed to the frontend.
   156 It is useful for scripts which create their own maps (see `AddPoint` and `FlushPoints`). If you create a map in this function, a preview will be generated from this map and is exposed to the frontend.
       
   157 
       
   158 === <tt>onParameters()</tt> (0.9.21) ===
       
   159 This function is called when the script parameters (as specified in the game scheme) become available. The script parameter string is stored in the global variable `ScriptParam`.
       
   160 
       
   161 Please note that it is normally not safe to call many of the other functions inside this function, this function is called very early in the game, only use this to initialize variables and other internal stuff like that.
       
   162 
       
   163 *Tip*: If you use the Params library  (`/Scripts/Params.lua`), you can make the task of dissecting the string into useful values a bit easier, but it’s not required. (The Params library is not documented yet, however).
       
   164 
       
   165 *Tip*: If you use this callback, make sure to document the interpretation of the parameters so others know how to set the parameters properly.
   157 
   166 
   158 === <tt>onGameTick()</tt> ===
   167 === <tt>onGameTick()</tt> ===
   159 
   168 
   160 <blockquote>This function is called on every game tick, i.e. 1000 times a second.  If you just need to check on something periodically, consider...
   169 <blockquote>This function is called on every game tick, i.e. 1000 times a second.  If you just need to check on something periodically, consider...
   161 </blockquote>
   170 </blockquote>