Dynamically choosing an attribute based on values...possible???

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

I am trying to save about a bezillion keystrokes with this cry for help.

I created attributes .. a lot of attributes with number coding
Is it possible in my object to have 2 attributes , a and b
assign them each a value
a=1
b=2
And then use that to incorporate in a rule

Rule
If game.ab = x then
this would translate to my game attribute called game.12

So the rule would become
if game.12 = x then

I hope i ask clearly and correctly.. sometimes i type as if i talked.. specially when in english.

Thanks again for your help.

Comments

  • JGary321JGary321 Member Posts: 1,246
    Instead of doing something like a=1, b = 2, make a a degree of 10.

    So a = 10, b = 2
    rule if game.a + game.b (12) = x then

    i would think this would work.
  • beaudoin_nbeaudoin_n Member Posts: 184
    It is more like i have
    game.12
    game.34
    game.17
    game.11

    And i want to assign one of those based on the condition of a and b

    so if a=1 and b=2 i want to assign game.12 to x
    but if a=3 and b=4 i want to assign game.34 to x

    or i want to have rules like
    if game.12 > 99 display text bla
    if game.12 = something then destroy
    etc...

    so since my group will want to check against this game.12 attribute when a=1 and b=2
    I'd like to be able to go something like
    game.'a''b'
    or even
    game.tata'a'bobo'b'
    resulting in game.tata1bobo2
  • rebumprebump Member Posts: 1,058
    What you're looking to do is akin to dynamic statements in languages like Perl, using "exec()" in SQL, etc. where you generate a language statement from values in a variable. From my four days playing with GameSalad, I think you will have to settle for a solution such as what JGary321 offered up.

    If you don't want to change 'a' into a ten's place edition of the value (i.e. maybe you already are using the one's place digit values all over in your project), you could just change the conditionals to something like:

    if ((game.A * 10) + game.B) = 12 then...

    Similar things are done to emulate a set of flags for an entity but they usually do it in Base 2 instead of Base 10 so you can use boolean logic for bit position testing and such.
Sign In or Register to comment.