ZMUD Autosipping

by Unknown

Back to Mechanic's Corner.

Unknown2006-09-04 22:45:12
How do I? I have no idea where to even start. Anyone have any suggestions for someone who can only do basic triggers, and has no idea how to write scripts?

Please and thanks!
Shorlen2006-09-04 22:57:59
QUOTE(Wyn @ Sep 4 2006, 06:45 PM) 327811
How do I? I have no idea where to even start. Anyone have any suggestions for someone who can only do basic triggers, and has no idea how to write scripts?

Please and thanks!

First, you need a prompt trigger that gets your current health/mana/ego.

Second, you need a score trigger that gets your max health/mana/ego.

Third, you need a piece of code that compares your current vitals to your max, and if the current is far enough below the max to warrent a sip, sips.

Fourth, you need something to keep track of potion balance, but isn't so dumb as to get screwed up with illusions.


I can show you my code, if you like. The forumla for a sip, by the way, is (.12*maxhealth+80)*(1+.1*sipbonus) to (.18*maxhealth+120)*(1+.1*sipbonus), or (.15*maxhealth+100)*(1+.1*sipbonus) average.
Minerva2006-09-04 23:03:54
make sure you DRINK not SIP its very anoying because you cant sip underground for some weird reason.
Shorlen2006-09-04 23:14:50
Score catcher:
CODE
In #CLASS {Curingsystem|prompt}:

#ALIAS score {
  #t+ scorecatch
  ~score
  }


#CLASS {Curingsystem|prompt|scorecatch}
#TRIGGER {^%sHealth%s:%s%d/(%d)} {
  #if (%1!=@maxhealth) {
    maxhealth=%1
    calcsips
    }
  }
#TRIGGER {^%sMana%s:%s%d/(%d)} {
  #if (%1!=@maxmana) {
    maxmana=%1
    calcsips
    }
  }
#TRIGGER {^%sEgo%s:%s%d/(%d)} {
  #if (%1!=@maxego) {
    maxego=%1
    calcsips
    }
  }
#TRIGGER {Endurance%s:%s%d/(%d)$} {maxendurance=%1}
#TRIGGER {Willpower%s:%s%d/(%d)$} {maxwillpower=%1}
#TRIGGER "scoreprompttrig" {You are %d years old} {#t- scorecatch}
#CLASS 0


My prompt catcher:
CODE

#REGEX {^(\\d+)h, (\\d+)m, (\\d+)e, (\\d+)p, (\\d+)en, (\\d+)w (+)} {
  #var change no
  #if (@health!=%1) {
    change=yes
    healthchange=%eval( %1-@health)
    } {healthchange=0}
  #if (@mana!=%2) {
    change=yes
    manachange=%eval( %2-@mana)
    } {manachange=0}
  #if (@ego!=%3) {
    change=yes
    egochange=%eval( %3-@ego)
    } {egochange=0}
  #if (@change="yes") {#echoprompt %ansi( 11)~}
  #va health %1
  #va mana %2
  #va ego %3
  #va endurance %5
  #va willpower %6
  #va promptcheck %7
  #if (@maybereckless) {
    #if (@health=@maxhealth and @mana=@maxmana and @ego=@maxego) {reckless} {#if (@maybehypo) {hypochondria}}
    maybereckless=0
    }
  maybehypo=0
  #var able 1
  #if (%pos( e, @promptcheck)) {#var eq 1} {
    #var eq 0
    #va able 0
    }
  #if (%pos( x, @promptcheck)) {#var balance 1} {
    #var balance 0
    #va able 0
    }
  #if (%pos( d, @promptcheck)) {#if (@sixthsense="False") {#if (!%ismember( deaf, @herbafflicts)) {deaf}}} {#delitem herbafflicts deaf}
  #if (%pos( b, @promptcheck)) {
    maybeblind=0
    #if (@sixthsense="False") {#if (!%ismember( blind, @herbafflicts)) {blind}}
    } {
    #if (@maybeblind) {
      maybeblind=0
      hypochondria
      }
    #delitem herbafflicts blind
    }
  #if (%pos( p, @promptcheck)) {#var proned 1} {
    standup=0
    #suspend standupa
    #va proned 0
    }
  #if ((@able and @proned) and (@standup and !@aeon)) {
    standup=0
    stand
    #alarm standupa +1.5 {standup=1}
    }
  #if (@akafe) {#if (%pos( k, @promptcheck)) {#delitem herbafflicts nokafe} {#if (!%ismember( nokafe, @herbafflicts)) {nokafe}}}
  #if (@proned=0) {paralysis=0} {#va able 0}
  #if (@balance=1) {#if @eq=1 {#if (@proned=0) {#va able 1}}}
  sipcheck
  } "" {nocr|prompt}


