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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Yanuth
Newbie


Joined: 22 Feb 2006
Posts: 9

PostPosted: Wed Mar 08, 2006 9:05 am   

#capture, Multi-Line, #cond, Colour...
 
Hello again ;)

I would like to start off saying I've been scanning the past posts on the subject(s) for several hours now in total and can't seem to find just the solution I need, nor parts of it that I can combine myself then...

I might be overlooking it, if so, I'm sorry and being pointed to the right post would be very welcome :)

But, in case the solution is simple enough to be posted here, don't let me stop you :D

My problem is that my MUD does line-wrapping (and I really don't want to turn that off and let zMud do it), so I am now trying to capture tells and channels that are on multiple lines

They have no clear defined endings, except that the colour changes on different messages...

Some sample MUD output might help:
CHAT:Bendario: That IS a scary thought :) Why no bosses? Meetings?
CHAT:Bendario: What would cause Dex to go down?
CHAT:Elastica: they quit cos Grommet is the uber boss.
CHAT:Bendario: Ah
CHAT:Elastica: Grommet = David Brent
Eureka tells you: no prob
You tell Grump: it's very simple, just keep going onwards and when the npc starts blabbing nonsense, wear the helmet and
it will make sense again :)

(columns is set to 120 in my case)

After a channel or tell or anything, there is no guaranteed prompt to show up, or anything indicating the msg has ended, except that the next line either has a different colour (my tells a green, my chats are cyan), or the next line starts again with one of those msgs of course, another tell, etc...

I figure using #cond is needed here, but I'm just not sure how to say: when this pattern happens (You tell (%1)), capture everything until you get either a msg in a different colour (no longer green) or if it's another tell (in which case the same trigger can grab that)

Sorry for such a long drawn out post, it seems to be my way... I truly hope some solution can be made for this...

Many thanks in advance :D
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Mar 08, 2006 5:27 pm   
 
Try something along the lines of
Code:

#COND {(*)} {
// Check if the text starts with my tell pattern
#IF (%match("%1", "*You tell (%w) (*)",SpokeTo, Said))
{Then do you matching code to use the tex elsewhere}
//ELSE check if it does not start with my tell ANSI color which you'll have to look up
{ #IF (%match("%1","ANSICYAN (*)", LineTest)
  {
     // Do what you'd like to with the result.
  }
}


This is largely pseudo-code but it should give you an idea what you need to do. Also note that you will have to turn on ANSI color matching for this trigger.

Alternatively you can look into the line=## option on #COND where can match the line that has a specific color.
_________________
Asati di tempari!
Reply with quote
Yanuth
Newbie


Joined: 22 Feb 2006
Posts: 9

PostPosted: Fri Mar 10, 2006 5:40 pm   Almost there :)
 
Phew :)

I managed to refind the post I initially got the hint from, the post pointed here http://www.zuggsoft.com/library/trigadv.htm to the section about resetting triggers, the example about the Inventory capture trigger almost does exactly what I need :)

My one search now is brought back to finding a way to put in that #temp trigger that fires when a line is NOT a certain colour (green in my case)...

So right now I just need a solution for:
Code:
#temp {
//Some code/pattern that fires if a line is NOT green, or red, use whatever you like in your example :P That much fine-tuning I can manage... I just can't seem to find a way to say !%ansi(green)%1 in a way that zMud understands...
} {#state TellTrigger 0}


Anyone able to help me with this?
Reply with quote
Yanuth
Newbie


Joined: 22 Feb 2006
Posts: 9

PostPosted: Fri Mar 10, 2006 6:27 pm   That little bit further
 
Hello :)

For all the people that happen to care how this goes... I actually managed to get something myself with some effort... Still not fully there, but now I have:

Code:
#temp {%e[31m} {#STATE TellTrigger 0} "" {color}


Which means it resets the triggerstate to 0 when a red-coloured line is received...
Which is ALMOST what I need... now I need to change that to the NOT version...

But putting a ! in front of it wasn't the solution :P

If anyone still understands the mess I am creating and can help, it will be much appreciated :)
Reply with quote
luggage
Novice


Joined: 20 Jul 2004
Posts: 38
Location: Australia

PostPosted: Sun Mar 26, 2006 1:45 pm   
 
I have a similar situation on the mud I play.

Due to some items and monsters generating text in various colours, and me being too lazy to generate an exception list, I set the mud to send all tells in underlined and chat lines in reverse video as that is not used for anything. Next I capture any lines of reverse video or underlined from the mud and send that to my comm window.
Then, in the comm window, I recolour and highlight the different chat lines and tells, which all works nicely. One little bit of fiddling I have to do is to set the colour for the current chat line, and when a new chat line appears, change the colour accordingly, so as to allow for multiple lines.
This works because each line has the escape code at the begining of the line.

Chat lines on my mud have a header at the start like:

[SM] Luggage: Hello
[<Newbie>] Luggage jiggles his foot.


Anyways, what I have is a seperate window labelled 'comms'

I put all my comm stuff in a seperate class called 'XTRAWindows'

Firstly, capture any tells from the mud and recolour them bold red, gag the original...

#TRIGGER {%e[7;32m} {
#COL bold,red
#CAP comms
#GAG
} "XTRAWindows" {color}

Next, for the comm lines. I use a variable for the current colour..
Then I check to see if a chat line header is present at the beginning of the line, and reset the colour accordingly. If no chat line header is present, then the line is part of a multiple line chat message, so keep the same colour. For some reason, I need to add in a variable that I called 'comm_check' to match up the comm line headers instead of being able to use %1. I think it is because %1 is stored differently than a text string, but... this works fine, and I'm too lazy to rewrite it.

#VAR cur_colour {blue,bold} {_nodef} "XTRAWindows"
#VAR comm_check {[sale]} {_nodef} "XTRAWindows"
#TRIGGER {%e[4;32m(%x)} {
#VA comm_check %1
#IF (@comm_check = "[SM]") {#VAR cur_colour "blue,bold"}
#IF (@comm_check = "[<Newbie>]") {#VAR cur_colour green}
#IF (@comm_check = "[sale]") {#VAR cur_colour grey}
#COL @cur_colour
#CAP comms
#GAG
} "XTRAWindows" {notrig|color}

Finally, a check to see if the line started with a space (as the space character is not included in the %x). In this case, the line is definately the next part from a multiple line chat message.

#TRIGGER {%e[7;32m} {#COL bold,red;#CAP comms;#GAG} "XTRAWindows" {color}

And that is basically it. If you have other text generated by your mud in the same colour as your tells or chat lines, use an exception list, something like #IF %x in {list of strings}, then ingore..

Hope this helps,

Luggage

--
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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