How to Make a Coolian Calculator ( Difficulty: 🟧 )

Introduction

In this guide I will be showing you how to make a calculator where you can input numbers, choose the equation symbol, and see your calculations.
However, this calculator is a relatively simple one and can only: Input positive whole numbers, only have 2 values inputted, clear (no backspace).
Also this uses 10% memory, so while it is a cool add to your map, it isn’t great for very high memory crammed maps unless necessary.

What the finished calculator will look like (with optional barriers for looks):
image

Also make sure to check out this calculator guide by @JoeTheChicken ! It’s awesome, but uses buttons and counters to manually increase and decrease the values by 1 while with mine you can input the values with just pressing the number buttons.

Alright, let’s get started!

The Basics

Place down a text device. Paste this into it:
1‎ ‎ ‎ ‎ ‎ ‎ ‎ 2 ‎ ‎ ‎ ‎ ‎ ‎ 3 ‎ ‎ ‎ ‎ ‎ ‎ +

4‎ ‎ ‎ ‎ ‎ ‎ ‎ 5 ‎ ‎ ‎ ‎ ‎ ‎ 6 ‎ ‎ ‎ ‎ ‎ ‎ –

7‎ ‎ ‎ ‎ ‎ ‎ ‎ 8‎ ‎ ‎ ‎ ‎ ‎ ‎ 9‎ ‎ ‎ ‎ ‎ ‎ ‎ x

C‎ ‎ ‎ ‎ ‎ ‎ ‎ 0‎ ‎ ‎ ‎ ‎ ‎ ‎ =‎ ‎ ‎ ‎ ‎ ‎ ‎ ÷

This is the layout of the calculator, and I put it here to save you time. You can also make each one a separate text device to have more control around each individually, but that costs more memory. And also, why?

Ok, so you should have this now (I made the font Galindo and colored the text white):
image

Next, a slightly tedious part. Place a button down below each number and make the settings like this:


(This is the button for 1)

(Button for 2)

(Button for 3)

See a pattern? Yup, I just made the message and channel the number. Also I made interaction duration Instant because I feel like that’s more like an actual calculator. I had to make the buttons Not Visible In-Game even though I liked the look because buttons naturally have collision that cannot be turned off unless they are invisible, so players wouldn’t be able to reach the numbers in the middle if the buttons were visible.

Now also put buttons under the C, =, +, -, x, and ÷. Same settings, except make the buttons show and broadcast on Clear for C, = for =, + for +… yeah.

You should have this:
image
(No I didn’t have grid snap on for this, sorry)

Finally, place another text device at the top. Just make it 0, and don’t add any blocks to it for now, but this will be the text that displays the values.

image

The Setting System

Place down a trigger. Make its settings look like this:


image

Basically, all this trigger does is broadcast on channel “set” when triggered. That’s it.
Now wire the buttons to the trigger: Button Pressed → Trigger
Wire four of them into the trigger. Then place a wire repeater. Wire the remaining buttons to the wire repeater: Button Pressed → Repeat Wire Pulse.
When that wire repeater can’t take anymore wires, make another, and do the same thing. Then lastly wire both of the wire repeaters to the trigger. When wire repeater receives a pulse → Trigger. All of the buttons wired up should take 1 trigger and 2 wire repeaters, with each device having 6 wires in it, looking like this:

Looks complicated? It’s not, I’m just terrible at making things look simple :smile: .
What I’m trying to show is that 1, 2, 3, and +, go into the trigger. 4, 5, 6, - , 7, and 8 go into the first wire repeater. 9, x, C, 0, =, ÷ go into the second wire repeater. Then, both the wire repeaters go into the trigger.
And what is all of this for? To make the channel “set” broadcast each time a button is pressed. Yup, that’s it. In fact, it doesn’t even matter what buttons are wired into the wire repeaters or triggers, as long as they all go the the trigger eventually. So just, ignore my rapid color scribbles.
All of the wires eventually trigger the trigger that broadcasts “set”.

Properties

Ready to make a bunch of properties? You better be. I generally don’t like making a bunch of properties at once without knowing what they’re used for, but in this case I think we have to because otherwise we would need to keep jumping in the middle of block code to make a property. I’ll try to explain what they’re used for, and you’ll get it more when we make the block case actually incorporating the properties.
We’ll be making 7 different properties.


firstvalue


This is the property that keeps the value of the first value.


secondvalue


This is the property that keeps the value of the second value.


digits


This is the property that keeps track of the amount of digits in the first value.


digits2


This is the property that keeps track of the amount of digits in the second value.


values


This is the property that keeps track of the amount of values in the equation.


equation


Probably not the best name for it, but this keeps track of the equation symbol used. This is the only text property used.


answer


This is the property that stores the answer of the final equation.


Hopefully you got through that, and mostly understood their uses.

Blocks

Block time! The fun part, but also the most tedious part. Because we will be making a block for every single button.
Place down an item granter (it’s only used for the blocks, I use them because they are the lowest memory block device).
Make a block when receiving on channel “1”.
image
Here is the block you need to make:

Update: @Grey_Stone has very helpfully pointed out that you actually don’t need the if statement checking if there are 1 or more digits. So the updated block would look like this:

