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.

Storage & Display

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

Both lines exist, they are pretty long though, maybe thats the problem?
Idling at #Football, Quakenet.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Football wrote:Both lines exist, they are pretty long though, maybe thats the problem?
I don't know if there is a limit or not. ... It is interesting.

Experiment.
With a variety of things.
But, if you feel that the length might be the problem, be sure to try a shorter line, and see what happens.

Or, it may require a real TCL guru, from around here, to look at what I've done, and tell us what the problem is.

But, the more experimenting you do, and carefully keeping track of what happens, could be useful info.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

Will definitely keep an eye on that, maybe it will write the line even if it didn't list it in the messages.

Will let you know if theres any progress
Idling at #Football, Quakenet.
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

Ah, willy, nice. :) You answered my question quite well, I may take another stab at this just for fun. Working it into private really isn't all that bad... you just have to make a variable for channels and then basically do the procs twice, again, with the correct binds for msg. As for it supporting multiple channels... I can do that for you now.

Where it says this in the procs:

Code: Select all

set phile [open $message_file "r"]
You'd need to make a new file named something different, then do:

Code: Select all

 if {$chan eq "#chan1"} {
set phile [open $message_file1 "r"]
 } else {
 set phile [open $message_file2 "r"]
 }
   
This would allow you to pick a file based on what chan you are requesting it from/for. So you could have smart file-switching. I do something similar in one of my procs where I need different files for each channel.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

Like this?

