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.

Auto-exec a Command on startup/rehash?

Old posts that have not been replied to for several years.
Locked
G
Guest

Post by Guest »

need to perform a command everytime the bot reconnects to the IRC network (after a netsplit), or when it restarts/rehashes!

My need right now is to link the same channel on to diff. networks with the .linkchan command!

It works allright as single command, but it doesnt re-initialize the linkchan on restarts/reconnects!

Any solllutions???


_________________
Greetings from:

MadGabZ

mail: klyt_madgabz@hotmail.com
ICQ: #93134846

Member and coordinator of:
Q3A-InstaGib Clan [KLYT]
Web: http://hosted.dailyrush.dk/klyt/
IRC: #clan-klyt @ QuakeNet & EnterTheGame

<font size=-1>[ This Message was edited by: madgabz on 2001-10-10 07:52 ]</font>
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

You can use multiple methods to do this.

You can use the need bind, to detect rehashes.

Restarts are a little more stricky to do. SOmthing like the following should work.

Code: Select all

proc chk:restart {} {
  global uptime
  if {[expr $uptime + 60] > [unixtime]} {
    [b]BOT WAS RESTARTED - put code here[/b]
  }
}
chk:restart
The above can also be used to detect a rehash.

You can use the need bind again to detect when the bot re-connects to the server.
G
Guest

Post by Guest »

OK, I'm a complete Nubi on TCL, as I cant seem to learn this properly, when the tcl/tk-plugin for browsers doesnt work!

OK, so far so good:

Your code, with my changes, would then be saved to scriptfile, and exec'ed from within my eggdrop.conf?

The code for RESTARTS should be like this then:

Code: Select all

proc chk:restart {} {
  global uptime
  if {[expr $uptime + 60] > [unixtime]} {
    .linkchan #clan-klyt ETG irc.enterthegame.com 6667
    #ANOTHER command
    #Yet another command
  }
}
chk:restart
Regarding the 'need' bind, can You explain this to me?
dont bother if u dont have the time! :grin:

BTW, I'm using WinDrop 1.6.6, would there be a prob with 'unixtime' or is that taken care of by CygWin, too????

/madgabz

<font size=-1>[ This Message was edited by: madgabz on 2001-10-10 07:50 ]</font>
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

2 things.

The code you posted wouldn't work, as a TCL script is not the partyline, so commands that you would normaly type int he partyline do not work.

The .linkchan command calls a certain part of a script, it is that part's name that we need.

Where di you get this script, and I will look at it, and try to create a solution for you.
G
Guest

Post by Guest »

Can I email the script to You?
I think I found it searching for linkchan here on egghelp.org

I dug into the linkchan.tcl script, heres an axcerpt (Its quite an´extensive script!):

Code: Select all

