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
Lost Soul
Newbie


Joined: 14 Oct 2003
Posts: 7

PostPosted: Tue Oct 14, 2003 7:53 pm   

Clogged Queuing System, any help? ((Achaea))
 
I have a currently running queuing system now, though it jams quite frequently. I'm pretty much a novice at these scripts, but I'm trying to learn and figure this out.. but any help would be fab! Ideas on how to make it run smoother, or improved queuing.. anything! Please help!

------------------

#ALIAS applyq {#IF ((!@sleep) AND (@apply) AND (%numitems(@applyqueue) = 0)) {%1;#VAR apply 0} {#IF (%numparam() > 1) {#VAR applyqueue %push(%1, @applyqueue)} {#VAR applyqueue %additem( %1, @applyqueue)}}} "Triggers|Automatic Healing"

#ALIAS eatq {#IF ((!@sleep) AND (@eat) AND (%numitems(@eatqueue) = 0)) {%1;#VAR eat 0} {#IF (%numparam() > 1) {#VAR eatqueue %push(%1, @eatqueue)} {#VAR eatqueue %additem( %1, @eatqueue)}}} "Triggers|Automatic Healing"

#ALIAS drinkq {#IF ((!@sleep) AND (@drink) AND (%numitems(@drinkqueue) = 0)) {%1;#VAR drink 0} {#IF (%numparam() > 1) {#VAR drinkqueue %push(%1, @applyqueue)} {#VAR drinkqueue %additem( %1, @drinkqueue)}}} "Triggers|Automatic Healing"

#VAR apply {1} {_nodef} "Triggers|Automatic Healing"

#VAR applyqueue {} {_nodef} "Triggers|Automatic Healing"

#VAR drink {1} {_nodef} "Triggers|Automatic Healing"

#VAR drinkqueue {} {_nodef} "Triggers|Automatic Healing"

#VAR eat {1} {_nodef} "Triggers|Automatic Healing"

#VAR eatqueue {} {_nodef} "Triggers|Automatic Healing"

#VAR sleep {0} {_nodef} "Triggers|Automatic Healing"

#TRIGGER {You close your eyes, curl up in a ball, and fall asleep.} {#VAR sleep 1} "Triggers|Automatic Healing"

#TRIGGER {You feel incredibly tired, and fall asleep immediately.} {#VAR sleep 1} "Triggers|Automatic Healing"

#TRIGGER {You feel irresistibly compelled to "sleep."} {#VAR sleep 1} "Triggers|Automatic Healing"

#TRIGGER {You may apply another salve to yourself.} {#IF ((@sleep) or (%item(@applyqueue, 1) = "")) {#VAR apply 1} {%item(@applyqueue,
1);#VAR applyqueue %delitem(%item(@applyqueue, 1), @applyqueue)}} "Triggers|Automatic Healing"

#TRIGGER {You may drink another affliction-healing elixir.} {#IF ((@sleep) or (%item(@drinkqueue, 1) = "")) {#VAR drink 1} {%item(@drinkqueue, 1);#VAR drinkqueue %delitem(%item(@drinkqueue, 1), @drinkqueue)}} "Triggers|Automatic Healing"

#TRIGGER {You may eat another plant.} {#IF ((@sleep) or (%item(@eatqueue, 1) = "")) {#VAR eat 1} {%item(@eatqueue, 1);#VAR eatqueue %delitem(%item(@eatqueue, 1), @eatqueue)}} "Triggers|Automatic Healing"

#TRIGGER {You open your eyes and yawn mightily.} {#VAR sleep 0;#IF (@eat) {#SH You may eat another plant.};#IF (@drink) {#SH You may drink another affliction-healing elixir.};#IF (@apply) {#SH You may apply another salve to yourself.}} "Triggers|Automatic Healing"

