Page 1 of 1

Sending number var to script

Posted: Sat Mar 23, 2019 9:47 pm
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?

Re: Sending number var to script

Posted: Sun Mar 24, 2019 10:27 am
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)

Re: Sending number var to script

Posted: Sun Mar 24, 2019 11:07 am
by timbecile
That worked perfect Tony! Thanks again!