egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

All Scripts Executing

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help
View previous topic :: View next topic  
Author Message
Artificial
Voice


Joined: 10 May 2007
Posts: 3

PostPosted: Thu May 10, 2007 11:37 pm    Post subject: All Scripts Executing Reply with quote

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
View user's profile Send private message
YooHoo
Owner


Joined: 13 Feb 2003
Posts: 939
Location: Redwood Coast

PostPosted: Fri May 11, 2007 2:02 am    Post subject: Reply with quote

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.... Question
_________________
Mr. Green
Johoho's TCL for beginners
Mr. Green
Back to top
View user's profile Send private message Send e-mail
Artificial
Voice


Joined: 10 May 2007
Posts: 3

PostPosted: Fri May 11, 2007 4:08 am    Post subject: Scripts Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 11, 2007 6:04 am    Post subject: Re: Scripts Reply with quote

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
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri May 11, 2007 7:44 am    Post subject: Reply with quote

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 Smile
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Artificial
Voice


Joined: 10 May 2007
Posts: 3

PostPosted: Fri May 11, 2007 12:10 pm    Post subject: Solved Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 11, 2007 6:41 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber