| View previous topic :: View next topic |
| Author |
Message |
digitalbleh Voice
Joined: 06 Jul 2011 Posts: 4 Location: Sydney
|
Posted: Mon Apr 26, 2021 5:49 am Post subject: privmsg nickname on a timer |
|
|
Hi,
Just want a simple script to send a msg to a person every 80 minutes. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Apr 26, 2021 9:48 am Post subject: |
|
|
Seems kind of rude to spam the same message to aPerson every 80 minutes, but here it is:)
| Code: |
proc timedMsgProc {} {
puthelp "PRIVMSG aPerson :send this msg to aPerson every 80 minutes"
timer 80 [list timedMsgProc]
}
if {![info exists timedMsgRunning]} {
set timedMsgRunning 1
timer 10 [list timedMsgProc]
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Apr 26, 2021 10:48 am Post subject: |
|
|
If anyone is willing to test a cron job like 20 */1 * * * (meaning at 20 minutes past the hour) let me know if works.
| Code: |
bind cron - {20 */1 * * *} send:message
proc send:message {min hour day month week} {
puthelp "PRIVMSG user :This is the once every 80 minutes message"
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Apr 26, 2021 11:37 am Post subject: |
|
|
Caesar: That seems a lot more like a 60 minute timer, at 20 after every hour. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Mon Apr 26, 2021 12:25 pm Post subject: |
|
|
*/1 or * are the same.
When using */x, it means it will run when * % x (modulo) equals 0.
Examples:
*/5 * * * * will act every time the minutes are 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
13 */7 * * * will act at 7h13, 14h13 and 21h13 _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
digitalbleh Voice
Joined: 06 Jul 2011 Posts: 4 Location: Sydney
|
Posted: Mon Apr 26, 2021 3:28 pm Post subject: |
|
|
Thanks SpiKe^^
Thank you caesar
I will test both scripts, im worried tho if i need to change the time to + or - 80mins i wont know how to change 20 */1. Id assume if its 90mins it would be 30 */1 ? |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Mon Apr 26, 2021 5:59 pm Post subject: |
|
|
| digitalbleh wrote: | | I will test both scripts, im worried tho if i need to change the time to + or - 80mins i wont know how to change 20 */1. Id assume if its 90mins it would be 30 */1 ? |
No.
20 */1 will send the message every hour, when minutes are 0, 20 and 40.
The code from SpiKe^^ seems more relevant _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Apr 27, 2021 2:22 am Post subject: |
|
|
Ah, right, i had a feeling a single cron job wouldn't do the job and it actually makes sense. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
heartbroken Op

Joined: 23 Jun 2011 Posts: 106 Location: somewhere out there
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat May 08, 2021 3:50 pm Post subject: |
|
|
anyway to have this as pub command ?
also anyway to display all running crons ? with the method heartbroken used |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat May 08, 2021 7:49 pm Post subject: |
|
|
| simo wrote: | ...
also anyway to display all running crons ?
...
|
From within the partyline, this is what I do:
.tcl binds cron _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat May 08, 2021 7:56 pm Post subject: |
|
|
| i tried that as well willyw but the method heartbroken is using doesnt show in the list on PL when using: .tcl binds cron |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun May 09, 2021 3:34 am Post subject: |
|
|
That's because it doesn't come from eggdrop's commands, but from tcllib, meaning it doesn't have an implementation to see them. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Fri May 28, 2021 5:53 am Post subject: |
|
|
A friend of mine remembers me that the (u)timer can have a count parameter (https://github.com/eggheads/eggdrop/blob/develop/doc/sphinx_source/mainDocs/tcl-commands.rst#timer-minutes-tcl-command-count)
if count equals 0, it will never end
| Code: | | .tcl timer 80 {putserv "PRIVMSG nick :hey!"} 0 |
Btw, I think I prefer using the cron package which allows to name the process and adds more flexibility. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
|