Multiline Trigger with replace()

Post Reply
Dhaed
Posts: 12
Joined: Wed Feb 03, 2010 3:55 pm

Multiline Trigger with replace()

Post by Dhaed »

I would like to 'gag' alot of what is going on using replace() to display simple words and phrases for what is happening. I'm trying to match a trigger that is two lines and then replace both lines with one 'gag' phrase. Or replace the first line and deletLine() the second line. I can't seem to get the trigger to fire though ... example:

Code: Select all

#0:  You recite a fiery liturgy praising the divine glories of Prandur, God of Fire,   --exact match
#1:   your eyes burning with conviction.           --exact match

multi/and checked and delta set to 2

send("ql")    <--- just to test the trigger firing, and it's not.
It is activated.

Please help.

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

Re: Multiline Trigger with replace()

Post by Vadi »

Please show a screenshot of mud output + your trigger setup. Can't say much atm.

Dhaed
Posts: 12
Joined: Wed Feb 03, 2010 3:55 pm

Re: Multiline Trigger with replace()

Post by Dhaed »

Never mind, I just got it to fire. The MUD has a 'hidden' space at the end of line 1, which I did not have. Working as intended. :D Now I just have no clue how to do what I want, here's some screenies of how I thought it should be done, but it isn't working so yeah.
Attachments
multi3.jpg
mult2.jpg
multi1.jpg

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

Re: Multiline Trigger with replace()

Post by Heiko »

1. You have a syntax error in your script it's fg("blue") instead of Fg("blue").
2. If you are using screen width 0 (=no server side line wrap) which is always the recommended option, deleteLine() at the end of your script will delete your color etc. also -> use replace("") instead. If you are not on screen width = 0 you'll have to move the cursor into the line where the match actually happened to select your text. Check the return code of selectString() to find out if the selection was successful, otherwise move up a line.
3. Using multistate triggers to gag or reformat text is not always the best option. Check the manual and search the forum for more information on multistate triggers and trigger chains.

Dhaed
Posts: 12
Joined: Wed Feb 03, 2010 3:55 pm

Re: Multiline Trigger with replace()

Post by Dhaed »

I see what you mean. Anything I should be weary of when setting screen width to off and Mudlet wrap buffer to 200?

Edit: 158 is all the wider I can go on my laptop. You guys are the greatest as far as support goes.

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

Re: Multiline Trigger with replace()

Post by Vadi »

Not really, because your triggers will be matching on the 0 line, not 200 - so you have nothing to worry about.

Post Reply