In this context, the "duration of the script" pertains to any particular activity that has been initiated -- whether a remote event or a popup menu or a timer firing or a typed out /alias.
Not to be confused with "script file." There are no script-file scope variables, yet.
Local variables die within a child alias when it returns to its parent alias/event, or when the top-level alias/event reaches its end or is prematurely /returned or /halted, etc. That's what we're calling a "script finished."
If you need a variable to survive from child to parent, you can use binary variables, or hash table entries, or global variables. A global variable /set -u0 %name data will automatically unset when the top-level alias/event has terminated. You can name temporary global variables within an event with that event's unique $eventid to avoid collisions. You can use this same trick with /hadd -u0 for self-destructing hash table entries. Binary variables are global in nature, in that they transcend parent to child to parent, but automatically self-destruct when an alias/event finishes.
Last edited by Raccoon; 19/10/18 06:23 AM. Reason: last paragraph: binary variables are global in nature, in that they...