Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Sat Sep 25, 2010 11:17 pm   

buggy healing script
 
I been making this autohealing trigger for myself and my tank firing of my prompt
and it seems to be very unreliable in getting enabled again and often it is disabled witout even having healed
Had to put in the trigger disabling or else i would often spam 10 heals where only 1 was needed in combat
The actual prompt this fires of looks like this the space in front included
the L:is leaders current hp and the H: is my current hp
L:878 H:730 M:1007 V:367>
all of these triggers are pattern triggers

pattern1
^ L:(%1) H:(%2)
#if (@tankfull > %1) {cast 'full heal' @tank}
#if (@tankheal > %1) {cast 'heal' @tank}
#if (@selffull > %2) {cast 'full heal' @self}
#if (@selfheal > %2) {cast 'heal' @self}
#t- healing

pattern2
^You heal
#t+ healing

pattern3
^You fully heal
#t+ healing

if anyone can tell me what i done wrong or have a smarter solution alltogheter it would be much appriciated
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Sep 25, 2010 11:28 pm   
 
I wouldn't make it fire off of your prompt, personally. What are some indicators that your tank has taken damage? aka if I can get some examples of some battlespam I can probably make a decent script for you.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Sun Sep 26, 2010 12:11 am   
 
Here is a little sample of 1 small fight


A Statue has arrived from the west.
A Statue sees Scary, and attacks!
Scary dodges A Statue's blow.
A Statue bruises Scary with his hit.

L:1125 H:730 M:868 V:367>
Scary wipes his boots in the face of A Statue!

L:1125 H:730 M:868 V:367> You crush A Statue very hard.

L:1125 H:730 M:868 V:367>
A Statue hits Scary hard.
A Statue hits Scary hard.
A Statue hits Scary very hard.
Scary parries A Statue's attack.
A Statue bruises Scary with his hit.
Scary dodges A Statue's blow.
A Statue bruises Scary with his hit.
A Statue hits Scary very hard.
Scary massacres A Statue with his stab.
Scary maims A Statue with a critical hit.
Scary massacres A Statue with his stab.
Scary maims A Statue with a critical hit.
Scary massacres A Statue with his stab.
Scary devastates A Statue with his triple damage attack.
Scary demolishes A Statue with a horrific stab!
You bruise A Statue as you crush him.

L:1030 H:730 M:873 V:367>
A Statue hits Scary hard.
A Statue hits Scary hard.
Scary parries A Statue's attack.
A Statue maims Scary with a critical hit.
A Statue bruises Scary with his hit.
Scary parries A Statue's attack.
A Statue bruises Scary with his hit.
A Statue hits Scary very hard.
Scary parries A Statue's attack.
A Statue bruises Scary with his hit.
Scary massacres A Statue with his stab.
Scary massacres A Statue with his stab.
Scary stabs A Statue extremely well.
Scary maims A Statue with his double damage attack.
Scary pulverizes A Statue with an amazing stab.
You crush A Statue very hard.
The white glow around A Statue's body fades.
You injure A Statue with a critical hit.
You pulverize A Statue with your amazing crush.

L:959 H:730 M:878 V:367>
Scary misses a kick at A Statue's groin.

L:959 H:730 M:878 V:367>
A Statue hits Scary very hard.
Scary parries A Statue's attack.
A Statue bruises Scary with his hit.
A Statue maims Scary with a critical hit.
A Statue hits Scary very hard.
A Statue hits Scary hard.
A Statue hits Scary hard.
Scary dodges A Statue's blow.
A Statue bruises Scary with his hit.
Scary pulverizes A Statue with an amazing stab.
Scary pulverizes A Statue with an amazing stab.
Scary pulverizes A Statue with an amazing stab.
You massacre A Statue with your crush.
You maim A Statue with your double damage attack.
You demolish A Statue with your horrific crush!

L:858 H:730 M:883 V:367>
A Statue hits Scary hard.
A Statue maims Scary with his double damage attack.
A Statue massacres Scary with his hit.
Scary dodges A Statue's blow.
A Statue bruises Scary with his hit.
A Statue hits Scary hard.
A Statue hits Scary very hard.
A Statue hits Scary hard.
Scary maims A Statue with a critical hit.
Scary demolishes A Statue with a horrific stab!
Scary maims A Statue with a critical hit.
Scary demolishes A Statue with a horrific stab!
Scary pulverizes A Statue with an amazing stab.
Scary pulverizes A Statue with an amazing stab.
You massacre A Statue with your crush.
You massacre A Statue with your crush.

L:724 H:730 M:888 V:367>
Scary makes a nice balletstep which plants a foot a mile above A Statue's head.

