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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  [string "Trigger: "]:1: unexpected symbol near '<'
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

[string "Trigger: "]:1: unexpected symbol near '<'

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


Posted by Rabbi   (2 posts)  [Biography] bio
Date Wed 13 Jul 2016 09:11 PM (UTC)

Amended on Wed 13 Jul 2016 09:19 PM (UTC) by Rabbi

Message
Hi all, I'm getting back into MUDing after a long time, and trying to write the simplest trigger is driving me crazy.

My trigger works, and I get the correct output, but before the correct output I get the following:

Error:

Error number: 0
Event:        Compile error
Description:  [string "Trigger: "]:1: unexpected symbol near '<'
Called by:    Immediate execution


Sample Input:
<641/641hp 14/14sp 207/207ep 345xp>


Trigger:

  <trigger
   enabled="y"
   group="Colorize"
   match="&lt;* * * *&gt;"
   omit_from_output="y"
   script="Prompt"
   send_to="12"
   sequence="100"
  >
  <send>%0</send>
  </trigger>


Lua:

function Prompt (name, text, wildcards)
    Tell ("<")
    ColourTell("yellow", "black", wildcards[1] .. " ")
    ColourTell("cyan", "black", wildcards[2] .. " ")
    ColourTell("magenta", "black", wildcards[3] .. " ")
    ColourTell("grey", "black", wildcards[4])
    Tell (">")
end


If I create the following trigger instead it works fine:

  <trigger
   enabled="y"
   expand_variables="y"
   group="Colorize"
   keep_evaluating="y"
   match="&lt;* * * *&gt;"
   omit_from_output="y"
   send_to="12"
   sequence="100"
  >
  <send>Tell ("&lt;")
ColourTell("yellow", "black", "%1" .. " ")
ColourTell("cyan", "black", "%2" .. " ")
ColourTell("magenta", "black", "%3" .. " ")
ColourTell("grey", "black", "%4")
Tell ("&gt;")</send>
  </trigger>

But I'd prefer to keep this stuff in an external file instead of having the code live in my triggers. I have no idea why this is happening and it's been driving me nuts! Any help is appreciated.

Version: Getting the same results on version 5.01 and 4.94.
[Go to top] top

Posted by Nick Gammon   Australia  (21,321 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 13 Jul 2016 09:19 PM (UTC)
Message

  <send>%0</send>


You are sending the matching text to the script engine. Omit the %0 there. Since you are calling your own function you don't need to set it to "send to script".

Send to "world" will do.

- Nick Gammon

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

Posted by Rabbi   (2 posts)  [Biography] bio
Date Reply #2 on Wed 13 Jul 2016 11:17 PM (UTC)
Message
Thank you so much for your VERY quick reply. It's much appreciated!
[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.


1,828 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 FutureQuest]