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


Joined: 13 Dec 2002
Posts: 12

PostPosted: Fri Jan 17, 2003 4:15 pm   

Help with trigger...
 
This trigger is for Achaea Mud (www.achaea.com)

Trigger text (as seen from mud):
1077h, 1266m

Trigger:
(&CHP)h, (&CMP)m

Commands:
#if (@CHP<=(@MHP-400) and @anorexia=0 and @health=1) {drink health
health=0}
#if (@CHP<=(@MHP-700) and @anorexia=0 and @moss=1) {outb moss
eat moss
moss=0}
#if (@CMP<(@MMP-600) and @health=1 and @balance=1 and @anorexia=0 and @kill=0) {drink mana
health=0}


This is what happens when I test the trigger. (It works but too good...it should only capture the variables one time and it does four times):

%1 : 1077
%2 : 1077
%3 : 1266
%4 : 1266


Any idea why this is capturing the variables CHP and CMP four times rather then only once each?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jan 17, 2003 5:10 pm   
 
Because you combined the &varname (* equivalent) syntax with the (wildcard) syntax, so that the first number is captured by both &CHP and (*), likewise for the second number.
Trigger:
&{CHP}h, &{CMP}m
or

Trigger:
(%n)h, (%n)m
Commands:
#VAR CHP %1
#VAR MHP %2
#if (%1<=(@MHP-400) and @anorexia=0 and @health=1) {drink health
health=0}
#if (%1<=(@MHP-700) and @anorexia=0 and @moss=1) {outb moss
eat moss
moss=0}
#if (%2<(@MMP-600) and @health=1 and @balance=1 and @anorexia=0 and @kill=0) {drink mana
health=0}

The script does have other problems...

LightBulb
Senior Member
Reply with quote
kdberg
Beginner


Joined: 06 Jan 2003
Posts: 18
Location: USA

PostPosted: Fri Jan 17, 2003 5:12 pm   
 
Your pattern seems a little too "loose", try

#TRIGGER {^(%d)h, (%d)m} {#var chp %1;#var cmp %2;...
Reply with quote
drazzen
Beginner


Joined: 13 Dec 2002
Posts: 12

PostPosted: Fri Jan 17, 2003 6:10 pm   
 
Please elaborate on the other problems.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jan 18, 2003 3:54 am   
 
If @CHP is over 700 below @MHP you will do both health related actions, drink health and eat moss. This may be desired behavior.

More significant is that you check balance before drinking mana but don't check it before drinking health. I can't be certain without logging into Achaea and trying it, but I'd expect that if balance is required for one it's required for both.

Finally, there's the order of actions. In all three triggers you use a variable (@health or @moss) to prevent it from repeating the action immediately. However, you don't set these variables to 0 until after drinking or eating. This will probably never be a problem, but if your computer was running extremely slow (probably because of other programs) it's possible the next prompt could arrive while the variable is still 1. It's best to change variables like this before the action.

LightBulb
Senior Member
Reply with quote
blade
Novice


Joined: 22 Jul 2002
Posts: 32
Location: USA

PostPosted: Mon Jan 20, 2003 10:22 am   
 
I play at achaea...this tirgger works fine for me...should for you as well

trigger:
^&hpvar{h}, &mpvar{m} %w-

commands
hpvar=%1
mpvar=%2
#if @healbalance=1 {#if @hpvar<2600 {
healbalance=0
sip health
}}
#if @healbalance=1 {#if @mpvar<2600 {
healbalance=0
sip mana
}}
#if @mossbalance=1 {#if @hpvar<1700 {
mossbalance=0
outb moss
eat moss
}}
#if @mossbalance=1 {#if @mpvar<1600 {
mossbalance=0
outb moss
eat moss
}}

course you will have to change the numbers to fit your character...i made this trigger for zMud 6.16...and well works fine on 6.40 the only other thing you will have to do is make 3 more triggers...for the balance part of the commands...i had to do that to keep trigger from making me eat 2 moss everytime my health/mana dropped below the values i set...same for vials i would end up sipping twice...the balance variables...keep that from happening....the triggers for that are as follows...

trigger:
^You may eat another bit of irid moss.

commands:
#co bold,magenta
mossbalance=1

trigger:
^You may drink another health or mana elixir.

commands:
#co bold,red
healbalance=1

you can leave out the color commands but i find it very useful to see that you can drink again....especially when your health is like only 1 point higher than you set value...and you know you want to drink again anyways...just drink when you see when you are able...the color makes it easier to see...anyway hope that helps....
Reply with quote
blade
Novice


Joined: 22 Jul 2002
Posts: 32
Location: USA

PostPosted: Mon Jan 20, 2003 10:54 am   
 
oops sorry thought i proofed my reply before i posted...i said you would have to make 3 more triggers...that is not the case...however what i meant is that you would need 2 triggers and alias's for drinking health and mana and eating moss that you can use if the trigger does not fire...i will tell you it will happen...especially if You may drink another health or mana elixir msg for reseting the healbalance to 1 is not received back from Achaea which does happen from time to time...or for some reason, which may be a problem that i may only have: it appears my variables do not get set to 1 soemtimes even if the msg is received and the value remains 0 keeping you from drinking/eating...this is where the alias's to drink/eat health/mana/moss come in...if you are trying to get away from alias's with this trigger you may want to incorporate sometype of #alarm to reset balance to 1 after a period of time...the only problem with doing that is i believe it would cause an infinite loop if the #alarm is set for too short a period causing the balance to be always 1 even if the You may drink another health or mana elixir msg is not been sent yet causing you to drink when you can not...the other scenario is if the #alarm is set for too long which may help with making sure value is 1 when it should be...but it may be to late by that time...i would suggest the alias's...
Reply with quote
blade
Novice


Joined: 22 Jul 2002
Posts: 32
Location: USA

PostPosted: Mon Jan 20, 2003 11:10 am   
 
*bashes head against a very large wall several times*...since my trigger uses the & command the hpvar=%1 and mpvar=%2 that are included in the commands for the trigger are not necessary i am sure...also i just noticed you check for anorexia before sipping which the trigger i supplied does not do...easily fixed...but i would suggest dropping the anorexia variable altogether and just checking for the one...just have trigger for anorexia set healbalance=0 and have the trigger for the msg saying that the anorexia is cured set the healbalance=1...i only suggest that cause it reduces the amount of variables zMud is keeping up with...
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