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 

automsg chan

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


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Mon Dec 01, 2014 8:23 pm    Post subject: automsg chan Reply with quote

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:
####### 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
  }
}

_________________
Very Happy thanks to that they help, that others learn Very Happy


Last edited by Arnold_X-P on Wed Dec 10, 2014 2:54 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Mon Dec 01, 2014 9:47 pm    Post subject: Reply with quote

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
.
Back to top
View user's profile Send private message Visit poster's website
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Wed Dec 10, 2014 11:07 pm    Post subject: Reply with quote

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:
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
.
Back to top
View user's profile Send private message Visit poster's website
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sun Dec 14, 2014 2:10 pm    Post subject: Please try this Reply with quote

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

Code:

############## 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
.
Back to top
View user's profile Send private message Visit poster's website
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Dec 14, 2014 2:36 pm    Post subject: Re: automsg chan Reply with quote

thanks SpiKe^^ for the help friend works of marvel
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
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