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
GooseFire
Novice


Joined: 08 Sep 2003
Posts: 32
Location: USA

PostPosted: Tue Sep 09, 2003 1:26 am   

Automatic Healing System not queueing?
 
http://www.zuggsoft.com/forum/topic.asp?TOPIC_ID=5119&SearchTerms=affliction%2Chealing%2Csystem

That was the original topic on it but I can't seem to find it near the top, so I hope to get it some more attention. I'm posting my script below, but as said in the original topic, I can't get it to queue any of the triggers that goes off. It continues to try to do them all at once. Now, I had to adjust a few things to make it use my alias that gets the herb from the container and eats it aswell. It was doing eat -alias- or change eat with drink or apply. So, I got rid of the eat and and I had to delete a | in the script because it was placing that at the end of each alias it set off, but I'm not sure where I made it go wrong.. Help please?

#ALIAS applyq {#IF ((!sleep) and (@apply) and (%item(@applyqueue, 1) = "")) {apply %1;#VAR apply 0} {#IF (%2 = 1) {#VAR applyqueue;%concat(%1, "", @applyqueue)} {#VAR applyqueue %additem(%1, @applyqueue)}}} "Triggers|Automatic Healing"
#ALIAS drinkq {#IF ((!sleep) and (@drink) and (%item(@drinkqueue, 1) = "")) {drink %1;#VAR drink 0} {#IF (%2 = 1) {#VAR drinkqueue;%concat(%1, "", @drinkqueue)} {#VAR drinkqueue %additem(%1, @drinkqueue)}}} "Triggers|Automatic Healing"
#ALIAS eatq {#IF ((!sleep) and (@eat) and (%item(@eatqueue, 1) = "")) {eat %1;#VAR eat 0} {#IF (%2 = 1) {#VAR eatqueue;%concat(%1, "", @eatqueue)} {#VAR eatqueue %additem(%1, @eatqueue)}}} "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 {1} {_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"
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Sep 09, 2003 5:32 am   
 
#ALIAS applyq {#IF ((!sleep) and (@apply) and (%item(@applyqueue, 1) = "")) {apply %1;#VAR apply 0} {#IF (%2 = 1) {#VAR applyqueue;%concat(%1, "", @applyqueue)} {#VAR applyqueue %additem(%1, @applyqueue)}}} "Triggers|Automatic Healing"

sleep is always true, so !sleep is always false. It's a non-null string. Not to be confused with @sleep.
(%2 = 1) is always true if %2 doesn't exist. I'm not sure why. It's probably another non-null string, " = 1".
; is the command character. In this case it makes #VAR applyqueue a separate command, which displays the contents of @applyqueue, followed by the %concat function, which returns the concatenated value of its arguments as the next command.
%concat( %1, "", @applyqueue) adds %1 to the front of the first item in @applyqueue but doesn't create a new item. Will you ever have a "mendingcaloric"?
%concat( %1, "|", @applyqueue) adds %1 to the front of @applyqueue as a new item. However, if @applyqueue is empty, it creates a second item with an empty string. Additional items added to the end will come after the empty item.

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

Your other two aliases have similar problems which will require similar fixes.
Reply with quote
GooseFire
Novice


Joined: 08 Sep 2003
Posts: 32
Location: USA

PostPosted: Tue Sep 09, 2003 2:48 pm   
 
We'll, it started queueing the aliases but now it doesn't bring the alias out of the queue and execute it. I'm looking over the old ones and this one, but I'm still new to this stuff.

EDIT:
Here is a trigger that I'm trying to get it to execute once it gets in the queue, but I dont think its the problem since it puts the contents inside the paranthesis of 'applyq "-----"' in the queue.

#cw yellow
#echo You are *** APPLYING MENDING to ARMS ***
applyq "apmend to arms"

That is just the value, though.
Reply with quote
GooseFire
Novice


Joined: 08 Sep 2003
Posts: 32
Location: USA

PostPosted: Tue Sep 09, 2003 9:18 pm   
 
