| View previous topic :: View next topic |
| Author |
Message |
MacDaddy Voice
Joined: 20 Jan 2006 Posts: 9
|
Posted: Sun Jan 22, 2006 5:57 am Post subject: load backup |
|
|
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: |
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 |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sun Jan 22, 2006 9:08 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
MacDaddy Voice
Joined: 20 Jan 2006 Posts: 9
|
Posted: Sun Jan 22, 2006 10:32 pm Post subject: |
|
|
ok thanks for the reply
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  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon Jan 23, 2006 10:06 am Post subject: |
|
|
You can load a script, but you can't unload it. For example:
| Code: | 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. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Jan 23, 2006 5:28 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Jan 24, 2006 12:20 am Post subject: |
|
|
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] tag when posting logs, code |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Jan 24, 2006 4:46 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Jan 24, 2006 5:35 am Post subject: |
|
|
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] tag when posting logs, code |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Jan 24, 2006 12:42 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Wed Jan 25, 2006 12:08 am Post subject: |
|
|
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] tag when posting logs, code |
|
| Back to top |
|
 |
|