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.

simple script

Old posts that have not been replied to for several years.
Locked
b
bair
Voice
Posts: 5
Joined: Wed Nov 19, 2003 2:03 pm

simple script

Post by bair »

I'm new at TCL, could someone script this for me, hopefully ill just be able to use this as an example and go from there. I have a channel called #invitescrim:s and I want all the people with +o and +v to be able to kick/ban people with no access by typing .noti namehere. So i could type .noti dumbo and it would kick/ban dumbo (he cant be a peon or op). Thanks.
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Re: simple script

Post by ^DooM^ »

bair wrote:I'm new at TCL, could someone script this for me, hopefully ill just be able to use this as an example and go from there. I have a channel called #invitescrim:s and I want all the people with +o and +v to be able to kick/ban people with no access by typing .noti namehere. So i could type .noti dumbo and it would kick/ban dumbo (he cant be a peon or op). Thanks.
If i understood what you were asking correctly this should do the trick.

Code: Select all

bind pub - .noti pub_kick

proc pub_kick {nick uhost hand chan args} {

    global botnick

    set args [lindex $args 0]
    set lamer [lindex $args 0]
    if {[!isop $nick] || [!isvoice $nick]} {
        putserv "PRIVMSG $chan :You dont have access to this command."
        return 0
    }
    if {[botisop $chan]} {
        if {[string length $args] > 0} {
            if {($lamer == $botnick)} { 
                putserv "PRIVMSG $chan :Why the hell would i want to kick myself?"
                return 0
            }
            if {[string length [lindex $args 1]] == 0} {
                set reason "kicked and banned by $nick"
            } else { 
                set reason [lrange $args 1 end]
            }
            if {[onchan $lamer $chan]} { 
                newchanban $chan *!*@[lindex [split [getchanhost $lamer $chan] @] 1] $nick $reason 120
                utimer 5 [putkick $chan $lamer $reason]
            } else { 
                puthelp "NOTICE $nick :no such nick on channel!"
            }            
        } else { 
            puthelp "NOTICE $nick :usage .noti <nick> <reason> - kicks and bans a nick "
        }
    } else { 
        puthelp "NOTICE $nick :i dont have ops!" 
    }
}
Hope this helps :wink:
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

^DooM^, your solution is like "Hello, world" program in Win32 API ;)

this shoud get that guy started:

Code: Select all

bind pub ov .noti foo
proc foo {n u h c t} {
  if {[nick2hand $t $c] == "*"} {
    newchanban $c [maskhost $t![getchanhost $t $c]] $n out
    putkick $c $t out
  }
}
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

Demond i intentionally wrote it that way as the guy is 'NEW' to TCL.

You can follow my script quite easily and work out what each part is doing.

Your script is too advanced for beginners although they do the same job. I was just trying to give the guy a nice easy start.

If i saw {n u h c t} for the first time I wouldn't have a clue what they meant. :lol:

also if you read what he said he wanted people with no access which i took to mean they weren't added to the bots userlist so binding 'ov' wouldn't work
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
b
bair
Voice
Posts: 5
Joined: Wed Nov 19, 2003 2:03 pm

Post by bair »

thanks, when i said no access i simply meant they were an op or a voice in the channel (has nothing to do with the eggdrops userlist, just chanserv's), all the ops and voiced people can kick the nonopped and nonvoiced people by doing .noti name, is that how these are set up?
Last edited by bair on Tue Dec 28, 2004 7:28 pm, edited 1 time in total.
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

have you added the ops and voiced people into the bots userlist?

The script i wrote should work regardless of if they are added to the bot or not it just works on if they have ops or voice in channel. My script also checks to see if the person being kicked and banned is in the channel and that the user has actually typed a nick into the command line and if not they are shown howto use the command.

demonds script is just a simple kickban script as was intended but no checks at all and no help it will just execute that script if the person is there or not. but demonds script does require that the users of the command are added to the bots userlist.

They both will have the same result the offender will be removed from the channel. :wink:
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
b
bair
Voice
Posts: 5
Joined: Wed Nov 19, 2003 2:03 pm

Post by bair »

i dont want to have to add anyone to the bot's userlist, ops and voices can use it at default
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

bair wrote:i dont want to have to add anyone to the bot's userlist, ops and voices can use it at default
Thats what i thought you meant from your original posting.

Its upto you what you use as its your bot we just offer help and let you decide what you want todo with that help. :wink:
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

bair wrote:i dont want to have to add anyone to the bot's userlist, ops and voices can use it at default
try this:

Code: Select all

bind pub - .noti kbpeon
proc kbpeon {nick uhost hand chan text} {
  set victim [lindex [split $text] 0]
  if ![botisop $chan] return
  if {[isop $nick $chan] || [isvoice $nick $chan]} {
    if {![isop $victim $chan] && ![isvoice $victim $chan]} {
      putserv "mode $chan +b [maskhost $victim![getchanhost $victim]]"
      putserv "kick $chan $victim :peon kickban"
    }
  } 
}
Last edited by demond on Tue Dec 28, 2004 9:52 pm, edited 1 time in total.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Why not combine them together to make it smaller and faster?

Code: Select all

proc pub - .noti kbpeon

proc kbpeon {nick uhost hand chan text} {
 if {![botisop $chan]} {return 0}
 if {[isop $nick $chan] || [isvoice $nick $chan] && ![isop [lindex [split $text] 0] $chan] && ![isvoice [lindex [split $text] 0] $chan]} {
  putserv "mode $chan +b [maskhost [lindex [split $text] 0]![getchanhost [lindex [split $text] 0]]]"
  putserv "kick $chan [lindex [split $text] 0] :peon kickban"; return 0
  }
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

lindex'ing and splitting several times instead of just once is hardly smaller & faster, don't you think? besides, the proc execution time in this case is totally irrelevant - as your return 0's
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Na I was just saying to reduce this:

Code: Select all

  if {[isop $nick $chan] || [isvoice $nick $chan]} {
    if {![isop $victim $chan] && ![isvoice $victim $chan]} { 

to this:

  if {[isop $nick $chan] || [isvoice $nick $chan] && ![isop [lindex [split $text] 0] $chan] && ![isvoice [lindex [split $text] 0] $chan]} {

Two if statements can be put together into one
Obviously lindexing it at first is for easier reading ability, and as for the return 0, its same as like halt. Well it is not compulsory and executes after everything has executed so I wouldn't count it to delay anything. It's just if you want to use it or not, doesn't make a big difference within this proc.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

return 0 same as halt? what are you talking about?? we're not dealing with mIRC scripting here...

the return code from [bind pub] proc is only relevant if it's 1, which means log the command; you are confused with other type binds (ctcp, raw, etc.) which force the bot to discontinue further processing of that event if return 1 (not 0!); I suppose you actually meant that "halt", which has nothing to do with [bind pub] proc
Locked