proc linkchan {idx arg} {
 global debug nick chanlinkchan chanlinknet chanlinknick username realname linkchantrim
 if {$debug == 1} {putlog "linkchan< $arg"}
 set arg2 [lindex $arg 0]
 switch $arg2 {
  PING {putlc "PONG [lindex $arg 1]"}
  ERROR {
   putserv "PRIVMSG $chanlinkchan :[1code]
proc linkchan {idx arg} {
 global debug nick chanlinkchan chanlinknet chanlinknick username realname linkchantrim
 if {$debug == 1} {putlog "linkchan< $arg"}
 set arg2 [lindex $arg 0]
 switch $arg2 {
  PING {putlc "PONG [lindex $arg 1]"}
  ERROR {
   putserv "PRIVMSG $chanlinkchan :032ERROR: Closing Link"
   linkchan:shutdown
  }
 }
 switch [lindex $arg 1] {
  001 {
   putlc "MODE $chanlinknick :+i"
   putlc "JOIN $chanlinkchan"
  }
  433 {
   set chanlinknick $nick[rand 1000]
   putdcc $idx "NICK :$chanlinknick"
  }
  353 {puthelp "privmsg $chanlinkchan :$chanlinknet NAMES list: [string trimleft [string trimleft [string trimleft $arg :] "abcdefghijklmnopqrstuvwxyzABCDEFGHIJGKLMNOPQRSTUVWXYZ1234567890 !@*.#~-_|[]{}`="] :]"}
  JOIN {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has joined $chanlinkchan"}
  KICK {linkchan:kick $idx $arg}
  NICK {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet in now known as [string trimleft [lindex $arg 2] :]@$chanlinknet"}
  PART {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has left $chanlinkchan"}
  PRIVMSG {linkchan:privmsg $idx $arg}
  QUIT {puthelp "privmsg $chanlinkchan :032*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) Quit ([string trimleft [string trimleft [string trimleft $arg :] $linkchantrim] :])"}
 }
}
[/code1]032ERROR: Closing Link"
   linkchan:shutdown
  }
 }
 switch [lindex $arg 1] {
  001 {
   putlc "MODE $chanlinknick :+i"
   putlc "JOIN $chanlinkchan"
  }
  433 {
   set chanlinknick $nick[rand 1000]
   putdcc $idx "NICK :$chanlinknick"
  }
  353 {puthelp "privmsg $chanlinkchan :$chanlinknet NAMES list: [string trimleft [string trimleft [string trimleft $arg :] "abcdefghijklmnopqrstuvwxyzABCDEFGHIJGKLMNOPQRSTUVWXYZ1234567890 !@*.#~-_|[]{}`="] :]"}
  JOIN {puthelp "privmsg $chanlinkchan :[1code]
proc linkchan {idx arg} {
 global debug nick chanlinkchan chanlinknet chanlinknick username realname linkchantrim
 if {$debug == 1} {putlog "linkchan< $arg"}
 set arg2 [lindex $arg 0]
 switch $arg2 {
  PING {putlc "PONG [lindex $arg 1]"}
  ERROR {
   putserv "PRIVMSG $chanlinkchan :032ERROR: Closing Link"
   linkchan:shutdown
  }
 }
 switch [lindex $arg 1] {
  001 {
   putlc "MODE $chanlinknick :+i"
   putlc "JOIN $chanlinkchan"
  }
  433 {
   set chanlinknick $nick[rand 1000]
   putdcc $idx "NICK :$chanlinknick"
  }
  353 {puthelp "privmsg $chanlinkchan :$chanlinknet NAMES list: [string trimleft [string trimleft [string trimleft $arg :] "abcdefghijklmnopqrstuvwxyzABCDEFGHIJGKLMNOPQRSTUVWXYZ1234567890 !@*.#~-_|[]{}`="] :]"}
  JOIN {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has joined $chanlinkchan"}
  KICK {linkchan:kick $idx $arg}
  NICK {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet in now known as [string trimleft [lindex $arg 2] :]@$chanlinknet"}
  PART {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has left $chanlinkchan"}
  PRIVMSG {linkchan:privmsg $idx $arg}
  QUIT {puthelp "privmsg $chanlinkchan :032*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) Quit ([string trimleft [string trimleft [string trimleft $arg :] $linkchantrim] :])"}
 }
}
[/code1]033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has joined $chanlinkchan"}
  KICK {linkchan:kick $idx $arg}
  NICK {puthelp "privmsg $chanlinkchan :[1code]
proc linkchan {idx arg} {
 global debug nick chanlinkchan chanlinknet chanlinknick username realname linkchantrim
 if {$debug == 1} {putlog "linkchan< $arg"}
 set arg2 [lindex $arg 0]
 switch $arg2 {
  PING {putlc "PONG [lindex $arg 1]"}
  ERROR {
   putserv "PRIVMSG $chanlinkchan :032ERROR: Closing Link"
   linkchan:shutdown
  }
 }
 switch [lindex $arg 1] {
  001 {
   putlc "MODE $chanlinknick :+i"
   putlc "JOIN $chanlinkchan"
  }
  433 {
   set chanlinknick $nick[rand 1000]
   putdcc $idx "NICK :$chanlinknick"
  }
  353 {puthelp "privmsg $chanlinkchan :$chanlinknet NAMES list: [string trimleft [string trimleft [string trimleft $arg :] "abcdefghijklmnopqrstuvwxyzABCDEFGHIJGKLMNOPQRSTUVWXYZ1234567890 !@*.#~-_|[]{}`="] :]"}
  JOIN {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has joined $chanlinkchan"}
  KICK {linkchan:kick $idx $arg}
  NICK {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet in now known as [string trimleft [lindex $arg 2] :]@$chanlinknet"}
  PART {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has left $chanlinkchan"}
  PRIVMSG {linkchan:privmsg $idx $arg}
  QUIT {puthelp "privmsg $chanlinkchan :032*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) Quit ([string trimleft [string trimleft [string trimleft $arg :] $linkchantrim] :])"}
 }
}
[/code1]033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet in now known as [string trimleft [lindex $arg 2] :]@$chanlinknet"}
  PART {puthelp "privmsg $chanlinkchan :[1code]
proc linkchan {idx arg} {
 global debug nick chanlinkchan chanlinknet chanlinknick username realname linkchantrim
 if {$debug == 1} {putlog "linkchan< $arg"}
 set arg2 [lindex $arg 0]
 switch $arg2 {
  PING {putlc "PONG [lindex $arg 1]"}
  ERROR {
   putserv "PRIVMSG $chanlinkchan :032ERROR: Closing Link"
   linkchan:shutdown
  }
 }
 switch [lindex $arg 1] {
  001 {
   putlc "MODE $chanlinknick :+i"
   putlc "JOIN $chanlinkchan"
  }
  433 {
   set chanlinknick $nick[rand 1000]
   putdcc $idx "NICK :$chanlinknick"
  }
  353 {puthelp "privmsg $chanlinkchan :$chanlinknet NAMES list: [string trimleft [string trimleft [string trimleft $arg :] "abcdefghijklmnopqrstuvwxyzABCDEFGHIJGKLMNOPQRSTUVWXYZ1234567890 !@*.#~-_|[]{}`="] :]"}
  JOIN {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has joined $chanlinkchan"}
  KICK {linkchan:kick $idx $arg}
  NICK {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet in now known as [string trimleft [lindex $arg 2] :]@$chanlinknet"}
  PART {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has left $chanlinkchan"}
  PRIVMSG {linkchan:privmsg $idx $arg}
  QUIT {puthelp "privmsg $chanlinkchan :032*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) Quit ([string trimleft [string trimleft [string trimleft $arg :] $linkchantrim] :])"}
 }
}
[/code1]033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has left $chanlinkchan"}
  PRIVMSG {linkchan:privmsg $idx $arg}
  QUIT {puthelp "privmsg $chanlinkchan :[1code]
proc linkchan {idx arg} {
 global debug nick chanlinkchan chanlinknet chanlinknick username realname linkchantrim
 if {$debug == 1} {putlog "linkchan< $arg"}
 set arg2 [lindex $arg 0]
 switch $arg2 {
  PING {putlc "PONG [lindex $arg 1]"}
  ERROR {
   putserv "PRIVMSG $chanlinkchan :032ERROR: Closing Link"
   linkchan:shutdown
  }
 }
 switch [lindex $arg 1] {
  001 {
   putlc "MODE $chanlinknick :+i"
   putlc "JOIN $chanlinkchan"
  }
  433 {
   set chanlinknick $nick[rand 1000]
   putdcc $idx "NICK :$chanlinknick"
  }
  353 {puthelp "privmsg $chanlinkchan :$chanlinknet NAMES list: [string trimleft [string trimleft [string trimleft $arg :] "abcdefghijklmnopqrstuvwxyzABCDEFGHIJGKLMNOPQRSTUVWXYZ1234567890 !@*.#~-_|[]{}`="] :]"}
  JOIN {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has joined $chanlinkchan"}
  KICK {linkchan:kick $idx $arg}
  NICK {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet in now known as [string trimleft [lindex $arg 2] :]@$chanlinknet"}
  PART {puthelp "privmsg $chanlinkchan :033*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) has left $chanlinkchan"}
  PRIVMSG {linkchan:privmsg $idx $arg}
  QUIT {puthelp "privmsg $chanlinkchan :032*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) Quit ([string trimleft [string trimleft [string trimleft $arg :] $linkchantrim] :])"}
 }
}
[/code1]032*** [lindex [split [lindex [split $arg2 !] 0] :] 1]@$chanlinknet ([lindex [split $arg2 !] 1]) Quit ([string trimleft [string trimleft [string trimleft $arg :] $linkchantrim] :])"}
 }
}
Hope this helps!

/madgabz

PS. Thx for reminding about the script-error i made .. Im DUH'ing myself pretty much right now :smile:

<font size=-1>[ This Message was edited by: madgabz on 2001-10-10 08:20 ]</font>

<font size=-1>[ This Message was edited by: madgabz on 2001-10-10 08:22 ]</font>
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

That looks like the same script pasted over and over again. Send the whole script to ppslim@users.sourceforge.net
G
Guest

Post by Guest »

Sorry about the former post's lenght, There must be a bug somewhere in the Forum system!
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

SOmthing like this should work.

Code: Select all

proc chk:restart {} {
  global uptime
  if {[expr $uptime + 60] > [unixtime]} {
    dcc:linkchan 0 0 {#clan-klyt ETG irc.enterthegame.com 6667}
    #ANOTHER command
    #Yet another command
  }
}
chk:restart
proc need:netsplit {args} {
  chk:restart
}
bind EVNT - "init-server" need:netsplit
the 0 0 is required for this to work.

And it was the evnt bind, not the need bind. me bad :razz:
Locked