Hey all, New to programming. I'm trying to set up a variable age with a fixed age corresponding to it.
I'm using Twine 2.1.3 and Sugarcube 2.18.0
For example:
What's your FIRST name? <<textbox '$fname' '' autofocus>>
What's your LAST name? <<textbox '$Lname' '' autofocus>>
You are how old: <<textbox '$age' '' autofocus>>
<<set $dadage to 22>>
Then the next passage would read:
Your dad's FIRST name is: <<textbox '$dad' '' autofocus>>
He is <<set $dadage to$dadag +$age>> $dadage years old.
Whenever it gives a result. For example if I input 20 to my age text box, the result comes out as the $dadage comes out as 2022.
I assume this is because by entering the age into a text box it is applying "20" around it and thus adding the two numbers together as text hence 20 + 22 = 2022.
Is there a way to have someone enter a numerical variable that keeps it's numeric form so that additional will be arithmetic rather than combination?
Thanks all!
Comments
Also, you misspelled the variable name $dadage as $dadag in your example, so you might want to double check your code.
Thank you SOOOOOO much!