egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

botnet !restart <bot>

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
paull
Voice


Joined: 01 Dec 2008
Posts: 6

PostPosted: Fri Dec 05, 2008 10:56 am    Post subject: botnet !restart <bot> Reply with quote

I am looking for a code to load in the HUB bot in the botnet and will restart a botnick when triggered like !restart <bot> in the HUB channel?

Is this possible?

thanks
Back to top
View user's profile Send private message
paull
Voice


Joined: 01 Dec 2008
Posts: 6

PostPosted: Sun Dec 07, 2008 7:00 am    Post subject: Reply with quote

Ok, I got it to work, maybe not the right way but it works. I am a noob at coding so if someone else have a better idea, let me know Smile

(HUB bot is in a private channel, so no one else can use this trigger)


In channel with HUB bot: !restart <botnick>

Loaded in HUB bot:


Code:


bind pub o|o !restart pub:restart

set adminchan "#channel"

proc pub:restart { nick uhost hand chan text } {
 global adminchan

   if { $chan == $addminchan } {
      if { $text == "" } {
         putquick "PRIVMSG $addminchan :Use: !restart <botnick> (Option: ALL)"
         return 0
      } else {
         putallbots "!restartbot $text"
         putquick "PRIVMSG $addminchan :Restarting $text..."
      }
  }
}


Loaded in LEAF bots:

Code:


bind bot -|- !restartbot restartbot

proc restartbot { from command text } {
       if { $text == "LEAF1" || $text == "ALL" } {
          restart
 }
}


Btw I dont know when to use:


Code:

    { $text == "LEAF1" } 
or
    { $text eq "LEAF1" }


Maybe someone can tell me the difference?

thanks
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 07, 2008 9:48 am    Post subject: Reply with quote

Read The difference between eq and ==.

So, since you're comparing strings, it's recommended to use "eq" (unless your Tcl version is older than 8.4).
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber