mIRC Home    About    Download    Register    News    Help

Print Thread
#186423 22/09/07 02:59 PM
X
XTZGZoReX
XTZGZoReX
X
So I finally made my own socket script. There's just one problem.

During the on SOCKREAD part it loops almost endlessly.

Here's the script:

Quote:
alias gzpupdate {
sockopen gzpupdate gamerzplanet.net 80
}

on *:sockopen:gzpupdate: {
sockwrite -n $sockname GET /forums/staff/201457-gamerzplanet-channel-management-script.html HTTP/1.1
sockwrite -n $sockname Host: gamerzplanet.net $+ $crlf $+ $crlf
}

on *:sockread:gzpupdate: {
if ( $sockerr ) {
echo -a Error connecting to update page! Try again later or check your connection.
halt
}
else {
var %gzpupdate
sockread %gzpupdate
if ( CurVer1.3 iswm %gzpupdate ) {
echo -a A new version is available! Download it at http://www.gamerzplanet.net/forums/staff/201457-gamerzplanet-channel-management-script.html ASAP!
else {
echo -a No new version of the script is available.
sockclose gzpupdate
halt
}
}
}
}


The connection runs fine but I just don't get why it does these loops.

Edit: You might not be able to directly use the socket script since the area it connects to is restriced.

Thanks in advance.

Last edited by XTZGZoReX; 22/09/07 03:05 PM.
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
If you check your brackets, you'll find the problem in the SOCKREAD event. Note that using the CODE tags instead of QUOTE tags will let you keep the spacing better.

Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
First off, long time no see, you probably don't remember me but I tried teaching you the basics of sockets and such. Welcome to the boards. That aside, I haven't tested your script as you said it's restricted.

Looking through your code though, here in particular:

Code:
    if ( CurVer1.3 iswm %gzpupdate ) {
      echo -a A new version is available! Download it at http://www.gamerzplanet.net/forums/staff/201457-gamerzplanet-channel-management-script.html ASAP!
    }
    else {
      echo -a No new version of the script is available.
      sockclose gzpupdate
      halt
    }


You are missing a bracket inbetween the echo command and else statement.

As I said I can't test it but that may stop the continuous looping.

Edit: I should have read Riamus2's post carefully he mentioned about the brackets, I started reading from the code tags part I guess. Sorry Riamus2!


Link Copied to Clipboard