[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]  require "wait"
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

require "wait"

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


Posted by Ammanas   (8 posts)  [Biography] bio
Date Thu 29 Oct 2009 05:41 PM (UTC)
Message
I have been working on something for a couple of days now, and can't seem to get it to work. If anyone would be able to help, I would appreciate it greatly.

http://pastebin.com/m7cb6f8c6
[Go to top] top

Posted by WillFa   USA  (525 posts)  [Biography] bio
Date Reply #1 on Thu 29 Oct 2009 06:37 PM (UTC)
Message
The wait module is good for inserting pauses into your script so you can evaluate the return.

i.e. search table
wait for response
if found candle then dothis
else dothat
end

You are doing just a simple one time delay. DoAfter(2, "say lots of stuff") is probably all you need in this case.
[Go to top] top

Posted by Ammanas   (8 posts)  [Biography] bio
Date Reply #2 on Thu 29 Oct 2009 06:50 PM (UTC)
Message
I would have used DoAfter, but it doesn't seem to work either.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 29 Oct 2009 08:11 PM (UTC)
Message
I would use DoAfter for the situations you showed - that is shorter and simpler to look at. I would rather work out why DoAfter doesn't work than throw that away and try a different approach.

Check the triggers actually fire - when you edit each trigger it shows in the bottom RH corner the count of times it fired. If it is zero, then whatever the code does won't matter.

As an example, one of your match lines is:


match="You say in a faint, raspy voice, "Greetings Mhaldorian, your attendance is appreciated. "


Does the line really end with a trailing space? Does it really start with "You say" or is there a prompt there too? Please post some example MUD output (copy and paste) so we can see exactly what you are trying to match on.

One tiny thing wrong in a trigger like that (eg. there isn't a trailing space) and it won't match.

- Nick Gammon

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

Posted by Ammanas   (8 posts)  [Biography] bio
Date Reply #4 on Fri 30 Oct 2009 01:22 AM (UTC)

Amended on Fri 30 Oct 2009 05:56 PM (UTC) by Ammanas

Message
Yeah it shows them as not firing. This is the whole output:

Quote:

say Greetings Mhaldorians, your attendance is most appreciated. Before we begin, let us bow our heads in an opening prayer.
You say in a faint, raspy voice, "Greetings Mhaldorians, your attendance is
most appreciated. Before we begin, let us bow our heads in an opening prayer."
2830h, 2205m, 13050e, 8925w ex-


I tried the DoAfter first. When that wouldn't work, I tried require "wait".

This is what I just changed it to, still not firing:

Quote:

<triggers>
<trigger
enabled="y"
ignore_case="y"
match="You say in a faint, raspy voice, &quot;Greetings Mhaldorians, your attendance is most appreciated. Before we begin, let us bow our heads in an opening prayer.&quot;"
regexp="y"
send_to="12"
sequence="2050"
>
<send>DoAfter(2, "emote bows his head and crosses his hands calmly before him.")</send>
</trigger>
</triggers>


Some of them are really long, so I didn't know if it was able to leave most of it off and just work to fire on the first few words, or if everything had to be included.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Fri 30 Oct 2009 03:26 AM (UTC)
Message
I'm seeing two lines here:


You say in a faint, raspy voice, "Greetings Mhaldorians, your attendance is 
most appreciated. Before we begin, let us bow our heads in an opening prayer."


Unless you use multi-line triggers, a trigger matches a single line.

You can probably get away with matching the partial line anyway. You already had regular expressions checked (which was a bit dubious because you should really put a backslash in front of things like periods). However this worked for me on your test case:


<triggers>
  <trigger
   enabled="y"
   ignore_case="y"
   match="^You say in a faint, raspy voice, &quot;Greetings Mhaldorians, your attendance "
   regexp="y"
   send_to="12"
   sequence="2050"
  >
  <send>DoAfter(2, "emote bows his head and crosses his hands calmly before him.")</send>
  </trigger>
</triggers>


The "^" means "match from the start of the line" and then you can just type in enough to make the trigger unique.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #6 on Fri 30 Oct 2009 04:51 AM (UTC)
Message
Since this looks like Achaea you're playing ('Mhaldorians' and such), what I would do is CONFIGURE SCREENWIDTH 0 to turn off wrapping, then in MUSHclient go to Game -> Configure -> Output and check the box next to "Wrap output at column number" near the bottom-right. Set the numeric field to 80 (or whatever you prefer your screenwidth to be). And uncheck "Indent paragraphs" on the right.

That should do nothing visibly to the output, but it basically shifts the line wrapping over from the server to the client. Long SAYs like the above, normally sent as two separate lines with a SCREENWIDTH of 80, would be sent as one single line. It really simplifies triggers.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[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.


6,315 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]