|
atuk Beginner
Joined: 18 Oct 2002 Posts: 24 Location: Canada
|
Posted: Fri Oct 18, 2002 7:38 pm
Help with an auto-heal "program" |
I got the below "program" here awile back, but it doesn't seem to work anymore. I'm using Zmud v.6.16
~<(%d)hp%dm%dmv TC:%d EC:%*~>
#VAR hp%1
#VAR maxhp 541
#IF (%eval((@hp*100)/@maxhp)<75) {c rejuv}
I put the above into the variable box, right?
Where did I go wrong? Please help! Perhaps the first line should be placed elsewhere?
Cheers,
Atuk on darkover. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Oct 18, 2002 7:51 pm |
This is NOT a variable, it's a TRIGGER. The first line goes in the Pattern box. The rest goes in the Value box. You'll need a space between hp and %1.
Pattern:
~<(%d)hp%dm%dmv TC:%d EC:%*~>
Value:
#VAR hp %1
#VAR maxhp 541
#IF (%eval((@hp*100)/@maxhp)<75) {c rejuv}
LightBulb
Senior Member |
|
|
|
atuk Beginner
Joined: 18 Oct 2002 Posts: 24 Location: Canada
|
Posted: Sat Oct 19, 2002 10:07 pm |
Thanks dude!
|
|
|
|
atuk Beginner
Joined: 18 Oct 2002 Posts: 24 Location: Canada
|
Posted: Tue Oct 29, 2002 7:49 pm |
Dang! The above trigger just doesn't go off, but when I have all that stuff typed in, and click on the "test" tab, I get a green light. What am I doing wrong?
-Atuk of darkover. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Oct 29, 2002 8:23 pm |
This is just a guess.
There's probably spaces in your prompt between "hp" and the next number, and between "m" and the next number. Since you didn't put any in, I didn't either.
Also, since this appears to be a prompt trigger, the options should be trigger on Prompt - on, trigger on Newline - off.
LightBulb
Senior Member |
|
|
|
atuk Beginner
Joined: 18 Oct 2002 Posts: 24 Location: Canada
|
Posted: Tue Oct 29, 2002 9:16 pm |
Tried playing with spaces, and toggling between trigger newline off/on and prompt off/on and it still didn't work. It must be something small I'm overlooking because this trigger worked before--I'm having a problem now because I wiped my HD and re-installed everything, including zMud. I'll keep trying, of course. Thanks for all your help!
-Atuk |
|
|
|
atuk Beginner
Joined: 18 Oct 2002 Posts: 24 Location: Canada
|
Posted: Tue Oct 29, 2002 9:36 pm |
How about this: when I put the "pointer" over the @/maxhp part, a mini-window appears saying @maxhp=<empty>
Is that wrong?
-atuk |
|
|
|
Amfitrion Wanderer
Joined: 29 Sep 2001 Posts: 75 Location: Israel
|
Posted: Tue Oct 29, 2002 10:53 pm |
Give us the exact line you want to trigger on.
- Amfitrion. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Oct 29, 2002 11:36 pm |
I don't know that it's "wrong", but it's different from what you had before. Also, you divide bye @maxhp in:
#IF (%eval((@hp*100)/@maxhp)<75) {c rejuv}
so it would be best if it had a value. What you had before was:
#VAR maxhp 541
LightBulb
Senior Member |
|
|
|
atuk Beginner
Joined: 18 Oct 2002 Posts: 24 Location: Canada
|
Posted: Wed Oct 30, 2002 1:26 am |
The line is:
< 283hp 0m 97mv EC: nasty wounds >
I want the trigger to cast a spell when I'm below a certain percentage of hp.
Cheers,
Atuk of darkover. |
|
|
|
atuk Beginner
Joined: 18 Oct 2002 Posts: 24 Location: Canada
|
Posted: Wed Oct 30, 2002 2:48 am |
Pardon, the input is:
< 245hp 43m 69mv TN: Atuk TC: 245 EN: a sly, little fox EC: nasty wounds >
Sorry! :) |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Oct 30, 2002 5:17 am |
Change your pattern from:
~<(%d)hp%dm%dmv TC:%d EC:%*~>
to:
~< (%d)hp %dm %dmv * ~>
Kjata |
|
|
|
atuk Beginner
Joined: 18 Oct 2002 Posts: 24 Location: Canada
|
Posted: Thu Oct 31, 2002 7:46 pm |
Kjata dude! That worked--thanks! :)
Atuk. |
|
|
|
atuk Beginner
Joined: 18 Oct 2002 Posts: 24 Location: Canada
|
Posted: Thu Oct 31, 2002 9:50 pm |
How about another angle? Rather than have the trigger spam heals, how can I get the trigger to go off once, wait a second or two, then reset itself?
Cheers,
Atuk. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Oct 31, 2002 10:04 pm |
The best way is not to have it wait some time and reset utself, but to use a message from the MUD that lets you know that you have healed yourself and then reset it. To do it this way, the commands of the trigger would be:
#VAR hp %1
#VAR maxhp 541
#IF (@heal) {#IF (%eval((@hp*100)/@maxhp)<75) {#VAR heal 0;c rejuv}}
Now, you create a trigger that fires on the message that lets you know you healed yourself:
Pattern: You feel rejuvenated.
Commands:
#VAR heal 1
You should also make another trigger that fires when you try to heal yourself but you fail:
Pattern: Your rejuvenation fails.
Commands:
#VAR heal 1
Finally, when you have all this set up, be sure to create the @heal variable and give it an initial value of 1. Entering the following into the command line only once should do it:
#VAR heal 1
Kjata |
|
|
|
atuk Beginner
Joined: 18 Oct 2002 Posts: 24 Location: Canada
|
Posted: Fri Nov 01, 2002 2:27 am |
So when I have #VAR heal 1 as one line in another trigger, it will "refer"/reset the main heal trigger? Cool!
-Atuk. |
|
|
|
jcx2001 Newbie
Joined: 16 Jul 2007 Posts: 6
|
Posted: Mon Jul 16, 2007 8:22 pm Help! |
I have been trying forever to try to get this auto-heal script to work, but I am having major issues. At one point it was working and then all of a sudden it went into an endless loop.
I am just trying to fix this up for healing, but eventualy would like to extend it to mana and ego.
Here is my prompt.
2034h, 2952m, 2952e, 10p, 9070en, 13660w exd-
here is what I have
#Var potion_queue 1
#var hp %1
#var maxhp 2034
#TR %dh, (I've tried it with just %dh and (%dh) and (%d)h, %dm, %de, %dp, %den, %dw exd-)
#IF (@potion_queue) (I have also tried #IF @potion_queue = 1)
#IF (%eval( (@hp*100)/@maxhp)<75)
#VAR potion_queue 0
drink health
#TR You are ready to drink another potion.
#Var potion_queue 1 |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Jul 16, 2007 9:28 pm |
The problem is that your trigger isn't updating the hp variable.
You can do this
Code: |
#TR {&{hp}h, %dm, %de, %dp, %den, %dw exd-} |
This automatically captures your hitpoints into you HP variable. Or you could do this.
Code: |
#TR {(%d)h, %dm, %de, %dp, %den, %dw exd-} {#VAR hp %1} |
When you are evaluating @potion_queue you should do an explicit check like #IF @potion_queue = 1 or #IF @potion_queue > 0 because simply checking #IF (@potion_queue) will evaluate to true even if the variable is 0 because you are actually checking if the variable is defined. |
|
_________________ Asati di tempari! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jul 16, 2007 10:09 pm |
Tech wrote: |
checking #IF (@potion_queue) will evaluate to true even if the variable is 0 because you are actually checking if the variable is defined. |
Unfortunately not true, Tech. Try this code:
#var test 0
#if (@test) {#say defined} {#say not defined} |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Jul 17, 2007 12:11 am |
I was basing that off of another recent forum post. I stand corrected.
|
|
_________________ Asati di tempari! |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Tue Jul 17, 2007 12:22 am |
hmm, I'm not even sure it should be that complex.
Basically, you have the prompt line.
2034h, 2952m, 2952e, 10p, 9070en, 13660w exd-
With that you'll do the trigger to check the amount of "H" and if its below certain amount, you'd drink health.
How about this:
Code: |
#trigger {^(%d)h, (%d)m, (%d)e, (%d)p, (%d)en, (%d)w exd-$} {#if ((%eval( %1*100)/@maxhp)<=75) {drink health}}
|
It grabs the amount of H, then does the eval to check if H is at 75% or below, if its below or even, it will drink health potion.
I hope this helps some.
EDIT: As you mentioned in your post that you want to obtain different values in the future, you'll be able to use M with %2, E with %3 and so on.
Prog |
|
|
|
jcx2001 Newbie
Joined: 16 Jul 2007 Posts: 6
|
Posted: Tue Jul 17, 2007 1:19 am |
I guess the only other thing is that I have to wait some time before I can drink another potion. I wanted to use the variable so that I would only drink after the mud prompted me I could. I haven't tried the trigger, yet but I will soon. What is the ^ for before the health?
Could I put the triggers for both mana and ego in this same command line? Do I have to use a string line and if so what does that mean? heh |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jul 17, 2007 1:23 am |
The ^ character represents the beginning of a line and $ matches the end. So it'll match
31351h, 135135m
but not
Fang says, "2962h, 296296m." |
|
|
|
jcx2001 Newbie
Joined: 16 Jul 2007 Posts: 6
|
Posted: Tue Jul 17, 2007 4:57 am |
I am having lots of trouble with this. I have no idea what I am doing wrong.
Sometimes it works, sometimes it goes into a continuous loop when it triggers and sometimes it goes into a continuous loop when my health is full
other times it doesn't work at all
[code]#tr {^(%d)h, (%d)m, (%d)e, (%d)p, (%d)en, (%d)w ex-$} {#if ((%eval( %1*100)/@maxhp)<=75) {#if potion_queue=1} {drink health} {#var potion_queue 0}}[code][/code] |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Jul 17, 2007 5:23 am |
It should be something like this.
Code: |
#tr {^(%d)h, (%d)m, (%d)e, (%d)p, (%d)en, (%d)w ex-$} {#if ((%eval( %1*100)/@maxhp)<=75) {#if (potion_queue=1) {drink health} {#var potion_queue 0}}} |
|
|
_________________ Asati di tempari! |
|
|
|
|
|