egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

auto post advert

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Freakazoid
Voice


Joined: 31 Jul 2005
Posts: 11

PostPosted: Sun May 27, 2007 3:20 pm    Post subject: auto post advert Reply with quote

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 Sad
1 time it will be work after rehash no more function from it


mfg freak
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun May 27, 2007 6:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
Freakazoid
Voice


Joined: 31 Jul 2005
Posts: 11

PostPosted: Sun May 27, 2007 9:13 pm    Post subject: Reply with quote

oki !
Back to top
View user's profile Send private message
Freakazoid
Voice


Joined: 31 Jul 2005
Posts: 11

PostPosted: Mon Jun 04, 2007 8:48 am    Post subject: Reply with quote

i lost a line in the code Very Happy
now it works Wink
<<< pinky is Wink
from pinky and the brain
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber