mIRC Homepage

Help w/ calculating....

Posted By: HappyFappy

Help w/ calculating.... - 30/03/15 02:20 AM

this is what I have:
Code:
ON *:TEXT:!calc*:#roflmao:{ 
    if ($3 == -) {
      Set %num $2 - $4
      timer1 1 2 msg # %num
      halt
    }
    if ($3 == +) { 
      Set %num $2 + $4
      timer1 1 2 msg # %num
      halt
    }
    if ($3 == *) { 
      Set %num $2 * $4
      timer1 1 2 msg # %num
      halt
    }
    if ($3 == /) { 
      Set %num $2 / $4
      timer1 1 2 msg # %num
      halt
    }
    if ($3 == of) { 
      Set %num $2 ? $4
      timer1 1 2 msg # %num
      halt
    }
}

how can I set this to accept percentage?
like: !calc 13% of 1025
Posted By: Belhifet

Re: Help w/ calculating.... - 30/03/15 02:28 AM

uhh if right $2 == % then remove % / 100
Posted By: HappyFappy

Re: Help w/ calculating.... - 30/03/15 02:39 AM

Originally Posted By: Belhifet
uhh if right $2 == % then remove % / 100



how would this show? >.<
Posted By: Sakana

Re: Help w/ calculating.... - 30/03/15 08:40 AM

This should work
Code:
if ($3 == of) { 
      %a $remove($2,$chr(37))
      %a $calc(%a / 100)
      .timer 1 2 msg # $calc($4 * %a) 
      halt
    }
Posted By: HappyFappy

Re: Help w/ calculating.... - 30/03/15 01:25 PM

Originally Posted By: Sakana
This should work
Code:
if ($3 == of) { 
      %a $remove($2,$chr(37))
      %a $calc(%a / 100)
      .timer 1 2 msg # $calc($4 * %a) 
      halt
    }

Thank you smile
© 2022 mIRC Discussion Forums