Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ Lua
➜ Gagging and Text Replacement
Gagging and Text Replacement
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Flelm
(15 posts) Bio
|
Date
| Sun 21 Aug 2005 09:24 AM (UTC) |
Message
| I'm having problems with the "omit from output" part of a trigger. Here's the relevant code.
<trigger
enabled="y"
keep_evaluating="y"
match="^ ([A-Za-z]+) was in the sign of( the)? ([A-Za-z ]+)\.$"
omit_from_output="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>Nativity ("%1", "%3")</send>
</trigger>
function Nativity (a, b)
Note ("TESTING")
end
If I check omit_from_output, neither the line nor the Note shows up, even though the function is being called. How do I replace the triggered line with my line?
SAMPLE TRIGGER LINE:
Sun was in the sign of Dragon.
Thanks in advance | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #1 on Sun 21 Aug 2005 10:31 AM (UTC) |
Message
| If you set a trigger that sends to script to omit from output then the send text will be omitted also. The solution is to put your script into a function callable by a trigger and do it through the script file, instead of directly inside the trigger. Or if you absolutely don't want to use a script file for some reason you could probably make two triggers to match on the same line, one to execute the script (keep evaluating - yes, sequence - 99) and another to omit from output (sequence - 100). That way the first trigger will match and perform whatever actions you need, and the second will omit the line. | Top |
|
Posted by
| Ekerim
Sweden (18 posts) Bio
|
Date
| Reply #2 on Sun 21 Aug 2005 01:25 PM (UTC) Amended on Sun 21 Aug 2005 01:27 PM (UTC) by Ekerim
|
Message
| Uhmmm...that might be working with Lua but how does one do it in PerlScript ? The only way I have been able to get any output from a trigger that omits output from output window is to set up a one-shot timer, the suggested call a sub in the script file just simply doesn't work.
What I did test is a sub in the scriptfile that looks like:
sub outputTest() {
$world->note("Modified output: You are hungry.");
}
and a trigger that that looks like:
Trigger text: "You are hungry."
Action contents: "outputTest();"
Send to: Script
What am I doing wrong here ?
// Fredrik | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #3 on Sun 21 Aug 2005 05:36 PM (UTC) |
Message
| You are still sending to script which won't work. You need to put the function name in the trigger's Script box (lower right corner of the trigger edit dialogue), and make sure that this function accepts exactly 3 arguments. The trigger will call this function passing its' own (the trigger's) name, whatever is in its Send box, and a list of captured wildcards in the arguments. So your "outputTest" sub should look like:
sub outputTest(name, output, wildcs) {}
or whichever way you declare accepted arguments in Perl. | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #4 on Sun 21 Aug 2005 05:39 PM (UTC) |
Message
| Ooops, missed the "doesn't work" part. Why wouldn't it work for Perl? Does it say anything at all?
And have you tried using two triggers for the same line? | Top |
|
Posted by
| Ekerim
Sweden (18 posts) Bio
|
Date
| Reply #5 on Mon 22 Aug 2005 12:06 AM (UTC) Amended on Mon 22 Aug 2005 03:27 AM (UTC) by Ekerim
|
Message
| Thanks for the answer...
I acctually missed that Script field for the trigger, I will test that next. I have it working ok now with a 0.1 sec delay coz of the DoAfterSpecial i use to get it to work. It would be preferable to not have any delay since I use it to highlight enemy player spellcasters casting offensive spells at me :)
Yes, I did test two triggers, one at sequence 50 that would write write modified text and one at 100 that would gag. That didn't work.
// Fredrik
[Added]I have it working using the Script field now. Thanks alot! | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
21,637 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top