egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

auto voice between 11pm and 8am
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Jul 04, 2009 1:42 pm    Post subject: Reply with quote

nml375 wrote:
speechles,
I did not make any comments as to your flood protection, neither anyone else's. You might also like to keep in mind that the original request did not come with flood protection, neither did the initial code example by the requester have one.

That, however, does not change the case that you've attached my signature to code I've not written, and which is non-functional. At best, I consider that slander.

Which part isn't functional, and notice after your nick says minor tweaks.. why are you so offended that your participation in a script has been noted in some regard, do you wish that removed, just say so? maybe you already have in this case just say so without being sarcastic about it or just "mod edit" it out. You do have this power. I remember the incident when you attained it precisely.

nml375 wrote:
On a side note, you could improve performance in your script by using the lappend command rather than resetting the variable with a concat'd value...

Lappand won't behave the same when using the foreach constructed below. I wanted a single inline list. Not a series of lists within lists. With those I would need to run a series of sets with lindexes on them to get the contents of each element. With an inline list, which concat gives back, is the only way the foreach constructed on the timer:onjoin can work. This is done to keep the code short and remove all those sets and lindexes otherwise required.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 04, 2009 1:47 pm    Post subject: Reply with quote

speechles,
lappend will work just fine, if you know how to use it.. Such as below:
Code:
lappend ::voicelist $nick $uhost $handle $channel

This is the recommended way of doing it, as it yields significant performance boost with large lists (see the lappend manpage for further details).
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 04, 2009 1:55 pm    Post subject: Reply with quote

speechles,
The code I proposed is this:
Code:
if {$hour >= $start && $hour < $end || ($hour >= $start || $hour < $end) && $start > $end} {

That's not even remotely close to the code you pinned my signature.. "minor tweak" does not cut it. What you wrote in your script is not my code, as such - do not attribute it to me, correct or faulty.

Your code does not work, as it makes the assumption $vStartHour is always less than $vEndHour. This is not the case in the original request.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Jul 04, 2009 1:56 pm    Post subject: Reply with quote

nml375 wrote:
speechles,
lappend will work just fine, if you know how to use it.. Such as below:
Code:
lappend ::voicelist $nick $uhost $handle $channel

This is the recommended way of doing it, as it yields significant performance boost with large lists (see the lappend manpage for further details).

Corrected the prior script to properly use lappend. For some reason every time I've tried to use it this way it has failed me but might be because I've always tried it using [list $elements $go $here] rather than just list the elements singularly after the lappend.

Also, corrected the code advice you gave and incorporated it into the script along with mention to you. If this is done poorly shout it out. If you'd rather not participate then I'll change the "maybe this is" back into a "this is not".. haw Wink
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Sat Jul 04, 2009 3:04 pm    Post subject: Reply with quote

For additional flexibility, I was trying to allow use of a secondary GMT offset in case a time zone was required within an IRC community that was not the same as the bot's GMT offset time.

Using nml375's hour checking statement, I think the following is now the correct logic.

Code:

set vStartHour 23
set vEndHour 8
set vGmtOffset +1
set vVoiceDelay 10

bind JOIN - * pTimedVoiceJoin

proc pTimedVoiceJoin {nick uhost hand chan} {
    global vGmtOffset vStartHour vEndHour vVoiceDelay
    set hour [clock format [expr {[clock seconds] + ($vGmtOffset * 3600)}] -format %k -gmt 1]
    if {$hour >= $vStartHour && $hour < $vEndHour || ($hour >= $vStartHour || $hour < $vEndHour) && $vStartHour > $vEndHour} {
        utimer $vVoiceDelay [list pTimedVoiceDelay $nick $chan]
    }
    return 0
}

proc pTimedVoiceDelay {nick chan} {
    if {[botisop $chan]} {
        if {[onchan $nick $chan]} {
            if {(![isop $nick $chan]) && (![isvoice $nick $chan])} {
                pushmode $chan +v $nick
                flushmode $chan
            }
        }
    }
    return 0
}

# eof

_________________
I must have had nothing to do
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber