| View previous topic :: View next topic |
| Author |
Message |
JoshuaUK Voice
Joined: 07 Aug 2005 Posts: 24
|
Posted: Mon Sep 12, 2005 6:28 pm Post subject: |
|
|
Cheers  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 |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Mon Sep 12, 2005 8:39 pm Post subject: |
|
|
| the .txt file must be in bot's main directory, not in scripts directory |
|
| Back to top |
|
 |
JoshuaUK Voice
Joined: 07 Aug 2005 Posts: 24
|
Posted: Tue Sep 13, 2005 5:20 am Post subject: |
|
|
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  |
|
| Back to top |
|
 |
JoshuaUK Voice
Joined: 07 Aug 2005 Posts: 24
|
Posted: Tue Sep 13, 2005 7:52 pm Post subject: |
|
|
[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. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Sep 13, 2005 8:16 pm Post subject: |
|
|
There's already a variable called data on your bot, thus you can't use it as an array. Replace data with some other array name. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Sep 13, 2005 9:48 pm Post subject: |
|
|
| Sir_Fz wrote: | | There's already a variable called data on your bot, thus you can't use it as an array. Replace data with some other array name. |
nah... actually I'm initializing data incorrectly
JoshuaUK, substitute first line of the script with array unset data |
|
| Back to top |
|
 |
JoshuaUK Voice
Joined: 07 Aug 2005 Posts: 24
|
Posted: Wed Sep 14, 2005 4:03 pm Post subject: |
|
|
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
This is the code..
| Code: |
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... |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Wed Sep 14, 2005 4:24 pm Post subject: |
|
|
I didn't say !key1, I said !get key1
if you are not sure if you have a particular file in a particular directory, you shouldn't be running eggdrop
and key1 is a placeholder for your actual key (0509, Rules, Chart or whatever), it couldn't be more obvious than that |
|
| Back to top |
|
 |
JoshuaUK Voice
Joined: 07 Aug 2005 Posts: 24
|
Posted: Wed Sep 14, 2005 4:46 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
JoshuaUK Voice
Joined: 07 Aug 2005 Posts: 24
|
Posted: Fri Sep 16, 2005 11:16 am Post subject: |
|
|
| 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  |
|
| Back to top |
|
 |
|