Cheers :D so now what I do is have say file.tcl say added in my config file and then put a .txt file say called file.tct in the scripts directory ? not managed to get it to work for me yte but I may be doing something wrong
Uhuh, ok I'll give it a go, currently got a little trouble with the bot itself atm, so going to have to re-install it or get it re-installed but will give it a go A.S.A.P Thanks again
[00:49] can't set "data(key1 )": variable isn't array
while executing
"set data($k) {} "
("foreach" body line 4)
invoked from within
"foreach t [split [read $f] \n] {
if {[string match !* $t]} {
set k [string range $t 1 e]
set data($k) {}
} {
..."
invoked from within
"if {![catch {set f [open file.txt]}]} {
foreach t [split [read $f] \n] {
if {[string match !* $t]} {
set k [string range $t 1 e] ..."
(file "scripts/info.tcl" line 2)
invoked from within
"source scripts/info.tcl"
(file "eggdrop.conf" line 1349)
[00:49] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
Seem to get that error now :S Not sure why it is showing that ... it's late here so maybe I have done somrthing completly wrong lol.
Loads now without crashing, but not able to get it to say anything when I type !key1 or (can I alter that too to another key?) Not sure I have the text file "file.txt" in the main directory and the tcl is set in config and is called info.tcl
array unset 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"
}
}
the file.txt is also in the bot directory just had it there too...
Sorted it is there a way I can alter things like have!get changed to !test for example? if not that's cool, I know I can change get to anything like another word so like !info chart for example. But it seems to work with those ones so far getting somewhere now
JoshuaUK wrote:Sorted it is there a way I can alter things like have!get changed to !test for example? if not that's cool, I know I can change get to anything like another word so like !info chart for example. But it seems to work with those ones so far getting somewhere now
So it could be just a trigger of !rules or !chart etc... just curious, sorry to be a pain lol I know I am being a pain to all you guys really,but fantastic that I can now actually call info from a text file in chat