Override default behaviour of switchable objects?

OurJud
15 Dec 2016, 23:57Jay's explained what the problem may be with the door closing/opening situation, but I'm not sure how to get around it.
I'm now in a similar situation with a torch where my criteria and rules are being ignored by the game in favour of the default behaviour.
I've set the script for when the torch is switched on, and for when it's switched off, but if I type switch on torch (and get the message I've defined to say it's switched on) and then immediately type switch off torch I'm told it's already off.
Even if this IS default behaviour it doesn't make sense. Why am I given the option to control what happens with on/off if it's going to be ignored?
Here's the various scripts I'm using.
In the Use tab for the torch:
msg ("You switch on the torch. The beam is good and strong.")
SetObjectFlagOn (torch, "torchOn")
In the Switchable tab for torch (under After switching on the object)
SetObjectFlagOn (torch, "torchOn")
And for After switching off the object):
SetObjectFlagOff (torch, "torchOn")
Also in the Switchable tab I have the two relevant messages set for Message to print when switching on and Message to print when switching off.
And then for the location where the torch is required in order to see:
SetObjectFlagOn (player, "footofStairs")
if (GetBoolean(torch, "torchOn")) {
firsttime {
msg ("You make your way slowly up the stairs, every one of the steps squeaking under the strain.")
MoveObject (player, shopUpstairs)
}
otherwise {
msg ("You make your way slowly up the stairs.")
MoveObject (player, shopUpstairs)
}
}
else {
msg ("It's almost pitch black here and you can't even see the stairs ahead of you.")
}
It all works just fine, except for the message telling me the torch is off when I haven't turned it off.

OurJud
16 Dec 2016, 00:14Solved.
I should have read Jay's answer in the other thread more carefully. Quest does indeed have its own flag names for certain functions, and in the case of switchability it's switchedon
Now I've renamed my flags to this it works as should.
hegemonkhan
16 Dec 2016, 04:08a lot of the built-in functionality has its own built-in Attributes, but they're a bit confusing. Usually it's a Boolean Attribute (such as 'isopen' and 'switchedon') that actually controls/determines the state of that functionality (ie: being opened/closed/on/off/etc). The 'XXX-ables' and 'XXX-eds' are usually Inherited Attributes / Object Types (Types) / as the GUI/Editor controls, for adding all of the built-in functionality ( the 'XXX-ables' )for that thing/Object and/or what is its initial state (the 'XXX-eds' ).
Here's the Attributes for Objects (this is a good thing to study and learn up on):
http://docs.textadventures.co.uk/quest/elements/object.html