 |
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Mon Oct 01, 2007 5:46 pm
[2.04] %arrset in the #LOOP does not work |
The task: create an array MobLevel[0...45] and fill it with default values.
Code: |
#VAR MobLevel %array(0,1,2,3,4,5);
#NOOP %arrset(MobLevel,45,777);
#NOOP %arrset(MobLevel,44,776);
#NOOP %arrset(MobLevel,43,775);
#LOOP 0,5 {#NOOP %arrset(MobLevel,%i,10)}
#LOOP 6,45 {#NOOP %arrset(MobLevel,%i,100)}
#LOOP 0,45 {#ECHO "Loop counter i =" %i "Array element[i] =" %arrget(MobLevel,%i)}
#VAR MobLevel;
|
Output:
Code: |
Loop counter i = 0 Array element[i] = 0
Loop counter i = 1 Array element[i] = 1
Loop counter i = 2 Array element[i] = 2
Loop counter i = 3 Array element[i] = 3
Loop counter i = 4 Array element[i] = 4
Loop counter i = 5 Array element[i] = 5
Loop counter i = 6 Array element[i] =
Loop counter i = 7 Array element[i] =
Loop counter i = 8 Array element[i] =
Loop counter i = 9 Array element[i] =
Loop counter i = 10 Array element[i] =
........
Loop counter i = 40 Array element[i] =
Loop counter i = 41 Array element[i] =
Loop counter i = 42 Array element[i] =
Loop counter i = 43 Array element[i] = 775
Loop counter i = 44 Array element[i] = 776
Loop counter i = 45 Array element[i] = 777
Variable: + MobLevel (Array) <Array>|0|1|2|3|4|5
|
|
|
|
 |
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Mon Oct 01, 2007 6:44 pm |
Try using #CALL instead of #NOOP - I think that might be a change compared with zMUD, that perhaps isn't as well documented as it should be. Or maybe there is no change.
|
|
|
 |
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Mon Oct 01, 2007 6:55 pm |
Seb
Yeah, it helps, thanks!
But #VAR MobLevel; still show me
Variable: + MobLevel (Array) <Array>|0|1|2|3|4|5
Is that ok?
And I ask for CMUD documentation update for arrays. |
|
_________________ My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads |
|
|
 |
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Mon Oct 01, 2007 7:18 pm |
I don't know, but use:
#SHOWARR VarName
to display arrays properly. |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Oct 02, 2007 12:27 am |
Arrays created using %arrset are internal Windows COM objects. You cannot display them just using #VAR. You *must* use #SHOWARR (or your own loop).
And yes, you should be using #CALL instead of #NOOP.
Arrays are not well documented because you should normally use string lists instead. There is a lot more support in CMUD/zMUD for String Lists. The %arrset and COM arrays are just there for people who need COM-compatible arrays for calling other applications. |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|