Difference between revisions of "Category:Variables"

Jump to navigation Jump to search
269 bytes removed ,  14:33, 28 February 2011
Undo revision 46918 by JOG (Talk)
imported>JOG
(Correction: Globals always are floats. Local shorts or longs are longs, never floats.)
imported>DragoonWraith
(Undo revision 46918 by JOG (Talk))
Line 1: Line 1:
{{Update}}
{{Update}}


There are a few types of variables. Most store numbers, but the special [[Reference Variables]] stores pointers to objects in the game world so you can run functions on it later.
There are a few types of variables. Most store numbers, but the special [[Reference Variables]] stores something in the game world so you can run functions on it later.


Although you can [[Declaring_variables|declare a variable]] to be [[Short Integer|Short]] or [[Long Integer|Long]], both will be stored as [[Long Integer|Long]] when they're declared as local variables in scripts. (i.e. you can't save memory by using short instead of long).
Although you can [[Declaring_variables|declare a variable]] to be [[Short Integer|Short]], [[Long Integer|Long]], or [[Floating Point|Float]], all three will be stored like a [[Floating Point|float]].
 
 
[[Globals]], though, no matter whether declared as [[Short Integer|Short]], [[Long Integer|Long]] or [[Floating Point|Float]], will always be stored like a [[Floating Point|float]].


This is significant, as [[Floating Point|floats]] have accuracy issues at very high or very low values. When dealing with [[Short Integer|shorts]], this is irrelevant as their range is within the float's "accurate" range. On the other hand, [[Long Integer|longs]] may be expected to be accurate outside of the [[Floating Point|float]]'s range, and they will not be.
This is significant, as [[Floating Point|floats]] have accuracy issues at very high or very low values. When dealing with [[Short Integer|shorts]], this is irrelevant as their range is within the float's "accurate" range. On the other hand, [[Long Integer|longs]] may be expected to be accurate outside of the [[Floating Point|float]]'s range, and they will not be.


To illustrate, the sizes of numbers that should be storable in each type:
To illustrate, the sizes of numbers that should be storable in each type:

Navigation menu