LuaAPI.wiki
changeset 181 714a208397bd
parent 180 96e6b405bcf6
child 182 b64d2239cb8c
equal deleted inserted replaced
180:96e6b405bcf6 181:714a208397bd
    30 === <tt>onGameInit()</tt> ===
    30 === <tt>onGameInit()</tt> ===
    31 
    31 
    32 <blockquote>This function is called before the game loads its resources. One can modify various game variables here:
    32 <blockquote>This function is called before the game loads its resources. One can modify various game variables here:
    33 </blockquote>
    33 </blockquote>
    34  * <tt>Seed = 0</tt> - sets the seed of the random number generator
    34  * <tt>Seed = 0</tt> - sets the seed of the random number generator
    35  * <tt>!GameFlags = gfSolidLand + gfArtillery + …</tt> - sets the gameflags, see above for the available flags
    35  * <tt>!GameFlags = gfSolidLand + gfArtillery + ...</tt> - sets the gameflags, see above for the available flags
    36  * <tt>!TurnTime = 60000</tt> - set the turntime in ms
    36  * <tt>!TurnTime = 60000</tt> - set the turntime in ms
    37  * <tt>!CaseFreq = 0</tt> - frequency of crate drops
    37  * <tt>!CaseFreq = 0</tt> - frequency of crate drops
    38  * <tt>!HealthCaseProb = 35</tt> - chance of receiving a health crate
    38  * <tt>!HealthCaseProb = 35</tt> - chance of receiving a health crate
    39  * <tt>!HealthCaseAmount = 25</tt> - amount of health in a health crate
    39  * <tt>!HealthCaseAmount = 25</tt> - amount of health in a health crate
    40  * <tt>!DamagePercent = 100</tt> - percent of damage to inforce
    40  * <tt>!DamagePercent = 100</tt> - percent of damage to inforce
    64 === <tt>onGameTick()</tt> ===
    64 === <tt>onGameTick()</tt> ===
    65 
    65 
    66 <blockquote>This function is called on every game tick, i.e. 1000 times a second.
    66 <blockquote>This function is called on every game tick, i.e. 1000 times a second.
    67 </blockquote>
    67 </blockquote>
    68 
    68 
    69 === <tt>onNewTurn()</tt> (0.9.15) ===
    69 === <tt>onNewTurn()</tt> ===
    70 
    70 
    71 <blockquote>This function calls at the start of every turn.
    71 <blockquote>This function calls at the start of every turn.
    72 </blockquote>
    72 </blockquote>
    73 === <tt>onGearAdd(gearUid)</tt> ===
    73 === <tt>onGearAdd(gearUid)</tt> ===
    74 
    74 
    78 === <tt>onGearDelete(gearUid)</tt> ===
    78 === <tt>onGearDelete(gearUid)</tt> ===
    79 
    79 
    80 <blockquote>This function is called when a new gear is deleted. Useful in
    80 <blockquote>This function is called when a new gear is deleted. Useful in
    81 combination with <tt>!GetGearType(gearUid)</tt>.
    81 combination with <tt>!GetGearType(gearUid)</tt>.
    82 </blockquote>
    82 </blockquote>
    83 === <tt>onGearDamage(gearUid, damage)</tt> (0.9.15) ===
    83 === <tt>onGearDamage(gearUid, damage)</tt> ===
    84 
    84 
    85 <blockquote>This function is called when a gear is damaged.
    85 <blockquote>This function is called when a gear is damaged.
    86 </blockquote>
    86 </blockquote>
    87 
    87 
    88 Example:
    88 Example:
    91         if (!GetGearType(gear) == gtHedgehog) then
    91         if (!GetGearType(gear) == gtHedgehog) then
    92             -- adds a message saying, e.g. "Hoggy H took 25 points of damage"
    92             -- adds a message saying, e.g. "Hoggy H took 25 points of damage"
    93             !AddCaption(!GetHogName(gear) .. ' took ' .. damage .. ' points of damage')
    93             !AddCaption(!GetHogName(gear) .. ' took ' .. damage .. ' points of damage')
    94         end
    94         end
    95     end</code>
    95     end</code>
    96 === <tt>onGearResurrect(gearUid) (0.9.14)</tt> ===
    96 === <tt>onGearResurrect(gearUid) </tt> ===
    97 
    97 
    98 <blockquote>This function is called when a gear is resurrected. CPU Hogs will resurrect if gfAISurvival is included in !GameFlags. Alternatively, specific gears can have heResurrectable set to true via !SetEffect.
    98 <blockquote>This function is called when a gear is resurrected. CPU Hogs will resurrect if gfAISurvival is included in !GameFlags. Alternatively, specific gears can have heResurrectable set to true via !SetEffect.
    99 </blockquote>
    99 </blockquote>
   100 === <tt>onAmmoStoreInit()</tt> ===
   100 === <tt>onAmmoStoreInit()</tt> ===
   101 
   101 
   145 === <tt>onDown()</tt> ===
   145 === <tt>onDown()</tt> ===
   146 
   146 
   147 <blockquote>This function is called when you press the down key.
   147 <blockquote>This function is called when you press the down key.
   148 </blockquote>
   148 </blockquote>
   149 
   149 
   150 === <tt>onAttackUp()</tt> (0.9.17) ===
   150 === <tt>onAttackUp()</tt> ===
   151 
   151 
   152 <blockquote>This function is called when you release the attack key.</blockquote>
   152 <blockquote>This function is called when you release the attack key.</blockquote>
   153 
   153 
   154 === <tt>onDownUp()</tt> (0.9.17) ===
   154 === <tt>onDownUp()</tt> ===
   155 
   155 
   156 <blockquote>This function is called when you release the down key.</blockquote>
   156 <blockquote>This function is called when you release the down key.</blockquote>
   157  
   157  
   158 === <tt>onHogAttack()</tt> (0.9.17) ===
   158 === <tt>onHogAttack()</tt> ===
   159 
   159 
   160 <blockquote>This function is called when you press the attack key.</blockquote>
   160 <blockquote>This function is called when you press the attack key.</blockquote>
   161 
   161 
   162 === <tt>onLeftUp()</tt> (0.9.17) ===
   162 === <tt>onLeftUp()</tt> ===
   163 
   163 
   164 <blockquote>This function is called when you release the left key.</blockquote>
   164 <blockquote>This function is called when you release the left key.</blockquote>
   165 
   165 
   166 === <tt>onPreciseUp()</tt> (0.9.17) ===
   166 === <tt>onPreciseUp()</tt> ===
   167 
   167 
   168 <blockquote>This function is called when you release the precise key.</blockquote>
   168 <blockquote>This function is called when you release the precise key.</blockquote>
   169 
   169 
   170 === <tt>onRightUp()</tt> (0.9.17) ===
   170 === <tt>onRightUp()</tt> ===
   171 
   171 
   172 <blockquote>This function is called when you release the right key.</blockquote>
   172 <blockquote>This function is called when you release the right key.</blockquote>
   173 
   173 
   174 === <tt>onSetWeapon()</tt> (0.9.17) ===
   174 === <tt>onSetWeapon()</tt> ===
   175 
   175 
   176 <blockquote>It is get called when a weapon is selected or switched.</blockquote>
   176 <blockquote>It is get called when a weapon is selected or switched.</blockquote>
   177 
   177 
   178 === <tt>onSlot()</tt> (0.9.17) ===
   178 === <tt>onSlot()</tt> ===
   179 
   179 
   180 <blockquote>This function is called when a weapon slot (row in the weapon menu) is selected.</blockquote>
   180 <blockquote>This function is called when a weapon slot (row in the weapon menu) is selected.</blockquote>
   181 
   181 
   182 === <tt>onSwitch()</tt> (0.9.17) ===
   182 === <tt>onSwitch()</tt> ===
   183 
   183 
   184 <blockquote>This function is called when a hog is switched to another.</blockquote>
   184 <blockquote>This function is called when a hog is switched to another.</blockquote>
   185 
   185 
   186 === <tt>onTaunt()</tt> (0.9.17) ===
   186 === <tt>onTaunt()</tt> ===
   187 
   187 
   188 <blockquote>This function is called when the player uses an animated   emote for example "/wave, /juggle and etc.</blockquote>
   188 <blockquote>This function is called when the player uses an animated   emote for example "/wave, /juggle and etc.</blockquote>
   189 
   189 
   190 === <tt>onTimer()</tt> (0.9.17) ===
   190 === <tt>onTimer()</tt> ===
   191 
   191 
   192 <blockquote>This function is called when one of the timer keys is pressed.</blockquote>
   192 <blockquote>This function is called when one of the timer keys is pressed.</blockquote>
   193 
   193 
   194 === <tt>onUpUp()</tt> (0.9.17) ===
   194 === <tt>onUpUp()</tt> ===
   195 
   195 
   196 <blockquote>This function is called when you release the up 
   196 <blockquote>This function is called when you release the up 
   197 key.</blockquote>
   197 key.</blockquote>
   198 
   198 
   199 === <tt>onHogHide()</tt> (0.9.17) ===
   199 === <tt>onHogHide()</tt> (0.9.16) ===
   200 
   200 
   201 <blockquote>This function is called when a hedgehog is hidden(removed from the map).</blockquote>
   201 <blockquote>This function is called when a hedgehog is hidden(removed from the map).</blockquote>
   202 
   202 
   203 === <tt>onHogRestore()</tt> (0.9.17) ===
   203 === <tt>onHogRestore()</tt> (0.9.16) ===
   204 
   204 
   205 <blockquote>This function is called when a hedgehog is restored (unhidden).<blockquote>
   205 <blockquote>This function is called when a hedgehog is restored (unhidden).<blockquote>
   206 
   206 
   207 == Functions for creating gears ==
   207 == Functions for creating gears ==
   208 
   208 
   223 
   223 
   224 <code lang="lua">  -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
   224 <code lang="lua">  -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
   225     vgear = !AddVisualGear(1000, 1000, vgtExplosion, 0, false) 
   225     vgear = !AddVisualGear(1000, 1000, vgtExplosion, 0, false) 
   226 </code>
   226 </code>
   227 
   227 
   228 === <tt>!SpawnHealthCrate(x, y)</tt> (0.9.14) ===
   228 === <tt>!SpawnHealthCrate(x, y)</tt> ===
   229 
   229 
   230 <blockquote>Spawns a health crate at the specified position.
   230 <blockquote>Spawns a health crate at the specified position.
   231 </blockquote>
   231 </blockquote>
   232 === <tt>!SpawnAmmoCrate(x, y, ammoType)</tt> (0.9.14) ===
   232 === <tt>!SpawnAmmoCrate(x, y, ammoType)</tt> ===
   233 
   233 
   234 <blockquote>Spawns an ammo crate at the specified position with content of ammoType (see [AmmoTypes Ammo Types]). Because by default settings the number of ammo in crates is zero it has to be increased to at least one with SetAmmo first, see the example:
   234 <blockquote>Spawns an ammo crate at the specified position with content of ammoType (see [AmmoTypes Ammo Types]). Because by default settings the number of ammo in crates is zero it has to be increased to at least one with SetAmmo first, see the example:
   235 </blockquote>
   235 </blockquote>
   236 Example:
   236 Example:
   237 
   237 
   238 <code lang="lua">    !SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
   238 <code lang="lua">    !SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
   239     !SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
   239     !SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
   240 === <tt>!SpawnUtilityCrate(x, y, ammoType)</tt> (0.9.14) ===
   240 === <tt>!SpawnUtilityCrate(x, y, ammoType)</tt> ===
   241 
   241 
   242 <blockquote>Spawns an utility crate at specified position with content of ammoType.
   242 <blockquote>Spawns an utility crate at specified position with content of ammoType.
   243 </blockquote>
   243 </blockquote>
   244 Example:
   244 Example:
   245 
   245 
   272 </blockquote>
   272 </blockquote>
   273 === <tt>!GetGearPosition(gearUid)</tt> ===
   273 === <tt>!GetGearPosition(gearUid)</tt> ===
   274 
   274 
   275 <blockquote>returns x,y coordinates for the specified gear
   275 <blockquote>returns x,y coordinates for the specified gear
   276 </blockquote>
   276 </blockquote>
   277 === <tt>!GetGearRadius(gearUid)</tt> (0.9.15) ===
   277 === <tt>!GetGearRadius(gearUid)</tt> ===
   278 
   278 
   279 <blockquote>Returns radius for the specified gear
   279 <blockquote>Returns radius for the specified gear
   280 </blockquote>
   280 </blockquote>
   281 === <tt>!GetGearVelocity(gearUid)</tt> (0.9.15) ===
   281 === <tt>!GetGearVelocity(gearUid)</tt> ===
   282 
   282 
   283 <blockquote>returns tuple of dx,dy values for the specified gear
   283 <blockquote>returns tuple of dx,dy values for the specified gear
   284 </blockquote>
   284 </blockquote>
   285 === <tt>!GetGearElasticity(gearUid) (0.9.15)</tt> ===
   285 === <tt>!GetGearElasticity(gearUid) </tt> ===
   286 
   286 
   287 <blockquote>Returns the elasticity of the specified gear. Useful for determining if a hog is on a rope or not. If a hog is attached to a rope, or is busy firing one, the elasticity of the rope will be non-zero.
   287 <blockquote>Returns the elasticity of the specified gear. Useful for determining if a hog is on a rope or not. If a hog is attached to a rope, or is busy firing one, the elasticity of the rope will be non-zero.
   288 </blockquote>
   288 </blockquote>
   289 === <tt>!GetHogClan(gearUid)</tt> ===
   289 === <tt>!GetHogClan(gearUid)</tt> ===
   290 
   290 
   332 </blockquote>
   332 </blockquote>
   333 === <tt>!GetFollowGear(gearUid)</tt> ===
   333 === <tt>!GetFollowGear(gearUid)</tt> ===
   334 
   334 
   335 <blockquote>Returns the uid of the gear that is currently being followed.
   335 <blockquote>Returns the uid of the gear that is currently being followed.
   336 </blockquote>
   336 </blockquote>
   337 === <tt>!GetTimer(gearUid)</tt> (0.9.14) ===
   337 === <tt>!GetTimer(gearUid)</tt> ===
   338 
   338 
   339 <blockquote>returns the timer of the gear. This is for example the time it takes for watermelon, mine, etc. to explode. This is also the time used to specify the blowtorch or rcplane time.
   339 <blockquote>returns the timer of the gear. This is for example the time it takes for watermelon, mine, etc. to explode. This is also the time used to specify the blowtorch or rcplane time.
   340 </blockquote>
   340 </blockquote>
   341 === <tt>!GetHealth(gearUid)</tt> (0.9.14) ===
   341 === <tt>!GetHealth(gearUid)</tt> ===
   342 
   342 
   343 <blockquote>returns the health of the gear
   343 <blockquote>returns the health of the gear
   344 </blockquote>
   344 </blockquote>
   345 === <tt>!GetHogLevel(gearUid)</tt> (0.9.14) ===
   345 === <tt>!GetHogLevel(gearUid)</tt> ===
   346 
   346 
   347 <blockquote>returns the bot level from 0 to 5. 0 means human player.
   347 <blockquote>returns the bot level from 0 to 5. 0 means human player.
   348 </blockquote>
   348 </blockquote>
   349 
   349 
   350 === <tt>!GetVisualGearValues(vgUid)</tt> (0.9.15) ===
   350 === <tt>!GetVisualGearValues(vgUid)</tt> ===
   351 
   351 
   352 <blockquote>This returns the typically set visual gear values, useful if manipulating things like smoke or bubbles or circles.  It returns the following values:
   352 <blockquote>This returns the typically set visual gear values, useful if manipulating things like smoke or bubbles or circles.  It returns the following values:
   353 X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint 
   353 X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint 
   354 X, Y typically position, dX, dY typically speed, Angle is usually the rotation angle, Frame is typically the animation frame, FrameTicks is usually an animation counter.  State can have a variety of values, but is typically bit packed, Timer is usually the gear lifetime and Tint is the colour.
   354 X, Y typically position, dX, dY typically speed, Angle is usually the rotation angle, Frame is typically the animation frame, FrameTicks is usually an animation counter.  State can have a variety of values, but is typically bit packed, Timer is usually the gear lifetime and Tint is the colour.
   355 Most visual gears require little to no modification of parameters.
   355 Most visual gears require little to no modification of parameters.
   364 === <tt>!DeleteGear(gearUid)</tt> ===
   364 === <tt>!DeleteGear(gearUid)</tt> ===
   365 
   365 
   366 <blockquote>Deletes a Gear</blockquote>
   366 <blockquote>Deletes a Gear</blockquote>
   367 Example:
   367 Example:
   368 
   368 
   369 <code lang="lua">    gear = !AddGear(…)
   369 <code lang="lua">    gear = !AddGear(...)
   370     !DeleteGear(gear) -- Delete the newly created gear.</code>
   370     !DeleteGear(gear) -- Delete the newly created gear.</code>
   371 
   371 
   372 === <tt>!DeleteVisualGear(vgUid)</tt> (0.9.15) ===
   372 === <tt>!DeleteVisualGear(vgUid)</tt> ===
   373 
   373 
   374 <blockquote>Deletes a Visual Gear.  Note, most visual gears delete themselves.</blockquote>
   374 <blockquote>Deletes a Visual Gear.  Note, most visual gears delete themselves.</blockquote>
   375 Example:
   375 Example:
   376 
   376 
   377 <code lang="lua">    vgear = !AddVisualGear(…)
   377 <code lang="lua">    vgear = !AddVisualGear(...)
   378     !DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
   378     !DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
   379 
   379 
   380 
   380 
   381 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint)</tt> (0.9.15) ===
   381 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint)</tt> ===
   382 
   382 
   383 <blockquote>This allows manipulation of many of the visual gear values.  Calling GetVisualGearValues first is recommended on most visual gears unless you are controlling all the key values.  In the case of vgtCircle, the visual gear values are mapped as follows.  X, Y: position.  State: radius. Timer: Thickness.  FrameTicks: pulsation speed (0 to disable).  dX, dY: min/max pulsation opacity (0-255). Tint: colour, RGBA.
   383 <blockquote>This allows manipulation of many of the visual gear values.  Calling GetVisualGearValues first is recommended on most visual gears unless you are controlling all the key values.  In the case of vgtCircle, the visual gear values are mapped as follows.  X, Y: position.  State: radius. Timer: Thickness.  FrameTicks: pulsation speed (0 to disable).  dX, dY: min/max pulsation opacity (0-255). Tint: colour, RGBA.
   384 Most visual gears require little to no modification of parameters.
   384 Most visual gears require little to no modification of parameters.
   385 </blockquote>
   385 </blockquote>
   386 Example:
   386 Example:
   393 
   393 
   394 <blockquote>Finds a place for the specified gear between x=left and x=right and places it there. 0.9.16 adds an optional fifth parameter, tryHarder. Setting to true/false will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other.
   394 <blockquote>Finds a place for the specified gear between x=left and x=right and places it there. 0.9.16 adds an optional fifth parameter, tryHarder. Setting to true/false will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other.
   395 </blockquote>
   395 </blockquote>
   396 Example:
   396 Example:
   397 
   397 
   398 <code lang="lua">    gear = !AddGear(…)
   398 <code lang="lua">    gear = !AddGear(...)
   399     !FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH</code>
   399     !FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH</code>
   400 === <tt>!HogSay(gearUid, text, manner)</tt> ===
   400 === <tt>!HogSay(gearUid, text, manner)</tt> ===
   401 
   401 
   402 <blockquote>Makes the specified gear say, think, or shout some text in a bubble.
   402 <blockquote>Makes the specified gear say, think, or shout some text in a bubble.
   403 </blockquote>
   403 </blockquote>
   417     !HogTurnLeft(!CurrentHedgehog, false) -- turns !CurrentHedgehog right</code>
   417     !HogTurnLeft(!CurrentHedgehog, false) -- turns !CurrentHedgehog right</code>
   418 === <tt>!SetGearPosition(gearUid, x, y)</tt> ===
   418 === <tt>!SetGearPosition(gearUid, x, y)</tt> ===
   419 
   419 
   420 <blockquote>Places the specified gear exactly at the position (x,y).
   420 <blockquote>Places the specified gear exactly at the position (x,y).
   421 </blockquote>
   421 </blockquote>
   422 === <tt>!SetGearVelocity(gearUid, dx, dy)</tt> (0.9.15) ===
   422 === <tt>!SetGearVelocity(gearUid, dx, dy)</tt> ===
   423 
   423 
   424 <blockquote>Gives the specified gear the velocity of dx, dy.
   424 <blockquote>Gives the specified gear the velocity of dx, dy.
   425 </blockquote>
   425 </blockquote>
   426 === <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> ===
   426 === <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> ===
   427 
   427 
   474 <code lang="lua">    function onGearAdd(gear)
   474 <code lang="lua">    function onGearAdd(gear)
   475         if (!GetGearType(gear) == gtHedgehog) and (!GetBotLevel(gear) > 0) then
   475         if (!GetGearType(gear) == gtHedgehog) and (!GetBotLevel(gear) > 0) then
   476             !SetEffect(gear, hePoisoned, true)
   476             !SetEffect(gear, hePoisoned, true)
   477         end
   477         end
   478     end</code>
   478     end</code>
   479 Notice: In 0.9.14 this function takes 0 or 1 instead of true/false.
   479 
   480 === <tt>CopyPV(gearUid, gearUid)</tt> ===
   480 === <tt>CopyPV(gearUid, gearUid)</tt> ===
   481 
   481 
   482 <blockquote>This sets the position and velocity of the second gear to the first one.
   482 <blockquote>This sets the position and velocity of the second gear to the first one.
   483 </blockquote>
   483 </blockquote>
   484 === <tt>CopyPV2(gearUid, gearUid)</tt> (deprecated) ===
   484 === <tt>CopyPV2(gearUid, gearUid)</tt> (deprecated) ===
   515 === <tt>!SetTag(gearUid, tag)</tt> ===
   515 === <tt>!SetTag(gearUid, tag)</tt> ===
   516 
   516 
   517 <blockquote>Sets the tag of the specified gear, different for every gear.
   517 <blockquote>Sets the tag of the specified gear, different for every gear.
   518 </blockquote>
   518 </blockquote>
   519 
   519 
   520 === <tt>!SetTimer(gearUid, timer)</tt> (0.9.14) ===
   520 === <tt>!SetTimer(gearUid, timer)</tt> ===
   521 
   521 
   522 <blockquote>Sets the timer of the specified gear. Also see !GetTimer.
   522 <blockquote>Sets the timer of the specified gear. Also see !GetTimer.
   523 </blockquote>
   523 </blockquote>
   524 
   524 
   525 === <tt>!SetHogLevel(gearUid)</tt> (0.9.16) ===
   525 === <tt>!SetHogLevel(gearUid)</tt> ===
   526 
   526 
   527 <blockquote>Sets the bot level from 0 to 5. 0 means human player.
   527 <blockquote>Sets the bot level from 0 to 5. 0 means human player.
   528 </blockquote>
   528 </blockquote>
   529 
   529 
   530 == Other Functions ==
   530 == Other Functions ==
   555 === <tt>!HideMission()</tt> ===
   555 === <tt>!HideMission()</tt> ===
   556 
   556 
   557 <blockquote>Hides the mission. This function is currently bugged somehow and will completely ruin your life, and your script should you happen to use it.
   557 <blockquote>Hides the mission. This function is currently bugged somehow and will completely ruin your life, and your script should you happen to use it.
   558 </blockquote>
   558 </blockquote>
   559 
   559 
   560 === <tt>!AddCaption(text)</tt> (0.9.14) ===
   560 === <tt>!AddCaption(text)</tt> ===
   561 
   561 
   562 <blockquote>Display event text in the upper part of the screen.
   562 <blockquote>Display event text in the upper part of the screen.
   563 </blockquote>
   563 </blockquote>
   564 
   564 
   565 === <tt>!MapHasBorder()</tt> ===
   565 === <tt>!MapHasBorder()</tt> ===
   575 === <tt>!PlaySound(soundId)</tt> ===
   575 === <tt>!PlaySound(soundId)</tt> ===
   576 
   576 
   577 <blockquote>Plays the specified sound.
   577 <blockquote>Plays the specified sound.
   578 </blockquote>
   578 </blockquote>
   579 
   579 
   580 === <tt>!PlaySound(soundId, gearUid)</tt> (0.9.15) ===
   580 === <tt>!PlaySound(soundId, gearUid)</tt> ===
   581 
   581 
   582 <blockquote>Plays the specified sound for the chosen hedgehog's team.
   582 <blockquote>Plays the specified sound for the chosen hedgehog's team.
   583 </blockquote>
   583 </blockquote>
   584 
   584 
   585 === <tt>!SetInputMask(mask)</tt> (0.9.15) ===
   585 === <tt>!SetInputMask(mask)</tt> ===
   586 
   586 
   587 <blockquote>Masks specified player input.
   587 <blockquote>Masks specified player input.
   588 </blockquote>
   588 </blockquote>
   589 Example: 
   589 Example: 
   590 <code lang="lua">    -- masks the long and high jump commands
   590 <code lang="lua">    -- masks the long and high jump commands
   592     -- clears input mask, allowing player to take actions
   592     -- clears input mask, allowing player to take actions
   593     SetInputMask(0xFFFFFFFF) 
   593     SetInputMask(0xFFFFFFFF) 
   594 		</code>
   594 		</code>
   595 Note: Using the input mask is an effective way to script uninterrupted cinematics, or create modes such as No Jumping. 
   595 Note: Using the input mask is an effective way to script uninterrupted cinematics, or create modes such as No Jumping. 
   596 
   596 
   597 === <tt>!SetZoom(zoomLevel)</tt> (0.9.14) ===
   597 === <tt>!SetZoom(zoomLevel)</tt> ===
   598 
   598 
   599 <blockquote>Sets the zoom level. The value for maximum zoom is currently 1.0 and for minimum 3.0 The default zoom level is 2.0
   599 <blockquote>Sets the zoom level. The value for maximum zoom is currently 1.0 and for minimum 3.0 The default zoom level is 2.0
   600 </blockquote>
   600 </blockquote>
   601 
   601 
   602 === <tt>!GetZoom()</tt> (0.9.14) ===
   602 === <tt>!GetZoom()</tt> ===
   603 
   603 
   604 <blockquote>Returns the current zoom level
   604 <blockquote>Returns the current zoom level
   605 </blockquote>
   605 </blockquote>
   606 
   606 
   607 === <tt>!GetRandom(number)</tt> (0.9.14) ===
   607 === <tt>!GetRandom(number)</tt> ===
   608 
   608 
   609 <blockquote>Returns a randomly generated number in the range of 0 to number - 1.  This random number uses the game seed, so is synchronised, and thus safe for multiplayer and saved games.  Use GetRandom for anything that could impact the engine state.  For example, a visual gear can use the Lua random, but adding a regular gear should use GetRandom.
   609 <blockquote>Returns a randomly generated number in the range of 0 to number - 1.  This random number uses the game seed, so is synchronised, and thus safe for multiplayer and saved games.  Use GetRandom for anything that could impact the engine state.  For example, a visual gear can use the Lua random, but adding a regular gear should use GetRandom.
   610 </blockquote>
   610 </blockquote>
   611 
   611 
   612 === <tt>!SetWind(windSpeed)</tt> (0.9.15) ===
   612 === <tt>!SetWind(windSpeed)</tt> ===
   613 
   613 
   614 <blockquote>Sets the current wind in the range of -100 to 100. Use together with gfDisableWind for full control.
   614 <blockquote>Sets the current wind in the range of -100 to 100. Use together with gfDisableWind for full control.
   615 </blockquote>
   615 </blockquote>
   616 
   616 
   617 === <tt>!GetDataPath()</tt> (0.9.15) ===
   617 === <tt>!GetDataPath()</tt> ===
   618 
   618 
   619 <blockquote>Returns the path to the data directory, used when adding libraries.
   619 <blockquote>Returns the path to the data directory, used when adding libraries.
   620 </blockquote>
   620 </blockquote>
   621 
   621 
   622 === <tt>!GetUserDataPath()</tt> (0.9.15) ===
   622 === <tt>!GetUserDataPath()</tt> ===
   623 
   623 
   624 <blockquote>Returns the path to the user data directory, used when adding libraries.
   624 <blockquote>Returns the path to the user data directory, used when adding libraries.
   625 </blockquote>
   625 </blockquote>
   626 
   626 
   627 === <tt>!GetClanColor(clan)</tt> (0.9.15) ===
   627 === <tt>!GetClanColor(clan)</tt> ===
   628 
   628 
   629 <blockquote>Returns the colour of the chosen clan by its number.
   629 <blockquote>Returns the colour of the chosen clan by its number.
   630 </blockquote>
   630 </blockquote>
   631 === <tt>!SetClanColor(clan, color)</tt> (0.9.15) ===
   631 === <tt>!SetClanColor(clan, color)</tt> ===
   632 
   632 
   633 <blockquote>Sets the colour of the chosen clan by its number.
   633 <blockquote>Sets the colour of the chosen clan by its number.
   634 </blockquote>
   634 </blockquote>
   635 
   635 
   636 === <tt>!PlaceGirder(x, y, state)</tt> (0.9.16) ===
   636 === <tt>!PlaceGirder(x, y, state)</tt> (0.9.16) ===
   652 <blockquote>Returns the currently selected [AmmoTypes Ammo Type].
   652 <blockquote>Returns the currently selected [AmmoTypes Ammo Type].
   653 </blockquote>
   653 </blockquote>
   654 
   654 
   655 == Debugging Functions ==
   655 == Debugging Functions ==
   656 
   656 
   657 === <tt>!WriteLnToConsole(string)</tt> (0.9.14) ===
   657 === <tt>!WriteLnToConsole(string)</tt> ===
   658 
   658 
   659 <blockquote>Writes (string) to the chat place, as if you had pressed t and typed it.
   659 <blockquote>Writes (string) to the chat place, as if you had pressed t and typed it.
   660 </blockquote>
   660 </blockquote>
   661 
       
   662 == Currently undocumented functions ==
       
   663 
       
   664 May only be available in -dev
       
   665 
       
   666 see http://hw.ercatec.net/docs/lua_wiki_check.php