mIRC Home    About    Download    Register    News    Help

Print Thread
Whats wrong with this script? [sockets] #169052 18/01/07 05:18 PM
Joined: Oct 2006
Posts: 60
M
moshkin Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Oct 2006
Posts: 60
What is wrong with this script?
Code:
on *:TEXT:!clan*:{
  if (%clan.used == 1) { .notice $nick The clan lookup is being used by %clan.nick $+ . Try again in 30-60[never] seconds %logo }
  else {
    set %clan.name $replace($2-,$chr(32),$chr(95))
    if ($len(%clan.name) > 12) { 
      msg $chan Name cannot be longer than 12 characters 
      unset %clan.*
    }
    else { 
      .notice $nick Processing request... please wait about 1 minute for the Runehead server to respond
      set %clan.nick $nick
      set %clan.chan $chan
      set %clan.used 1 
      set %clan.integer 1
      set %clan.found no
      clan.chk
    } 
  }
}

alias clans {
  if (%clan.used == 1) { echo -a The clan lookup is being used by %clan.nick $+ . Try again in 30-60 seconds %logo }
  else {
    set %clan.name $replace($1-,$chr(32),$chr(95))
    if ($len(%clan.name) > 12) { 
      echo -a $chan Name cannot be longer than 12 characters 
      unset %clan.*
    }
    else { 
      msg $active !clans $1-
      echo -a Processing request... please wait about 1 minute for the Runehead server to respond
      set %clan.nick $me
      set %clan.chan $active
      set %clan.used 1 
      set %clan.integer 1
      set %clan.found no
      clan.chk
    } 
  }
}

alias clan.chk {
  .sockclose clanlookup
  .sockopen clanlookup www.runehead.com 80
}

alias striphtml.clan {
  var %clan.txt = $gettok($1,3,62)
  %clan.txt = $gettok(%clan.txt,1,60)
  return %clan.txt
}
alias striphtml.site {
  var %clan.txt.s = $gettok($1,2,62)
  %clan.txt.s = $gettok(%clan.txt.s,1,60)
  %clan.txt.s = $gettok(%clan.txt.s,2,39)
  return $+(www.runehead.com/clans/,%clan.txt.s)
}

alias clan.output {
  :lmao
  $iif($1 == msg,msg %clan.chan,notice %clan.nick) $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) $&
    is in %clan.output [12owwScript]
  goto lmao 
  unset %clan.*
}
if (%clan.output) {
  var %i = 1   while (%clan.output $+ %i) {
    $iif($1 == msg,msg %clan.chan,notice %clan.nick) $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) $&
      is in the following clans:12 %clan.output $+ %i
    inc %i
  }
}
else {


  on *:SOCKOPEN:clanlookup: {
    if ($sockerr) { echo -a $sock(clanlookup).wsmsg | return }
    .set %clan.findings no
    .sockwrite -n clanlookup POST /clans/search.php?search= $+ %clan.name $+ &searchtype=exact HTTP/1.1
    .sockwrite -n clanlookup Host: $+(www.runehead.com,$crlf,$crlf)
  }
  on *:SOCKREAD:clanlookup: {
    if ($sockerr) { echo -a $sock(clanlookup).wsmsg | return }
    .sockread %clan.find
    set %clan.output $null
    if (*<p><b>*</b> is currently on the Memberlist(s):</p>* iswm %clan.find) %clan.found = yes
    if (*<td style='width:90px; border-color:#404040;'><a href='ml.php?clan=*</a></td>* iswm %clan.find) {
      ;%clan.output = %clan.output $striphtml.clan(%clan.find) 14( $+ $striphtml.site(%clan.find) $+ 14)
      $iif(%clan.nick isop %clan.chan || %clan.nick ishop %clan.chan || %clan.nick == $me,msg %clan.chan,notice %clan.nick) $upper($left(%clan.name,1)) $+ $&
        $right(%clan.name,-1) is in $striphtml.clan(%clan.find) 14( $+ $striphtml.site(%clan.find) $+ 14) %logo
    }
  }
  set %clan.found.clan. $+ %clan.integer $striphtml.clan(%clan.find)
  set %clan.found.ml. $+ %clan.integer $striphtml.site(%clan.find) 

  on *:SOCKCLOSE:clanlookup: {
    if (%clan.found == no) { msg %clan.chan $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) is not in any clans on runehead.com | unset %clan.* }
    ;unset %clan.*
    elseif (%clan.nick isop %clan.chan || %clan.nick ishop %clan.chan || %clan.nick == $me) { clan.output msg }
    else clan.output notice
  }

Re: Whats wrong with this script? [sockets] [Re: moshkin] #169056 18/01/07 05:57 PM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
else {


on *:SOCKOPEN:clanlookup: {




Re: Whats wrong with this script? [sockets] [Re: DJ_Sol] #169123 19/01/07 06:35 PM
Joined: Oct 2006
Posts: 60
M
moshkin Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Oct 2006
Posts: 60
what :s

Re: Whats wrong with this script? [sockets] [Re: moshkin] #169131 19/01/07 07:52 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Look at the part of the script he pointed out. You have an ELSE there for apparently no reason.


Invision Support
#Invision on irc.irchighway.net
Re: Whats wrong with this script? [sockets] [Re: moshkin] #169160 19/01/07 11:44 PM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
An EVENT starts the code. You do not put an event inside code.

on *:sockopen:*:{ < the opening bracket of the code

Re: Whats wrong with this script? [sockets] [Re: DJ_Sol] #169163 19/01/07 11:52 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Actually, this entire section isn't inside an event or alias... it's just sitting there causing problems:

Code:
if (%clan.output) {
  var %i = 1   while (%clan.output $+ %i) {
    $iif($1 == msg,msg %clan.chan,notice %clan.nick) $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) $&
      is in the following clans:12 %clan.output $+ %i
    inc %i
  }
}
else {


Invision Support
#Invision on irc.irchighway.net