mIRC Home    About    Download    Register    News    Help

Print Thread
/tokenize #227289 03/11/10 04:31 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
Hi all,

I was just messing about with /tokenize and have a few queries

Code:
//tokenize 32 this is a string | echo -a $*


This will echo each word, but for some reason I cannot enclose $* in an other mIRC identifiers.

i.e. using $upper

Code:
//tokenize 32 this is a string | echo -a $upper($*)


it will echo each word, but ignore the $upper identifier.

Many thanks to all replies.


Newbie
Re: /tokenize [Re: HaleyJ] #227293 03/11/10 05:43 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
$* is an undocumented feature. That means that even if it's useful, it's not necessarily fully functional and may not be able to work in ways that you think it should. In cases where you want to use it and it doesn't work, you'll need to use other methods (looping) to get the desired effect. Being that it's undocumented, I doubt it will get an update to work better than it currently does. Also keep in mind that using undocumented features may cause you trouble later if Khaled decides to remove them. Anyhow, you can always bug report or feature request something regarding that, but I'm not sure I'd put much hope in getting it fixed simply because it is undocumented.

Just playing around with it, identifiers DO work, but $* isn't ever equal to the words being displayed. To see what it really is, use:

//tokenize 32 this is a test | echo $qt($*)
Output (4 times): "`~$*"

As you can see, the identifier only ever sees `~$*. $upper on that is the same thing, which then evaluates to the same thing and you see the words as they were entered.

That means that unless $* is redone to show the "words" to the identifier before display, there's nothing you can do with it directly.

That being said, you can always use an alias:
Code:
alias test {
  tokenize 32 $1-
  test2 $*
}
alias test2 { echo -a $upper($1) }

Use: /test this is a test


Invision Support
#Invision on irc.irchighway.net
Re: /tokenize [Re: HaleyJ] #227294 03/11/10 05:51 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
You have to use /scon -r or /scid -r to reevaluate the identifier. Like so:
Code:
//tokenize 32 this is a string | scid -r echo -a $!upper( $* )

Re: /tokenize [Re: Tomao] #227315 04/11/10 12:57 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
Thanks.

How does the /scid -r work on that particular script? I thought it was related to changing connection $cid's?


Newbie
Re: /tokenize [Re: HaleyJ] #227320 04/11/10 01:50 PM
Joined: Jun 2007
Posts: 933
5
5618 Offline
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
If you look at the help file you'll see that the -r switch "resets the connection id to the original id for that script".
So basically it just uses the current id. The whole use of /scid here is a just way to force evaluation.