| View previous topic :: View next topic |
| Author |
Message |
Bondie Voice
Joined: 17 Dec 2006 Posts: 7
|
Posted: Mon Dec 18, 2006 8:22 am Post subject: /msg nick join and part |
|
|
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 |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Mon Dec 18, 2006 9:01 am Post subject: |
|
|
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 |
|
 |
Bondie Voice
Joined: 17 Dec 2006 Posts: 7
|
Posted: Mon Dec 18, 2006 9:13 am Post subject: |
|
|
| thx very much but its not working. |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Mon Dec 18, 2006 9:21 am Post subject: |
|
|
| 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 |
|
 |
Bondie Voice
Joined: 17 Dec 2006 Posts: 7
|
Posted: Mon Dec 18, 2006 9:29 am Post subject: |
|
|
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 |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Mon Dec 18, 2006 9:42 am Post subject: |
|
|
| 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 |
|
 |
Bondie Voice
Joined: 17 Dec 2006 Posts: 7
|
Posted: Mon Dec 18, 2006 9:52 am Post subject: |
|
|
| well if i knew how to i wouldnt post it in request. |
|
| Back to top |
|
 |
bloodLiner Voice
Joined: 18 Dec 2006 Posts: 1 Location: Hanau / Germany
|
Posted: Mon Dec 18, 2006 12:15 pm Post subject: |
|
|
He told you what to do
| 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
This would be better
| 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 |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Mon Dec 18, 2006 2:00 pm Post subject: |
|
|
| Still using the wrong proc arguments. All of you except tosser for that matter. |
|
| Back to top |
|
 |
Bondie Voice
Joined: 17 Dec 2006 Posts: 7
|
Posted: Mon Dec 18, 2006 3:24 pm Post subject: |
|
|
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 |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Mon Dec 18, 2006 7:39 pm Post subject: |
|
|
| 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 |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Mon Dec 18, 2006 8:17 pm Post subject: |
|
|
| metroid wrote: | | Still using the wrong proc arguments. All of you except tosser for that matter. |
Comes with being tired probably.
* Alchera slaps his forehead _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Tue Dec 19, 2006 3:09 pm Post subject: |
|
|
| 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 |
|
 |
Riddler Halfop
Joined: 20 May 2007 Posts: 60 Location: Brasov, Romania
|
Posted: Mon May 21, 2007 5:22 pm Post subject: |
|
|
| 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 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 |
|
 |
YooHoo Owner

Joined: 13 Feb 2003 Posts: 939 Location: Redwood Coast
|
Posted: Mon May 21, 2007 7:01 pm Post subject: |
|
|
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 |
_________________
Johoho's TCL for beginners
 |
|
| Back to top |
|
 |
|