[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Perlscript
. . -> [Subject]  Trigger Send To Script Not Working

Trigger Send To Script Not Working

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by 1of10   Canada  (54 posts)  [Biography] bio
Date Sat 07 Jun 2003 09:03 PM (UTC)
Message
I just discovered the Send To Script option for triggers, etc. and I've been trying to make use of this feature. I cannot seem to get the inline script to work. I always get an error box saying immediate execution line in error.

I have searched the site (docs and forums) looking for help and examples of this feature. Most of it looks to be written in VBScript. I use PerlScript.

I have tried the following variations:

run~if (!defined($world->getVariable("TestVar"))) { $world->send("Some \"quoted\" text."); }

if (!defined($world->getVariable("TestVar"))) { $world->send("Some \"quoted\" text."); }

run~if (!defined(getVariable("TestVar"))) { send("Some \"quoted\" text."); }

if (!defined(getVariable("TestVar"))) { send("Some \"quoted\" text."); }


Above, run~ is my script alias, as opposed to /.

As far as I can tell, the trigger is setup correctly. I use the same !defined() test in a script file subroutine for another trigger that is not inline script, and that works. I even copied the inline script out of the trigger and pasted to the input window. It worked perfectly there. The script will not work for me as an inline script.

Screen captures of the trigger setup:
http://fr.1of10.net/nx01/inline_trigger_script_1.jpg
http://fr.1of10.net/nx01/inline_trigger_script_2.jpg

One of Ten
Secondary Adjunct of Unimatrix Z03
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #1 on Sat 07 Jun 2003 09:35 PM (UTC)
Message
Just a question.. Are you sure the language is set to Perl in the script dialog? :P

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Sat 07 Jun 2003 10:14 PM (UTC)
Message
The problem is a bit more subtle. :)

First, the variant you want is your second one, because "send to script" already knows you want to script it, and adding the script prefix is unnecessary, and in fact, wrong.

If you want to use the script prefix (why, I can't think) then you need to "send to execute" so it goes through the command parser, which then notices the script prefix.

However the idea of "send to script" was that triggers like that would continue to work even if you changed the script prefix.

The main problem is that triggers very helpfully translate backslash sequences for you, so that \" becomes simply ".

To make it work, which it did for me you need to escape the backslash, so it makes it through to the Perl engine. This works:


if (!defined($world->getVariable("TestVar")))
{ $world->send("Some \\"quoted\\" text."); }

Note the extra backslashes.




- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by 1of10   Canada  (54 posts)  [Biography] bio
Date Reply #3 on Sun 08 Jun 2003 01:49 AM (UTC)

Amended on Sun 08 Jun 2003 01:51 AM (UTC) by 1of10

Message
That was VERY subtle... It's working now.

Thanks. :)

One of Ten
Secondary Adjunct of Unimatrix Z03
[Go to top] 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.


15,303 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]