mIRC Home    About    Download    Register    News    Help

Topic Options
#69967 - 01/02/04 12:08 PM parameter count and read
cmad Offline
Babel fish

Registered: 06/01/04
Posts: 79
Loc: Greece
This is really simple I know but I just can seem to be able to do it mad

1) How do I get the parameter count of an alias (or event)

example: /test_alias abc1 d2 f e
that should return 4.

How do I do that?

2) And I want to be able to read the contents of the parameters like

$%i

but it won't work.

I hope you know what i mean smile
_________________________
My ally is the compiler, and a powerful ally it is!

Top
#69968 - 01/02/04 12:20 PM Re: parameter count and read
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
/alias test_alias echo -a $0 parameters; $!1 = $1 ; $!2 = $2 ; $!3- = $3- ; $!1-3 = $1-3

Top
#69969 - 01/02/04 12:31 PM Re: parameter count and read
cmad Offline
Babel fish

Registered: 06/01/04
Posts: 79
Loc: Greece
the $0 works

but about the other ones

it's not what I want

let's say I got a variable %i that contains the integer for example 2.

I wanna be able to do something like $%i

i.e. the i-th parameter
_________________________
My ally is the compiler, and a powerful ally it is!

Top
#69970 - 01/02/04 12:36 PM Re: parameter count and read
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
$ [ $+ [ %i ] ]
or
$eval($ $+ %i,2)
$eval($+($,%i),2)

Top
#69971 - 01/02/04 03:42 PM Re: parameter count and read
Raccoon Offline
Hoopy frood

Registered: 18/02/03
Posts: 2590
Or, for greater flexibility...

$numtok($1-,32)
$gettok($1-,0,32)
and
$gettok($1-,%i,32)

See also /help Token Identifiers for more info.
You'll want to learn these eventually.
_________________________
Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Top