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.

!addcmd

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
C
CuteBangla
Halfop
Posts: 58
Joined: Mon Feb 27, 2006 10:47 pm
Location: Dhaka, Bangladesh
Contact:

!addcmd

Post by CuteBangla »

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
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Maybe this topic can help you.
C
CuteBangla
Halfop
Posts: 58
Joined: Mon Feb 27, 2006 10:47 pm
Location: Dhaka, Bangladesh
Contact:

Re Sir_Fz

Post by CuteBangla »

Code: Select all

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.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Why did you ask in both topics? try the code.
C
CuteBangla
Halfop
Posts: 58
Joined: Mon Feb 27, 2006 10:47 pm
Location: Dhaka, Bangladesh
Contact:

Re Sir_Fz

Post by CuteBangla »

ya its working thanks
Sir_Fz wrote:.....
h
hpostiga
Voice
Posts: 3
Joined: Thu Dec 29, 2005 12:13 am

Post by hpostiga »

and for del a command?
C
CuteBangla
Halfop
Posts: 58
Joined: Mon Feb 27, 2006 10:47 pm
Location: Dhaka, Bangladesh
Contact:

Re hpostiga

Post by CuteBangla »

i deleted manually from cmd.txt then restarted bot

hpostiga wrote:and for del a command?
Post Reply