| View previous topic :: View next topic |
| Author |
Message |
primus Voice
Joined: 31 Jul 2015 Posts: 12 Location: West Coast
|
Posted: Sat Aug 01, 2015 8:06 pm Post subject: Looking for mc.limit.tcl |
|
|
| It's no longer in the archive and cant find anywhere else. Anyone have a copy? |
|
| Back to top |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
|
| Back to top |
|
 |
primus Voice
Joined: 31 Jul 2015 Posts: 12 Location: West Coast
|
Posted: Sun Aug 02, 2015 5:23 pm Post subject: |
|
|
Not it, but thanks...
It's specific to MC_8's scripts... |
|
| Back to top |
|
 |
primus Voice
Joined: 31 Jul 2015 Posts: 12 Location: West Coast
|
Posted: Fri Sep 11, 2015 2:30 am Post subject: |
|
|
Found it finally... Only issue is the SVS portion, but it does not seam to effect the script in any way or report any errors, so it should be all good...
| Code: |
##
# Limit v1.0.1 by MC_8 - Carl M. Gregory <mc8@purehype.net>
# This script will only work on eggdrop 1.5.5 or greater.
#
# My SVS Website - http://mc.purehype.net:81/
##
##
# This script will keep the limit above the number of users, changing the limit
# every (x) min's (you set the x below). This makes the channel more secure in
# such an instance of stopping a large floodnet from join'n at once.
#
# This script beta tested on Undernet, there may be a problem when run on other
# IRC servers. If this is the case, just e`mail me along with what server your
# on and I will test it out.
#
# Just for the record, I made this script because I'm tired of the lame limit
# scripts avilable. This script is so simple for a TCL coder, I don't see why
# everyone made there's so screwy.
#
# The timer resets upon +l mode changes, that way you can run this script on
# as many bots as you wish and it not be a security hole/flood.
#
# Tested on RFC 1459 100% compliant server (Undernet).
# http://www.user-com.undernet.org/documents/rfc1459.txt
##
##
# History
##
# v1.0.1 (11.15.01)
# MC_8 - Removed now unused filt, unfilt, srange, sindex, and slength procs.
# MC_8 - Changed procname eval:pipe to mode.
# MC_8 - Minorly rewrote eval proc.
# MC_8 - Reworte chanintinfo and renamed it to chanint.
# MC_8 - Upgraded SVS from v1.2 to v2.0.
#
# v1.0 (06.27.01)
# MC_8 - Added `mc_limit(reeval)` option.
# MC_8 - Fixed `syntax error in expression "(0+6)-+"`.
# MC_8 - Inital beta release.
##
##
# Settings
##
#
# Note:
# There are three settings you set from dcc chat with the bot using .chanset.
# mc.limit_users <number> Setting this to the limit to set, above the current
# of users in channel. (ie. I always set mine to 5,
# witch means if 25 people are in the channel... the
# script will set the limit to 30.)
# The default for all channels is 0, witch means to
# disable the script for that channel.
#
# mc.limit_grace <number> Set this to the grace limit you would like to have
# on the particular channel. Here, let me try to
# explain grace limit: Let's say there are 25 users
# in the channel, and you have mc.limit_users
# setting set to 5, and the current limit in the
# channel 28. Should the script change the limit to
# 30 or be allowed the 2 user grace...
# The default for all channels is 0, witch means no
# grace for the particular channel.
#
# mc.limit_time <number> Set this to how often (in min's) the script to
# check the particular channel to ensure the limit is
# set the way you want it, and if not set the way you
# want it... it will adjust the limit.
#
# Example from dcc chat with the bot:
# .chanset #channel mc.limit_users 5
# .chanset #channel mc.limit_grace 2
# .chanset #channel mc.limit_time 5
#
# To disable the script on a particular channel(s), set mc.limit_time
# to 0 for that channel.
# When someone changes the limit in the channel, this script will auto evaluate
# that limit to make sure it's within correct limits. If it's not then it will
# set it to it's correct limits. What flaged users do you want to exempt form
# re-evaluation?
#
# This is usefull when you have more than 1 bot running this script, and the irc
# server just did a netjoin and everything is all desynched. On one bot it may
# look like there are 5 users, other the other it may look like there are 20 users.
# In a case like that, you don't want them both to fight over the limit, so I
# exempt bot from re-evaluation.
#
# Flag Structure: <Global>|<Channel>
# Set this to "" exempt no one.
set mc_limit(reeval) "b|"
## MC SVS (Script Version Service) v2.0 ##
# Do you want the bot to connection to MC_8's SVS to see if there are newer versions
# of this script avilable? It will only tell you -- It's up to you to get the newest
# version (I decided not to auto update the code, there may be new features in the
# newest script that may require your attention).
# 0=no/1=yes
set mc_limit(svs:enabled) 0
# Once a day the script will check with the SVS -- this specifies when
# that should happen. The setting should be the hour (military).
# examples:
# set mc_limit(svs:check) 0 ;#This is at Midnight
# set mc_limit(svs:check) 5 ;#This is at 5am
# set mc_limit(svs:check) 13 ;#This is at 1pm
# set mc_limit(svs:check) 23 ;#This is at 11pm
set mc_limit(svs:check) 3
# Upon finding a newer version of this script, who do you want this script
# to send a note to telling them of this newer version?
# If more than 1 user is to be notified, seperate each user with a
# ' ' (space).
set mc_limit(svs:notify) "Pr|muS"
# Do you want even beta version notified to whomever you have set? Or just
# stable releases of the script?
# 0 = Tell me about all version, even beta versions.
# 1 = Just tell me about new stable versions.
set mc_limit(svs:stableonly) 0
##
# Coding below, do not proceed unless you know TCL.
##
set mc_limit(script) "Limit"
set mc_limit(version) "v1.0.1"
set mc_limit(svs:script) "limit"
set mc_limit(svs:version) "001000001000"
set mc_limit(svs:server) "mc.purehype.net"
set mc_limit(svs:port) "81"
set mc_limit(svs:get) "/"
set mc_limit(svs:query) "svs=$mc_limit(svs:script)&version=$mc_limit(svs:version)"
if {$numversion < "1050500"} {
putlog "$mc_limit(script) $mc_limit(version) by MC_8 will only work on eggdrop 1.5.5 or greater."
putlog "$mc_limit(script) $mc_limit(version) will not work with eggdrop $version."
putlog "$mc_limit(script) $mc_limit(version) not loaded."
return 1
}
setudef int mc.limit_users;setudef int mc.limit_grace;setudef int mc.limit_time
proc mc:limit:eval {chan} {
global botnick
if {![mc:limit:resettimer $chan]} {return 0}
set limit_users [mc:limit:chanint $chan mc.limit_users]
if {(!$limit_users) || (![isop $botnick $chan])} {return 0}
set current_mode [getchanmode $chan]
if {[regexp -- l $current_mode]} {set current_limit [lindex [split $current_mode] end]} \
else {set current_limit 0}
if {[regexp -- {[^0-9]} $current_limit]} {set current_limit 0}
set current_users [llength [chanlist $chan]]
set grace [mc:limit:chanint $chan mc.limit_grace]
if {[string trimleft [expr ($current_users+$limit_users)-$current_limit] "-"] <= $grace} {
return 0
}; pushmode $chan +l [expr $current_users+$limit_users]
}
proc mc:limit:chanint {channel int} {
if {![validchan $channel]} {return -code error "no such channel record"}
set list [channel info $channel]
for {set i 0} {![regexp -- {^[0-9]*:[0-9]*$} [lindex $list $i]]} {incr i} {}
for {} {[regexp -- {^[0-9]*:[0-9]*$} [lindex $list $i]]} {incr i} {}
set list [lrange $list $i end]
foreach info [string tolower $list] {
if {[lindex $info 0] == [string tolower $int]} {return [lindex $info 1]}
};return -1
}
bind mode - "% ?l" mc:limit:mode
proc mc:limit:mode {nick uhost hand chan mc victim} {
global mc_limit
if {[matchattr $hand $mc_limit(reeval) $chan] || $mc_limit(reeval) == ""} {
mc:limit:resettimer $chan
return 0
}; mc:limit:eval $chan
}
proc mc:limit:resettimer {chan} {
set chan [string tolower $chan]
foreach timer [timers] {
if {[lindex $timer 1] != [list mc:limit:eval $chan]} {continue}
killtimer [lindex $timer 2]
}
set time [mc:limit:chanint $chan mc.limit_time]
if {!$time} {timer 1 [list mc:limit:eval $chan]} \
else {timer $time [list mc:limit:eval $chan]}
return $time
}; foreach chan [channels] {mc:limit:eval $chan}
## SVS v2.0
if {(![info exists mc_limit(svs:enabled)]) ||
(![regexp -- {^(0|1)$} $mc_limit(svs:enabled)])} {set mc_limit(svs:enabled) 0}
if {(![info exists mc_limit(svs:check)]) ||
([regexp -- {[^0-9]} $mc_limit(svs:check)])} {set mc_limit(svs:check) 0}
if {![info exists mc_limit(svs:notify)]} {set mc_limit(svs:notify) $owner}
if {(![info exists mc_limit(svs:stableonly)]) ||
(![regexp -- {^(0|1)$} $mc_limit(svs:stableonly)])} {set mc_limit(svs:stableonly) 0}
foreach bind [binds mc:limit:svs:time] {
unbind [lindex $bind 0] [lindex $bind 1] [lindex $bind 2] [lindex $bind 4]
}
foreach command [info commands mc:limit:svs:time] {rename $command ""}
if {$mc_limit(svs:enabled)} {
if {($mc_limit(svs:check) > "23") || ($mc_limit(svs:check) < "0")} {set mc_limit(svs:check) 00}
if {[string length $mc_limit(svs:check)] == "1"} {set mc_limit(svs:check) 0$mc_limit(svs:check)}
bind time - "00 $mc_limit(svs:check) *" mc:limit:svs:time
proc mc:limit:svs:time {{args ""}} {
global mc_limit
if {[catch {socket -async $mc_limit(svs:server) $mc_limit(svs:port)} sid]} {;\
putlog "SVS Error\[$mc_limit(svs:script)/$mc_limit(svs:version)\]: $sid"
return 1
}
fconfigure $sid -blocking 0 -buffering line
set tout [after 60000 "mc:limit:svs:interface $sid timeout"]
fileevent $sid readable "mc:limit:svs:interface $sid $tout"
puts $sid "GET $mc_limit(svs:get)?$mc_limit(svs:query) HTTP/1.0\
\nHost: $mc_limit(svs:server)\n"
flush $sid
}
}
proc mc:limit:svs:interface {sid tout} {
global mc_limit
if {$tout == "timeout"} {
putlog "SVS Warning\[$mc_limit(svs:script)/$mc_limit(svs:version)\]: SVS Server timed out."
close $sid
return 0
}; after cancel $tout
set temp 0
while {![eof $sid]} {
gets $sid get
if {$temp < "2"} {
if {$get == ""} {incr temp; if {$temp == "1"} {set temp 2}}
continue
}; if {$get == ""} {continue}
switch -- [lindex $get 0] {
003 {
set reply [lrange $get 1 end]
if {[lindex $reply 0] != $mc_limit(svs:script)} {
putlog "SVS Error\[$mc_limit(svs:script)/$mc_limit(svs:version)\]: SVS Server sent wrong info, got [lindex $reply 0]"
break
}
if {$mc_limit(svs:stableonly)} {
set temp [string range $mc_limit(svs:version) 0 8]999
} else {set temp [string range $mc_limit(svs:version) 0 11]}
if {[lindex $reply 1] > $temp} {
set note [lindex $reply 5]
regsub -- %0 $note [lindex $reply 0] note
regsub -- %1 $note [lindex $reply 1] note
regsub -- %2 $note [lindex $reply 2] note
regsub -- %3 $note [lindex $reply 3] note
regsub -- %4 $note [lindex $reply 4] note
regsub -- %version $note $mc_limit(version) note
foreach to [split $mc_limit(svs:notify) ",; "] {
if {$to == ""} {continue}
regsub -- %nick $note $to outnote
if {[string match *$outnote* [set unotes [notes $to -[notes $to]]]]} {
set temp 0
foreach unote $unotes {
if {$outnote == [lindex $unote 2]} {set temp 1; break}
}; if {$temp} {continue}
}
switch -- [sendnote SVS $to $outnote] {
0 {
if {![validuser $notify]} {set x "invalid user"} else {set x "unknown error"}
putlog "SVS Error\[$mc_limit(svs:script)/$mc_limit(svs:version)\]: Trying to send note to $to, $x."
}
3 {putlog "SVS Error\[$mc_limit(svs:script)/$mc_limit(svs:version)\]: Trying to send note to $to, notebox too full!"}
}
}
}
}
}
}; close $sid
}
## ^
putlog "$mc_limit(script) $mc_limit(version) by MC_8 loaded." |
|
|
| Back to top |
|
 |
