Check which property is the highest

I have 10 properties, and I want the game to check which one is the highest. Any simple way of doing this?

4 Likes

??? Sorry I can’t help you

2 Likes

Get a button(or anything) and get text.
Wire the button to the text (when button pressed–run wire pulse back)
Now make a when receving wire pulse block in the text.
In the block: Set text to:get property:(your property)
Copy the text 9 more times one by one (because then the block will also copy)
Dont forget to change the properties in each text block.
Now wire the button (or whatever you chose) to the other 9 texts with when button pressed–run wire pulse back.
So when you press the button you should see all the numbers (if they are number properties) and see which one is the highest
This should work

4 Likes

Sadly, using the checker with properties doesn’t work, as it is bugged, so you will have to use block code.

Create two properties, highestValue, and highestName. These will store the value of the highest property, and the name of the highest property.

Place a trigger, and go to block code. Write:
if (get_property(highestValue) < get_property(myproperty1):
set_property(highestValue, get_property(highestValue)
set_property(highestName, myproperty1)

This checks if my property is greater than the highest property checked so far. To check all 10 properties, copy paste this code over and over, changing the name of the property you are comparing each time.

If you run out of space in the block code of this trigger, add a broadcast on channel button to the code. Setup another trigger to trigger when receiving on that channel, and then put the rest of the if statements in that trigger.

Sorry for the lack of screenshots, I’m on mobile right now.

6 Likes

Thanks! I was trying to make a voting system for Among Us.

1 Like

I should probably say- there is a more optimal solution, but it’s more complex and involves lists. Do you want it?

1 Like

Yes.

2 Likes

So, first, read this if you haven’t already:

Then, make sure your voting properties all have a naming scheme like “p1votes”, “p2votes”, “p3votes” etc.

Place a repeater, and wire it to a trigger. Then place a property and name it '‘i’ or something like that.
Make the repeater repeat 10 times, and then go to the trigger and enter block code.

Then write the following code:

#store the property name in a varible called name
name = create_text("p1", get_property(i), "votes")

#check if the value of name is greater than the highest votes so far
if (get_property(name) > get_property("highest")):
    #if so, update the highestName and highestValue properties.
    set_property("highestName", name)
    set_property("highestValue", get_property(name))

#increase i to check the next property
set_property("i", get_property("i")+1)

#A check to reset the "i" property when all properties have been checked.
if (get_property("i") == 10):
    set_property("i", 0)

I hope this makes sense lol

4 Likes

you should make a guide!

1 Like

I’m procrastinating it lol
I’m working on my next big project in gimkit :smiley:

1 Like

What’s it going to be? Just a hint would be fine lol.

I’m also working on a huge rpg project called Farmers’ Quest.

1 Like

i am still working on monopoly, but i did add to my guide today :}

1 Like

Don’t even know where to start on CCC lol

1 Like

Farmers’ Quest has 72% memory and a merchant system lol.

3 Likes

the terrain

1 Like

Well, its not gonna be something boring that gimkit intended for people to make in creative :slight_smile:
But other than that, i prefer not to give spoilers, since I usually fail to meet my goals and dont want to raise expectations only to drop them.

3 Likes

That’s okay. I think I want to create a bossfight first to get feels for the boss fight at the end of Farmers’ Quest, so I might make a guide on those.

1 Like

What kind of bossfight? Like a sentry one or with custom attacks?

2 Likes

Both, probably. I’m making a fake one.

1 Like

so you are just getting comfortable before you make the real thing?

1 Like