[ 📜 ] The Ultimate Guide to Blocks!

A sequel to the Ultimate Guide For Every Device…see [ 📜 ] The Ultimate Guide To Every Device Part 1!
May be merged into the Ultimate Guide for Everything.

Part 4 of the “TUG” Series.

Note: You may see some users mention transmissions, channels, etc. If you don’t know what that is, look at this guide.

Blocks. Block Coding is what any advanced game needs to create mechanics. This guide will tell you what each block does, and which devices will be compatible with blocks!
The Basics: This is what you need to know before actually doing block coding.

Devices Compatible With Blocks
  1. Trigger
  2. Knockout Manager
  3. Inventory Item Manager
  4. Item Granter
  5. Popup
  6. Notification
  7. Overlay
  8. Text
  9. Tag Zone
  10. Questioner
How to Access

When first coding, one thing you may want to know is how to get there! It is quite simple. When viewing a block compatible device interface, you should see this.


Click on that.
After that, you should either a couple options. Some devices have more, others have less. (Triggers have 1, Questioners have 4). On Wire Pulse means whenever it receives a signal from a wire, the block of code will run. When Receiving on Channel means that the block will run when receiving on a specific channel. Click on one of those.
After, you should see a couple categories. Some will have the for this device only, others, like the trigger, will not have that. Anyway, that is how to get to the block interface!

Block Categories

You will find that there are 5 (or 6) main categories to blocks. Their names are “Essentials”, “Logic”, “Math”, “Text”, and “Variables”.

Essentials and Variables
Branch of Mathematics

Numbers
The first block in the Math category is a simple block with a 0.
image
This block can be placed inside of other blocks. Like this:
image
image
Easy right? Well this simple little block is extremely important. It’s one of the most important blocks in GKC, because it can allow you to increment properties, do advanced mathematics, and so much more!

Basic math
The second block in the math category is this one:
image
This block enables us to do basic math operations, such as: addition, subtraction and multiplication. In order to do a simple adition do this:
image
image
image
Now that you have that, why isn’t anything happening??? Simple, we need to add a way for the result to be sent. Add the following:
image
image
image
image
image
image
image
image
Then press play and see the result. (Make sure you have a lifecycle wired to the trigger to trigger it when event occurs)
(Your resolution should be at 80% or less to see the small message at the bottom right corner)
image
Above you can see what it should look like in game.
Picture in editing mode:
image
We’ve made a simple math equation! Pat yourself on the back. Sometimes people want to make really complicated equations using basic operators, but how?
Let’s say we want to find what is the result of 3+(1/5)-9. In mathematics you have PEMDAS for the order of operations, well, so does the computer!
Do this:
image
image
image
image
In the images above the result would be
image
Now normally when we do 3+(1/5)-9 we get -5.8 so why did we get that super long number? Well in coding this happens a lot because the computer is transforming the response to a string and well it changes its format to a decimal that’s very long. In order to fix that head on over to the next part of the Branch of Mathematics!

Rounding and estimation
In mathematics we get a lot of weird and long numbers like in the example above, so how do we fix it? Rounding! One of the most powerful tools in math. It’s the sixth block in the math category. Here it is:
image
Looks very simple, right? Well this little tool can be a life saver when it comes to weird and long numbers! Add it like this to the blocks we have:
image
Why did it say the answer was 6? Well remember that rounding a number means it goes to the neareest whole number, not the nearest tenth or decimal point. I sadly don’t know how to find the nearest tenth, but maybe you can find a way!

  • Homework! Try to find a way to find the nearest tenth or decimal of a number, instead of the whole number!

If you tap on the word “round” inside of the block you will see this:
image
If you want to round up or down instead of just the nearest whole number, chose one of those options. They are constantly overlooked, but they can be quite useful for certain things, like: finding the position of someone on a coordinate plane and things like that.

