Timer

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Timer

Post by runtest »

CWO, how did you get the total age of a player. I noticed you had a nice newbie system. Is this built in age, or did you set your own props?
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Post by Austin »

There's a couple ways it can be done.

The first would be linear time using the characters .createdat member.
Using the difference between that and POLCore().systime you could determine the age.

Another way is to track accumulated online time when the person logs on and off. That would require a custom property.
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post by runtest »

I think he does the third option there. That should be easy enough. Thanks Austin.
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post by runtest »

Will this help me.

Code: Select all

use uo;

program textcmd_age( who )
	var utime := ReadGameClock() - GetObjProperty(who,"logontime");
	var dtime := GetObjProperty(who, "onlinetimer")+utime;

	if( !dtime )
		dtime := 0;
	endif

	SendSysMessage( who, "Total Online Age: " + dtime, color := 65 );
endprogram
CWO is going to kill me, I loved his newbie dungeon and I am trying to make my stone recognize player age. :P
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post by runtest »

Here is the code for my stone.

Code: Select all

use os;
use uo;

program item_ndstone( who )
   var utime := ReadGameClock() - GetObjProperty(who,"logontime");
   var dtime := GetObjProperty(who, "onlinetimer")+utime;

   if( !dtime )
      dtime := 0;
   endif 

	if(dtime <= 36000)
		who.frozen := 1;
		SendSysMessage( who, "You are granted permision to enter. Now wait.", color := 65 );
		Sleep( 15 );
		MoveCharacterToLocation( who, 5998, 1472, 0 );
		who.frozen := 0;
		//SendSysMessage( who, "It works!", color := 65 );
	else
		SendSysMessage( who, "You are to old to enter. Be gone!", color := 65 );
	endif

endprogram
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

Ya we use the "onlinetimer" prop and check it. Although on CG, we go by the age of all chars on the account plus age of deleted chars (onDelete counts up an account prop with the age of the char they deleted)
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post by runtest »

Not until after CG4. I remember making chars just to get monies. :P Oh, and thanks for that tip.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

Remember I wasn't admin/dev until CG4...
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post by runtest »

Yeah it was passed down. Promise if you ever get tired of it, the code will be passed down again. I do not see this in the foreseeable future since you alone have completely rewritten the base.
Post Reply