Block Code Help

I’m kinda confused what this would look like (i have been playing around with this for an hour)

Blackhole's block code post

"As of right now (May 28, 2023) there is currently no built in way to make lists in gimkit creative. However, if we get creative, we can make our own lists. The Idea: You’ll notice when you place a get property block, the property name is just a text object. We can use this to our advantage, with the create text block. By creating multiple properties, each named item.0, item.1, item.2, we can make some text with the create text block that matches the property name of the item we’re trying to gra…
[/quote]

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"

1 Like

so you are trying to make a voting system according to this all of these have blocks for them

is this for an amogus map?

i can help you build this in game or try to send a pic depending on what this is going to be used for

This is just finding the heighest property out of a list of them.

1 Like

I just don’t understand what the code looks like.

1 Like

Ok but what would that look like in the code.

1 Like

all of it is written out just find the different blocks that say these words some will have to be typed

Give me a second. I don’t have access to GKC, so maybe @Haiasi could get you a picture? What he is doing is checking if a property is heigher than a certain value (stars at 0), if it is, set that value to the property, and repeating the process for every property.

Ok thanks guys for your help! I have to go to bed. I won’t respond till the morning! Good night!

1 Like

ok ill try to get it to work if i do ill send pics

I made this so you would only need to trigger it once without a repeater:


What this does is basically loop itself until it reaches the maximum index value & find the property with the highest value and sets the index to 0 and broadcasts the result statement after it reaches the end of the index, make sure you set (getProperty(# of numbered properties)) to the amount of p1(indexes)votes you have and make sure there are properties named p1(index)votes or for example:

p11votes,
p12votes,
p13votes,

etc, etc do this so that the blockcode can read the value of those properties and to find the highest among them. (do whatever you want with the Send Vote Results channel, like finding who got voted out or smth) PS: you can set the # of numbered properties to 10 like in your example.

Hope this helps in as a visual representation!

1 Like

thanks i couldnt figure this out really

Thank you so much! You are a lifesaver!

2 Likes

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.