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


Joined: 20 Jun 2004
Posts: 20
Location: USA

PostPosted: Fri Dec 12, 2008 4:21 pm   

curing project
 
Ok I currently have a auto sipping script that has some issues with healing me properly. I want to try and go a bit more complex and use some #if statements. Any new ideas would be most welcome!

I currently have 2 prompt triggers each with their own classes. One is called autohealerpot which just checks and heals me with a health potion the other is called autohealerherb which is turned on after I sip a health potion and will heal with a herb.

Problems arise in the heat of battle and I have sipped a potion and the autohealerpot class is shut off (if it shuts off properly...) and the Autohealerherb class is on. Sometimes they both stay on as the timings get mucked up exc...I have basically been pulling my hair out with adjusting it so much I just want to start fresh and try something new.

This would check current health and if it is below a certain value sip health potion. If health potion has been sipped I want it to eat a healing herb. Also, I can only eat a herb every 2 seconds. So, if I have eaten a herb for another curative I want it to cue up to try healing again in a second or 2.


Here are some of my current triggers to capture my prompt.
Class Autohealerpot
^(%d)h, (%d)m (*)
HpVar=%1
MpVar=%2
#if @HpVar<600 {sip heal;#T- autohealherpot} (should I even have my healing trigger set up here?)
#if @mpVar<600 {warn} (just an alias to warn me for low mana)

Class Aotohealerherb
HpVar=%1
MpVar=%2
#if @HpVar<600 {eat healing herb;#T- autohealerherb}
#if @mpVar<600 {warn}

Some useful triggers:

After you sip health potion: ^The healing liquid tingles down your spine.
After you eat an herb: ^The healing herb brightens your stamina.
Recover to sip again: ^You could take a healing potion again.
Recover to eat again: ^You could take a healing herb again.
Affliction herbs: ^You ingest a affliction healing leaf. (no recovery message for affliction healing herbs, 2 second pause in between)
If you sip or eat too fast: ^You must wait a few seconds before taking another healing potion/eating another herb.






[/b]
_________________
carol
Reply with quote
porcelina
Beginner


Joined: 20 Jun 2004
Posts: 20
Location: USA

PostPosted: Sat Dec 13, 2008 10:56 pm   
 
Ok, I am still trying to make a better autohealth script and am hoping someone will chime in at some point with advice.

This is my current prompt:

1350h, 1350m ex-

The letters after designate various defenses which I would like to capture. If I sip a health potion my prompt changes to:

1350h, 1350m epx-


My current trigger for the above prompt is as follows:

^(%d)h, (%d)m (%w)-
#IF (%match(%3, x) = 0) {kelvv}
#IF (%match(%4, p) = 0) {healthwait=1} {healthwait=0}

I am having problems capturing the "p" in the prompt and I would like to use this for my healing script somehow.

Basically if the p were in my prompt I would eat a healing herb instead so this would be key for another script.


Any help would be much appreciated!
_________________
carol
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sat Dec 13, 2008 11:16 pm   
 
In your second if statement where you are checking for p you are using %4 which will not have a value given the trigger you are using. I think you just want to change that %4 to a %3 and what you have should work. The only other thing is that you are checking if %match returns 0 in your if statements. %match returns 0 when a match was not found, that may have been what you intended but figured I'd mention it just in case.
Reply with quote
porcelina
Beginner


Joined: 20 Jun 2004
Posts: 20
Location: USA

PostPosted: Sat Dec 13, 2008 11:27 pm   
 
Ah that worked, thanks!

Now I have:

^(%d)h, (%d)m (%w)-

HpVar = %1
MpVar = %2
#IF (%match(%3, x) = 0) {kelvv}
#IF (%match(%3, p) = 0) {healthwait=1} {healthwait=0}

So if I sip a health potion the p appears on my prompt and healthwait changes to 0 then to 1 once the p disappears.

Question, should I have my healing #if statement withing that same prompt trigger or should I make a separate Prompt trigger?

I was thinking I could just do the following:

^(%d)h, (%d)m (%w)-

HpVar = %1
MpVar = %2
#IF (%match(%3, x) = 0) {kelvv}
#IF (%match(%3, p) = 0) {healthwait=1} {healthwait=0}
#IF ((%1 < 600) AND @healthwait) {Sip health Potion}} <...........How can I do else eat healing herb here as well?
_________________
carol
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sat Dec 13, 2008 11:36 pm   
 
If I understand correctly you won't be able to do that quite how you are attempting. If you put 'eat healing herb' in the else part of the if statement you have now, you would eat the healing herb if you weren't below 600 hp or if healthwait was 0. You really want it to only eat the herb if you are below 600 and healthwait is 0. Maybe something like this:
Code:
#if (%1 < 600) {
  #if (@healthwait) {Sip health Potion} {eat healing herb}
}
Reply with quote
porcelina
Beginner


Joined: 20 Jun 2004
Posts: 20
Location: USA

PostPosted: Sun Dec 14, 2008 12:04 am   
 
