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.

ban duration convert from: y-m-w-d-h to minute

Help for those learning Tcl or writing their own scripts.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

That's odd, I get a $min of 10080

That should work as a good expire time as it is an integer number.

Have you used the very last code I posted without edits?
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Fix cat's error by adding the [catch]es like I added to mine.
an empty string cant be used in an exp:)
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

simo wrote:tested your latest code CC and got:

Tcl error [sticky_bansx]: missing operand at _@_
in expression "365*24*60*_@_"
Well, I'm too used to use languages interpreting "" as 0 :)

Here is the corrected proc:

Code: Select all

proc delay2min {delay} {
   regexp {((\d{1,})y)?((\d{1,})w)?((\d{1,})d)?((\d{1,})h)?(\d{1,})?} $delay - iy by iw bw id bd ih bh bm
   set min 0
   if {[string is integer by]} { incr min [expr 365*24*60*$by] }
   if {[string is integer bw]} { incr min [expr 7*24*60*$bw] }
   if {[string is integer bd]} { incr min [expr 24*60*$bd] }
   if {[string is integer bh]} { incr min [expr 60*$bh] }
   if {[string is integer bm]} { incr min [expr 1*$bm] }
   return $min
}
@SpiKe^^ : you have a small error in your script:

Code: Select all

set dur [duration [expr {60*$min}]]
$min is in minutes, why do you convert it into seconds ?
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

your code seems to work proper Spike^^

CrazyCat your code seems to set ban duration permanent regardless of what is used

i used like : !addbl *!*@*.RU 2w uit testen

and it sets it as permanent ban i get no errors tho
Post Reply