The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regarding Time Online
Author Message
pinku
Journeyman
*

Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4



Post: #11
RE: Regarding Time Online
Oh! hahaha.

4 hours?!
I'll just wait for this then. Surely will make my life MUCH easier.
Thanks again Mordaunt. Smile
08-06-2013 05:35 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #12
RE: Regarding Time Online
Yeah he has committed the changes, 12:05 (ish) Berlin time is when the automated nightly build appears

[Image: 2nis46r.jpg]
08-06-2013 06:01 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Rattlehead
Master
**

Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8



Post: #13
RE: Regarding Time Online
wow, i was just about to suggest a way to stop a timerf function based on function name too, cus i have had issues with that in the past

so, thats friggin awesome Ben, thx man Wink

revised if using the newest nightly build

Code:
[function f_time_online]
src.ctag.online_hours += 1

[events e_online_time]
on=@login
if (<istimerf.f_time_online> == 1)
timerf stop,f_time_online
endif
src.timerf 3600,f_time_online

and ty for the reminder about ctags, saves the need for an extra IF statement Wink

[Image: matts_siggy.gif]
(This post was last modified: 08-06-2013 07:48 AM by Rattlehead.)
08-06-2013 07:42 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #14
RE: Regarding Time Online
<ACCOUNT.LASTCONNECTTIME> counts the total time (minutes) of your last connection. So if you stay online for 80min it will return "80", just divide it by 60 and you will get the value in hours. You can do it using just 1 code line, simple as this:
Code:
ON=@Logout
TAG0.OnlineHours += <eval <ACCOUNT.LASTCONNECTTIME>/60>
08-09-2013 04:04 PM
Find all posts by this user Like Post Quote this message in a reply
Rattlehead
Master
**

Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8



Post: #15
RE: Regarding Time Online
yeah, but then it only tallies once they log off, i think he wanted to know in game while online the tally of their hours while in game.

[Image: matts_siggy.gif]
08-13-2013 07:43 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #16
RE: Regarding Time Online
in this case I think its better use just 1 function to all clients instead of a timer running separately on each player. The tag will be better stored as minutes and then convert it to hours/days/etc as you need. It will get a much more accurate result compared to a tag that just count at full hours

Code:
[EVENTS e_connection_time]
ON=@Login
CTAG.ConnectionTimestamp=<SERV.TIME> //set the current timestamp on login to prevent incorrect counting

[FUNCTION CountConnectionTime]
TAG0.OnlineMinutes += <eval (<SERV.TIME>-<CTAG0.ConnectionTimestamp>)/600>
CTAG.ConnectionTimestamp=<SERV.TIME>

just add the event on all clients and keep calling "SERV.ALLCLIENTS CountConnectionTime" at each X minutes (maybe the best way is use it directly on f_onserver_timer)

PS: needs a better testing, since I'm doing it without testing any result
(This post was last modified: 08-14-2013 04:23 AM by Coruja.)
08-14-2013 04:19 AM
Find all posts by this user Like Post Quote this message in a reply
Rattlehead
Master
**

Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8



Post: #17
RE: Regarding Time Online
so ur saying that running a function that fires on all connected players every few minutes would be better than a function that only fires per player every hour?

i will have to disagree on this one, for multiple reasons

1) a function that fires on a per player basis every hour, will obviously only fire every hour that they are online, rarely do multiple players login at the same time, therefore the functions wont be firing at the same time, giving each their own wiggle room as far as resource are concerned

2) since the functions fire on a per player basis, you wont have the immense resource consumption of the allclients firing, if there were say 100 players on, then when all clients is fired its going to take up a good bit of resources, tie that in with firing every X minutes, and ur looking at a resource hog every X minutes rather than just a function firing every so often per players login

3) he was only interested in every hour, so it seems counter productive to have it adding every few minutes when the minutes are of no concern to the outcome of the results, so again u would be trading resource consumption for irrelevant accuracy

