Is there a way to do a dialogue tree that triggers an action

I’m not sure how the explain he made is, probably not perfect, but most likely can be the bones of a system for you

——
This is an old thing I said to him, not sure how accurate I was in what I was saying, probably some flaw and whatnot I’d find now that it’s 9 months later.

——

Step 1: What you want

So typically when I’m stuck on a problem I like to break it up into very small parts, and normally just from this the answer can reveal itself.


  1. Click option A or B
  • If A is clicked, show Dialogue A
  • If B is clicked, show Dialogue B

(So it’s: Click Option → Select Dialogue Option → Display Dialogue)


Step 2: What you now know

So I’m sure you already know that, but if we break it apart more we see there are 2 dialogues (A & B).
This means that 2 Text Lists will be used, one with dialogue A and the other with dialogue B.

Now you need to activate those dialogues with a clicking option.
(I’ll explain how to format the text inside the lists later).


Step 3: Complete the beginning part

So the first part is being able to select an option.
I’m assuming you already know how to do this, but in case not I’ll explain a little.

  • If object A is clicked, send a message equal to 1
  • If object B is clicked, send a message equal to 2
    (These messages will be sent to the object with the dialogue)

What will be done with these messages?

Using a Router you can select specific outputs via the “Select” input.
(Make sure it is set to “Select specific route”)

Output 1 will give Dialogue A
Output 2 will give Dialogue B


Step 4: Complete middle part(s)

Most everything you will make will have an activation and a result. But the key part is the steps in between to reach that result.

In this case, you have already selected a dialogue option, now you need to have to give dialogue to your display function (I’ll explain the display function later)

This step requires knowing how lists work. Let’s say you want to show the messages
(1) “Hello, nice to meet you.”
(2) “What’s your name?”
(3) “That’s an awesome name!”

You would need to get these items from inside the List (“items” just refers to the text that is held within the Text List)


I will be using this as the example list
[(1)“Hello, nice to meet you.”, (2)“What’s your name?”, (3)“That’s an awesome name!”]
( I used (1),(2),(3) to show that these are separate items and their placement within the list. This number is referred to as the Index)

Technically there are 4 options that can give you these items, but in slightly different ways.

The “All” output. This will output the entire list, but you are looking for individual items so this isn’t what you’re looking for.

The “One” output.

If you input a number into the “One” input, it will give you an item at that index.
This means if you input 1, you would receive the output “Hello, nice to meet you.”
If you input 5 (a number greater than the total indexes) you would get the last item in the list
“That’s an awesome name!”

This will give you individual items within the list like you want. So if you wanted to get the values this way, you would do this

Number=1(Out) → (+)Number=0 → (One)Text List(One) → Output is the item at that specific spot. Each time you want to show the next message, you would increase the value by 1 to get the next item.

The “Pop” output.

This will REMOVE the LAST item in the list. This is NOT dependent on what the input value is.

So using the example list, the first time you input you would get
“That’s an awesome name!”
Then “What’s your name?”
And after that “Hello, nice to meet you.”
(If you inputted any more after this the list would be empty, so you would receive no output)

This is not exactly what you’re looking for because it’s backward, but it’s almost there.
To fix this you could do 2 methods.

  1. Enter all of your dialogue in reverse order.
  2. To make it a little easier you can write all of your dialogue like normal, and then use the List Order behavior to reverse it.

The “Join” output.

This is not what you want.

In summary, it combines everything in the list with what you inputted.
So if you input "CAKE " the output result would be;
“Nice to meet you.CAKE What’s your name?CAKE That’s an awesome name!”

2 Likes