zMud autosipper

by zand

Back to Mechanic's Corner.

zand2006-12-29 20:22:38
This is an autosipper I just finished and I want to know if there are anyways I can improve it.

CODE
#CLASS {Autosipper}
#TRIGGER {(*)h, (*)m, (*)e, (*)p *(*)-} {
#VAR currenthp %1
#VAR currentmp %2
#VAR currenteg %3
#VAR currentpw %4
#IF (%1 < %3) {dh} {
#IF (%2 < %3) {dm} {db}
}
#ALIAS dh {#IF (@healbalance = 1) {#IF (@currenthp < @maxhp/2) {dh} {dm}}
#ALIAS dm ..................
#ALIAS db ................
#TRIGGER {Health : (*)/(*)       Endurance : (*)/(*)} {
#VAR maxhp %2
#VAR maxed %4
}
#TRIGGER {Mana   : (*)/(*)       Willpower : (*)/(*)} {
#VAR maxmp %2
#VAR maxwp %4
}
#TRIGGER {Ego    : (*)/(*)       Reserves  : (*)%} {
#VAR maxeg %2
}
Shorlen2006-12-30 14:29:29
QUOTE(Zand @ Dec 29 2006, 03:22 PM) 367507

This is an autosipper I just finished and I want to know if there are anyways I can improve it.

CODE
#CLASS {Autosipper}
#TRIGGER {(*)h, (*)m, (*)e, (*)p *(*)-} {
#VAR currenthp %1
#VAR currentmp %2
#VAR currenteg %3
#VAR currentpw %4
#IF (%1 < %3) {dh} {
#IF (%2 < %3) {dm} {db}
}
#ALIAS dh {#IF (@healbalance = 1) {#IF (@currenthp < @maxhp/2) {dh} {dm}}
#ALIAS dm ..................
#ALIAS db ................
#TRIGGER {Health : (*)/(*)       Endurance : (*)/(*)} {
#VAR maxhp %2
#VAR maxed %4
}
#TRIGGER {Mana   : (*)/(*)       Willpower : (*)/(*)} {
#VAR maxmp %2
#VAR maxwp %4
}
#TRIGGER {Ego    : (*)/(*)       Reserves  : (*)%} {
#VAR maxeg %2
}


First, you're missing the "" {nocr|prompt} at the end of your prompt trigger, which catches only prompts sent from the MUD, not normal lines. You are also comparing your health/mana/ego to each other, rather than to your maxes. What I do, and you don't have to do this, when I set max health, I also run this formula:
CODE
#var status.healthsip %round( %eval( ((0.15 * @maxhealth)+100.0) * (1.0 + @status.sipbonus * 0.1)))

Which calculates the average amount I'll sip health for. And then the same for the other two. Then, in my autosipper, I check if anything is down by two sips. If my health is, I sip health. If my mana is, I sip mana. If my ego is, I sip ego. Then I check if anything is down about one sip, and then sip in the same order.

Up to you how you do it though.