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 

Timers and additions

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
X-Ception
Voice


Joined: 20 May 2005
Posts: 37
Location: Earth

PostPosted: Sat Sep 02, 2006 9:41 pm    Post subject: Timers and additions Reply with quote

I'm wanting to create a script thats works on the basis of start and stop on a per user level with addition of time...

for example:
Quote:

<nick> !login
<bot> Nick you're now logged in
<nick2> !login
<bot> Nick2 you're now logged in

While logged in a timer or similar is running basically counting mins which are written to a file
Quote:

<nick2> !logout
<bot> Nick2 you're now logged out

in the file it should say similar to:
Code:

Nick1 has been logged in for 0 hours 10 mins 23 seconds

Seconds not really needed but for hours and mins its a must, this file then must restart once every 7 days ( renaming the old one to log.lastweek ..whatever )

I'm very uncomfy with timers and ive not worked too often if ever with additions in this manner could someone give me some tips, a starting point or even better point me to one that does the above already Razz ( never know huh ? )

note
The basis of login is NOT based on bots userlist but users on a specific channel - anyone on said channel must be able to login/out

preferbly with a specific flag being able to log users out that failed to log themselves out
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sat Sep 02, 2006 9:52 pm    Post subject: Reply with quote

No need for timers. Just use the [unixtime] when they login and the difference from NOW in unixtime and the last unixtime recorded:
Code:

set now [unixtime]
set difference [expr [unixtime - $now]]
set duration [duration $difference]

Also, if all of your users use a specific credentials then I would go for XTRA fields in the userfile for each user in particular.
Code:

setuser $hand XTRA LAST [unixtime]

and to see the actual online time use something like:
Code:

set last [getuser $hand XTRA LAST]
set difference [expr [unixtime - $last]]
set duration [duration $difference]

_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Sep 02, 2006 11:30 pm    Post subject: Re: Timers and additions Reply with quote

X-Ception wrote:

The basis of login is NOT based on bots userlist but users on a specific channel - anyone on said channel must be able to login/out


then you need to develop an authorization system first; or by "login" you mean simply recording current time for the user issued that command?
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
wiz(andrew)
Voice


Joined: 01 Sep 2006
Posts: 5

PostPosted: Sun Sep 03, 2006 12:08 am    Post subject: Reply with quote

Code:
if {[onchan $nick $chan] } {...}
?
Back to top
View user's profile Send private message
X-Ception
Voice


Joined: 20 May 2005
Posts: 37
Location: Earth

PostPosted: Sun Sep 03, 2006 6:30 am    Post subject: Re: Timers and additions Reply with quote

demond wrote:

by "login" you mean simply recording current time for the user issued that command?

yup
Back to top
View user's profile Send private message Visit poster's website
X-Ception
Voice


Joined: 20 May 2005
Posts: 37
Location: Earth

PostPosted: Sun Sep 03, 2006 1:58 pm    Post subject: Reply with quote

Well the reason i thought the use of timers would be needed was it needs to be started and stoped by the user and then recorded to a text file/database file of some format so the administration can see WHO is actually putting in what amount of times on a per week basis, but none of the users will be on the userlist
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Sep 03, 2006 3:45 pm    Post subject: Reply with quote

You should be able to use most of caesar's script. Just have to use variables to store "logon-time", rather than the user database fields.. (arrays with nicks as index comes to mind)

Only use for timers that I could possibly see, would be some automated logout-feature. Although this would probably be easier to implement without timers aswell.

As for writing to the logfile, I'd either write on "!logout", or on a regular basis using "bind time". Log rotation would be implemented using "bind time" or "bind evnt".
_________________
NML_375, idling at #eggdrop@IrcNET
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 -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
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