This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

HELP!! auto message code

Old posts that have not been replied to for several years.
Locked
i
inxs
Voice
Posts: 29
Joined: Fri Jun 10, 2005 5:33 am
Location: India

HELP!! auto message code

Post by inxs »

can anyone help me out!!.. i need a code that auto message channel every 5minutes to read text from text.db.

am just a newbies so i cant do it my own :D
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Why do you want it to read from a database? If you make list and read random replies from there it would be more easier.

Code: Select all

#Set the channel for this script to work on
set my_channel "#channel"

#Set the list of messages you want to display randomly
set my_list {
{ I am away }
{ Don't bother me. }
{ Go away }
{ Be back later }
{ Gone for dinner! }
}

#Set the interval delay of each message in minutes
set my_timer "5"


proc send:message {} {
 global my_list my_channel my_timer
  putserv "PRIVMSG $my_channel :[lindex $my_list [rand [llength $my_list]]]"
  timer $my_timer send:message
}

timer $my_timer send:message
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
i
inxs
Voice
Posts: 29
Joined: Fri Jun 10, 2005 5:33 am
Location: India

Post by inxs »

thx, awyeah
coz i want each lines to read within 5minutes.. line by line in 5minutes
:D
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

You might want to tweak it a bit, so you won't have several timers runnin when you rehash:

Code: Select all

#Set the channel for this script to work on 
set my_channel "#channel" 

#Set the list of messages you want to display randomly 
set my_list { 
{ I am away } 
{ Don't bother me. } 
{ Go away } 
{ Be back later } 
{ Gone for dinner! } 
} 

#Set the interval delay of each message in minutes 
set my_timer "5" 

proc send:message {} { 
 global my_list my_channel my_timer 
  putserv "PRIVMSG $my_channel :[lindex $my_list [rand [llength $my_list]]]" 
  timer $my_timer send:message 
} 

if {[timerexists send:message]!=""} { killtimer [timerexists send:message] }
timer $my_timer send:message
Locked