|
dazed-n-confused Novice
Joined: 14 Jan 2004 Posts: 31
|
Posted: Tue Feb 24, 2004 7:50 pm
command prompt trigger help |
what i want to do is have a trigger sip health potion, but it needs to take two things into consideration.
First of all, I want to trigger to make a health check when I get the message "^You would be able to take another health or mana potion." The chech should be made against my command prompt which commonly looks like this: 950h, 950m bcdei([{-}]), If my health is below some prededermined limit then I want to sip health potion. The letters on the prompt can change from time to time as do the brackets. To avoid confusion, ill include a paste from the mud.
You would be able to take another health or mana potion.
673h, 462m bceil([{-}])
The command prompt will always be on the next few lines depending on how fast the scroll is. I tried just using the potion everytime I get the potion message, only during a fight. But it still wastes a lot of potion. Anyone got a good idea, Im all ears. Thanks |
|
|
|
Darker GURU
Joined: 24 Sep 2000 Posts: 1237 Location: USA
|
Posted: Tue Feb 24, 2004 8:41 pm |
Create a trigger on your prompt to store your current health in a variable.
Create another trigger on the "You would be able..." text with a command like this:
#if (@MyHealth < @SomeHealthNumber) {sip a potion}
Battle spam will still mess with this - especially if you see your prompt several times before the mud reacts to the "sip" command you sent. You can get more complicated to try and avoid extra sips, but this is the basic way your trigger should work. |
|
|
|
dazed-n-confused Novice
Joined: 14 Jan 2004 Posts: 31
|
Posted: Wed Feb 25, 2004 12:18 am |
If I make a trigger to check the prompt every time it shows, it causes MAJOR lag. This forces me to update @myhealth only at a few controlled times. Sorry, should have mentioned that.
|
|
|
|
Timas Novice
Joined: 05 Jan 2003 Posts: 39 Location: Netherlands
|
Posted: Wed Feb 25, 2004 7:55 am |
odd stuff.. I got a trigger that updates my prompt every single time and its *HUGE*. It updates a ton of variables. Considering your using a different prompt and mud though, maybe its different.
I suppose you can try adding a counter to it, that'll count the passed prompts and let you respond every so many times.. this wont fix your lag with the prompt I don't think but will save a potion or two perhaps
would be something like:
#TRIGGER {(%d)h, (%d)m (*)~]~)} {#VAR hp %1;#VAR mana %2;#ADD prompt 1;#IF (@prompt > @defined.prompt) {#VAR prompt 0;#IF (@hp < @defined.hp) {sip a potion}}
Then for the sake of setting the two variables you might want to add:
#ALIAS counter {#PR defined.hp "Enter the minimum hp";#PR defined.prompt "Enter how many prompts should be counted."}
After you run this it'll only take a potion after the defined number of prompts pass, its still not waterproof but might save another potion or two. Make sure you run that counter alias or define the variables manually, they need to be set or the trigger will be useless
edit: forgot to reset the prompt counter. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Feb 25, 2004 8:42 am |
You'd need to post your exact trigger that you used for your prompt that was causing the lag for us to help with it.
Keep in mind that if you have any Button or Gauge with your @hp in it, then every time the @hp variable changes, zMUD needs to repaint the button or gauge, and that can cause it to be really slow. In that case, have your prompt trigger read in the hp everytime, but then run another alarm in the background to update your button or gauge variable only every few seconds. |
|
|
|
dazed-n-confused Novice
Joined: 14 Jan 2004 Posts: 31
|
Posted: Thu Feb 26, 2004 12:34 am |
The laggy trigger looked something like this:
#trigger {^(%d)h,*} {health = %1}
As soon as I disabled the trigger the lag stopped. I was wondering if something like this would work:
#trigger {*bashes you.} {#cw bold,red} {#if (@myhealth < @minhealth) (sip potion)}
{#t- class folder}
#cond {^(%d)h,*} {myhealth = %1} {within|param=5}
Am I way off with this? |
|
|
|
|
|