Bypassing built-in verbs
Thickar
24 Feb 2019, 20:57So I have an object that's a door and I want to give it the verbs either enter or open. But open has to be a command and open is for container's. Someone once explained to me there is a way to by pass these built in features so you can use open or whatever as an actual custom verb, anyone know how that works?
The Pixie
25 Feb 2019, 08:17Do you mean the verbs that are displayed to the player, or the verbs Quest uses as a command?
Are you using the desktop version, or on-line?
mrangel
25 Feb 2019, 15:10A verb is a special type of command, which runs a script attribute on the object it's run on.
The default open
is a command, not a verb, so you can't make a verb of the same name without removing it completely.
You could modify the open command so that it will act like a verb, though.
The default open command is:
<command name="open" template="open">
TryOpenClose(true, object)
</command>
If you changed that to:
<command name="open" template="open">
if (HasScript (object, "open")) {
do (object, "open")
}
else if (HasString (object, "open")) {
game.text_processor_this = object
msg (object.open)
}
else {
TryOpenClose(true, object)
}
</command>
then you could give an object a script attribute named "open
" and it would act as if open was a verb, while open would still work normally for containers.
Doing this in the web editor is a bit harder, because it doesn't give you a way to change the builtin commands or to create script attributes that aren't verbs. If you need to do this on the web editor, I can give it a shot later.
Thickar
05 Mar 2019, 01:47I tired to change the command's code like you suggested, by copying the command and then replacing the code you gave me, but it still wouldn't let me make open a verb for the door, did I do it wrong?
mrangel
05 Mar 2019, 15:29I tired to change the command's code like you suggested, by copying the command and then replacing the code you gave me, but it still wouldn't let me make open a verb for the door, did I do it wrong?
You can't make "open" a verb, because the editor has code that prevents you using certain special words as verbs.
Once you have changed that code, you can give an object an attribute called "open" (on the 'Attributes' tab in the offline editor). If that attribute is a string or a script, it will be treated like a verb.
Note that in this case, you will need to manually add "open" and "close" to the object's displayverbs or inventoryverbs to make them appear in the menu.
Thickar
05 Mar 2019, 23:49I did everything you said but when I select the open "Verb" to the door it still says Door open in the text screen and I saw someone who did this where it didn't say door open, it just moved the character to the desired room?