All pastes #905800 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-02-16 01:01 UTC
rendered paste body
alias task {
  if (%amount != $null) {
    /echo -a You already have an ongoing slayer task of %amount %task $+ 's! Type /done to end it.
  }
  else {
    set %amount $1
    set %task $2-
    echo -a Retrieving HP for %task
    sockopen hpcheck www.geniebots.net 80
    .timer1 1 5 /msg $active Slayer Task: %amount %task $+ 's. That's $calc( %hp * %amount ) Slayer, $calc( %hp * %amount * 1.3) HP and $calc( %hp * %amount * 4) combat experience!
  }
}

alias done {
  if (%amount == $null) {
    /echo -a You do not have any active slayer task, type /task amount hp task to start one!
  }
  else {
    /msg $active My task of %amount %task $+ 's is complete! I gained $calc( %hp * %amount ) Slayer, $calc( %hp * %amount * 1.3) HP and $calc( %hp * %amount * 4) combat experience!
    unset %task
    unset %amount
    unset %hp
  }
}
on *:SOCKOPEN:hpcheck: {
  sockwrite -nt $sockname GET /bot/npcsearch3.php?name=%task&type=npc HTTP/1.1
  sockwrite -nt $sockname Host: www.geniebots.net
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:hpcheck: {
  if ($sockerr) {
    echo -a Error retrieving HP for %task
    halt
  }
  else {
    var %sockreader
    sockread %sockreader
    if (*|* iswm %sockreader) {
      set %hp $nohtml(%sockreader)
      sockclose $sockname
    }
  }
}