hello, I would want to make so that my script pre.tcl spam news in IRC chan every 10 minutes. Unfortunately it does not make it, I I have tried various ways but I do not succeed to resolve it, if someone can help me, thanks in advance.
Davide Torino Italy.
This is the code:
### BINDS ###
#bind time - "00 * * * *" dlx:pretimes:scnsrc2
#bind time - "15 * * * *" dlx:pretimes:scnsrc2
#bind time - "30 * * * *" dlx:pretimes:scnsrc2
#bind time - "45 * * * *" dlx:pretimes:scnsrc2
bind pub - !pre dlx:pretimes:scnsrc
bind pub - !pred dlx:pretimes:scnsrc2
if {![info exists dlx:pretimes:scnsrc2_running]} {
timer 10 dlx:pretimes:scnsrc2
set dlx:pretimes:scnsrc2_running 1
}
# SCRIPT START
proc dlx:pretimes:scnsrc { nick host hand chan arg } {
global pre
set got_custom_number [regexp {\-n=([0-9]+)} $arg gothit custom_number]
if {$got_custom_number} { set arg [lrange $arg 1 end] }
set arg [string map { " " "%" } $arg]
set arg [string map { "*" "%" } $arg]
set urlEncodeArg [http::formatQuery search $arg]
if {([lsearch -exact $pre(availchans) $chan] == -1) && ($chan != "privmsg")} {return}
if {([lsearch -exact $pre(quietchans) $chan] != -1) || ($chan == "privmsg")} {set chan $nick}
if {$got_custom_number} {
set url "http://scnsrc.net/pre/bots.php?user=$pr ... tom_number"
} else {
set url "http://scnsrc.net/pre/bots.php?user=$pr ... lEncodeArg"
}
set page [http::data [http::geturl $url]]
if { $arg == "" } {
putquick "PRIVMSG $chan :Usage: !pre \[-n=number\]<keywords or releasename>"
} else {
if { $page == "Stay out." } {
putquick "PRIVMSG $chan :PREDB: Your account got revoked. Tough luck fool! This script is now useless!"
} else {
if { $page == "" } { putquick "PRIVMSG $chan :$pre(prefix) Got 0 hits to your query." } else {
foreach release [split $page "\n"] {
if { [string first "^" $release] != -1 } {
set item [split $release "^"]
set releasename [lindex $item 1]
set section [lindex $item 2]
set time [lindex $item 0]
set nuked [lindex $item 3]
set reason [lindex $item 4]
if { $nuked == "" } {
putquick "PRIVMSG $chan :\002 $pre(prefix) \002 $releasename was released $time ago in $section $arg"
} elseif { $nuked == "nuked" } {
putquick "PRIVMSG $chan :\002 $pre(prefix) \002 $releasename was released $time ago in $section. \0034 It was NUKED: $reason \003"
} elseif { $nuked == "unnuked" } {
putquick "PRIVMSG $chan :\002 $pre(prefix) \002 $releasename was released $time ago in $section. \0033 It was UNNUKED: $reason \003"
}
}
}
}
}
}
}
proc dlx:pretimes:scnsrc2 { nick host hand chan arg } {
global pre
set got_custom_number [regexp {\-n=([0-9]+)} $arg gothit custom_number]
if {$got_custom_number} { set arg [lrange $arg 1 end] }
set arg [string map { " " "%" } $arg]
set arg [string map { "*" "%" } $arg]
set ast *
set arg ast
puts [set $arg]
set urlEncodeArg [http::formatQuery search $arg]
if {([lsearch -exact $pre(availchans) $chan] == -1) && ($chan != "privmsg")} {return}
if {([lsearch -exact $pre(quietchans) $chan] != -1) || ($chan == "privmsg")} {set chan $nick}
if {$got_custom_number} {
set url "http://scnsrc.net/pre/bots.php?user=$pr ... tom_number"
} else {
set url "http://scnsrc.net/pre/bots.php?user=$pr ... lEncodeArg"
}
set page [http::data [http::geturl $url]]
if { $arg == "" } {
putquick "PRIVMSG $chan :Usage: !pre \[-n=number\]<keywords or releasename>"
} else {
if { $page == "Stay out." } {
putquick "PRIVMSG $chan :PREDB: Your account got revoked. Tough luck fool! This script is now useless!"
} else {
if { $page == "" } { putquick "PRIVMSG $chan :$pre(prefix) Got 0 hits to your query." } else {
foreach release [split $page "\n"] {
if { [string first "^" $release] != -1 } {
set item [split $release "^"]
set releasename [lindex $item 1]
set section [lindex $item 2]
set time [lindex $item 0]
set nuked [lindex $item 3]
set reason [lindex $item 4]
if { $nuked == "" } {
putquick "PRIVMSG $chan :\002 $pre(prefix) \002 $releasename was released $time ago in $section $arg"
} elseif { $nuked == "nuked" } {
putquick "PRIVMSG $chan :\002 $pre(prefix) \002 $releasename was released $time ago in $section. \0034 It was NUKED: $reason \003"
} elseif { $nuked == "unnuked" } {
putquick "PRIVMSG $chan :\002 $pre(prefix) \002 $releasename was released $time ago in $section. \0033 It was UNNUKED: $reason \003"
}
}
}
}
}
}
timer 10 dlx:pretimes:scnsrc2
return 1
}
# UPDATE CHECK
set url "http://www.scnsrc.net/pre/script_version.nfo"
set page [http::data [http::geturl $url]]
regexp {Latest@([0-9\.a-z]+)} $page gotlatest latest
regexp {URI@(.*)} $page goturi uri
regexp {Changelog@(.*)} $page gotlog changelog
if {$latest > $scnsrc_pre_version} {
putlog "scnsrc-pre New version out: v$latest (you have v$scnsrc_pre_version)"
putlog "scnsrc-pre Get it while its hot: $uri"
putlog "scnsrc-pre Changelog: $changelog"
} else {
putlog "scnsrc-pre loaded.. you just got pwned by dlx. and youre up to date (v$scnsrc_pre_version)"
}
# Change the putlog message and the world will end