Help - Search - Members - Calendar
Full Version: Triggers - Text Capture Reroute To New Windows
Achaea's Forums > Off-Topic > Tech Support > Client Help
Ceili
I have only recently begun using ZMud, so I'm not at all fully knowledgeable about using things like this.

However, I've done some research, and I think these might work, but I'd feel more confident if I had someone with more experience in ZMud that could verify things.

I have managed to create extra windows, and I split the window (it's full screen) in half. On the left is the main window, with the prompt and rooms. On the right, I have these windows; House, City, Class, Tells, Market. I'm sure you can tell what each is meant to be used for.

Now, these are the triggers I worked out. I'm not positive whether the first two will work though.

1) Send House announcements to the House window.
#TRIGGER {----[ Ashura House announcement ]---- * -------------------------------------} {#CAP House;#GAG}

The part that concerns me is the * in between. The first half is obviously the top of the announcement area, the second part is the ending of it, and the * is supposed to be all the lines that come between those two. I know the second half should work. to CAPture anything with that and send it to the House window. And GAG it on the main area.

2) Send City announcements to the City window.
#TRIGGER {----[ Ashtan City announcement ]---- * ------------------------------------} {#CAP City;#GAG}

This one is pretty much the same deal, just for the City instead of my House.

3) Capture House messages and send to House window.
#TRIGGER {(Deshi): * says,} {#CAP House;#GAG}

I think this should only apply to my house? At least I think anything with the (Deshi) at the front comes from the Ashuran channel.

4) Capture City messages and route them to City window.
#TRIGGER {(Ashtan):} {#CAP City;#GAG}

Same deal as above. Given how it looks, I figure (Ashtan) must be for the citizens.

5) Tells send to the Tell window.
#TRIGGER {* tells you,} {#CAP Tells;#GAG}

And the last one should work. I just wanted to make sure.

I don't have one yet for Market, because my character isn't high enough level to use the market.

[Also, if someone could PM or fill me in on house messages from others in my class would look? Given how things are...I want to think it'd be (Runewarden) but I can't say for sure.]
Sena
First, you'll want to make sure you anchor your triggers whenever possible. This means specifying the beginning and end of lines using ^ for the beginning and $ for the end.
QUOTE (Ceili @ Jun 3 2009, 05:05 PM) *
1) Send House announcements to the House window.
#TRIGGER {----[ Ashura House announcement ]---- * -------------------------------------} {#CAP House;#GAG}

2) Send City announcements to the City window.
#TRIGGER {----[ Ashtan City announcement ]---- * ------------------------------------} {#CAP City;#GAG}

These will only attempt to match a single line. For multiple lines, you'll have to specify where the lines break using $. You also want to escape [ and ], since those are special characters for pattern matching. Escaping (which just means to specify that a character is matched literally) in zMUD is done with ~.
CODE
#TRIGGER {^----~[ Ashura House announcement ~]----$*$-------------------------------------$} {#CAP House;#GAG}

If the announcement is on multiple lines though, that still won't work, so a better option would be to use #C+ and #C-.
CODE
#TRIGGER {^----~[ Ashura House announcement ~]----$} {#GAG;#GAGON;#C+ House}
#TRIGGER {^-------------------------------------$} {#GAG;#GAGOFF;#C-}

#GAGON will start gagging every line received, and #C+ House will start capturing every line received. Then #GAGOFF and #C- will stop gagging and capturing. So, that will gag and capture those two lines and everything between them. Then you would do the same for city announcements.

QUOTE (Ceili @ Jun 3 2009, 05:05 PM) *
3) Capture House messages and send to House window.
#TRIGGER {(Deshi): * says,} {#CAP House;#GAG}

4) Capture City messages and route them to City window.
#TRIGGER {(Ashtan):} {#CAP City;#GAG}

5) Tells send to the Tell window.
#TRIGGER {* tells you,} {#CAP Tells;#GAG}

( and ) are also special characters, used for capturing patterns for later use, so to match the actual characters you'll want to use ~ again. Also, * will work here, but it's better to be as specific as possible with wildcards. In this case, since you only want to match a single word (a name), %w would be the best choice.
CODE
#TRIGGER {^~(Deshi~): %w says,} {#CAP House;#GAG}

#TRIGGER {^~(Ashtan~):} {#CAP City;#GAG}


Market and class channels would be (Market): and (Class):

Your triggers could also be improved by using regex for pattern matching. Trevize has a useful tutorial here if you want to take a look at it. It can make your triggers a bit faster, and allow for much more flexibility.
Ceili
Hmm...I gotta admit. All that stuff looks complicated x_x

