On my eggdrop, there are two scripts, that can't be loaded at the same time, or neither one works. This means that to change between the two scripts, I have to connect to the server, go in and edit the config file, then rehash the bot every time.
this becomes very tedious when it's changing mulitple times in one day.
Would it be possible to have a script that would edit the config file for me?
source scripts/blah.tcl
#source scripts/moo.tcl
in theory, it would need to delete the first character of the line with moo.tcl, and then add a # to the beginning of the line of blah.tcl. then a second script to do the opposite.
then i can just rehash the bot on irc, and it would save me a lot of time and bother. It would also allow other users to change from one script to another!
However, i'm fairly in-experienced in TCL scripting, so i actually don't know where to start.
If any of you have any ideas on how to do this, it would be greatly appreciated!
well, if the scripts don't work together then they are of the same type.. so you have to use one of them, I don't see any reason to use both scripts or make such a complication as you're requesting.
I'm sure that it states in these scripts that you should not use a similar script with this script.
search the tcl archive on here... there are some scripts that enable you to load and unload tcl's from partyline i believe. hmm to flush the old binds tho its probably going to take more then a rehash.. not sure have not actually looked at the scripts.
the scripts are relay scripts from game servers 2 irc.
one of them relays every event, so it parses practically every thing from the logs of the server. thats the main one.
the second one however, only parses the chat, and ignores all the events.
when you have them both loaded at the same time, neither one works because they interfere with each other trying to parse the same things differently.
if i can't change the config file, is there a way putting at the beginning of a script file, some thing to tell it to ignore the rest of the script unless a command is inputted.
basically a way of turning the script on and off completely, because as they are now, they continually run in the background, regardless of whether stuff is inputted into the channel or not.
well, this kind of hard to explain, but it wouldn't work.
the main script relays every thing from the server. it parses every thing that is produced by the logs.
the second script ignores every thing except chat. this one would be used for matches, where having events shown publically wouldn't be allowed by the rules.
i was directed to a script in the archive that lets me load and unload scripts through dcc. with a little modification, i should be able to make it a public command for the people who need it. will solve the problems.
# set the paths to your two scripts here
set script1 "scripts/script1.tcl"
set script2 "scripts/script2.tcl"
bind pub n !script1 load_script1
bind pub n !script2 load_script2
proc load_script1 {nick uhost hand chan text} {
global script1
switch_to $script1
restart
}
proc load_script2 {nick uhost hand chan text} {
global script2
switch_to $script2
restart
}
proc switch_to {fname} {
set fp [open script_toggle.tcl w]
puts $fp "source $fname"
close $fp
}
if {![file exists script_toggle.tcl]} {
switch_to $script1
}
Stikelight - Double negative... if you read the original post you can see that he currently edits the config file and rehashes, thus clearing the binds must not be an issue (overlapping?).
That said, maybe he just said it wrong (that is why I used restart to begin with), but I wanted to give him the option to try it his way.
stdragon - I was commenting in general on your "switcher.tcl" being a true tcl "switcher". 'rehash' will break it. When others search the forum for similar answers, we don't want to lead them up the wrong path.