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.

load backup

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
M
MacDaddy
Voice
Posts: 9
Joined: Fri Jan 20, 2006 4:41 pm

load backup

Post by MacDaddy »

hey all is there a way to make a trigger that will load 1 or more backup scripts if the main channel bot gose in a netsplit i know how to do it in mIRC script but not tcl eg:

Code: Select all

ON *:TEXT:!bload:#channelhere: {
  if (($nick isop #) || ($nick ishop #) || ($nick isvoice #)) {
    /load -rs Scripts\Scripts.mrc | /msg $chan $nick Backup scripts loaded :)
  }
}

ON *:TEXT:!bunload:#channelshere: {
  if (($nick isop #) || ($nick ishop #) || ($nick isvoice #)) {
    /unload -rs Scripts\Scripts.mrc | /msg $chan $nick Backup scripts Unloaded :)
  }
}

or load more than one sctipt and unload then as abouve would be just a simple break and /load -rs script2.mrc then message
anyone know how this can be done in tcl so and eggdrop bot would load the backup script
thanks for anyhelp
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Probably not possible due to the simple fact that the eggdrop's configuration file needs editing followed by a rehash; it's not a simple matter of /load or /unload.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
M
MacDaddy
Voice
Posts: 9
Joined: Fri Jan 20, 2006 4:41 pm

Post by MacDaddy »

ok thanks for the reply :wink:

edit: ok it there a way to have the script loaded but none of the triggers in the script to work untill the channel trigger is used ie !bload and deactivate on !bunload ?

like instead of loading the script with a /load command have the script loaded in the bot but it will be idle untill the trigger is given in the channel by an op halfop or voice.
say the normal bot is in the channel and someone uses !trigger1 the backup bot wont reply but if the !bload command is given on a netsplit the !trigger1 will work and the bot will reply to the channel triggers.

hope you understand what i mean :D
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

You can load a script, but you can't unload it. For example:

Code: Select all

bind pub n !bload bload

proc bload {nick uhost hand chan arg} {
 if {![catch {source [lindex [split $arg] 0]} e]} {
  puthelp "privmsg $chan :Loaded [lindex [split $arg] 0]."
 } {
  puthelp "privmsg $chan :An error occured while trying to load [lindex [split $arg] 0]: $e"
 }
}
As for unloading, I don't think you can do that BUT you can still unbind all binds assiciated with the loading script but that will need some extra coding.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Sir_Fz : There is no need to use '[lindex [split $arg] 0]' three times, why don't you just '[set foo [lindex [split $arg] 0]]' then use $foo instead of two '[lindex [split $arg] 0]'?

As for loading/unloading a script in the TCL Archive is a script called 'Unloadtcl' by Wingman that 'Allows you to load and unload Tcl scripts using DCC commands.' give it a try. I know is old and a bit outdated.. egghead's 'freshmint' (it's a script, check it's webpage, don't know if he added in the TCL Archive) is realy nice.
Once the game is over, the king and the pawn go back in the same box.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you can't really unload an eggdrop Tcl script

at least you can't know which binds belong to that script; parsing the source (as that wingman guy's script probably does) is crude and inacurate way of obtaining such info
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

demond : Actualy egghead's 'freshmint' dose the cleaning. And no, you don't need to unbind just the binds of that tcl script in question since upon rehash your conf file is reloaded also all your tcl scripts are reloadsed, meaning that all the binds are (re)created so, the binds from the 'unloaded' script won't be binded again because that script isn't loaded because isn't there. Simple. :)

Wingman's 'Unloadtcl' just opens your conf file and either appends or removes a certain line with the script you wish either to load or remove.
Once the game is over, the king and the pawn go back in the same box.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

as simple as it might be, it's actually more crude than I thought

I am forced to reload all other scripts in order to unload one? what if I don't want to do that? I might have some scripts in intermediate states, which will screw up their current states on forced reload, what about that? what if I don't want my config modified? what if the script I want to unload is not sourced directly in the config, but indirectly by some other script?

it ain't that easy as it sounds
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oh well, it works fine for me. I don't like to complicate stuff. And you aren't forced to reload all the scripts since that already happens when you either rehash or restart the bot. Anyway, is not 100% perfect BUT it's doing exactly what I needed. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

that was a necessary clarification

I personally wouldn't recommend a script which won't work for everybody; but then again, there's only a handful of correct eggdrop scripts, unfortunately
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
Post Reply