My sip checker:
CODE

  #if (!@aeon) {
    #if (@asipbalance="True" and @autosipper="On" and @potionbalance="True") {#if (@mechanics.sippriority="health") {#if ((@health < @status.lowhealth) or (@burstvessels>7)) {#if (@mechanics.usebag) {#if (@health < @status.lowhealth) {bag} {he}} {he}} {#if (@mana < @status.lowmana) {mn} {#if (@ego < @status.lowego) {br} {#if (!%ismember( slick, @herbafflicts) and (@worstwound > @status.lowwound)) {rundh} {#if ((@health < @status.midhealth) or (@burstvessels>4)) {#if (@mechanics.usebag) {#if (@health < @status.midhealth) {bag} {he}} {he}} {#if (@mana < @status.midmana) {mn} {#if (@ego < @status.midego) {br} {#if (!%ismember( slick, @herbafflicts) and (@worstwound > @status.midwound)) {rundh} {#if ((@health < @status.highhealth) or (@burstvessels>0)) {he} {#if (@mana < @status.highmana) {mn} {#if (@ego < @status.highego) {br} {#if (!%ismember( slick, @herbafflicts) and (@worstwound > @status.highwound)) {rundh}}}}}}}}}}}}}}
    #if (@asparkbalance and @autosipper="On" and @sparkbalance="True") {#if (@mechanics.spark) {#if ((@health<@status.lowhealth | @mana<@status.lowmana | @ego < @status.lowego | %eval( @burstvessels>6))) {spark}} {#if (@mechanics.midspark) {#if (@health<@status.midhealth | @mana<@status.midmana | @ego < @status.midego | %eval( @burstvessels>6)) {spark}} {#if (@mechanics.highspark) {#if (@health<@status.highhealth | @mana<@status.highmana | @ego < @status.highego | %eval( @burstvessels>6)) {spark}} {#if (@burstvessels>6) {spark}}}}}
    }
  }

(I never really worked on other priorities other than health, and the sip checker is, obviously, designed for a stag user, hence the bags in there.)

When to sip calculator:
CODE

#alias calcsips {
  #var status.healthsip %round( %eval( ((0.15 * @maxhealth)+100.0) * (1.0 + @status.sipbonus * 0.1)))
  #var status.manasip %round( %eval( ((0.15 * @maxmana)+100.0) * (1.0 + @status.sipbonus * 0.1)))
  #var status.egosip %round( %eval( ((0.15 * @maxego)+100.0) * (1.0 + @status.sipbonus * 0.1)))
  #var status.highhealth %round( %eval( @maxhealth-@status.healthsip*0.9))
  #var status.midhealth %round( %eval( @maxhealth-@status.healthsip*1.5))
  #var status.lowhealth %round( %eval( @maxhealth-@status.healthsip*2.1))
  #var status.highmana %round( %eval( @maxmana-@status.manasip*0.9))
  #var status.midmana %round( %eval( @maxmana-@status.manasip*1.5))
  #var status.lowmana %round( %eval( @maxmana-@status.manasip*2.1))
  #var status.highego %round( %eval( @maxego-@status.egosip*0.9))
  #var status.midego %round( %eval( @maxego-@status.egosip*1.5))
  #var status.lowego %round( %eval( @maxego-@status.egosip*2.1))
}


My potion balances, and people better not specifically target me with illusions tailored to this just because I was kind enough to post this here sad.gif Should be protected against most common health sip illusions by the two line requirement on health, mana, and bromide sips.
CODE

#CLASS {Curingsystem|potions}
#ALIAS he {
  #if (!@aeon) {
    #if (@potionbalance="True") {
      drink health
      #if (@autosipper="On") {
        asipbalance="False"
        #alarm asipa +1 {asipbalance="True"}
        }
      } {
      #show YOU DO NOT HAVE ELIXIR BALANCE
      #color lightblue
      }
    }
  }
#ALIAS mn {
  #if (!@aeon) {
    #if (@potionbalance="True") {
      drink mana
      #if (@autosipper="On") {
        asipbalance="False"
        #alarm asipa +1 {asipbalance="True"}
        }
      } {
      #show YOU DO NOT HAVE ELIXIR BALANCE
      #color lightblue
      }
    }
  }
#ALIAS br {
  #if (!@aeon) {
    #if (@potionbalance="True") {
      drink bromide
      #if (@autosipper="On") {
        asipbalance="False"
        #alarm asipa +1 {asipbalance="True"}
        }
      } {
      #show YOU DO NOT HAVE ELIXIR BALANCE
      #color lightblue
      }
    }
  }
#ALIAS spark {
  #if (!@aeon) {
    outr 1 sparkleberry
    eat sparkleberry
    asparkbalance=0
    #alarm +1 {asparkbalance=1}
    }
  }
