Passing var value from rollout to macro script
I'm having a problem with a script I wrote. My main script is a macro script which I have assigned to a keyboard shorcut. The other script is a simple rollout with a pickbutton which stores an object in a global variable.
My macroscript should be able to read this global variable, but it only happens if I open a macro editor and evaluate an entire script (instead just using a shortcut). Otherwise it will just keep reporting undefined.
Once the macroscript is evaluated in script editor, I can use the pickbutton in the rollout to change the picked object and macroscript will respond correctly when activated by a keyboard shortcut.
Why does it work only if evaluated once an object is picked? Is there a way around it?
Many thanks in advance for any help or suggestions!
Finally found a solution that made my script "usable"! I've added:
at the beginning of the UI part, so a macro script gets automatically run every time a UI is started.