|
Ayclaes Newbie
Joined: 31 Mar 2005 Posts: 9
|
Posted: Tue Jan 24, 2006 2:15 am
Alias parameter question |
#ALIAS apunch {#T+ punch;#RESET (punch|counter);#IF (%numparam == 3) {punch_uses = %3}{punch_targ = %1 %2};#IF (%numparam == 2) {#IF (%isnumber( %2)) {punch_uses = %2;punch_target = %1} {punch_target = %0}};#ECHO targ: @punch_target uses: @punch_uses;punch @punch_targ}
Is there a way to clean this up or expand it for n parameter testing? |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Wed Jan 25, 2006 3:12 pm |
There is probably someway to make this cleaner but here is an idea:
Code: |
#ALIAS apunch {
#T+ punch
#RESET (punch|counter)
#VAR punch_targ %null
#VAR punch_uses %null
#LOOP %eval( %numParam( )-1) {#var punch_targ %concat(@punch_targ, " ", %Param( %i))}
#VAR punch_uses %Param( %numParam( ))
#ECHO @punch_targ / @punch_uses
#NOOP To dump alias parameters sent.
}
|
|
|
|
|
|
|