All pastes #742797 Raw Edit

Mine

public text v1 · immutable
·published 2007-10-19 20:50 UTC
rendered paste body
on *:text:!calc *:#:{
  if ($2- isletter && pi !isin $2- && k !isin $2- && m !isin $2- && b !isin $2- && t !isin $2-) { notice $nick Invalid equation. | halt 
  }
  else { notice $nick $2- = $bytes($calc($regsubex($replace($2-,pi,$pi),/([\d.]*)([kmb])/gi,$calc($iif(\1,\1,1) * $+(1,$str(0,$calc($pos(kmb,\2,1) * 3)))))),db) 
    set %lastequation. $+ $nick $2- = $bytes($calc($regsubex($replace($2-,pi,$pi),/([\d.]*)([kmb])/gi,$calc($iif(\1,\1,1) * $+(1,$str(0,$calc($pos(kmb,\2,1) * 3)))))),db)
    halt 
  }
}
on *:text:@calc *:#:{
  if ($2- isletter && pi !isin $2- && k !isin $2- && m !isin $2- && b !isin $2- && t !isin $2-) { msg $chan Invalid equation. | halt 
  }
  else { msg $chan $2- = $bytes($calc($regsubex($replace($2-,pi,$pi),/([\d.]*)([kmb])/gi,$calc($iif(\1,\1,1) * $+(1,$str(0,$calc($pos(kmb,\2,1) * 3)))))),db) 
    set %lastequation. $+ $nick $2- = $bytes($calc($regsubex($replace($2-,pi,$pi),/([\d.]*)([kmb])/gi,$calc($iif(\1,\1,1) * $+(1,$str(0,$calc($pos(kmb,\2,1) * 3)))))),db) 
    halt 
  }
}
on *:text:!lastcalc:#:{
  if ([ [ $+(%,lastequation.,$nick) ] ] == $null) { notice $nick You haven't calculated anything before. | halt }
  notice $nick [ [ $+(%,lastequation.,$nick) ] ]
}
on *:text:@lastcalc:#:{
  if ([ [ $+(%,lastequation.,$nick) ] ] == $null) { msg $chan You haven't calculated anything before. | halt }
  msg $chan [ [ $+(%,lastequation.,$nick) ] ]
}
on *:text:!sqrt *:#:{
  if ($2 isletter) { msg $chan Invalid equation. | halt }
  notice $nick Square root of $2 = $sqrt($2)
}
on *:text:@sqrt *:#:{
  if ($2 isletter) { msg $chan Invalid equation. | halt }
  msg $chan Square root of $2 = $sqrt($2)
}
on *:text:!sq *:#:{
  if ($2 isletter) { msg $chan Invalid equation | halt }
  notice $nick $2 squared = $calc($2 * $2)
}
on *:text:@sq *:#:{
  if ($2 isletter) { msg $chan Invalid equation | halt }
  msg $chan $2 squared = $calc($2 * $2)
}
on *:text:!cu *:#:{
  if ($2 isletter) { msg $chan Invalid equation | halt }
  notice $nick $2 cubed = $calc($2 * $2 * $2)
}
on *:text:@cu *:#:{
  if ($2 isletter) { msg $chan Invalid equation | halt }
  msg $chan $2 cubed = $calc($2 * $2 * $2)
}