Shoutbox

[Release] Calculator (v1.20.011) - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Release] Calculator (v1.20.011) (/showthread.php?tid=66771)

[Release] Calculator (v1.20.011) by Matti on 09-29-2006 at 09:58 AM

It's there. Finally. After months of testing and trashing, Calculator has reached its day of final release. With proud I present you

Calculator
Version 1.20.011 FINAL

The Calculator script was made with the thought that when your discussing your math homework, you don't need calc.exe running next to it. But it was grown to a full application on its own. On the moment of writing, the script contained following features:
  • calculate an expression by typing "/calc [expression]".
  • convert a calculation to a different numeral system using "/calc [system] [expression]", e.g.: "/calc hex 8+2" will produce "A"
  • replace selected text in the typing area of the chat window with its result if it's a valid expression by pressing F5.
  • calculate the angle unit used by a trigonometric function (e.g. sine or cosine) to grads, for example.
  • open the Quick Calculator window to calculate something and then send the result to one or more contacts.
  • let the user choose how the results will be sent and enable the F5 calculating in the preferences window.
  • get documentation for the script by using the Help window
  • translate the script with a language .ini file.
  • automatically check for updates every hour.
It has only one command, which is:
code:
/calc [system] [expression]
but it accepts a variety of parameter options, which are
quote:
/calc = Opens the Quick Calculator Window
/calc 8+2 = Calculates "8+2" and returns "10"
/calc hex 8+2 = Calculates "8+2", converts it to hexadecimal and returns "A"
/calc ang deg = Sets the angle unit for trigonometric functions
/calc pref = Opens the Preferences window
/calc abt = Opens the About window
/calc help = Opens the Help window
The available systems are "dec", "bin", "hex", "sci" or "oct", their meaning is quite understandable I guess. As for the angle unit, it supports radians (rad), grads (grad) and degrees (deg). Changing the angle unit only affects trigonometric functions, so don't worry about miscalculations of 8 times 5 when you've set your angle unit to grads. ;)

To Do list:
  • let the user use numbers in different modes in the expression. (like, typing Hex(FF) would be parsed as 255) DONE!
  • add some extra functions? DONE!
  • maybe add an update checker if I left a bug in a release. :P DONE!
  • create a Help window (the "?" in the Preferences window) DONE!
  • submit it to the database before the scripting contest ends DONE!

And finally... the screenshots! :D
Changelog:
  • FINAL 1.20.011:
    • Bugfix: conversion failed when sending /calc [system] [exp]
  • FINAL 1.20.010:
    • Final release
  • PR 1.02:
    • Fixed bug causing offline contacts to appear as away in the Send Calculation window, now they just don't appear. (like I wanted)
  • PR 1.01:
    • Fixed bug causing the script to only parse 1 [calc] tag at a time
  • PR 1.00:
    • First public release
» Download Calculator 1.20.011 here! ;)
RE: [WIP] Calculator by Spunky on 09-29-2006 at 11:22 AM

Sounds good. This is something I might actually make use of. Just hurry up and get a download available :p


RE: [WIP] Calculator by Matti on 09-29-2006 at 12:33 PM

quote:
Originally posted by SpunkyLoveMuff
Sounds good. This is something I might actually make use of. Just hurry up and get a download available :p
Well, I first want to make sure everything that's already in it works good, before I release it. Then, I can begin to work on the other stuff. ;)
I'm not at my own pc atm, so you'll have to wait a bit longer untill I can take some screenies. I hope to do that around 17:00 CET, and maybe I can release a first beta this evening. But don't expect too much of it yet: it's only a calculator. :P
RE: [WIP] Calculator by markee on 09-29-2006 at 02:17 PM

quote:
Originally posted by Mattike
If the result isn't a natural number,
I think you mean integers so as to include negative numbers as well (and zero depending on your school of thought abut zero being a natural number or not).

quote:
Originally posted by Mattike
make a simple About window.
If you need any help with making windows Jay_Jay is very will to helpout, even if he only has his left hand to do it.  There might be alittle delay though as he is not at home atm, though I'm sure I canchange one of his already made ones to do what you want.

