Code: Select all
# The list of channel ads to run (set to {} to disable this script) #
set prnl(msgs) {
1st example ad.
2nd example ad.
Next ad.
Last ad.
}
# The channels to msg: #chan1 #chan2 #etc (* = all channels) #
set prnl(chans) {*}
# The number of minutes between channel ads (1 or more minutes) #
set prnl(minutes) 5
###### END OF SETTINGS ######
set prnl(tmls) [split [string trim $prnl(msgs)] "\n"]
set prnl(msgs) ""
foreach prnl(tmit) $prnl(tmls) {
set prnl(tmit) [string trim $prnl(tmit)]
if {$prnl(tmit) ne ""} { lappend prnl(msgs) $prnl(tmit) }
}
unset prnl(tmls) prnl(tmit)
if {$prnl(msgs) eq ""} { return }
if {$prnl(chans) eq "*" || $prnl(chans) eq ""} { set prnl(chans) [channels] }
if {![info exists prnl(next)]} { set prnl(next) 0 }
if {![info exists prnl(timer)]} { set prnl(timer) [timer 2 [list prnl:rnext]] }
proc prnl:rnext {} { global prnl
if {$prnl(msgs) eq ""} { return }
foreach ch $prnl(chans) {
puthelp "PRIVMSG $ch :[lindex $prnl(msgs) $prnl(next)]"
}
incr prnl(next)
if {$prnl(next)>=[llength $prnl(msgs)]} { set prnl(next) 0 }
set prnl(timer) [timer $prnl(minutes) [list prnl:rnext]]
}
putlog "Public Read Next Line v1.1 loaded."
Code: Select all
# The list of channel ads to run (set to {} to disable this script) #
set prnl(msgs) {
1st example ad.
2nd example ad.
Next ad.
Last ad.
}
# The channels to msg: #chan1 #chan2 #etc (* = all channels) #
set prnl(chans) {*}
# The number of minutes between channel ads (1 or more minutes) #
set prnl(minutes) 5
# Read the lines in order or random (1=inorder || 2=random) #
set prnl(order) 2
###### END OF SETTINGS ######
set prnl(tmls) [split [string trim $prnl(msgs)] "\n"]
set prnl(msgs) ""
foreach prnl(tmit) $prnl(tmls) {
set prnl(tmit) [string trim $prnl(tmit)]
if {$prnl(tmit) ne ""} { lappend prnl(msgs) $prnl(tmit) }
}
unset prnl(tmls) prnl(tmit)
if {$prnl(msgs) eq ""} { return }
if {$prnl(chans) eq "*" || $prnl(chans) eq ""} { set prnl(chans) [channels] }
if {![info exists prnl(next)]} { set prnl(next) 0 }
if {![info exists prnl(timer)]} { set prnl(timer) [timer 2 [list prnl:rnext]] }
proc prnl:rnext {} { global prnl
if {$prnl(msgs) eq ""} { return }
if {$prnl(order)=="2"} { set prnl(next) [rand [llength $prnl(msgs)]] }
foreach ch $prnl(chans) {
puthelp "PRIVMSG $ch :[lindex $prnl(msgs) $prnl(next)]"
}
incr prnl(next)
if {$prnl(next)>=[llength $prnl(msgs)]} { set prnl(next) 0 }
set prnl(timer) [timer $prnl(minutes) [list prnl:rnext]]
}
putlog "Public Read Next Line v1.1 loaded."
Code: Select all
# The list of channel ads to run (set to {} to disable this script) #
set prnl(msgs) {
1st example ad.
2nd example ad.
Next ad.
Last ad.
}
# The channels to msg: #chan1 #chan2 #etc (* = all channels) #
set prnl(chans) {*}
# The number of minutes between channel ads (1 or more minutes) #
set prnl(min-lo) 5
# The number of minutes between channel ads (same or above min-lo) #
set prnl(min-hi) 10
# Read the lines in order or random (1=inorder || 2=random) #
set prnl(order) 2
###### END OF SETTINGS ######
set prnl(tmls) [split [string trim $prnl(msgs)] "\n"]
set prnl(msgs) ""
foreach prnl(tmit) $prnl(tmls) {
set prnl(tmit) [string trim $prnl(tmit)]
if {$prnl(tmit) ne ""} { lappend prnl(msgs) $prnl(tmit) }
}
unset prnl(tmls) prnl(tmit)
if {$prnl(msgs) eq ""} { return }
if {$prnl(chans) eq "*" || $prnl(chans) eq ""} { set prnl(chans) [channels] }
if {![info exists prnl(next)]} { set prnl(next) 0 }
if {![info exists prnl(timer)]} { set prnl(timer) [timer 2 [list prnl:rnext]] }
if {$prnl(min-hi)<$prnl(min-lo)} { set prnl(min-hi) $prnl(min-lo) }
proc prnl:rnext {} { global prnl
if {$prnl(msgs) eq ""} { return }
if {$prnl(order)=="2"} { set prnl(next) [rand [llength $prnl(msgs)]] }
foreach ch $prnl(chans) {
puthelp "PRIVMSG $ch :[lindex $prnl(msgs) $prnl(next)]"
}
incr prnl(next)
if {$prnl(next)>=[llength $prnl(msgs)]} { set prnl(next) 0 }
set randmin $prnl(min-lo)
if {$prnl(min-hi)>$prnl(min-lo)} {
incr randmin [rand [expr {$prnl(min-hi)-$prnl(min-lo)+1}]]
}
set prnl(timer) [timer $randmin [list prnl:rnext]]
}
putlog "Public Read Next Line v1.2 loaded."
To have the ads always on the same time interval, set min-lo & min-hi both to the same number of minutes.1. timer to use static/dynamric
The issue there is with a few tcl special characters.no working properly if in the quotes has [,],(,),%,&,!, .
Code: Select all
# set the route and file name of the channel ads file #
# make the ads file as a plain text document, 1 ad per file line #
set prnl(ad-file) "scripts/ad-file.txt"
# The channels to msg: #chan1 #chan2 #etc (* = all channels) #
set prnl(chans) {*}
# The minimum number of minutes between channel ads (1 or more minutes) #
set prnl(min-lo) 5
# The maximum number of minutes between channel ads (same or above min-lo) #
set prnl(min-hi) 10
# Read the lines in order or random (1=inorder || 2=random) #
set prnl(order) 2
###### END OF SETTINGS ######
set prnl(msgs) ""
if {![file exists $prnl(ad-file)]} { return }
set prnl(tm-open) [open $prnl(ad-file)]
while {![eof $prnl(tm-open)]} {
set prnl(tm-line) [string trim [gets $prnl(tm-open)]]
if {$prnl(tm-line) ne ""} {
lappend prnl(msgs) $prnl(tm-line)
}
}
close $prnl(tm-open)
unset prnl(tm-open) prnl(tm-line) prnl(ad-file)
if {$prnl(msgs) eq ""} { return }
if {$prnl(chans) eq "*" || $prnl(chans) eq ""} { set prnl(chans) [channels] }
if {![info exists prnl(next)]} { set prnl(next) 0 }
if {![info exists prnl(timer)]} { set prnl(timer) [timer 2 [list prnl:rnext]] }
if {$prnl(min-hi)<$prnl(min-lo)} { set prnl(min-hi) $prnl(min-lo) }
proc prnl:rnext {} { global prnl
if {$prnl(msgs) eq ""} { return }
if {$prnl(order)=="2"} { set prnl(next) [rand [llength $prnl(msgs)]] }
foreach ch $prnl(chans) {
puthelp "PRIVMSG $ch :[lindex $prnl(msgs) $prnl(next)]"
}
incr prnl(next)
if {$prnl(next)>=[llength $prnl(msgs)]} { set prnl(next) 0 }
set randmin $prnl(min-lo)
if {$prnl(min-hi)>$prnl(min-lo)} {
incr randmin [rand [expr {$prnl(min-hi)-$prnl(min-lo)+1}]]
}
set prnl(timer) [timer $randmin [list prnl:rnext]]
}
putlog "Public Read Next Line v1.3 loaded."
Code: Select all
# set the route and file name of the channel ads file #
# make the ads file as a plain text document, 1 ad per file line #
set prnl(ad-file) "scripts/ad-file.txt"
# The channels to msg: #chan1 #chan2 #etc (* = all channels) #
set prnl(chans) {*}
# The minimum number of minutes between channel ads (1 or more minutes) #
set prnl(min-lo) 5
# The maximum number of minutes between channel ads (same or above min-lo) #
set prnl(min-hi) 10
# Read the lines in order or random (1=inorder || 2=random) #
set prnl(order) 2
###### END OF SETTINGS ######
set prnl(msgs) ""
if {![file exists $prnl(ad-file)]} {
putlog "PRNL Error: Unable to find file: $prnl(ad-file)"
putlog "Public Read Next Line v1.4 NOT loaded!"
return
}
set prnl(tm-open) [open $prnl(ad-file)]
while {![eof $prnl(tm-open)]} {
set prnl(tm-line) [string trim [gets $prnl(tm-open)]]
if {$prnl(tm-line) ne ""} {
lappend prnl(msgs) $prnl(tm-line)
}
}
close $prnl(tm-open)
unset prnl(tm-open) prnl(tm-line) prnl(ad-file)
if {$prnl(msgs) eq ""} {
putlog "PRNL Error: No text in ad file: $prnl(ad-file)"
putlog "Public Read Next Line v1.4 NOT loaded!"
return
}
if {$prnl(chans) eq "*" || $prnl(chans) eq ""} { set prnl(chans) [channels] }
if {![info exists prnl(next)]} { set prnl(next) 0 }
if {![info exists prnl(timer)]} { set prnl(timer) [timer 2 [list prnl:rnext]] }
if {$prnl(min-hi)<$prnl(min-lo)} { set prnl(min-hi) $prnl(min-lo) }
proc prnl:rnext {} { global prnl
if {$prnl(msgs) eq ""} { return }
if {$prnl(order)=="2"} { set prnl(next) [rand [llength $prnl(msgs)]] }
foreach ch $prnl(chans) {
puthelp "PRIVMSG $ch :[lindex $prnl(msgs) $prnl(next)]"
}
incr prnl(next)
if {$prnl(next)>=[llength $prnl(msgs)]} { set prnl(next) 0 }
set randmin $prnl(min-lo)
if {$prnl(min-hi)>$prnl(min-lo)} {
incr randmin [rand [expr {$prnl(min-hi)-$prnl(min-lo)+1}]]
}
set prnl(timer) [timer $randmin [list prnl:rnext]]
}
putlog "Public Read Next Line v1.4 loaded."