|
Kaioshin Beginner
Joined: 28 Sep 2002 Posts: 26 Location: USA
|
Posted: Sat Sep 28, 2002 12:57 am
Need help with some sort of a queue |
I really need help...Here is a quick look on whats going on...
I need to create some sort of queue, being a sort of a vampire class I have abilities to bite others with different poisons...so I wanted to create a queue...that would store the poisons that I want to use, and everytime I bite my victim it would remove a poison that I added to the queue. I would like to be able to use the f12 button as a macro to make the poison (the first poison I added to the queue), then bite my victim with the poison, then by pressing f12 again i would make the second poison i added to to queue and then be able to bite my victim....then so on and so on.
Heres what my mud looks like:
I have to type secrete (poison)
You begin to concentrate, threading strands of your lifeblood into the poison, sumac.
H:3044 M:1678 B:100% [e-]
You feel the power of the venom sumac flowing through your veins.
H:3044 M:1678 B:100% [e-]
You have recovered balance on all limbs.
H:3044 M:1678 B:100% [e-]
bite (victim)
You sink your fangs into yourself, sumac flowing into his veins.
You gasp as a terrible aching strikes all your limbs.
H:2546 M:1678 B:100% [e-]
secrete <poison>
You begin to concentrate, threading strands of your lifeblood into the poison,
sumac.
H:2546 M:1678 B:100% [e-]
You feel the power of the venom sumac flowing through your veins.
H:2546 M:1678 B:100% [e-]
You have recovered balance on all limbs. |
|
|
|
Castaway GURU
Joined: 10 Oct 2000 Posts: 793 Location: Swindon, England
|
Posted: Sat Sep 28, 2002 9:38 am |
I don't understand at all where you need a queue here. What is the queue supposed to contain?
Lady C. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sat Sep 28, 2002 2:27 pm |
#VAR poisons {poison1|posion2|poison3|etc.}
#VAR index 1
#KEY F12 {#IF (@index > %numitems(@poisons)) {#VAR index 1};secrete %item(@poisons, @index);#TEMP {You have recovered balance on all limbs.} {bite @victim}}
Change @poisons to contain the name of all the poisons you want to use. Also, be sure that @victim is set beforehand either manually, by trigger or by alias.
Kjata |
|
|
|
Kaioshin Beginner
Joined: 28 Sep 2002 Posts: 26 Location: USA
|
Posted: Sat Sep 28, 2002 3:23 pm |
Thanks alot Kjata, it works great! Is it possible to create an alias since I have about 20 different poisons...so like by typing voy (the poison voyria), it would be added to the queue?
And one last thing, cause I really dont want to wear your patience down, but it is also possible to create another alias that would let me see everything that I've added to the queue, and another to reset the queue to contain no poisons at all? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Sep 28, 2002 3:40 pm |
I'm using %additem instead of #ADDITEM because this is a case where you might want duplicate items. Voy adds the venom voyria to the list, addven adds any venom but you have to specify which venom (addven voyria).
#AL voy {#VAR poisons %additem("voyria", @poisons)}
#AL addven {%additem(%1, @poisons)}
#AL addven {#VAR poisons {%additem(%1, @poisons)}}
#AL showven {#SHOW @poisons}
#AL clearven {#VAR @poisons %null}
#AL clearven {#VAR poisons %null}
Kjata's script never advances the index, here's a fix:
#KEY F12 {#IF (@index > %numitems(@poisons)) {#VAR index 1};secrete %item(@poisons, @index);#ADD index 1;#TEMP {You have recovered balance on all limbs.} {bite @victim}}
LightBulb
Senior Member
02/08/2003: Edited to show corrections to addven and clearven aliases |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sat Sep 28, 2002 8:56 pm |
Oops, thanks for catching that LightBulb.
Kjata |
|
|
|
Kaioshin Beginner
Joined: 28 Sep 2002 Posts: 26 Location: USA
|
Posted: Sat Sep 28, 2002 9:39 pm |
Thanks for helping out, but can anyone of you explain how the queue works exactly, in lamers terms...
I know for one that by adding different venoms to the queue, I will be able to bite a victim with a venom that i previously added to the queue. But another note, will the trigger "You have recovered balance on your limb" trigger of all the time...because there are other things that trigger off this same thing. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sat Sep 28, 2002 9:51 pm |
There variable @poisons contains the different poisons that you want to secrete. The script will use each one in sucession and when it reaches the end, it goes back to the start of the list. The poison that will be accessed from the list is controled by @index.
The first thing the macro does is to check if @index is bigger than the amount of items in the poisons list. If so, it resets it back to 1. Next, it secretes the next poison in the list, add 1 to @index and creates a temporary trigger. This temporary trigger exists only from the moment when the macro creates it, until it is deleted as soon as it fires. When the trigger fires, it bites the victim. This also answers your other question: the trigger is not permanenet, only temporary, so it should only fire on the very next "You have recovered balance on all limbs." line that comes after your press the macro key.
The aliases LightBulb made just call simple zMUD commands.
Kjata |
|
|
|
Kaset Newbie
Joined: 08 Feb 2003 Posts: 8 Location: USA
|
Posted: Sat Feb 08, 2003 8:18 am |
Hello All. Read a lot here but this is my first time Posting. Hopefully I can be coherent.
I'm having trouble with this script here...It works GREAT for me, doing what it does...but I need to alter a few functions in it.
First, I wonder how I might make it so that I could choose the particular item in the variable. Ex. I have (Fire,Ice,Lightning,Sonic) in the Variable @Elemental. Now, if I press the Key the script is linked to, it will cast fire. Can I make it so I issue a command that tells it which of the 4 I want it to use when I press the key, WITHOUT affecting the order of the list?
Also, the Clearven (or clear whatever for that matter) Alias that Lightbulb put up doesn't work as written...perhaps I'm using it wrong...I just C&P'ed the alias in.
Thanks for your help.
Kaset |
|
|
|
Kaset Newbie
Joined: 08 Feb 2003 Posts: 8 Location: USA
|
Posted: Sat Feb 08, 2003 8:18 am |
Hello All. Read a lot here but this is my first time Posting. Hopefully I can be coherent.
I'm having trouble with this script here...It works GREAT for me, doing what it does...but I need to alter a few functions in it.
First, I wonder how I might make it so that I could choose the particular item in the variable. Ex. I have (Fire,Ice,Lightning,Sonic) in the Variable @Elemental. Now, if I press the Key the script is linked to, it will cast fire. Can I make it so I issue a command that tells it which of the 4 I want it to use when I press the key, WITHOUT affecting the order of the list?
Also, the Clearven (or clear whatever for that matter) Alias that Lightbulb put up doesn't work as written...perhaps I'm using it wrong...I just C&P'ed the alias in.
Thanks for your help.
Kaset |
|
|
|
Kaset Newbie
Joined: 08 Feb 2003 Posts: 8 Location: USA
|
Posted: Sat Feb 08, 2003 8:19 am |
Hello All. Read a lot here but this is my first time Posting. Hopefully I can be coherent.
I'm having trouble with this script here...It works GREAT for me, doing what it does...but I need to alter a few functions in it.
First, I wonder how I might make it so that I could choose the particular item in the variable. Ex. I have (Fire,Ice,Lightning,Sonic) in the Variable @Elemental. Now, if I press the Key the script is linked to, it will cast fire. Can I make it so I issue a command that tells it which of the 4 I want it to use when I press the key, WITHOUT affecting the order of the list?
Also, the Clearven (or clear whatever for that matter) Alias that Lightbulb put up doesn't work as written...perhaps I'm using it wrong...I just C&P'ed the alias in.
Thanks for your help.
Kaset |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sat Feb 08, 2003 12:22 pm |
The script right is desgined to do each item in the list in order and then loop around. Do you want to override this and make it do just the item you specify? Is this supposed to be all the time, or just in special occasions when you desire? What happens after you force it to use a particular item in the list and don't force any item in the next key press, does it continue after the last forced item or after the last non-forced item?
Kjata |
|
|
|
Kaset Newbie
Joined: 08 Feb 2003 Posts: 8 Location: USA
|
Posted: Sat Feb 08, 2003 1:32 pm |
Thanks for the Reply.
I'd basically like to be able to choose the startpoint on the script is what I'm after. Like lets say I am dealing with a monster that resists fire...well I can skip over fire. OR lets say my last ice spell didn't go off but I need it too. I can go backwards.
So I want to over-ride the startpoint, but not the order. in essence, the button press continues the loop from where I tell it to. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sat Feb 08, 2003 2:13 pm |
Ok, then, create aliases or macros to change the value of the @index variable to the value you need it. When the script is used again, it should see the changed value in @index and start from there.
Kjata |
|
|
|
Kaset Newbie
Joined: 08 Feb 2003 Posts: 8 Location: USA
|
Posted: Sat Feb 08, 2003 2:47 pm |
Excellent! I shoulda thought of that heh.
Thanks! |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Feb 08, 2003 5:43 pm |
You can have a macro (#KEY) that always does the same thing, or you can have a macro which cycles through several choices in order, or you can have a macro which chooses between several actions at random, but there's really no way to specify which of several items a macro will choose, since it acts immediately when you press the key. For that you need an alias (#AL).
The clearven alias just needs the @ removed from the variable name. Also, the addven alias needs correcting (I'm surprised nobody ever caught it). Changes in red.
#AL addven {#VAR poisons {%additem( %1, @poisons)}}
#AL clearven {#VAR poisons %null}
LightBulb
Advanced Member |
|
|
|
|
|