Skip Menus?

Like a lot of text adventures, mine has branching dialogue that I use menus to grab answers for. Sometimes I want a dialogue path to get to the end more quickly by skipping subsequent menus (for instance, when repeating a conversation and skipping some introduction questions). The only method I know to make this happen is to create a function that I reference to plug in the material that comes after the skip, which becomes a bit cumbersome for my function list.

To clarify, this is a simple example of what I mean:

if ( {
  msg ("\"Hi, what's your name?\"")
  list = NewStringList()
  list add (list, "Give your name.")
  ShowMenu ("", list, false) {
    msg ("<br/>You give them your name.<br/><br/>\"Nice to meet you. What's up?\"<br/><br/>{command:ask NPC about nothing:\"Nothing.\"}")
else {
  msg ("\"Hey {}, what's up?\"<br/><br/>{command:ask NPC about nothing:\"Nothing.\"}")

(Or, in picture form:

In a situation like this, I would place {command:ask NPC about nothing:"Nothing."} into a function that I would then call at the end of each of those paths, because this "end" content is normally a lot longer than a single line of text like that. Sometimes it's more dialogue paths or other such things, so simply pasting it into both paths isn't always viable.

What I want to know is, is there a better way to do this?

Making a function for each response is probably the simplest way to do it; but can create a large list of functions.

An alternative would be to store the conversation data in a more structured form.

One method I'd consider would be making a set of 'conversation rooms'; you could put a chunk of text or script in each room's description, and use exits between them to indicate their choices. You wouldn't actually send the player to these rooms, but you could have a single function that handles a branching menu system in this way.
(you could also put questions in objects, or in a dictionary… the advantage of using rooms is that you can collapse them in the sidebar of the editor, put them inside other rooms to keep them organised, and use the 'description' editor to easily change your text.

You'd just need a function like:

<function name="ShowMenuFromRoom" parameters="room">
  if (HasString (room, "description")) {
    msg (room.description)
  else if (HasScript (room, "description")) {
    do (room, "description")
  choices = ScopeUnlockedExitsForRoom (room)
  if (ListCount (choices) > 0) {
    ShowMenu ("", choices, false) {
      chosen = GetObject (chosen)
      // Remove the next line if you don't want to show the player's choice:
      msg ("==> " + GetDisplayAlias (chosen))
      if (HasScript (chosen, "script")) {
        do (chosen, "script")
      if (HasObject (chosen, "to")) {
        ShowMenuFromRoom (to)

Then you can just type all of your NPC conversations into a set of rooms. When you call this function, it displays the description of the "room" you name, and then displays the room's exits as a menu.
You can put the rooms in a container so that they're separate from your game's real rooms; or you could put them inside an invisible container in the NPC. You can make the description either text or a script; and you can disable choices by locking the exits.

I think this is a pretty neat way to organise a conversation, rather than having a big list of functions.

Log in to post a reply.