| View previous topic :: View next topic |
| Author |
Message |
Artificial Voice
Joined: 10 May 2007 Posts: 3
|
Posted: Thu May 10, 2007 11:37 pm Post subject: All Scripts Executing |
|
|
I have experienced an odd issue with eggdrop 1.6.18. Besides this one issue the bot operates flawlessly. The problem is that nearly every script in the /scripts directory is executed. Currently 84 scripts reside in that directory (as the result of heavy tweaks and shifting interests over the years) and 82 are initialized!
The config file currently in use has at most 1/2 of those (usually a 1/3rd) loaded at any one time. What is alarming is scripts not enabled (or listed!) in the current bot config file are being executed. I noticed in the console log following the "Initialising Scripts" line:
Current search path:
scripts
Followed by a list of all of the scripts in the /scripts directory. Any idea whats going on? |
|
| Back to top |
|
 |
YooHoo Owner

Joined: 13 Feb 2003 Posts: 939 Location: Redwood Coast
|
Posted: Fri May 11, 2007 2:02 am Post subject: |
|
|
what do you mean that all the scripts are initializing? Scripts are loaded via the conf file, down at the bottom in the scripts section. If you have a script listed down there, it will load, if it is commented out, it will not. Maybe I am just not clear about what you mean exactly....  _________________
Johoho's TCL for beginners
 |
|
| Back to top |
|
 |
Artificial Voice
Joined: 10 May 2007 Posts: 3
|
Posted: Fri May 11, 2007 4:08 am Post subject: Scripts |
|
|
I realize how things operate normally, however I am loading a config file that only specifies ~ 30 scripts. Scripts NOT in the config file are loading. I have even removed the commented out scripts. Thats why it's odd. Unfortunately I did not make a backup of the config file (since it was business as usual + a few new scripts). I am going to retry a stock config and see if I get the same results.
Is it possible for the eggdrop to load an entire directory (*.tcl)?
My only guess as of now are that one of the newer scripts is executing the other scripts (not sure how). I'll give a better break down shortly. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri May 11, 2007 6:04 am Post subject: Re: Scripts |
|
|
| Artificial wrote: | | My only guess as of now are that one of the newer scripts is executing the other scripts (not sure how). I'll give a better break down shortly. |
Definitely that's the issue, Eggdrop only loads the scripts specified via source (in the .conf file or any other loaded script). _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri May 11, 2007 7:44 am Post subject: |
|
|
You might like to search through your scripts for anyone containing the command "glob", as this could be used to locate files in a speciffic path or such. The command you'd be looking for should look something like this:
| Code: | set scriptdir "./scripts"
foreach script [glob $scriptdir/*.tcl] {
source $script
} |
I assume you've done a complete .restart after removing scripts rather than simply doing a .rehash  _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Artificial Voice
Joined: 10 May 2007 Posts: 3
|
Posted: Fri May 11, 2007 12:10 pm Post subject: Solved |
|
|
AHA!
| Code: | # Load all *.tcl files in either this directory or "script-path".
if {$LOAD_ALL_SCRIPTS} {
putlog "--------------------------------------";
putlog "-------- Initialising scripts --------";
if {![info exists script-path]} {
set script-path [list [file dirname [info script]]];
}
foreach fsck(dir) ${script-path} {
putlog "Current search path:";
putlog $fsck(dir);
set fsck(scripts) [lsort -dictionary [glob -nocomplain -- "[string trimright $fsck(dir) "/"]/*"]];
set fsck(error) "";
set fsck(x) 0; set fsck(y) 0;
foreach fsck(script) $fsck(scripts) {
if {![file isdirectory $fsck(script)] && [string match -nocase *?.tcl $fsck(script)]} {
incr fsck(y);
if {![string compare [info script] $fsck(script)]} {
incr fsck(x);
continue;
}
if {[catch {source $fsck(script)} fsck(error)]} {
Error "fsck" FATAL "Couldn't load $fsck(script) \[$fsck(error)\]";
continue;
}
incr fsck(x);
}
}
putlog "$fsck(x) of $fsck(y) script[expr {($fsck(y) == 1) ? "" : "s"}] initialised.";
}
catch {unset fsck}
}
|
What a curious bit of code. Thank you for the prompt responses! This is completely my fault for not reviewing what a script does before executing it. Lesson learned! Quite a useful function too, however need to vet through my scripts directory to weed out outdated scripts and scripts I don't want run - such as one that emulates another person by creating new lines from a grepped logfile. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri May 11, 2007 6:41 pm Post subject: |
|
|
Setting LOAD_ALL_SCRIPTS to 0 solves your problem without having to remove that peace of code (in case you want to enable it some other time). _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|