Author Topic: Calculator Commands | v1.5  (Read 8915 times)

Calculator Commands

Calculator Commands is a simple way to calculate in Blockland. It's not clientsided. It's a server script so that all your users can calculate if needed for building or eventing, whatever.

Usage
Any time ingame you can type /calc help
to get a list of what commands do what.
/calc <type> # #
Basically, you could type /calc add 3 5 and it would calculate 3 + 5
This will appear in the chat right after: CC Add: 3 + 5 = 8
Same thing will work for these commands:
/calc add/subtract/multiply/divide/sin/cos/tan #1 #2/rad/deg

Changelog
Quote from: v1 to v1.2
-All calculation functions now only allow numbers 1 and up (No 0 or letters.)
-Better way of scanning user's given numbers.
-Changed the error message to say CC (Add): instead of CC:. (will say what the calculation is, add, subtract, etc.)
-Changed commands from add, subtract, multiply, divide to ccAdd, ccSubtract, etc etc.
-Changed the /ccHelp command to say the version number and the new commands.
Quote from: v1.2 to v1.3
-Added /ccSin, /ccCos, and /ccTan.
-Modified /ccHelp a bit, including colours and new commands.
Probably more, I forget.
Quote from: v1.3 to v1.4
I basically re-wrote all of the code, to prepare for the upcoming client-sided version.
* Everything is in one command, /calc <type> <num1> <num2>.
* Just type /calc for what used to be /cchelp.
+ Added a message to players when they join (Not sure if it works yet, someone confirm.)
+ Added proper brackets to if/else triggers.
- Removed sin, cos, and tan. They were pointless.
Quote from: v1.4 to v1.4.1 UNRELEASED
*Fixed join message.
Quote from: v1.4.1 to v1.4.2
*Fixed join message.
+Re-added Sin/Cos/Tan (now with degree support)
-Removed the "this server has calculator commands v1.9.235.4 blah blah" line from /calc
NOTICE: The client-sided version will not be happening. I feel this should stay as a server-mod.
Quote from: v1.4.2 to v1.5.0
This update does not contain any new features, but I still see it as an important one.
*Re-did half the code to reduce the amount of lines and wedge pattern (see bottom of post).
*/calc is now /calc help. /calc will not work.
*Message now says CC <type>: instead of CC (<type>):

Wedge Pattern Fix
So if you ever looked at the server.cs it would sometimes like a bit like this:
Code: [Select]
if(blah = 1)
{
   if(blahhj = 1)
   {
      dothis;
   }
}
Now it is like this:
Code: [Select]
if(blah = 1 && blahhj = 1)
{
   dothis;
}

Dropbox Download

RTB Manager Download
not yet.
« Last Edit: November 24, 2012, 09:47:48 PM by Subpixel »

What does it do? Is it just a calculator?


Basically, you could type /add 3 5 and it would calculate 3 + 7
!


« Last Edit: September 25, 2012, 08:02:35 PM by Subpixel »

I think you should check for the first arg, other than that
Quote from: server.cs
So simple, it'll knock your socks off!

I think you should check for the first arg
Don't know what you're talking about.. is /add used by something else?


Don't know what you're talking about.. is /add used by something else?

What i mean is if someone typed /add hello 1 it would make your calc say "hello + 1 = 1", which is why you should check for the first argument on your add, subtract, multiply, and divide commands, as you only check for the 2nd argument, but still

Quote from: server.cs
So simple, it'll knock your socks off!

What i mean is if someone typed /add hello 1 it would make your calc say "hello + 1 = 1", which is why you should check for the first argument on your add, subtract, multiply, and divide commands, as you only check for the 2nd argument, but still

Only foolproofing it currently has is making sure you don't accidentally type /add 36 instead of /add 3 6, also it will do the same thing if you do /add 7 0, because that's just flat-out ridiculous.

I may change it soon, and make it only allow numbers from 1 and beyond. (No words)

Now v1.2
Quote from: Changelog
-All calculation functions now only allow numbers 1 and up (No 0 or letters.)
-Better way of scanning user's given numbers.
-Changed the error message to say CC (Add): instead of CC:. (will say what the calculation is, add, subtract, etc.)
-Changed commands from add, subtract, multiply, divide to ccAdd, ccSubtract, etc etc.
-Changed the /ccHelp command to say the version number and the new commands.



add /ccCos /ccTan /ccSin
I don't think that's possible with torquescript.
I might add /ccModulo