| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 11, 2021 3:47 pm Post subject: |
|
|
| i also found if timer is running and nick is gone from channel it doesnt kill the running timer |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sat Dec 11, 2021 7:57 pm Post subject: |
|
|
Why do you add your if {[set thetimer ....} { killtimer xxxxx } in all procs ?
Just keep the if {[info exists ::ish($nick)]} { return } in proc auto:announcement, it will be ok when pple come out and in and regain hop.
And concerning the person out of the chan when timer runs... why catch unset ? The timer is killed if $nick is not on chan OR $nick is not halfop. With your catch, you first unset the "memory" timer ID and then try to use this variable to kill the timer.
I resume your code:
| Code: | # try to delete ::is($nick)
catch { unset ::ish($nick) }
# don't care if deleted or not, use it to kill the timer
killutimer $::ish($nick)
# probably an error, no ? |
_________________ 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 |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Dec 12, 2021 12:09 am Post subject: |
|
|
hi simo
remove:
catch { unset ::ish($nick) }
and look for this :
killutimer $::ish($nick)
change it to:
unset -nocomplain -- ::is($nick) _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Dec 12, 2021 9:33 am Post subject: |
|
|
| CrazyCat wrote: | Why do you add your if {[set thetimer ....} { killtimer xxxxx } in all procs ?
Just keep the if {[info exists ::ish($nick)]} { return } in proc auto:announcement, it will be ok when pple come out and in and regain hop.
And concerning the person out of the chan when timer runs... why catch unset ? The timer is killed if $nick is not on chan OR $nick is not halfop. With your catch, you first unset the "memory" timer ID and then try to use this variable to kill the timer.
I resume your code:
| Code: | # try to delete ::is($nick)
catch { unset ::ish($nick) }
# don't care if deleted or not, use it to kill the timer
killutimer $::ish($nick)
# probably an error, no ? |
|
the reason i added is in an ettempt to make sure if if halfopped nick has left channel to have the timer lifted and also to make sure if timer is running and halfopped nick rejoining channel and gets halfop again +h nick not to have a duplicate timer start again while there already was one running |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sun Dec 12, 2021 11:55 am Post subject: |
|
|
I understand, but it was already managed.
If you want to kill the previous timer and start a new one (to reinit the 10 minutes delay), just unset ::ish($target) if it exists.
Note that in your code (proc auto:announcement), you have an error:
| Code: | | if {[info exists ::ish($nick)]} { return } |
It's not $nick but $target _________________ 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: Sun Dec 12, 2021 12:51 pm Post subject: |
|
|
oh true thanks for the correction this is what i have so far
| Code: |
bind mode - "#% *+*h*" auto:announcement
proc auto:announcement {nick uhost handle chan mode target} {
if {[info exists ::ish($target)]} { 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) [utimer 10 [list repeat:announcement $chan $target] 0] }
}
proc repeat:announcement {chan nick} {
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 {
killutimer $::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 :[colors] $target [end][colors] show is done thank you [end][colors] $target [end][colors]for the nice show [end]"
killutimer $::ish($target)
}
}
|
it still seems to not remove timer if halfop nick has left channel |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Dec 12, 2021 1:00 pm Post subject: |
|
|
now i also get error:
| Quote: |
Tcl error [stop:announcement]: invalid timerID |
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Dec 12, 2021 3:31 pm Post subject: |
|
|
| Code: |
bind mode - "#% *+*h*" auto:announcement
proc auto:announcement {nick uhost handle chan mode target} {
if {[isbotnick $target] || ![string equal -nocase $chan "#test"]} { return }
if {[info exists ::ish($target)]} { return }
putserv "PRIVMSG $chan :$target is on air tune in to your radio"
set ::ish($target) [timer 10 [list repeat:announcement $chan $target] 0]
}
proc repeat:announcement {chan nick} {
if {[onchan $nick $chan] && [ishalfop $nick $chan]} {
putserv "PRIVMSG $chan :$nick is on air tune into your radio"
} else {
killtimer $::ish($nick)
unset ::ish($nick)
}
}
bind mode - "#% *-*h*" stop:announcement
proc stop:announcement {nick uhost handle chan mode target} {
if {[isbotnick $target] || ![string equal -nocase $chan "#test"]} { return }
if {![info exists ::ish($target)]} { return }
putserv "PRIVMSG $chan :$target show is done thank you $target for the nice show"
killtimer $::ish($target)
unset ::ish($target)
}
|
_________________ 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: Sun Dec 12, 2021 3:39 pm Post subject: |
|
|
ive loaded it and changed to utimer to test with not to have to wait minutes to see results
but when nick is de-halfopped or left channel the timer doesnt get removed tho |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Dec 12, 2021 3:42 pm Post subject: |
|
|
the repeat announcement doesnt seem to know what nicks to check for as it doesnt get feeded the nick after the first time nick is halfopped
perhaps if the nick is stored to be used by repeat annoucer it can do the checks |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Dec 12, 2021 3:45 pm Post subject: |
|
|
| perhaps the halfopped nick can be stored seperate in a var as well to be used by repeat announcement proc |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Dec 12, 2021 3:52 pm Post subject: |
|
|
| thanks for trying Spike^^ CrazyCat much apreciated |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Dec 12, 2021 4:22 pm Post subject: |
|
|
Maybe it's just a case issue with the array element name?
one last try...
| Code: |
bind mode - "#% *+*h*" auto:announcement
proc auto:announcement {nick uhost handle chan mode target} {
if {[isbotnick $target] || ![string equal -nocase $chan "#test"]} { return }
set tglow [string tolower $target]
if {[info exists ::ish($tglow)]} { return }
putserv "PRIVMSG $chan :$target is on air tune in to your radio"
set ::ish($tglow) [timer 10 [list repeat:announcement $chan $target] 0]
}
proc repeat:announcement {chan target} {
if {[onchan $target $chan] && [ishalfop $target $chan]} {
putserv "PRIVMSG $chan :$target is on air tune into your radio"
} else {
set tglow [string tolower $target]
killtimer $::ish($tglow)
unset ::ish($tglow)
}
}
bind mode - "#% *-*h*" stop:announcement
proc stop:announcement {nick uhost handle chan mode target} {
if {[isbotnick $target] || ![string equal -nocase $chan "#test"]} { return }
set tglow [string tolower $target]
if {![info exists ::ish($tglow)]} { return }
putserv "PRIVMSG $chan :$target show is done thank you $target for the nice show"
killtimer $::ish($tglow)
unset ::ish($tglow)
}
|
_________________ 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: Sun Dec 12, 2021 5:05 pm Post subject: |
|
|
| tested it same result thanks for the efforts u put into it tho Spike^^ and CrazyCat |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Dec 12, 2021 5:51 pm Post subject: |
|
|
OK, I bet I know what is going on:)
Let us assume that the recently added, infinitely repeating timer Does Not function as one might Hope and Expect it to....
| Code: |
bind mode - "#% *+*h*" auto:announcement
proc auto:announcement {nick uhost handle chan mode target} {
if {[isbotnick $target] || ![string equal -nocase $chan "#test"]} { return }
set tglow [string tolower $target]
if {[info exists ::ish($tglow)]} { return }
putserv "PRIVMSG $chan :$target is on air tune in to your radio"
#set ::ish($tglow) [timer 10 [list repeat:announcement $chan $target] 0]
set ::ish($tglow) [timer 10 [list repeat:announcement $chan $target]]
}
proc repeat:announcement {chan target} {
##
set tglow [string tolower $target]
if {[onchan $target $chan] && [ishalfop $target $chan]} {
putserv "PRIVMSG $chan :$target is on air tune into your radio"
##
set ::ish($tglow) [timer 10 [list repeat:announcement $chan $target]]
} else {
#killtimer $::ish($tglow)
unset ::ish($tglow)
}
}
bind mode - "#% *-*h*" stop:announcement
proc stop:announcement {nick uhost handle chan mode target} {
if {[isbotnick $target] || ![string equal -nocase $chan "#test"]} { return }
set tglow [string tolower $target]
if {![info exists ::ish($tglow)]} { return }
putserv "PRIVMSG $chan :$target show is done thank you $target for the nice show"
killtimer $::ish($tglow)
unset ::ish($tglow)
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
|