These functions are used to determine or modify the scale of a reference. Any scale you can set must be within (exclusively) 0 and 10 (so you can set it beyond 0.5 and 2, contrary to what was written in the original description by Bethesda) (info by Mode Locrian). The above sample script can thus be used to set scale beyond the limits of what the TES CS itself allows.
Notes: You shouldn't call "setscale" in every frame, at least not in exteriors or other FPS-critical situations.
The scale will be reset to a value within the 0.5 - 2.0 frame when you reload. So don't use a done-flag to call it only once. Either call it regularly (about all 10 frames) or test for "getscale" and reset the scale when it doesn't fit:
if ( GetScale != 5 )
SetScale, 5
endif
Another way is to set it in a Tribunal or Bloodmoon start script. This can be done once, and will make sure the scale is set each time you load a game. (Forum info / JOG).
Sample script:
A more complex sample script by Bethesda shows how to grow and shrink an object.
When this script is placed on a reference, activating that reference gives the user the ability to change that reference’s scale.
Begin scalescript
short questionAsked
short button
float direction
float currscale
float tempscale
if ( MenuMode )
return
endif
if ( OnActivate == 1 )
if ( questionAsked == 0 )
MessageBox, "Make this object..." "...Grow" "...Shrink"