LuaAPI: Explain map variables that they are set when onGameStart is called
authorWuzzy
Mon, 03 Sep 2018 19:08:32 +0100
changeset 1532 94030dc69d1e
parent 1531 9a4773488054
child 1533 9faad9be6e0e
LuaAPI: Explain map variables that they are set when onGameStart is called
LuaAPI.wiki
--- a/LuaAPI.wiki	Mon Sep 03 18:54:06 2018 +0100
+++ b/LuaAPI.wiki	Mon Sep 03 19:08:32 2018 +0100
@@ -76,12 +76,12 @@
 Here are some unsorted variables or constants which are available in Lua. You shouldn’t write to most of them.
 
 || *Identifier* || *Description* ||
-|| `LAND_WIDTH` || The width of the landscape in pixels ||
-|| `LAND_HEIGHT` || The height of the landscape in pixels ||
 || `LOCALE` || Current locale identifier (e.g. “de” for German) ||
-|| `LeftX` || X coordinate of the leftmost point of the landscape ||
-|| `RightX` || X coordinate of the rightmost point of the landscape ||
-|| `TopY` || Y coordinate of the topmost point of the landscape ||
+|| `LAND_WIDTH` || The width of the landscape in pixels. Not available before `onGameStart` ||
+|| `LAND_HEIGHT` || The height of the landscape in pixels. Not available before `onGameStart` ||
+|| `LeftX` || X coordinate of the leftmost point of the landscape. Not available before `onGameStart` ||
+|| `RightX` || X coordinate of the rightmost point of the landscape. Not available before `onGameStart` ||
+|| `TopY` || Y coordinate of the topmost point of the landscape. Not available before `onGameStart` ||
 || `CursorX` || The X position of the cursor if the player is choosing a target. Otherwise, this is `-2147483648` ||
 || `CursorY` || The Y position of the cursor if the player is choosing a target. Otherwise, this is `-2147483648` ||
 || `WaterLine` || The y position of the water, used to determine at which position stuff drowns. Use `SetWaterLine` to change. ||
@@ -197,13 +197,13 @@
 
 Can be used to show the mission and for more setup, for example initial target spawning.
 
+At this stage, the global variables `LeftX`, `RightX`, `TopY`, `LAND_WIDTH` and `LAND_HEIGHT` become available.
+
 === <tt>onPreviewInit()</tt> ===
 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.
 
 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.
 
-Note the variables `LeftX`, `RightX`, `TopY`, `LAND_WIDTH` and `LAND_HEIGHT` are *not* yet available at this stage!
-
 === <tt>onParameters()</tt> ===
 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`.