Need help with rule - attributes combination

IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
edited January 2012 in Working with GS (Mac)
Hi guys!
I need a little help with my rules:
1. I have two game attributes (integers) - A and B.
2. I want to have a rule looking like this:
If:
game.A is 2
and
game.B is 4
Do something.

OR

If:
game.A is 4
and
game.B is 2
Do something.

So, in other words I want the rule to work if one of those attributes is 2 and second is 4, in any possible combination (as above). The easiest way to do it, is to make two different rules (as above). But I was wondering if there is any way to fit it into one rule.

Thank you very much for your help!

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Why not have two rules? I don't know if you could put a plus sign between them. So say rule if attribute game A + game b = 6 then.
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    Thank you for your reply! I can put two rules, but I have a lot more combinations, so if I have 2x every rule, I would have more than 100 rules in one actor.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    edited January 2012
    FryingBacon has a great idea. But instead of adding the two attributes, you can try making each attribute a prime number and use multiplication. (Multiplying prime numbers results in a unique number.)
    For example, say that game.A=3 and game.B=7 then (game.A*game.B) will be 21. Your rule would test for "21" and you would know that game.A and game.B must have the combination of 3 and 7 (or 7 and 3).

    Hope that helps!
    RThurman
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited January 2012
    Hey RThurman what can I say even a blind squirrel like me finds a nut every now and again..lol I'm no math guy but your prime number idea is great. Very similar to addressing using dip switches.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    DIP switches! That's what GameSalad needs! I think I'll add it to the wish list. ;)
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    Wow, thanks guys for some brilliant ideas! :)
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Glad to help!

    RThurman
Sign In or Register to comment.