View Single Post
Old 27th October 2013, 15:56   #4  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
EDIT: This post is outdated because the initialization is now included in the full example above.

And don't forget: It is dangerous/buggy to define global vars for RTE functions at global script level like it was usual all the time:

...
global RTE_myVar = 0
...

since no such variable without appended index will exist any more, and the really existing ones remain undefined.

To stay indeppendent from number of instances, maybe better style to define inside RTE, after check that they're undefined:
Code:
GScriptClip("""
    ...
    try { __ = RTE_myVar%%%%%% } catch(err) { global RTE_myVar%%%%%% = 0 }
    ...
    first use of RTE_myVar%%%%%% in RTE
    ...
""", local=true)
If you know what you do, you may define a whole bunch in one catch block (faster), or you may check each var separately.

Last edited by martin53; 27th October 2013 at 20:01. Reason: reference to init in post above
martin53 is offline   Reply With Quote