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.

Need someone to code this important script for me.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Need someone to code this important script for me.

Post by samhain »

Hi, i have been looking for this script for quite a long time due to repeat flooding in my channel i need this script badly. i want a script which will autovoice users in 15 or 10 secs in presence of +D mode. can someone please script this for me.
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

like this?
User has +D flag in bot...

12:34.00 - User joins #lamest!
12:34:15 - Eggie sets mode +v on User!
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

# +D/+d I mean +D/+d is a channel mode.

If a channel is set to +D users joining the channel wont be shown until something "happens to them". This means, a user joins the channel and remains "hidden" till he speaks, gets opped/voiced etc. Only at this point the join will be displayed. This mode is to prevent the disruption of channel discussions where lots of users are joining.

If the channel is set to -D again and there are still "hidden" users left, the server will set mode +d until the last one is visible or left the channel.

"Hidden" users are shown by /names -d #channel.

If you /whois a user who is in a channel with +D set and the user is not "visible" there yet, you'll see that channel prefixed by a < sign. i.e. <#delaychannel NOTE: mode +D isn't available on all servers yet, it will come with ircu2.10.12

so it's helpful in stopping the flooders. after 10-15 secs in presence of +D mode people voice them.
User avatar
DarkRaptor
Voice
Posts: 36
Joined: Sat Apr 15, 2006 2:39 am
Location: Trois-Rivières, Qc

Post by DarkRaptor »

use sentinel.tcl 's variable to don't "names -d #channel" while a flood
will not voice user if his nick!user@host match an existing ban in internal banlist
voice user by X

Code: Select all

set modeD(channel) "#yourchannel"


bind TIME - "* * * * *" modeD:send:names
bind RAW - 355 modeD:receives:names
bind RAW - 352 modeD:receives:who

proc modeD:send:names { minutes hours days months years } {
        global modeD sl_flooded
        if {[validchan $modeD(channel)]} {
                if {[regexp {D|d} [lindex [getchanmode $modeD(channel)] 0]] &&
                    $sl_flooded([string tolower $modeD(channel)]) != "1" } {
                        putquick "NAMES -d $modeD(channel)"
                }
        }
}

proc modeD:receives:names { from raw args } {
        global modeD
        set chan [lindex [split $args] 2]
        set temp1 [lindex [split $args :] 1]
        set temp2 [string range $temp1 0 end-1]
        set nicklist "$temp2"
        if {[string tolower $chan] == [string tolower $modeD(channel)] && [regexp -nocase {[a-z]|[0-9]} $nicklist]} {
                foreach user [split $nicklist] {
                        puthelp "WHO $user"
                }
        }
}

proc modeD:receives:who { from raw args } {
        global modeD
        set identd [lindex [split $args] 2]
        set host [lindex [split $args] 3]
        set nick [lindex [split $args] 5]
        set chan $modeD(channel)
        if {![matchban $nick!$identd@$host] && ![matchban $nick!$identd@$host $chan]} {
                utimer [rand 8] [list puthelp "PRIVMSG X :voice $chan $nick"]
        }
        # hidden user appear in ".channel #chan" command and
        # stays there even when they parts or disconnect.
        resetchan $chan
}
DarkRaptor @ irc.undernet.org
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

How come you use 'args' and then you [split] it??! Args will already be a list, this script is flawed majorly.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

# hidden user appear in ".channel #chan" command and
# stays there even when they parts or disconnect.
what does this mean? and speechless can you please work at it and fix it for me. i really need it badly, regards.
User avatar
DarkRaptor
Voice
Posts: 36
Joined: Sat Apr 15, 2006 2:39 am
Location: Trois-Rivières, Qc

Post by DarkRaptor »

