# HG changeset patch # User almikes@aol.com # Date 1417623455 0 # Node ID 861e9e89e19cc9f4c558f5a06d5bec1e4bfad410 # Parent a7d34a3e5786c7ab6d4136e241f35afe41843e88 Update SetTag, add GetTag. diff -r a7d34a3e5786 -r 861e9e89e19c LuaAPI.wiki --- a/LuaAPI.wiki Wed Dec 03 06:45:26 2014 +0000 +++ b/LuaAPI.wiki Wed Dec 03 16:17:35 2014 +0000 @@ -467,6 +467,24 @@
returns the message of the gear.
+ +=== !GetTag(gearUid) === + +Returns the tag of the specified gear (by `gearUid`). + +A “tag” of a gear is simply an extra variable to modify misc. things. The meaning of a tag depends on the gear type. For example, for gtBall gears, it specifies the ball color, for gtAirAttack gears (airplane) it specifies the direction of the plane, etc. `tag` has to be an integer. + +Note that the word “tag” here does _not_ refer to the name and health tags you see above hedgehogs, this is something different. + + +-- This adds a ball (the one from the ballgun) at (123, 456): +ball = AddGear(123, 456, gtBall, 0, 0, 0, 0) +-- The tag of a ball defines its color. It will automatically chosen at random when created. +colorTag = GetTag(ball) +-- Now colorTag stores the tag of ball (in this case a number denoting its color) + + + === !GetFollowGear() ===
Returns the uid of the gear that is currently being followed. @@ -706,8 +724,18 @@ === !SetTag(gearUid, tag) === -
Sets the tag of the specified gear, different for every gear. -
+Sets the tag of the specified gear (by `gearUid`). A “tag” of a gear is simply an extra variable to modify misc. things. The meaning of a tag depends on the gear type. For example, for gtBall gears, it specifies the ball color, for gtAirAttack gears (airplane) it specifies the direction of the plane, etc. `tag` has to be an integer. + +Note that the word “tag” here does _not_ refer to the name and health tags you see above hedgehogs, this is something different. + + +-- This adds a ball (the one from the ballgun) at (123, 456): +ball = AddGear(123, 456, gtBall, 0, 0, 0, 0) +-- This sets the tag of the gear. For gtBall, the tag specified the color. “8” is the color white. +SetTag(ball, 8) -- + + +Extensive documentation on what the different tags for gear types mean is still pending. === !SetTimer(gearUid, timer) ===