#TRIGGER {You may apply another salve to yourself.} {#if ((@sleep) or (%numitems(@applyqueue, 1) = "")) {#VAR apply 1} {%numitems(@applyqueue, 1);#VAR applyqueue %delnumitems(%numitems(@applyqueue, 1), @applyqueue)}} "Triggers|Automatic Healing"

That was the new trigger I had constructed inhopes of fixing it. It fixed it to a point, but now when I apply mending to my left leg, and my left leg only, it locks zMUD up. Also, it was executing the alias but it was putting apply in front of it. I don't know if it was queueing it still. And it didnt recognize every trigger, either.
Reply with quote
GooseFire
Novice


Joined: 08 Sep 2003
Posts: 32
Location: USA

PostPosted: Tue Sep 09, 2003 9:47 pm   
 
#TRIGGER {You may apply another salve to yourself.} {#if ((@sleep) or (%numitems(@applyqueue, 1) = "")) {#VAR apply 1} {%numitems(@applyqueue, 1);#VAR applyqueue %delnumitems(%numitems(@applyqueue, 1), @applyqueue)}} "Triggers|Automatic Healing"

That was the new trigger I had constructed inhopes of fixing it. It fixed it to a point, but now when I apply mending to my left leg, and my left leg only, it locks zMUD up. Also, it was executing the alias but it was putting apply in front of it. I don't know if it was queueing it still. And it didnt recognize every trigger, either.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Sep 10, 2003 11:05 am   
 
%numitems() and %item() are not interchangeable. There is no %delnumitems() function.

Your original trigger (from your first post in this topic) leaves out apply.

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

This is a critical error. Most of your other changes have consisted of similarly critical errors. There was nothing significantly wrong with the original script in the topic you reference in your first post. I'd suggest you go back to it. You clearly don't yet understand enough to write or modify complex scripts like this one on your own.

This isn't intended as an insult. It takes time and experience to acquire understanding of anything. Nor is it intended to discourage your attempts at scripting. If you never try to script, you not only won't improve, you'll probably get worse. It's simply a suggestion to tackle something simpler than a full-scale Achaea affliction system (which is still beyond my expertise) to learn on.
Reply with quote
GooseFire
Novice


Joined: 08 Sep 2003
Posts: 32
Location: USA

PostPosted: Wed Sep 10, 2003 3:21 pm   
 
Oh, definately! I agree, I have no clue what I'm doing, but I am trying. Don't worry, everything comes in time. I was hoping that the original alias dub'd the things it queue'd %item, even though that only makes sense in my mind, then since the triggers were setup as %item and the new alias was set to %numitems I figured that it just wan't recognizing the alias to execute in the queue. But, like I said, this may only make sense in my mind. But, thank you for your help.

Now that I've looked over it, your right. It does seem to execute the trigger. It executes the #cw and the #echo but it doesn't enter the alias into the game. It will if I take the applyq off and just leave the alias, but it just leaves everything else in the queue and doesn't execute it. I'm tinkering, but I'm a newbie!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Sep 11, 2003 8:41 pm   
 
I suspect that one of the problems is that you're trying to specify where to apply the mending salve, which means you have to use multiple words. Mending salve will automatically target any affliction it can cure, and you'd want them all cured, so it's not really necessary to specify a target. If you do want to specify the target, use the same method as I demonstrate below with epidermal salve.

Epidermal salve will also target any affliction it can cure, however two of those afflictions are blindness and deafness. Since you might actually want these two afflictions as defenses against other attacks, it may be necessary to specify where the epidermal salve is applied. This is done by grouping with {} and should be incorporated into the triggers for anorexia, the other affliction cured with epidermal salve.

Sample trigger:
#TR {You have anorexia} {applyq {epidermal to body} 1}
Reply with quote
GooseFire
Novice


Joined: 08 Sep 2003
Posts: 32
Location: USA

PostPosted: Thu Sep 11, 2003 10:15 pm   
 
Alright! Its fixed and working correctly now, everything is! Thank you Lightbulb!
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