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 Goto page Previous  1, 2, 3, 4  Next
chamenas Posted: Fri May 16, 2008 9:30 am
Getting Back to the Damage Calculator
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun May 18, 2008 11:11 pm   
 
oldguy2 wrote:
Uh of course it adds up the damage. How else would you get the output you just said along with averages.

Quote:
b) Subtotals at the end of each round... something like:


A purple tube worm's suction misses you. (0) dmg
A purple tube worm's suction misses you. (0) dmg
A purple tube worm's suction misses you. (0) dmg
Your shock === OBLITERATES === a purple tube worm! (88) dmg
Your shock *** DEMOLISHES *** a purple tube worm! (58.5) dmg
Your shock === OBLITERATES === a purple tube worm! (88) dmg
Your shock MASSACRES a purple tube worm! (50.5) dmg
Your shock === OBLITERATES === a purple tube worm! (88) dmg
Your shock MANGLES a purple tube worm! (54.5) dmg
A purple tube worm is in awful condition.
You: 425 damage to A purple tube worm [ 6% left ]
A purple tube worm: 0 damage to you [ 100% left ]



Right, that was my simple example. But what if I had a friend fighting with me, or I was fighting more than one mob? the averages and number of hits isn't that hard to add in. I'm just trying to figure out how the client will discern the difference in damages.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun May 18, 2008 11:15 pm   
 
Look see this part? You: 425 damage to A purple tube worm [ 6% left ]? You have roundDamage and totalDamage. You said originally that you have a skill that you can see the total health of a creature. Well there you go. You can get all of what you want in that line with 3 variables and some math.

Now if you plan on tracking specifically the target of everyone around you and this stuff...well whatever I think that's kind of crazy. Why the heck you need damage done to you line I don't know. That's what your prompt shows does it not?
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun May 18, 2008 11:20 pm   
 
It does, I sort of don't need it. But the skill I have to see it is on another character so I have to store the values in a database. But what I mean is that there's no way for the current set up to see what damage goes where. It just knows there's damage, that's it.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun May 18, 2008 11:34 pm   
 
Oh my god dude it's not hard. You set your TARGET into a variable right? Then you attack @TARGET right? So you can get health left by using the database of creature healths.

%db(@mobHealth, @target)

There you go that's how you find the creature health of the current target. Of course you can use whatever names you want.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon May 19, 2008 8:04 pm   
 
heart wounds battle.

Also triggers it. I narrowed it down, it's wounds that triggers it because wounds is a damage type. It needs the other words seemingly to fill other roles but it's firing without an attack_type value (heart isn't an attack type), I have no clue what's going on.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Mon May 19, 2008 11:21 pm   
 
Also triggers what, sorry?

Additionally, what IF you had a friend with you or were fighting multiple mobs? Having not seen an example of what that looks like, how can we answer that? Not that the answer will be difficult, unless you start AoEing multiple mobs of the same name.
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon May 19, 2008 11:49 pm   
 
I can AoE mobs of the same name, it's something to bring up but I suppose I should start simple. And sorry...


heart wounds battle. (18.5)

It takes it as a damage amount, but it's not at all :/
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Tue May 20, 2008 12:03 am   
 
chamenas wrote:
I can AoE mobs of the same name, it's something to bring up but I suppose I should start simple. And sorry...


heart wounds battle. (18.5)

It takes it as a damage amount, but it's not at all :/

The problem is clearly your trigger pattern then. If it doesn't match it, it won't fire and there is no problem.

Which trigger is matching that line, because I don't see a pattern in your script that would do so?
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue May 20, 2008 12:05 am   
 
I know, I've stated that it's the pattern. It matches, but it shouldn't. And:

^(?>[[^]]*] )?(?>[\w'-]+ ){1,5}(?>(@attack_type) (?>does )?)?(@damage_type) (?>things to )?(?>a |the )?(?>[\w'-]+[ !.]){1,5}

is the pattern.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Tue May 20, 2008 12:11 am   
 
Yeah, that was my mistake. I changed the attack_type to be optional in another topic.
Code:
^(?>[[^]]*] )?(?>[\w'-]+ ){1,5}(@attack_type) (?>does )?(@damage_type) (?>things to )?(?>a |the )?(?>[\w'-]+[ !.]){1,5}
Fixed.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue May 20, 2008 12:51 am   
 