L:724 H:730 M:888 V:367>
A Statue hits Scary very hard.
A Statue hits Scary extremely well.
Scary parries A Statue's attack.
A Statue bruises Scary with his hit.
A Statue maims Scary with a critical hit.
A Statue hits Scary extremely well.
A Statue bruises Scary with his hit.
Scary dodges A Statue's blow.
A Statue bruises Scary with his hit.
Scary pulverizes A Statue with an amazing stab.
Scary pulverizes A Statue with an amazing stab.
You massacre A Statue with your crush.
You miss A Statue.

L:628 H:730 M:893 V:367>
Scary parries A Statue's attack.
A Statue bruises Scary with his hit.
A Statue hits Scary very hard.
A Statue hits Scary hard.
A Statue maims Scary with his double damage attack.
A Statue massacres Scary with his hit.
Scary dodges A Statue's blow.
A Statue bruises Scary with his hit.
A Statue hits Scary hard.
Scary pulverizes A Statue with an amazing stab.
Scary pulverizes A Statue with an amazing stab.
Scary maims A Statue with a critical hit.
Scary demolishes A Statue with a horrific stab!
You massacre A Statue with your crush.
You massacre A Statue with your crush.

L:507 H:730 M:898 V:367>
Scary misses a kick at A Statue's groin.

L:507 H:730 M:898 V:367>
A Statue hits Scary hard.
Scary parries A Statue's attack.
A Statue maims Scary with a critical hit.
A Statue bruises Scary with his hit.
A Statue hits Scary hard.
Scary dodges A Statue's blow.
A Statue bruises Scary with his hit.
Scary parries A Statue's attack.
A Statue bruises Scary with his hit.
A Statue hits Scary hard.
Scary pulverizes A Statue with an amazing stab.
Scary pulverizes A Statue with an amazing stab.
Scary pulverizes A Statue with an amazing stab.
Scary pulverizes A Statue with an amazing stab.
You massacre A Statue with your crush.
You miss A Statue.

L:442 H:730 M:903 V:367>
A Statue hits Scary hard.
Scary dodges A Statue's blow.
A Statue bruises Scary with his hit.
Scary parries A Statue's attack.
A Statue bruises Scary with his hit.
A Statue hits Scary very hard.
A Statue hits Scary hard.
A Statue hits Scary very hard.
Scary pulverizes A Statue with an amazing stab.
Scary maims A Statue with a critical hit.
Scary demolishes A Statue with a horrific stab!
A Statue is dead! R.I.P.
You gain 238620 experience.
Your blood freezes as you hear A Statue's death cry.
Scary splits 38380 coins, of which you receive 19190 of them.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Sep 26, 2010 2:23 am   
 
Can I have a list of all the possible damage amounts? Just in case some weren't covered in there?

By damage amounts I mean the stuff like "maims" and "demolishes"
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Sun Sep 26, 2010 3:04 am   
 
err nope i dont have all that atm and also some spells/roomeffects and such looks the same even if tank have immune/resist to that dmg type
so i dont think your idea will work very good in this case

the other clerics all go off the prompt with a variable set for when they gonna heal etc but they all use some tintin variants so i cant really use their scripts
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Sep 26, 2010 3:20 am   
 
Trust me, it will likely work, but I'm going to need to possible damage variants in order to do so. I'll make the basic outline of the script, but without your cooperation I won't be able to finish it. I promise you though, it can be done the way I'm attempting to do it, and I'm sure it will be much more efficient and far less buggy. Gotta trust me though.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Sep 26, 2010 4:32 am   
 
To explain: the basic concept is this

1. Recognize when the Tank takes damage.
- We don't care about when they dodge or they get a resist echo. We just need to isolate any echo where a tank takes damage
2. Recognize the end of a round of battle where the Tank took damage.
- Easy enough, taking damage will turn on a trigger. This trigger will turn off at the first blank-line, since the blank line signals the end of a round. Before this trigger shuts off it will toss out a heal.
3. Repeat

This means you will never toss out a heal more than once around and you will only toss out heals whenever the Tank takes damage.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Sun Sep 26, 2010 11:39 am   
 
will take me some weeks to collect all that data and probably will be missing parts of it but how can it takes into accounts immunities and resist on certains effects that says you are splashed with acid and it can mean evrything from 0 dmg to 2000?
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Sep 26, 2010 12:57 pm   
 
You don't need to take into account immunities, just damage nouns. For instance, on my mud it's:

Code:

    miss:                 0   
       
