| View previous topic :: View next topic |
| Author |
Message |
X-Ception Voice
Joined: 20 May 2005 Posts: 37 Location: Earth
|
Posted: Sat Sep 02, 2006 9:41 pm Post subject: Timers and additions |
|
|
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 ( 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 |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat Sep 02, 2006 9:52 pm Post subject: |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Sep 02, 2006 11:30 pm Post subject: Re: Timers and additions |
|
|
| 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 |
|
 |
wiz(andrew) Voice
Joined: 01 Sep 2006 Posts: 5
|
Posted: Sun Sep 03, 2006 12:08 am Post subject: |
|
|
| Code: | | if {[onchan $nick $chan] } {...} | ? |
|
| Back to top |
|
 |
X-Ception Voice
Joined: 20 May 2005 Posts: 37 Location: Earth
|
Posted: Sun Sep 03, 2006 6:30 am Post subject: Re: Timers and additions |
|
|
| demond wrote: |
by "login" you mean simply recording current time for the user issued that command? |
yup |
|
| Back to top |
|
 |
X-Ception Voice
Joined: 20 May 2005 Posts: 37 Location: Earth
|
Posted: Sun Sep 03, 2006 1:58 pm Post subject: |
|
|
| 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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Sep 03, 2006 3:45 pm Post subject: |
|
|
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 |
|
 |
|