Update SetVisualGearValues
authoralmikes@aol.com
Sun, 25 Jan 2015 20:37:53 +0000
changeset 552 27add396065d
parent 551 67b079768796
child 553 5faf837d73e5
Update SetVisualGearValues
LuaAPI.wiki
--- a/LuaAPI.wiki	Sat Jan 24 04:14:40 2015 +0000
+++ b/LuaAPI.wiki	Sun Jan 25 20:37:53 2015 +0000
@@ -503,8 +503,8 @@
 
 === <tt>!GetVisualGearValues(vgUid)</tt> ===
 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.
+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:
@@ -555,8 +555,17 @@
 Example:
 
 <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>
+    SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff)</code>
+
+Beginning from 0.9.21-dev, the 2nd to 11th arguments are optional. Any such argument which is declared as `nil` will not overwrite the corresponding value of the visual gear. With this change, it is not required anymore to call `GetVisualGearValues` beforehand.
+
+Examples:
+
+<code language="lua">  -- set a circle to position 1000,1000
+    SetVisualGearValues(circleUid, 1000, 1000)</code>
+<code language="lua">  -- set the color of a circle to bright red.
+    SetVisualGearValues(circleUid, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xff0000ff)</code>
+
 
 === <tt>!FindPlace(gearUid, fall, left, right, tryHarder) (0.9.16)</tt> ===
 Finds a place for the specified gear between x=`left` and x=`right` and places it there. 0.9.16 adds an optional fifth parameter, `tryHarder`. Setting to `true`/`false` will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other.