mIRC Home    About    Download    Register    News    Help

Print Thread
!clan script #184877 02/09/07 02:43 PM
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
I found this script on the net:
on $*:text:/^[!@](clan|group)/Si:#:{
var %sckid = $right($ticks,5)
if ($2 == $null) { set %clan.nick. $nick }
if ($2 != $null) { set %clan.nick. $replace($2- ,$chr(32),_) }
if ($left($1,1) == !) set %clan.way. notice $nick
if ($left($1,1) == @) set %clan.way. msg $chan
sockopen clan. [ $+ [ %sckid ] ] runehead.com 80
}
on *:SOCKOPEN:clan.*: {
sockwrite -nt $sockname GET /feeds/lowtech/searchuser.php?user= $+ %clan.nick. $+ &type=2 HTTP/1.1
sockwrite -nt $sockname Host: runehead.com
sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:clan.*: {
if ($sockerr) {
%clan.way. Socket Error: $sockname $+ . Error code: $sockerr Please inform $me of this error message.
halt
}
else {
var %sockreader
sockread %sockreader
if (*|* iswm %sockreader) {
noop $regex(%sockreader,/(.*?)\|/Si)
set %clan.name $regml(1)
}
if (*|* iswm %sockreader) {
noop $regex(%sockreader,\|(.*?)/Si)
set %clan.url $regml(1)
%clan.way. Clan: %clan.name URL: %clan.url
sockclose $sockname
}
if (*Not Found* iswm %sockreader) {
%clan.way. ERROR: %clan.nick. isn't in any clanlist.
sockclose $sockname
}
}
}

Kid said it didnt work. Baisically it will tell you the clan they are in but its supposed to give the url and doesn't. The whole process works fine aside from that. So if anyone could tell me whats wrong I will be glad to in response to the kids code link them here and give you credit or w/e you want to do.

Thanks.

Re: !clan script [Re: zad0909] #184916 02/09/07 08:04 PM
Joined: Jul 2006
Posts: 107
L
LonDart Offline
Vogon poet
Offline
Vogon poet
L
Joined: Jul 2006
Posts: 107
Despite knowing essentially nothing about socket scripts (I take your word that it works),
it is obvious why it never returns the url.

There are 2 identical if statements trying to parse the same data in 2 different ways. mirc will never see the second if.
Try this.
Code:
on *:SOCKREAD:clan.*: { 
  if ($sockerr) { 
    %clan.way. Socket Error: $sockname $+ . Error code: $sockerr Please inform $me of this error message. 
    return 
  } 
  else { 
    var %sockreader 
    sockread %sockreader 
    if (*|* iswm %sockreader) { 
      noop $regex(%sockreader,/(.*?)\|(.*)/Si)
      set %clan.name $regml(1) 
      set %clan.url $regml(2) 
      %clan.way. Clan: %clan.name URL: %clan.url 
      sockclose $sockname 
    } 
    elseif (*Not Found* iswm %sockreader) { 
      %clan.way. ERROR: %clan.nick. isn't in any clanlist. 
      sockclose $sockname 
    } 
  } 
}

If it works, say so, and we'll call it even smile


LonDart
Re: !clan script [Re: LonDart] #184925 02/09/07 10:39 PM
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
Works great thanks man.