radoslav1990 Voice
Joined: 23 Nov 2015 Posts: 4
|
Posted: Mon Nov 23, 2015 5:33 pm Post subject: |
|
|
| when I loaded this script bot my crash |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Nov 23, 2015 5:59 pm Post subject: |
|
|
Explain the error it throws as it goes thunk. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
radoslav1990 Voice
Joined: 23 Nov 2015 Posts: 4
|
Posted: Mon Nov 23, 2015 7:47 pm Post subject: |
|
|
| Code: | [ 12:47:46 ] <Scallop> while executing
[ 12:47:46 ] <Scallop> "else {timer $time [list mc:limit:eval $chan]} "
[ 12:47:46 ] <Scallop> (procedure "mc:limit:resettimer" line 9)
[ 12:47:46 ] <Scallop> invoked from within
[ 12:47:46 ] <Scallop> "mc:limit:resettimer $chan"
[ 12:47:46 ] <Scallop> (procedure "mc:limit:eval" line 3)
[ 12:47:46 ] <Scallop> invoked from within
[ 12:47:46 ] <Scallop> "mc:limit:eval $chan"
[ 12:47:46 ] <Scallop> ("foreach" body line 1)
[ 12:47:46 ] <Scallop> invoked from within
[ 12:47:46 ] <Scallop> "foreach chan [channels] {mc:limit:eval $chan} "
[ 12:47:46 ] <Scallop> (file "scripts/mc.limit.tcl" line 196)
[ 12:47:46 ] <Scallop> invoked from within
[ 12:47:46 ] <Scallop> "source scripts/mc.limit.tcl"
[ 12:47:46 ] <Scallop> (file "e
[ 12:47:46 ] <Scallop> [00:46:44] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR) |
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Tue Nov 24, 2015 8:59 am Post subject: |
|
|
The actual error would be just above that.... _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
radoslav1990 Voice
Joined: 23 Nov 2015 Posts: 4
|
Posted: Tue Nov 24, 2015 6:38 pm Post subject: |
|
|
| SpiKe^^ wrote: | | The actual error would be just above that.... |
I do not understand |
|
| Back to top |
|
 |
|