egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

!addcmd

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
CuteBangla
Halfop


Joined: 27 Feb 2006
Posts: 58
Location: Dhaka, Bangladesh

PostPosted: Tue Mar 28, 2006 7:04 am    Post subject: !addcmd Reply with quote

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
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Mar 28, 2006 7:37 pm    Post subject: Reply with quote

Maybe this topic can help you.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
CuteBangla
Halfop


Joined: 27 Feb 2006
Posts: 58
Location: Dhaka, Bangladesh

PostPosted: Tue Mar 28, 2006 11:59 pm    Post subject: Re Sir_Fz Reply with quote

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
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Mar 29, 2006 6:18 am    Post subject: Reply with quote

Why did you ask in both topics? try the code.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
CuteBangla
Halfop


Joined: 27 Feb 2006
Posts: 58
Location: Dhaka, Bangladesh

PostPosted: Wed Mar 29, 2006 7:58 am    Post subject: Re Sir_Fz Reply with quote

ya its working thanks

Sir_Fz wrote:
.....

_________________
SuMiT
iRC.CuteBangla.Com
Back to top
View user's profile Send private message Visit poster's website
hpostiga
Voice


Joined: 29 Dec 2005
Posts: 3

PostPosted: Thu Mar 30, 2006 8:14 pm    Post subject: Reply with quote

and for del a command?
Back to top
View user's profile Send private message
CuteBangla
Halfop


Joined: 27 Feb 2006
Posts: 58
Location: Dhaka, Bangladesh

PostPosted: Fri Mar 31, 2006 12:08 am    Post subject: Re hpostiga Reply with quote

i deleted manually from cmd.txt then restarted bot


hpostiga wrote:
and for del a command?

_________________
SuMiT
iRC.CuteBangla.Com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber