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 ➜ Compile Error: where did I mess up?

Compile Error: where did I mess up?

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


Posted by Caelen   (81 posts)  Bio
Date Wed 14 Jul 2010 09:04 PM (UTC)

Amended on Wed 14 Jul 2010 09:08 PM (UTC) by Caelen

Message
I had a pair of scripts that give me a printed timer for fishing. I wanted to edit them to make myself automatically reel the line in to a certain distance if I overcast.


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   match="You reel your line in and stop with the hook at * feet."
   send_to="12"
   sequence="100"
  >
  <send>require "wait"

if %1 > 25 then
 Send "reel in"
elseif %1 > 5 then
 wait.make (function ()
 wait.time(60)
 print "REEL IN"
 end)
else
 Send "reel all the way"
end</send>
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   group="Multi Line"
   lines_to_match="2"
   keep_evaluating="y"
   match="You hear a gentle plop as your hook falls into the water about \d+ feet from\nyou\.\Z"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>require "wait"

if %1 > 25 then
 Send "reel in"
else
 wait.make (function ()
 wait.time(60)
 print "REEL IN"
 end)
end</send>
  </trigger>
</triggers>


I keep getting this message when either one fires.


Compile error
World: Ateraan
Immediate execution
[string "Trigger: "]:3: unexpected symbol near '>'


Where did I mess up?
Top

Posted by Caelen   (81 posts)  Bio
Date Reply #1 on Wed 14 Jul 2010 09:10 PM (UTC)

Amended on Wed 14 Jul 2010 09:16 PM (UTC) by Caelen

Message
Odd... now it's working after I retyped them...

EDIT

Spoke too soon.

[code]
<triggers>
<trigger
enabled="y"
expand_variables="y"
group="Multi Line"
lines_to_match="2"
keep_evaluating="y"
match="You hear a gentle plop as your hook falls into the water about \d+ feet from\nyou\.\Z"
multi_line="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>require "wait"

if %1 &gt; 25 then
Send "reel in"
else
wait.make (function ()
wait.time(60)
print "REEL IN"
end)
end</send>
</trigger>
</triggers>
[/code]

still isn't working.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 14 Jul 2010 09:14 PM (UTC)
Message
Here:


   match="You hear a gentle plop as your hook falls into the water about \d+ feet from\nyou\.\Z"


You haven't designated a wildcard so %1 will be empty, and it will be processing:


if > 25 then
 Send "reel in"
else


You need to put brackets around it like this:


   match="You hear a gentle plop as your hook falls into the water about (\d+) feet from\nyou\.\Z"


- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 14 Jul 2010 09:16 PM (UTC)
Message
Caelen said:

Odd... now it's working after I retyped them...

This time, though, instead of getting some set of four characters where the > sign is, it copied the > signs correctly...


The XML ouputting converts < to &lt; and > to &gt;

This is normal, it converts back when you paste into the client.

- Nick Gammon

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

Posted by Caelen   (81 posts)  Bio
Date Reply #4 on Wed 14 Jul 2010 09:17 PM (UTC)

Amended on Wed 14 Jul 2010 09:18 PM (UTC) by Caelen

Message
Ah, so that's how it works. () to make a wildcard.

Yep! works now. Thanks!
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.


14,362 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.