mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2007
Posts: 21
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Aug 2007
Posts: 21
not a single socket script I try to use, they never work frown
Here's a very recent example I got from zad0909.

Code:
on *:TEXT:!clan*:#:{
  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. 
    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 anyone has any idea why, please tell me. Is it because my version isn't registered (yet)?

Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
How about you tell us what errors you get..

Just a few things though:

Code:
ON *:TEXT:!clan*:

Cool, but:

Code:
  if ($left($1,1) == !) set %clan.way. notice $nick
  if ($left($1,1) == @) set %clan.way. msg $chan

This is redundant due to the fact that $1 is '!clan<something>' So it'll always be !.

Now, the regex you're using is just a bit odd:
Code:
noop $regex(%sockreader,/(.*?)\|(.*)/Si)

A '*' after an atom says "0 or more". Using the '?' there is pointless.

All this being said, if multiple people make the request at the same time, the '%clan.way.' and '%clan.nick.' will get mixed up. Use 'sockmark' to keep the variables associated with the socket it's self.

Apart from all that, I can't see any obvious errors.. (don't have mIRC with me, so can't further test).

Joined: Jul 2006
Posts: 107
L
Vogon poet
Offline
Vogon poet
L
Joined: Jul 2006
Posts: 107
Quote:
Now, the regex you're using is just a bit odd:
Code:
noop $regex(%sockreader,/(.*?)\|(.*)/Si)

I put that together from zad0909's original code,
neglecting to mention that I am also still struggling with regex. smirk

I wonder if it wouldn't be even more efficient to simply use tokens to parse the line,
replacing:
Code:
if (*|* iswm %sockreader) { 
  noop $regex(%sockreader,/([^|]+)\|(.*)/Si)
  set %clan.name $regml(1) 
  set %clan.url $regml(2)
with:
Code:
if (*|* iswm %sockreader) { 
set %clan.name $gettok(%sockreader, 1,124) 
set %clan.url $gettok(%sockreader, 2,124)

Sorry Ash44455666, I don't 'get' socket scripts either; can't help you there.
Unregistered mirc is not crippled in any way. That's not the prob.

Last edited by LonDart; 03/09/07 04:20 AM.

LonDart
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Ok, am home now..

The socket stuff you've got there is fine, and all works. Even the regex. I literally copy/pasted it into my mIRC, and it worked unaltered.

Just to neaten the ON TEXT up a bit though:

Code:
on *:TEXT:!clan*:#:{
  set %clan.nick. $iif($2, $replace($2- ,$chr(32),_), $nick)
  set %clan.way. notice $nick
  sockopen clan. $+ $right($ticks,5) runehead.com 80
}

If you want some more details on how to do the sockmark stuff, just drop a note..

Joined: Aug 2007
Posts: 21
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Aug 2007
Posts: 21
(sorry for the delayed response, been busy IRL)
well I'll try adding the code again, and I'll just wait a full day (including at some point a restart of the system) if it still doesn't work then.. oh well :|

Joined: Aug 2007
Posts: 21
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Aug 2007
Posts: 21
The script still won't work. I guess I'll have to go without socket scripts -.-

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
If all socket scripts fail to work, then you probably have a router or firewall that is preventing the connections. You might want to check into that possibility.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard