--- a/LuaAPI.wiki Wed Dec 03 05:43:29 2014 +0000
+++ b/LuaAPI.wiki Wed Dec 03 05:47:58 2014 +0000
@@ -17,7 +17,7 @@
=== Tutorial missions ===
-Tutorial missions are located within text files inside "share/hedgewars/Data/Missions/Training". The game will list all files with the lua extension inside this directory in the Training selection screen. You'll find some premade example scripts within this directory that contain several comments on the script lines and what they do.
+Tutorial missions are located within text files inside "share/hedgewars/Data/Missions/Training". The game will list all files with the lua extension inside this directory in the Training selection screen. You'll find some premade example scripts within this directory that contain several comments on the script lines and what they do./
=== Special maps ===
@@ -131,7 +131,7 @@
Example:
-<code lang="lua"> function onGearDamage(gear, damage)
+<code language="lua"> function onGearDamage(gear, damage)
if (GetGearType(gear) == gtHedgehog) then
-- adds a message saying, e.g. "Hoggy H took 25 points of damage"
AddCaption(GetHogName(gear) .. ' took ' .. damage .. ' points of damage')
@@ -300,7 +300,7 @@
</blockquote>
Example:
-<code lang="lua"> local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
+<code language="lua"> local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
FindPlace(gear, true, 0, LAND_WIDTH)</code>
=== <tt>!AddVisualGear(x, y, visualGearType, state, critical)</tt> ===
@@ -309,7 +309,7 @@
</blockquote>
Example:
-<code lang="lua"> -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
+<code language="lua"> -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false)
</code>
@@ -323,7 +323,7 @@
</blockquote>
Example:
-<code lang="lua"> SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
+<code language="lua"> SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
=== <tt>!SpawnUtilityCrate(x, y, ammoType)</tt> ===
@@ -331,7 +331,7 @@
</blockquote>
Example:
-<code lang="lua"> SetAmmo(amLaserSight, 0, 0, 0, 1)
+<code language="lua"> SetAmmo(amLaserSight, 0, 0, 0, 1)
SpawnUtilityCrate(0, 0, amLaserSight)</code>
=== <tt>!SpawnFakeAmmoCrate(x, y, explode, poison) </tt> ===
@@ -343,7 +343,7 @@
Example:
-<code lang="lua">SpawnFakeAmmoCrate(500, 432, false, false) -- Spawns a fake ammo crate at the coordinates (500, 434) without explosion and poison.
+<code language="lua">SpawnFakeAmmoCrate(500, 432, false, false) -- Spawns a fake ammo crate at the coordinates (500, 434) without explosion and poison.
</code>
=== <tt>!SpawnFakeHealthCrate(x, y, explode, poison) </tt> ===
@@ -369,7 +369,7 @@
Example:
-<code lang="lua"> local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player
+<code language="lua"> local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player
SetGearPosition(player, 1500, 1000)</code>
== Functions to get gear properties ==
@@ -491,7 +491,7 @@
</blockquote>
Example:
-<code lang="lua"> GetVisualGearValues(vgUid) -- return visual gear values
+<code language="lua"> GetVisualGearValues(vgUid) -- return visual gear values
</code>
== Functions to modify gears ==
@@ -501,7 +501,7 @@
<blockquote>Removes a hedgehog from the map. The hidden hedgehog can be restored with !RestoreHog(gearUid). The current hedgehog cannot be hidden!</blockquote>
Example:
-<code lang="lua"> gear = AddGear(...)
+<code language="lua"> gear = AddGear(...)
HideHog(gear) -- Hide the newly created gear.</code>
=== <tt>!RestoreHog(gearUid)</tt> ===
@@ -509,7 +509,7 @@
<blockquote>Restores a previously hidden hedgehog.</blockquote>
Example:
-<code lang="lua"> gear = AddGear(...)
+<code language="lua"> gear = AddGear(...)
HideHog(gear) -- Hide the newly created gear.
RestoreHog(gear) -- Restore the newly hidden gear.</code>
@@ -518,7 +518,7 @@
<blockquote>Deletes a Gear</blockquote>
Example:
-<code lang="lua"> gear = AddGear(...)
+<code language="lua"> gear = AddGear(...)
DeleteGear(gear) -- Delete the newly created gear.</code>
=== <tt>!DeleteVisualGear(vgUid)</tt> ===
@@ -526,7 +526,7 @@
<blockquote>Deletes a Visual Gear. Note, most visual gears delete themselves.</blockquote>
Example:
-<code lang="lua"> vgear = AddVisualGear(...)
+<code language="lua"> vgear = AddVisualGear(...)
DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
@@ -537,7 +537,7 @@
</blockquote>
Example:
-<code lang="lua"> -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red.
+<code language="lua"> -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red.
SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff)
</code>
@@ -547,7 +547,7 @@
</blockquote>
Example:
-<code lang="lua"> gear = AddGear(...)
+<code language="lua"> gear = AddGear(...)
FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH</code>
=== <tt>!HogSay(gearUid, text, manner)</tt> ===
@@ -555,7 +555,7 @@
</blockquote>
Example:
-<code lang="lua"> HogSay(CurrentHedgehog, "I wonder what to do...", SAY_THINK) -- thought bubble with text
+<code language="lua"> HogSay(CurrentHedgehog, "I wonder what to do...", SAY_THINK) -- thought bubble with text
HogSay(CurrentHedgehog, "I'm hungry...", SAY_SAY) -- speech bubble with text
HogSay(CurrentHedgehog, "I smell CAKE!", SAY_SHOUT) -- exclamatory bubble with text
</code>
@@ -565,7 +565,7 @@
</blockquote>
Example:
-<code lang="lua"> HogTurnLeft(CurrentHedgehog, true) -- turns CurrentHedgehog left
+<code language="lua"> HogTurnLeft(CurrentHedgehog, true) -- turns CurrentHedgehog left
HogTurnLeft(CurrentHedgehog, false) -- turns CurrentHedgehog right</code>
=== <tt>!SetGearPosition(gearUid, x, y)</tt> ===
@@ -581,7 +581,7 @@
</blockquote>
Example:
-<code lang="lua"> SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
+<code language="lua"> SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code>
=== <tt>!AddAmmo(gearUid, ammoType, ammoCount) (0.9.16) </tt> ===
@@ -602,7 +602,7 @@
* Setting all the mines to duds.
* (And more!)
-<code lang="lua"> function onGearAdd(gear)
+<code language="lua"> function onGearAdd(gear)
if (GetGearType(gear) == gtRCPlaane) then
SetHealth(gear, 10)
end
@@ -624,7 +624,7 @@
</blockquote>
Example: (sets all bots poisoned)
-<code lang="lua"> function onGearAdd(gear)
+<code language="lua"> function onGearAdd(gear)
if (GetGearType(gear) == gtHedgehog) and (GetBotLevel(gear) > 0) then
SetEffect(gear, hePoisoned, 1)
end
@@ -659,7 +659,7 @@
<b>Example:</b>
-<code lang="lua">
+<code language="lua">
AddAmmo(CurrentHedgehog, amBazooka, 1) -- give the CurrentHedgehog a bazooka
SetWeapon(amBazooka) -- select the Bazooka.</code>
</blockquote>
@@ -825,7 +825,7 @@
<blockquote>Masks specified player input.
</blockquote>
Example:
-<code lang="lua"> -- masks the long and high jump commands
+<code language="lua"> -- masks the long and high jump commands
SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump)))
-- clears input mask, allowing player to take actions
SetInputMask(0xFFFFFFFF)
@@ -851,7 +851,7 @@
Example:
-<code lang="lua"> AddTeam("team 1", 0xDD0000, "Simple", "Island", "Default", "hedgewars")</code>
+<code language="lua"> AddTeam("team 1", 0xDD0000, "Simple", "Island", "Default", "hedgewars")</code>
==== <tt>!DismissTeam(teamname)</tt> ====
Removes the team with the given team name from the game.
@@ -920,9 +920,9 @@
Loads a script (i.e. a [LuaLibraries library]) from the specified `scriptPath`. The root directory is here Hedgewars’ data directory.
Example:
-{{{
+<code language="lua">
HedgewarsScriptLoad("/Scripts/Locale.lua") -- loads locale library
-}}}
+</code>
=== <tt>!GetDataPath()</tt> ===
@@ -944,7 +944,7 @@
<b>Examples:</b>
-<code lang="lua">
+<code language="lua">
-- will automatically change the health icon to a star
SendStat(siGraphTitle,'Custom Graph Title')
SendStat(siGameResult,'Winner is Team A!')