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 %s.name info. $+ $rand(1,9999)
while ($sock(%s.name).mark) var %s.name info. $+ $rand(1,9999)
sockopen %s.name www.torn.com 80
sockmark %s.name $+($1,:,$2-)
}
on *:sockopen:info.*:{
sockwrite -n $sockname GET $gettok($sock($sockname).mark,1,58) HTTP/1.1
sockwrite -n $sockname Host: www.torn.com
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
}
}
}
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.
-->> http://pastebin.com/Hek82T4B
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 ;/