--- green ---
    scratch:             1-4         
    graze:               5-8       
    hit:                 9-12           
    injure:             13-16       
    wound:              17-20
    maul:               21-24
    decimate:           25-28
    devastate:          29-32
    maim:               33-36

--- YELLOW ---

    MUTILATE:           37-40
    DISEMBOWEL:         41-44
    DISMEMBER:          45-48
    MASSACRE:           49-52
    MANGLE:             53-56

--- >>>BRIGHT RED<<< ---

    *** DEMOLISH ***:   57-60
    *** DEVASTATE ***:  61-75
    === OBLITERATE ===: 76-100
    >>> ANNIHILATE <<<: 101-125 
    <<< ERADICATE >>>: 126-150

--- STRIPED ---

    GHASTLY:            151-175
    HORRID:             176-200
    DREADFUL:           201-255 
    HIDEOUS:            226-250 
    INDESCRIBABLE:     251-275
    UNSPEAKABLE:        276+


So far for yours we have:
bruises
hits
massacres
maims
devastates
demolishes
pulverizes
crushes

What we'll be matching is this:
(possible mob name) (dam noun) (tank)

So, we'll have some variable pattern matching for the first part, and a variable for the dam noun and a variable for the tank. This will limit it to rounds of combat where the tank takes damage.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Sun Sep 26, 2010 2:59 pm   
 
some roomeffects and spelleffects look the same even if the damage done can vary with several thousand points of damage so in one way or another i really need it to be based on the
value from prompt
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Sep 26, 2010 3:06 pm   
 
I think you're misunderstanding, but if you can't get me that info then I can't help. There's a lot of problems using a prompt for triggers because of how frequently it appears, as such it does things when you don't want it to. Sometimes to come up with a reasonable solution you need to put in a bit if effort and work, it's just the way of things: my Clan Highlighter has over 1600 hundred lines of script.

Nevertheless, if you share the XML of your script I'll take a look at it and see what I can do.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Sun Sep 26, 2010 8:03 pm   
 
i know what you trying to say but on here we got some special rooms and spells and other effects where you dont get anything saying how much dmg you or other takes
other then reading prompt or using group command thats why i never botherd to get the actual descriptions of all of them
also the heal and full heal spells dont always heal the same amount either

<trigger name="healing" priority="810" id="81">
<pattern>^ L:(%1) H:(%2)</pattern>
<value>#if (@tankfull &gt; %1) {cast 'full heal' @tank}
#if (@tankheal &gt; %1) {cast 'heal' @tank}
#if (@selffull &gt; %2) {cast 'full heal' @self}
#if (@selfheal &gt; %2) {cast 'heal' @self}
#t- healing</value>
</trigger>

<trigger priority="870" id="87">
<pattern>^You fully heal</pattern>
<value>#t+ healing</value>
</trigger>

<trigger priority="860" id="86">
<pattern>^You heal</pattern>
<value>#t+ healing</value>
</trigger>
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Sep 26, 2010 8:52 pm   
 
Do you want it casting heals 4 times if all the conditions are true? Otherwise you may want a switch statement if you only intend for one heal to go off at a time, that's likely what's causing most of your issues, something like:

Code:

<class name="Auto Heal" id="54">
  <trigger name="healing" priority="810" id="55">
    <pattern>^ L:(%1) H:(%2)</pattern>
    <value>#SWITCH (%db( @heal, full_tank) > %1) {
  #send %concat( "cast 'full heal' ", @tank)
  #T+ full-heal
  }
  (%db( @heal, tank) > %1) {
  #send %concat( "cast 'heal' ", @tank)
  #T+ norm-heal
  }
  (%db( @heal, full_self) > %2) {
  #send %concat( "cast 'full heal' ", @self)
  #T+ full-heal
  }
  (%db( @heal, self) > %2) {
  #send %concat( "cast 'heal' ", @self)
  #T- norm-heal
  }
#t- healing</value>
  </trigger>
  <trigger name="full-heal" priority="870" enabled="false" id="56">
    <pattern>^You fully heal</pattern>
    <value>#t+ healing
#T- full-heal</value>
  </trigger>
  <trigger name="norm-heal" priority="860" enabled="false" id="57">
    <pattern>^You heal</pattern>
    <value>#t+ healing
#T- norm-heal</value>
  </trigger>
  <var name="heal" type="Record" id="58">
    <value>tank=10|full_tank=10|self=10|full_self=10</value>
  </var>
  <var name="tank" id="59">Scary</var>
  <var name="self" id="60">me</var>
</class>


If you want to have multiple heals possibly cast a time then we'll have to work out something a little different, but it's still manageable.

This is how we'd go if you wanted to allow multiple possible heals:
Code:

