| View previous topic :: View next topic |
| Author |
Message |
samhain Halfop
Joined: 03 Jan 2007 Posts: 77
|
Posted: Sun Jul 27, 2008 4:05 pm Post subject: Need someone to code this important script for me. |
|
|
| 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. |
|
| Back to top |
|
 |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Sun Jul 27, 2008 6:59 pm Post subject: |
|
|
like this?
| Quote: |
User has +D flag in bot...
12:34.00 - User joins #lamest!
12:34:15 - Eggie sets mode +v on User!
|
|
|
| Back to top |
|
 |
samhain Halfop
Joined: 03 Jan 2007 Posts: 77
|
Posted: Mon Jul 28, 2008 3:11 am Post subject: |
|
|
# +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. |
|
| Back to top |
|
 |
DarkRaptor Voice

Joined: 15 Apr 2006 Posts: 36 Location: Trois-Rivières, Qc
|
Posted: Thu Jul 31, 2008 1:15 pm Post subject: |
|
|
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: | 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 |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Jul 31, 2008 1:33 pm Post subject: |
|
|
How come you use 'args' and then you [split] it??! Args will already be a list, this script is flawed majorly. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
samhain Halfop
Joined: 03 Jan 2007 Posts: 77
|
Posted: Thu Jul 31, 2008 1:49 pm Post subject: |
|
|
# 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. |
|
| Back to top |
|
 |
DarkRaptor Voice

Joined: 15 Apr 2006 Posts: 36 Location: Trois-Rivières, Qc
|
Posted: Thu Jul 31, 2008 2:20 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Jul 31, 2008 2:26 pm Post subject: |
|
|
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, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
DarkRaptor Voice

Joined: 15 Apr 2006 Posts: 36 Location: Trois-Rivières, Qc
|
Posted: Thu Jul 31, 2008 3:08 pm Post subject: |
|
|
i hope this work
| Code: | 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 |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Jul 31, 2008 3:33 pm Post subject: |
|
|
| 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. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
samhain Halfop
Joined: 03 Jan 2007 Posts: 77
|
Posted: Thu Jul 31, 2008 3:56 pm Post subject: |
|
|
| I want it to voice everyone hidden on the channel? will it do the same? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Jul 31, 2008 4:03 pm Post subject: |
|
|
| 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: | | 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. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
samhain Halfop
Joined: 03 Jan 2007 Posts: 77
|
Posted: Thu Jul 31, 2008 4:17 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Jul 31, 2008 4:40 pm Post subject: |
|
|
| 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: | 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. _________________ speechles' eggdrop tcl archive
Last edited by speechles on Thu Aug 07, 2008 2:38 am; edited 4 times in total |
|
| Back to top |
|
 |
samhain Halfop
Joined: 03 Jan 2007 Posts: 77
|
Posted: Thu Jul 31, 2008 4:56 pm Post subject: |
|
|
| what If I want to do it after every minute? I have to change utimer '10' to '60' ? |
|
| Back to top |
|
 |
|