Two "Match Alls" in Same Line Interfering with Each Other

Post Reply
TheUltimateMap
Posts: 10
Joined: Thu Jul 11, 2013 9:14 pm

Two "Match Alls" in Same Line Interfering with Each Other

Post by TheUltimateMap »

Ok, so I may have coded myself into a corner here. What I am trying to do is make Mudlet understand the difference between "fresh water" and "salt water" in the game, which are represented by little waves like this ~~ but are different in coloration, and then seperate the two so they can be mapped.

I've been wrestling with the logic of this for quite a while as both will appear on the same line, and there seems to be no way to match by color alone; only substring. I think matching the whole line and using string.split would do the trick but I've been avoiding that option like the plague.

Right now I have a multiline color trigger called freshwater, with a substring of ~~. It matches on fg:cyan and bg:blue and then highlights it fg:white and bg:blue. I then have another multiline color trigger called saltwater, with the same substring but matches on fg:blue and bg:blue and highlights it fg:white and bg:blue.

The huge blunder of course being that I'm still only albe to match by substring even though they are multiline. Now one highlight takes dominance depending on which one is higher up in the list of triggers, because both are matching all of the ~~ on the line. Once I had them highlighted, the idea was to echo every match, changing the ~~ to something else.

I'm hopeful that someone can come up with an elegant solution for what I'm going for, preferably without modifying what I've already done too much. Like I said, matching the whole line and splitting it may work but I want to try to salvage the solution I already have.

TheUltimateMap
Posts: 10
Joined: Thu Jul 11, 2013 9:14 pm

Re: Two "Match Alls" in Same Line Interfering with Each Othe

Post by TheUltimateMap »

Actually I don't think that splitting it would work either; not without that color differentiation. Can anyone bail me out? :shock:

User avatar
keneanung
Site Admin
Posts: 94
Joined: Mon Mar 21, 2011 9:36 am
Discord: keneanung#2803

Re: Two "Match Alls" in Same Line Interfering with Each Othe

Post by keneanung »

From your description, you currently highlight both the same colors: fg:white and bg:blue.

It should work as you described, if you set the multiline delta to 0. Maybe I am overseeing something though.

TheUltimateMap
Posts: 10
Joined: Thu Jul 11, 2013 9:14 pm

Re: Two "Match Alls" in Same Line Interfering with Each Othe

Post by TheUltimateMap »

One was blue and blue and the other was white and blue, but to be safe I changed it to white and orange. The line delta is at zero for both. The tooltip I noticed that made me /facepalm is under 'match all'... 'match all occurences of the pattern in the line'. I can't seem to create matches from a color trigger under any circumstances, evidently just a string pattern.

I also read up on chains and filters pretty extensively and I don't think they can help in this situation, though I could be wrong.

TheUltimateMap
Posts: 10
Joined: Thu Jul 11, 2013 9:14 pm

Re: Two "Match Alls" in Same Line Interfering with Each Othe

Post by TheUltimateMap »

I'm not at home to try it, but I just just found the getBgColor() and getFgColor() commands, that I'm pretty certain would do it. Crisis averted.

Post Reply