SphereCommunity
Age count - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Age count (/Thread-Age-count)

Pages: 1 2


RE: Age count - Leonidas - 11-11-2016 12:10 PM

Well thanks for your opinion. I'll just wait for someone who is willing to help to reply.


RE: Age count - Ben - 11-14-2016 06:22 AM

The thing is here that you can't use 31 or 30 or 28 for specific months, or 365, 366 days in a year since you are counting played days and not the actual age of the account (days since the creation of the account)... unless that is what you want...


RE: Age count - Leonidas - 11-14-2016 08:33 AM

Yeah I'm wanting it to count even when they are offline, so it shows how old their account is. If there isn't a way of showing months and what not I'll just have to stick with it showing days.


RE: Age count - Ben - 11-14-2016 08:58 AM

Have you tried in game .show age to see what it displays?


RE: Age count - Coruja - 11-18-2016 02:53 PM

sphere already store the account first/last connection date (<ACCOUNT.FIRSTCONNECTDATE> and <ACCOUNT.LASTCONNECTDATE>), so you must compare these 2 dates and convert it to an "readable" value, which probably the best format will be "X days"

eg: to compare dates 2016/05/10 and 2016/08/10, you must convert both dates into days using the formula: (year * 365) + (month * 30) + days

2016/05/10 = (2016 * 365) + (05 * 30) + 10 = 736000
2016/08/10 = (2016 * 365) + (08 * 30) + 10 = 736090

736090 - 736000 = 90, so the interval between these dates is 90 days

on sphere scripting it will be something like this:
Code:
[FUNCTION GetAccountAge]
return <eval <ConvertToDays <ACCOUNT.LASTCONNECTDATE>> - <ConvertToDays <ACCOUNT.FIRSTCONNECTDATE>>>

[FUNCTION ConvertDateToDays]
ARGS=<EXPLODE : /, <ARGS>>  // this will explode the date "yyyy/mm/dd HH:mm:ss" into "yyyy,mm,dd,HH,mm,ss", making it easy to get values using ARGV[0], ARGV[1], ...
return <eval (<ARGV[0]>*365)+(<ARGV[1]>*30)+<ARGV[2]>>
so with this code you will be able to get the account age using something like "SYSMESSAGE Your account age is: <GetAccountAge> days"