Runescape players

By Mfoust on Mar 12, 2011

This is my first non parser socket, feel free to post on how i can make my scripts better in the future
add this to aliases /nohtml return $replace($remove($regsubex($regsubex($1-,/<[^>]+>/g,$null),/&#(\d+);/g,$chr(\1)),$chr(9)), ,$chr(32),©,$chr(169),",",',',',',<,<,>,>,&,&,',',$eval(%27,0),',–,$chr(150),",",% $+ 2C,$chr(44))

~Mfoust~

on $*:TEXT:/^[!@.]players\b/i:#: {
  if ($sock(rsplayers)) { sockclose rsplayers } {
    set %msg $iif(@* iswm $1 ,msg $chan,notice $nick )
    /sockopen rsplayers www.RuneScape.com 80
  }
}
on *:SOCKOPEN:rsplayers: {
  /sockwrite -nt $sockname get /title.ws HTTP/1.1
  /sockwrite -nt $sockname Host: www.runescape.com
  /sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:rsplayers:{
  if ($sockerr) { sockclose $sockname | halt }
  var %sockreader | sockread %sockreader
  if (*<span id="playerCount">* people currently online</span>* iswm %sockreader) {
    tokenize 32 %sockreader
    %msg There are $nohtml($1-2) people currently online.
    unset %msg | sockclose $sockname
  }
}

Comments

Sign in to comment.
cptpan   -  Dec 19, 2011

What the fuck does this even do

 Respond  
Gummo   -  Mar 14, 2011

GET and POST are only methods of requesting/sending data. Your regex is used when receiving it.

 Respond  
Jethro   -  Mar 13, 2011

Your friend should have edited the alias for you, because it has irrelevant variables in them.

 Respond  
Mfoust   -  Mar 13, 2011

well i got the nohtml alias from my friend tom-

 Respond  
Sorasyn   -  Mar 13, 2011

I'm speaking from personal experience as I have none in POST sockets so I'll take your word for it. :) And yeah there have been innumerable versions of the $nohtml alias it's hard to pinpoint exactly who made it.

 Respond  
Jethro   -  Mar 13, 2011

Sunny, regex can work well with a POST socket too. That alias shown in the introduction is probably acquired from somewhere else, as there are variables that aren't found in the code. It looks rather familiar to someone's, but I won't say who...especially since MSL is vastly ubiquitous.

 Respond  
Sorasyn   -  Mar 13, 2011

Good to see you expanding to sockets Mfoust. As per personal preference $regex works well in conjunction with GET sockets, and might be something look into someday if the need arises. Also if you have an alias that is required for it to work, it might be a good idea to paste it in along with the snippet and not in the description itself.

 Respond  
Jethro   -  Mar 12, 2011

You don't need nohtml alias with regex:

on $*:text:/^([!@.])players$/iS:#:{
  if (!%f) { inc -u4 %f | if ($sock(rsplayers)) { sockclose $v1 }
    sockopen rsplayers www.RuneScape.com 80
    sockmark rsplayers $iif(@ == $regml(1),msg #,notice $nick)
  }
}
on *:SOCKOPEN:rsplayers: {
  sockwrite -nt $sockname GET /title.ws HTTP/1.1
  sockwrite -nt $sockname Host: www.runescape.com
  sockwrite -nt $sockname
}
on *:SOCKREAD:rsplayers:{
  if ($sockerr) { sockclose $sockname | halt }
  var %sockreader | sockread %sockreader
  if ($regex(%sockreader,/(\d+,\d+\s)/)) {
    $sock($sockname).mark There are $regml(1) people currently online.
    sockclose $sockname
  }
}
 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.