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.
 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Completely Clueless, How would I do this?

Completely Clueless, How would I do this?

Posting of new messages is disabled at present.

Refresh page


Posted by Queeny   (6 posts)  Bio
Date Thu 05 Jul 2018 01:15 PM (UTC)

Amended on Thu 05 Jul 2018 01:30 PM (UTC) by Queeny

Message
I'm trying to write a trigger that changes depending on the number in this sentence

You reel in a short distance, bringing it 21 feet from the boat.

When it is farther than 10 feet I want it to send the command reelin medium

but when it is 10 or lower feet I want it to reelin short

I'm figuring I could do this with two triggers ( Maybe one if someone smarter is able to help me write it)

Any advice?
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #1 on Fri 06 Jul 2018 09:03 PM (UTC)

Amended on Fri 06 Jul 2018 09:04 PM (UTC) by Fiendish

Message
Try


<triggers>
<trigger
   enabled="y"
   match="^You reel in a short distance, bringing it (\d+) feet from the boat.$"
   regexp="y"
   send_to="12"
   sequence="100"
>
<send>
if %1 &gt; 10 then
  Send("reelin medium")
else
  Send("reelin short")
end
</send>  
</trigger>
</triggers>

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Queeny   (6 posts)  Bio
Date Reply #2 on Fri 06 Jul 2018 10:51 PM (UTC)

Amended on Fri 06 Jul 2018 11:20 PM (UTC) by Queeny

Message
Fiendish said:

Try


<triggers>
<trigger
   enabled="y"
   match="^You reel in a short distance, bringing it (\d+) feet from the boat.$"
   regexp="y"
   send_to="12"
   sequence="100"
>
<send>
if %1 &gt; 10 then
  Send("reelin medium")
else
  Send("reelin short")
end
</send>  
</trigger>
</triggers>



Where would I put this/set this up in my client?

Also, is there a way to put a 20 second delay between reel in commands?
So I'd reelin medium if it's at 30 feet and then wait 20 seconds and reelin again accordingly depending on how far it is away still?

Also was just testing some things and realized it has different lines depending on how far you reel...

You reel in a medium amount, bringing it 16 feet from the boat.
You reel in a short distance, bringing it 19 feet from the boat.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 07 Jul 2018 03:38 AM (UTC)
Message
Queeny said:

Where would I put this/set this up in my client?


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.



Also, is there a way to put a 20 second delay between reel in commands?

See: http://www.gammon.com.au/forum/?id=4956

Queeny said:

Also was just testing some things and realized it has different lines depending on how far you reel...


Change "short" to "(?:short|medium|long)" or whatever the words are. The brackets make a group (with alternatives) and the "?:" stops it being captured (so the distance is still %1 in the send box).

- Nick Gammon

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

Posted by Queeny   (6 posts)  Bio
Date Reply #4 on Sat 07 Jul 2018 05:26 AM (UTC)

Amended on Sat 07 Jul 2018 05:31 AM (UTC) by Queeny

Message
Nick Gammon said:

Queeny said:

Where would I put this/set this up in my client?


(pasting)


Also, is there a way to put a 20 second delay between reel in commands?

See: http://www.gammon.com.au/forum/?id=4956

Queeny said:

Also was just testing some things and realized it has different lines depending on how far you reel...


Change "short" to "(?:short|medium|long)" or whatever the words are. The brackets make a group (with alternatives) and the "?:" stops it being captured (so the distance is still %1 in the send box).



Alright I was able to enter it into my client and figure out how to test the wait command after updating my client. Now when I try to launch the command I get this error

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


Also, these are the two triggers I made for the different lines that are spit out at me. Not sure if they are written correctly or not.

These are the examples with what I am trying to work with:

With Fish -
You reel in a short distance, bringing the tuna 15 feet from the boat.
You reel in a medium amount, bringing the tuna 11 feet from the boat.

Without Fish -
You reel in a medium amount, bringing it 17 feet from the boat.
You reel in a short distance, bringing it 15 feet from the boat.


The Trigger Hooked Fish -

<triggers>
<trigger
enabled="y"
match="^You reel in a (?:short|medium|long) (.*?), bringing the (.*?) (\d+) feet from the boat.$"
regexp="y"
send_to="12"
sequence="100"
>
<send>require "wait"
wait.make (function ()

if %1 &gt; 10 then
Send("reelin medium")
wait.time (20)
else
Send("reelin short")
wait.time (20)

end)
</send>
</trigger>
</triggers>


Trigger With No Fish -

<triggers>
<trigger
enabled="y"
match="^You reel in a (?:short|medium|long) (.*?), bringing it (\d+) feet from the boat.$"
regexp="y"
send_to="12"
sequence="100"
>
<send>require "wait"
wait.make (function ()

if %1 &gt; 10 then
Send("reelin medium")
wait.time (20)
else
Send("reelin short")
wait.time (20)

end)
</send>
</trigger>
</triggers>


Thank you guys for your help/patience :( I really am clueless.
Top

Posted by Queeny   (6 posts)  Bio
Date Reply #5 on Sat 07 Jul 2018 03:04 PM (UTC)
Message
I was able to fix the error that was popping up by adding an extra 'end' into it but the trigger doesn't launch/activate at all and no errors pop up. x_X
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #6 on Sat 07 Jul 2018 07:44 PM (UTC)

Amended on Sat 07 Jul 2018 07:46 PM (UTC) by Fiendish

Message
I do indeed see missing ends in what you posted ("if" or "if else" always needs its own trailing "end"), but lets make sure that things are in the right place. Please post what you have now that isn't launching.

For easier readability, put your triggers inside code tags.
Template:codetag To make your code more readable please use [code] tags as described here.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #7 on Sat 07 Jul 2018 09:52 PM (UTC)
Message
As Fiendish said, use code tags please.

As for this:


^You reel in a (?:short|medium|long) (.*?), bringing the (.*?) (\d+) feet from the boat.$


You have made more captures here (I used ?: to avoid that). So what you have is:


^You reel in a (?:short|medium|long) (.*?), bringing the (.*?) (\d+) feet from the boat.$
                                      ^^^                 ^^^   ^^^
                            Capture:   1                   2     3



Therefore the number of feet is now %3 and not %1.

- Nick Gammon

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

Posted by Queeny   (6 posts)  Bio
Date Reply #8 on Sun 08 Jul 2018 12:56 AM (UTC)

Amended on Sun 08 Jul 2018 01:14 AM (UTC) by Queeny

Message
After fiddling around with it with the guidance of you guys I got the error to stop and changed the trigger to make it have less captures and got it to fire correctly based on distance from the boat, but the wait-timer doesn't seem to work and the command sends immediately.

Without fish


<triggers>
  <trigger
   enabled="y"
   match="^You reel in a (?:short|medium|long) (?:amount|distance), bringing it (\d+) feet from the boat.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>require "wait"
wait.make (function ()

if %1 &gt; 10 then
Send("reelin medium")
wait.time (20)
else
Send("reelin short")
wait.time (20)

end

end)
</send>
  </trigger>
</triggers>


With Fish


<triggers>
  <trigger
   enabled="y"
   match="^You reel in a (?:short|medium|long) (?:amount|distance), bringing the (.?) (\d+) feet from the boat.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>require "wait"
wait.make (function ()

if %2 &gt; 10 then
Send("reelin medium")
wait.time (20)
else
Send("reelin short")
wait.time (20)

end

end)
</send>
  </trigger>
</triggers>
Top

Posted by Queeny   (6 posts)  Bio
Date Reply #9 on Sun 08 Jul 2018 03:07 AM (UTC)
Message
Oh my lord I got it to work, all thanks to you guys. You guys are literally the bees knees, and the best. I cut the wait.time (20) to above the commands and it works now perfectly, thank you so much.
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.


26,865 views.

Posting of new messages is disabled at present.

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.