Objects: a box with smaller boxes inside
Think of a school bag with pockets. The bag is the Object. Each pocket has a name (a key) and holds something. Aprofile Object could look like this:
Why use one?
Instead of making three variables (coins, gems, title), you make one and keep everything together. This is great for profiles, shops and inventories.
Starting properties
When you make an Object variable (or a User → Object variable), you can add Starting properties: the named values every new entry begins with. Press Add property to add one. For example, addcoins = 0, gems = 0 and title = Newbie. Now every new member starts with exactly those pockets filled in.
You can set Starting properties in the builder’s Create New Variable window and on the Database page.
Reading a key
Put a dot and the key name after the variable:Changing a key
Use Save a value or Do the maths and fill in the Key box, for examplecoins. Or use the Object operation choices: Set a key, Get a key, Remove a key and Remove every key. See Change a variable with blocks.
Collections: a list
A Collection is a list of values in a row, like a shopping list:- a list of words your bot should delete
- a list of prizes for a giveaway
- a list of people who joined something
New to all this? You can build almost everything with Number, Text and User variables. Come back to Objects and Collections when you feel ready.
