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 ➜ General ➜ making a line in a trigger wait a sec or 2

making a line in a trigger wait a sec or 2

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


Posted by Sprockfizzly   (2 posts)  Bio
Date Fri 16 Feb 2018 12:41 AM (UTC)

Amended on Sun 18 Feb 2018 02:39 AM (UTC) by Nick Gammon

Message
i play this mud that has a command buffer on body location commands, and im trying to have a trigger do a spell, but i cant get it to wait long enough for the item i drop to disappear before targeting the one in my inventory. i tried world.doafter, and DoAfter. but they both say unrecognized command. this is the first trigger thats not working. its a chain of 3, if i do stuff manually i can get the other 2 to fire off with no problem.


<triggers>
  <trigger
   enabled="y"
   ignore_case="y"
   match="You drop *(a|an|the) *(bronze|iron|steel) shortsword in the void."
   regexp="y"
   sequence="100"
  >
  <send>fab short
tar short
rw
rw
rp
</send>
  </trigger>
</triggers>


[EDIT] Put trigger into code tags.
Top

Posted by Areadien   USA  (47 posts)  Bio
Date Reply #1 on Fri 16 Feb 2018 07:12 AM (UTC)

Amended on Fri 16 Feb 2018 11:53 PM (UTC) by Areadien

Message
Sounds to me like what you want is a timer. Here's how I would code it, though I use Lua, so your exact coding will be different. I'm not sure which command it is you want to execute later, so I'm going to assume that tar short is what you want to go with.

<muclient>
<triggers>
    <trigger enabled="y" ignore_case="y" match="You drop *(a|an|the) *(bronze|iron|steel) shortsword in the void."
regexp="y" send_to="12" sequence="100">
        <send>fabTar()</send>
    </trigger>
</triggers>

<script>
<![CDATA[

function fabTar()
    Send("fab short")
    AddTimer("fabTar", 0, 0, 3, "fabTar2()", timer_flag.Enabled + timer_flag.OneShot)
    SetTimerOption("fabTar", "send_to", 12)
end

function fabTar2()
    Send("tar short")
    Send("rw")
    Send("rw")
    Send("rp")
end

]]>
</script>
</muclient>
Top

Posted by Fiendish   USA  (2,537 posts)  Bio   Global Moderator
Date Reply #2 on Fri 16 Feb 2018 04:15 PM (UTC)

Amended on Fri 16 Feb 2018 04:17 PM (UTC) by Fiendish

Message
Quote:
i tried world.doafter, and DoAfter. but they both say unrecognized command


It looks like the reason for the problem that you're encountering is that your trigger is sending directly to the game, and not passing your <send></send> section to the script interpreter.

Set your trigger to send to Script instead of the default to World and then wrap everything in Send() functions, like so...


<triggers>
<trigger
enabled="y"
ignore_case="y"
match="You drop *(a|an|the) *(bronze|iron|steel) shortsword in the void."
regexp="y"
sequence="100"
send_to="12"
>
<send>
Send("fab short")
Send("tar short")
Send("rw")
Send("rw")
Send("rp")
</send>
</trigger>
</triggers>


http://www.gammon.com.au/scripts/function.php?name=Send

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

Posted by Nick Gammon   Australia  (23,159 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 17 Feb 2018 04:57 AM (UTC)
Message
That doesn't address the issue of the delay. Try reading this:

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

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,159 posts)  Bio   Forum Administrator
Date Reply #4 on Sat 17 Feb 2018 10:16 PM (UTC)
Message
Also see: http://www.gammon.com.au/modules

Scroll down to the part about "wait.lua".

- Nick Gammon

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

Posted by Sprockfizzly   (2 posts)  Bio
Date Reply #5 on Sun 18 Feb 2018 01:12 AM (UTC)
Message
Thanks for the replys! Internets been down so i havent been able to try anything. I have read the posts Mr. Gammon suggested but dont know anything about lua so i somewhat skimmed over it. But i guess i will be reading up on it now :)

Areadien, that was the command i wanted delayed. If my internet ever gets fixed i will try your suggestion.

Thanks all. Will post again when i can!
Top

Posted by Nick Gammon   Australia  (23,159 posts)  Bio   Forum Administrator
Date Reply #6 on Sun 18 Feb 2018 02:32 AM (UTC)

Amended on Sun 18 Feb 2018 02:41 AM (UTC) by Nick Gammon

Message
This is the general idea:


<triggers>
  <trigger
   enabled="y"
   ignore_case="y"
   match="^You drop +(a|an|the) +(bronze|iron|steel) shortsword in the void\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>

require "wait"

wait.make (function ()  --- coroutine below here

  Send ("fab short")
  wait.time (2)   -- wait 2 seconds
  Send ("tar short")
  Send ("rw")
  Send ("rw")
  Send ("rp")

end)  -- end of coroutine

</send>
  </trigger>
</triggers>


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


This sends "fab short", waits 2 seconds, and then sends the other stuff. You could add in other waits if you wanted to.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


21,547 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.