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
Smeff
Newbie


Joined: 17 Mar 2006
Posts: 9

PostPosted: Wed Mar 29, 2006 8:59 pm   

Accessing the top of a list
 
Code:
#alias z11 {hfp @target left;hfp @target left;hfp @target left;hfp @target left;illnet}
#alias z1 {#if (@balance & @equilibrium) {z11} {#addi attackqueue z11}
#trig {|Recovered Balance|} {#if @equilibrium {do_attack} {#temp {|Recovered Equilibrium|} {do_attack}}}
#alias do_attack {[b]WHAT TO DO HERE?[/b]


Now.. What I want to do is:

say I enter the alias 'zz', and I execute the attack. It puts me off balance and such. At that point I want to be able to enter another attack alias, for example 'cc', and add it to a queue.. I think I have that part down.

Now for do_attack...

I want to be able to have it access the first item in the list, then delete that item, so when I can attack again, I can execute the NEXT attack.

Any ideas on how you could do this? I've tried a few diffent things so far..
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Thu Mar 30, 2006 4:27 am   
 
You can use the %pop(ListName) function to remove the first item of the list. Check the help file for examples.
Reply with quote
Smeff
Newbie


Joined: 17 Mar 2006
Posts: 9

PostPosted: Thu Mar 30, 2006 7:53 pm   
 
Vorax wrote:
You can use the %pop(ListName) function to remove the first item of the list. Check the help file for examples.


Yes, I know that. I've done that. I just need to know how to access the first part of the list. I've only been able to access the WHOLE list, so it would try to fire something like..

zz1|cc1|zz1|zc11

instead of

zz1

EDIT: Darn it, Brian! Don't mess with my keyboard, again!
Reply with quote
Hamstro
Newbie


Joined: 03 Jan 2006
Posts: 9

PostPosted: Thu Mar 30, 2006 8:27 pm   
 
%pop not only deletes the first item, it also returns it. So all you have to do is use the result directly or assign it to a variable:

#VAR foo %pop(bar)

If you only want to read the item and not delete it, you can use %item.
Reply with quote
Smeff
Newbie


Joined: 17 Mar 2006
Posts: 9

PostPosted: Thu Mar 30, 2006 8:39 pm   
 
So...

Code:
#alias do_attack {%pop(attackqueue)}


should do what I need to?

I'll have to test it tonight when I get home. Thanks for the help!
Reply with quote
Smeff
Newbie


Joined: 17 Mar 2006
Posts: 9

PostPosted: Sat Apr 01, 2006 3:21 am   
 
Okay..

I have another slight problem.. I have the whole 'returning' thing down, it's just they won't execute commands. Can you queue up commands in a string list, or is that only for strings? If it's only for strings, is there any other way I could do this?

EDIT: A syntax error. Now I'm figuring out how to add a few things to my list and have it execute properly...

EDIT: Just got it fixed... Sorry for the trouble...
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