|
Smeff Newbie
Joined: 17 Mar 2006 Posts: 9
|
Posted: 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.. |
|
|
|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: 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.
|
|
|
|
Smeff Newbie
Joined: 17 Mar 2006 Posts: 9
|
Posted: 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! |
|
|
|
Hamstro Newbie
Joined: 03 Jan 2006 Posts: 9
|
Posted: 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. |
|
|
|
Smeff Newbie
Joined: 17 Mar 2006 Posts: 9
|
Posted: 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! |
|
|
|
Smeff Newbie
Joined: 17 Mar 2006 Posts: 9
|
Posted: 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... |
|
|
|
|
|