I hope we can help you out.

EDIT: Btw it sounds quite interesting :P
RE: [WIP] Calculator by Matti on 09-29-2006 at 04:43 PM

quote:
Originally posted by markee
I think you mean integers so as to include negative numbers as well (and zero depending on your school of thought abut zero being a natural number or not).
What I mean is any integer which is larger or equal to 0. Sorry, I just didn't know how to mention it. ;)
quote:
Originally posted by markee
If you need any help with making windows...
It's not that I can't do it, it's just that I didn't have time for it yet. Lazy me. :P
quote:
Originally posted by markee
Btw it sounds quite interesting :P
That's what I like to hear...

Time to take some screenshots! :D (with a delay of 2 hours :dodgy:)
RE: [WIP] Calculator by Chris4 on 09-29-2006 at 06:30 PM

Nice, lookin' good. :)
Will save me going to Start > Programs > Accessories etc. etc.


RE: [WIP] Calculator by Matti on 09-29-2006 at 06:39 PM

quote:
Originally posted by Chris4
Nice, lookin' good. :)
Will save me going to Start > Programs > Accessories etc. etc.
That's the idea behind it. ;)
RE: [WIP] Calculator by WDZ on 09-29-2006 at 06:51 PM

quote:
Originally posted by Chris4
Will save me going to Start > Programs > Accessories etc. etc.
I prefer WinKey+R, calc, Enter :p
RE: RE: [WIP] Calculator by Chris4 on 09-29-2006 at 06:53 PM

quote:
Originally posted by WDZ
quote:
Originally posted by Chris4
Will save me going to Start > Programs > Accessories etc. etc.
I prefer WinKey+R, calc, Enter :p

Thanks, I never even new about WinKey+R :P
RE: [WIP] Calculator by prashker on 09-29-2006 at 06:56 PM

I prefer

[Image: attachment.php?pid=735404]

Yes thats a calculator button on my keyboard....(I did not set anything up, the keyboard just comes with a calculator button :D)

edit: And about the up and coming script, looks really good, I will use the quick calculator some times ;-)


RE: RE: RE: [WIP] Calculator by Jimbo on 09-29-2006 at 06:58 PM

quote:
Originally posted by Chris4
quote:
Originally posted by WDZ
quote:
Originally posted by Chris4
Will save me going to Start > Programs > Accessories etc. etc.
I prefer WinKey+R, calc, Enter :p

Thanks, I never even new about WinKey+R :P

Lol me neither:p, i just used to have it in my taskbar:P
RE: [WIP] Calculator by Chancer on 09-29-2006 at 07:50 PM

I have one in my head!


RE: [WIP] Calculator by vaccination on 09-29-2006 at 11:35 PM

quote:
Originally posted by SonicSpam
I prefer

[Image: attachment.php?pid=735404]

Yes thats a calculator button on my keyboard....(I did not set anything up, the keyboard just comes with a calculator button :D)


Rofl, same as me *hits calc button*

But i think i would like to use this is would be nice to set how it is sent and i don't have to right out the answer :P
RE: [WIP] Calculator by phalanxii on 09-30-2006 at 12:39 AM

Wow, Mattike, that GUI is looking really awesome! Might I also suggest that you add in degrees, radians and grads in the preferences? Other than that, the script looks really nice. :)

(The F5 was my idea!! :P)



PS. I also have a calculator button on my keyboard... 8-)


RE: [WIP] Calculator by alexp2_ad on 09-30-2006 at 12:43 AM

Nice... but needs a [calc] tag.


RE: [WIP] Calculator by NanaFreak on 09-30-2006 at 01:02 AM

quote:
Originally posted by Mattike

quote:
Originally posted by markee
If you need any help with making windows...
It's not that I can't do it, it's just that I didn't have time for it yet. Lazy me. :P
damn im so bored because there isnt any hard script im working on (well maybe gradient but :P) but you have done a little better than what i would have done

but i like the script as well good job

