Setting variable numbers from other variables


#1

I’m currently writing a dice game as part of my choice script adventure.

However I’m getting an error when trying to set the value of a variable using the value of another variable.

*temp roll
*rand roll 2 12
*temp difference
*set difference 12 - ${roll}

The error occurs on the last line, pointing to the ${roll} section.

I presumed that if I could print the value of a variable via ${variable} then I could do the same when setting another variable. If this isn’t the case how else would I go about adding variables together. Perhaps I’ve gone about this the wrong way.

Thanks,

roskelld


#2

Ok, slap my idiocy and call me Roger. It’s always the way that you work it out the second you ask the question.

The answer to my quandary was this:

*temp roll
*rand roll 2 12
*temp difference
*set difference 12 - roll

I didn’t need the ${} around the variable because I’m not printing anything. I should probably take a break for a while.


#3

It’s good to answer you’re own question. A dice game sounds good - An old fashioned role-playing experience.