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.

All Scripts Executing

General support and discussion of Eggdrop bots.
Post Reply
A
Artificial
Voice
Posts: 3
Joined: Thu May 10, 2007 11:25 pm

All Scripts Executing

Post by Artificial »

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?
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

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.... :?:
A
Artificial
Voice
Posts: 3
Joined: Thu May 10, 2007 11:25 pm

Scripts

Post by Artificial »

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.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Re: Scripts

Post by Sir_Fz »

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).
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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: Select all

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
A
Artificial
Voice
Posts: 3
Joined: Thu May 10, 2007 11:25 pm

Solved

Post by Artificial »

AHA!

Code: Select all

# 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.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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).
Post Reply