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 

/msg nick join and part
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Bondie
Voice


Joined: 17 Dec 2006
Posts: 7

PostPosted: Mon Dec 18, 2006 8:22 am    Post subject: /msg nick join and part Reply with quote

Hiya again can somebody pls code me that in tcl

Code:
on *:TEXT:join*:?:{
  if ($nick == bondie) {
    join $2 
  }
}
on *:TEXT:part*:?:{
  if ($nick == bondie) {
    part $2 Error
  }
}


when i enter /msg nick join #chan or /msg nick part #chan the bot joins or part a channel.
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Mon Dec 18, 2006 9:01 am    Post subject: Reply with quote

Try:

Code:
bind msg n {join} msg:join
bind msg n {part} msg:part

proc msg:join {nick uhost hand text} {
  global botnick lastbind
  if {$text == "" || [string index $text 0] != "#"} {
    putserv "NOTICE $nick :Usage: /msg $botnick $lastbind #channel."
  } elseif {[llength [channels]] >= 20} {
    putserv "NOTICE $nick :All channels filled!"
  } elseif {[validchan $text]} {
    putserv "NOTICE $nick :$text is already added."
  } else {
    channel add $text
    putserv "NOTICE $nick :Joined $text."
  }
}

proc msg:part {nick uhost hand text} {
  global botnick lastbind
  if {$text == "" || [string index $text 0] != "#"} {
    putserv "NOTICE $nick :Usage: /msg $botnick $lastbind #channel."
  } elseif {![validchan $text]} {
    putserv "NOTICE $nick :$text is not a valid channel."
  } else {
    channel remove $text
    putserv "NOTICE $nick :Parted $text."
  }
}


NOTE: Not Tested!
_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
Bondie
Voice


Joined: 17 Dec 2006
Posts: 7

PostPosted: Mon Dec 18, 2006 9:13 am    Post subject: Reply with quote

thx very much but its not working.
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Dec 18, 2006 9:21 am    Post subject: Reply with quote

Bondie wrote:
thx very much but its not working.

Simply saying "not working" is meaningless.

Paste the results of ".set errorInfo" or the result of any log pertaining to this.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Bondie
Voice


Joined: 17 Dec 2006
Posts: 7

PostPosted: Mon Dec 18, 2006 9:29 am    Post subject: Reply with quote

well, the script is also a bit "to" much. i just need the msg bind without any flags. and just that the bot acts on a command that i give in Mirc via /msg <nick - who has this script> join <#channel>. also no output if it parts or joined the chan. very plain just.

The error is
Tcl error [join]: wrong # args: should be "join nickname hostname handle channel arguments"

Tcl error [part]: wrong # args: should be "part nickname hostname handle channel arguments"

i have that, but its not working at all

Code:
bind MSG - "join" join
bind MSG - "part" part
 
proc join { nickname hostname handle channel } {
 
if {($nickname == "bondie")} {
 
   channel add $channel
 
   }
 
}
 
proc part { nickname hostname handle channel } {
 
if {($nickname == "bondie")} {
 
   channel remove $channel
 
   }
 
}
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Dec 18, 2006 9:42 am    Post subject: Reply with quote

Quote:
Tcl error [join]: wrong # args: should be "join nickname hostname handle channel arguments"

Code:
proc msg:join {nick uhost hand chan text} { ... }
proc msg:part {nick uhost hand chan text} { ... }

_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Bondie
Voice


Joined: 17 Dec 2006
Posts: 7

PostPosted: Mon Dec 18, 2006 9:52 am    Post subject: Reply with quote

well if i knew how to i wouldnt post it in request.
Back to top
View user's profile Send private message
bloodLiner
Voice


Joined: 18 Dec 2006
Posts: 1
Location: Hanau / Germany

PostPosted: Mon Dec 18, 2006 12:15 pm    Post subject: Reply with quote

He told you what to do Wink
Code:
bind MSG - "join" join
bind MSG - "part" part
proc join {nickname hostname handle channel argument} {
if {$nickname == "bondie"} {
   channel add $channel
   }
}
 
proc part {nickname hostname handle channel argument} {
if {$nickname == "bondie"} {
   channel remove $channel
   }
}

But it isn't that smart to bind the command to - and check for the nickname. Anyone could just name himself to Bondie and they could let your bot join/part channels Wink
This would be better Very Happy
Code:
bind MSG n "join" join
bind MSG n "part" part
proc join {nickname hostname handle channel argument} {
   channel add $channel
}
 
proc part {nickname hostname handle channel argument} {
   channel remove $channel
}
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Mon Dec 18, 2006 2:00 pm    Post subject: Reply with quote

Still using the wrong proc arguments. All of you except tosser for that matter.
Back to top
View user's profile Send private message
Bondie
Voice


Joined: 17 Dec 2006
Posts: 7

PostPosted: Mon Dec 18, 2006 3:24 pm    Post subject: Reply with quote

Hmm isnt this part of the Forum called request ?! Sometimes its easier just to write down how it worx then "quizzing" around


Code:
bind MSG - "join" join
bind MSG - "part" part

proc join { nickname hostname handle channel } {
    channel add $channel
  }
}
 
proc part { nickname hostname handle channel } {
    channel remove $channel
  }
}
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Mon Dec 18, 2006 7:39 pm    Post subject: Reply with quote