#TRIGGER {You open your eyes and stretch languidly, feeling deliciously well-rested.} {#VAR sleep 0;#IF (@eat) {#SH You may eat another plant.};#IF (@drink) {#SH You may drink another affliction-healing elixir.};#IF (@apply) {#SH You may apply another salve to yourself.}} "Triggers|Automatic Healing"

-----------------

With an example trigger of:

Pattern: Why must everything be so difficult to figure out.
Value: #cw red
#echo *** EAT GOLDENSEAL ***
eatq eatgo 1

-----------------

I've even went so far as to make a purge macro, to reset all the aliases to empty.. so it would immediately unfizzle. But I'd rather it just work in itself. I have no idea why it's not running smoothly, but like I said.. any help would be fantastic! Thanks!!

~Chrissy
Reply with quote
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Thu Oct 16, 2003 5:46 am   
 
What do you mean by 'clogged'. Does it all just stop, slow down, get too full or something else? Does it fail completly or just sometimes the salves or sometimes herbs or sometimes elixirs?

Do you notice anything that seems to happen before it 'clogs'?

The only minor issue I see is that you could possably call your q alaises with out a parameter wich wuld add "" to your list. This would stop it until you gave %push to something, then it would only run until you came to the "" again. Basicly your list would be {eatgo|eatas||eatlo} it would stop after 'eatas' an never hit 'eatlo'.

Also if you look at your example you could call eatq eatgo 1, but if you failed to eat it (you didn't have any, your stupid, your anorexic, your have amnesia, etc) your eat variable stays at 0 and you won't get the balance recovery message to reset to 1.
Reply with quote
Lost Soul
Newbie


Joined: 14 Oct 2003
Posts: 7

PostPosted: Sat Oct 18, 2003 4:50 pm   
 
Sometimes it's herbs that don't trigger, sometimes salves, sometimes drinking. *blush* But your example really hit what was wrong on the head. It will be working wonderfully, then all of a sudden stop. I inderstand the problem with my system now, but sadly have NO idea how to script a solution! I don't know how to get the parameters to change when they don't fire.. and don't know how to give the %push to something else. I also don't know how to get the recovery messages to reset to one if the trigger dosen't fire. Any help with that!!?? Thank you so much for your help thus far.. and I hope to hear from you again.

~ Chrissy
Reply with quote
Lost Soul
Newbie


Joined: 14 Oct 2003
Posts: 7

PostPosted: Sat Oct 18, 2003 4:51 pm   
 
I know I'm very newbish to this.. and I apologize. Please bear with me!! ^^

~ Chrissy
Reply with quote
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Thu Oct 30, 2003 8:57 am   
 
Sorry I didn't reply sooner, you probaly solved this already, but here's an idea to try if you haven't.

Add an alarm trigger when ever you try to eat/drink/apply to reset the variable. then untrigger the alarm when you do eat/drink/apply.

#ALIAS applyq {#IF ((!@sleep) AND (@apply) AND (%numitems(@applyqueue) = 0)) {%1;#VAR apply 0;#ALARM "applyreset" +1 {#VAR apply 1}} {#IF (%numparam() > 1) {#VAR applyqueue %push(%1, @applyqueue)} {#VAR applyqueue %additem( %1, @applyqueue)}}} "Triggers|Automatic Healing"

#TRIGGER {You may apply another salve to yourself.} {#IF ((@sleep) or (%item(@applyqueue, 1) = "")) {#VAR apply 1} {%item(@applyqueue,
1);;#ALARM "applyreset" +1 {#VAR apply 1};#VAR applyqueue %delitem(%item(@applyqueue, 1), @applyqueue)}} "Triggers|Automatic Healing"

Then when you get the message "You apply a salve" of "What do you want to apply" #UNTRIGGER applyreset You may also want to delay the the removal if the item from the queue until you get this message. You may want to #GAG the message about the trigger being removed if it says that.

To solve the issue of adding "" to queue you could try changing the %item(@applyqueue,1)="" to %numitems(@applyqueue)>0 to check for an empty queue.
Reply with quote
Lost Soul
Newbie