Huh? How... there's no... oh wait there is. I didn't even see that. *sighs*

Edit:

I even looked for it too, but didn't see the encapsulating parentheses.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue May 27, 2008 6:48 pm   
 
Code:

#regex Damage_Convert {^(?>[[^]]*] )?(>[\w'-]+ ){1,5}(@attack_type) (?>does )?(@damage_type) (?>things to )?(?>a |the )?(?>[\w'-]+[ !.]){1,5}}
{
  battle=1
  $DmgVal=%3
  $Dmg=" "
  #switch ($DmgVal)
    ("misses") {$Dmg=0}
    ("scratches") {$Dmg=2.5}
    ("grazes") {$Dmg=6.5}
    ("hits") {$Dmg=10.5}
    ("injures") {$Dmg=14.5}
    ("wounds") {$Dmg=18.5}
    ("mauls") {$Dmg=22.5}
    ("decimates") {$Dmg=26.5}
    ("devastates") {$Dmg=30.5}
    ("maims") {$Dmg=34.5}
    ("MUTILATES") {$Dmg=38.5}
    ("DISEMBOWELS") {$Dmg=42.5}
    ("DISMEMBERS") {$Dmg=46.5}
    ("MASSACRES") {$Dmg=50.5}
    ("MANGLES") {$Dmg=54.5}
    ("*** DEMOLISHES ***") {$Dmg=58.5}
    ("*** DEVASTATES ***") {$Dmg=68}
    ("=== OBLITERATES ===") {$Dmg=88}
    (">>> ANNIHILATES <<<") {$Dmg= 112}
    ("<<< ERADICATES >>>") {$Dmg=136}
    ("GHASTLY") {$Dmg=163}
    ("HORRID") {$Dmg=188}
    ("DREADFUL") {$Dmg=228}
    ("HIDEOUS") {$Dmg=238}
    ("INDESCRIBABLE") {$Dmg=263}
    ("UNSPEAKABLE") {$Dmg=280}

  #switch ($Dmg=0) {#sayadd { <color #CCCCCC>~(</color><color #2D2D00>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg > 0) AND ($Dmg <=34.5)) {#sayadd { <color #CCCCCC>~(</color><color @Pcolor1>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg > 34.5) AND ($Dmg <= 54.5)) {#sayadd { <color #CCCCCC>~(</color><color @Pcolor2>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg > 54.5) AND ($Dmg <= 136)) {#sayadd { <color #CCCCCC>~(</color><color @Pcolor3>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg >= 163) AND ($Dmg <= 280)) {#sayadd { %ansi(blink)<color #CCCCCC>~(</color><color @Pcolor3>$Dmg</color><color #CCCCCC>~) dmg </color>%ansi(none)}}

  #IF (%2!=You) {
    round_dmg=@round_dmg+$Dmg
  } { round_dmgu=@round_dmg+$Dmg }

} {General Triggers|Damage Calculator}

#REGEX dmg_report_round {^(>[\w'-]+ ){1,5}(has|is in|looks) (@condition)\.$} {
  total_dmg=@total_dmg+@round_dmg
  #say You did @round_dmg to all creatures this round.
  #say You took @round_dmgu from all creatures this round.
  round_dmg=0
 }


Trying to move onto the next step, but the above code breaks the damage trigger, no display output whatsoever, not even on what has worked before. I suspect that the new back reference is screwing it up, but I'm also not sure why. Can anyone see anything to help me here?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Tue May 27, 2008 8:34 pm   
 
Look Chamenas, if you are going to post questions, you at least need to test them beforehand.

What is this?

