AND and OR Triggers + Counting Script

Post Reply
Kyle
Posts: 30
Joined: Fri May 14, 2010 5:39 am

AND and OR Triggers + Counting Script

Post by Kyle »

Would someone give me an example of an AND/OR trigger? I'd like to know how they work so I can set them up in specific triggers if I want the entire thing to depend on the first sequence going through successfully.

Also, would someone be able to explain how to work a counting script in? Something that could track each time a message appears and keeps track of the count while adding more for each successful message.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: AND and OR Triggers + Counting Script

Post by Vadi »

OR trigger: just input multiple patterns into it, if either matches, the script runs. AND trigger: enable the AND checkbox, set the delta for how many lines would you like to have all patterns matched by (ie, you want all lines to match within 5 lines of the first one - set the delta to be 5).

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: AND and OR Triggers + Counting Script

Post by tsuujin »

I've honestly never found a great use for AND triggers.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: AND and OR Triggers + Counting Script

Post by Vadi »

That's a pity. I did - besides the necessity of matching precision, I also use them as a convenient way to shield things.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: AND and OR Triggers + Counting Script

Post by tsuujin »

regex shielding is really the only reason I use them at all. I've rewritten all of my multi line match triggers to a different system of late, as well.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: AND and OR Triggers + Counting Script

Post by Heiko »

AND triggers become very important if you play MUDs where you cannot disable server line wrap (= most MUDs that I know) or if you want to reduce complexity by condensing multiple triggers into a single AND trigger.

example 1: You want to print "hello world" if and only if 3 lines after your last prompt you get a line that contains the word "Jim".
multistate AND trigger pattern list:
1.) isPrompt() [type Lua function]
2.) 3 [type line spacer]
3.) Jim [type substring]
script: echo("hello world")

example 2: You want to match the sentence "Jim likes Sally, Carla and Jane.", but you cannot know where the server sets the line break as you cannot disable server line wrap. The server output could look like:
Jim likes Sally and Jane.

or

Jim likes Sally, Carla
and Jane

or any other combination.

solution:
multistate pattern list: [trigger pattern type is always substring], line delta is 2
1. Jim
2. likes
3. Sally
4. and
5. Jane

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: AND and OR Triggers + Counting Script

Post by tsuujin »

True, the games I play all give the option of eliminating server side line wrapping.

As far as to see if a trigger matches only three lines after a prompt, I've switched to using moveCursor and selectString. I have a lot of systems that depend on page-length limited output, and came up with the method of checking the last line for "MORE" via moveCursor and simply shutting down the processing triggers on the correct situation. Again, situational to how I do things.

Post Reply