How to determine lowest to highest efficiently for 8 attribute values
jorkos
Member, PRO Posts: 353
Hey guys, in my game I have 8 attribute values that get set and can change over the course of the gameplay. When I do a check, I want to be able to efficiently determine the lowest to highest values. What is the best way to do this? Any ideas? thank you so much!
Comments
Do a search for bubble sort and see if that is what you are after.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Hook up each attribute in the min function.
For example: min(game.attribute1,game.attribute2,game.attribute3,game.attribute4) etc
You can hook up 8 attributes in that function. Hook that up into a loop, determine the lowest, then change that value to a really high value so that it doesn't get picked later on.
I have a video tutorial for it on GShelpers YouTube channel.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
To be sure of the best way to do what you want, you need to give us a few more details.
The 8 attributes you have, do they need to be sorted from lowest to highest without changing the value of each attribute? That is, 8 more attributes would be needed in order to store the order (e.g. game.1st = game.Attribute 6, game.2nd = game.Attribute 5 etc.) or can you change the contents of the attributes, putting the lowest value into Attribute 1 and the highest in Attribute 8?
Does that make sense?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I cannot change the value of the attributes when I do the check. All that I have are 8 real values. I need to know the order of lowest to highest. All I have is attribute1, attribute2, etc.
Can someone code this logic for $20 - immediate payment via paypal. I'm struggling
Shot you a PM.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx