mIRC Home    About    Download    Register    News    Help

Print Thread
help catching / storing / matching #206152 08/11/08 03:36 PM
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

Re: help catching / storing / matching [Re: bwuser] #206247 10/11/08 04:00 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
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* }
Re: help catching / storing / matching [Re: bwuser] #206248 10/11/08 04:02 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
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* }
Re: help catching / storing / matching [Re: Lpfix5] #206250 10/11/08 04:35 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
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.