Take a look at this:
frontdoor_trigger1
{
spawn
{
accum 5 set 1 // Initial state is down
wait 500 // Wait for everything to settle
trigger frontdoor_trigger1 main // Open front door of complex initially
}
trigger main
{
globalaccum 1 abort_if_not_equal 0
trigger frontdoor_trigger1 up
trigger frontdoor_trigger1 down
}
trigger up
{
accum 5 abort_if_not_equal 1 // Ready to run up routine == 1
resetscript // return to trigger that called it
trigger frontdoor_lever1 up
accum 5 set 0 // Setup accum for up routine
}
trigger down
{
accum 5 abort_if_not_equal 0 // Ready to run down routine == 0
resetscript // return to trigger that called it
trigger frontdoor_lever1 down
accum 5 set 1 // Setup accum for up routine
}
}
It’s a section from battery.script. I am particularly interested in the trigger up routine…
trigger up
{
accum 5 abort_if_not_equal 1 // Ready to run up routine == 1
resetscript // return to trigger that called it
trigger frontdoor_lever1 up
accum 5 set 0 // Setup accum for up routine
}
If you notice, the function startes by saying it should abort the function if an accum is not set to 1. This is the opened/closed state of the door and makes sense to me. But then there’s the resetscript call with the note saying it’s returning to the trigger calling it. Obviously it doesn’t do this or otherwise the door would never open, so can someone coughbobcough give me a detailed, not laymens defintion, but in fact using detailed programmer jargon explanation of exactly what resetscript does and why it’s in the door script like that.
