mIRC Homepage

Perfect calculator

Posted By: lassyakjedi

Perfect calculator - 31/07/10 05:21 AM

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
Posted By: Wims

Re: Perfect calculator - 31/07/10 05:58 AM

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"
Posted By: lassyakjedi

Re: Perfect calculator - 31/07/10 06:01 AM

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
Posted By: Wims

Re: Perfect calculator - 31/07/10 06:07 AM

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)
© 2021 mIRC Discussion Forums