Difference between revisions of "Category:Variables"
Jump to navigation
Jump to search
Correction: Globals always are floats. Local shorts or longs are longs, never floats.
imported>Bruneauinfo m (added a See Also section as well as a reference to a OBSE array article) |
imported>JOG (Correction: Globals always are floats. Local shorts or longs are longs, never floats.) |
||
Line 1: | Line 1: | ||
{{Update}} | {{Update}} | ||
There are a few types of variables. Most store numbers, but the special [[Reference Variables]] stores | 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. | ||
Although you can [[Declaring_variables|declare a variable]] to be [[Short Integer|Short]], [[Long Integer|Long]], or [[Floating Point|Float]], | 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). | ||
[[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: |