Page 1 of 1
Open Stack script
Posted: Mon Mar 15, 2010 3:18 am
by Glenn Boyce
I have an openStack script that runs when I open a substack. I only want it to work when the main stack opens. How do I limit it to working just with the main stack?
cheers
Glenn
Re: Open Stack script
Posted: Mon Mar 15, 2010 4:09 am
by Regulae
The following should work in your mainstack script:
Code: Select all
on openStack
if the short name of this stack = "MainStackName" then
-- the specific instructions you want
pass openStack
end if
end openStack
... “MainStackName” of course being the name you gave your main stack. The “pass openStack” is perhaps worth including if later you want to add instructions which only execute when opening substacks, e.g.:
Code: Select all
on openStack
if the short name of this stack = "MainStackName" then
-- the specific instructions you want
pass openStack
end if
-- instruction when opening substack
-- instruction when opening substack
end openStack
Regards,
Michael
Re: Open Stack script
Posted: Mon Mar 15, 2010 7:02 am
by Glenn Boyce
Many thanks
Re: Open Stack script
Posted: Mon Mar 15, 2010 1:48 pm
by Klaus
Hi Glenn,,
you can also put the "openstack" and "preopenstack" handlers into the script of the first card of that (main-) stack!
This way only the mainstack will get these messages (which do also get sent to the first card of the stack!).
Best
Klaus
Re: Open Stack script
Posted: Mon Mar 15, 2010 3:03 pm
by FourthWorld
Klaus wrote:you can also put the "openstack" and "preopenstack" handlers into the script of the first card of that (main-) stack!
This way only the mainstack will get these messages (which do also get sent to the first card of the stack!).
That's what I do. It's simpler than adding an IF condition, and keeps initialization handlers limited to a single script that can't interfere with anything else.
Re: Open Stack script
Posted: Mon Mar 15, 2010 5:10 pm
by Regulae
Once again I learn something new. The Rev forum is both an education and an inspiration.
Cheers,
Michael