Raptr.com status information

By GrimReaper on Apr 01, 2011

I don't know how many people use Raptr.com but I do and a few of my friends do as well.

So I can use this to see if they are online or not..

All you need to do is load it into the scripts editor in Remotes, Then do !Raptr info

And that's all it is.

on *:TEXT:!Raptr info*:#: {
  if (%raptrhalt == on) { HALT }
  elseif (!$3) { msg $chan * Error: Please use correct syntax: !Raptr info <Raptr name> }
  else {
    sockopen raptr raptr.com 80
    sockmark raptr $3 msg $chan [7R14aptr]
    set -u30 %raptrhalt on
  }
}
on *:SOCKOPEN:raptr: {
  if ($sockerr) { $gettok($sock(raptr).mark,2-3,32) * Error: Could not connect to the server. }
  else {
    var %a = sockwrite -n $sockname
    %a GET $+(/,$gettok($sock(raptr).mark,1,32)) HTTP/1.0
    %a Host: $+($sock(raptr).addr,$str($crlf,2))
  }
}
on *:SOCKREAD:raptr: {
  var %raptr | sockread %raptr
  if ($regex(%raptr,/<li class="lastseen"><i class=".*?"><\/i>(.*?)<\/li>/i)) {
    $gettok($sock(raptr).mark,2-,32) $+($gettok($sock(raptr).mark,1,32),'s) Current status.
    $gettok($sock(raptr).mark,2-,32) $regml(1)
  }
  elseif ($regex(%raptr,/<li class='clientstatus'><i class=".*?"><\/i>(.*?)<\/li>/i)) {
    $gettok($sock(raptr).mark,2-,32) $regml(1)
  }
}

Comments

Sign in to comment.
Jethro   -  Apr 01, 2011

You can use one regex, rather than two, to catch the keywords you're after, and then use the tokenize command in place of the $gettok to reduce some bytes. The trigger in you on text matchtext section is sort of incorrect, because you already indicate the $2 as "info," so there is no way for $2 not to be info. This is my approach of renovating your current script:

on *:TEXT:$($iif(!Raptr* iswm $strip($1-),$1-)):#:{
  if (%raptrhalt == on) { halt }
  elseif ($2 != info) || (!$3) {
    msg # * Error: Please use correct syntax: !Raptr info <Raptr name>
  }
  else {
    sockclose raptr
    sockopen raptr raptr.com 80
    sockmark raptr $3 msg # [7R14aptr]
    set -u30 %raptrhalt on
  }
}
on *:SOCKOPEN:raptr:{
  tokenize 32 $sock(raptr).mark
  if ($sockerr) { $2-3 * Error: Could not connect to the server. }
  else {
    var %a = sockwrite -n $sockname
    %a GET $+(/,$1) HTTP/1.0
    %a Connection: close
    %a Host: $+($sock(raptr).addr,$str($crlf,2))
  }
}
on *:SOCKREAD:raptr:{
  tokenize 32 $sock(raptr).mark
  var %raptr | sockread %raptr
  var %s /(last\sseen\sonline:\s\S+\s\d+\s\d+|client\sstatus\s\(\S+\))/i
  if ($regex(%raptr,%s)) { $2-3 The user $1 : $regml(1) }
}
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.