Can't turn off switchable
NecroDeath
27 Oct 2016, 11:56I had an object that was originally switchable, have disable switchable, but you can still switch the object on when you play the game?
hegemonkhan
27 Oct 2016, 13:19see here:
http://docs.textadventures.co.uk/quest/attributes/switchable.html
what it is saying is this:
if you give an Object the 'switchable' Object Type (Object Type / Type / Class / Group), then the Object is given the 'switchedon' Boolean Attribute, and is initially set'ted as 'false' :
NAME_OF_OBJECT.switchedon = false // ie, the Object is switched/turned off --- ie, the default is for an Object to start the game as being switched/turned off.
and having that 'switchedon' Boolean Attribute, you can now manipulate/toggle/adjust it:
NAME_OF_OBJECT.switchedon = false // ie, the Object is effectively switched/turned off
NAME_OF_OBJECT.switchedon = true // ie, the Object is effectively switched/turned on
so the 'switchedon' Boolean Attribute is what is actually used to determine whether an Object is switched/turned on/off, ie:
<object name="tv">
<inherit name="switchable" /> // this is the 'switchable' Object Type (Object Type / Type / Class / Group) code line from that you added/given to the (in this case) 'tv' Object through the GUI/Editor
<attr name="switchedon" type="boolean">false</attr> // in its: default ('false') or 'false', setting/state
//
// or:
//
// <attr name="switchedon" type="boolean">true</attr> // in its: 'true' setting/state
</object>
and example scripting of how the 'switchedon' Boolean Attribute can be used (how it is used to determine the effective state of an Object being on/off/turned-on/turned-off:
if (tv.switchedon = true) {
msg ("The tv is on.")
} else if (tv.switchedon = false) {
msg ("The tv is off.")
}
whereas, the 'switchable' Object Type (Object Type / Type / Class / Group) merely has quest add the 'switchedon' Boolean Attribute to that Object (and does whatever else might be needed that I'm not aware of, for the/this functionality of effectively being able to be switched/turned on/off in the game)
an example of mine of the 'turn on' (or whatever it is called) built-in Verb's scripting:
if (this.switchedon = true) {
msg ("The " + this.name + " is already on, silly.")
} else if (this.switchedon = false) {
this.switchedon = true
msg ("You turn on the " + this.name + ".")
}
an example of mine of the 'turn off' (or whatever it is called) built-in Verb's scripting:
if (this.switchedon = true) {
this.switchedon = false
msg ("You turn off the " + this.name + ".")
} else if (this.switchedon = false) {
msg ("The " + this.name + " is already off, silly.")
}
so, either you just removed the 'switchable' Object Type code, but the 'switchedon' Boolean Attribute code remains, thus allowing it to still be switched/turned on/off, or vice versa: you removed the 'switchedon' Boolean Attribute code, but since you still have the 'switchable' Object Type code, when you start your game, it thus creates/adds the 'switchedon' Boolean Attribute code to that Object, thus allowing the Object to still be switched/turned on/off.
The Pixie
27 Oct 2016, 13:49How did you disable switchable? If you did it on the Features tab, you only disabled its display in the editir. Turn the feature back on, go to the Switchables tab, and at the top set it to be not switchable.
NecroDeath
27 Oct 2016, 14:00Thanks both, fixed now.