Getting value from dynamic attribute name ?

ApplaudAppsApplaudApps Member Posts: 308
edited November -1 in Working with GS (Mac)
Hi,

I've searched the forums for possible answers, looks like some have asked similar questions but I haven't found a solution. Got a feeling its not possible... but if anyone can help with this problem please post. Thanks.

Say I have integer attributes called

n1
n2
n3
n4
... up to n100

during the game these attributes get random values.

I now want to loop through these and perform actions on each in sequence. So I've got a counter and a timer and an attribute called current_value ... something like this

loopcounter=1
timer every second {

// this is what i want to change
rule loopcounter=1 {current_value = game.n1}
rule loopcounter=2 {current_value = game.n2}
... 100 different rules!

loopcounter=loopcounter+1
}

Can I get the value of an attribute by using something like current_value = game.n..loopcounter to make it get the value of n63 when the counter is 63 for example ?

It doesn't work and I thought that would be too simple but is there anyway of having one statement to get the values in the loop rather than 100 statement?

Thanks!

Comments

Sign In or Register to comment.