|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
execute { return $1- }
for {
execute $1
if $right($3,2) == ++ { var %type inc }
elseif $right($3,2) == -- { var %type dec }
while $gettok($2,1,32) $gettok($2,2,32) $gettok($2,3,32) {
%type $left($3,-2)
execute $4-
}
}
typing: //.echo -q $for(var %x 1,%x <= 10,%x++,echo -s %x) gives the following error: - * /while: '10' unknown operator (line 13, aliases.ini) - anyone know why?
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 230
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 230 |
because your variables are evaluated before they are passed to the alias.
|
|
|
|
Joined: Apr 2003
Posts: 414
Fjord artisan
|
Fjord artisan
Joined: Apr 2003
Posts: 414 |
if after elseif $right($3,2) == -- { var %type dec } i put echo -set $gettok($2,1,32) $gettok($2,2,32) $gettok($2,3,32) in the status i see <= 10.. So error cause of the error is While <= 10..
And //.echo -q $for(var %x 1,%x <= 10,%x++,echo -s %x) must be //echo $for($eval(var %x 1,0),$eval(%x <= 10,0),$eval(%x++,0),$eval(echo -s %x,0))
|
|
|
|
Joined: Apr 2003
Posts: 414
Fjord artisan
|
Fjord artisan
Joined: Apr 2003
Posts: 414 |
Here is you alias.. Nice parser
for {
if $right($eval($3,1),2) == ++ { var %type inc }
elseif $right($eval($3,1),2) == -- { var %type dec }
set $eval($left($eval($3,1),-2),1) 0 | ;For some reson.. Var don't work here..
while $eval($gettok($2,1,32),2) $eval($gettok($2,2,32),2) $eval($gettok($2,3,32),2) {
$eval($4-,2)
%type $left($eval($3,1),-2)
}
} //echo $for($eval(var %x 1,0),$eval(%x <= 10,0),$eval(%x++,0),$eval(echo -s %x,0)) Show to me 0 1 2 3 4 5 6 7 8 9 10
|
|
|
|
|