Variables with the same name but different types

So, I am a little unclear on something.
To make some things, such as calling orientation or height or what not with fairly long, at least for variables, titles, I have, for example.

*set mc_height "very tall"
*set mc_height0

Will that work, or do I have put a different variable, because they are both MC_height? Also, I think I ran into something like this where I did that and because it changed the variable from a “” to a number, when I typed in the *if (quoted variable name), it didn’t trigger because it wasn’t that variable anymore.

Fairly certain you have to designate each individual variable as a string, boolean, or number. You cannot make the same variable exist in different types.

You’d have to do something like
*create height_describe ""

And then

*if mc_height > 1000
   *set height_describe "very tall"

and so forth.

I’m not 100% sure what this means, but possibly has to do with the fact that a numeral can exist both as a number variable and as a string. In other words, you can store 6 as a numeral and “6” as a string. But I’m not quite sure if that was what you are referring to.

1 Like

Thanks, I thought it was something like that. I think what happened with my example was that it was a string, and then I accidentally sent it to a number, so then the string no longer existed and the game had nothing to trigger since it was set up with the assumption that the strings still existed.

Arrays might also be useful in this case. It allows you to do things like this, which seems to be what you’re trying.

*set mc_height "very tall"
*set mc_measure 6
*set feature "measure"
Your character is ${mc["height"]}, standing at ${mc[feature]} feet.
// Your character is very tall, standing at 6 feet.

It would probably help in some measure to keep variables separated, especially when they refer to the same thing?

Check out:

2 Likes