Joined: 14 Oct 2003
Posts: 7

PostPosted: Tue Nov 04, 2003 10:43 pm   
 
Hmm, well, I updated my system with the suggested solutions.. but now, it's not working at all. If more than one thing gets put into the queue, is shuts down and stops healing. Any additional advice? ;) Thanks for all your help sweetie!!

- Chrissy
Reply with quote
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Wed Nov 05, 2003 6:44 am   
 
opps,
I'm guessing you tried the suggestion of changing the %item(@applyqueue,1)="" to %numitems(@applyqueue)>0.

Try %numitems(@applyqueue)=0 insted of >0. I goofed there.
Reply with quote
Lost Soul
Newbie


Joined: 14 Oct 2003
Posts: 7

PostPosted: Thu Nov 06, 2003 6:13 am   
 
*giggle* I'm going to go check that out :). One more question for you, hun.. the #UNTRIGGER applyreset.. I would put that with my trigger, correct? IE:

Pattern: Why must everything be so difficult to figure out.
Value: #cw red
#echo *** EAT GOLDENSEAL ***
eatq eatgo 1
#UNTRIGGER applyreset

???? Thanks much :D

~Chrissy.
Reply with quote
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Thu Nov 06, 2003 1:04 pm   
 
The Best place to put the #UNTRIGGER would be in a trigger for "You eat a goldenseal" or "What do you wish to eat". This is verify that you tried to eat and if you didn't recieve one of these messages you want to reset the variable. If you receive one of those then you don't want the #ALARM to fire. you want to keep the varable the way it is.
Something like #TRIGGER {You eat a goldenseal} {#UNTRIGGER eatreset;#VAR drinkqueue %delitem(goldenseal, @drinkqueue)}
and remove the delitem from the "You may eat another plant." trigger.

You also probably should wait until you receive one of these messages before you remove the herb/salve/elixir from your queue.

Now that I think about it you need add a way to re-eat/apply/drink to the #Alarm. Otherwise you'll hang until you call your q alais again.
Such as #ALARM "eatreset" +1 {#VAR eat 1;#SAY You may eat another plant.}
Reply with quote
mauzl
Novice


Joined: 10 Oct 2000
Posts: 34
Location: Australia

PostPosted: Thu Nov 06, 2003 1:55 pm   
 
For Achaea though, I'd recommend setting variables saying what afflictions you have rather than running a queue. That way, if you get a bad affliction like stupidity or paralysis, you can have a healing alias which prioritises which ones to cure and will cure them first, so you don't have to work through a lot of minor affliction if you're fighting a very quick affliction opponent.

Sorry if this is off topic, but thats the sort of system most of the best trigger based fighters use.
Reply with quote
Lost Soul
Newbie


Joined: 14 Oct 2003
Posts: 7

PostPosted: Thu Nov 06, 2003 8:25 pm   
 
Oh, thank you for the advice Mauzl! Though, I have no idea how that system would work! I understand that you set it so the variable goes to 1 when you get the affliction.. then to 0 when you cure. Simple. But I don't know how to make a variable that would do that! Lol, I'm sorry I ask so many questions.. like I said before, I'm really just a novice in this. So let me just ask for an example..

The affliction message is "Why must everything be so difficult to figure out?", and the cure for such a message is goldenseal. The heal message, what script you recieve when you cure it, is "You don't feel like a complete idiot anymore." My question is this:
How do I go about setting up a variable something to outr my goldenseal, and eat it.. like was mentioned above?

Thanks guys, you are my heros!!

~ Chrissy.
Reply with quote
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Fri Nov 07, 2003 5:04 pm   
 
I agree that an affliction tracking system is better, but a queue system can work quite well. A Queue based is easier to work with at first, and good place to start as you learn scripting. I used a queue system for a long time and it got me by as a member of the Mark. I wans't great, but I got by. Since then I've tried several different methods.

