mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
About the icon, it's cool, ok?

I think it would really be useful if you could use more than one set of token identifers.
Code:
tokenize.a 32 1 2 3 4 5 6 7 8 9 10
echo -a $a1 $a2 $a3 $a4 $a5-10

Basicly what I'm saying is that you could do /tokenize.anything and then use $anythingN.

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
There's a few problems with that:

Code:
tokenize.? 32 1 2 3
echo -a $?1 $?2 $?3


Code:
tokenize.! 32 1 2 3
echo -a $!1 $!2 $!3


Code:
tokenize.v 32 1 2
echo -a $v1 $v2


Code:
tokenize.1 32 1 2
echo -a $11 $12


etc

I'm sure you know what the problems are. smile


New username: hixxy
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
I think we decided that $anyhing.N would prevent it from breaking, except with speical characters like ? and ! and numbers.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You are the king of weird suggestions :tongue:


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
How is this functionally any different from using $gettok()? The only thing I can think of is possibly a meagre - probably non-existent - speed advantage. The main use of /tokenize (in my experience) is to either make it possible to rewrite $n to effectively change the parameters as the following code sees them, or to take advantage of $* - neither of which apply to your suggestion.

I dunno, just seems like another way of doing something that's already possible.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Exactly what I said :tongue:


New username: hixxy
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
The problem with $gettok is that if you use it too much, your code becomes harder to read
Code:
var %q = $whowhatwhere.draw($gettok(%o,17,58),$gettok(%o,18,58),$gettok(%o,3,58),$gettok(%o,4,58),$gettok(%o,15,58),$gettok(%o,16,58))

That's a line from one of my scripts, I had to use $gettok excessively because $1- was being used and I couldn't override it.
Code:
tokenize.o 58 %o
var %q = $whowhatwhere.draw($o.17,$o.18,$o.3,$o.4,$o.15,$o.16)

I think the second example is easier to read because it fits on one line in the mIRC editor.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Why couldn't you override it, ie something like this:
Code:
var %a = $1-
tokenize 58 %o
var %q = $whowhatwhere.draw($17,$18,$3,$4,$15,$16)
tokenize 32 %a


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
I personally hate doing that, I think it makes the code look messy, but thats just me.

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
It does, but it's much less messy than your current method. :[/b]o)


New username: hixxy
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Well aslong as you dont need any of the more advanced $2- or $2-5 etc commands you could just use

Code:
alias tokenize2 {
  var %var = $$1
  tokenize $2-
  var %i = $0
  while (%i) {
    set -u [ $+(%,%var,.,%i) ] [ [ $+($,%i) ] ]
    dec %i
  }
}



tokenize2 o 58 %o
var %q = $whowhatwhere.draw(%o.17,%o.18,%o.3,%o.4,%o.15,%o.16)

Joined: Jul 2003
Posts: 77
B
Babel fish
Offline
Babel fish
B
Joined: Jul 2003
Posts: 77
well i like this suggestion though i think to keep it easy on the mIRC parser maybe khaled should limit it to like a couple of differnt ones like hteres the standard $1 $2 $3... etc and maybe like a tokenize.a tokenize.b since i cant imagine when youd need to tokneize more than like 2 things simultanously so you could have $1 $2 $3 like $1.a $2.a $3.a $1.b $2.b $3.b

A simple code example being
var %string = Somethign Neat O
var %stringa = Another neat thing
var %stringb = Something Else cool
tokenize 32 %string
tokenize.a 32 %stringa
tokenize.b 32 %stringb
$1- = somethign neat o
$1.a- = Another neat thing
$1.b = Something Else

PS if you didnt ntoice id like to see it as a "property" of $1 instead of something like $a1 or $a.1 just seems like it should be that way since it would be easier to parse. Either that or like
tokenize 32 completely neato
tokenize -a 32 something awsome
tokenize -b 32 something else awsome

then again i suppose you could replace -a with anything and get away with it dont really see a need to though

Last edited by bamaboy1217; 24/03/05 04:36 AM.

hmmm signed by me

Link Copied to Clipboard