Synonyms for variables

Does anyone know how to make a synonym, a shortcut reference, for a variable? For example, I have a list called “Traits of player” and each entry is a value. It is inconvenient to say “entry 3 of Traits of player” over and over, especially for each of the entries, which are unique. I would prefer to say: for example, “increment STR” where STR(ength) is entry 3 of Traits of player, or WIS(dom) is entry 6 of Trait of player.

I know that I can say Understand "STR" as entry 3 of Traits of player.
but that only sets up what the parser understands, and not the code. Understand phrases don’t work there.

You can use To and Decide phrases:

To increment STR:
   <desired code>

To decide which number is STR:
   Decide on entry 3 of the traits of player. 
3 Likes

Phil’s solution is the best one in general. It’s possible to actually make two variables be aliases of each other, using a bit of I6, but this usually isn’t a good idea.

2 Likes

OK, this seems good. I have six of these kinds of variables, so that makes at least 6 decide phrases, but I get the idea. How do I use it?

Once the To decide is written, can I say Let tmp be STR?

Yes. Decide phrases always yield a value which you can assign to a variable or use in an expression however you want.

For this code

[code]
To decide on STR:
Decide on entry 5 of Traits of player;
[\code]
I get this compile error " You wrote ‘Decide on entry 5 of Traits of player’ as the outcome of a phrase, a number, but in the definition of something which was not a phrase to decide a value.
(Not sure where the tab sent in the Decide phrase. It is in there in my code but doesnt makeit to the post.)

You need:

To decide which number is STR:
…

My mistake. I left that out. All works as expected. Thanks.