Listing verbs in show menus

Thickar
23 Apr 2018, 04:15

So initially I thought I had this handled by making a command instead of a verb and then use {command:"Command"} in a message. But I realized that because I want to use the command when entering a room, but want to use a command by the same name but a different outcome depending on the room, I need to use a verb instead. So when my character enters a room, they get the options of the verbs "call into the darkness" or "search for light" and in each room you get back a different message.
Any ideas on how to do this?


mrangel
23 Apr 2018, 07:48

Generally, verbs are for use onto an object.

You could probably do that by putting scenery objects called"darkness" and "light" in each room, and giving them verbs named "call into" and "search for" to handle their responses. The {command:whatever} syntax acts as if the player typed the command, as far as I know, so should be fine with having the same command target a different "darkness" in each room. (The object would have different names but the same alias)

Or you could have a single "search for light" command with a switch statement in it:

switch (game.pov.parent) {
  case (room 101, bathroom, laundry room) {
    msg ("You find a light switch in the corner. That was easy!")
  }
  case (bedroom, garden) {
    msg ("You light a candle")
  }
  default {
    msg ("You search, but there's no light here. Eventually you stub your toe, and curse the darkness.")
  }
}

(I'm being silly with the responses. But this might be more efficient if you've got responses that apply in several rooms)


Thickar
23 Apr 2018, 18:57

What so its possible to change the outcome of a command based on the room? Now that I think about it if I make an if statement asking the current room the player is in that could work but I have mutiple outcomes per command per room so coding all that to one command got get messy