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
➜ Using a timer with a keybind
|
Using a timer with a keybind
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Eitelmj
(5 posts) Bio
|
| Date
| Wed 01 Jan 2020 04:24 AM (UTC) |
| Message
| Hi, I play on a star wars based mud which has timed skills, but expects you to know when that timer is up.
Is there a way to have a timer that starts on a specific keybind (eg like inputting slash)?
Or have a trigger that works on a timer having the start of the fight trigger the skill usage and then be put onto a timer from ther | | Top |
|
| Posted by
| Fiendish
USA (2,555 posts) Bio
Global Moderator |
| Date
| Reply #1 on Wed 01 Jan 2020 06:11 PM (UTC) Amended on Wed 01 Jan 2020 06:13 PM (UTC) by Fiendish
|
| Message
| |
| Posted by
| Eitelmj
(5 posts) Bio
|
| Date
| Reply #2 on Thu 02 Jan 2020 12:38 AM (UTC) |
| Message
| I'll dive into that and start seeing if I can understand it. I've never coded anything in my life.
IS there a way to stop it as well? Like could a trigger stop a timer? | | Top |
|
| Posted by
| Fiendish
USA (2,555 posts) Bio
Global Moderator |
| Date
| Reply #3 on Thu 02 Jan 2020 01:27 AM (UTC) |
| Message
| |
| Posted by
| Eitelmj
(5 posts) Bio
|
| Date
| Reply #4 on Thu 02 Jan 2020 07:31 AM (UTC) |
| Message
| I don't want to delete it. It needs to be used ongoing.
This is all just confusing me. | | Top |
|
| Posted by
| Fiendish
USA (2,555 posts) Bio
Global Moderator |
| Date
| Reply #5 on Thu 02 Jan 2020 08:00 AM (UTC) |
| Message
| | When you create the timer, if you don't set it as one-shot, then it keeps firing every N seconds (or whatever). Deleting it is the same as stopping it. |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #6 on Thu 02 Jan 2020 08:04 PM (UTC) Amended on Fri 03 Jan 2020 06:12 AM (UTC) by Nick Gammon
|
| Message
|
I don’t want to delete it. It needs to be used ongoing.
- Timers fire after a time has elapsed (eg. 30 seconds) or at a time of day (eg. 10:45 pm). This is the “AtTime” flag.
- Timers fire once or forever. If forever, then a periodical timer would fire after that interval continuously, eg. every 30 seconds. And a “AtTime” timer would fire at (say) 10:45 pm every day.
- Timers can be made “OneShot” (another flag used when creating them) which means they delete themselves when they fire. In this case, of course, they only fire once.
- Timers can be made “Temporary” (another flag) in which case they are not saved to the world file, and are lost when you close MUSHclient.
- Timers can be enabled and disabled (see the EnableTimer function). Disabled timers do not fire, but are not deleted.
- Timers can be reset (see the ResetTimer function). This makes them start the timing interval again. So, if you reset a 30-second timer, it will count for another 30 seconds.
- Timers can be deleted, before or after they fire (see the DeleteTimer function).
Script functions are documented here.
You don’t necessarily have to have dozens of timers. You could have one “heartbeat” timer that fires every second or so, and in that timer (script) consult a table of things (timed skills in your case) and see if the time has elapsed. If the time has elapsed display a message and remove the particular skill from the table, otherwise leave it there for the next heartbeat check.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Eitelmj
(5 posts) Bio
|
| Date
| Reply #7 on Thu 02 Jan 2020 08:53 PM (UTC) |
| Message
| This is what my triggers currently look like:
http://prntscr.com/qimfzx
It's essentially all based on messages that are returned from the MUD I'm playing on.
I have a skill called "Slash" which can be used every 4 seconds, however there is nothing returned from the MUD when it is available to be used again.
What I'm trying to accomplish is starting a time that will input "slash" every 4 seconds once combat is started, and stop once combat is ended.
I've never scripted or done anything like this before, so it's really really confusing to me what I'm looking at in the documentation.
I don't even know where I would input this? In triggers? In timers? Or if it's even possible.
Thank you ahead of time! | | Top |
|
| Posted by
| Fiendish
USA (2,555 posts) Bio
Global Moderator |
| Date
| Reply #8 on Thu 02 Jan 2020 10:33 PM (UTC) Amended on Thu 02 Jan 2020 10:37 PM (UTC) by Fiendish
|
| Message
|
Quote: I've never scripted or done anything like this before, so it's really really confusing to me what I'm looking at in the documentation.
That's why I said to first read the introduction to MUSHclient Scripting at https://mushclient.com/forum/?id=6030
After you've read that fully, search for "script directly in a trigger" and follow that using your triggers that detect the start and end of combat. |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #9 on Fri 03 Jan 2020 06:08 AM (UTC) Amended on Fri 03 Jan 2020 06:13 AM (UTC) by Nick Gammon
|
| Message
|
I don’t even know where I would input this? In triggers? In timers? Or if it’s even possible.
Virtually anything is possible.
Stop worrying, initially, about how to script. First make a plan. Imagine you are explaining your plan to a friend, in detail.
- When combat starts 1
- Do a “slash” 2
- Keep doing a slash every 4 seconds 3
- When combat ends 4
- Stop sending “slash” 5
Now turn that into scripting:
- How do you know combat starts? A certain message arrives from the MUD, presumably. So you probably need a trigger.
- Use the Send function to send a command to the MUD.
- Add a timer to send “slash” with an interval of 4 seconds. See AddTimer.
- How do you know combat ends? A certain message arrives from the MUD, presumably. So you probably need a trigger.
- In the trigger, delete the timer which is sending “slash”. See DeleteTimer
Script functions are documented here.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Eitelmj
(5 posts) Bio
|
| Date
| Reply #10 on Fri 03 Jan 2020 08:02 AM (UTC) |
| Message
| This actually helps a lot.
There's 2 ways combat start: Either by initiating it with a command or assissing.
Is there a way to write it so that it either starts because of a command input or a trigger?
I'm reaiding through the functions document and don't see anything that discusses that. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #11 on Fri 03 Jan 2020 10:56 AM (UTC) |
| Message
| If you initialize by command input then you want an alias which can:
- Send the command you want.
- Do other stuff like starting a timer.
|
- 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.
37,858 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top