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
➜ Lua
➜ require "wait"
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Ammanas
(8 posts) 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 | Top |
|
Posted by
| WillFa
USA (525 posts) 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.
| Top |
|
Posted by
| Ammanas
(8 posts) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,100 posts) 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 | Top |
|
Posted by
| Ammanas
(8 posts) 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, "Greetings Mhaldorians, your attendance is most appreciated. Before we begin, let us bow our heads in an opening prayer.""
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. | Top |
|
Posted by
| Nick Gammon
Australia (23,100 posts) 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, "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 | Top |
|
Posted by
| Twisol
USA (2,257 posts) 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 | 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,560 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top