Good to see. Feel free to use my modstat/setstat info (I PMed).
Other thoughts:
It'd be nice to include some more info on scripting limits, e.g.
Maximum of 255 instructions (not lines) within an IF...ENDIF block or WHILE...ENDWHILE block.Blanks / comments don't count, but some lines become two instructions, for example I think this is two:
Set anotherScript.someVariable to ( actorID->GetStrength )
Nesting While loops does not work [EDIT: NOT CORRECT - there must have been something else wrong]
Advise that (in general) reducing the number of scripts running improves efficiency more than reducing the complexity of individual scripts.So, for example, if two short global scripts will always run at the same time, it makes sense to combine them.
Or if you've got a few global scripts which only need to run based on some check, it makes sense to place the checks in one "parent" script, and startscript the others from there when they need to run (remembering to ensure to run them once per game session if they need to conserve variable values).
The extra overhead of starting and stopping the child scripts is insignificant compared to the saving through putting all the checks in one script. (although startscripting can cause other scripts to run more than once in a frame, that should be less of an issue when the script doing the startscripting has been running for a long time - so is likely near the start of the script queue. This is because only scripts earlier in the queue than the calling script will be run twice. [at least I think this makes sense ??? - correct me if I'm wrong]).
34th variable bugThe 34th variable of a given type (e.g. float) in a script can be confused with a double-quote character by the compiler (under some circumstances). This can lead to a load of weird issues (and adding messageboxes to detect the problem can fix/change the problem - until you remove them, of course

).
Declaring the 34th variable of a given type as e.g.:
float UNUSED
should avoid trouble (clearly you don't use it

).
Personally I've found that using many more than 34 shorts is fine, while floats cause trouble. Others have reported trouble with shorts too.
A script to check (NOT always correctly) for scripts being run multiple times in one frame:(Taken from the "soon"-to-be-released new version of GCD)
Clearly it'd be best to put this sort of script in a utility mod of some sort which every user should use. That way other mods can simply include and check the e.g. UTIL_FrameNotChanged variable, rather than putting in another copy of the same script.
This could go for various other commonly required checks too, e.g. finding the current, maximum, and ratio of health/magicka/fatigue where there aren't direct functions to calculate these. The checks could be performed once per frame in one fairly large script which updates some globals. Any mod then wanting e.g. the ratio of current fatigue to maximum fatigue, could simply use a getFatigueRatio global, rather than do the calculations.
This sort of thing could (theoretically) be simpler and more efficient than the current every-modder-for-himself approach. However, it would have been most important a few years ago (unless anyone fancies rewriting half the mods in existence).
It's a thought in any case

.
CODE
Begin Gals_NewFrameCheck
;this script sets the Gals_FrameNotChanged global variable to 1 if the
;frame is *probably* the same. So where startscript commands would
;cause scripts to run many times in one frame, they can return if Gals_FrameNotChanged == 1.
float oldGameHour
float oldSecondsPassed
short constantFrameRateTimeout
;by default, assume this is a new frame
Set Gals_FrameNotChanged to 0
;when not in menu, check GameHour - if it's not increasing (it's a float), we're in the same frame.
;(if some nutter has stopped time, use the GetSecondsPassed check below instead.)
if ( menumode == 0 )
if ( TimeScale != 0 )
if ( oldGameHour == GameHour )
Set Gals_FrameNotChanged to 1
else
Set oldGameHour to GameHour
endif
return
endif
endif
;When in menu, assume we're in the same frame if GetSecondsPassed returns the same as last time.
;This only usually works - sometimes GetSecondsPassed will happen to be the same two frames in a row.
;It's possible that constant framerates might lead to GetSecondsPassed returning the same value repeatedly.
;[this could happen for very low framerates, (GSP never returns > 0.2), or high capped framerates].
;For this reason, if the same value is returned 20 times in a row, the frame is assumed to have changed.
;So, when in menu, the Gals_FrameNotChanged variable is a good indicator, but can be wrong in both directions.
if ( GetSecondsPassed == oldSecondsPassed )
Set constantFrameRateTimeout to ( constantFrameRateTimeout + 1 )
if ( constantFrameRateTimeout == 20 )
Set constantFrameRateTimeout to 0
else
Set Gals_FrameNotChanged to 1
endif
else
Set oldSecondsPassed to GetSecondsPassed
Set constantFrameRateTimeout to 0
endif
End Gals_NewFrameCheck
Then this can be added to any script which shouldn't be run more than once in a frame:
CODE
;-------------------------------------------------------------
;Don't run twice in the same frame
;-------------------------------------------------------------
if ( Gals_FrameNotChanged == 1 )
return
endif
;-------------------------------------------------------------
That's all I can think of at the moment.