work only if nickname is like {nick} [nick]. I have forget to verify with nickname like [nick} {nick[...



@speechles: I'm not TCL expert. If you think you can correct this, show us how. I'm just asking to learn.
DarkRaptor @ irc.undernet.org
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

What speechles is pointing out, is that "args" is a special argument-name. It allows a proc to accept 0 or more parameters; each parameter will be added as a list item to args. When using bindings with eggdrop, it is advised to avoid using "args", as bindings always will call the proc with a fixed number of arguments (specified by the binding).

Simple fix would be to rename args into something different (such as "arg" or "text") throughout the script.
NML_375
User avatar
DarkRaptor
Voice
Posts: 36
Joined: Sat Apr 15, 2006 2:39 am
Location: Trois-Rivières, Qc

Post by DarkRaptor »

i hope this work

Code: Select all

set modeD(channel) "#yourchan"


bind TIME - "* * * * *" modeD:send:names
bind RAW - 355 modeD:receives:names
bind RAW - 352 modeD:receives:who

proc modeD:send:names { minutes hours days months years } {
        global modeD sl_flooded
        if {[validchan $modeD(channel)]} {
                if {[regexp {D|d} [lindex [getchanmode $modeD(channel)] 0]] &&
                    $sl_flooded([string tolower $modeD(channel)]) != "1" } {
                        putquick "NAMES -d $modeD(channel)"
                }
        }
}

proc modeD:receives:names { from raw text } {
        global modeD
        set chan [lindex [split $text] 2]
        set nicklist [lindex [split $text :] 1]
        if {[string tolower $chan] == [string tolower $modeD(channel)] && $nicklist != "" } {
                foreach user [split $nicklist] {
                        puthelp "WHO $user"
                }
        }
}

proc modeD:receives:who { from raw text } {
        global modeD
        set identd [lindex [split $text] 2]
        set host [lindex [split $text] 3]
        set nick [lindex [split $text] 5]
        set chan $modeD(channel)
        if {![matchban $nick!$identd@$host] && ![matchban $nick!$identd@$host $chan]} {
                if {[onchan X $chan]} {
                        utimer [rand 8] [list puthelp "PRIVMSG X :voice $chan $nick"]
                }
        }
        resetchan $chan
}
With args, the list end with "}" but not with text. Thanks nml375. I have learned something today
DarkRaptor @ irc.undernet.org
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

DarkRaptor wrote:With args, the list end with "}" but not with text. Thanks nml375. I have learned something today
Args invokes the interpreter to 'swallow' all the arguments passed to it into a list. This involves encapsulating it all within curly braces {}, using double-quotes "" around the parameter if it contains spaces and escaping any potential tcl special characters. It creates a list by doing as I just explained so that you can have a variable number of arguments invoke your procedure. Your use of [split $args] suggested to me that you misunderstood this. $args is already a list, and splitting it in effect destroys this list and creates a 2nd list. The 2nd list will escape the present curly braces from the first list, and use these in the new list [split] creates (hence you seeing those { and } in odd places). It will also potentially escape escapes and destroy several other things. That is why it is best to avoid using $args ever unless you fully understand the consequences.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

I want it to voice everyone hidden on the channel? will it do the same?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

samhain wrote:I want it to voice everyone hidden on the channel? will it do the same?
The code he posted using $text and not $args should. But you might want to change this part.

Code: Select all

bind TIME - "* * * * *" modeD:send:names 
The above will be a resource hog biding time to all wildcards.... You may want to use something more sane.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

I wish I was a coder, so then I would have changed that to something more appropriate, and as I am not a coder, that's why I asked you to change it for me sir. to something appropriate.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

samhain wrote:I wish I was a coder, so then I would have changed that to something more appropriate, and as I am not a coder, that's why I asked you to change it for me sir. to something appropriate.
/eggdrop/doc/tcl-commands.doc wrote: (37) TIME (stackable)
bind time <flags> <mask> <proc>
proc-name <minute> <hour> <day> <month> <year>

Description: allows you to schedule procedure calls at certain
times. mask matches 5 space separated integers of the form:
"minute hour day month year". minute, hour, day, month have a
zero padding so they are exactly two characters long; year is
extended to four characters in the same way.
Module: core
In effect, the best this can ever do is bind to time every minute. Polling a /names -d #chan userlist, then checking every single name against a ban, if it isn't banned, if X is on the channel, X will voice it, basically identical to the behavior of using timer, as the best it can do is every minute as well.

If you want to go crazy, and it sounds like you do with "polling every 10-15 seconds", well... We can venture into the realm of insanity to prove a point:

Code: Select all

set modeD(channel) "#yourchan"
set modeD(timermin) "10"'
set modeD(timermax) "15"

bind RAW - 355 modeD:receives:names
bind RAW - 352 modeD:receives:who

proc modeD:send:names { } {
        global modeD
        if {[validchan $modeD(channel)]} {
                if {[regexp {D|d} [lindex [getchanmode $modeD(channel)] 0]]} {
                        putquick "NAMES -d $modeD(channel)"
                }
        }
        utimer [expr $modeD(timermin)+[rand [expr $modeD(timermax)-$modeD(timermin)]]] [list modeD:send:names]
}

proc modeD:receives:names { from raw text } {
        global modeD
        set chan [lindex [split $text] 2]
        set nicklist [lindex [split $text :] 1]
        if {[string tolower $chan] == [string tolower $modeD(channel)] && $nicklist != "" } {
                foreach user [split $nicklist] {
                        puthelp "WHO $user"
                }
        }
}

proc modeD:receives:who { from raw text } {
        global modeD
        set identd [lindex [split $text] 2]
        set host [lindex [split $text] 3]
        set nick [lindex [split $text] 5]
        set chan $modeD(channel)
        if {![matchban $nick!$identd@$host] && ![matchban $nick!$identd@$host $chan]} {
                utimer [rand 8] [list puthelp "PRIVMSG X :voice $chan $nick"]
        }
        # hidden user appear in ".channel #chan" command and
        # stays there even when they parts or disconnect.
        resetchan $chan
}

utimer [expr $modeD(timermin)+[rand [expr $modeD(timermax)-$modeD(timermin)]]] [list modeD:send:names]
This is basically a utimer event occuring at least every 10 seconds (modeD(timermin)). The script will randomly select a time between the timermin and timermax you set which will poll for a names -d #chan list (services might not tolerate this repeated polling.. who knows and is why we randomly time it so it doesn't appear so scripted..heh). It will then interpret that list, and if the nick isn't banned and X is on the channel will voice that user who was previously -d. This is even more a resource hog than binding to time, but it fits your request. Play with the timermin/timermax until you find a comfortable range.
Last edited by speechles on Thu Aug 07, 2008 2:38 am, edited 4 times in total.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

what If I want to do it after every minute? I have to change utimer '10' to '60' ?
Post Reply