image
Much simpler. Again, thanks to @Grey_Stone .
Let me try to explain.
First, it checks if there is one value or two. If there is one, it updates the first value, if there’s two it updates the second value. Then it multiplies the digits by 10, then adds 1. The variable named tree is just a random name. I didn’t know what to name it so I just randomly named it tree, but tree doesn’t mean anything special. Then it adds 1 to the digit property.
And, you have to do this for each number. Yup, I did say this was tedious. You mostly keep the blocks the same except for what you set first and second value to. I’ll show blocks for 2 and 3 and circle what changes.
Remember, use the updated easier blocks, refer to the updated channel 1 block for what I got rid of.
Block for channel 2:
image

Block for channel 3:
image

Ok, now do that for channels 1 - 9. Channel 0 is a little more simple:

image


Because it’s just 0, we don’t need to add 0 so we just multiply it by 10.

Also devies have a block limit of 6, so when you finish 0-9 you should have filled one item granter and have 4 blocks in a new item granter.

Now, we make the blocks for the equation symbols. Start with a block when receiving on channel “+”.
image
image
That simple. No long blocks for the equation symbol blocks!
Here are the rest of the equation symbol blocks:
For -
image

For Ă·
image

For x
image
There is one thing for this block. Instead of putting the letter x like I’d been using in the value for “equation”, I used this symbol: ×
It’s just the actual multiplication symbol and looks better than the letter x in the equation.

Also you should have filled your second item granter with blocks and went on your third and final block item granter by now.

Alright, you’re almost done with blocks now! Just a few more to go. Make a block for channel “=”
image


Looks a bit bulky, but just determines the equation symbol, then performs that equation.
Again, make sure that the Get Property “equation” = “×” uses the multiplication symbol ×, not x.

Ok, last block in your item granter. This is for the channel “Clear”
image
image
Just clears and resets all of the properties back to their original values.
Make sure property “equation” uses a text block because it’s a text property.

You’re so close to being done now! One last block. Go back to your 0 text above all of your numbers.
Screenshot 2023-10-30 22.31.26
That one. Open a block receiving on the channel “set”. Remember this is the channel that all of the buttons will trigger when pressed?
image
image

This block just sets the text to show the current equation. Also wondering why the property answer was set to -99999999999? What a random number. Well, it’s just to make sure that the answer hasn’t been calculated yet. Making it 0 wouldn’t work, because the actual answer to the equation could be 0. And, because the blocks set the answer, not add to it, it doesn’t actually matter what value it’s set to. But, on the slim chance that -99999999999 is the actual answer to the equation, welp we’ve got a problem.

Optional

To make the calculator look a bit better than just numbers on the ground, place down a rectangular barrier, no collision, set transparency 1. Color it grey and adjust its size under the calculator.
image
Now make a rectangular barrier, no collision, set transparency 1 but color it light blue. Position it like this:
image

Summary

Anddddddd… That should be the whole calculator done! You can test it now. You should be able to press the numbers, they should appear, you should be able to press equations and calculate them, and you can clear the equation. Hopefully I didn’t forget anything, and everything works.
There are probably numerous ways to simplify the block code or get rid of some properties, but I’m not a block wizard. This is how I did it, and this my way, though you are welcome to find ways to make it more simple. A :heart: would always be appreciated, as this guide took way too long. Have fun!

What Difficulty Should This Guide Be?
  • 0/10 or :white_large_square:
  • 1/10 or :blue_square:
  • 2/10 or :green_square:
  • 3/10 or :green_square:
  • 4/10 or :yellow_square:
  • 5/10 or :yellow_square:
  • 6/10 or :orange_square:
  • 7/10 or :orange_square:
  • 8/10 or :red_square:
  • 9/10 or :red_square:
  • 10/10 or :purple_square:
  • 11/10 or :black_large_square:
0 voters
17 Likes

Wow! Great and detailed guide, @I’m_Pretty_Cool! It was a really good read. Thanks for improving the forum!

2 Likes

Thank you! I appreciate it.

3 Likes

Wow.
Nice guide @Im_Pretty_Cool!
(Even though I can’t understand it)
I can’t imagine how much time this took you.

Is this the second longest guide on the forum?

3 Likes

Thanks, it’s really not that complicated I just like to add way too many explanations and pictures. Trust me, it’s a lot simpler than it looks, but it did take me a while it make this guide :]

5 Likes

I like it. But I still like mine cuz its mine

3 Likes

Great guide, I had a lot of fun making this!

2 Likes

In the trigger, do you really need the second if statement? If the starting digit is 0, multiply it by 10, then add 1, and it will still end up as 1. Still, good job. This is really cool.

Why do people keep making calculator guides before me?

2 Likes

Nice guide!

1 Like

I think you mean that first block for channel 1? There are no blocks in the trigger. Anyway, that’s a very good point. Thank you for that, that saves some blocks and time.
I added it to guide with credits.

3 Likes

Thanks! Also, why do you need the “Tree” variable? I don’t understand what it does. Could you please explain that?

Great guide, @Im_Pretty_Cool!

P.S. Haven’t seen you post a while!

1 Like

The tree variable is just the firstvalue (or secondvalue) property x 10. Maybe it’s not necessary to set it to a variable first, but I did.

Blizzy

Yeah, I’ve been busy and have moved from the forums. I still scroll around and look at guides, though.

4 Likes

This was amazing. The block code was genius, and the art was simple but effective. Amazing job, @Im_pretty_cool!

1 Like

Great guide @Im_Pretty_Cool! Very complex at least for me.

1 Like

Great job! Good to see you making guides again!

1 Like

Nice guide! This confuses me, but looks good!

4 Likes

Bump! This is an amazing guide, should have been bumped earlier.

Amazing guide @Im_Pretty_Cool!

1 Like

Bump! Great guide!!…