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
Zion
Beginner


Joined: 26 Mar 2004
Posts: 18

PostPosted: Fri Apr 09, 2004 6:23 am   

A way to stop spamming of trigger?
 
Ok, I want my trigger to heal me if my hit points go under 350

so here's the prompt:
{HP:672/672 MA:295/402 MV:665/684} 19977

here's my trigger:
Pattern:
~{HP:&hpc/&hpt

Command:
#IF (@hpc < 350) {
poke zion
#WA 3000
}

now the problem isn't that it isn't working, the problem is, it's spamming, it heals, but there's a delay on the heal and it's sending the command repeatedly, so i'm sending like 15 requests before I actually get healed. Is there a way to stop that? I thought the wait would, but it doesn't seem to
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Fri Apr 09, 2004 7:07 am   
 
quote:
Originally posted by Zion

Ok, I want my trigger to heal me if my hit points go under 350

so here's the prompt:
{HP:672/672 MA:295/402 MV:665/684} 19977

here's my trigger:
Pattern:
~{HP:&hpc/&hpt

Command:
#IF (@hpc < 350) {
poke zion
#WA 3000
}

now the problem isn't that it isn't working, the problem is, it's spamming, it heals, but there's a delay on the heal and it's sending the command repeatedly, so i'm sending like 15 requests before I actually get healed. Is there a way to stop that? I thought the wait would, but it doesn't seem to




There's quite a few ways you can deal with this.
If your mud gives you a message when you heal then you can either
disable the trigger using #t- in the command before you heal, and use the heal message to enable it again (#t+) or use a boolean variable, here's an example : i dont know what your mud sends when you heal but for the example we'll use these 2 triggers
Code:

#TRIGGER {You feel better after you heal yourself} {bhealing = 0}
#TRIGGER {You fail to heal yourself} {bhealing = 0}

#TRIGGER {~{HP:&hpc/&hpt} {#IF (!@bhealing && @hpc < 350) {bhealing = 1;poke zion}}

Jesse
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 09, 2004 4:50 pm   
 
Don't use #WAIT in triggers!
Read Zugg's article in the Support Library if you want to know why.

You also have a problem with &hpc and &hpt. You didn't specify a wildcard type, so they use the default * type. That means that either of them can match almost the entire line. I usually make variables as part of the trigger's commands in order to avoid any possibility of this happening. However, if you must make variables in the pattern, at least specify what type of wildcard you intend.

For COMMMAND LINE entry.
#TR poke {~{HP:&%dhpc/&%dhpt} {#IF (%1 < 350) {poke zion;#STATE poke 1}} {} {manual}
#COND {} {} {Wait|Param=3000}

HINT: The command line is the one-line box at the bottom of the main screen where you enter commands for the MUD
Reply with quote
Zion
Beginner


Joined: 26 Mar 2004
Posts: 18

PostPosted: Sat Apr 10, 2004 4:09 am   
 
LightBulb, I did exactly what you did, but it still spams off?
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Sat Apr 10, 2004 4:33 am   
 
That should work the way its written. But you may be having problems because the wait option on a trigger isnt your best option, it's very good for certain things like muds that penalize you for spamming so you can delay recast, or to tick for certain amount of time and stand up again etc... But in your case you dont want to heal again in a certain amount of time. You want to heal, then re-evaluate your hps.
So you should go with one of the methods I mentioned above.

Cheers, Jesse
Reply with quote
Zion
Beginner


Joined: 26 Mar 2004
Posts: 18

PostPosted: Sat Apr 10, 2004 5:14 am   
 
Jessew, you're is 3 seperate triggers right?
Trig 1:
Trigger: You feel better after you heal yourself
Command: bhealing = 0
Trig 2:
Trigger: You fail to heal yourself
Command: bhealing = 0
Trig 3:
Trigger: HP:&hpc/&hpt
Command: #IF (!@bhealing && @hpc < 350) {bhealing = 1;poke zion}

of course the feedback messages would be specific? but the first error I got was from && I changed that to AND, but it also wasn't working correctly. Am I doing something wrong?
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Sat Apr 10, 2004 5:36 am   
 
&& is different from AND, AND i believe in zmud will actually perform the bitwise AND operation.
That was my bad it was only supposed to be one ampersand , #IF(!@bhealing & @hpc < 350)

Yes and replace these two triggers with the messages you get for a successful heal , and a failed heal

Trigger: You feel better after you heal yourself
Trigger: You fail to heal yourself

and define bhealing as

#VARIABLE bhealing 0 0

Jesse
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Sat Apr 10, 2004 5:48 am   
 
and here's the example for turning triggers on and off. Once again since i don't know what messages you get, ill substitute my fake ones.
Code:

#TRIGGER "healtrig" {~{HP:&hpc/&hpt} {#IF (@hpc < 350) {poke zion;#t- "healtrig"}
#TRIGGER {YOUR_MESSAGE_FOR_A_SUCCESSFUL_HEAL_CAST} {#T+ "healtrig"}
#TRIGGER {YOUR_MESSAGE_FOR_A_FAILED_HEAL_CAST} {#T+ "healtrig"}


Jesse
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Sat Apr 10, 2004 7:08 am   
 
Ok nevermind about the whole AND thing i got confused :)
that *should* of worked the way you had it, what was happening?

Jesse
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Apr 10, 2004 12:44 pm   
 
LightBulb's trigger does not cause a loop for me. The only way it could cause a loop if is poke is an alias that produces some output that makes the trigger match again.
Reply with quote
Zion
Beginner


Joined: 26 Mar 2004
Posts: 18

PostPosted: Sun Apr 11, 2004 2:09 am   
 
Jessew:
The problem is, the HP trigger doesn't match my prompt?
{HP:1047/1047 MA:674/674 MV:1152/1152} 50398
I've tried testing it, but with the "healtrig" I don't think it's working

Trigger 1:
Pattern: "healtrig" {~{HP:&hpc/&hpt}
Value: #IF (@hpc < 900) {
poke zion
#t- "healtrig"
}

Trigger 2:
Pattern:
You feel a warm healing force flow through your body.
Value:
#T+ "healtrig"

Trigger 3:
Pattern:
Zion says 'I lost my concentration'
Value:
#T+ "healtrig"
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Sun Apr 11, 2004 2:26 am   
 
Ok, from your other post im assuming your using zmuds settings editor to add your triggers. "healtrig" was not meant to be part of the pattern, It's the ID, when using the editor switch to the options tab on your prompt trigger and type in healtrig under ID. That should solve your problem.

Cheers Jesse
Reply with quote
Zion
Beginner


Joined: 26 Mar 2004
Posts: 18

PostPosted: Tue Apr 13, 2004 1:45 am   
 
Hey, just wanted to say thank you to both jessew and lightbulb, it works now.
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