diff -r 70961d4eef05 -r 5aa55bbe4b73 LuaAPI.wiki --- 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: - function onGearDamage(gear, damage) + 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 @@ Example: - local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) + local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) FindPlace(gear, true, 0, LAND_WIDTH) === !AddVisualGear(x, y, visualGearType, state, critical) === @@ -309,7 +309,7 @@ Example: - -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created. + -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created. vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false) @@ -323,7 +323,7 @@ Example: - SetAmmo(amGrenade, 0, 0, 0, 1) -- see below + SetAmmo(amGrenade, 0, 0, 0, 1) -- see below SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map === !SpawnUtilityCrate(x, y, ammoType) === @@ -331,7 +331,7 @@ Example: - SetAmmo(amLaserSight, 0, 0, 0, 1) + SetAmmo(amLaserSight, 0, 0, 0, 1) SpawnUtilityCrate(0, 0, amLaserSight) === !SpawnFakeAmmoCrate(x, y, explode, poison) === @@ -343,7 +343,7 @@ Example: -SpawnFakeAmmoCrate(500, 432, false, false) -- Spawns a fake ammo crate at the coordinates (500, 434) without explosion and poison. +SpawnFakeAmmoCrate(500, 432, false, false) -- Spawns a fake ammo crate at the coordinates (500, 434) without explosion and poison. === !SpawnFakeHealthCrate(x, y, explode, poison) === @@ -369,7 +369,7 @@ Example: - local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player + local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player SetGearPosition(player, 1500, 1000) == Functions to get gear properties == @@ -491,7 +491,7 @@ Example: - GetVisualGearValues(vgUid) -- return visual gear values + GetVisualGearValues(vgUid) -- return visual gear values == Functions to modify gears == @@ -501,7 +501,7 @@
Removes a hedgehog from the map. The hidden hedgehog can be restored with !RestoreHog(gearUid). The current hedgehog cannot be hidden!
Example: - gear = AddGear(...) + gear = AddGear(...) HideHog(gear) -- Hide the newly created gear. === !RestoreHog(gearUid) === @@ -509,7 +509,7 @@
Restores a previously hidden hedgehog.
Example: - gear = AddGear(...) + gear = AddGear(...) HideHog(gear) -- Hide the newly created gear. RestoreHog(gear) -- Restore the newly hidden gear. @@ -518,7 +518,7 @@
Deletes a Gear
Example: - gear = AddGear(...) + gear = AddGear(...) DeleteGear(gear) -- Delete the newly created gear. === !DeleteVisualGear(vgUid) === @@ -526,7 +526,7 @@
Deletes a Visual Gear. Note, most visual gears delete themselves.
Example: - vgear = AddVisualGear(...) + vgear = AddVisualGear(...) DeleteVisualGear(vgear) -- Delete the newly created visual gear. @@ -537,7 +537,7 @@ Example: - -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red. + -- 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) @@ -547,7 +547,7 @@ Example: - gear = AddGear(...) + gear = AddGear(...) FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH === !HogSay(gearUid, text, manner) === @@ -555,7 +555,7 @@ Example: - HogSay(CurrentHedgehog, "I wonder what to do...", SAY_THINK) -- thought bubble with text + 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 @@ -565,7 +565,7 @@ Example: - HogTurnLeft(CurrentHedgehog, true) -- turns CurrentHedgehog left + HogTurnLeft(CurrentHedgehog, true) -- turns CurrentHedgehog left HogTurnLeft(CurrentHedgehog, false) -- turns CurrentHedgehog right === !SetGearPosition(gearUid, x, y) === @@ -581,7 +581,7 @@ Example: - SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players + 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 === !AddAmmo(gearUid, ammoType, ammoCount) (0.9.16) === @@ -602,7 +602,7 @@ * Setting all the mines to duds. * (And more!) - function onGearAdd(gear) + function onGearAdd(gear) if (GetGearType(gear) == gtRCPlaane) then SetHealth(gear, 10) end @@ -624,7 +624,7 @@ Example: (sets all bots poisoned) - function onGearAdd(gear) + function onGearAdd(gear) if (GetGearType(gear) == gtHedgehog) and (GetBotLevel(gear) > 0) then SetEffect(gear, hePoisoned, 1) end @@ -659,7 +659,7 @@ Example: - + AddAmmo(CurrentHedgehog, amBazooka, 1) -- give the CurrentHedgehog a bazooka SetWeapon(amBazooka) -- select the Bazooka. @@ -825,7 +825,7 @@
Masks specified player input.
Example: - -- masks the long and high jump commands + -- 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: - AddTeam("team 1", 0xDD0000, "Simple", "Island", "Default", "hedgewars") + AddTeam("team 1", 0xDD0000, "Simple", "Island", "Default", "hedgewars") ==== !DismissTeam(teamname) ==== 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: -{{{ + HedgewarsScriptLoad("/Scripts/Locale.lua") -- loads locale library -}}} + === !GetDataPath() === @@ -944,7 +944,7 @@ Examples: - + -- will automatically change the health icon to a star SendStat(siGraphTitle,'Custom Graph Title') SendStat(siGameResult,'Winner is Team A!')