Bondie wrote:
Hmm isnt this part of the Forum called request ?! Sometimes its easier just to write down how it worx then "quizzing" around


Code:
bind MSG - "join" join
bind MSG - "part" part

proc join { nickname hostname handle channel } {
    channel add $channel
  }
}
 
proc part { nickname hostname handle channel } {
    channel remove $channel
  }
}


Bondie you obv. dont know your proc header for MSG, how do you get channel from a private message? Also you missed out arguments (text) in that header..
Your also overwriting the built-in command 'join'

Try:

Code:
bind msg - "join" cmd:join
bind msg - "part" cmd:part

proc cmd:join {nick uhost hand arg} {
  if {[string match -nocase "mynick" $nick]} {
    channel add $arg
  }
}

proc cmd:part {nick uhost hand arg} {
  if {[string match -nocase "mynick" $nick]} {
    channel remove $arg
  }
}

_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Dec 18, 2006 8:17 pm    Post subject: Reply with quote

metroid wrote:
Still using the wrong proc arguments. All of you except tosser for that matter.

Comes with being tired probably. Laughing

* Alchera slaps his forehead
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Tue Dec 19, 2006 3:09 pm    Post subject: Reply with quote

Code:
bind msg - "join" cmd:join
bind msg - "part" cmd:part

proc cmd:join {nick uhost hand arg} {
  if {[string match -nocase "mynick" $nick]} {
    channel add $arg
  }
}

proc cmd:part {nick uhost hand arg} {
  if {[string match -nocase "mynick" $nick]} {
    channel remove $arg
  }
}


though this would work, you shouldn't use string match.

Code:
bind msg - "join" cmd:join
bind msg - "part" cmd:part

proc cmd:join {nick uhost hand arg} {
  if {[string equal -nocase "mynick" $nick]} {
    channel add $arg
  }
}

proc cmd:part {nick uhost hand arg} {
  if {[string equal -nocase "mynick" $nick]} {
    channel remove $arg
  }
}


is the script I'd use (though as mentioned before, you should use handles rather than nick matching)
Back to top
View user's profile Send private message
Riddler
Halfop


Joined: 20 May 2007
Posts: 60
Location: Brasov, Romania

PostPosted: Mon May 21, 2007 5:22 pm    Post subject: Reply with quote

Tosser^^ wrote:
Try:

Code:
bind msg n {join} msg:join
bind msg n {part} msg:part

proc msg:join {nick uhost hand text} {
  global botnick lastbind
  if {$text == "" || [string index $text 0] != "#"} {
    putserv "NOTICE $nick :Usage: /msg $botnick $lastbind #channel."
  } elseif {[llength [channels]] >= 20} {
    putserv "NOTICE $nick :All channels filled!"
  } elseif {[validchan $text]} {
    putserv "NOTICE $nick :$text is already added."
  } else {
    channel add $text
    putserv "NOTICE $nick :Joined $text."
  }
}

proc msg:part {nick uhost hand text} {
  global botnick lastbind
  if {$text == "" || [string index $text 0] != "#"} {
    putserv "NOTICE $nick :Usage: /msg $botnick $lastbind #channel."
  } elseif {![validchan $text]} {
    putserv "NOTICE $nick :$text is not a valid channel."
  } else {
    channel remove $text
    putserv "NOTICE $nick :Parted $text."
  }
}


NOTE: Not Tested!


Ok, I`ve tested in this original structure, and it works very good Very Happy but ..
i want to change some of the code and make the bot add the channel olso like a user in eggdrop.user with a the $default-flags and a +C.

Code:
bind msg n addchan s:addchan
bind msg n delchan s:delchan

proc s:addchan {nick uhost hand text} {
 global botnick default-flags
  if {$text == "" || [string index $text 0] != "#"} {
    putserv "NOTICE $nick :SYNTAX: /msg $botnick addchan #channel"
    } elseif {[validchan $text]} {
    putserv "NOTICE $nick :\002$text \002is already added"
    } else {
    channel add $text
    newuser ~$text $default-flags
    chattr ~$text +C
    putserv "NOTICE $nick :Channel added:\002 $text \002"
  }
}

proc s:delchan {nick uhost hand text} {
 global botnick
  if {$text == "" || [string index $text 0] != "#"} {
    putserv "NOTICE $nick :SYNTAX: /msg $botnick delchan #channel"
    } elseif {![validchan $text]} {
    putserv "NOTICE $nick :\002$text \002is not a valid channel"
    } else {
    channel remove $text
    killuser ~$text
    putserv "NOTICE $nick :Channel deleted:\002 $text \002"
  }
}


but i has an error...
Code:

[23:10] Tcl error [s:addchan]: can't read "default": no such variable

and this
Code:
[23:21] Tcl error [s:delchan]: invalid command name "killuser"


any sugestions ?
_________________
I am a man of few words, but many riddles
Back to top
View user's profile Send private message Send e-mail Visit poster's website
YooHoo
Owner


Joined: 13 Feb 2003
Posts: 939
Location: Redwood Coast

PostPosted: Mon May 21, 2007 7:01 pm    Post subject: Reply with quote

I looked everywhere for this "killuser" command, and didn't find squat. Where'd you get this at?
Code:
  deluser <handle>
    Description: attempts to erase the user record for a handle
    Returns: 1 if successful, 0 if no such user exists
    Module: core

_________________
Mr. Green
Johoho's TCL for beginners
Mr. Green
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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