Issue setting text variable to a number and concatenation


#1

I’m trying to set a text temp variable for the stats screen but having issues. Pretty sure I am making some basic mistake, but I can’t figure it out. Help would be appreciated.

*temp moneytext ${money}&" Rald"

*stat_chart
text firstname First Name
text lastname Last Name
text moneytext Money

Error message: choicescript_stats line 5: Invalid expression, couldn’t extract another token: ${money}&" Rald"

Thanks in advance


#2

Ok I am a little new to choicescript myself, but it looks like you are trying to set a double variable. ${moneytext} would bring up the word money originally from your stat chart. You have confused it by saying moneytext should be both money and rald. Also if you just want to change it for a single chapter it would be easier to just add *set moneytext “Rald” at the beginning of the chapter. I haven’t tried, but I would assume creating a temp stat that is identical to an already existing permanent stat would produce errors.


#3

Just add quotes around ${money}, you’re trying to create a temp variable with text and numbers, need to convert the numbers into text for it to work.

*temp moneytext “${money}”&" Rald".


#4

That worked, thanks.