I do this a different way (see my example above of using gameMain.showIntro() to set up variables… I would set up all your random variables there which fires off one time only at game start up.
me: Actor
stats = [20,20,20,20,20,20,5,5,5,5,5,5]
statNames = ['str','int','dex','agi','wis','cha','nature','death','fire','cold','magic','poison']
desc {
"You look as good looking as ever.<.p> ";
for(local i=0;i < me.stats.length();i++){
say(me.statNames[i] + ': ' + me.stats[i] + '<br>');
}
}
;
gameMain
showIntro(){
// this randomizes your player statistics from 1 to 20 at game start up
for(local i= 0;i< me.stats.length();i++) me.stats[i] = rand(20) + 1;
}
;
… actually the downside to putting variables in the “me” object is if you wanted to change the player character to another character later on in the game via setPlayer(newActorName). If you had them somewhere global, like in gameMain, you would not have to worry about that possibility.
I’m not sure how familiar you are with arrays. You mentioned you are new to tads, so I’m just going to explain it as if you don’t know arrays. On the above example, you refer to the variables by their position in the array. For example, strength (‘str’) is at the zero (0) position, so…
me.stats[0] = 17;
… would set strength to 17. Str is in the 0 position of the array… ‘int’ is in the 1 position… ‘dex’ is in the 2 position… and so on. To display fire resistance (‘fire’) you could do this:
"Your fire resistance is <<me.stats[8]>>. ";