|
Pjotr Newbie
Joined: 15 Dec 2007 Posts: 7
|
Posted: Wed Dec 19, 2007 8:37 pm
Arrays |
I see a reply on my mail for another workaround. Will try that one. Thanks, no need to reply on my topic.
----------------
Hi,
In Zmud I tried to use arrays, but every now and then the dat in the array was lost, and the array became an ordinary variable. I think I see the same in CMud now. And more, I cannot make arrays as described in the manual.
If I fill an array with data, and I read the data back in the next line, it is empty.
It is this part:
#LOOP 10,27 {#NOOP %arrset(ItemList,%i,@{Item%i})}
typing #VAR ItemList returns the following line:
Variable: + ItemList (Array) <Array>|Null
This is not as stated in the manual. But requisting a single entry by: #show @itemlist.21 works fine.
In the following combination however, this doesn't work:
#IF (@Mode <> %upper( %1) and @Sleep = "AWAKE" and @Mode <> "MPTY" and %ismember( %upper( %1), "MANA|RAIS|REGN|RENT|STAB|TANK"))
{#VAR ItemList %array(1,1) @MyName;#LOOP 10,27 {#NOOP %arrset(ItemList,%i,@{Item%i})};#T- {@CharNr@Mode};Mode = %upper( %1);#T+ {@CharNr@Mode};remove all;#IF (@Item22 <> @Storage) {get @Storage @Item22};#LOOP 10,27 {#IF (@{Item%i}<>%arrget( ItemList, %i)) {put %if( %left( %arrget( ItemList, %i), 2)="2.", %rightback( %arrget( ItemList, %i), %len( %arrget( ItemList, %i))-2), %arrget( ItemList, %i)) @Storage;get @{Item%i} @storage}};#IF (@Item22 <> @Storage) {put @Storage @Item22};wear all}
Does anyone have clue or advise how to bypass this problem?
Thanks.
Pjotr |
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Wed Dec 19, 2007 10:19 pm |
The array is getting populated as requested the only problem is that when you do #VAR ItemList it doesn't actually show you what the array contains.
It only shows what the array contained when it was initially created.
If you tried something like #LOOP 0,%arrhigh(ItemList) {#SHOW %i: %arrget(ItemList,%i)}, you could see the data is actually present. |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Thu Dec 20, 2007 9:02 am |
There is #SHOWARR command for displaying an array. Or you may use a custom loop, as Dharkael suggested. #SHOWARR
|
|
_________________ 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 |
|
|
|
Pjotr Newbie
Joined: 15 Dec 2007 Posts: 7
|
Posted: Sat Dec 22, 2007 10:03 am |
Thanks for your replies. I will try your advise.
Pjotr |
|
|
|
|
|
|
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
|
|