Randomizing
You may want to randomize a password to a door, but how? The random block! It’s the last block in the math category. This is it:
image
Now onto how to randomize stuff! So this block is very simple to understand, but essential in mathematics. Let’s say we want to multiply two different numbers that are random. Here’s what to do:
image
image
It should send you the answer that is completly random. In order to know what numbers were picked to multiply do this:
image
You may notice we have two variables in the picture to multiply, well that’s because we can do math with variables, not just numbers! (Properties too!)
image
The small button above is next to the create text with block.
image
image
Drag the item block into the j0in area.
image
And now hit run and it should send something like this:
image

Logic in math
By now you have probably noticed this block:
image
But what exactly is it, and what do you do with it? Well that’s where logic in math comes in! This probably should be in Logic Gates, but it’s in the Branch of Mathematics, because it uses math!

Advanced Mathematics
(Leaving this to WhoAmI)

Trigonometry
(Leaving this to WhoAmI)

Logic Gates

If statements
If statements run a check to see if specified conditions are true or false.
image

Clicking on the gear opens a sub-menu.
image

In the sub-menu, you can build the sub-blocks to create more complex IF statements.

If-else
If the statement above it returns FALSE, then run the if statement. Will not run if the one above it returns TRUE.

Else
If all other statements in the IF block return false, the Else returns true. Any that return true above it causes it to not run.

At any statement in the block, if the conditions are TRUE, then it stops checking and executes the code in the statement that returned true.

Other blocks from the LOGIC category can be put into the IF block’s statements. These check conditions and decide if it returns TRUE or FALSE

EXAMPLES
image
In this example, only the one line will run: the one that checks if var NUM = 2.
Because var NUM does indeed equal 2, the first line will return false, moving to the next line,
ELSE IF: NUM = 2
Because the ELSE IF statement returns true, the code inside it is executed, and the entire IF block ends.

And or or?
The third block in the logic category is the and operator. This operator allows you to check if multiple things are true intsead of 1.
image
In the picture above, the block of code will broadcast the message on channel true because num1 and num2 both equal true. If one of them was false or something else besides true, it would not broadcast the message on channel true. If you tap on the word “and” of the block it will show you this:
image
Tap on or and set num2 to false. Even though num2 equals false it still sends the message on channel true because the or operator checks if at least 1 of the variables(or other things) are true.

More details
If you want to learn more on logic gates check out this guide.

Terminology

Increment
Incrementing means to add 1 to a variable or property. You would do these:


You can also say incrementing by 5 or any number, but that doesn’t really have any uses.

Text
For this device only

Other

User Assignments

Anythinger: I’m doing Essentials and Variables
WhoAmI-The Branch of Mathematics is mine.
Heretohelp- Every device’s “for this device only”
@mysz- i wanted to do mathetmatics :( , but I guess I’ll do text.
Dragontamer: I’m doing logic gates.
Getritheked: I’m doing terminology.
VALUEX- Helping out WhoAmI with the Branch of Mathematics.

No one is currently editing

Changelog (UTC)

2023-07-21T20:00:00Z
WhoAmI added a list of block compatible devices.

2023-07-21T21:59:00Z
Anythinger edited skeleton to match TUG for Devices.

8 Likes

Nice! This is what we needed!

1 Like

This is just a skeleton post right now. It is just something to build upon.

1 Like

why is it a wiki post

1 Like

@WhoAmI before editing you need to change the currently editing bar otherwise it will override some edits

3 Likes

Oops. Going to reverse that right away.

1 Like

@WhoAmI for the times in the changelog use the calendar but make time zone UTC so anyone who sees it sees it in their time

3 Likes

Also, I added a tag called WIP.

1 Like

work in progress, i presume?

2 Likes

Yup.

2 Likes

I added my UA

2 Likes

tug means “The Ultimate Guide” right?

4 Likes

What is tug?

2 Likes

The Ultimate Guide

1 Like

isn’t a repeater compatible with blocks?

2 Likes

No

1 Like

Nope.

1 Like

ok, i just saw an old guide that had blocks and they said you only needed a repeater, so i thought it was block compatible

1 Like

Why does nothing happen when I’m active, but vast societal change happens when I’m away?

3 Likes

i don’t know, for some reason it just happens to people i guess. maybe you were meant to be at another party

1 Like