Fixed Value

From Mario Fan Games Galaxy Wiki
Revision as of 21:09, 21 December 2015 by VinnyVideo (talk | contribs) (Removed the merge tag; this Click-specific page should definitely not be merged with the general "data types" article)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A Fixed Value is an integer value that is unique to an object in MMF/TGF, and used to reference that specific object instance. Some expressions of MMF/TGF and their extensions require a fixed value as an argument, so they can affect only that object.

Technical Information

Note: this info was found through experimentation in MMF2/TGF2; it may be different for other Click products

  • Fixed values are assigned during runtime; they do not (as is) exist during edittime
  • When MMF/TGF initially populates the frame with objects, it assigns fixed values to objects based on their z-order, from back to front. Afterwards, objects are assigned the next fixed value as they are created.
  • The first assigned fixed value is 65536
  • Each fixed value is 65537 (yes, 65537) greater than the one previously assigned, and appears to stay constant regardless of how large (data-wise) the object is
  • When an object is destroyed, its former fixed value is not reused by new objects
  • Fixed values are stored as signed 32-bit integers, meaning they range from 0 -> 2,147,483,647 -> -2,147,483,648 -> 0
  • The 65537 increment ensures that should fixed values overflow into negative and make it back into positive (which requires tens of thousands of create-delete cycles), they'll be offset and generally won't repeat already used values (repeats are still possible if you have an extremely old object and go through literally millions of create-delete cycles)

As fixed values are not always easy to work with, another method of assigning a unique value to an object is by spreading a value.