|
chamenas |
Posted: Thu Apr 17, 2008 11:47 am
replacing lines of text before they show... |
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Mon Apr 21, 2008 6:43 pm |
hrmm, could be a mispelling then. IT's just odd since I know I copied and pasted all the damage amount, I never typed 'em in
Oh, and. There's nothing I can do to make the comparison list cleaner? I can't access another referenece somewhere else to keep it neater? |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Mon Apr 21, 2008 7:05 pm |
So it all works now, except that the color still has bleed issues. I'll take a screen shot of it so you can see. Also, I don't think <color> supports variables, so should I use ansi color instead for that?
|
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Apr 21, 2008 7:19 pm |
Whatcha mean you don't think <color> supports variables?
I use them in my status bar all the time with variables. So if it isn't working ya need to show us exactly what isn't working.
Code: |
#var mxpc orange
#show {This is <color @mxpc>@mxpc</color>.} |
Code: |
#var $mxpc red
#show {This is <color $mxpc>$mxpc</color>.} |
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Apr 21, 2008 7:28 pm |
Which list are you talking about?
As I mentioned a few days ago you could use a string list variable in your regex instead of typing it directly.
Those switches while they are quite nice are not needed. Neither are #IF statements for that matter.
If you made a database variable containing each of the number values you would use the words for the keys and do something like.
#sayadd { <color %db(@dbDamageColor,%1)>%db(@dbDamageV,%1)</color>} |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Apr 21, 2008 7:46 pm |
Keep in mind that I have NOT been paying close attention to this thread so that will not work OUT OF THE BOX so to speak that is a general example requiring two database variables to be built.
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Mon Apr 21, 2008 10:23 pm |
The database way is great except how can you get the damage types like "=== OBLITERATES ===" to store as a key?
|
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Mon Apr 21, 2008 10:37 pm |
chamenas wrote: |
I'm spelling them how they're spelled in the game. I know how to spell, but the coder in the game doesn't. So I don't think that's it, but I could double check. The ^(?:A|The|a|the) is very important for later purposes. I want to capture the name, not what proceeds the name... so...
A sasquatch, I just want to capture sasquatch, but it's not always A, it could be:
The Arkane Guard
or
a small fish
or
the puppy dog
or
Chamenas (player name)
That's why it's optional.
should be (?: things to)?(?: a|the|A|The)? (.+), I'll fix it. Wont be able to test until later. |
Why not just make the pattern like this:
Code: |
^Your (@attackType) (?:does )?(@damageType) (?>\w+\s?)+?(\w+)[!\.]$ |
It will still capture the target name since the actual THING is always the last word.
Your spell does GHASTLY things to A puppy dog! (163) dmg
%1 = spell, %2 = GHASTLY, %3 = dog
Your spell does GHASTLY things to Chamenas! (163) dmg
%1 = spell, %2 = GHASTLY, %3 = Chamenas
Your spell does GHASTLY things the small fish! (163) dmg
%1 = spell, %2 = GHASTLY, %3 = fish |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Apr 21, 2008 11:26 pm |
Actually I had never attempted to store an = sign as a key before *grumps*
As as work around you could store it like this for the key.
___ OBLITERATES ___
Then for the #sayadd do this.
$subbedEq=%subchar(%1,"=","_")
#sayadd { <color %db(@dbDamageColor,$subbedEq)>%db(@dbDamageV,$subbedEq)</color>}
Since I've never ran into this problem with any other characters you shouldn't have any problems with the rest. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Apr 22, 2008 12:02 am |
I've posted the code several times.
#regex Damage_Convert {^Your (acidic bite|beating|bite|blast|charge|chill|chop|claw|cleave|crush|divine|drain|flame|flaming bite|freezing bite|grep|magic|peck|pierce|pound|punch|scratch|shocking bite|shock|slap|slash|slice|slime|smash|stab|sting|suction|thrust|thwack|whip|wrath|polevault kick|kick|flamestrike|spell|flame)(?: does)? (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devastates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVASTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESSCRIBABLE|UNSPEAKABLE)(?: things to)?(?: a|the|A|The)? (.+)[!\.]$}
{ $Dmg_Val=%2
$Dmg=" "
#switch ($Dmg_Val)
("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}
("INDESSCRIBABLE") {$Dmg=263}
("UNSPEAKABLE") {$Dmg=280}
#switch ($Dmg <= 34.5) {#sayadd {<color @Pcolor_color1></color>~(<color red>$Dmg</color><color @Pcolor_color1>~) dmg </color>}}
(($Dmg > 34.5) AND ($Dmg <= 54.5)) {#sayadd {<color @Pcolor_color2>~(<color red>$Dmg</color><color @Pcolor_color2>~) dmg </color>}}
(($Dmg > 54.5) AND ($Dmg <= 136)) {#sayadd {<color @Pcolor_color3>~(<color red>$Dmg</color><color @Pcolor_color3>~) dmg </color>}}
(($Dmg > 163) AND ($Dmg <= 280)) {#sayadd {<color @Pcolor_color3>~(<color red>%ansi(blink)$Dmg%ansi(none)</color><color @Pcolor_color3>~) dmg </color>}}
} {General Triggers|Damage Calculator}
I don't need to change how any of it works, it all works. It just wont change the color according to the variable, it's always gray, no matter what the color.
And then...
Why does the color drain? I closed the tags properly |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Apr 22, 2008 12:20 am |
First thing I see:
Quote: |
($Dmg <= 34.5) {#sayadd {<color @Pcolor_color1></color>~(<color red>$Dmg</color><color @Pcolor_color1>~) dmg </color>}} |
The bolded open parenthesis should be inside of the color tag.
Next thing I see is the colors in your screen shot are correct for this trigger. The trigger you are pasting once again has the pattern starting with
Quote: |
^Your (acidic bite|beating|bite|blast|charge |
All the lines in your screen shot that match this pattern have the proper red and gray colors.
FIX YOUR OTHER TRIGGER. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Tue Apr 22, 2008 1:08 am |
Why don't you set up two string lists, one of which is all the damage amounts that don't have weird characters, and one of which is all the ones that DO have weird characters, and then you can use a pattern like this:
(?:(@damageTypesWithoutWeirdCharacters)|(@damageTypesWithWeirdCharacters))
and then do this:
#if %2 {$dmg = @{damageList.%2}} {a less long switch statement for the damage types that have weird characters}
So that the switch will be less long and obnoxious. |
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Tue Apr 22, 2008 1:15 am |
Chamenas you asked:
Quote: |
Is there a way to store all the possible attack types somewhere else? It's getting to be quite a list... |
Here are both trigger patterns to do this:
Code: |
^Your (@attackType) (?:does )?(@damageType) (?>\w+\s?)+?(\w+)[!.]$ |
Code: |
^(?>\w+\s?)+?(\w+)'s (@attackType) (@damageType).* (\w+)[!.]$ |
Just place all the attack types in a string list named @attackType or whatever you want and all the damage types in a string list called @damageType or whatever you want to name it. Then fix your code like Viji said and you should be good to go! |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Apr 22, 2008 4:32 am |
Vijilante wrote: |
First thing I see:
Quote: |
($Dmg <= 34.5) {#sayadd {<color @Pcolor_color1></color>~(<color red>$Dmg</color><color @Pcolor_color1>~) dmg </color>}} |
The bolded open parenthesis should be inside of the color tag.
Next thing I see is the colors in your screen shot are correct for this trigger. The trigger you are pasting once again has the pattern starting with
Quote: |
^Your (acidic bite|beating|bite|blast|charge |
All the lines in your screen shot that match this pattern have the proper red and gray colors.
FIX YOUR OTHER TRIGGER. |
You don't see the text that's inexplicably gray? |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Apr 22, 2008 10:16 am |
Quote: |
You don't see the text that's inexplicably gray? |
I see lots of gray text. I also see you used a JPEG format which tends to mangle colors slightly. I can't recall you ever posting a screen shot with your triggers not turned on, so I have no idea what the colors should be. You also never stated what should be colored differently.
The result of all those things is that there is no visible problem. Once again we are all supposed to be mindreaders. I know I have been working my mind reading skill lately, but for some reason everytime I try to use it to help you I just get a blank. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Apr 22, 2008 11:02 am |
I don't mean to be rude, but if you look at the image again you can see *** DEVASTATES *** and === OBLITERATES === both are in red, except a couple instances where they are gray. The gray is not normal, they should always be red. This happens with the yellow sometimes too, the only thing that's changed is this trigger to add to the end of the line. But I'm closing the color tags, so I don't know why it does this.
|
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Tue Apr 22, 2008 11:08 am |
Yes, but that isn't the trigger you're talking about. The one you're talking about matches "Your" at the start of the line, not "A fire elemental"
Vijilante said "All the lines in your screen shot that match this pattern have the proper red and gray colors."
So you need to post the trigger that matches the lines that aren't working. |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Tue Apr 22, 2008 11:10 am |
I've not read the last 100 posts, nor do I intend to. There does seem to be some 'inexplicable gray', although not in the trigger he's talking about.
I changed the trigger text to have a * at the start, so it'd match 'Your' or 'A fire elemental's' etc. Then made a loop
#ALIAS test {
#LOOP 10 {
#SAY %i A fire elemental's flame *** DEVASTATES *** A sasquatch!
}
}
Which fires. Problem is it sometimes doesn't colour correctly.
See the circled part, it's grey not red. It was red on the previous run of the alias and red in every other iteration of the loop.
The debugger output for the last test alias is
Code: |
c untitled | [1] untitled Comline : start :
a untitled |1 A fire elemental's flame *** DEVASTATES *** A sasquatch!
f untitled | Pattern: ^(?:.*) (acidic bite|beating|bite|blast|charge|chill|chop... : (%1="flame", %2="*** DEVASTATES ***", %3="sasquatch")
c untitled | exec : Pattern "^(?:.*) (acidic bite|beating|bite|blast|charge|c...
g untitled =[1S1 A fire elemental's flame *** DEVASTATES *** A sasquatch![0S([0S68[0S) dmg [0m
a untitled |2 A fire elemental's flame *** DEVASTATES *** A sasquatch!
f untitled | Pattern: ^(?:.*) (acidic bite|beating|bite|blast|charge|chill|chop... : (%1="flame", %2="*** DEVASTATES ***", %3="sasquatch")
c untitled | exec : Pattern "^(?:.*) (acidic bite|beating|bite|blast|charge|c...
g untitled =[1S2 A fire elemental's flame *** DEVASTATES *** A sasquatch![0S([0S68[0S) dmg [0m
a untitled |3 A fire elemental's flame *** DEVASTATES *** A sasquatch!
f untitled | Pattern: ^(?:.*) (acidic bite|beating|bite|blast|charge|chill|chop... : (%1="flame", %2="*** DEVASTATES ***", %3="sasquatch")
c untitled | exec : Pattern "^(?:.*) (acidic bite|beating|bite|blast|charge|c...
g untitled =[1S3 A fire elemental's flame *** DEVASTATES *** A sasquatch![0S([0S68[0S) dmg [0m
a untitled |4 A fire elemental's flame *** DEVASTATES *** A sasquatch!
f untitled | Pattern: ^(?:.*) (acidic bite|beating|bite|blast|charge|chill|chop... : (%1="flame", %2="*** DEVASTATES ***", %3="sasquatch")
c untitled | exec : Pattern "^(?:.*) (acidic bite|beating|bite|blast|charge|c...
g untitled =[1S4 A fire elemental's flame *** DEVASTATES *** A sasquatch![0S([0S68[0S) dmg [0m
a untitled |5 A fire elemental's flame *** DEVASTATES *** A sasquatch!
f untitled | Pattern: ^(?:.*) (acidic bite|beating|bite|blast|charge|chill|chop... : (%1="flame", %2="*** DEVASTATES ***", %3="sasquatch")
c untitled | exec : Pattern "^(?:.*) (acidic bite|beating|bite|blast|charge|c...
g untitled =[1S5 A fire elemental's flame *** DEVASTATES *** A sasquatch![0S([0S68[0S) dmg [0m
a untitled |6 A fire elemental's flame *** DEVASTATES *** A sasquatch!
f untitled | Pattern: ^(?:.*) (acidic bite|beating|bite|blast|charge|chill|chop... : (%1="flame", %2="*** DEVASTATES ***", %3="sasquatch")
c untitled | exec : Pattern "^(?:.*) (acidic bite|beating|bite|blast|charge|c...
g untitled =[1S6 A fire elemental's flame *** DEVASTATES *** A sasquatch![0S([0S68[0S) dmg [0m
a untitled |7 A fire elemental's flame *** DEVASTATES *** A sasquatch!
f untitled | Pattern: ^(?:.*) (acidic bite|beating|bite|blast|charge|chill|chop... : (%1="flame", %2="*** DEVASTATES ***", %3="sasquatch")
c untitled | exec : Pattern "^(?:.*) (acidic bite|beating|bite|blast|charge|c...
g untitled =[1S7 A fire elemental's flame *** DEVASTATES *** A sasquatch![0S([0S68[0S) dmg [0m
a untitled |8 A fire elemental's flame *** DEVASTATES *** A sasquatch!
f untitled | Pattern: ^(?:.*) (acidic bite|beating|bite|blast|charge|chill|chop... : (%1="flame", %2="*** DEVASTATES ***", %3="sasquatch")
c untitled | exec : Pattern "^(?:.*) (acidic bite|beating|bite|blast|charge|c...
g untitled =[1S8 A fire elemental's flame *** DEVASTATES *** A sasquatch![0S([0S68[0S) dmg [0m
a untitled |9 A fire elemental's flame *** DEVASTATES *** A sasquatch!
f untitled | Pattern: ^(?:.*) (acidic bite|beating|bite|blast|charge|chill|chop... : (%1="flame", %2="*** DEVASTATES ***", %3="sasquatch")
c untitled | exec : Pattern "^(?:.*) (acidic bite|beating|bite|blast|charge|c...
g untitled =[1S9 A fire elemental's flame *** DEVASTATES *** A sasquatch![0S([0S68[0S) dmg [0m
a untitled |10 A fire elemental's flame *** DEVASTATES *** A sasquatch!
f untitled | Pattern: ^(?:.*) (acidic bite|beating|bite|blast|charge|chill|chop... : (%1="flame", %2="*** DEVASTATES ***", %3="sasquatch")
c untitled | exec : Pattern "^(?:.*) (acidic bite|beating|bite|blast|charge|c...
g untitled =[1S10 A fire elemental's flame *** DEVASTATES *** A sasquatch![0S([0S68[0S) dmg [0m
d untitled | [1] untitled Comline : stopped |
|
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Apr 22, 2008 1:22 pm |
can I put the list of attack types and damage amounts in a database?
|
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Tue Apr 22, 2008 1:34 pm |
Rahab wrote: |
For the damage levels, a database variable will work, but you'll have to come up keys that distinguish between "devastates" and "*** DEVASTATES ***". Chris-74269 suggested a string list, but you can't guarantee the order of that. A db variable like this would work:
#var dmglist scratch=1|graze=5|hit=9|injure=13 ...
The damage value would be e.g @dmglist.graze |
Arminas wrote: |
If you made a database variable containing each of the number values you would use the words for the keys and do something like.
#sayadd { <color %db(@dbDamageColor,%1)>%db(@dbDamageV,%1)</color>} |
gamma_ray wrote: |
Why don't you set up two string lists, one of which is all the damage amounts that don't have weird characters, and one of which is all the ones that DO have weird characters, and then you can use a pattern like this:
(?:(@damageTypesWithoutWeirdCharacters)|(@damageTypesWithWeirdCharacters))
and then do this:
#if %2 {$dmg = @{damageList.%2}} {a less long switch statement for the damage types that have weird characters}
So that the switch will be less long and obnoxious. |
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Apr 22, 2008 4:11 pm |
Right, but I don't see if that answers whether or not I can put the attack types in a database, which is the one I most need it in. The damage itself could be neater, but that wont expand so it's set and stable. I keep adding new things to the list of attack types all the time.
And here's another lovely screenie:
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Apr 22, 2008 5:35 pm |
Hm. The color you indicate is missing is not part of what you are adding with your trigger. You seem to be saying that the mud itself should be sending that line with color in it which is not showing up. And the other lines in your screenshot do show color on those words. So, the problem is not that color you are trying to add is not showing up, but rather that color being sent by the mud is not showing up. Your earlier questions did not make that clear.
At a first guess, it could be the old bug which occasionally wipes out colors. #sayadd certainly shouldn't be affecting the color of the existing line.
Regarding your question about putting attack types in a database: what values do you want to be associated with the attack types? Right now I don't see any. If you just need the list of types, then a stringlist will suffice. If you do have some kind of values you want linked to each attack type, then of course you can use a database variable. And if you do that, you can generate a stringlist of the type names from it with %dbkeys(). |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Apr 22, 2008 5:51 pm |
I just felt like it would be easier to manage in a sort of database, spreadsheet form. If I wanted a long, heavy list of words on one line I could keep what I have. I'm looking for something that will be a bit easier to update and search. And I still don't know if I could put the OR command in the stringlist, I suppose it's something I can look up, but I can't even find the <color> command in the help on the website.
As for the color. I thought I explained the color situation, regardless, I've now posted two screenshots of it with it mostly being ignored. Should I report it as a bug? I just thought it was something I'm doing wrong. If it's an old bug, why am I seeing it? |
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Tue Apr 22, 2008 7:31 pm |
A string list is essentially a one dimensional database. If you look at a string list in the settings editor, it shows with each item on its own line, just like if you had a list of things in a spreadsheet taking up only one column. You can also use things like #additem, #ismember, etc., for searching and updating your string lists.
OR is exactly equivalent to the | symbol, which is what's used internally to separate items in a string list. So, using a string list as a pattern is exactly equivalent to saying "item one OR item two OR item three OR ..." Did you need to use OR in the string list anywhere else? (Explain.)
<color> is an MXP tag, you should look in the MXP section of the help to find it.
Can you explain again either exactly where in your trigger you're colouring DEVASTATES, MANGLES, and so on, or explain if that colour is usually coming from the game? |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Apr 22, 2008 7:36 pm |
The color is coming from the game, for some reason CMUD is blocking it because of the trigger.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Apr 22, 2008 8:09 pm |
gamma_ray wrote: |
using a string list as a pattern is exactly equivalent to saying "item one OR item two OR item three OR ..." |
Not quite accurate. The proper syntax for this is {@varname}. |
|
|
|
|
|