Check values of all actors are equal
robert.mccarthy
Member Posts: 165
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
I think you can use tables for this one.
http://www.arcaderz.com
Add each value to a table and then compare using the new table to table comparisons and table functions.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
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
If I understand this correctly (which I probably don't ) 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 ?
Duh!!!
(nevermind)
OK -- how about this
Attached is an example
Would this work?
1234 <> 4321 (reverse string)
...
1111 = 1111 (reverse string)
Hmm... not quite!
121 = 121
*( this is not working for palindrome numbers)
http://www.arcaderz.com
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