How do I display a variable in dialogs?

Started by zutokaza, September 09, 2016, 02:27:09 AM

Previous topic - Next topic
How do I display a variable in dialogs? How would I do something like in the example below?

Example:

You took v[apple_amount] apples.

apple_amount would be a variable equal to some number.

You took 20 apples.
Solarus Works on ReactOS Opensource Windows OS

https://www.reactos.org/forum/viewtopic.php?f=2&t=14759&p=120616#p120616


The one from your old 1.3 tutorials on YouTube. Is it possible with the dialogs.dat file? I noticed I think it was $v, but I am not sure if that has anything to do with variables in the map script.

I basically want to display a variable amount in the dialogs text.
Solarus Works on ReactOS Opensource Windows OS

https://www.reactos.org/forum/viewtopic.php?f=2&t=14759&p=120616#p120616

First you should update to the dialog box script of the 1.5 tutorials as explained here: https://www.youtube.com/watch?v=iG0YRerYphg

Anyway, with this one or the old one, the dialog box script replaces the "$v" sequence by the value of the info parameter you pass to game:start_dialog(dialog_id, [info], [callback]).
Example:

Code (lua) Select

local value = 42
game:start_dialog("my_dialog", value)

You are the best Christopho! Worked pefectly.
Solarus Works on ReactOS Opensource Windows OS

https://www.reactos.org/forum/viewtopic.php?f=2&t=14759&p=120616#p120616