#ALIAS all {#if (@allhealebalance) {drink allheale} {#echo YOU DO NOT HAVE ALLHEALE BALANCE!}}
#ALIAS bag {
  #if (!@aeon) {
    #if (@potionbalance="True") {
      #if (@medicinebag and !@afflict.entangled and !@afflict.paralysed) {touch medicinebag} {drink health}
      #if (@autosipper="On") {
        asipbalance="False"
        #alarm asipa +1 {asipbalance="True"}
        }
      } {
      #echo %null
      #echo YOU DO NOT HAVE ELIX BALANCE
      }
    }
  }
#ALIAS nobag {
  medicinebag=0
  #echo %ansi( 47) - get a NEWBAG asap -
  }
#VAR medicinebag {1}
#TRIGGER {^The potion heals and soothes you.$} {
  #cw aqua,magenta
  potionbalance="False"
  #alarm "elixreset" +5.5 {potionbalance=True}
  } "" {disable}
#TRIGGER {^Your mind feels stronger and more alert.$} {
  #cw aqua,magenta
  potionbalance="False"
  #alarm "elixreset" +5.5 {potionbalance=True}
  } "" {disable}
#REGEX {(?:You take a drink from .*\\.|You down the last drop from .*\\.)\\nAh, the soothing bromides help strengthen your ego\\.} {
  #gag
  #echo %ansi( 91) - Bromide sip -
  potionbalance="False"
  #alarm "elixreset" +5.5 {potionbalance=True}
  }
#TRIGGER {^You may drink another health, mana, or bromide potion.$} {
  #cw aqua,dimgray
  potionbalance="True"
  asipbalance="True"
  #suspend elixreset
  }
#TRIGGER {^You feel your health, mana and ego replenished.$} {
  #cw $FFC080,magenta
  sparkbalance=false
  asparkbalance=0
  #if (@burstvessels>0) {#add burstvessels -1}
  }
#TRIGGER {^The aftertaste of the berry turns sour.$} {
  sparkbalance=false
  asparkbalance=0
  }
#TRIGGER {^You may eat another sparkleberry.$} {
  #cw $FFC080,dimgray
  sparkbalance=True
  asparkbalance=1
  }
#TRIGGER {^You may use another health, mana, or bromide potion, or medicine bag.$} {
  #cw aqua,dimgray
  potionbalance="True"
  asipbalance="True"
  #suspend elixreset
  }
#TRIGGER {^You touch your medicine bag and feel your wounds close and heal.$} {
  #cw aqua,magenta
  potionbalance="False"
  #alarm "elixreset" +5.5 {potionbalance=True}
  #if (@burstvessels>0) {
    #add burstvessels -1
    #echo %ansi( 111) - vessel cured, %ansi( 107)@burstvessels%ansi( 111) burst vessels left -
    }
  }
#REGEX {(?:You take a drink from .*\\.|You down the last drop from .*\\.)\\nThe potion heals and soothes you\\.} {
  #gag
  #echo %ansi( 91) - Health sip -
  potionbalance="False"
  #if (@burstvessels>0) {
    #add burstvessels -1
    #echo %ansi( 111) - vessel cured, %ansi( 107)@burstvessels%ansi( 111) burst vessels left -
    }
  #alarm "elixreset" +5.5 {potionbalance=True}
  }
#REGEX {(?:You take a drink from .*\\.|You down the last drop from .*\\.)\\nYour mind feels stronger and more alert\\.} {
  #gag
  #echo %ansi( 91) - Mana sip -
  potionbalance="False"
  #alarm "elixreset" +5.5 {potionbalance=True}
  }
#TRIGGER {^Your medicine bag crumbles into dust.$} {nobag}
#TRIGGER {^You hold your hands in the air and pray to the stag totem for succor. A medicine} {
  medicinebag=1
  #echo %ansi( 47) - Bagged! -
  }
#TRIGGER {^You hold your hands in the air and pray to the stag totem for succor. You} {
  medicinebag=1
  #echo %ansi( 47) - Already bagged -
  }
#TRIGGER {^The allheale burns your throat and makes your eyes water.$} {
  #gag
  #echo %ansi( 91) - Allheale -
  allhealebalance=0
  #alarm "allhealereset" +5.5 {allhealebalance=0}
  }
#TRIGGER {^You may take another dose of allheale.$} {
  #cw aqua,dimgray
  allhealebalance=1
  aallhealebalance=1
  #suspend allhealereset
  }
#CLASS 0
Unknown2006-09-04 23:26:45
Wow, how very helpful! Thank you all for replying.
jethskarn2006-09-09 04:52:48
Right, is the prompt checker all one variable?
Shorlen2006-09-09 09:22:57
QUOTE(jethskarn @ Sep 9 2006, 12:52 AM) 329444
Right, is the prompt checker all one variable?

The prompt trigger itself is all one long trigger, if that's what you're asking?
Nepthysia2006-09-09 14:54:25
HOLY... heh just reading this makes my freggin head hurt... -cries-

Reminds me I need to work on all this junk sleep.gif