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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Perlscript
. . -> [Subject]  Trigger Send To Script Not Working
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Trigger Send To Script Not Working

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by 1of10   Canada  (54 posts)  [Biography] bio
Date Sat 07 Jun 2003 09:03 PM (UTC)  quote  ]
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)  quote  ]
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  (19,469 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Sat 07 Jun 2003 10:14 PM (UTC)  quote  ]
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)  quote  ]

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.


3,772 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [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.

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]