Dynamic response text

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Swing Wren
Posts: 31
Joined: Fri Apr 10, 2020 2:30 am

Dynamic response text

Post by Swing Wren »

Hello, I'm trying to have some more control over the text of responses without having to create another node as de conditions get quite a bit more complicated with multiple nodes. Something like this for example:

example-burritos.png
example-burritos.png (32.46 KiB) Viewed 100 times

The response of cheese burritos may have different disabled text depending on different conditions:
I not have enough money: Text in red
If Paul is Angry: No cheese for you!
if no more cheese burritos: I'm out of cheese burritos!

What would be a good way to achieve this? Thank you
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dynamic response text

Post by Tony Li »

Hi,

Personally, I think separate response dialogue entries would make the options more clear. That is, separate options for "Cheese burrito", "No cheese burritos for you" and "I'm out of cheese burritos".

However, if you want to keep it in one dialogue entry, you can use the Conditional() Lua function inside a [lua(code)] markup tag.

For example, set the Dialogue Text or Menu Text to:

Code: Select all

[lua(Conditional(Variable["Paul.IsAngry"], "No cheese for you!"))]
[lua(Conditional(Variable["Burritos"] <= 0, "I'm out of burritos!"))]
[lua(Conditional(Variable["Money"] < 40 and Variable["Burritos"] >= 1 and not Variable["Paul.IsAngry"], "I don't have enough money"))]
Swing Wren
Posts: 31
Joined: Fri Apr 10, 2020 2:30 am

Re: Dynamic response text

Post by Swing Wren »

Hey, Thank you! that was what I was looking for!

In other cases I would keep those options separate but here having to keep only one visible and disabled It gets too cumbersome to manage the logic for each option for only having different text.

Thanks again! :D
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dynamic response text

Post by Tony Li »

Glad to help!
Post Reply