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.

auto msg .

Help for those learning Tcl or writing their own scripts.
Post Reply
F
F|irT
Voice
Posts: 30
Joined: Thu Apr 30, 2015 11:23 pm
Location: Pakistan

auto msg .

Post by F|irT »

Code: Select all

# Set your channel
set send_chans "#sukoon" 

# Set Timer one line after X mins
set send_time "2"

# Set Your Messages. You can insert more messages caz is every X min an random message from the list..
set send_msg {
"Hello"
"How are u"
"what do u do"
"your are only mine"
} 

#########################################
#!!!!!!DO NOT EDIT AFTER THIS LINE!!!!!!#
#########################################

if {![string match "*time_send*" [timers]]} {
 timer $send_time time_send
}

proc time_send {} {
 global send_msg send_chans send_time
 if {$send_chans == "*"} {
  set send_temp [channels]
 } else {
  set send_temp $send_chans
 }
 foreach chan $send_temp {
  set send_rmsg [lindex $send_msg [rand [llength $send_msg]]]
 puthelp "PRIVMSG $chan :$send_rmsg" 
timer $send_time time_send
return 1
 }
 }
this is ok tcl working fine .. just need litel change on it it's playing msg randomly .. and like to be play by order ..

1st Hello
2nd How Are you
3rd what do u do
4th you are only mine

if any helper can help me for it . i will be so kind for him .

Thank u
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Auto message next line

Post by SpiKe^^ »

That will require that the script has some memory of what line it sent last...

Code: Select all

 # Set your channel 
 set send_chans "#sukoon" 

 # Set Timer one line after X mins 
 set send_time "2" 

 # Set Your Messages. You can insert more messages caz is every X min an random message from the list.. 
 set send_msg { 
 "Hello" 
 "How are u" 
 "what do u do" 
 "your are only mine" 
 } 

 ######################################### 
 #!!!!!!DO NOT EDIT AFTER THIS LINE!!!!!!# 
 ######################################### 

 if {![string match "*time_send*" [timers]]} { 
  timer $send_time time_send 
 } 

 # set a global variable to track the next line to say #
 if {![info exists send_next]} {  set send_next 0  }

 proc time_send {} { 
  global send_msg send_chans send_time send_next

  # save the msg line to say now #
  set nextline [lindex $send_msg $send_next]

  # and advance the global var to the next msg line number #
  incr send_next
  if {$send_next >= [llength $send_msg]} {  set send_next 0  }

  if {$send_chans == "*"} { 
   set send_temp [channels] 
  } else { 
   set send_temp $send_chans 
  } 
  foreach chan $send_temp { 

   puthelp "PRIVMSG $chan :$nextline" 

  } 

  # move the timer set and return to outside of the foreach loop #
  timer $send_time time_send 
  return 1 

 } 
 
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Post Reply