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 Voice after Certain lines in Certain Time

Help for those learning Tcl or writing their own scripts.
Post Reply
R
Romeyo
Voice
Posts: 12
Joined: Tue Nov 01, 2005 10:56 am

Auto Voice after Certain lines in Certain Time

Post by Romeyo »

I have modified the auto voice after talking some lines. And added udef flag for matching channels and unset the variable after voicing them but i am getting error... The script is as follows:

Code: Select all

# Set Number of lines for the bot to voice
set vline 4
# Set in max number of seconds here.
set vsec 25

setudef flag voice

bind pubm - * voice:user
proc voice:user {nick uhost hand chan arg} {
global actvoice vline vsec
  if {([isop $nick $chan]) || ([isvoice $nick $chan])} {return 0}
  if {[lsearch -exact [channel info $chan] +voice] == -1} {return 0}
  if {![info exists actvoice([string tolower $nick])]} { set actvoice([string tolower $nick]) 0 }
  incr actvoice([string tolower $nick])
  utimer $vsec [list incr actvoice([string tolower $nick]) -1]
  if {$actvoice([string tolower $nick]) >= $vline} {
    putserv "MODE $chan +v $nick"
    unset actvoice([string tolower $nick])
 }
}
the error i am getting from the bot in party line after voicing is as follows:
[12:29] #THRRaaga: mode change '+v Romeyo' by THRraaga!rakesh@stand.up.for.the.mast3r.com
[12:29] Tcl error in script for 'timer366':
[12:29] can't read "actvoice(romeyo)": no such element in array
[12:29] Tcl error in script for 'timer367':
[12:29] can't read "actvoice(romeyo)": no such element in array
[12:29] Tcl error in script for 'timer368':
[12:29] can't read "actvoice(romeyo)": no such element in array
[12:30] Tcl error in script for 'timer369':
[12:30] can't read "actvoice(romeyo)": no such element in array
Help me...
Thanks... :)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you unset the array element which you later try to decrement in [utimer]

some tips:
  • don't use [lsearch] on [channel info], use [channel get]
  • don't use [putserv], use [pushmode]; it will automatically pack several modes on single line as necessary
  • your script logic is flawed; get rid of [utimer] and vline, you don't use those correctly anyway
in general, your script (even properly implemented) is useless; voicing someone who can speak already is pointless
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
Post Reply