| View previous topic :: View next topic |
| Author |
Message |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Tue Mar 28, 2006 7:04 am Post subject: !addcmd |
|
|
i need a script help wich will b abale to add trigers for eggdrop what can use in channel
like
<SuMiT>!addcmd laugh PRIVMSG 12hands13 $who 12a huggable
teddy bear and smiles at
<CuteBangla>Command Added
<SuMiT>!laugh JiN0
<CuteBangla>12hands13 JiN0 12a huggable
teddy bear and smiles at _________________ SuMiT
iRC.CuteBangla.Com |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Tue Mar 28, 2006 11:59 pm Post subject: Re Sir_Fz |
|
|
| Code: |
set cmdsfile "scripts/cmds.txt"
if {![file exists $cmdsfile]} {
set fileid [open $cmdsfile w]
close $fileid
} {
source $cmdsfile
}
bind pub n !addcommand add:command
proc add:command {n u h c a} {
global addedcommands
set command [lindex [split $a] 0]
set action [join [lrange [split $a] 1 end]]
if {[info command added:$command] == ""} {
set addedcommands($command) $action
proc added:$command {n u h c a} {
global addedcommands
puthelp "privmsg $c :\001ACTION [string map [list %nick [lindex [split $a] 0]] $addedcommands($::lastbind)]\001"
}
bind pub - $command added:$command
save:command $command $action
puthelp "notice $n :Added add:$command command."
} {
puthelp "notice $n :Command added:$command already exists."
}
}
proc save:command {c act} {
global cmdsfile
set c [string map {\[ \\\[ \] \\\] \\ \\\\} $c]
set cmdlist [split [read [set f [open $cmdsfile]]] \n][close $f]
lappend cmdlist "bind pub - $c added:$c"
lappend cmdlist ""
lappend cmdlist "set addedcommands($c) [list $act]"
lappend cmdlist ""
set f [open $cmdsfile w]
foreach cmd $cmdlist {
puts $f $cmd
}
puts $f [printproc added:$c]
close $f
}
# user's proc from the Tcl faq forum
proc printproc proc {
set args {}
foreach arg [info args $proc] {
if {[info default $proc $arg val]} {
lappend args [list $arg $val]
} {
lappend args [list $arg]
}
}
list proc $proc $args [info body $proc]
}
|
is it the final code ???
| Sir_Fz wrote: | | Maybe this topic can help you. |
_________________ SuMiT
iRC.CuteBangla.Com |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Wed Mar 29, 2006 7:58 am Post subject: Re Sir_Fz |
|
|
ya its working thanks
_________________ SuMiT
iRC.CuteBangla.Com |
|
| Back to top |
|
 |
hpostiga Voice
Joined: 29 Dec 2005 Posts: 3
|
Posted: Thu Mar 30, 2006 8:14 pm Post subject: |
|
|
| and for del a command? |
|
| Back to top |
|
 |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Fri Mar 31, 2006 12:08 am Post subject: Re hpostiga |
|
|
i deleted manually from cmd.txt then restarted bot
| hpostiga wrote: | | and for del a command? |
_________________ SuMiT
iRC.CuteBangla.Com |
|
| Back to top |
|
 |
|