Register forum user name 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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ [string "Trigger: "]:1: unexpected symbol near '<'

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

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


Posted by Rabbi   (5 posts)  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.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  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
Top

Posted by Rabbi   (5 posts)  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!
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.


12,317 views.

It is now over 60 days since the last post. This thread is closed.     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.