Check values of all actors are equal

Hello,

I have a problem that I cannot get my head around. I use to be a very active user but haven't use GS for a year now so a little rusty.

I have actors on a screen. Each actor has a value assigned to it as a local/actor attribute.

I want to somehow check if the values in each actor are the same as each other.

I did think about using something like: Add the values of each actor together and then do something with the value (but I got stuck here).

Any and all answers I am grateful of.

Thanks
Rob

Comments

  • jeezzcakejeezzcake Member Posts: 144

    I think you can use tables for this one.

    • add the local attribute of each actor as a row in a table using Add/Remove Row;
    • choose the value from the first row, and check if it's the same with all the other values from the table;
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Add each value to a table and then compare using the new table to table comparisons and table functions.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Add the attributes together. Then divide by the number of attributes that were added together. If the attributes each contained the same number, then the result would be that same number.

    Some examples:

    (6+6+6)/3 = 6

    (99+99+99+99)/4 = 99

    (25+25+25+25+25+25+25)/7 = 25

    However if the result does not match what was expected, then the value of the attributes are not the same.

    Example:

    (99+99+99+101+99)/5 = 99.4

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @RThurman said:

    If I understand this correctly (which I probably don't :smile: ) wouldn't this . .

    (99+98+100+99)/4 = 99

    . . . return a false positive ?

    Or maybe I'm looking at this the wrong way, the actual check in your system is done when the result is compared to the values in the attributes ?

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Socks said:
    . . . return a false positive ?

    Duh!!!

    (nevermind)

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    edited October 2014

    OK -- how about this

    When (numeric expression)
    [ (self.firstAtt==self.secondAtt)and(self.secondAtt==self.thirdAtt)and(self.thirdAtt==self.fourthAtt) ] = [  1  ]
          Do your thing
    

    Attached is an example

  • jeezzcakejeezzcake Member Posts: 144
    edited October 2014

    Would this work?

    1234 <> 4321 (reverse string)

    ...

    1111 = 1111 (reverse string)

    Hmm... not quite!

    121 = 121

    *( this is not working for palindrome numbers)

  • robert.mccarthyrobert.mccarthy Member Posts: 165

    Hi All,

    Thanks for all your suggestions. I started with the table route, and basically store each value in a row.

    Basically, as the number of actors is different each time, I add a row each time an actor is spawned. When a row is created and an actor spawned, I store it's row location locally. I can share properly if anyone wants when I get into the office.

    My next problem is, how do I go about check if row1=row2, row1=row3 etc.

    I'm not sure how to call and check each value against the others.

    Thanks
    Rob

Sign In or Register to comment.