i would also like to point out using TAG0 on the left side of a statement is unnecessary as you are defining the tag on the left side, and tag0 is only for statements that may have the opportunity to resolve to nothing rather than 0

firing a timerf function every hour on the player is as accurate as any other way of timing an hour, logging the current server time and counting back from it really wont be anymore accurate than the timerf, not to mention more calls to the server to get the time and adding it to a ctag that gets evaluated later, thus adding to more resource consumption

just my view, i could be wrong, but i am willing to bet that my reasoning endures Wink

[Image: matts_siggy.gif]
08-14-2013 08:16 AM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #18
RE: Regarding Time Online
There is an ACCOUNT property called TOTALCONNECTIME... does that not work?
08-15-2013 12:42 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #19
RE: Regarding Time Online
Of course it works, but that's not what he wants.

He wants to reward players when they stay online for an hour, and then for each hour afterwards and only in those sessions. At least that's what I understand. So sessions less than an hour would not be rewarded, and then when they log on and complete an hour using TOTALCONNECTTIME they'd get rewarded, which isn't wanted.

At least that's how I read this whole thing

[Image: 2nis46r.jpg]
08-15-2013 01:17 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #20
RE: Regarding Time Online
(08-14-2013 08:16 AM)Rattlehead Wrote:  so ur saying that running a function that fires on all connected players every few minutes would be better than a function that only fires per player every hour?

i will have to disagree on this one, for multiple reasons

1) a function that fires on a per player basis every hour, will obviously only fire every hour that they are online, rarely do multiple players login at the same time, therefore the functions wont be firing at the same time, giving each their own wiggle room as far as resource are concerned

2) since the functions fire on a per player basis, you wont have the immense resource consumption of the allclients firing, if there were say 100 players on, then when all clients is fired its going to take up a good bit of resources, tie that in with firing every X minutes, and ur looking at a resource hog every X minutes rather than just a function firing every so often per players login

3) he was only interested in every hour, so it seems counter productive to have it adding every few minutes when the minutes are of no concern to the outcome of the results, so again u would be trading resource consumption for irrelevant accuracy

i would also like to point out using TAG0 on the left side of a statement is unnecessary as you are defining the tag on the left side, and tag0 is only for statements that may have the opportunity to resolve to nothing rather than 0

firing a timerf function every hour on the player is as accurate as any other way of timing an hour, logging the current server time and counting back from it really wont be anymore accurate than the timerf, not to mention more calls to the server to get the time and adding it to a ctag that gets evaluated later, thus adding to more resource consumption

just my view, i could be wrong, but i am willing to bet that my reasoning endures Wink
it will work using both ways
but its not a good idea run a -active- timer on every player. I will prefer consume 0 resources and run a light-weight function on every player at each 5~10 minutes than set a active timerf running on every single connected account. Of course we cant run heavy functions on allclients, but in this case the function is ultra mega hyper very light and won't cause any lag, freeze or something like this even for 0.0000001ms

the accurary which I mean is count the connection time using the correct time instead counting only full hours. I can make multiple logins counting 15min + 5min + 20min and it will count 40 minutes. Doesnt reach a full hour yet, but another login using more 20 minutes will do it. Its better than counting 0 on all connections because I doesn't reach a full hour connected on none of them Big Grin

(08-15-2013 01:17 AM)Mordaunt Wrote:  Of course it works, but that's not what he wants.

He wants to reward players when they stay online for an hour, and then for each hour afterwards and only in those sessions. At least that's what I understand. So sessions less than an hour would not be rewarded, and then when they log on and complete an hour using TOTALCONNECTTIME they'd get rewarded, which isn't wanted.

At least that's how I read this whole thing
I would prefer using LASTCONNECTTIME / TOTALCONNECTTIME too, its more simple and optimized. But maybe only he would clarify the idea, since we're a bit confusing with everything lol
08-15-2013 03:26 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 5 Guest(s)