<class name="Auto Heal" id="54">
  <trigger name="healing" priority="810" id="55">
    <pattern>^ L:(%1) H:(%2)</pattern>
    <value>$num=0
#IF (%db( @heal, full_tank) > %1) {
  #send %concat( "cast 'full heal' ", @tank)
  #ADD $num 1
  #T+ full-heal
  }
#IF (%db( @heal, tank) > %1) {
  #send %concat( "cast 'heal' ", @tank)
  #ADD $num 1
  #T+ norm-heal
  }
#IF (%db( @heal, full_self) > %2) {
  #send %concat( "cast 'full heal' ", @self)
  #ADD $num 1
  #T+ full-heal
  }
#IF (%db( @heal, self) > %2) {
  #send %concat( "cast 'heal' ", @self)
  #ADD $num 1
  #T- norm-heal
  }

#ADDKEY heal num $num
#t- healing</value>
  </trigger>
  <trigger name="full-heal" priority="870" enabled="false" id="56">
    <pattern>^You fully heal</pattern>
    <value>#ADDKEY heal num (%db( @heal, num) - 1)
#IF (%db( @heal, num)) {
  #t+ healing
  #T- full-heal
  #T- norm-heal
  }
</value>
  </trigger>
  <trigger name="norm-heal" priority="860" enabled="false" id="57">
    <pattern>^You heal</pattern>
    <value>#ADDKEY heal num (%db( @heal, num) - 1)
#IF (%db( @heal, num)) {
  #t+ healing
  #T- norm-heal
  #T- full-heal
  }
</value>
  </trigger>
  <var name="heal" type="Record" id="58">
    <value>tank=10|full_tank=10|self=10|full_self=10|num</value>
  </var>
  <var name="tank" id="59">Scary</var>
  <var name="self" id="60">me</var>
</class>
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Sun Sep 26, 2010 9:25 pm   
 
heal does 100-300 healing while full heal does 1k-3k but is very mana expensive
so my idea was to use full heal if it gets really low and heals otherwise
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Sep 26, 2010 10:32 pm   
 
Well see if one of those works as you'd like. Let me know either way.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Sun Sep 26, 2010 11:19 pm   
 
nvm found it out
Reply with quote
madhalaster
Beginner


Joined: 22 Sep 2010
Posts: 12

PostPosted: Mon Sep 27, 2010 11:27 am   
 
The first one didnt work that ended up disbaling its own triggers for me
The 2nd seems to work a bit better but got a few issues will come back to them later after i tested it more throughly
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Mon Sep 27, 2010 12:28 pm   
 
ok something both of you forgot a little, is that in a pattern (%1)/(%2) is not correct, you want to use (%n) or (%d) ...

personally i would use this, alot more simple and efficent

Code:
<module name="autoheal" global="true" id="36">
  <uid>{ED8F3D0D-EE71-4F68-9ACA-D2ACABF3475A}</uid>
  <class name="autohealer" id="37">
    <trigger priority="380" id="38">
      <pattern>^L:(%n) H:(%n) M:(%n) V:(%n)></pattern>
      <value><![CDATA[#if (%db( @autoheal_DB, tankfull) > %1 && %db( @autoheal_DB, healfired)=0) {
  #addkey autoheal_DB healfired 1
  cast 'full heal' %db( @autoheal_DB, tank)
  } {#if (%db( @autoheal_DB, tankheal) > %1) {cast 'heal' %db( @autoheal_DB, tank)}}
#if (%db( @autoheal_DB, selffull) > %2 && %db( @autoheal_DB, healfired)=0) {
  #addkey autoheal_DB healfired 1
  cast 'full heal' %db( @autoheal_DB, tank)
  } {#if (%db( @autoheal_DB, selfheal) > %2) {cast 'heal' %db( @autoheal_DB, tank)}}]]></value>
    </trigger>
    <trigger priority="460" id="46">
      <pattern>{put pattern here for when heal hits|pattern here for when heal missses}</pattern>
      <value>#addkey autoheal_DB healfired 0</value>
    </trigger>
  </class>
  <class name="autohealvar" id="39">
    <var name="autoheal_DB" type="Record" id="45">
      <value>selffull=100|selfheal=10|tankfull=100|tankheal=10|tank=me</value>
      <json>{"tankheal":10,"tankfull":100,"selfheal":10,"selffull":100,"tank":"me"}</json>
    </var>
  </class>
</module>
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Sep 27, 2010 3:47 pm   
 
I don't use zscript patterns, I prefer regex :P, thus I don't usually fix or catch problems in zscript patterns. It doesn't make my script worse, a simple pattern fix is easy.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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