Variables and Properties

So, there are Variables and Properties in Gimkit which means that we have 2 different ways of storing information.

Rundown:
Variables are not a device and can only be accessed through the block code menu by creating it.
Properties are devices and can be changed by different devices (e.g Counter ) and the block code menu such as set property «A » to 10 which can also change the Property itself.

In depth of Variables

Variables can only be changed in block code and it costs 500 memory to make at least 1<.

Another fact is that a variable does not save its memory after your block code has finished its function and will reset.

But, variables save more block code space as using change “ Variable A” by 5 needs only 2 blocks and properties on the other hand needs this code to replicate it set property “Property A” to “get property (Property A)”+ 5
Which takes 6 blocks in total.


This is the full image of variable menu.

Create Variable

The use of create variable is very simple, when you press it, it gives you a prompt to name your variable and to create it.

Set “ A” to “ random string” 

The use of this is to change the information it contains entirely. Such as A=7 And then you use Set “A” to “Penguin” it will completely change it into a whole other data inside.

Change “A” by “a number”

What it basically does is it adds “a number” to your variable, whether it is 5 or -5 it only does a simple arithmetic.
Whoo! Last block for variables, oh boy my hands are tired.

“A”

This is the block where you can put it in spaces for it to replace data such as Set text to “Variable A” which means if Variable A is Penguin, the text would be Penguin

Finally, the variable is player scoped.

In depth on properties

So properties are different in many ways but similar in some ways.
One thing the property is different in is that it will save even when it has changed.

Also it has settings such as



And I will run all of this through,
Broadcast value change on game start is basically when it says if it is changed or not.

Property name
It’s very simple, it just changes the name of what the game calls it.
So it could be Penguin or Abcs or 123.

Property type
It means what type of data it stores, such as

  • Numbers (eg 1234567890)
  • Words such as (eg Penguin)
  • True or false, which is interesting as it is just a 1 and 2 version of the number type.

Now, setting it to a different type of data storage category will mean that it cannot save other types of data.

Default value

It means what it data it has on game start.

Property scope

What this means is it give makes different storage “categories”

  • Player: This means it saves data personalised to your actions and will not change if someone else does something.
  • Team: Same thing but changes when someone on tour team does something.
  • Global: Can be changed by everyone and everyone shares this data.
When property changes value, transmit on

Simplified, when Property A contains abc and it’s changed to def
it broadcasts on a channel.

My hands are tired and it is my first day so I won’t reply, but, ping me and I will see your suggestions or opinions.
Thanks. Signing out.

Which one is better?
  • Variable
  • Properties
0 voters
6 Likes

I don’t think that asking for an opinion on two devices is on topic, but it could be since it is about devices.


Also, properties are better because they don’t have faults like variables. Variables could potentially glitch out or disappear randomly, so using the property would fix whatever wasn’t working when you used the variable. Just my opinion though.

3 Likes

Don’t forget though, variables can save space, especially when you complete your block code using only 75 blocks rather than spending another 500 mem on a new block device.

Also, in many cases variables can do simple actions that we want to be broadcasted but not saved, like randomizing numbers for channels but we have no need to save. If we didn’t have variables, we’d have to make a property to hold the value and broadcast.


Anyways, I still vote properties. As a bulk they are the most important out of the two, but variables are a side benefit in many cases.

Technically, the block codes themselves ARE functions and the broadcasts are just call channels to activate them. Parameters would probably be the thing that’s plugged in (property values)

Sigh, when will people ever learn? They’re DELICIOUS!

2 Likes

Idk, my two cents is this:


Variables are block-scoped for a specific function, so better to use in general, just like in Javascript.

Properties are global variables, for if you need to reference data over and over again and you can’t find it algorithmically. Great potential for concatenation, one of the harder things to work out.

All in all, they do the same thing. Just have slightly different purposes.
(so try to use variables if possible).

Now we can all rant about the real problem with GKC, which is the lack of FUNCTIONS !!!

7 Likes

Opinion:
Depending on the situation, one is better than the other. For example when handling local process within a single device (and other devices aren’t dependent that process) then variables are better. However, when it comes to differently scoped global processes with multiple devices handling this process (like fall damage systems) then that’s where properties are more useful.

Note that a single device (for the variable opinion) can be dependant on other devices, just not devices dependant on it.

I just fully read the guide (I know, posting earlier without reading #1, the nerve) and I have some feedback.

  1. Pictures are worth 1,001.598 words exactly. As in, yeah, uh, more would be nice.

  2. Along with this, some visual examples (like example mechanics, block code, setups, etc.) would also take this guide to the next level.

  3. Nice job with the formatting- really, excellent command of Markdown, impressive considering you said you were new.

  4. Add a “depends on the use case” option for the poll ahhhh

All in all, neat guide. I do think it belongs more in Devices though.

Yet I want to call a function several times within a block and it needs to be progressive, so I can’t retrigger it over and over again, and triggers + blocks are not cheap ($540 USD, amirite) so a function section (mind you it’s included in Blockly by default) would be simply wonderful.

Oh, and loops. Loops would be wonderful too.

Text wall :D.

8 Likes

I know code, today my brain isn’t braining right now though. Explain what you mean, on any other day I’d understand this, today…yeah, I need context.

1 Like

Nice guide. Cool explanations and a good narrative.

1 Like

code still exists-- can we add that to the topic tags?

way ahead of you

Here is me saving blocks with variables. I would have to waste so many blocks without them! [1]

So many yummy err I mean tasty properties.


  1. They also look nice as a different color. ↩︎

6 Likes

Variables are underrated.

Prove me wrong.

4 Likes

Done, sorry for replying late, I was on first day limit.

3 Likes

Me when counters.

4 Likes

uh.
sure.

Counter are op.

2 Likes

To clarify, counters connected to properties go insane.

6 Likes

Variables can replace counters and properties in some ways with their change code block.

1 Like

How can variables replace counters?

1 Like

Like using their change by ().

I can’t change my original post but some new stuff for variables.
They save lots of memory even if it takes 500 memory per 1 and more.
They have much more flexible data storage.
Slim has a good point here

2 Likes

It would replace counter is the you saved the value to a property. When the block code finishes, it doesn’t remember the variable. That is why most people place them in properties if they want the variable to update without restarting.

Properties can remember their value throughout the game, while variables only remember their value during block code, after that it resets and repeats when the block code is called again.

3 Likes