I have a file with info in it that is added by users with !commands..
Would it be possible to make a small script that would read the five newest inputs in that file? (The newest are always at the bottom of the file)
For example !new , and it displays it in the channel u want it to.
The file im talking about is with lines and looks like this:
set yourfile "scripts/file.txt"
bind pub - !new show:new
proc show:new {nick uhost hand chan arg} {
global yourfile
foreach n [lrange [split [read [set f [open $yourfile]]] \n] end-4 end] {
puthelp "privmsg $chan :$n"
}
close $f
}
Ops, sorry that i posted in the wrong place
Sir_Fz , ty for your answer! but it didnt show anything in the channel.
I saved this into a empty .tcl file and loaded it in the eggdrop source/scripts.
HI I am trying to find a script which will allow me to add custom triggers and read lines from a text file, so for example !released0509 for example and it would announce so information not announcing it for everyone to see but only the person who requested it as a 'notice' in the channel they are in and it is set to... there may be something like this already just going to continue but this seems the closest I have seen so far.
normally, the trigger keywords would be constants and you specify what you want not by introducing a new trigger command but by supplying parameters to your command line which are interpreted by that command's handler proc in a certain way
Hmm not sure if there is such a script I found one called mc.readfile1.5.tcl.tcl not sure if it works or what, but not sure if anyone here would know how I could set up a script to say when someone types !rules it takes rules from a text file for example, so the info can be altered easily though a text file on the server.. one which I can have more than one trigger would be great.
Yeah I have looked into it, but I can't seem to get it to work, going to try again with it, but not sure if it will work, and not sure what I should search for! I looked for Trigger scripts, reading from text file etc.. and not really sure what it would come under.. I will try FAQ and rules etc.. and see
Right wel what I would like is to have a !Chart option !Rules and !srealses0509 !areleases0509 etc.. for music releases and I can just alter the trigger when I update and remove them and add new ones, and can modify new additions to the lists for each one everytime like the chart etc.. each week through a text file and just .rehash the bot
set data {}
if {![catch {set f [open file.txt]}]} {
foreach t [split [read $f] \n] {
if {[string match !* $t]} {
set k [string range $t 1 e]
set data($k) {}
} {
lappend data($k) $t
}
}
close $f
}
bind pub - !get foo
proc foo {n u h c t} {
if {[info exists ::data($t)]} {
foreach e $::data($t) {puthelp "notice $n :$e"}
} {
puthelp "notice $n :no data found for $t"
}
}