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 

/msg nick join and part
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Riddler
Halfop


Joined: 20 May 2007
Posts: 60
Location: Brasov, Romania

PostPosted: Tue May 22, 2007 8:31 am    Post subject: Reply with quote

YooHoo wrote:
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

oki...thanks for the advice...

New modification to the Code and i have this:

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
    deluser ~$text
    putserv "NOTICE $nick :Channel deleted:\002 $text \002"
  }
}


Ok, the delchan command works great, but the addchan command has still an error.

Code:
 [14:28] Tcl error [s:addchan]: can't read "default": no such variable


.....
_________________
I am a man of few words, but many riddles
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue May 22, 2007 1:20 pm    Post subject: Reply with quote

Tcl has some issues with a few characters, such as "-", within variable names. In these cases you need to enclose the variable name with {}, ie. ${default-flags}.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
xU
Voice


Joined: 24 May 2007
Posts: 7

PostPosted: Thu May 24, 2007 5:33 pm    Post subject: Reply with quote

Hi, Very Happy
Code:
############################################## Date: 25May06 ############################
##      xU (Qadsia@hotmail.com        WeArab: #Qadsia ########      msg-part.tcl        #
#########################################################################################

#########################################################################################
#                                                             #       Note:             #
#                    Name: MeShari                            #                         #
#                Nickname:  xU                                #        None             #
#                     IRC: Irc.WeArab.Net: -j #qadsia         #                         #
#                   Email: Qadsia@hotmail.com                 #                         #
#                                                             #                         #
#                                                             ###########################
#########################################################################################
 

## bind ##
##########
bind msgm - * proc:privmsg

## proc ##
##########
proc proc:privmsg { nick uhost hand text } {
set text [string tolower $text]
if {([stirng tolower bondie] == "[string tolower $nick]")} {
if {[lindex $text 0]) == "!join")} {
if {([lindex $text 1] == "")} {putquick "privmsg $nick :WARNING: Please enter Channel /msg <botnet> !join #channel"}
if {([botonchan [lindex $text 1]])} {putquick "privmsg $nick :WARNING: Iam already on channel!"
} else {
if {([lindex $text 1]) != "")} {putquick "privmsg $chan :NOTE: Try to join [lindex $text 1];channel add [lindex $text 1];utimer 1 save}
}
}
if {[lindex $text 0]) == "!part")} {
if {([lindex $text 1] == "")} {putquick "privmsg $nick :WARNING: Please enter Channel /msg <botnet> !part #channel"}
if {(![botonchan [lindex $text 1]])} {putquick "privmsg $nick :WARNING: Iam not in channel!"
} else {
if {([lindex $text 1]) != "")} {putquick "privmsg $chan :NOTE: Try to part [lindex $text 1];channel remove [lindex $text 1];utimer 1 save}
}
}
}
}
Back to top
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu May 24, 2007 5:43 pm    Post subject: Reply with quote

@xU:
Try replacing "stirng" with "string". And dont, ever, use lindex on plain strings! It's designed to be used on proper tcl-lists only (list and split is your friend here).

Also, I am abit confused as to why you have a hardcoded nick in the middle of the code...

Finally, for simple informational msgs, you'd be better off using puthelp rather than putquick.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Riddler
Halfop


Joined: 20 May 2007
Posts: 60
Location: Brasov, Romania

PostPosted: Thu May 24, 2007 6:43 pm    Post subject: Reply with quote

nml375 wrote:
Tcl has some issues with a few characters, such as "-", within variable names. In these cases you need to enclose the variable name with {}, ie. ${default-flags}.


Thank you nml375 Very Happy , the script works great now...just didn`t need no more for the $default-flags, because the eggdrop.conf has a option to set them and the adduser comand work with that option. Cool

The new cod :
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
    adduser ~$text
    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
    deluser ~$text
    putserv "NOTICE $nick :Channel deleted:\002 $text \002"
  }
}


now I ask one last thing, how do add an option that will not add the username to the database with the "#" in front of the name ?

Code:
<|Rbot1> [00:38] |Rbot2: newuser ~#chan hp
(01:41:09) <|Rbot1> [00:38] |Rbot2: chattr ~#chan hpC
----
<h4nd> .whois ~#chan
<|Rbot1> [00:37] #h4nd# whois ~#chan
<|Rbot1> HANDLE       PASS NOTES FLAGS           LAST
<|Rbot1> ~#chan      no       0 hpC             never (nowhere)


a simple adduser without the "#" , some thing like this:

Code:
<h4nd> .whois ~chan
<|Rbot1> [00:37] #h4nd# whois ~chan
<|Rbot1> HANDLE       PASS NOTES FLAGS           LAST
<|Rbot1> ~chan      no       0 hpC             never (nowhere)

_________________
I am a man of few words, but many riddles
Back to top
View user's profile Send private message Send e-mail Visit poster's website
notrox
Voice


Joined: 28 May 2007
Posts: 5

PostPosted: Mon May 28, 2007 10:36 pm    Post subject: Reply with quote

i'm looking for the exact same thing , but to msg me when anyone joins a selected channel
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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