Author Topic: How do I display a variable in dialogs?  (Read 3740 times)

0 Members and 1 Guest are viewing this topic.

zutokaza

  • Full Member
  • ***
  • Posts: 146
  • Active - Making stories can take the most time.
    • View Profile
How do I display a variable in dialogs?
« on: September 09, 2016, 02:27:09 AM »
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.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
Re: How do I display a variable in dialogs?
« Reply #1 on: September 09, 2016, 09:31:27 AM »
Which dialog box script are you using?

zutokaza

  • Full Member
  • ***
  • Posts: 146
  • Active - Making stories can take the most time.
    • View Profile
Re: How do I display a variable in dialogs?
« Reply #2 on: September 09, 2016, 11:53:36 AM »
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.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
Re: How do I display a variable in dialogs?
« Reply #3 on: September 09, 2016, 11:59:53 AM »
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)

zutokaza

  • Full Member
  • ***
  • Posts: 146
  • Active - Making stories can take the most time.
    • View Profile
Re: How do I display a variable in dialogs?
« Reply #4 on: September 09, 2016, 12:25:12 PM »
You are the best Christopho! Worked pefectly.