if {$chan eq "#Football"} {
set phile [open $message_file1 "r"]
}
if {$chan eq "#Football2"} {
set phile [open $messages_file2 "r"]
else {
set phile [open $message_file3"r"]
}


[/quote]
Idling at #Football, Quakenet.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Football wrote:Like this?

if {$chan eq "#Football"} {
set phile [open $message_file1 "r"]
}
if {$chan eq "#Football2"} {
set phile [open $messages_file2 "r"]
else {
set phile [open $message_file3"r"]
}

Wouldn't that require that you know, before you write the script, the names of every channel that you might ever use it in?

If so, then no - I'd prefer to not hardcode the names of channels into the script.
For what it is worth - I use arrays to hold the data, channel names, etc. ,
when I try to do something that is truly multi-channel.


I'm working on it, some. I haven't forgotten it. :)
If I have some success, I'll post it, and you'll be able to see how I did (attempted to do) it.

But don't hold your breath. It all depends on how much time I have to play with it.
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

Yeah, that's really only good if your bot is only floating in a few channels. In my case, I know what channels my bot will float in and may possibly float in in the future, so I can use a method like this without issue.

As for your code, you're close. If you wanted to do it that way, use an elseif in place of that second if:

Code: Select all

 
   if {$chan eq "#Football"} {
 set phile [open $message_file1]
  } elseif {$chan eq "#Football2"} {
 set phile [open $message_file2]
  } else {
 set phile [open $message_file3]
  }
Willy is probably right about arrays, but I haven't used them in any of my scripts yet and they all respond within two seconds or so, depending on irc lag, etc. So the speed is acceptable to me. Probably more proper to use arrays though.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Football wrote:Think I found an error...
From message #1 it jumped to #3, same from #3 to #5
...
I may have found it. Thanks for pointing it out.

Time will tell, as you continue to test and use it.
I'm about to post a newer version. Let me know if it continues to do it, or if it is fixed.

But, this version does a little more. :D
I think you'll be interesting in trying it out.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Here we go... :) ... Give this a try.

--Added binds and proc so you can use /msg.

--Is now multi-chan, with seperate message files on a per-channel basis.

I've run low on time today, and rather than hold onto it for further testing,
I'm hoping that you will thoroughly test it, and report back.
I have played with it, on a test bot, in two channels.
But, there are so many combinations of possibilities, no doubt that I've overlooked something.

Be sure to note the difference in the Config below: Now you set just the directory that holds the message files, and NOT the filename too.

Code: Select all

# August 4, 2010
# fixed : if {[botonchan $chan]} {	putserv "privmsg $chan : [join [lindex [split $data \n] $line_counter]] "}
#         ^^^^^^^^^^^^^^^^^^^^^ was not there       and it is possible for bot to NOT be in a channel, that has +announcer set
#
# moved the section that increments the line counter in proc run_announce, as it looked like it was incrementing for each chan
# not just for each run of run_announce
# changed the determination of number of lines in file, in case NO channels have +announcer set
#
# added more binds and proc, so that commands may be sent via  /msg


# Is now multi-chan, with seperate message files on a per-channel basis
   


        ###################
# August 3, 2010

# http://forum.egghelp.org/viewtopic.php?p=93728#93728


########################################################
#The public commands would be:
#!enable
#!disable
#!settimer
#!addmsg
#!delmsg
#!listmsg

#!timeron
#!timeroff
#!status
#!setline

#!enable - will enable the script in the current channel
#!disable - will disable the script in the current channel
#!status - will notify you whether the script is enabled or disabled
#!addmsg <message-here> and the bot will add it to his list
#!listmsg <number> - will list one message, from line #<number>
#!listmsg          - will list all the messages that were added to the bot
#!delmsg <message-number> - will erase that specific message
#!settimer <number of minutes> - Every X minutes the bot will display the messages by order; #1 and then X minutes later #2 and so on
#!settimer              will display the current setting.

#!timeroff Stops the timer for message display   (timer is ON, when bot starts )
#!timeron  Starts the timer for message display (without having to restart the bot)
#!setline <number>  Manually set the line number of the next displayed line
#!setline           will display current setting


###     Same commands work, via /msg, but many must include #channel as first word of msg
#
# Example:    /msg botnick !enable #channel
#
#    (  !timeron , !timeroff,  and   !settimer    via /msg do not require a #channel   ) 
#

####################################



##### Config
# Set the path and directory name for the directory that will hold message files.    Be sure to include the trailing forward slash.
set message_file_dir "scripts/"



# Set the default starting timer minutes. 
# This is the time that will be used after a restart, until a !settimer command is used to change it.
set timer_minutes 2

##### End Config



########### script begins here


bind pub - "!addmsg" addmsg
bind pub - "!listmsg" listmsg
bind pub - "!delmsg" delmsg
bind pub - "!settimer" settimer
bind pub - "!enable" enable
bind pub - "!disable" disable
bind pub - "!status" status
bind pub - "!timeroff" timer_off
bind pub - "!timeron" timer_on
bind pub - "!setline" setline

bind msg o "!addmsg" msg_addmsg
bind msg o "!listmsg" msg_listmsg
bind msg o "!delmsg" msg_delmsg
bind msg o "!settimer" msg_settimer         
bind msg o "!enable" msg_enable
bind msg o "!disable" msg_disable
bind msg o "!status" msg_status
bind msg o "!timeroff" msg_timer_off
bind msg o "!timeron" msg_timer_on
bind msg o "!setline" msg_setline



setudef flag announcer




## Check to see if script is loaded already, and if not, then start timer.
## The idea is to NOT start additional timers, after a rehash 
if {![info exists timer_announcer_loaded]} {
	set timer_announcer_loaded 1
    	timer $timer_minutes run_announce
   } 




## Sends one message to channel, every XX minutes, incrementing through stored messages.
proc run_announce {} {
global message_file_dir timer_minutes line_counter 

	
foreach chan [channels] {

   if {([lsearch -exact [channel info $chan] {+announcer}] != -1)} {

	if {![info exists line_counter($chan)]} {
		set line_counter($chan) 0
		}
	if {$line_counter($chan) < 0} {
		set line_counter($chan) 0
	     }
	if {![file exist $message_file_dir${chan}]} {
	    close [open $message_file_dir${chan} w]
         }
	

	set phile [open $message_file_dir${chan} "r"]
	set data [read -nonewline $phile] 
	close $phile

	#Check to see if the line number we are looking for, is greater than the actual number of lines in the message file
	#and if so, instead have it go to the last line
	if {[llength [split $data \n]]<=$line_counter($chan)} {
		set line_counter($chan) [expr [llength [split $data \n]] - 1]
		}

      #Display the line
	if {"[lindex [split $data \n] $line_counter($chan)]"!=""} {
		if {[botonchan $chan]} {	putserv "privmsg $chan : [join [lindex [split $data \n] $line_counter($chan)]] "}

      incr line_counter($chan)
	
	if {[llength [split $data \n]] <= $line_counter($chan)} {
		set line_counter($chan) 0
	  }

	   }
	 }
    }
   

# re-starts the timer, to run this proc again
timer $timer_minutes run_announce

}




## Allows line counter to be manually set
proc setline {nick uhost handle chan text} {
global line_counter

if {[string is integer -strict [join [lindex [split $text] 0]]]} {
	set line_counter($chan) [expr [lindex [split $text] 0] -1]
	putserv "notice $nick :Next line displayed in $chan will be line [expr $line_counter($chan) +1]"
	} else {
	putserv "notice $nick :Next line displayed in $chan will be line [expr $line_counter($chan) +1]"
  }
}

#Via MSG - setline
proc msg_setline {nick uhost handle text} {
global botnick line_counter


if {"$text"==""} {
		putserv "notice $nick :Syntax: /msg $botnick !setline #<channel> \[number\]"
		putserv "notice $nick :\[number\] is optional.  Without it, !setline will report only"
		return 0
	  }

set chan [lindex [split $text] 0]

  if {[validchan $chan]} {

	if {[string is integer -strict [join [lindex [split $text] 1]]]} {
		set line_counter($chan) [expr [lindex [split $text] 1] -1]
		putserv "notice $nick :Next line displayed in $chan will be line [expr $line_counter($chan) +1]"
		} else {
		putserv "notice $nick :Next line displayed in $chan will be line [expr $line_counter($chan) +1]"
  	}
  } else {
	putserv "notice $nick :$chan is not a valid channel on $botnick"
 }
}






##Allows timer delay to be changed via a pub command

proc settimer {nick uhost handle chan text} {
global timer_minutes

if {([lsearch -exact [channel info $chan] {+announcer}] != -1)} {

	if {"[lindex [split $text] 0]"==""} {
		putserv "notice $nick :Timer is set to $timer_minutes minutes"
		} elseif {"[lindex [split $text] 0]"<="0"} {
			putserv "notice $nick :No change. Timer must be set to a positive integer" 
		} else {
		set timer_minutes "[lindex [split $text] 0]"
		putserv "notice $nick :Timer will be set to $timer_minutes minutes"
		}
  }
}

# Via MSG - change timer delay
proc msg_settimer {nick uhost handle text} {
global timer_minutes

	if {"[lindex [split $text] 0]"==""} {
		putserv "notice $nick :Timer is set to $timer_minutes minutes"
		} elseif {"[lindex [split $text] 0]"<="0"} {
			putserv "notice $nick :No change. Timer must be set to a positive integer" 
		} else {
		set timer_minutes "[lindex [split $text] 0]"
		putserv "notice $nick :Timer will be set to $timer_minutes minutes"
		}

}




##Allows timer to be turned off via a pub command

proc timer_off {nick uhost handle chan text} {

if {([lsearch -exact [channel info $chan] {+announcer}] != -1)} {


	foreach thetimer [timers] {
		 if {[string match -nocase "run_announce*" [lindex $thetimer 1]]} {
	  # got a match
	  killtimer [lindex $thetimer 2]

	  putserv "notice $nick :Timed Announcer is off"
	
	  # killed the timerID which is the 3rd element of $thetimer.
	  break
	  # stopped since no need for further checks.
      	}
     }

# credit: http://forum.egghelp.org/viewtopic.php?p=53896#53896

  }
}

# Via MSG - timer off
proc msg_timer_off {nick uhost handle text} {

	foreach thetimer [timers] {
		 if {[string match -nocase "run_announce*" [lindex $thetimer 1]]} {
	  # got a match
	  killtimer [lindex $thetimer 2]

	  putserv "notice $nick :Timed Announcer is off"
	
	  # killed the timerID which is the 3rd element of $thetimer.
	  break
	  # stopped since no need for further checks.
      	}
     }
  }








## Allows timer to be turned on via a pub command

proc timer_on {nick uhost handle chan text} {

if {([lsearch -exact [channel info $chan] {+announcer}] != -1)} {

	if {"[timerexists run_announce]"==""} {
		run_announce
		putserv "notice $nick :Timed Announcer is on"
	}
   }
}

#Via MSG - timeron
proc msg_timer_on {nick uhost handle text} {

	if {"[timerexists run_announce]"==""} {
		run_announce
		putserv "notice $nick :Timed Announcer is on"
	}
  }





## Used by other procedure, to find out if a timer already exists
proc timerexists {command} {
  foreach i [timers] {
    if {![string compare $command [lindex $i 1]]} then {
      return [lindex $i 2]
	}
  }
  return
#credit:  from alltools.tcl
}







## Allows messages to be added via a pub command

proc addmsg {nick uhost handle chan text} {
global message_file_dir

if {([lsearch -exact [channel info $chan] {+announcer}] != -1)} {

	if {"$text"==""} {
		putserv "notice $nick :Syntax: !addmsg <message here..... >"
		return 0
	  }

	set phile [open $message_file_dir${chan} "r"]
	set first_line [gets $phile]
	close $phile
	if {"$first_line"==""} {
		set phile [open $message_file_dir${chan} "w"] 
		puts $phile "[lrange [split $text] 0 end]"
	     close $phile
		} else {
		set phile [open $message_file_dir${chan} "a"] 
		puts $phile "[lrange [split $text] 0 end]"
		close $phile
	   }
	
	putserv "notice $nick :Added:   \"[join [lrange [split $text] 0 end]]\" "
  }
}

# Via MSG - addmsg
proc msg_addmsg {nick uhost handle text} {
global botnick message_file_dir

set chan [lindex [split $text] 0]

if {"$text"==""} {
		putserv "notice $nick :Syntax: /msg $botnick !addmsg #<channel> <message here..... >"
		return 0
	  }

if {[validchan $chan]} {

	set phile [open $message_file_dir${chan} "r"]
	set first_line [gets $phile]
	close $phile
	if {"$first_line"==""} {
		set phile [open $message_file_dir${chan} "w"] 
		puts $phile "[lrange [split $text] 1 end]"
	     close $phile
		} else {
		set phile [open $message_file_dir${chan} "a"] 
		puts $phile "[lrange [split $text] 1 end]"
		close $phile
	   }
	
	putserv "notice $nick :Added:   \"[join [lrange [split $text] 1 end]]\" "
 } else {
	putserv "notice $nick :$chan is not a valid channel on $botnick"
 } 
}






## Will display all messages, in response to a pub command

proc listmsg {nick uhost handle chan text} {
global message_file_dir line_counter

if {([lsearch -exact [channel info $chan] {+announcer}] != -1)} {

	#Display one message via notice, only if a number is given with !listmsg - if no number given, then list all messages
	if {[string is integer -strict [join [lindex [split $text] 0]]]} {
		set phile [open $message_file_dir${chan} "r"]
		set data [read -nonewline $phile] 
		close $phile

		if {[llength [split $data \n]]>=[lindex [split $text] 0]} {
			putserv "notice $nick :[join [lindex [split $data \n] [expr [lindex [split $text] 0]-1]]]"
			} else {
			putserv "notice $nick :No such line"
		}

	return 0
	  }	


	set phile [open $message_file_dir${chan} "r"]
	set first_line [gets $phile]
	close $phile
	if {"$first_line"==""} {
		putserv "notice $nick : I got nothing"
		return 0
		}

	set lnum 0
	set phile [open $message_file_dir${chan} "r"]
	while {[gets $phile line] >= 0} {
		putserv "notice $nick :[incr lnum]: [join $line]"
		}
	close $phile
	#credit: Luminous

	
  }

}

# Via MSG - !listmsg
proc msg_listmsg {nick uhost handle text} {
global botnick message_file_dir line_counter

set chan [lindex [split $text] 0]

if {"$text"==""} {
	putserv "notice $nick :Syntax: /msg $botnick !listmsg #<channel> \[#\]"
	putserv "notice $nick :The number is optional. Without it, all messages are listed.  Include it, and only that message is displayed"
	return 0
    }

if {[validchan $chan]} {

	if {![file exists $message_file_dir${chan}]} {
		putserv "notice $nick :No message file exists yet, for $chan"
		putserv "notice $nick :The first time you use !enable to enable $chan, an empty message file will be created for $chan"
		
		return 0
       }

	#Display one message via notice, only if a number is given with !listmsg - if no number given, then list all messages
	if {[string is integer -strict [join [lindex [split $text] 1]]]} {
		set phile [open $message_file_dir${chan} "r"]
		set data [read -nonewline $phile] 
		close $phile

		if {[llength [split $data \n]]>=[lindex [split $text] 1]} {
			putserv "notice $nick :[join [lindex [split $data \n] [expr [lindex [split $text] 1]-1]]]"
			} else {
			putserv "notice $nick :No such line"
		}

	return 0
	  }	


	set phile [open $message_file_dir${chan} "r"]
	set first_line [gets $phile]
	close $phile
	if {"$first_line"==""} {
		putserv "notice $nick : I got nothing"
		return 0
		}

	set lnum 0
	set phile [open $message_file_dir${chan} "r"]
	while {[gets $phile line] >= 0} {
		putserv "notice $nick :[incr lnum]: [join $line]"
		}
	close $phile
	#credit: Luminous

  } else {
	putserv "notice $nick :[lindex [split $text] 0] is not a valid channel on $botnick"
   }
}










## Allows a message to be deleted (by message number, see !listmsg) via a pub command

proc delmsg {nick uhost handle chan text} {
global message_file_dir

if {([lsearch -exact [channel info $chan] {+announcer}] != -1)} {


	if {"$text"==""} {
		putserv "notice $nick :Syntax: !delmsg <number>"
		putserv "notice $nick :Use !listmsg     to get line numbers"
		return 0
		}

	
	set del_line_num [expr [lindex [split $text] 0] - 1 ]
	if {$del_line_num < 0} {
		putserv "notice $nick :No can do.  Must be 1 or greater."
		return 0
		}
	 

	set phile [open $message_file_dir${chan} r]
		set data [read -nonewline $phile] 
	close $phile

	set lines [split $data "\n"] 



     if {[llength $lines] <= $del_line_num} {
		putserv "notice $nick :No such line number"
		return 0
	   }
	putserv "notice $nick :Deleting:  [join [lindex $lines $del_line_num]]"
	putserv "notice $nick :      (use  !listmsg   again now, as you may have changed the line numbers!)"
	set lines [lreplace $lines $del_line_num $del_line_num]

	set phile [open $message_file_dir${chan} "w"]
		puts $phile [join $lines "\n"]
	close $phile

  }
}

# Via MSG - delmsg
proc msg_delmsg {nick uhost handle text} {
global botnick message_file_dir

set chan [lindex [split $text] 0]

	if {"$text"==""} {
		putserv "notice $nick :Syntax: !delmsg #<channel> <number>"
		putserv "notice $nick :Use !listmsg #<channel>    to get line numbers"
		return 0
		}

if {[validchan $chan]} {

	if {![file exists $message_file_dir${chan}]} {
		putserv "notice $nick :No message file exists yet, for $chan"
		putserv "notice $nick :The first time you use !enable to enable $chan, an empty message file will be created for $chan"
		
		return 0
       }

	
	set del_line_num [expr [lindex [split $text] 1] - 1 ]
	if {$del_line_num < 0} {
		putserv "notice $nick :No can do.  Must be 1 or greater."
		return 0
		}
	 

	set phile [open $message_file_dir${chan} r]
		set data [read -nonewline $phile] 
	close $phile

	set lines [split $data "\n"] 



     if {[llength $lines] <= $del_line_num} {
		putserv "notice $nick :No such line number"
		return 0
	   }
	putserv "notice $nick :Deleting:  [join [lindex $lines $del_line_num]]"
	putserv "notice $nick :      (use  !listmsg   again now, as you may have changed the line numbers!)"
	set lines [lreplace $lines $del_line_num $del_line_num]

	set phile [open $message_file_dir${chan} "w"]
		puts $phile [join $lines "\n"]
	close $phile

   } else {
	putserv "notice $nick :$chan is not a valid channel on $botnick"
   }	  	
}






## Will enable timed messages announcements in the channel where the pub command is sent

proc enable {nick uhost handle chan text} {
global message_file_dir

channel set $chan +announcer


if {([lsearch -exact [channel info $chan] {+announcer}] != -1)} {
	putserv "notice $nick :Timed Announcer enabled on $chan"
	
	if {![file exist $message_file_dir${chan}]} {
	 close [open $message_file_dir${chan} w]
	}
  }
	
}


# Via MSG - will enable timed message announcements in a channel

proc msg_enable {nick uhost handle text} {
global botnick

if {"[lindex [split $text] 0]"==""} {
	putserv "notice $nick :Syntax: /msg $botnick !enable #<channel>"
	return 0
   }
if {[validchan [lindex [split $text] 0]]} {
		enable $nick $uhost $handle [lindex [split $text] 0] -fillerFortext-
	} else {
		putserv "notice $nick :[lindex [split $text] 0] is not a valid channel on $botnick"
	}
}





## Will disable timed message announcements in the channel where the pub command is sent

proc disable {nick uhost handle chan text} {

if {([lsearch -exact [channel info $chan] {+announcer}] != -1)} {

	channel set $chan -announcer

     }

if {([lsearch -exact [channel info $chan] {-announcer}] != -1)} {
	putserv "notice $nick :Timed Announcer disabled on $chan"
	}
}


# Via MSG - will disable timed message announcements in a channel

proc msg_disable {nick uhost handle text} {
global botnick
if {"[lindex [split $text] 0]"==""} {
	putserv "notice $nick :Syntax: /msg $botnick !disnable #<channel>"
	return 0
   }

if {[validchan [lindex [split $text] 0]]} {
		disable $nick $uhost $handle [lindex [split $text] 0] -fillerFortext-
	} else {
		putserv "notice $nick :[lindex [split $text] 0] is not a valid channel on $botnick"
	}
}





## Send the status (enabled or disabled) to the channel where the pub command is given

proc status {nick uhost handle chan text} {

set time_left 0
foreach thetimer [timers] {
		 if {[string match -nocase "run_announce*" [lindex $thetimer 1]]} {
		 set time_left [lindex $thetimer 0]
		   }
      }

if {([lsearch -exact [channel info $chan] {+announcer}] != -1)} {
	
	putserv "notice $nick :Announcer is enabled in $chan."  
	if {$time_left} {putserv "notice $nick :Timer is running with $time_left minutes or less to go"}
	if !{$time_left} {putserv "notice $nick :Timer is not running"}
	} else {
	putserv "notice $nick :Timed Announcer is disabled in $chan"
	if {$time_left} {putserv "notice $nick :Timer is running with $time_left or less to go"}
	if !{$time_left} {putserv "notice $nick :Timer is not running"}
	}
}

# Via MSG -  status
proc msg_status {nick uhost handle text} {
global botnick

if {"[lindex [split $text] 0]"==""} {
	putserv "notice $nick :Syntax: /msg $botnick !status #<channel>"
	return 0
   }

if {[validchan [lindex [split $text] 0]]} {

	set time_left 0
	foreach thetimer [timers] {
		 if {[string match -nocase "run_announce*" [lindex $thetimer 1]]} {
		 set time_left [lindex $thetimer 0]
		   }
      }

	if {([lsearch -exact [channel info [lindex [split $text] 0]] {+announcer}] != -1)} {	
		putserv "notice $nick :Announcer is enabled in [lindex [split $text] 0]."  
		if {$time_left} {putserv "notice $nick :Timer is running with $time_left minutes or less to go"}
		if !{$time_left} {putserv "notice $nick :Timer is not running"}
	   } else {
		putserv "notice $nick :Timed Announcer is disabled in [lindex [split $text] 0]"
		if {$time_left} {putserv "notice $nick :Timer is running with $time_left or less to go"}
		if !{$time_left} {putserv "notice $nick :Timer is not running"}
	   } 
   } else {putserv "notice $nick :[lindex [split $text] 0] is not a valid chan on $botnick"
   }
}





putlog "Loaded Timed Announcer   :)     See: http://forum.egghelp.org/viewtopic.php?p=93728#93728 "



## Much credit goes to posters on the forum at   http://forum.egghelp.org/   
## Bits and pieces, and ideas used above - were borrowed from there.
## To anyone not specifically mentioned, I apologize.

## Any errors, broken code, poor code, or other strange things,  are not theirs.  They are mine.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

[11:31:01] <EPL> [08:31] Tcl error [proc:laina]: invalid command name "PRIVMSG #EPL-Staff :<Xabriel!Boca@MeSCh.users.quakenet.org>: !addmsg #EPL NEW #EPL Addon Uploaded! Date Release: July 20th. http://tinyurl.com/2wzoukk"

Not sure what the error is about...
Idling at #Football, Quakenet.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

Hey willyw, thanks for the hard work and reply again!


[11:31:01] <EPL> [08:31] Tcl error [proc:laina]: invalid command name "PRIVMSG #EPL-Staff :<Xabriel!Boca@MeSCh.users.quakenet.org>: !addmsg #EPL NEW #EPL Addon Uploaded! Date Release: July 20th. http://tinyurl.com/2wzoukk"

Not sure what the error is about...


[11:29:34] <EPL> [08:29] Tcl error [listmsg]: couldn't open "scripts/messages/#EPL": no such file or directory

Shouldn't it create the file when you try one of the commands?

[11:29:34] <EPL> [08:29] Tcl error [listmsg]: couldn't open "scripts/messages/#EPL": no such file or directory

Why is it #EPL and not #EPL.txt ?
Idling at #Football, Quakenet.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Football wrote:Hey willyw, thanks for the hard work and reply again!


[11:31:01] <EPL> [08:31] Tcl error [proc:laina]: invalid command name "PRIVMSG #EPL-Staff :<Xabriel!Boca@MeSCh.users.quakenet.org>:
It appears that something is calling "proc:laina", whatever that is.
It is not a procedure in my script.
If this is something that just started, then it is likely you've just installed another script, and it is in that script. If not, then you could comment out *all* scripts, and load them back one at a time, until you figure out which script it is in.


!addmsg #EPL NEW #EPL Addon Uploaded! Date Release: July 20th. http://tinyurl.com/2wzoukk"

Not sure what the error is about...
Neither am I. :)

