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 

invite

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


Joined: 29 Oct 2006
Posts: 31

PostPosted: Sat May 12, 2007 2:31 pm    Post subject: invite Reply with quote

hey guys, I need some help
Code:

# Character that will be used before public querries
set edu(cmdchar) "."
# Owner flag:
set edu(flag.owner) "o"
# Voice flag
set edu(flag.voice) "V"

bind pub $edu(flag.owner)|$edu(flag.voice) $edu(cmdchar)invite edu:pub:invite

# .invite <nickname>
proc edu:pub:invite {nickname hostname handle channel text} {
   global edu
   set text [split $text]
   set invite_nickname [join [lrange $text 0 1]]
   if {![channel get $channel [censored]]} {
      return
   }
     if {![botisop $channel]} {
      putquick "NOTICE $nickname :ERROR: I'm not opped on $channel"
      return
   }
   if {$invite_nickname == ""} {
      putquick "NOTICE $nickname :SYNTAX: $edu(cmdchar)invite <nickname>"
      return
   }
   if {[onchan $invite_nickname $channel]} {
      putquick "NOTICE $nickname :ERROR: $invite_nickname is already in $channel"
      return
   }
   putquick "INVITE $invite_nickname $channel"
   putquick "NOTICE $nickname :*INVITE* $invite_nickname on $channel"
}


The things I need are the following 1) .invite [#channel] <nickname> and 2) $botnick invite [#channel] <nickname>

I need you help as soon as possible, please.

PS: please, thanks.

PS2: Sorry for my bad english
_________________
Seek the truth
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat May 12, 2007 3:48 pm    Post subject: Reply with quote

Code:
bind pubm n|n * invite:nick

proc invite:nick {nick uhost hand chan arg} {
 foreach {a b} [split $arg] {break}
 if {[string equal -nocase .invite $a]} {
  set cmd .invite
  set parm [join [lrange [split $arg] 1 end]]
 } elseif {[isbotnick $a] && [string equal -nocase invite $b]} {
  set cmd "$::botnick invite"
  set parm [join [lrange [split $arg] 2 end]]
 }
 if {[info exists cmd]} {
  if {[scan $parm {%s %s} c n]!=2} {
   puthelp "notice $nick :USAGE: $cmd <#chan> <nick>"
   return 0
  }
  puthelp "invite $n $c"
  puthelp "notice $nick :Invited $n to $c"
 }
}

Edit: Applied caesar's suggestion Smile
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts


Last edited by Sir_Fz on Sat May 12, 2007 4:01 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sat May 12, 2007 3:58 pm    Post subject: Reply with quote

Hi, I see you are using '[lindex [split $arg] 0]' two times and then '[lindex [split $arg] 1]' one time, and I wonder why don't you just:
Code:

foreach (foo bar) [split $arg] {break}

(if I recall corectly) or even make a variable like:
Code:

set split [split $arg]

and use 'split' variable instead of splitting it n times.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat May 12, 2007 4:02 pm    Post subject: Reply with quote

Well I didn't apply that since I'm doing the check only once, however I edited the code and applied it; thanks for your suggestion Wink
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
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