Sending number var to script

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Sending number var to script

Post by timbecile »

Hey Tony,

I'm having trouble sending a number var to a script. I've had success with strings in the past, but it seems like no matter what I do, the number var always ends up as zero in my script.

I'm testing for a condition to make sure the player has enough gold to get their healing.

here's the conditional script:

Code: Select all

HasGold(var=HealingCost) == true and (Variable["HealingCost"] > 0)
I know there's value in the variable as I get that in a previous dialog bit. Here's that code:

Code: Select all

Variable["HealingCost"] = GetHealingCost(15)
I'm sure its a syntax error on my part as I don't know Lua basically at all. How should the code be written?
User avatar
Tony Li
Posts: 21080
Joined: Thu Jul 18, 2013 1:27 pm

Re: Sending number var to script

Post by Tony Li »

Hi,

Change this:

Code: Select all

HasGold(var=HealingCost) == true and (Variable["HealingCost"] > 0)
to this:

Code: Select all

HasGold(Variable["HealingCost"]) == true and (Variable["HealingCost"] > 0)
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Re: Sending number var to script

Post by timbecile »

That worked perfect Tony! Thanks again!
Post Reply