[11:29:34] <EPL> [08:29] Tcl error [listmsg]: couldn't open "scripts/messages/#EPL": no such file or directory

Shouldn't it create the file when you try one of the commands?

[11:29:34] <EPL> [08:29] Tcl error [listmsg]: couldn't open "scripts/messages/#EPL": no such file or directory
I could have put in a check, in every command - yes.
I didn't.. I suppose it seems a bit redundant.

It does check for the existence of the file, and create it if not found - at two points.
One: if you use the !enable command to enable a channel.
Two: every time the run_announce procedure runs ... in other words, every time the timer triggers.

Thinking... I wonder just what would be the best, most efficient
times to check for the existence of them.
Why is it #EPL and not #EPL.txt ?
Because that is what I named it. :lol:
Seriously - would you like the files to be named with a .txt extentsion?
It should be easy to do.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Football wrote: ...
[11:29:34] <EPL> [08:29] Tcl error [listmsg]: couldn't open "scripts/messages/#EPL": no such file or directory

Shouldn't it create the file when you try one of the commands?

[11:29:34] <EPL> [08:29] Tcl error [listmsg]: couldn't open "scripts/messages/#EPL": no such file or directory

...
Do us a favor, please:

Try to duplicate the above, by adding new channels to the bot, and using !listmsg.
What I want to know is: When you did the above quoted, did you do it with !listmsg as a public command? ( I think you did, but want to confirm it)
Then, be sure to try it both ways. As public command, and :
/msg botnick !listmsg #channel
and let me know if it behaves differently, with the /msg method.

