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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Cr0ntab
Voice
Posts: 22 Joined: Fri Mar 26, 2010 11:31 am
Post
by Cr0ntab » Thu Apr 08, 2010 9:13 am
hello i would a rather simple script.
i would like to type in my channel .run 1.txt for example and the bot reads that .txt that is in the /scripts folder and it writes each line of the text on the channel that is triggered with a custom delay between each channel(the delay in seconds to be customised in the tcl)
Cr0ntab
Voice
Posts: 22 Joined: Fri Mar 26, 2010 11:31 am
Post
by Cr0ntab » Sun Apr 11, 2010 5:27 pm
someoneeeeeeee???
doggo
Halfop
Posts: 97 Joined: Tue Jan 05, 2010 7:53 am
Contact:
Post
by doggo » Tue Apr 27, 2010 8:07 am
this will check and read the last line of a .txt file every 1 second
or if you have the +n flag -lastline will force a check
might help with what you want to do
Code: Select all
# Rls: Auto_Read_txt.tcl v1.0
# Date: 27/04/10
# Coded by: doggo
# Contact: #alt.binaries.inner-sanctum@EFNET
###############################
bind pub n|n -lastline auto_req_read_proc
set pree_chan "#somewere"
set req_file "/home/doggo/news/mysql/auto_req.txt"
set insert_interval 1 #in seconds
set auto_req_file_mod 0
## Script Starts Here - DO NOT EDIT BELOW! ##
proc auto_req_timer { } {
global insert_interval
auto_req_read_proc
if {[string match *auto_req_timer* [utimers]] != 1} {
utimer $insert_interval auto_req_timer
}
}
proc auto_req_read_proc { } {
global pree_chan req_file auto_req_file_mod
set file_mtime [file mtime $req_file]
set file_handle [open $req_file r]
set get_data [split [read $file_handle] "\n"]
close $file_handle
set last_line [join [lindex $get_data end]]
if {$last_line == ""} {
set last_line [join [lindex $get_data end-1]]
}
if {$auto_req_file_mod != $file_mtime} {
putquick "PRIVMSG $pree_chan :\00306$last_line"
set auto_req_file_mod $file_mtime
}
}
if {[string match *auto_req_timer* [utimers]] != 1} {
utimer $insert_interval auto_req_timer
}
putlog "Auto_Read_txt.tcl v1.0 #alt.binaries.inner-sanctum"
Code: Select all
[12:41pm] <doggo> -lastline
[12:41pm] -tsara- this is the last line doggo :)