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.

Would it be possible...

Old posts that have not been replied to for several years.
s
shanks
Voice
Posts: 19
Joined: Mon Aug 18, 2003 7:03 am

Would it be possible...

Post by shanks »

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!

Thanks for your time.

- shanks
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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.
User avatar
gumbydammit
Master
Posts: 311
Joined: Thu Sep 05, 2002 4:52 pm
Location: Canada
Contact:

Post by gumbydammit »

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.
a.k.a. hellios
s
shanks
Voice
Posts: 19
Joined: Mon Aug 18, 2003 7:03 am

Post by shanks »

the binds wouldn't be needed to be flushed.

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.
v
vork3
Voice
Posts: 19
Joined: Sun Aug 17, 2003 1:19 pm
Contact:

Post by vork3 »

why don't you use 2 bots. one for eetch script
s
shanks
Voice
Posts: 19
Joined: Mon Aug 18, 2003 7:03 am

Post by shanks »

i only have the option of hosting one, and it would make it easier using just the one bot
v
vork3
Voice
Posts: 19
Joined: Sun Aug 17, 2003 1:19 pm
Contact:

Post by vork3 »

and combining the 2 scripts to 1?
s
shanks
Voice
Posts: 19
Joined: Mon Aug 18, 2003 7:03 am

Post by shanks »

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.
v
vork3
Voice
Posts: 19
Joined: Sun Aug 17, 2003 1:19 pm
Contact:

Post by vork3 »

but if you combine the scripts and build in a function to shut them off by for instece !chat off and !event off ??
s
shanks
Voice
Posts: 19
Joined: Mon Aug 18, 2003 7:03 am

Post by shanks »

it is a nice idea, but not actually necessairy.

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.


thanks a lot for all your help though people.

shanks.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

switcher.tcl:

Code: Select all

# 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
}
config:

Code: Select all

# source scripts/script1.tcl
# source scripts/script2.tcl <-- comment these lines out, or delete them
source switcher.tcl
catch {source script_toggle.tcl}
tada! not tested :)
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Oh, you can make that "rehash" instead of "restart" if you want.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

stdragon wrote:Oh, you can make that "rehash" instead of "restart" if you want.
Negative.. 'rehash' doesn't clear previous bindings.. You'll need to keep the 'restart'.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

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.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

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.
Locked