--- a/LuaAPI.wiki Wed Dec 04 13:11:28 2013 +0000
+++ b/LuaAPI.wiki Wed Dec 04 15:45:28 2013 +0000
@@ -128,9 +128,9 @@
Example:
<code lang="lua"> function onGearDamage(gear, damage)
- if (!GetGearType(gear) == gtHedgehog) then
+ 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')
+ AddCaption(GetHogName(gear) .. ' took ' .. damage .. ' points of damage')
end
end</code>
=== <tt>onGearResurrect(gearUid) </tt> ===
@@ -262,8 +262,8 @@
</blockquote>
Example:
-<code lang="lua"> local gear = !AddGear(0, 0, gtTarget, 0, 0, 0, 0)
- !FindPlace(gear, true, 0, LAND_WIDTH)</code>
+<code lang="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> ===
@@ -272,7 +272,7 @@
Example:
<code lang="lua"> -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
- vgear = !AddVisualGear(1000, 1000, vgtExplosion, 0, false)
+ vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false)
</code>
=== <tt>!SpawnHealthCrate(x, y)</tt> ===
@@ -285,16 +285,16 @@
</blockquote>
Example:
-<code lang="lua"> !SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
- !SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
+<code lang="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> ===
<blockquote>Spawns an utility crate at specified position with content of ammoType.
</blockquote>
Example:
-<code lang="lua"> !SetAmmo(amLaserSight, 0, 0, 0, 1)
- !SpawnUtilityCrate(0, 0, amLaserSight)</code>
+<code lang="lua"> SetAmmo(amLaserSight, 0, 0, 0, 1)
+ SpawnUtilityCrate(0, 0, amLaserSight)</code>
=== <tt>!AddTeam(teamname, color, grave, fort, voicepack, flag)</tt> ===
<blockquote>Adds a new team. Note that this can only be done in onGameInit(), not at a later time. First argument is the team name followed by color, grave, fort, voicepack and flag settings.
@@ -303,7 +303,7 @@
Example:
-<code lang="lua"> !AddTeam("team 1", 14483456, "Simple", "Island", "Default", "hedgewars")</code>
+<code lang="lua"> AddTeam("team 1", 14483456, "Simple", "Island", "Default", "hedgewars")</code>
=== <tt>!AddHog(hogname, botlevel, health, hat)</tt> ===
<blockquote>Adds a new hedgehog for current team (last created one), with botlevel and specified health also head.
@@ -312,8 +312,8 @@
Example:
-<code lang="lua"> local player = !AddHog("HH 1", 0, 100, "!NoHat") -- botlevel 0 means human player
- !SetGearPosition(player, 1500, 1000)</code>
+<code lang="lua"> local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player
+ SetGearPosition(player, 1500, 1000)</code>
== Functions to get gear properties ==
=== <tt>!GetGearType(gearUid)</tt> ===
@@ -406,7 +406,7 @@
</blockquote>
Example:
-<code lang="lua"> !GetVisualGearValues(vgUid) -- return visual gear values
+<code lang="lua"> GetVisualGearValues(vgUid) -- return visual gear values
</code>
== Functions to modify gears ==
@@ -416,33 +416,33 @@
<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(...)
- !HideHog(gear) -- Hide the newly created gear.</code>
+<code lang="lua"> gear = AddGear(...)
+ HideHog(gear) -- Hide the newly created gear.</code>
=== <tt>!RestoreHog(gearUid)</tt> ===
<blockquote>Restores a previously hidden hedgehog.</blockquote>
Example:
-<code lang="lua"> gear = !AddGear(...)
- !HideHog(gear) -- Hide the newly created gear.
- !RestoreHog(gear) -- Restore the newly hidden gear.</code>
+<code lang="lua"> gear = AddGear(...)
+ HideHog(gear) -- Hide the newly created gear.
+ RestoreHog(gear) -- Restore the newly hidden gear.</code>
=== <tt>!DeleteGear(gearUid)</tt> ===
<blockquote>Deletes a Gear</blockquote>
Example:
-<code lang="lua"> gear = !AddGear(...)
- !DeleteGear(gear) -- Delete the newly created gear.</code>
+<code lang="lua"> gear = AddGear(...)
+ DeleteGear(gear) -- Delete the newly created gear.</code>
=== <tt>!DeleteVisualGear(vgUid)</tt> ===
<blockquote>Deletes a Visual Gear. Note, most visual gears delete themselves.</blockquote>
Example:
-<code lang="lua"> vgear = !AddVisualGear(...)
- !DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
+<code lang="lua"> vgear = AddVisualGear(...)
+ DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
=== <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint)</tt> ===
@@ -453,7 +453,7 @@
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.
- !SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff)
+ SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff)
</code>
=== <tt>!FindPlace(gearUid, fall, left, right, tryHarder) (0.9.16)</tt> ===
@@ -462,17 +462,17 @@
</blockquote>
Example:
-<code lang="lua"> gear = !AddGear(...)
- !FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH</code>
+<code lang="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> ===
<blockquote>Makes the specified gear say, think, or shout some text in a bubble.
</blockquote>
Example:
-<code lang="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 lang="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>
=== <tt>!HogTurnLeft(gearUid, boolean)</tt> ===
@@ -480,8 +480,8 @@
</blockquote>
Example:
-<code lang="lua"> !HogTurnLeft(!CurrentHedgehog, true) -- turns !CurrentHedgehog left
- !HogTurnLeft(!CurrentHedgehog, false) -- turns !CurrentHedgehog right</code>
+<code lang="lua"> HogTurnLeft(CurrentHedgehog, true) -- turns CurrentHedgehog left
+ HogTurnLeft(CurrentHedgehog, false) -- turns CurrentHedgehog right</code>
=== <tt>!SetGearPosition(gearUid, x, y)</tt> ===
<blockquote>Places the specified gear exactly at the position (x,y).
@@ -496,8 +496,8 @@
</blockquote>
Example:
-<code lang="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>
+<code lang="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> ===
<blockquote>Adds ammoType to the specified gear. The amount added is determined by the arguments passed via !SetAmmo() in the onAmmoStoreInit() event handler. In 0.9.16 ammo can be set directly via the optional third parameter, ammoCount. A value of 0 will remove the weapon, a value of 100 will give infinite ammo.
@@ -518,14 +518,14 @@
* (And more!)
<code lang="lua"> function onGearAdd(gear)
- if (!GetGearType(gear) == gtRCPlaane) then
- !SetHealth(gear, 10)
+ if (GetGearType(gear) == gtRCPlaane) then
+ SetHealth(gear, 10)
end
- if (!GetGearType(gear) == gtJetpack) then
- !SetHealth(gear, 1000)
+ if (GetGearType(gear) == gtJetpack) then
+ SetHealth(gear, 1000)
end
- if (!GetGearType(gear) == gtMine) then
- !SetHealth(gear, 0)
+ if (GetGearType(gear) == gtMine) then
+ SetHealth(gear, 0)
end
end</code>
@@ -539,8 +539,8 @@
Example: (sets all bots poisoned)
<code lang="lua"> function onGearAdd(gear)
- if (!GetGearType(gear) == gtHedgehog) and (!GetBotLevel(gear) > 0) then
- !SetEffect(gear, hePoisoned, true)
+ if (GetGearType(gear) == gtHedgehog) and (GetBotLevel(gear) > 0) then
+ SetEffect(gear, hePoisoned, true)
end
end</code>