|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Thu Jul 20, 2006 2:20 pm
[1.03] #FORALL and the %i expansion |
Still trying to get my i_add alias to work, I am starting from square one and trying to figure out the differences or bugs in CMUD that prevent it from just working as it was in zMUD. I've come across a problem in a test alias simply using the #FORALL command. I'd like to know if others have similar problems.
The alias:
Code: |
#ALIAS test {#FORALL {%1} {#say {Loop variable is %i}}} |
The compiled code:
Code: |
0000 LINE 0 ; #forall {%1} {#say {Loop variable is %i}}
0012 PUSHSTRLOC 0028
0020 JUMP 0036
0028 PARAMREF 1
0036 ARGSTR %1
0048 PUSHLOC 0064
0056 JUMP 0168
0064 PUSHSTRLOC 0080
0072 JUMP 0128
0080 STR 'Loop variable is '
0116 LOOPVAR i
0124 CONCAT
0128 ARGSTR Loop variable is %i
0156 CMD say (1)
0168 ARGSTR #say {Loop variable is %i}
0204 CMD forall (2) |
The command executed:
The output received:
Code: |
Loop variable is 28 |
(Actually, the -first- time I tried it, it printed out the alias code, even though it's valid syntax. Editing it and saving it with the exact same syntax as before yields the output above.)
I see two things happening here:
1. It appears that it's printing the address of the string list and not the strings I passed in.
2. Since it's using the address, it's not a string list and so it's not really a loop on two items. It's only printing the one line. |
|
|
|
CyricDT Beginner
Joined: 19 Jul 2006 Posts: 19
|
Posted: Thu Jul 20, 2006 2:24 pm |
I get the exact same thing.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jul 20, 2006 5:20 pm |
Verified and added to bug list.
|
|
|
|
edb6377 Magician
Joined: 29 Nov 2005 Posts: 482
|
Posted: Thu Jul 20, 2006 11:27 pm |
This would explain a few of my problems with scripts i use.
|
|
_________________ Confucious say "Bugs in Programs need Hammer" |
|
|
|
|
|