Could you show me an example of how I could use it, maybe that'll give me some idea of what you mean by how I could setup the triggers using that.

Sorry if I seem hopeless at this. I've just never really experienced anything like this in coding.
Sena
What parts are you having trouble understanding?

As an example, for the triggers you posted, I'd fix them by changing them to:
CODE
#TRIGGER {^----~[ Ashura House announcement ~]----$} {#C+ House;#GAGON}
#TRIGGER {^------------------------------------$} {#C-;#GAGOFF}
#TRIGGER {^----~[ Ashtan City announcement ~]----$} {#C+ City;#GAGON}
#TRIGGER {^------------------------------------$} {#C-;#GAGOFF}
#TRIGGER {^~(Deshi~):} {#CAP House;#GAG}
#TRIGGER {^~(Ashtan~):} {#CAP City;#GAG}
#TRIGGER {^%w tells you,} {#CAP Tells;#GAG}

If you want to use regex, they would be:
CODE
#REGEX {^----\[ Ashura House announcement \]----$} {#C+ House;#GAGON}
#REGEX {^------------------------------------$} {#C-;#GAGOFF}
#REGEX {^----\[ Ashtan City announcement \]----$} {#C+ City;#GAGON}
#REGEX {^------------------------------------$} {#C-;#GAGOFF}
#REGEX {^\(Deshi\):} {#CAP House;#GAG}
#REGEX {^\(Ashtan\):} {#CAP City;#GAG}
#REGEX {^\w+ tells you,} {#CAP Tells;#GAG}
Ceili
Oh.

That's what was throwing me off. Sorry.

I thought you meant REGEX was put in certain places on the first set of codes in your post. To make them better and faster.

I didn't realize REGEX was a separate set like that. To be used instead of a TRIGGER.

My mistake smile.gif
Ceili
I'm having some trouble with the first two, for the House and City announcements.

I input it the way you had up there.

#TRIGGER {^----~[ Ashura House announcement ~]----$} {#C+ House;#GAGON}
#TRIGGER {^------------------------------------$} {#C-;#GAGOFF}
#TRIGGER {^----~[ Ashtan City announcement ~]----$} {#C+ City;#GAGON}

And it went like this:

Main Window:

----[ Ashura House announcement ]------
Capture On

House Window:
<announcement text> (without the top part, shown above this)
-----------------------------

----[ Ashtan City announcement ]-----------
Capture On

City Window:
<announcement text>

So I fiddled a little with the code.
On this line mainly:
#TRIGGER {^------------------------------------$} {#C-;#GAGOFF}

I just changed it to be like this:
---------------------

So now I have it going like this:

----[ Ashura announcement ]--------
capture on

----[ Ashtan announcement ]---------
capture on

House window:
<announcement text>
---------------------

City window:
<announcement text>
--------------------

So it works, it's just that it's cutting off the top part. I'm not sure how I can alter the code to make it capture that line and the lines below it.

I want to think it could be altered like this:
#TRIGGER {^----~[ Ashura House announcement ~]----$} {#CAP House;#GAGON;#C+}

Wouldn't this capture the line that is on, then set the GAG to be on, then start Capturing the normal lines?

--On a side note, the items that are sent to my windows are not being logged. How can I set it up to log each window?

The window names are: House, City, Class, Market, Tells, Newbie

--And lastly, sometimes when someone says something in Newbie, it'll cut in half, and the other half will be in the main window. Is there any way to rewrite things to fix this?
Sena
You're right, just add #CAP along with #C+, apparently #C+ doesn't capture the line it fires from. As for the problems with multiple lines, there are ways to code around that, but it's a good idea to just do CONFIG SCREENWIDTH 0. That will make it so Achaea doesn't wrap the lines at all, and zMUD will do the wrapping itself. It makes scripts much simpler. To log other windows, you'll have to start the log the same way you would in the normal window. Or, you could simply go into preferences, in the logging section, and check "Log before triggers" and it will log before gagging from the main window.
Ceili
Ok.

I unchecked the Log After Triggers piece in Zmud. So that should be resolved.

In trying the addition I made. the House Announcement piece does show in the new windows. So that's good.

However, it also shows in the main window still. So I altered it to be like this.

#CAP House;#GAG;#C+ House;#GAGON

Hoping that'll resolve that lil issue.

But other than that, everything should be great smile.gif
Sena
Oh, yep, I forgot about the gagging too.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.