This is a child page. You can use Parent in the quick nav bar at the top or the bottom of the page to navigate directly back to the parent of this page. Some child pages are more than one level deep, and in that case will require more than one Parent click to reach the outermost document level. |
Sometimes a function just doesn't seem to work, though you've carefully checked the parameters. But — did you remember to assign the function to a value? All functions return a value, though most simply return zero. So if you write a line like this:
...you simply get an error, even though the function is set up right. You have to write it like this:
...so that the function has somewhere to put the returned value.
Now, commands don't return a value. How do you tell the difference? Easy: Commands don't use parenthesis to contain the parameters, if there are any parameters. This is a command:
...and so is this:
...but this is a function:
...and because it is a function, you must assign the result to a value.
This usually happens because values you intended to make a complete loop were calculated using TPOS() instead of TLPOS().
TLPOS() is designed to generate values that almost loop; you don't really want the last frame to be the same as the first frame, you just want it to be almost the same so that when the first frame comes around again, it'll naturally follow the last frame. If the last frame is the same as the first frame (which is what happens with a rotation of 360 and 0, for instance), then all frames are different except those two - so one frame appears for twice the time you expect, and you get a "jerk". Just use TLPOS(360) instead of TPOS(360)and the last frame will be just what you want.
This:
...results in "5", instead of "9".
That's because although commands and functions are not case-sensitive, variable names are. "A" is not the same as "a"! You have to write it like this:
...or maybe like this:
...or this: