Ok what I want is a switch: it either enables something or disables it. And while the thing is disabled, you shouldn’t be able to disable it again…
What I want to use is: a script that triggers 2 events. Both have an accum check in the first line, and only 1 can get executed completely.
In the map I have a func_invisible_user targeting a target_script_trigger which works fine. So when the user uses the func_invisible_user it activates the script_trigger which fires the “used” scriptblock.
This is the script:
radio01
{
spawn
{
wait 150
accum 7 set 1
disablespeaker sd_abradiooff
enablespeaker sd_abradioon
}
trigger used
{
enablespeaker sd_abradiotr
wait 100
trigger radio01 on
trigger radio01 off
}
trigger on
{
accum 7 abort_if_not_equal 2
disablespeaker sd_abradiooff
enablespeaker sd_abradioon
accum 7 set 1
wm_announce "ON: accum 7 set 1"
}
trigger off
{
accum 7 abort_if_not_equal 1
enablespeaker sd_abradiooff
disablespeaker sd_abradioon
accum 7 set 2
wm_announce "OFF: accum 7 set 2"
}
}
Only what happens is:
Start of map: switch and sound is on… everything fine.
I activate the func_invisible_user, and get “OFF: accum 7 set 2” and the sound switches.
Upon activating the func_invisible_user again, I get both messages which means both blocks get executed completely.
And that can’t be… (or I just don’t see it)
I did already check whether the scriptblock gets started more than once, but there is only 1 entity in the map which the scriptname radio01. Also accum 7 gets only used in the script radio01.
As far as i can see, this scriptsetup is NOT linear, and both the OFF block should not be executed after the ON block, right?
Ideas anyone?