| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 10:17 am Post subject: Auto announcement every 10 min after nick gets halfop |
|
|
anyway to have this code announce a message after a nick gets halfopped +h
nick on channel and have every 10 min check if that nick is still halfop and if so to announce again and if nick gets dropped as halfop -h nick to stop the every 10 minute check
not sure if a bind cron is best or bind time or a timer for this and after nick is dehalfopped -h nick to unbind the bind cron / bind time or kill specific timer
| Code: |
bind mode - "#% *+*h*" auto:announcement
proc auto:announcement {nick uhost handle chan mode target} {
if {($target != $::botnick) && [string equal -nocase $chan "#channel"]} {
putserv "privmsg $chan :$target is on air tune in to your radio"
}
}
bind mode - "#% *-*h*" StopAuto:announcement
proc StopAuto:announcement {nick uhost handle chan mode target} {
if {($target != $::botnick) && [string equal -nocase $chan "#channel"]} {
putserv "privmsg $chan :$target show is done thank you $target for the nice show"
}
}
|
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sat Dec 11, 2021 11:11 am Post subject: |
|
|
Not tested, but may work
| Code: | bind mode - "#% *+*h*" auto:announcement
proc auto:announcement {nick uhost handle chan mode target} {
if {($target != $::botnick) && [string equal -nocase $chan "#channel"]} {
putserv "PRIVMSG $chan :$target is on air tune in to your radio"
set ::ish($target) [list timer 10 [repeat:announcement $chan $target] 0]
}
}
proc repeat:annoucement {chan nick} {
if {![info exists ::ish($nick)]} { return }
if {[onchan $nick $chan] && [ishalfop $nick $chan]} {
putserv "PRIVMSG $chan :$nick is alway on air tune into your radio"
} else {
killtimer $::ish($nick)
}
}
bind mode - "#% *+*h*" stop:announcement
proc stop:announcement {nick uhost handle chan mode target} {
if {![info exists ::ish($nick)]} { return }
if {($target != $::botnick) && [string equal -nocase $chan "#channel"]} {
putserv "PRIVMSG $chan :$target show is done thank you $target for the nice show"
killtimer $::ish($nick)
}
} |
_________________ 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 |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 11:23 am Post subject: |
|
|
thank you CrazyCat for the swift response i tested it and i get this error:
| Quote: |
Tcl error [auto:announcement]: invalid command name "repeat:announcement" |
also i changed the :
bind mode - "#% *+*h*" stop:announcement
to
bind mode - "#% *-*h*" stop:announcement |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 11:24 am Post subject: |
|
|
this is what i have so far:
| Code: |
bind mode - "#% *+*h*" auto:announcement
proc auto:announcement {nick uhost handle chan mode target} {
if {($target != $::botnick) && [string equal -nocase $chan "#test"]} {
putserv "PRIVMSG $chan :$target is on air tune in to your radio"
set ::ish($target) [list timer 1 [repeat:announcement $chan $target] 0]
}
}
proc repeat:annoucement {chan nick} {
if {![info exists ::ish($nick)]} { return }
if {[onchan $nick $chan] && [ishalfop $nick $chan]} {
putserv "PRIVMSG $chan :$nick is alway on air tune into your radio"
} else {
killtimer $::ish($nick)
}
}
bind mode - "#% *-*h*" stop:announcement
proc stop:announcement {nick uhost handle chan mode target} {
if {![info exists ::ish($nick)]} { return }
if {($target != $::botnick) && [string equal -nocase $chan "#test"]} {
putserv "PRIVMSG $chan :$target show is done thank you $target for the nice show"
killtimer $::ish($nick)
}
}
|
|
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 11:34 am Post subject: |
|
|
i changed the :
set ::ish($target) [list timer 1 [repeat:announcement $chan $target] 0]
into
set ::ish($target) [list timer 1 [list repeat:announcement $chan $target] 0]
but it didnt seem to work as well |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sat Dec 11, 2021 11:49 am Post subject: |
|
|
Well, there is 2 errors in my proc stop:announcement, I use "$nick" when I've to use "$target"
| Code: | proc stop:announcement {nick uhost handle chan mode target} {
if {![info exists ::ish($target)]} { return }
if {($target != $::botnick) && [string equal -nocase $chan "#test"]} {
putserv "PRIVMSG $chan :$target show is done thank you $target for the nice show"
killtimer $::ish($target)
}
} |
Now, "it didnt seem to work as well" is not enough to help you. What is working, what is not working, show the logs and errors, add debug log, ... _________________ 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 |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 11:57 am Post subject: |
|
|
oh yea sorry what i meant was the timer doesnt get set
errors :
| Quote: |
Tcl error [stop:announcement]: argument is not a timerID |
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Dec 11, 2021 12:10 pm Post subject: |
|
|
| Code: | | set ::ish($target) [timer 1 [list repeat:announcement $chan $target] 0] |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 12:15 pm Post subject: |
|
|
thanks for the reply Spike^^ i tried that and got error
| Quote: | Tcl error in script for 'timer364':
invalid command name "repeat:announcement"
|
| Code: |
bind mode - "#% *+*h*" auto:announcement
proc auto:announcement {nick uhost handle chan mode target} {
if {($target != $::botnick) && [string equal -nocase $chan "#test"]} {
putserv "PRIVMSG $chan :$target is on air tune in to your radio"
set ::ish($target) [utimer 10 [list repeat:announcement $chan $target] 0] }
}
proc repeat:annoucement {chan nick} {
if {![info exists ::ish($nick)]} { return }
if {[onchan $nick $chan] && [ishalfop $nick $chan]} {
putserv "PRIVMSG $chan :$nick is on air tune into your radio"
} else {
killtimer $::ish($nick)
}
}
bind mode - "#% *-*h*" stop:announcement
proc stop:announcement {nick uhost handle chan mode target} {
if {![info exists ::ish($target)]} { return }
if {($target != $::botnick) && [string equal -nocase $chan "#test"]} {
putserv "PRIVMSG $chan :$target show is done thank you $target for the nice show"
killtimer $::ish($target)
}
}
|
|
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 12:15 pm Post subject: |
|
|
changed timer to this to test with not to have to wait minutes:
| Quote: | | set ::ish($target) [utimer 10 [list repeat:announcement $chan $target] 0] } |
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Dec 11, 2021 12:20 pm Post subject: |
|
|
fix the spelling @ proc repeat:annoucement _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 12:27 pm Post subject: |
|
|
thanks spike^^ that seems to do it
thanks CrazyCat |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sat Dec 11, 2021 1:37 pm Post subject: |
|
|
| SpiKe^^ wrote: | | Code: | | set ::ish($target) [timer 1 [list repeat:announcement $chan $target] 0] |
|
Woops, did I add an extra list ? Yes, I did it again
Thanks SpiKe^^  _________________ 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 |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 3:13 pm Post subject: |
|
|
after using the code i found if the halfopped nick leaves channel for whatever reason and joins channel back and gets halfopped again +h nick
it basically sets 2 timers doing the same thing it doests check for timer already existing to prevent duplicate timers set |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 3:40 pm Post subject: |
|
|
from a similar code Spike^^ wrote i tried this wich seems to work altho not sure if proper:
| Code: |
bind mode - "#% *+*h*" auto:announcement
proc auto:announcement {nick uhost handle chan mode target} {
if {[set thetimerzq [timerexists "repeat:annoucement $chan $target"]]!=""} { killtimer $thetimerzq }
if {[info exists ::ish($nick)]} { return }
if {($target != $::botnick) && [string equal -nocase $chan "#test"]} {
putserv "PRIVMSG $chan :[colors] $target [end][colors] is on air tune into your radio [end]"
set ::ish($target) [timer 15 [list repeat:annoucement $chan $target] 0] }
}
proc repeat:annoucement {chan nick} {
if {[set thetimerq [timerexists "repeat:annoucement $chan $nick"]]!=""} { killtimer $thetimerq }
if {![info exists ::ish($nick)]} { return }
if {[onchan $nick $chan] && [ishalfop $nick $chan]} {
putserv "PRIVMSG $chan :[colors] $nick [end][colors] is on air tune into your radio [end]"
} else {
catch { unset ::ish($nick) }
killutimer $::ish($nick)
}
}
bind mode - "#% *-*h*" stop:announcement
proc stop:announcement {nick uhost handle chan mode target} {
if {[set thetimerXXz [timerexists "repeat:annoucement $chan $target"]]!=""} { killtimer $thetimerXXz }
if {![info exists ::ish($target)]} { return }
if {($target != $::botnick) && [string equal -nocase $chan "#test"]} {
putserv "PRIVMSG $chan :[colors] $target [end][colors] show is done thank you [end][colors] $target [end][colors]for the nice show [end]"
killtimer $::ish($target)
}
}
|
|
|
| Back to top |
|
 |
|