Calculator to friends - 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: Calculator to friends (/showthread.php?tid=87813) Calculator to friends by mrfireman on 12-18-2008 at 12:37 AM
Dear guys! RE: Calculator to friends by toddy on 12-18-2008 at 01:35 AM
can i just ask you to clarify whether you want the script to give the correct answer? or whether you'd like the wrong answer given ala your example RE: Calculator to friends by mrfireman on 12-18-2008 at 01:44 PM
Ohh i misswrote I would like to give the script the correct answer RE: Calculator to friends by matty on 12-18-2008 at 04:04 PM Welcome to JScript. There is a function called eval(). Carry on my wayward son! RE: Calculator to friends by mrfireman on 12-18-2008 at 05:56 PM If anyone can script me this, just write here! Thanks RE: Calculator to friends by matty on 12-18-2008 at 06:01 PM
Why dont you try? RE: Calculator to friends by mrfireman on 12-18-2008 at 06:49 PM My only problem is, I cant programming well in msn scripting. I have read the handbook of this scripting, but it just say, which function what does. But how can I write a simple calculator, it doesn't say... so i am stupid about it. RE: Calculator to friends by matty on 12-18-2008 at 07:51 PM I already told you. You don't have to reinvent the wheel you can use the eval() function which will evaluate a mathematical expression. RE: Calculator to friends by mrfireman on 12-18-2008 at 08:13 PM
Here is a good sample, this calculator can give solution for everything. RE: Calculator to friends by matty on 12-18-2008 at 08:21 PM
Seriously it isn't hard to do if you take the time to learn. js code: You can check if the command is !calc by doing something like this: js code: To get the equation you can do something like this: js code: Then research how to use eval() or figure out how the script does it. RE: Calculator to friends by mrfireman on 12-18-2008 at 09:03 PM
My problem is: I dont have time, and energy to learn it, I work 12 hours a day. RE: Calculator to friends by matty on 12-18-2008 at 09:05 PM
I gave you almost everything you need... I am sorry but if someone isn't willing to learn then why should I just give them something... they wont learn at all... RE: Calculator to friends by Chrono on 12-18-2008 at 09:12 PM not everyone is willing to learn how to code, matty RE: Calculator to friends by matty on 12-18-2008 at 09:15 PM
quote:Well then that should have been specified instead of saying i want to make they should have said i want someone to make me blah blah blah... I dunno just my opinion and I am at work and cannot DL that script anyways lol. RE: Calculator to friends by mrfireman on 12-18-2008 at 09:22 PM You are right about the original post, i am looking for someone, who had a little time to write me the script. RE: Calculator to friends by WDZ on 12-19-2008 at 06:06 AM
quote: Sounds like a remote code execution vulnerability waiting to happen RE: Calculator to friends by Matti on 12-19-2008 at 08:31 AM
quote:Very true. What if the user does something like: code:So that's why Shondoit and me made the Calculator script some time ago, with a custom algorithm for calculations. Despite the fact that this algorithm isn't perfect, it does simple things fine. It's just that a remote command was never integrated in the script... What you could do to add some kind of remote command feature is either modify the script itself and add an OnEvent_ChatWndReceiveMessage function, or make a separate script which parses "!calc" from another user and makes you send "/calc". Simply remember that I'm not planning to work on the script myself for some time, I have other projects these days. RE: Calculator to friends by mrfireman on 12-19-2008 at 10:12 PM
Okey, I am waiting for my man/women to write it, 'cause I am not able to programming RE: RE: Calculator to friends by segosa on 12-20-2008 at 05:11 AM
quote: ... then nothing would happen since not only can you not format the active system partition, but it would also ask for confirmation. RE: Calculator to friends by TheBlasphemer on 12-20-2008 at 09:33 PM
How about: RE: Calculator to friends by Pinecone on 12-21-2008 at 11:14 AM
The following is untested. Should work with a few tweaks i think. code: RE: Calculator to friends by Spunky on 12-21-2008 at 11:56 PM
Here's something I've been playing with... It removes all alpha characters and most symbols except for mathematical operators from the eval string to try and prevent exposing your PC through WLM. RE: Calculator to friends by Matti on 12-22-2008 at 10:58 AM
@Pinecone: That looks like a very simple implementation, although I'd suggest you could optimize that code by breaking out of the loop as soon as you found an invalid character: code:@Spunky: Indeed, you can simply strip out all alphabetical characters and other possibly malicious characters. However, I'd suggest you to improve your stripping algorithm then: instead of looping through the whole array everytime !calc is received, you could create one single RegExp at start-up formed by a single loop which will strip all unwanted characters: code: And what if you'd want to extend such a script and make things like sin(60), cos(60), sqrt(64) work? Well, good luck to both of you if you're looking to extend your scripts. RE: Calculator to friends by mrfireman on 12-22-2008 at 12:35 PM THX GUYS! RE: Calculator to friends by mrfireman on 12-23-2008 at 05:18 PM
Hmm I have bad news (for me ) I tried to change the code, what you wrote before, but it doesnt working at me. RE: Calculator to friends by Pinecone on 12-23-2008 at 05:26 PM Maybe we can help explain where you've gone wrong if you post your changed code. |