How to Check age.

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Damien
Adept Poster
Posts: 82
Joined: Sat Apr 15, 2006 11:50 am

How to Check age.

Post by Damien »

Hello, I got a question about a script that shows how much u totally been online.

As my sentence says, The script should only count the time when your ONLINE.

and to show ur ingame age you should write a command like .checkmyage

it should also be in minutes :)

Please help? :)

Code: Select all

Thanks
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm

Post by tekproxy »

If you're using the distro, look at the onlinetimer prop set on characters.

Look at /scripts/misc/logoff.src and /scripts/misc/logon, particularly logoff.src. Here's the code that handles updating onlinetimer:

Code: Select all

program onlogoff(who)
  var acct := FindAccount(who.acctname);
  acct.setprop("LastLogin", readGameclock());
  var sessiontime := ReadGameClock() - GetObjProperty(who,"logontime");
  var timer := GetObjProperty(who,"onlinetimer");
  if(!timer)
    timer := 0;
  endif
  SetObjProperty(who,"onlinetimer",timer+sessiontime);
  EraseObjProperty(who,"LoggedIn");
When you login, it records the time you logged in. When you logoff, it subtracts the current time minus the time you logged in to get your total online time that session and then adds that to onlinetimer.

Changing to be in minutes would be as simple as dividing by 60 since everything is recorded in seconds.
Post Reply