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.

/msg nick join and part

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
B
Bondie
Voice
Posts: 7
Joined: Sun Dec 17, 2006 1:52 pm

/msg nick join and part

Post by Bondie »

Hiya again can somebody pls code me that in tcl

Code: Select all

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.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Try:

Code: Select all

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
B
Bondie
Voice
Posts: 7
Joined: Sun Dec 17, 2006 1:52 pm

Post by Bondie »

thx very much but its not working.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

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
B
Bondie
Voice
Posts: 7
Joined: Sun Dec 17, 2006 1:52 pm

Post by Bondie »

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: Select all

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
 
   }
 
}
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

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

Code: Select all

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
B
Bondie
Voice
Posts: 7
Joined: Sun Dec 17, 2006 1:52 pm

Post by Bondie »

well if i knew how to i wouldnt post it in request.
b
bloodLiner
Voice
Posts: 1
Joined: Mon Dec 18, 2006 12:13 pm
Location: Hanau / Germany
Contact:

Post by bloodLiner »

He told you what to do ;)

Code: Select all

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 ;)
This would be better :D

Code: Select all

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
}
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Still using the wrong proc arguments. All of you except tosser for that matter.
B
Bondie
Voice
Posts: 7
Joined: Sun Dec 17, 2006 1:52 pm

Post by Bondie »

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

Code: Select all

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
  }
}
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

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: Select all

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: Select all

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
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

metroid wrote:Still using the wrong proc arguments. All of you except tosser for that matter.
Comes with being tired probably. :lol:

* Alchera slaps his forehead
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Code: Select all

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: Select all

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)
R
Riddler
Halfop
Posts: 60
Joined: Sun May 20, 2007 10:20 pm
Location: Brasov, Romania
Contact:

Post by Riddler »

Tosser^^ wrote:Try:

Code: Select all

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 :D 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: Select all

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: Select all

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

Code: Select all

[23:21] Tcl error [s:delchan]: invalid command name "killuser"
any sugestions ?
I am a man of few words, but many riddles
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

I looked everywhere for this "killuser" command, and didn't find squat. Where'd you get this at?

Code: Select all

  deluser <handle>
    Description: attempts to erase the user record for a handle
    Returns: 1 if successful, 0 if no such user exists
    Module: core
Post Reply