All pastes #426755 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-06 11:30 UTC
rendered paste body
on *:TEXT:!m*:#: {
  set %x1 $remove($gettok($2,1,44),$chr(40))
  set %x2 $remove($gettok($3,1,44),$chr(40))
  set %y1 $remove($gettok($2,2,44),$chr(41))
  set %y2 $remove($gettok($3,2,44),$chr(41))

  %m = $calc((%y2 - %y1) /  (%x2 - %x1))

  /msg $chan The gradient between $2 and $3 is: %m  
}
on *:TEXT:!eqn*:#: {
  set %x1 $remove($gettok($2,1,44),$chr(40))
  set %x2 $remove($gettok($3,1,44),$chr(40))
  set %y1 $remove($gettok($2,2,44),$chr(41))
  set %y2 $remove($gettok($3,2,44),$chr(41))

  %m = $calc((%y2 - %y1) /  (%x2 - %x1))
  %eqn = y - %y1 = %m (x - %x1)

  /msg $chan The equation of the line between $2 and $3 is: %eqn  
}