mIRC Home    About    Download    Register    News    Help

Print Thread
#63163 07/12/03 12:16 AM
Joined: Dec 2002
Posts: 68
P
Babel fish
OP Offline
Babel fish
P
Joined: Dec 2002
Posts: 68
Alright, I have this script, but the socket still ping timeouts. Help please. Thanks.

Code:
on 1:sockread:dnn:{
  var %temp | sockread %temp
  if (%temp == PING) { sockwrite -n $sockname PONG $2- }
}

#63164 07/12/03 03:19 AM
Joined: Dec 2002
Posts: 68
P
Babel fish
OP Offline
Babel fish
P
Joined: Dec 2002
Posts: 68
Figured it out. I needed:

Code:
on 1:sockread:dnn:{
  var %temp | sockread %temp
  if ($gettok(%temp,1,32) == PING) { sockwrite -n $sockname PONG $2- }
}

#63165 07/12/03 08:31 AM
Joined: Sep 2003
Posts: 156
B
Vogon poet
Offline
Vogon poet
B
Joined: Sep 2003
Posts: 156
You can also use "tokenize" command. That allows you to tokenize texts.
Usage; /tokenize <ascii code> <text>
Code:
on 1:sockread:dnn:{  
var %temp 
sockread %temp  
tokenize 32 %temp
if ([color:red]$1[/color] == PING) { sockwrite -n $sockname PONG  [color:red]$2-[/color] }
}

smirk

#63166 07/12/03 08:31 AM
Joined: Nov 2003
Posts: 227
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
Glad you figured it out, but just remember there is no tokenized data in sockread unless you use /tokenize, your $2- is null there.

#63167 07/12/03 02:50 PM
Joined: Sep 2003
Posts: 156
B
Vogon poet
Offline
Vogon poet
B
Joined: Sep 2003
Posts: 156
Oh I didn't see.
phrozen, you cannot use data as token like $2- by not using tokenize command if theres not already tokenized.
;--------
;there should be like below code if there not using tokenizing;
if ($gettok(%temp,1,32) == ping) sockwrite -tn $sockname pong $gettok(%temp,2-,32)
;--------
by using tokenize command;
if ($1== ping) sockwrite -tn $sockname pong $2-
;-------



Link Copied to Clipboard