* NanaFreak its calculator button on keyboard :P
RE: [WIP] Calculator by Matti on 09-30-2006 at 10:39 AM

quote:
Originally posted by vaccination
But i think i would like to use this is would be nice to set how it is sent and i don't have to right out the answer :P
That's why I'm making it. :P
quote:
Originally posted by phalanxii
(The F5 was my idea!! :P)
Yup, and I love it! :D
quote:
Originally posted by alexp2_ad
Nice... but needs a [calc] tag.
Hmm... that sounds interesting! Great request! :D
Then, I'll make it:
code:
[calc]8+5[/calc]
to result in 13 and:
code:
[calc=hex]8+5[/calc]
to display D. :cheesy:
RE: [WIP] Calculator by Jimbo on 09-30-2006 at 10:40 AM

when are you going to get a release out Mattike cos i cant wait


RE: [WIP] Calculator by Matti on 09-30-2006 at 10:45 AM

quote:
Originally posted by 134jimbodude
when are you going to get a release out Mattike cos i cant wait
Allright, I think I'll now make the About window and implement the [calc] thing, and then I'll release it. But the problem is that I still have to lunch @ 13:00 CET... :P
* Matti opens his script files...
RE: RE: [WIP] Calculator by Jimbo on 09-30-2006 at 10:48 AM

quote:
Originally posted by Mattike
quote:
Originally posted by 134jimbodude
when are you going to get a release out Mattike cos i cant wait
Allright, I think I'll now make the About window and implement the [calc] thing, and then I'll release it. But the problem is that I still have to lunch @ 13:00 CET... :P
* Mattike opens his script files...

So what time do you hting you will release it GMT
RE: [WIP] Calculator by Matti on 09-30-2006 at 11:40 AM

quote:
Originally posted by 134jimbodude
So what time do you hting you will release it GMT
I can't say. I'm trying to find a way to replace the [calc] tags using regexps, but if that won't work I'll have to use a for-loop. But when it's done, you'll find it here. ;)

EDIT: Okay, that was the hardest part. The regular expressions are working perfectly. :D
Next up: the About window. ;)
EDIT 2: And that was the About window. Time to send my baby to the big world. :)



Enjoy! ;)
RE: [WIP] Calculator by NanaFreak on 09-30-2006 at 12:55 PM

WICKED SCRIPT!!!!!!!!!!!!!!!! i give it 9 and a half/10 GO YOU!!

i cant wait untill the real release :D


RE: [Pre-Release] Calculator by Matti on 09-30-2006 at 01:10 PM

Okay, had to update it again since I left a bug: it could only parse one [calc] tag per message... :dodgy:
I wanted to fix this before the release, but I forgot. :P

Attachment updated.


RE: [Pre-Release] Calculator by Felu on 09-30-2006 at 01:42 PM

BUG
In the Calculator window when you click send the Send Window appears... The contact status images there are messed up. Like offline appear as away :P.


RE: [Pre-Release] Calculator by duck! on 09-30-2006 at 01:47 PM

I have a suggestion
The quick calculator should have a command like /qc because its much quicker than the other way going plus menu calculator then quick calculator...

EDIT: im getting the same bug as -!felu!-


RE: [Pre-Release] Calculator by Matti on 09-30-2006 at 01:49 PM

quote:
Originally posted by -!Felu!-
BUG
In the Calculator window when you click send the Send Window appears... The contact status images there are messed up. Like offline appear as away :P.
Damn, you're right. I was already wondering why I had so many away contacts.
PR 1.02 released
quote:
Originally posted by noodle!
I have a suggestion
The quick calculator should have a command like /qc because its much quicker than the other way going plus menu calculator then quick calculator...
I was thinking of adding such commands to, and now you remembered me on it, I'll add it. It'll be in the updated package when I need to release a bugfix again. :P
RE: [Pre-Release] Calculator by alexp2_ad on 09-30-2006 at 03:35 PM

Make the calc tag support [n] already! :P

Otherwise, pretty nice script. (Y)


RE: [Pre-Release] Calculator by Lourix on 09-30-2006 at 03:39 PM

Hey cool script Mattike good one :)


RE: [Pre-Release] Calculator by Matti on 09-30-2006 at 03:39 PM

quote:
Originally posted by alexp2_ad
Make the calc tag support [n] already! :P
Damn you got good ideas. :P
* Matti writes it down on a piece of paper...

RE: [Pre-Release] Calculator by Shondoit on 09-30-2006 at 07:35 PM

Maybe a small suggestion...

Instead of adding another command, use and empty /calc command to open the quickcalc...
so '/calc 8+5' will send '8+5=12' (:P)
and '/calc' will open the quickcalc...


RE: [Pre-Release] Calculator by Spunky on 09-30-2006 at 07:45 PM

quote:
Originally posted by Shondoit
Instead of adding another command, use and empty /calc command to open the quickcalc...
so '/calc 8+5' will send '8+5=12' (:p)
and '/calc' will open the quickcalc...
Thats sounds like a good idea... Just check to see if there are any params sent or not :D Script is looking awesome so far :p
RE: [Pre-Release] Calculator by Andrew_H on 09-30-2006 at 08:25 PM

Thats cool!:D

P.S. Off Topic: What version of messenger are you using? It dosn't look like mine.


RE: [Pre-Release] Calculator by Spunky on 09-30-2006 at 08:31 PM

quote:
Originally posted by Andrew_H
P.S. Off Topic: What version of messenger are you using? It dosn't look like mine.

Looks like WLM with the Vista skin and a background set

RE: [Pre-Release] Calculator by davidpolitis on 09-30-2006 at 09:24 PM

Sorry to be off-topic, but wouldn't care to share your messenger skin or background in This Screenshot?

Also, by the way SpunkyLoveMuff your websites download for PSM+ is wrong, it links to another script.


RE: [Pre-Release] Calculator by Zahid™ on 09-30-2006 at 09:32 PM

quote:
Originally posted by davidpolitis
Sorry to be off-topic, but wouldn't care to share your messenger skin in This Screenshot?
Its:
quote:
Originally posted by SpunkyLoveMuff
WLM with the Vista skin and a background set

RE: [Pre-Release] Calculator by vaccination on 09-30-2006 at 11:33 PM

Yay great to see a pre-release, i love it <3

Can't wait for the final :P


[Image: spleakef5.png]

Spleak is smart :tongue:


RE: [Pre-Release] Calculator by phalanxii on 10-01-2006 at 12:32 AM

Sweet pre-release! This (like all your other work) is very professional, Mattike! (Y)(Y)


In the QC, I can't quite use the letters (A-F) for hex, because the calculator doesn't parse them. Also, it might be better to convert expressions before making the calculations in other bases (so that 10+10 in binary = 100; maybe split modes to "input" and "output"). And degrees, radians and grads! :D

Again, super script!
RE: [Pre-Release] Calculator by Matti on 10-02-2006 at 05:03 PM

quote:
Originally posted by Shondoit
Instead of adding another command, use and empty /calc command to open the quickcalc...
so '/calc 8+5' will send '8+5=12' (:p)
and '/calc' will open the quickcalc...
Hmm... never thought about that. That will indeed make things easier.
And maybe, I can make '/calc pref' to open the preferences and '/calc abt' to open the about window...
That way, I only have one command left. :lol:

quote:
Originally posted by phalanxii
In the QC, I can't quite use the letters (A-F) for hex, because the calculator doesn't parse them.
I am aware of this. They were just meant to note that you will be able to use hexadecimal values, but not by simply typing them. I'll make the script to use special functions to let the user specify what mode should be used. For example, I'll make Hex(FF) to result in 255, so you can calculate with different modes. (e.g.: substracting hexadecimal numbers from binary numbers and returning the octal result)
quote:
Originally posted by phalanxii
Also, it might be better to convert expressions before making the calculations in other bases (so that 10+10 in binary = 100; maybe split modes to "input" and "output").
See previous reply. :P
quote:
Originally posted by phalanxii
And degrees, radians and grads! :D
Yes yes, I'll look for that. :)
quote:
Originally posted by phalanxii
Sweet pre-release! This (like all your other work) is very professional, Mattike! (Y)(Y)
...
Again, super script!
Hehe, thanks! :D
RE: RE: [Pre-Release] Calculator by CookieRevised on 10-02-2006 at 05:54 PM

