mIRC Home    About    Download    Register    News    Help

Print Thread
#244547 08/03/14 07:55 PM
Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
Can you have multiple ascii values ? so if i had this
12.34.56.78:7777
could I have the dot (.) and colon (:) as seperators? because i want a script which will try and look for server advertisements within input.

So say... someone said this in the channel...
'Hey, everybody! join server 12.34.56.78:7777' I want it to tokenize the thing. I already have a bit of the script, where it removes the token if it isn't a number, but I don't know how to get the 7777 and stuff. Also, its oddly cutting off the first token (12.)

Quote:
on *:TEXT:*.*.*.*:#test: {
set %advert /tokenize 46 $1-
echo 2 %advert
var %counter 1
while ($gettok(%advert,%counter,46) != $null) {
if ($gettok(%advert,%counter,46) !isnum) {
set %advert $deltok(%advert,%counter,46)
echo 2 #test %advert
}
inc %counter 1
}
if ($gettok(%advert,1,46) == 93) {
echo 3 #test all clear %advert
}
else {
echo 4 #test Advert! %advert
}
}

dominic_eddy #244548 08/03/14 08:20 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Regular expressions are suited to this problem:

Code:
on *:text:*:#:{
  var %regex = /(\d+\.\d+\.\d+\.\d+):(\d+)/S
  if ($regex($1-,%regex)) {
    var %ip = $regml(1), %port = $regml(2)
    echo -ag %ip :: %port
  }
}

Loki12583 #244549 08/03/14 08:30 PM
Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
thanks loki, this is awesome, only problem is, this would check it for EVERY bit of text in that channel right? The channel im on is quite busy, so wouldn't my mirc lag and crash if its having to check every bit of text to see if its an advert? Wouldn't know how to make it more efficient :P

dominic_eddy #244550 08/03/14 09:17 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Every text event is checked against every line in the channel, how do you figure this is different?

Loki12583 #244551 08/03/14 09:18 PM
Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
Dunno, thought it might be more efficient somehow xD lol. Anyway, thanks! laugh


Link Copied to Clipboard