If you want to try to change over to an Affliction based system you need to set a variable when you get the affliction, and reset it when you cure it. You will need to set up a way to check the variables to see what afflictions you have. There are several ways to do this.

1) long stringlist with all the possable afflictions in it sorted by healing priority and you check each one with a #FORALL to see if you have have it.
2)A stringlist with the afflictions based on the cure type(herb, salve, elixir, focus, etc) and do #FORALL on those lists.
3)A stringlist with the afflictions that you have insted of a variable for each affliction.
4)use the bitwise operators set bits within a variable.
5)-100) There are many other ways to do this also.

Each way has different advantages and disadvantages, mostly on time/efficency and complexity.

Hope this helps/gives you some ideas. I also hope you not a Mhaldorian. [:p]
Reply with quote
Lost Soul
Newbie


Joined: 14 Oct 2003
Posts: 7

PostPosted: Thu Nov 13, 2003 7:02 pm   
 
OK, so I tried the variable based system with much failure. I've never worked on a variable system before.. and well, it frusterated the hell out of me! :) I went from a mostly working queueing system to a pile of garbage that I just basically scrapped.. so I don't know where to go from here. Any help would be excellent guys :).

Love, Chrissy.
Reply with quote
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Tue Nov 18, 2003 6:14 am   
 
I would suggest you go back to the queue system. get it working to where it dosen't hang up. Keep asking questions when it does hang and you can't figure out why. Then start thinking about ways to do a affliction tracking.

A good way to start is once you have working queue is to combine the two ideas. insted of adding goldenseal to your eatq when have stupidity add "1 goldenseal". when you have scytherus add "2 goldenseal". (if you had both then the list would look like {1 goldenseal|2 goldenseal} then you can sort by priority, and track the afflictions. when you cure stupidity then delete "1 goldenseal". that will still leave "2 goldenseal" and then you can try to eat again. Use the %word() function to extract then herb name.

It's a bit more complecated than a simple queue, but more acurate. It will also help you learn tricks for an affliction system.

But I suggest you get the simple queue system working first. Ask questions here, or in game. Someone will help.
Reply with quote
Auren
Newbie


Joined: 12 Jan 2003
Posts: 7

PostPosted: Wed Nov 19, 2003 2:06 am   
 
In my experience, the queue system most commonly hangs when the system for tracking balance gets out of whack. Almost every time this is due to the stupidity affliction: you send the command to eat the herb, and set herb balance to 0, but due to stupidity you don't actually eat the herb, thus you never get the "You may eat another plant." message that most of us trigger for regaining herb balance. If you never eat it, you never see that message becasue you never LOST herb balance to start with. The end result: You're stuck waiting for a balance you already have! The workaround is to trigger the actual eating of the herb to removing herb balance, rather than doing it in the alias that sends the command to eat, that way if you fail to actually eat it, then you still know you have herb balance and can try again.
As an aside, I'm working on an afflcition-based system myself, and was curious if any decent fighters could give me tips on curing order? Contact me on AIM, SN auren365
Reply with quote
Martok
Newbie


Joined: 03 Jul 2003
Posts: 1
Location: United Kingdom

PostPosted: Thu Nov 20, 2003 1:23 pm   
 
I use prioritised queues, and a few variables for key afflictions such as stupidity, paralysis, asthma, anorexia and slickness.

When adding a cure to my queue I put a number in front of it so I add 010_bloodroot to my queue for instance instead of just bloodroot and then I sort the queue. That way I can tweak the cure orders without changing any code :)

Also I have bal_eat type variables which I set when I run my eat alias. this is to prevent eat spamming and I have zbal_eat type variables which hold the true balance from the actual eat and you may eat messages.

When I get the stupidity cure text, I reset the bal_ variables to equal the zbal_ variables. This kind of thing means that the queues don't ever get clogged.
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