quote:
Originally posted by Mattike
quote:
Originally posted by phalanxii
In the QC, I can't quite use the letters (A-F) for hex, because the calculator doesn't parse them.
I am aware of this. They were just meant to note that you will be able to use hexadecimal values, but not by simply typing them. I'll make the script to use special functions to let the user specify what mode should be used. For example, I'll make Hex(FF) to result in 255, so you can calculate with different modes. (e.g.: substracting hexadecimal numbers from binary numbers and returning the octal result)
do as JScript does (and other languages) add a prefix to the numbers instead of creating extra functions:
eg:

0x?? for binary numbers
or h01DF4B, o1472, b0110, etc

it is a lot easier/shorter to write:

/calc h01DF4B + h412F

than:

/calc Hex(01DF4B) + Hex(412F)

Also, using the function Hex() like Hex(FF) doesn't make sense when you compare it to how such functions work in other languages and stuff. Hex() is to convert something to a hex number, not vice versa. Just like Cos() is used to calculate the cosinus not to convert a cosinus to something else.

And then you could still use those extra functions, but to change the output to some base. which would be more logical IMHO. eg:

/calc Oct(h01DF4B + b110110)



RE: [Pre-Release] Calculator by Matti on 10-03-2006 at 03:56 PM

quote:
Originally posted by CookieRevised
h01DF4B, o1472, b0110, etc
There you have a good point. I think I'll try these. :D
quote:
Originally posted by CookieRevised
And then you could still use those extra functions, but to change the output to some base. which would be more logical IMHO. eg:

/calc Oct(h01DF4B + b110110)
Well, for changing the output I already have:
code:
/calc oct 8+5
so I don't need them. ;)

* Matti opens his project files... :)

EDIT: Yay! I made the modes working! hA now results in the decimal number 10, just as o12 and b1010. :D
Now, I'll have to make the negative numbers work... :-/ (e.g.: h-A)
RE: [Pre-Release] Calculator by CookieRevised on 10-03-2006 at 06:40 PM

quote:
Originally posted by Mattike
Now, I'll have to make the negative numbers work... (Smilie) (e.g.: h-A)
That doesn't exists.... That is, if you follow programming logic.

If you follow the math logic they do exist, but be EXTREMELY carefull in what you do, this is far from easy to implement this in the correct way.

Look at how a real scientific calculator works with numbers in another base to get the idea on how to implement it properly...

eg: -128 in hexadecimal can be hFF81, hFFFFFF81,  hFFFFFFFFFFFFFF81 etc... convert that back and you could get hFF81 = 65409, hFFFFFF81 = 4294967169, etc. It depends not only on what method you use, but also on the amount of bits/bytes you use to define a hexadecimal/octal/binary number, etc...

My advise would be to not allow negative numbers in other bases than the decimal base.


RE: [Pre-Release] Calculator by Shondoit on 10-03-2006 at 06:44 PM

For the functionality
Something like:
-hF*hF + h100 = h1
(It's no problem if this it implemented, is it?)

But he already got it to work...


RE: [Pre-Release] Calculator by CookieRevised on 10-03-2006 at 06:56 PM

quote:
Originally posted by Shondoit
For the functionality
Something like:
-hF*hF + h100 = h1
(It's no problem if this it implemented, is it?)

But he already got it to work...

it depends on what you mean with the negative sign. Normally a negative sign is part of the number (negative number) if used alone, not part of the calculation. Hence why you shouldn't do: -hF and interpret that as:
- convert hF to 15
- make 15 negative

The "make x negative" should come before "convert x to y", not before! Hence why negative hexadecimal/octal/binary numbers don't exist.

A hexadecimal number produces a negative decimal number if that hexadecimal number wraps around the edge you have defined for the hexadecimal environment.

If you want -15 in hexadecimal it should be hFE or hFFFE or hFFFFFFFE or hFFFFFFFFFFFFFFFE, depending on the range...

btw: "-hF*hF + h100 = h1" is wrong, it should be "h1F"

----------------

To give a better example of why you can't do all that: you will find it even more complex when you're dealing with floating points. Again, you can't do "hF.EF" as that does not exist, almost the same goes for the use of the sign.

----------------

(can't explain this too well, someone else?)

RE: [Pre-Release] Calculator by Matti on 10-04-2006 at 07:57 AM

Oh damn... then I guess I better remove the negative support. :(

Thanks for mentioning, Cookie. I think I'll start on one of the hardest parts of the script: the Help window, since it has to give lots of information. At least I can't break any programming logic with that. 8-)


RE: [Pre-Release] Calculator by phalanxii on 10-05-2006 at 10:27 AM

Blah, these were driving me a little mad... *-)

1. The F5 calculate works even if it is disabled. (Not that I don't use it :D)
2. Inverse trigonometry functions don't work. (Debug says "! Out of stack space") Fixed this one by removing this line (I think it causes a sort of loop):

code:
if (/^Math\.(a(?:sin|cos|tan2?))\((.+)\)$/.test(Token)) {
   var Func = "Math." + RegExp.$1 + "(" + RegExp.$2 + ")/Math.PI";
   if (/^degrees?$/i.test(Angle)){
      Token = Func + "*180";
   } else if (/^grad$/i.test(Angle)) {
      Token = Func + "*200";
   }
   Token = Token.Calculate();
}
3. Negative functions? (Not subtraction, but expressions beginning with "-Sin(1.5)" or "-Pi"; don't need this too desperately because "0-Pi" works)
4. Hexadecimal "not a number" is "NAN" as opposed to "NaN" in other bases.

Besides that, everything seems fine. (Y) Really helpful for maths homework. :)
RE: [Pre-Release] Calculator by Matti on 10-05-2006 at 05:54 PM

quote:
Originally posted by phalanxii
1. The F5 calculate works even if it is disabled. (Not that I don't use it :D)
That's what you have with pre-releases: the creator only tests what he thinks he needs to test... doh! :P
quote:
Originally posted by phalanxii
2. Inverse trigonometry functions don't work. (Debug says "! Out of stack space") Fixed this one by removing this line (I think it causes a sort of loop):
code:
if (/^Math\.(a(?:sin|cos|tan2?))\((.+)\)$/.test(Token)) {
   var Func = "Math." + RegExp.$1 + "(" + RegExp.$2 + ")/Math.PI";
   if (/^degrees?$/i.test(Angle)){
      Token = Func + "*180";
   } else if (/^grad$/i.test(Angle)) {
      Token = Func + "*200";
   }
   Token = Token.Calculate();
}

Hmm... strange, but if that can fix it...
quote:
Originally posted by phalanxii
3. Negative functions? (Not subtraction, but expressions beginning with "-Sin(1.5)" or "-Pi"; don't need this too desperately because "0-Pi" works)
Well, here I go again with another attempt for negative values! :D
quote:
4. Hexadecimal "not a number" is "NAN" as opposed to "NaN" in other bases.
Yeh, I wanted to show the hexadecimal values in capital letters, but it seems like I have to run a check for it first. 8-)
quote:
Besides that, everything seems fine. (Y) Really helpful for maths homework. :)
Heh... I guess that's why they requested this script. :P

RE: [Release] Calculator (v1.20.011) by Matti on 12-20-2006 at 10:16 AM

BUMP! Calculator 1.20.011 released and waiting for scripting database to update it. I hope they won't get mad that the update comes 2 hours too late... :(

Please check the first post for information. :)


RE: [Release] Calculator (v1.20.011) by Plan-1130 on 02-09-2008 at 04:43 PM

How about inline calculations? Like (!CALC=8*5) or something...
Since you have the engine, and we have Regular expressions, it shouldn't be too hard i guess?
Still, congratulations on such an advanced plugin :D