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.
Old posts that have not been replied to for several years.
d
deepforest
Post
by deepforest » Mon Sep 08, 2003 6:57 am
i need basic script.
my eggdrop is admin.
i want to !kill Nick !kline nick scripts.
thanks for replies.
Ofloo
Owner
Posts: 953 Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:
Post
by Ofloo » Mon Sep 08, 2003 7:56 am
ok ill give you a syntax its all the same but there are some scripts like that out there. check the tcl archive
!kill
Code: Select all
bind pub n !kill kill:pub
proc kill:pub {nick uhost hand chan arg} {
set user [lindex $arg 0]
set reason [lindex $arg 1]
putserv "KILL $user $reason"
}
do the same for the rest :p well thats basicly it you can also add other stuff like if "" ..
Code: Select all
bind pub n !kill kill:pub
proc kill:pub {nick uhost hand chan arg} {
set user [lindex $arg 0]
set reason [lindex $arg 1]
if {[string match -nocase "" $user] || [string match -nocase "" $reason] == 1} {
putserv "NOTICE $nick :Usage: !kill <nick> <reason>"
} else {
putserv "KILL $user $reason"
putserv "NOTICE $nick :$user has been killed from irc."
}
}
ok then it will probaly look more like this
XplaiN but think of me as stupid
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Sep 08, 2003 10:29 am
Why do you use the "string match" in:
Code: Select all
if {[string match -nocase "" $user] || [string match -nocase "" $reason] == 1} {
instead of:
Code: Select all
if {user == "" || $reason == ""} {
Any reason to do so? Also, you can do this "check" by doing something like:
Last edited by
caesar on Mon Sep 08, 2003 10:32 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon Sep 08, 2003 10:32 am
...also, SPLITTING THE STRING BEFORE YOU USE LIST COMMANDS ON IT might be a good idea.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Sep 08, 2003 10:34 am
Damn! I've forgot again to mention that..
Once the game is over, the king and the pawn go back in the same box.
d
deepforest
Post
by deepforest » Mon Sep 08, 2003 2:06 pm
ok thanks. it's working but i don't want to command in channel.
i want to script working in private message .
example: /msg Botnick !kill nick reason
thanks..
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Sep 08, 2003 2:37 pm
Read the tcl-commands.doc file for the
bind msg and start doing yourself the code. Don't be lazy.
Once the game is over, the king and the pawn go back in the same box.
Ofloo
Owner
Posts: 953 Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:
Post
by Ofloo » Mon Sep 08, 2003 7:03 pm
Why do you use the "string match"
well you can do it either way i know there beter ways but haven't figured out witch one is best under what circomstances sorry hehe and also .. you could like use 1 and 0 return .. if you know what i mean so you could easely set it to 0 .. it was just an general example .. to use under any circomstances ..
XplaiN but think of me as stupid
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon Sep 08, 2003 7:15 pm
I think checking $arg as the first thing inside the proc would make the most sense. Then you would avoid all that work for nothing. No need to split an empty string just to find out it's empty
The best way to check if a variable is empty (imo) is
Code: Select all
if {[string length $arg]} {not empty} {empty}
d
deepforest
Post
by deepforest » Tue Sep 09, 2003 8:10 am
i trying this code but command doesn't working.
bind msg !kill kill:msg
proc kill:msg {nick uhost hand chan arg} {
set user [lindex $arg 0]
set reason [lindex $arg 1]
if {[string match -nocase "" $user] || [string match -nocase "" $reason] == 1} {
putserv "NOTICE $nick :Usage: !kill <nick> <reason>"
} else {
putserv "KILL $user $reason"
putserv "NOTICE $nick :$user has been killed from irc."
}
}
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Tue Sep 09, 2003 8:35 am
deepforest wrote: i trying this code but command doesn't working.
Try using the correct syntax when creating the bind
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Sep 09, 2003 10:00 am
[from tcl-commands.doc]
(1) MSG
bind msg <flags> <command> <proc>
procname <nick> <user@host> <handle> <text>
Description: used for /msg commands. The first word of the user's
msg is the command, and everything else becomes the text argument.
Module: server
also don't forget what User said:
set arg [split $arg]
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Tue Sep 09, 2003 11:51 am
Actualy user was talking about the bind wich is incorrect. Also, please do follow the sugestions you've recived for the public bind.
Once the game is over, the king and the pawn go back in the same box.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Sep 09, 2003 12:13 pm
user wrote: ...also, SPLITTING THE STRING BEFORE YOU USE LIST COMMANDS ON IT might be a good idea.
caesar, I was talking abou this post. wasn't he talking about the [aplit $arg] ?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Tue Sep 09, 2003 12:47 pm
Actualy is
split not
aplit Also he sugested a better way to get the
length of the line using the
string length .. pay attention.
Once the game is over, the king and the pawn go back in the same box.