See... I had a quick look, and it appears I did put in a check, in the /msg method of the !listmsg command, and the bot should simply tell you that the file doesn't exist, and not error. This check does not actually create the file, just looks for it, and tells you if it is not there.
I guess I realized it should be there, as I was adding the procedure for the /msg method...
... and apparently I forgot to go back and put it in the public command method.

After you check it both ways, and are sure of the results - be sure to remember it and remind me - if we ever go over the script again, we can add it in the pub !listmsg command too.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

[17:53:20] -> *EPL* !timeron
[17:53:20] <EPL> [14:53] Tcl error [msg_timer_on]: can't set "line_counter(#EPL)": variable isn't array

[17:53:44] -> *EPL* !timeron #EPL
[17:53:45] <EPL> [14:53] Tcl error [msg_timer_on]: can't set "line_counter(#EPL)": variable isn't array
Idling at #Football, Quakenet.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

[17:56:43] -> *Football* !enable #football
[17:56:43] <Football> [14:56] Tcl error [msg_enable]: couldn't open "scripts/messages/#football": no such file or directory
[17:56:44] -Football- Timed Announcer enabled on #football
[17:56:49] -> *Football* !settimer 180
[17:56:50] -Football- Timer will be set to 180 minutes
[17:56:52] -> *Football* !timeron
[17:56:53] <Football> [14:56] Tcl error [msg_timer_on]: can't set "line_counter(#football)": variable isn't array
[17:56:56] -> *Football* !timeron #football
[17:56:56] <Football> [14:56] Tcl error [msg_timer_on]: can't set "line_counter(#football)": variable isn't array
[17:56:58] -> *Football* !addmsg #football hey
[17:56:58] <Football> [14:56] Tcl error
Idling at #Football, Quakenet.
Post Reply