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.

automsg chan

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Arnold_X-P
Master
Posts: 243
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

automsg chan

Post by Arnold_X-P »

good to all
this tcl sends msg to several channels in form random, the detail of error of the tcl is that spent the two hour provokes a mistake of time of mailing
example in partyline:

<(Kantuta> [10:31:01] Tcl error in script for 'timer6196':
<(Kantuta> [10:31:01] invalid command name ""

and once this mistake goes out the tcl stops working and does not throw any more msg phrases.
please someone who could help me.

Code: Select all

####### tcl ##############
### SPEAK ###  

set spoken.v "Auto talk"

## -=[ SPEAK ]=-  Set the next line as the channels you want to run in #
## for all channel just type "*" if only for 1 channel or 2 chnnel just #
## type "#channel1 #channel2"#
set speaks_chans "#beni #beni2 #pando #lapaz #cremacamba"

# Set you want in XXX minute you bot always talk on minute #
set speaks_time "8"

# Set the next lines as the random speaks msgs you want to say #
set speaks_msg {
"hi chat hi to all :) hi $chan"
"that so beautiful day, and that day is today."
"welcome to channel :D"
"remember that the mutual respect is always indispensable in the channel"
}

if {![string match "*time_speaks*" [timers]]} {
  timer $speaks_time time_speaks
}

proc time_speaks {} {
  global speaks_msg speaks_chans speaks_time

  if {$speaks_chans == "*"} {
    set speaks_temp [channels]
  } else {
    set speaks_temp $speaks_chans
  }

  foreach chan $speaks_temp {
    set speaks_rmsg [subst [lindex $speaks_msg [rand [llength $speaks_msg]]]]
    foreach msgline [split $speaks_rmsg \n] {
      putserv "PRIVMSG $chan :$msgline" 
    }
  }

  if {![string match "*time_speaks*" [timers]]} {
    timer $speaks_time time_speaks
  }
}
Last edited by Arnold_X-P on Wed Dec 10, 2014 2:54 pm, edited 1 time in total.
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
networks: DALnet #tcls ChatZona #tcl Libera.Chat #tcls
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

First off, you have no settings for channel or time.
Not sure why it's working at all:)
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

I see you fixed the above script some, adding the missing settings.
Since you say the script works for some hours before giving those strange timer errors,
I am fairly sure you are being trashed by the dreaded Eggdrop 1.6.21 timers/utimers bug.

The error starts when this line if code in proc time_speaks executes...

Code: Select all

if {![string match "*time_speaks*" [timers]]} { 
... and the badly flawed Eggdrop refuses to give an accurate list of running timers!

Try running your script on the 1.6.20 Eggdrop, which is the last good version in the 1.6 line, and does not come packaged with the bug.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Please try this

Post by SpiKe^^ »

Please try this, it does not include the [timers] command.

Code: Select all

############## Random Auto Talk tcl ver.0.1 ##############

## Set the next line as the channels you want to run in:  ##
## For all channels, just type "*"                        ##
## For only specific channels, type "#channel1 #channel2" ##
set speaks_chans "#beni #beni2 #pando #lapaz #cremacamba"

# Set the number of minutes between sending random lines: ##
set speaks_time "8"

## Set the text lines to send as Random Auto Talks: ##
##  ->   %c will be replaced by the channel name    ##

set speaks_msg {
Hi chat hi to all :) hi %c
That so beautiful day, and that day is today.
welcome to channel :D
Remember that the mutual respect is always indispensable in the channel
}

############## !! End Of Settings !! ##############

set speaks_msg [split [string trim $speaks_msg] "\n"]

if {![info exists speaks_running]} {
  set speaks_running 1
  timer $speaks_time [list time:speaks]
}

proc time:speaks {} {
  global speaks_chans speaks_msg

  if {$speaks_chans eq "*"} {
    set chanlist [channels]
  } else {
    set chanlist [split [string trim $speaks_chans]]
  }

  foreach {chan} $chanlist {
    set randmsg [lindex $speaks_msg [rand [llength $speaks_msg]]]
    puthelp "PRIVMSG $chan :[string map [list %c $chan] $randmsg]" 
  }

  timer $::speaks_time [list time:speaks]
}

putlog "Random Auto Talk tcl ver.0.1 loaded"

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
Arnold_X-P
Master
Posts: 243
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Re: automsg chan

Post by Arnold_X-P »

thanks SpiKe^^ for the help friend works of marvel
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
networks: DALnet #tcls ChatZona #tcl Libera.Chat #tcls
Post Reply