| View previous topic :: View next topic |
| Author |
Message |
Freakazoid Voice
Joined: 31 Jul 2005 Posts: 11
|
Posted: Sun May 27, 2007 3:20 pm Post subject: auto post advert |
|
|
| Code: | variable sql
variable libMySQLTcl "/usr/local/lib/mysqltcl-3.03/libmysqltcl3.03.so"
# SQL info
set sql(host) "localhost"
set sql(user) ""
set sql(pass) ""
set sql(db) ""
set sql(port) ""
## END CONF ##
set channel "#eTicker"
set time 30
if {[string compare [string index $time 0] "!"] == 0} { set timer [string range $time 1 end] } { set timer [expr $time * 60] }
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go }
proc go {} {
global sql libMySQLTcl
set sql(handle) [mysqlconnect -host $sql(host) -user $sql(user) -password $sql(pass) -db $sql(db) -port $sql(port)]
set query [::mysql::query $sql(handle) "SELECT werbung FROM advert ORDER BY DESC LIMIT 1 "]
while {[set row [::mysql::fetch $query]] != ""} {
set werbung [lindex $row 0]
global channel time text timer
foreach chan $channel {
putserv "PRIVMSG $chan :$werbung"
}
}
::mysql::endquery $query
mysqlclose $sql(handle)
}
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go }
|
why does work this script
1 time it will be work after rehash no more function from it
mfg freak |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun May 27, 2007 6:44 pm Post subject: |
|
|
Properly indenting the code would reveal that you don't call either timer or utimer within the proc, you also do not use the "time" binding..
Obviously, you will only execute "go" once...
Most likely, you've misunderstood the use of timer and utimer...
These allow you to delay the execution of some code, it will not repeat the execution multiple times... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Freakazoid Voice
Joined: 31 Jul 2005 Posts: 11
|
Posted: Sun May 27, 2007 9:13 pm Post subject: |
|
|
| oki ! |
|
| Back to top |
|
 |
Freakazoid Voice
Joined: 31 Jul 2005 Posts: 11
|
Posted: Mon Jun 04, 2007 8:48 am Post subject: |
|
|
i lost a line in the code
now it works
<<< pinky is
from pinky and the brain |
|
| Back to top |
|
 |
|