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
➜ Triggers that trigger again.
Triggers that trigger again.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Jlyrncher
(6 posts) Bio
|
Date
| Sat 04 Mar 2017 09:24 AM (UTC) |
Message
| So I'm trying to write some autotrain triggers for "Realms of Despair."
I would like to keep trying a command I have entered until success is achieved.
For example:
I enter "cast 'black hand' naga" but the spell fails and I recieve the response from RoD is "You lost your concentration."
I wrote a simple trigger to retry the last command:
<trigger
bold="y"
enabled="y"
keep_evaluating="y"
match="^You lost your concentration\.$"
match_bold="y"
regexp="y"
repeat="y"
send_to="12"
sequence="100"
>
<send>Send(GetCommand())</send>
</trigger>
The problem is it only triggers once. If the mud then responds to the input from the trigger with "You lost your concentration." the trigger will not fire again.
This should keep trying until the message "You lost your concentration." is NOT received as a response, but it only happens once.
I must be missing something. Any ideas?
Thanks. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 04 Mar 2017 10:06 AM (UTC) |
Message
| GetCommand() returns the current command in the command window which would probably be blank once you sent it.
You could probably use:
If you specify 1 as the argument you get the last command (actually a table with one entry). You could use that to find the last thing you sent.
Of course, if you type something else inbetween then that will be the last command.
You might make an alias the remembers the last thing you tried to do (eg. the spell you cast) and then your trigger can send that again. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Jlyrncher
(6 posts) Bio
|
Date
| Reply #2 on Tue 11 Apr 2017 09:55 PM (UTC) |
Message
| Thanks Nick. I'm sorry about the long delay in responding. I'm only a "sometimes" programmer. LOL.
I modified the triggers to something like this:
<trigger
enabled="y"
group="Mage"
keep_evaluating="y"
match="You lost your concentration."
send_to="12"
sequence="100"
>
<send>local Command = GetCommandList ( 1 )
Execute (Command [1])</send>
</trigger>
They still will not fire the second time though. Am I missing a setting or something?
Thanks! | Top |
|
Posted by
| Meerclar
USA (733 posts) Bio
|
Date
| Reply #3 on Sun 23 Apr 2017 06:01 AM (UTC) |
Message
|
<trigger
enabled="y"
group="Mage"
keep_evaluating="y"
match="You lost your concentration."
send_to="12"
sequence="100"
>
<send>(GetCommandList (1))</send>
</trigger>
Should do what you want. |
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org | Top |
|
Posted by
| Jlyrncher
(6 posts) Bio
|
Date
| Reply #4 on Fri 28 Apr 2017 04:25 PM (UTC) |
Message
| Thanks Meerclar
Sorry, but that doesn't work. The purpose of the local variable was because directly calling GetCommandList() returns the table ID not the value.
I'll keep working on it.
Thanks | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #5 on Sat 29 Apr 2017 05:07 AM (UTC) |
Message
|
<send>(GetCommandList (1))</send>
You would need to send it. eg.
<send>Send (GetCommandList (1))</send>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Jlyrncher
(6 posts) Bio
|
Date
| Reply #6 on Sat 29 Apr 2017 06:49 AM (UTC) |
Message
| So this if the current code:
<trigger
enabled="y"
group="Mage"
keep_evaluating="y"
match="You lost your concentration."
send_to="12"
sequence="100"
>
<send>Send (GetCommandList (1))</send>
</trigger>
And this is the current output:
Quote:
c farsight
You lost your concentration.
table: 00B57350
>Huh?
Remember, I'm only a part time programmer. Lua is new to me. I thought that a local variable was necessary. Am I incorrect?
Thanks again. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #7 on Sat 29 Apr 2017 10:05 AM (UTC) |
Message
| OK, this line returns a table with one entry:
<send>Send (GetCommandList (1))</send>
So change it to:
<send>Send (GetCommandList (1) [1])</send>
|
- 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.
24,808 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top