Search FAQ

Gammon Forum

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 ➜ Perlscript ➜ AddTrigger/AddTriggerEx problem

AddTrigger/AddTriggerEx problem

Posting of new messages is disabled at present.

Refresh page


Posted by Ioolo   (5 posts)  Bio
Date Sat 04 May 2002 05:35 AM (UTC)
Message
This works...

$world->note($world->AddTrigger("monster2", $whatMatch, '%0', 1, 14, 0, "", "music"));

but this doesn't..

$world->note($world->AddTriggerEx("monster3", $whatMatch, '%0', 1, 14, 0, "", "music",9,100));

And I can't figure out why. I've tried switch the 9 and the 100, but it doesn't add the trigger. No error message, no output, nothing. Any idea why?
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 04 May 2002 06:07 AM (UTC)
Message
I think this is a Perl idiosyncracy.

It worked for me *provided* $whatMatch was defined.

If I tried it as:


$world->note($world->AddTriggerEx("monster3", $xxx, '%0', 1, 14, 0, "", "music",9,100));


then I got the same results - no return code at all.

I can only assume that the AddTrigger didn't get called at all under the circumstances. Why, I cannot say. You can get the same results like this:


$world->note($world->AddTriggerEx("monster3", , '%0', 1, 14, 0, "", "music",9,100));

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #2 on Sat 04 May 2002 06:11 AM (UTC)
Message
I get similar results with this:


/$world->note ();


It seems the Perl interpreter must check the number of arguments, and if the supplied number does not agree with the number required, declines to call the script routine. And in your case, two consecutive commas effectively gives a missing argument, which the script is not designed to accept.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ioolo   (5 posts)  Bio
Date Reply #3 on Sat 04 May 2002 06:42 AM (UTC)
Message
When I try..

/$world->AddTriggerEx ("", "* attacks", "You are under attack!", 1, 14, 0, "", "", 2, 50);

(The example provided in documentation) it doesn't work. Does it work for you? If so, what could possibly be causing this function not to work for myself? Thanks for the help so far..
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #4 on Sat 04 May 2002 08:14 AM (UTC)
Message
That exact example works for me. Why it wouldn't for you is a mystery. Maybe you have a leading space before the line?
Maybe scripting isn't enabled? I hate to insult you with such suggestions, but that is the sort of thing I would check.

I am using ActivePerl 5.6.0.613.

Maybe a different version wouldn't work, but I can't think why.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ioolo   (5 posts)  Bio
Date Reply #5 on Sat 04 May 2002 09:06 AM (UTC)
Message
Yeah.. no leading space.. I'm running ActivePerl v5.6.1 build 631, MushClient 3.17. I've tried making new world files, new scripts.. eliminating all spaces, etc. Is there by chance another way to set the Send To option via scripting?
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #6 on Sat 04 May 2002 10:08 PM (UTC)
Message
Ah I see what the problem is.

AddTriggerEx is new to version 3.18 of MUSHclient. As I just released it an hour or so before your message I assumed you were the first to download it, so I didn't comment on that.

I have amended the documentation for the function to say that you need 3.18. Try that and see how you go.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


17,335 views.

Posting of new messages is disabled at present.

Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.