diff -r 123cc75cbe6a -r 45a576e56425 LuaAPI.wiki --- a/LuaAPI.wiki Sun Nov 21 16:01:30 2010 +0000 +++ b/LuaAPI.wiki Sat Dec 04 20:09:56 2010 +0000 @@ -1,3 +1,4 @@ +#labels 80 == Global available Constants == @@ -78,6 +79,16 @@ local gear = !AddGear(0, 0, gtTarget, 0, 0, 0, 0) !FindPlace(gear, true, 0, LAND_WIDTH) + +=== !AddVisualGear(x, y, viusalGearType, state, critical) === + +
This creates a new visual gear at position x,y (measured from top left) of kind visualGearType (see [visualGearTypes Visual Gear Types]). The function returns the uid of the visual gear created. Set critical to true if the visual gear is crucial to game play. False if it is just an effect, and can be skipped when in fastforward (such as when joining a room). A critical visual gear will always be created, a non-critical one may fail. Most visual gears delete themselves. +
+Example: + + vgear = !AddVisualGear(1000, 1000, vgtExplosion, 0, false) -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created. + + === !SpawnHealthCrate(x, y) (0.9.14) ===
Spawns a health crate at the specified position. @@ -167,8 +178,48 @@
returns the bot level from 0 to 5. 0 means human player.
+ +=== !GetVisualGearValues(vgUid) === + +
This returns the typically set visual gear values, useful if manipulating things like smoke or bubbles or circles. It returns the following values: +X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint +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. +Most visual gears require little to no modification of parameters. +
+Example: + + !GetVisualGearValues(vgUid) -- return visual gear values + + == Functions to modify gears == +=== !DeleteGear(gearUid) === + +
Deletes a Gear
+Example: + + gear = !AddGear(…) + !DeleteGear(gear) -- Delete the newly created gear. + +=== !DeleteVisualGear(vgUid) === + +
Deletes a Visual Gear. Note, most visual gears delete themselves.
+Example: + + vgear = !AddVisualGear(…) + !DeleteVisualGear(vgear) -- Delete the newly created visual gear. + + +=== !SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint) === + +
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. +Most visual gears require little to no modification of parameters. +
+Example: + + !SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff) -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red. + + === !FindPlace(gearUid, fall, left, right) ===
Finds a place for the specified gear between x=left and x=right and places it there.