mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2006
Posts: 248
B
bwuser Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Jul 2006
Posts: 248
on an announce in a channel ($3) this part of hte announce always ends in -RANDOMTHING i want to read from names.txt and see if -RANDOMTHING is already in there, if so { halt } if not it should add it to names.txt,

$3 could be any size and have -WORD-WORD_word-WORD
but i only want to catch the end

if anyone has an efficient way to accomplish this it would be greatly appreciated

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Confused... but to get the last very word since the character - is in use use gettok...

$gettok($3,$numtok($3,45),45)

$numtok calculates how many tokens are found the same, then I take that total and get the last word after the token

CHARACTER 45 equals minus or -.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Confused... but to get the last very word since the character - is in use use gettok...

$gettok($3,$numtok($3,45),45)

$numtok calculates how many tokens are found the same, then I take that total and get the last word after the token

CHARACTER 45 equals minus or -.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You can also use $gettok($3,-1,45) to get the last word (or token as it can also be called) using the chracter 45 or - token separator.


Link Copied to Clipboard