I’m having trouble with trying to read a string as a numeral. For instance, I have variable x and y as the grid coordinate.
I am using x and y as strings so that I can use it as a reference.
e.g:
*temp x “1”
*temp y “1”
so that something like this works:
*goto (x)-(y)
*images (x)-(y).png
However, I also want to be able to change the value through arithmetic operators so that I can do something like this:
For example:
*set x 0
*set y 0
*label 0-0
You are north!
*choice
#go south
***set y + 1**
*goto ${x}-${y}
*label 0-1
*images $(x)-$(y).png
You are south!
*choice
#go north
***set y - 1**
*goto ${x}-${y}
#go south
***set y + 1**
*goto ${x}-${y}
#go east
***set x + 1**
*goto ${x}-${y}
etc
Obviously, the bolded part will simply not work since variable x and y are string data types.
I have tried making them numeric data types instead, but then, they cannot work as references.
Is there anyway to read a string as a numeral or a numeral as a string?