How to make a calculator (Difficulty: 🟧)

In this tutorial, we learn how to use buttons and properties to create a functional calculator! This calculator has the 4 basic functions of math, a game display to show the most recent calculation, and a working number changer.

This is what you will need:

  • 11x Buttons
  • 5x Triggers
  • 4x Properties
  • 2x Counters
  • Text to label the operations
  • A way to show the result. I’m using a game overlay.

Part 1 - Updating Counters

Let’s set up the counters. Make them global, start at 0, and update properties for both of the counters. The properties should be numbers, and be called values 1 & 2. Put buttons around the counters. Wire the buttons so that the top one increases the counter, the side one resets it to zero, and the bottom one decreases it. Feel free to make the buttons describe their actions.

g2

Part 2 - Setting the Operators

Create text to show which button sets which operator. Connect the buttons to the triggers with wires. The button should activate the trigger. GO into the blocks for the triggers and make it so that when the trigger is activated, set the property equationType to that operator.

g3

Part 3 - Creating the calculator

Add a trigger under the button on the right. Connect the button to the trigger with wires. This button will run the equation. Go into the trigger and add a new block.

Create 3 variables: a, b, and operator. Set a and b to values 1 and 2 and operator to equationType.

Create 4 if statements. Each one will check if operator is adding, subtracting, multiplying, or dividing. The triggers from the last step will define what the if is looking for.

In each of the statement, use the set property block. We want to set the output to what the operator says based on the 2 values. Basically, the addition one will output a + b, the subtraction one will output a - b, and so on.

Part 4 - Showing the text

Make the trigger transmit on a new channel, showResult. Then, make a new block in the game overlay that shows the result as text.

g5

That’s it! This calculator is quite simple. If you want, you can add more operators, like exponents, roots, and modular functions. Thanks for reading!

(Also, I don’t know if this bug happens for you, but I have to press the button twice for the result to update. Dunno how to fix it).

11 Likes

Nice guide! No one really bothered with a simple calculator, so this fills its own niche!

2 Likes

Actually, @Blackhole927 did make one but never posted a guide on it.

YOOOOO CALCULATOR GUIDE I AM SO EXITED FIRST EVER NEW USER TECHNICAL GIMKIT GUIDE WOOOOOOOOOOOOOOOOOOOOOOOOO

1 Like

Wait, but the graphing calculator guide I made? and candyland??? and tic tac toe??? and the gui???

New user technical gimkit guide: Someone who has barely been on the forums posts a technical gimkit guide!

the gui is barely finished, last time i checked, it was just a bunch of metal signs.

It’s not a new user, they’ve been here since the gimai days.

Yes, but check their activity on the forums.

They could’ve just gotten better over time but not talked on the forums. Also @ClicClac apparently found a string-indexing function, check it out. It’s in the item generation post by me.

Showmeshowmeshowmeshowmeshowme

Finally someone made a guide for a calculator! Amazing work, @JoeTheChicken!

Bump…perhaps I should dial down the size of my segments a bit more. Delving this deep into history can be very dangerous because you might hit something on the way down.

OOF! Just BUMPED into a calculator…… my head hurtsssss i bumped into a cat, invisible prop, a car, and another guild…Whats next? RIP me

You bump into a bank robber me?

1 Like

:bear: bear bump™ :bear: