mIRC Home    About    Download    Register    News    Help

Print Thread
Perfect calculator #223642 31/07/10 05:21 AM
Joined: Apr 2010
Posts: 24
L
lassyakjedi Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Apr 2010
Posts: 24
Hi,need some help pls

Code:
on *:TEXT:!calc*:#test: {
  if ($3 == $null) /notice $nick  $2 =7 $calc( $2 )

}

Its a simple calculator script ..works fine and all.
Code:
<~abc>!calc 500+500
from TestBot:500+500 =7 1000


But when i add comas (,) it dosn't read correctly.
Code:
<~abc>!calc 500,000+500,000
from TestBot:500,000+500,000 =7 500

If there's a script to amend that i'd like to have it please smile

Re: Perfect calculator [Re: lassyakjedi] #223648 31/07/10 05:58 AM
Joined: Jul 2006
Posts: 3,807
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,807
Simply remove any comma in the string when making the calculation :
Code:
on *:TEXT:!calc ?*:#test:notice $nick  $2- =7 $calc($remove($2-,$chr(44)))
I also edited the code so you should be able to use space like "5 + 6"

Last edited by Wims; 31/07/10 05:59 AM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Perfect calculator [Re: Wims] #223649 31/07/10 06:01 AM
Joined: Apr 2010
Posts: 24
L
lassyakjedi Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Apr 2010
Posts: 24
Originally Posted By: Wims
Simply remove any comma in the string when making the calculation :
Code:
on *:TEXT:!calc ?*:#test:notice $nick  $2- =7 $calc($remove($2-,$chr(44)))
I also edited the code so you should be able to use space like "5 + 6"

I need the comas as well to work, cause many people in my channel use comas in their calculation.

Ah thanks Wims worked like a charm.I'd be greatfull if i could get comas in my answer as well .Removing comas is a great idea smile ,but i'd appreciate it if i could keep them in the answers smile

Last edited by lassyakjedi; 31/07/10 06:08 AM.
Re: Perfect calculator [Re: lassyakjedi] #223650 31/07/10 06:07 AM
Joined: Jul 2006
Posts: 3,807
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,807
The code is only removing the commas when passing parameters to $calc since $calc doesn't handle them..

edit : if you want the commas after the calculation, you can use $bytes :

on *:TEXT:!calc ?*:#test:notice $nick  $2- =7 $bytes($calc($remove($2-,$chr(44))),bd)

Last edited by Wims; 31/07/10 06:44 AM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net