This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
KingOfAllChunks's profile picture

Calculator+ [v.1.0] ALPHA

Started by KingOfAllChunks, 08 March 2014 - 05:12 PM
KingOfAllChunks #1
Posted 08 March 2014 - 06:12 PM
Hello there guys. Today im posting my first official lua script. It is called "Calculator+". Note that i made this just for fun, i dont care if some one tells that there is something already out there like mine. Dont expect it to be super perfect, as the fact its my first one!

What it does?
It is a multiblock structure ( monitors ) and it displays calculator with clickable buttons on schreen YAY!
Basically you click the number buttons and they show up on the "display" line. You then choose what action to do with that number ( to add, to subtract , to multiply or to divide ) and after that you type in the second number. Then you press the "=" button and BOOM it calculated them for you! You can awesoe calculate with the result! Press "clear" button to clear the schreen for new calculations! Say bye bye to math class with this little script!

Gimme dem schreenshots!
Here is the starting schreen:
[attachment=1516:2014-03-08_19.33.06.png]
Whell… thats it thanks to my global upload quota…

Are there any bugs?
I fixed as much as i can find, please REPORT if you find any wrong calculations/or other glitches that may come during your use of my script.
If you spot a bug, try pressing the "clear" button
Awesoe you CAN'T have more than one symbol on the schreen ( aka more than one +,-,* or /), it WILL give you an "TOO MANY SYMBOLS" error. Press "clear" to fix.
Shut up and gimme the script!
WARNING! This requires both advanced monitors ( 4 of them ) and an advanced computer
If you want it so badly, slap an advanced computer on the ground and type in this thing:
pastebin get 3uBUu0MM button -API for the main program
then this:
pastebin get UZ0CMZ91 startup -main program
Thats it! If you've done it correcctly read the next step
How to set it up?
STEP 1: After you have downloaded BOTH programs, get 4 advanced monitors and slap them on TOP of the computer in a 2x2 shape.
STEP 2: Run startup in the computer and if you have set this up correctly you will see the GUI of the calculator on the monitors.
STEP 3: You are done! Now just start CAlCULATING like a math master!
Can i use this in my LP/World download/Anything else…??
You can, as long as you give credit!
Edited on 08 March 2014 - 06:19 PM
Alice #2
Posted 08 March 2014 - 08:21 PM
This looks like a cool GUI, and 'gratz on first program.
MostwantedRBX #3
Posted 09 March 2014 - 01:05 AM
Looks neat! Good job. :D/> May I suggest adding more options like a backspace button(so you don't have to clear the whole problem), and finding certain %s of other numbers?(If you want to know how, you multiply the number by the percentage you want with a decimal in front, like 15% of 10 is 0.15*10) Just some ideas for development, then it will be more then just a calculator. :P/>
Edited on 09 March 2014 - 12:06 AM
KingOfAllChunks #4
Posted 09 March 2014 - 09:21 AM
Looks neat! Good job. :D/>/>/> May I suggest adding more options like a backspace button(so you don't have to clear the whole problem), and finding certain %s of other numbers?(If you want to know how, you multiply the number by the percentage you want with a decimal in front, like 15% of 10 is 0.15*10) Just some ideas for development, then it will be more then just a calculator. :P/>/>/>
Thanks, and LOL I know how to calculate % of a number… The backspace button Is kinda impossible to do without changing the whole code… But I will try do add more functions like %.. The + in the name is just for the cool GUI, I guess I might add functions for it to be real +

This looks like a cool GUI, and 'gratz on first program.
Thanks! I will try to add more stuff into it for it to be real "Calculator +"
Edited on 09 March 2014 - 08:17 AM
MostwantedRBX #5
Posted 09 March 2014 - 07:39 PM
I have an idea for the backspace button. All you should have to do it use the :len() function on the number to get the length of the inputted number then use the :sub() function to cut off the last number. So maybe kinda like this:

local Number = 100
local LengthOfNumber = tostring(Number):len()
print("Before backspace:\nNumber: "..Number.."\nLength: "..LengthOfNumber) --Will output 3
Number = tostring(Number):sub(1,LengthOfNumber - 1)
LengthOfNumber = tostring(Number):len()
print("\nAfter backspace:\nNumber: "..Number.."\nLength: "..LengthOfNumber) --Will output 2

That uses a mix of string functions to take a number off the end of the the line of numbers. You can actually perform arithmetic on numbers converted to string, if you didn't know. :)/> So print("10" + 10) would output 20.

PS: if you want to figure this out on your own, tell me to shutup and I will. :)/>
KingOfAllChunks #6
Posted 10 March 2014 - 06:05 PM
I have an idea for the backspace button. All you should have to do it use the :len() function on the number to get the length of the inputted number then use the :sub() function to cut off the last number. So maybe kinda like this:

local Number = 100
local LengthOfNumber = tostring(Number):len()
print("Before backspace:\nNumber: "..Number.."\nLength: "..LengthOfNumber) --Will output 3
Number = tostring(Number):sub(1,LengthOfNumber - 1)
LengthOfNumber = tostring(Number):len()
print("\nAfter backspace:\nNumber: "..Number.."\nLength: "..LengthOfNumber) --Will output 2

That uses a mix of string functions to take a number off the end of the the line of numbers. You can actually perform arithmetic on numbers converted to string, if you didn't know. :)/> So print("10" + 10) would output 20.

PS: if you want to figure this out on your own, tell me to shutup and I will. :)/>
thanks! I dodnt kow about the len() and sub() functions. I dont think that your part of program will be much helpful because of the way i set it up. Better to get on my ass and think a bit… Still thanks, can use this partially
MostwantedRBX #7
Posted 11 March 2014 - 12:40 AM
Cool, can't wait to see what you do with it. :D/>
Konlab #8
Posted 03 April 2014 - 02:53 PM
Nice work!
Can I download and edit the code?
I'll write your name at credits
KingOfAllChunks #9
Posted 05 April 2014 - 05:21 PM
Nice work!
Can I download and edit the code?
I'll write your name at credits
1-Thanks
2-You can download and edit the code ( why else would i give download links? )
3-Thanks, credits are always welcome!

Awesoe, can i see what you channge in the program, maybe i will implement it in the next version..
Edited on 27 April 2014 - 08:06 AM