Posted by member 99 on 2004-07-08 13:02:40 link

scripting + threading = race conditions.

If you're not using NetLoadModule, do so, or load those other modules from *script start like tnl suggests. Actually, I'm not sure whether or not !reloadmodules from a threaded module will force things to load sequencially... but at least you'd know that they won't load until mzscript is done. NLM forces things to load in order, even if NLM itself is threaded (er, I think).

Otherwise, make sure the script will work even if it is called too late. eg, if 3 icons are added quickly, your OnAdd script may be called (3 times) only after vtray's vars have been updated for all of them. Similarly for any bangs you call from inside mzscript. (except things that stay entirely within mzscript, like !varset)

Order should still be the same though, so if you get an add and a del, the OnAdd and OnDel scripts should be executed in order, but the tray's vars may have already been updated for OnDel by the time OnAdd gets executed.