Grand Exchange Update Alert

Want to show off your scripts? Release them here and bask in the glory as the users give their opinions of your work.

Moderators: IRC Operators, Support Team, mIRC Gurus

Arconiaprime
User
User
Posts: 1458
Joined: Fri May 18, 2007 12:29 am
Contact:

Grand Exchange Update Alert

Postby Arconiaprime » Thu Nov 04, 2010 12:16 am

At the request of a #msl user here is a full GE Update Alerter based off Vectra's parser systems.

* As a side note, feel free to change the repetition in the timer, however abuse will have your IP banned from the parsers.
** Also please leave the User-Agent intact so I can track what networks this is used on.


All messages are sent through the 'handler' alias, please add whatever "msg #Somechan" or amsg commands there. Just reference as $1-)

Code: Select all

on *:sockopen:Geupdater.*: {
  if ($sockerr) { echo -ast Error connecting to GEupdate page. Reason: $sock($sockname).wsmsg | sockclose $sockname | halt }
  sockwrite -nt $sockname GET /Parsers/index.php?type=Geupdate HTTP/1.1
  sockwrite -nt $sockname Host: vectra-bot.net
  sockwrite -nt $sockname User-Agent: Crawler Bot (Ge Update Scraper on: $+ $network $+ )
  sockwrite -nt $sockname $+($crlf,$crlf)
}
on *:sockread:Geupdater.*: {
  if ($sockerr) { echo -ast Error connecting to GEupdate page. Reason: $sock($sockname).wsmsg | sockclose $sockname | halt }
  var %Sockread
  while ($sock($sockname).rq) {
    sockread %Sockread
    if ($sockbr == 0) { return }
    tokenize 32 $replace(%Sockread,:,$chr(32))
    if ($istok(LAST AVERAGE PREVIOUS,$1,32)) { hadd -mu10 $sockname $lower($1) $2- }
    if (END isincs $1-) { 
      var %time = $readini(geupdate.ini,Last,time)
      if (!%time) {
        ; first load don't run alert
        writeini geupdate.ini Last time $gettok($hget($sockname,last),1,32)
        hfree $sockname | sockclose $sockname | halt
      }
      else {
        if (%time != $gettok($hget($sockname,last),1,32)) {
          ; update occurred
          var %output *** (GEUPDATE) A Grand Exchange update has been detected. The previous update took $+($chr(2),$hget($sockname,previous),$chr(2)) $+ .
          handler %output
          writeini geupdate.ini Last time $gettok($hget($sockname,last),1,32)
          hfree $sockname | sockclose $sockname | halt
        }
        else { hfree $sockname | sockclose $sockname | halt }
      }
    }
  } ;while
}
on *:SOCKCLOSE:Geupdater.*: { hfree $sockname | sockclose $sockname | halt }

alias handler {
  if (!$1) { return }
  ; Make it do some action here otherwise everything falls to a blackhole (eg: amsg $1-)
  noop
  return
}
alias geupdater {
  if ($sock(Geupdater.*)) { return }
  sockopen $+(Geupdater.,$ticks) vectra-bot.net 80
}
alias startup {
  if ($timer(.Geupdater)) { timer.Geupdater off }
  timer.Geupdater 0 60 geupdater
}


I update my parser from time to time with new features and improvements, so as long as someone reminds me, I'll keep this page updated.
(Tim) Awong, the helpops are scaring me.
--------------------------------------------------------
SwiftIRC Services Administrator - 2010 - 2012
Owner: intrepid.il.us.SwiftIRC.net

Return to “Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests