|
atuk |
Posted: Fri Oct 18, 2002 7:38 pm
Help with an auto-heal "program" |
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Tue Jul 17, 2007 2:53 pm |
This is the #IF portion of what you want.
Code: |
#if (%eval( (%1*100)/@maxhp)<=75) {#if (@potion_queue=1) {drink health} {#var potion_queue 0}} |
In this case if you are at or below %75 of your total health you will attempt to drink health if @potion_queue is 1.
As for the trigger pattern.
Code: |
^(%d)h, (%d)m, (%d)e, (%d)p, (%d)en, (%d)w %x$ |
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
jcx2001 Newbie
Joined: 16 Jul 2007 Posts: 6
|
Posted: Tue Jul 17, 2007 9:40 pm |
I have almost got it, but I am still having one issue. It will work when my HP is at 75% but if it gets to low it will loop. I have a variable called potion_queue to try and fix that problem and my triggers are changing the value to 1 and 0, respectively. The issue is that the trigger is not registering #if (@potion_queue=1)
Here is what I'm working with
#tr {(%d)h, (%d)m, (%d)e, (%d)p, (%d)en, (%d)w %-} {#if (%eval( (%1*100)/@maxhp)<=75) {#if (@potion_queue=1) {#var potion_queue 0} {drink health}}}
Also, is there anyway to set make a does not equal symbol? |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Jul 17, 2007 10:44 pm |
Yes you can do '<>' and '!='
|
|
_________________ Asati di tempari! |
|
|
|
jcx2001 Newbie
Joined: 16 Jul 2007 Posts: 6
|
Posted: Thu Jul 19, 2007 1:08 am |
#tr {(%d)h, (%d)m, (%d)e, (%d)p, (%d)en, (%d)w %-} {#if (%eval( (%1*100)/@maxhp)<=75) {#if (@potion_queue=1) {#var potion_queue 0} {drink health}}}
any ideas on why my trigger will not recognize the #if (@potion_queue=1?? |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Thu Jul 19, 2007 3:46 am |
Only three.
First you are saying if @potion_queue!=1 drink health. If you are editing the potion_queue variable and giving it any values besides 1 and 0 you must understand that any values other than 1 will cause you to drink health. A better way to write this would be to reverse your IF structure.
#if (@potion_queue=0) {drink health} {#var potion_queue 0}
The next is a little tricker.
When you drink health do you immediately set the potion_queue to 1 or do you wait for a trigger to fire first? If you wait for a trigger to fire first it is possible that you will sip your potion again every time you receive a prompt before you get the, "You have sipped a restorative potion." line. This could end up being many lines especially in a big fight. To avoid this you can add setting the potion_queue variable in the drink part as well.
#if (@potion_queue=1) {#var potion_queue 0} {drink health;#var potion_queue 1}
Of course the problem with this is that you are setting the potion_queue back to 0 the very next time the trigger fires and you are on low health, which could be the very next prompt. This should be avoided if possible as if you get three prompts before your health is above %75 you will drink health again every other prompt.
There are several ways to deal with THIS new issue. Usually you will receive a line something like, "You can now sip another health potion.". Make this into a trigger and have IT set your potion_queue to 0.
Another way is that the wait before you can sip another potion is usually set on a timer. Often this timer is something like 2 seconds. If you can discover this timer you can set an alarm to fire off in that amount of time. Turn on the alarm when you drink a health potion and have it turn itself off after setting the value of potion_queue to 0.
Finally the last possible issue. And it is the easiest one.
It is possible, though unlikely, that you have multiple potion_queue variables and that you need to delete one of them.
Now the most likely culprit is #2 but you should look into all three. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jul 19, 2007 10:37 am |
Another idea - is it possible that you meant
#if (@potion_queue=1) {drink health;#var potion_queue 0}
but typoed it? This way seems to make more sense. |
|
|
|
jcx2001 Newbie
Joined: 16 Jul 2007 Posts: 6
|
Posted: Thu Jul 19, 2007 11:21 pm |
Thanks Arminas and Fang Xianfu and everyone. It works perfectly now, it turns out it was a typo and Fang Xianfu solution worked!!
|
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Jul 20, 2007 1:11 pm |
Sweet, glad to hear you got it working.
It's always good when someone posts that they have a solution. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
|
|