Torn info socket

By [Plornt] on Apr 24, 2011

Oddly asked by a few people to make this. Not the best way of doing it in the world but it does allow for a bit of custimisation (Although the regex could have been used more sparingly).

But yeah what you do is type !info Torn-ID (or torn name if you have them stored in ids.txt) and it outputs a message to the channel with information on that user.

What exactly gets messaged is up to you since I have a few "backward" variables that get replaced when outputting. Just edit the first and second lines to your needs.

;color% name% gender% age% level% rank% faction% property% job% life% marstat% married% friends% enemys% posts% score% lastaction
alias INFOMESSAGE return Hello name% your gender is gender% your Age is age% your level is level% your rank is rank% your faction is faction%
alias binfo {
  var info. $+ $rand(1,9999)
  while ($sock( var info. $+ $rand(1,9999)
  sockopen 80
  sockmark $+($1,:,$2-)
on *:sockopen:info.*:{
  sockwrite -n $sockname GET $gettok($sock($sockname).mark,1,58) HTTP/1.1
  sockwrite -n $sockname Host:
  sockwrite $sockname $crlf
alias -l g return $gettok($1,$2,58)
on *:sockread:info.*:{
  sockread %t
  if ($regex(%t,/<font color=#505050>Name\:<\/font> <font color=#([0-9a-zA-Z]+?)><b>(.+?)<\/b><\/font>/)) sockmark $sockname $+($sock($sockname).mark,:,$regml(1),:,$regml(2))
  if ($regex(%t,/<font color=#505050>Gender\:<\/font> (Male|Female)<br>/)) sockmark $sockname $+($sock($sockname).mark,:,$regml(1))
  if ($regex($remove(%t,$chr(44)),/<font color=#505050>Age\:<\/font> ([0-9]+?) days <br>/)) sockmark $sockname $+($sock($sockname).mark,:,$regml(1))
  if ($regex(%t,/<font color=#505050>Level\:</font> ([0-9]+?)<br><font color=#505050>Rank:<\/font> (.+?)<br>/)) sockmark $sockname $+($sock($sockname).mark,:,$regml(1),:,$regml(2))
  if ($regex(%t,/<font color=#505050>Faction\:<\/font> (.+?)<br><font color=#505050>Property\:<\/font> (.+?)<br>/)) sockmark $sockname $+($sock($sockname).mark,:,$replace($regml(1),:,$chr(28)),:,$regml(2))
  if ($regex($remove(%t,$chr(44)),/<font color=#505050>Job\:<\/font> (.+?)<br><font color=#505050>Life\:<\/font> (.+?)<br><font color=#505050>Marital Status\:<\/font> (.+?)<br><font color=#505050>Married\:<\/font> (.+?)<br><font color=#505050>Friends\:<\/font> ([0-9]+?)<br><font color=#505050>Enemies\:<\/font> ([0-9]+?)<br><font color=#505050>Forum posts\:<\/font> <a href=forums\.php\?searchword=[0-9]+?>([0-9]+?)<\/a> \(([0-9]+?) score\)<br><font color=#505050>Last action\:<\/font> (.+?)<br>/)) {
    sockmark $sockname $+($sock($sockname).mark,:,$regml(1),:,$regml(2),:,$regml(3),:,$regml(4),:,$regml(5),:,$regml(6),:,$regml(7),:,$regml(8),:,$regml(9))
  if (*</html>* iswm %t) {
    var %s $sock($sockname).mark
    var %m $replace($INFOMESSAGE,color%,$g(%s,3),name%,$g(%s,4),gender%,$g(%s,5),age%,$g(%s,6),level%,$g(%s,7),rank%,$g(%s,8),faction%,$replace($g(%s,9),$chr(28),:),property%,$g(%s,10),job%,$g(%s,11),life%,$g(%s,12),marstat%,$g(%s,13),married%,$g(%s,14),friends%,$g(%s,15),enemys%,$g(%s,16),posts%,$g(%s,17),score%,$g(%s,18),lastaction%,$g(%s,19))
    msg $gettok($sock($sockname).mark,2,58) %m
on *:TEXT:*:#:{
  if ($1 == !info) {
    if ($read(ids.txt,s,$2) || $2 isnum) {
      binfo /profiles.php?XID= $+ $iif($2 isnum,$2,$v1) $chan


Sign in to comment.
Stewie1k94   -  May 03, 2011

this script no longer works

Stewie1k94   -  Apr 26, 2011

but yeh great script

Stewie1k94   -  Apr 25, 2011

well someone else asked but i was there at the time

FordLawnmower   -  Apr 24, 2011

Yea it was toclafane. I actually wasn't even done with it and he said he liked the way it worked so I didn't finish it.
I only parsed the lines he asked for and it prints straight out in like 5 lines or something.
No Idea why he asked both of us to make the same script though ;/

[Plornt]   -  Apr 24, 2011

Toclafane asked you?


Just out of curiosity can I look at how you did it :P see what I could improve on?

FordLawnmower   -  Apr 24, 2011

@[Plornt] No idea what torn even is, but I just made the same script for someone today.

RaZ   -  Apr 24, 2011

Nice :D

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.