Code:
?(>[\w'-]+ )


You expect that to work? It takes what five seconds to test your patterns in Regex Buddy?

Also this...

Code:
(($Dmg > 54.5) AND ($Dmg <= 136)) {#sayadd { <color #CCCCCC>~(</color><color @Pcolor3>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg >= 163) AND ($Dmg <= 280)) {#sayadd { %ansi(blink)<color #CCCCCC>~(</color><color @Pcolor3>$Dmg</color><color #CCCCCC>~) dmg </color>%ansi(none)}}


Did you change this? You have from 54.5 to 136 and then 163 to 280. What happened to all damage between 136 and 163?

Then you have...

Code:
#IF (%2!=You) {
    round_dmg=@round_dmg+$Dmg
  } { round_dmgu=@round_dmg+$Dmg }


That isn't going to work. The round_dmgu part is not how you do an accumulator and will not accumulate the total. It will just keep overwriting round_dmg+$Dmg. Plus the reason %2 isn't even working is because your pattern is screwed up again and %2 is attack type. By the way, you should put "You" in quotes as a string or get into the habit.

Something else may be wrong, but I don't have the time to go through it all thoroughly.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue May 27, 2008 8:43 pm   
 
oldguy2 wrote:
Look Chamenas, if you are going to post questions, you at least need to test them beforehand.

What is this?

Code:
?(>[\w'-]+ )


You expect that to work? It takes what five seconds to test your patterns in Regex Buddy?

I think the Regex Coach is the free one that you suggested. Admittedly I didn't do that, but all I took out was the "?", from my understanding, a ? in the front of something means "don't back reference", but if it screws with the pattern I suppose it doesn't mean that.

Quote:

Code:
(($Dmg > 54.5) AND ($Dmg <= 136)) {#sayadd { <color #CCCCCC>~(</color><color @Pcolor3>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg >= 163) AND ($Dmg <= 280)) {#sayadd { %ansi(blink)<color #CCCCCC>~(</color><color @Pcolor3>$Dmg</color><color #CCCCCC>~) dmg </color>%ansi(none)}}


Did you change this? You have from 54.5 to 136 and then 163 to 280. What happened to all damage between 136 and 163?


I can look at it, but it shouldn't interfere with this, that section hasn't changed and worked fine before.

Quote:

Then you have...

Code:
#IF (%2!=You) {
    round_dmg=@round_dmg+$Dmg
  } { round_dmgu=@round_dmg+$Dmg }


That isn't going to work. The round_dmgu part is not how you do an accumulator and will not accumulate the total. It will just keep overwriting round_dmg+$Dmg. Plus the reason %2 isn't even working is because your pattern is screwed up again. By the way, you should put "You" in quotes as a string or get into the habit.

Something else may be wrong, but I don't have the time to go through it all thoroughly.


Well, I missed the U in the second statement, should have caught that. Other than that, I'm not entirely sure what you mean. If the line does not contain You in the beginning then it will be damage that the creature has done. By inverse, if it does contain You, then it's damage I'm doing. So... it should actually be:

Code:

#IF (%2=You) {
    round_dmg=@round_dmg+$Dmg
  } { round_dmgu=@round_dmg2+$Dmg }


Now if that doesn't work, then I'm really confused. But obviously the pattern matching needs to be fixed first, and I'm not sure about the first couple parts of the regex, so I'm a bit lost. I'll go see what I can find on the reference site.

Quote:

Quote:

(?>regex)

Atomic groups prevent the regex engine from backtracking back into the group (forcing the group to discard part of its match) after a match has been found for the group. Backtracking can occur inside the group before it has matched completely, and the engine can backtrack past the entire group, discarding its match entirely. Eliminating needless backtracking provides a speed increase. Atomic grouping is often indispensable when nesting quantifiers to prevent a catastrophic amount of backtracking as the engine needlessly tries pointless permutations of the nested quantifiers.


Alright, so my basic understanding is that this makes that part of the statement faster. Does that mean it's back-referenced as %1?
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Tue May 27, 2008 8:54 pm   
 
oldguy2 wrote:


Also this...

Code:
(($Dmg > 54.5) AND ($Dmg <= 136)) {#sayadd { <color #CCCCCC>~(</color><color @Pcolor3>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg >= 163) AND ($Dmg <= 280)) {#sayadd { %ansi(blink)<color #CCCCCC>~(</color><color @Pcolor3>$Dmg</color><color #CCCCCC>~) dmg </color>%ansi(none)}}


Did you change this? You have from 54.5 to 136 and then 163 to 280. What happened to all damage between 136 and 163?



From his previous posts, $Dmg can never be assigned a value greater than 136 or less than 163... Its just not possible, so it would only seem obvious that he would omit these amounts.

chamenas wrote:

Code:

    ("=== OBLITERATES ===") {$Dmg=88}
    (">>> ANNIHILATES <<<") {$Dmg= 112}
    ("<<< ERADICATES >>>") {$Dmg=136}
    ("GHASTLY") {$Dmg=163}
    ("HORRID") {$Dmg=188}

Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue May 27, 2008 9:43 pm   
 
Well there you go.

The reason for that is simple, the damages I have are actually averages, they vary even among the individual damage types. So "=== OBLITERATES ===" is actually 76-100, and scratch is 1-4. Up until *** DEMOLISH *** it's all separated by 3, then it jumps. The final numbers have a variance of 24, so the averages have a lot of space between them.

Quote:

--- 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
INDESSCRIBABLE: 251-275
UNSPEAKABLE: 276+
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Tue May 27, 2008 10:04 pm   
 
chamenas wrote:
Well there you go.

The reason for that is simple, the damages I have are actually averages, they vary even among the individual damage types. So "=== OBLITERATES ===" is actually 76-100, and scratch is 1-4. Up until *** DEMOLISH *** it's all separated by 3, then it jumps. The final numbers have a variance of 24, so the averages have a lot of space between them.



What I don't understand is A.) Why your not just using the actual string to determine whether it should be red/yellow/striped etc. instead of assigning it a dam number first (thats inaccurate) and B.) Why you don't use the actual damage that is displayed at the end of these strings (or could be if you have the feature turned on, in-game) to get your total damage for partymembers and/or yourself.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue May 27, 2008 11:01 pm   
 
I'm assigning a damage number because it's easier to think about than converting damage strings. I then use the numbers to determine color since I can use a range of numbers 1-10, 20-30, etc... as opposed to listing out each string and what color it would be. Quicker, more efficient and easier to look at. The number that's displayed at the end of the strings is just added there by my script and is not a game number. That's essentially what I'm using to figure out the damage total if you look at the script. I'm adding up round damage line by line based on the damage conversion number (same number used in the string) and then resetting it once I hit a line that I know signifies the end of a round.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Tue May 27, 2008 11:07 pm   
 
First off, what MUD is this from? I assumed, but now I think I assumed wrong. And why wouldn't you just use a dbvar to assign color to each string... Seems much more effective to me personally, but then again, I don't really understand all the REGEX that your programming in anyways so it may not fit in with your code well that way. Im just simply suggesting cutting out the middle man, Your going from String to damnumber to color, Just go from string to color using a dbvar..
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue May 27, 2008 11:24 pm   
 
Dark and Shattered Lands, based on Diku MUD I think, similar to a lot of them. There's no middle man, it goes from:

String -> Number

and I want to base anything that needs numbers off of the number.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed May 28, 2008 3:08 am   
 
Atomic groups don't create backreferences. They just stop the engine from going back inside the group once the group has matched. You need to put brackets () around whatever you want to be referenced.

Your accumulator is still wrong, too. You have round_dmgu=@round_dmg2+$dmg when both variables should be round_dmgu for the accumulation to work.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed May 28, 2008 10:54 am   
 
Code:

#IF (%2=You) {
    round_dmg=@round_dmg+$Dmg
  } { round_dmgu=@round_dmgu+$Dmg }


right, well let me see what I can do.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed May 28, 2008 12:17 pm   
 
So, this is odd:

_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Wed May 28, 2008 1:36 pm   
 
Code:

#IF (%2=Your) {
    round_dmg=@round_dmg+$Dmg
  } { round_dmgu=@round_dmgu+$Dmg }


Use this instead... it should be Your, not You, according to your output... right now its using round_dmgu because of this.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed May 28, 2008 2:15 pm   
 
Ah yes, silly me.

Oddly enough, it's still adding the other creature's damage to it:

Code:

#IF (%1=Your) {
    round_dmg=@round_dmg+$Dmg;#say round: @round_dmg
  } { round_dmgu=@round_dmgu+$Dmg;#say round: @round_dmgu }


Quote:


Your claw === OBLITERATES === a gnome stone excavator! (88) dmg
round: 3458.5
Your claw === OBLITERATES === a gnome stone excavator! (88) dmg
round: 3546.5
Your claw === OBLITERATES === a gnome stone excavator! (88) dmg
round: 3634.5
A gnome stone excavator's slash hits you. (10.5) dmg
round: 3645



And, of course, isn't resetting round damage, nor reporting round total at the end.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
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