Can't add verbs during gameplay

Dongers
05 Dec 2021, 19:53

I'm having trouble. I want my character to jump towards and object by using its display verb "Jump" in one of the scenes. However, the same object can be encountered elsewhere where jumping towards it wouldn't make sense since it's directly within reach. So I want to add the Jump display verb when the Jump scene is about to happen, but want to remove it if the player decides to take it later and instead replace it with "touch".
I've tried following this tutorial https://docs.textadventures.co.uk/quest/display_verbs.html but it doesn't work. Is there a way to do it without expressions or direct coding?


mrangel
05 Dec 2021, 21:20

but it doesn't work

What doesn't work?
If you can show your code, and tell us what the error message is, then someone will probably be able to see what's wrong.

The most common problem with this kind of thing is Quest's weird issue with inherited lists. If you haven't altered the object's display verbs in the editor, then before you can change them you will need to make them concrete by doing:

name_of_object.displayverbs = name_of_object.displayverbs

After that, you can add a verb before the 'jump' scene by doing:

if (not ListContains (name_of_object.displayverbs, "Jump")) {
  list add (name_of_object.displayverbs, "Jump")
}

and afterwards (when the object is moved, or when the player leaves that area), you could do:

if (ListContains (name_of_object.displayverbs, "Jump")) {
  list remove (name_of_object.displayverbs, "Jump")
}
if (not ListContains (name_of_object.displayverbs, "Touch")) {
  list add (name_of_object.displayverbs, "Touch")
}

Now, if this is an actual verb, it's a little more complex. Because any verbs an object had are automatically added to a list called generatedverbslist, which is created the first time the player sees the object. By default, Quest displays both the displayverbs and generatedverbslist.

So… you can either use the different tickboxes above the display verbs list to control which list(s) are used; or you can make sure the unwanted verbs are removed from generatedverbslist as well, using the same method. Before altering generatedverbslist, you would need to make sure it has been generated, by doing:

GetDisplayVerbs (name_of_object)

Dongers
05 Dec 2021, 21:40

Thank you! I just used expressions the completely wrong way it seems. Now I managed to make the Verbs show up and disappear, but how do I edit what they do?
Quest just replies "I don't understand your command" whenever I select them. Where can I edit what they'll do?


mrangel
06 Dec 2021, 00:21

You can add verbs on the 'Verbs' tab for an object.


Dongers
06 Dec 2021, 16:13

I did that, now they aren't being removed anymore.
Nevermind, I figured that one out. Had to disable the automatic inclusion of Verb tab verbs in the displayverbs.


mrangel
06 Dec 2021, 17:29

I did that, now they aren't being removed anymore.

I explained that in the previous post.
An object's verbs are automatically added to a second list, generatedverbslist, which is displayed in addition to the displayverbs if it's enabled.

You can turn off the automatically generated verb list, and make sure that all your other verbs are manually included in the displayverbs; or you can use the same technique to remove it from generatedverbslist.