Creating menu for dialouge (SOLVED)

I'm not sure how to do it, i have the responses typed out but I'm not sure how to set it up.

Player talks to NPC --> start of convewrsation --> player is given choice of how to respond: Honestly or Cowardly
==> Honestly: conversation continues and ends
==> Cowardly : conversation ends and player is moved to previous room

how would this look?(not codeview plz)


If you haven#t already, you may want to take a look at this tutorial: http://docs.textadventures.co.uk/quest/conversations.html

With that out of the way, the most simple version would be using {command:}, which are printed as clickable hyperlinks with custom readings, executing a script, etc. when clicked.

Else, you could try working with an ask () {} script. It only works for yes/no questions, so you had to ask something like "Do you want to lie?", but is quite handy and simple to understand.


(You may skip this rambling)
However, asking for a yes/no question, especially in a moral context, will lead to psychological bias that are not to be underestimated. Depending on how you word your question, most people will have tendencies towards the "positive" answer, which is a major point on Social Engineering, for example. Letting the player come to their own terms will lead to more natural reactions, even if it requires some guess-the-verb.


@Zasc I already know talk to and Ask/tell verbs and meassages. No, i do not intend to use hyperlinks.
https://imgur.com/a/0TetKZK

this is what it shows


The normal way to do this would be to use ShowMenu.

Your script would look something like:

ShowMenu ("How do you respond?", Split("Honestly;Cowardly"), true) {
  switch (result) {
    case ("Honestly") {
      // code to continue the conversation goes here
    }
    case ("Cowardly") {
      // code to move the player to another room goes here
    }
  }
}

You don't need to use code view; you can open it just long enough to paste the code in, and then you can see how it looks in the GUI. Code view is just the easiest way to send a piece of a script to someone.


@mrangel O.k. That works perfectly, Thank you. i just needed to add the Split and " around the options


just to add:


the 'Split' Function is a helper Function: a quick/easy way of creating (it creates and returns) a String List Attribute

Split ("STRING_VALUE SEPERATOR_CHARACTER STRING_VALUE", "SEPERATOR_CHARACTER")

example_stringlist_variable = Split ("Honestly;Cowardly", ";")

// the default SEPERATOR_CHARACTER is the semicolon, so that's why mrangel just has it like this: Split ("STRING_VALUE;STRING_VALUE"), quest understands that if you don't specify the SEPERATOR_CHARACTER, it automatically uses the default SEPERATOR_CHARACTER, which is the semicolon

// this is useful, as you can take a String, for example, using spaces/white-spaces: example_string_variable = "Honestly Cowardly"
// and use it in the 'Split' Function, for this example, using a space/white-space, as your SEPERATOR_CHARACTER: Split (example_string_variable, " ")

DisplayList (example_stringlist_variable, 1)
// output:

  1. Honestly
  2. Cowardly
ShowMenu ("How do you respond?", Split("Honestly;Cowardly"), true) {
  switch (result) {
    case ("Honestly") {
      // code to continue the conversation goes here
    }
    case ("Cowardly") {
      // code to move the player to another room goes here
    }
  }
}

alternatively, you can do this (manually creating your String List Attribute), as well:

create ("example_object")

example_object.example_stringlist_attribute = NewStringList ()

list add (example_object.example_stringlist_attribute, "Honestly")
list add (example_object.example_stringlist_attribute, "Cowardly")

------------------

ShowMenu ("How do you respond?", example_object.example_stringlist_attribute, true) {
  switch (result) {
    case ("Honestly") {
      // code to continue the conversation goes here
    }
    case ("Cowardly") {
      // code to move the player to another room goes here
    }
  }
}

while, usually it's easier/better to just use the 'split' Function, it's useful to know how to create a list manually, because....

the 'Split' Function can ONLY create a String List

if you want to create an Object List, you must do so manually:

create ("example_object")

create ("train")

create ("car")

create ("boat")

example_object.example_objectlist_attribute = NewObjectList ()

list add (example_object.example_objectlist_attribute, train)
list add (example_object.example_objectlist_attribute, car)
list add (example_object.example_objectlist_attribute, boat)

// MPORTANT:

note the differences between a String List and an Object List

for a String List, it's Values are Strings, so they MUST have the double quotes: "Honestly" and "Cowardly"

for an Object List, it's Values are Object references/pointers, so you must: (1) actually have the Objects existing, and (2) you do NOT use the double quotes on them: train, car, and boat

as the 2nd argument/parameter in the 'show menu / ShowMenu' Function, requires a List (or Dictionary) Attribute:

show menu ("PROMPT", LIST/DICTIONARY, BOOLEAN: either, true: display as a numbered list, or false: non-numbered list) { SCRIPTING }

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

Support

Forums