Intro to Compressing Blocks 🟨

Want to compress your code? If you don’t know how this guide will teach you!

There is a intro to blocks guide too! Go check it out!

If you want to edit, please read post #8


The Begining

The first thing to mention is that code blocks take up 500 memory! So try to avoid them if it is a simple if statement you need to run. You can use checkers to run if statements so it saves memory! [1]

You only have 75 blocks per 500 memory, so compressing your code is crucial!


Using Variables

Using Variables saves valuable blocks that you need. If you need to run the code below a lot, use a variable to store that property instead! It requires 3 blocks at first, but then you only need to use 1 block every time you need it.

Get Property >>> Players

For example, this code could use work. I got the property “Players” a lot.


The Gear Button
image
This button up here- is one of the most crucial ways to compress blocks.
It helps combine multiple blocks, saving space, and giving room for more blocks
Here is an example:
Let’s say we are making a long section of block code and they are all if statements.


image
WOAH! That’s a whole lotta blocks, But, we can save block space by using the gear button!
We just change it to else if statements, and move the channels and properties, and we’d save lots of space!
image
image
2 blocks saved! You could even go a step further by changing the last section to else. This Button would be even more useful if you place blocks, upon blocks, upon blocks…


Counters

Did you know using a huge 500-memory code block to set a true/false property isn’t worth it? There is a MUCH better way to save memory on this!

Use the counter to set a number property instead! 0 is going to represent false, and 1 is going to represent true.

Now if you ever want to change a number property that is acting like a true/false property, use channels or wires to increment or decrement the counter!


Advanced Compressing [2]

Let’s start this harder section with a recent problem I had. I was making a battle-royal game, and I needed to teleport players each in a different spot. [3] I won’t go into detail about the post, but the solution was to create a randomizer and based on what it was, it teleported you to a different spot. I could have done a bunch of if statements, but that is too chunky of code. Instead, I broadcasted on a channel of the number, and each teleporter received on a number. The code is screenshotted below.
image [4]


I did the same thing to my coordinate system, I broadcasted the position, and if anything was received right there, it would activate. A screenshot is below.
image

That’s it! Hope you learned a thing or two!


Thank you to these user(s) for helping create this guide.


Polls

Rate This Guide
  • :star:
  • :star::star:
  • :star::star::star:
  • :star::star::star::star:
  • :star::star::star::star::star:
0 voters
Difficulty
  • :blue_square:
  • :green_square:
  • :yellow_square:
  • :orange_square:
  • :red_square:
  • :purple_square:
0 voters

  1. Checkers only use 35 memory. ↩︎

  2. Sorta ↩︎

  3. My problem was I had no idea how to do this, but I realized this was a great example of not using a million if statements. ↩︎

  4. A little tip is when you are doing this, in order to broadcast off of a variable, you have to turn it into text with the “Create Text With” block. ↩︎

17 Likes

Wow, Nice Guide!, Also I don’t have the text difficulty memorized, so can you put the numbers in?
@Slim you are nice so I put you in my bio:)

2 Likes

very useful, great guide!

[1]


  1. I need this XD ↩︎

3 Likes

If I change the poll it resets all its votes, sorry.

3 Likes

Oh, ok, I’ll start memorizing [1]


  1. I’m the world’s worst person at memorizing things ↩︎

2 Likes

Reusable Bump time for this really useful guide!

Don’t bump. This is no longer the last reply.

1 Like

Great guide! This is pretty helpful for mega projects!

4 Likes

@here, apologies for the ping, but this guide is now a wiki! If I did not cover any topic on condensing, you may add to it.

Please ask me before adding to it.

5 Likes

Noice! Keep it up!

4 Likes

@Slim , can I edit? I want to make a section about the gear button, and change the title to “Intro to Compressing Blocks”

3 Likes

These buttons on the code blocks?
image

3 Likes

Yes, they help a lot when compressing.

3 Likes

Yeah, you can on both. Since the title is going to change the title to include “Intro”, do you want to add it to gimkit-beginners?

What lol

Yes, you can too. I’m writing in the post above. :eyes:

3 Likes

Done @Slim . Hope you liked it! :smile:

3 Likes

I alr did it @bob_the_tomato

3 Likes

Here, it tells you the difficulty.

3 Likes

Here’s a different version:
:white_large_square: = 0/10 (art)
:green_square: = 1-2-3/10
:yellow_square: = 4-5/10
:orange_square: = 6/10
:red_square: = 7-8/10
:purple_square: = 9-10/10

6 Likes

0 out of 10 isn’t always art in my experience. I have a post I made around a month ago that isn’t art, but is a 0/10.

4 Likes

0/10 is supposed to be only art though. Easiest will be blue or green.

8 Likes

Bump! This guide is soo useful for beginners

3 Likes