Gammon Forum
Entire forum
MUSHclient
General
DoAfter
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Mistrandir The White
(5 posts) bio
|
Date
| Wed 26 Apr 2006 01:51 AM (UTC) |
Message
| Alright, I know next to absoloutly nothing about scripting. I'm attempting to use a DoAfter, but I keep recieving an error.
Lets say I want to 'look' after I see 'You nod.' What would I put as a trigger? I've tried DoAfter 6, "look" as the send and You nod. as the trigger.
What I see is:
Error number: 0
Event: Compile error
Description: [string "Trigger: "]:1: `=' expected near `3'
Called by: Immediate execution
If this is unbelivebly easy, I give you permission to laugh, sneer, jest and make fun of me, just please help me fix the problem. | top |
|
Posted by
| Mistrandir The White
(5 posts) bio
|
Date
| Reply #1 on Wed 26 Apr 2006 04:40 AM (UTC) |
Message
| Alright, all I want is two scripts that does this:
Trigger:
You are successful at weaving a grass headband.
Send:
(seven seconds after)drop headband
(three seconds later)get grass
(two seconds latter)weave grass headband
and
Trigger:
You mess up while weaving a grass headband.
Send:
(five seconds later)get grass
(two secnds later)weave grass headband
I'm using Lua, and can change it if you want. | top |
|
Posted by
| Nick Gammon
Australia (22,982 posts) bio
Forum Administrator |
Date
| Reply #2 on Wed 26 Apr 2006 06:44 AM (UTC) Amended on Wed 26 Apr 2006 06:52 AM (UTC) by Nick Gammon
|
Message
| It helps if you paste your whole trigger in, see this post:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4776
I couldn't see how you got the error "`=' expected near `3'" when there is no "3" in your example. I guess you changed it from 3 to 6 at some stage?
Anyway, in Lua, function arguments need to be in brackets, unless you have a single string, or a table constructor, as the argument.
eg.
Note "hello" --> is ok
Note ("hello") --> also works
DoAfter (6, "look") --> must have brackets here
tprint {"a", "b", "c"} --> this works, argument is a table
tprint ({"a", "b", "c"}) --> also works
Note [[
I am doing a multi-line
note here and don't
need brackets ]]
The trigger which works for me is:
<triggers>
<trigger
enabled="y"
match="You nod."
send_to="12"
sequence="100"
>
<send>DoAfter (6, "look")</send>
</trigger>
</triggers>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Nick Gammon
Australia (22,982 posts) bio
Forum Administrator |
Date
| Reply #3 on Wed 26 Apr 2006 06:46 AM (UTC) |
Message
| For your second question, this is how I would do it:
<triggers>
<trigger
enabled="y"
match="You are successful at weaving a grass headband."
send_to="12"
sequence="100"
>
<send>
DoAfter (7, "drop headband")
DoAfter (10, "get grass")
DoAfter (12, "weave grass headband")
</send>
</trigger>
</triggers>
I'm sure you can work out the other one yourself. :) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Nick Gammon
Australia (22,982 posts) bio
Forum Administrator |
Date
| Reply #4 on Wed 26 Apr 2006 06:54 AM (UTC) |
Message
| The examples in the online documentation (which is identical to the help file) have the brackets. It is always useful to start with one of the examples there if you are getting syntax errors:
http://www.gammon.com.au/scripts/doc.php?function=DoAfter
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Mistrandir The White
(5 posts) bio
|
Date
| Reply #5 on Wed 26 Apr 2006 08:48 PM (UTC) |
Message
| Ah, you lost me right about when you said eg... but, luckily, I am smart enough to copy and paste, yet it dosen't seem to work. I copied and pasted the scripts directly from you, and it should have worked. I turned scripting off and got a echo from the client stating: Send-to-script cannot execute because scripting is not enabled. So, it should have worked. Nothing happened, however. I also tried putting diffrent times in, with little luck. | top |
|
Posted by
| Nick Gammon
Australia (22,982 posts) bio
Forum Administrator |
Date
| Reply #6 on Wed 26 Apr 2006 09:07 PM (UTC) |
Message
| Please show us your actual trigger by copying it from the trigger list and pasting here. Read this post:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4776
Quote:
I copied and pasted the scripts directly from you, and it should have worked
Can you be more specific? In what way did it not work? Error message? What was that message? Simply didn't work? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Mistrandir The White
(5 posts) bio
|
Date
| Reply #7 on Wed 26 Apr 2006 09:25 PM (UTC) |
Message
| <triggers>
<trigger
enabled="y"
match="You are successful at weaving a grass headband."
send_to="12"
sequence="100"
>
<send>DoAfter (7, "drop headband")
DoAfter (10, "get grass")
DoAfter (12, "weave grass headband")
</send>
</trigger>
</triggers>
<triggers>
<trigger
enabled="y"
match="You mess up while weaving a grass headband."
send_to="12"
sequence="100"
>
<send>DoAfter (5, "get grass")
DoAfter (7, "weave grass headband")
</send>
</trigger>
</triggers>
---
No error message... it just didn't respond to them at all. When I turned the scrip off, it did, however. | top |
|
Posted by
| Nick Gammon
Australia (22,982 posts) bio
Forum Administrator |
Date
| Reply #8 on Wed 26 Apr 2006 09:41 PM (UTC) |
Message
| So the trigger fires? Edit each one and you should see a "fire count" which is greater than zero.
Have you turned timers off in the timer configuration screen? DoAfter actually creates a temporary timer. If you have turned timers off then nothing will happen. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Mistrandir The White
(5 posts) bio
|
Date
| Reply #9 on Wed 26 Apr 2006 09:48 PM (UTC) |
Message
| Ah, that was it. I turned them on and about 100 lines of text hit me.
Thank you for your time, I appreciate it. | 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.
19,800 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
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.