Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Shylmysten
Wanderer


Joined: 18 Sep 2001
Posts: 93
Location: USA

PostPosted: Mon Apr 28, 2003 3:41 pm   

Nested Variable BLEH!
 
Since the new version came out all my variable lists are now created in nests which really sucks because it makes my scripts obsolete, to say the least, and they dont work at all.

So I if I can be helped with something very basic to help me with the rest of my string lists.

So say I have a list like this:

Cedarwood vial40555 an elixir of mana 28 119
Cedarwood vial129991 an elixir of mana 60 119

So my trigger would look like this

%w(%d) an elixir of (%w)

Great! easy enough, however I want to

#additem %2 %1|1

however when I do this my variable list ends up looking like this

{40555|1}|{129991|1}

and so on - This is NASTY NASTY NASTY when I go to call the next item in the list and get
drink 40555|1

so is there a way that I can get it to add these contents and make my variable lists look like this:

40555|1|129991|1

Would appreciate any help cause this is a very nasty and BAD problem for code that has taken me weeks to create and it's all obsolete now because I upgraded.....

thanks
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Apr 28, 2003 4:04 pm   
 
You can access the subitems in the list with sub-indices. For example, if you want to drink the third health vial, you can use

drink @health.3.1

This should access the first sub-item of the third item in the list. With the recent changes in the beta version, you may need to use @{health.3.1} instead. I'm not sure on that part.
Reply with quote
Shylmysten
Wanderer


Joined: 18 Sep 2001
Posts: 93
Location: USA

PostPosted: Mon Apr 28, 2003 5:13 pm   
 
quote:

You can access the subitems in the list with sub-indices. For example, if you want to drink the third health vial, you can use

drink @health.3.1

This should access the first sub-item of the third item in the list. With the recent changes in the beta version, you may need to use @{health.3.1} instead. I'm not sure on that part.





Ah but I also will delete these items on the fly, so I always drink the first Item in the list.

so
40555|1 is my a representation that vialnumber 40555 is FULL

40555|0 is a representation that the same vial is empty in the list. the 1's and 0's are checked before I drink, if they are a 0 it deletes the item adds it again to the end of the list as an empty and then drinks the first Item in the list.

So again, is there any way to additems to s string list WITHOUT them being nested?

thanks again
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Apr 28, 2003 5:24 pm   
 
This is fairly obvious. If you don't want them nested, don't nest them. Add them separately.
#additem %2 %1;#ADDI %2 1

LightBulb
Advanced Member
Reply with quote
Shylmysten
Wanderer


Joined: 18 Sep 2001
Posts: 93
Location: USA

PostPosted: Mon Apr 28, 2003 5:35 pm   
 
quote:

This is fairly obvious. If you don't want them nested, don't nest them. Add them separately.
#additem %2 %1;#ADDI %2 1

LightBulb
Advanced Member



Ah, I used that EXACT code at first. And had to alter the code to health=%additem("1", @health) because I needed it to add multiples of item "1". This did not work as it would always leave off the last 1 in the list, which ended up looking like this:

4444|1|33333|1|2222|1|5555

No 1 at the end, which I found rather odd...
Any explainations for this error?
Reply with quote
Shylmysten
Wanderer


Joined: 18 Sep 2001
Posts: 93
Location: USA

PostPosted: Mon Apr 28, 2003 5:48 pm   
 
quote:

quote:

This is fairly obvious. If you don't want them nested, don't nest them. Add them separately.
#additem %2 %1;#ADDI %2 1

LightBulb
Advanced Member



Ah, I used that EXACT code at first. And had to alter the code to health=%additem("1", @health) because I needed it to add multiples of item "1". This did not work as it would always leave off the last 1 in the list, which ended up looking like this:

4444|1|33333|1|2222|1|5555

No 1 at the end, which I found rather odd...
Any explainations for this error?





BLeh, I figured out why......

My syntax for %item was wrong.....

I was using @health=%additem("1",@health)

Instead of health=%additem("1",@health)

oops, sorry bout that, but thanks for all the help anyways
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Apr 28, 2003 6:43 pm   
 
You're right, #ADDITEM doesn't allow duplicate entries. %additem is the correct choice. Sorry about that.

LightBulb
Advanced Member
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net