That worked well I now have:

^(%d)h, (%d)m (%w)-

HpVar = %1
MpVar = %2
#IF (%match(%3, x) = 0) {kelvv}
#IF (%match(%3, p) = 0) {healthwait=1} {healthwait=0}
#if (%1 < 1000) {
#if (@healthwait) {#sa health} {#say herb}}

But it double and tripples sipping health or eating herb. I have tried both trigger on prompt and new line.
_________________
carol
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sun Dec 14, 2008 12:40 am   
 
Ahh, you said this is the trigger to capture your prompt. That means every time your hp falls below the trigger point you are going to send the command to sip or eat which then results in another prompt. This will repeat until your hp goes above the trigger point.

It sounds like based on your first post you should have a healing class that becomes enabled when the prompt trigger detects the hp threshold. You would then immediately sip a potion and eat an herb. At that point you would use the other triggers you listed to detect when you can sip another potion or eat another herb. Each time one of these triggers fires, you would check the hp again to see if you should continue healing or disable the healing class.

Your prompt trigger would change to something like this:
Code:
HpVar = %1
MpVar = %2
#IF (%match(%3, x) = 0) {kelvv}
#IF (%match(%3, p) = 0) {healthwait=1} {healthwait=0}
#if (%1 < 1000 AND !%class(Healing)) {
  #T+ Healing
  sip health potion
  eat healing herb
}


And the healing class would look something like this:
Code:
#trigger {^You could take a healing herb again.} {if (@HpVar < 1000) {eat healing herb} {#T- Healing}}
#trigger {^You could take a healing potion again.} {if (@HpVar < 1000) {sip healing potion} {#T- Healing}}

If you can't sip a potion and eat an herb at the same time, you would need to use some other message after you sipped the potion that would let you know you can now eat the herb.
Reply with quote
porcelina
Beginner


Joined: 20 Jun 2004
Posts: 20
Location: USA

PostPosted: Sun Dec 14, 2008 2:16 am   
 
Alright, so far I have 2 classes now and 3 prompt triggers.

The main prompt trigger is always on and updating my health/mana and stats as follows:

^(%d)h, (%d)m (%w)-
HpVar = %1
MpVar = %2
#IF (%match(%3, p) = 0) {healthwait=1} {healthwait=0}
#IF {@healthwait=1} {#T+ autoheal} {#T- autoherb}

(I was thinking of trying this 2nd line to turn off the second class if the first back on. Not working... *sigh*)

First class called [autoheal}

^(%d)h, (%d)m (*)
HpVar=%1
MpVar=%2
#if (%1 < 1000) {
#if (@healthwait=1) {h} {#T+ les;#T- autoheal}}

Second class called [autoherb]

^(%d)h, (%d)m (*)
HpVar=%1
MpVar=%2
#if (%1 < 1000) {
#if (@healthwait=0) {hh} {hhh}}

***************************************************************************
The alias for hh is eat herb
alias for h is sip health
alias for hhh is eat food

I am still having isues with the double sip as the classes do not seem to shut themselves off fast enough. Maybe I can code something into the alias that may cure this?

I tried changing my sip health alias (h) to
#T- autoheal
#IF {@healthwait=1} {healme} {#sa must wait to heal}
but still getting the double sips somehow lol
_________________
carol
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sun Dec 14, 2008 3:00 am   
 
You shouldn't need more than one prompt trigger. The main prompt trigger stores the information you need into the HpVar and MpVar variables which you can then use in the other triggers if needed.

The problem is that if you are starting the healing process based on the prompt, you can only do the first potion sip and eating of the healing herb based on the prompt. My last post accomplished that in the prompt trigger by checking if your hp was low and if the healing class was already enabled. If your hp was too low but the healing class was already enabled, it didn't do anything because the triggers inside the healing class would take care of it.

If I understand correctly, with the method I posted above you won't need the healthwait variable anymore either because the healing class triggers are performing that function for you now by waiting for the messages saying that a potion can be sipped again and that a herb can be eaten again.

Was there something about the setup in my previous post that didn't work which led you down this path of making multiple prompt triggers and healing classes?
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sun Dec 14, 2008 2:23 pm   
 
Is the sipper for Achaea, btw?

I'm asking because I have pretty decent sipper written for it though in CMud.

But I could look into it and throw few ideas out there after I've molded them into ZMud.

In a nutshell, Prompt trigger shouldn't do anything else but capture values to respectable variables.

Henceforth there are a few ways to go, personally I prefer an Alarm.

Though Expression trigger should work just as well (personally I have just never liked to use them).

Either of them would call healing Alias once math meets the requirements.

Say, #if (@hp<500) {heal_alias}

And heal Alias would contain all the code involved how to heal exactly based on a given scenario.

That being said, if your MUD is Achaea there are several MUD messages which point when something has been
drank etc.

All those messages have excellent uses as well.

Anyway, I just figured I'd throw it out there.

I won't have any time to post some code until late tonight, though.
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
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