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
➜ This is giving me some grief.
This is giving me some grief.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Spetz
(8 posts) Bio
|
Date
| Tue 01 Mar 2011 08:18 PM (UTC) |
Message
| I have made an autorescue trigger. My trigger works fine, but after some field testing I have run into the problem that I want to only try to rescue the person once every 5 seconds or so. This is due to my mud having lag penalties for rescue so if multiple people get attacked I end up trying to rescue each one about 5 times before I am out of lag from the first one.
I also have a trigger that automatically adds people to the variable "group". I can post it if you would like it.
Here is what I have:
<triggers>
<trigger
enabled="y"
expand_variables="y"
ignore_case="y"
keep_evaluating="y"
match="(?U)^(?!You)(.*) (attack|attacks) (strikes|strike|haven't hurt) (@!group) (?!you)(.*) (time|times), with * *."
name="Autorescue_1"
regexp="y"
sequence="100"
>
<send>rescue %4</send>
</trigger>
</triggers>
<triggers>
<trigger
enabled="y"
expand_variables="y"
ignore_case="y"
keep_evaluating="y"
match="(?U)^(?!You)(.*) attacks haven\'t hurt (@!group)\!$"
name="autorescue_2"
regexp="y"
sequence="100"
>
<send>rescue %2</send>
</trigger>
</triggers>
<triggers>
<trigger
enabled="y"
ignore_case="y"
match="^You fail to rescue (.*?) from"
name="I_Fail_Rescue"
regexp="y"
sequence="100"
>
<send>rescue %1</send>
</trigger>
</triggers>
Again really if my variable contains:
Mike|Fred|Jim
and Fred gets attacked I only want to send the rescue once. I considered building into the trigger a line that disabled the trigger and activated a timer for 5 seconds that would run once and re-enable the trigger. The problem with this is if another groupie gets attacked while the trigger is disabled I would not be able to get them.
Thanks for any input you could give me. | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #1 on Tue 01 Mar 2011 08:40 PM (UTC) |
Message
| What if you remove the name from the list, and set a timer for 5 seconds to add it back? |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #2 on Tue 01 Mar 2011 10:40 PM (UTC) |
Message
| Something like this will do it. You remember when you last rescued someone in a Lua table, and only do it again if 5 seconds have elapsed:
<triggers>
<trigger
enabled="y"
expand_variables="y"
ignore_case="y"
keep_evaluating="y"
match="(?U)^(?!You)(.*) attacks haven\'t hurt (@!group)\!$"
name="autorescue_2"
regexp="y"
send_to="12"
sequence="100"
>
<send>
recent = recent or {}
local who = "%2"
if not recent [who] or (recent [who] + 5 < os.time ()) then
Send ("rescue " .. who)
recent [who] = os.time ()
else
ColourNote ("green", "", "Recently rescued " .. who)
end -- if
</send>
</trigger>
</triggers>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Spetz
(8 posts) Bio
|
Date
| Reply #3 on Wed 02 Mar 2011 03:23 AM (UTC) |
Message
| Twisol,
I did not simply remove the name because I could not figure out how to.
Nick,
Thanks a bunch this seems to work (although I have not had any testing in battle just the simulator) and I am always amazed at how simple it really is once I see it. Also thanks for the quick response. | 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.
16,446 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top