One use only object links

How can I make an object link with a verb that is disabled after use?
Conversely, how can I write a command Link into the middle of a popup 's long text?

I finally realized I can just make the object invisible as soon as it has been used. However, that will involve a lot of making one object visible in the room in some cases and another object visible in other cases, and rarely but sometimes both. That's 66 x four scripts to write add make object visible before. So, I'm really feeling like a short cut, because it also means I have to scan each line of text for which it is.


I dunno but these links might be helpful.

Coding…
So how do you actually add and remove verbs? We have an object called “hat”, and we want to add a “Wear” verb to the inventory list. One approach is to create a new list each time. This is easily done with the Split function. This takes two strings, the first being a list of verbs, seperated by semi-colons, the second just a semi-colon, telling Quest what to break the first list on.

hat.inventoryverbs = Split("look at;Drop;Wear", ";")
Then when the hat is worn:

hat.inventoryverbs = Split("look at;Remove", ";")
That will not work if there are potentially other verbs that may or may not be there, and you are better off assign the attribute each time using `ListConbine:

object.displayverbs = ListCombine(object.displayverbs, Split("Attack"))
When you want to remove the verb, it should be safe to use list remove as you know the object has the list, given you set it yourself earlier. To be extra safe, check the list has the verb first.

if (ListContains(object.displayverbs, "Attack")) {
list remove (object.displayverbs, "Attack")
}

https://docs.textadventures.co.uk/quest/display_verbs.html

CommandLink
CommandLink (string command, string link text)
Returns a string containing the XML required to display a hyperlink. When the hyperlink is clicked, the specified player command will be run. For example:

msg (CommandLink("undo", "Click here to undo the previous turn"))
outputs a link titled “Click here to undo the previous turn” - when clicked, the “undo” player command is run.
See also: ObjectLink

https://docs.textadventures.co.uk/quest/functions/corelibrary/commandlink.html


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums