Whats wrong with my onlineTimer? :)
Posted: Mon Apr 27, 2009 11:15 am
Hello once again.. I was trying to create an onlinetimer that would count how many seconds (then convert to minutes) that you have been online but it seems like I can't get it working no matter what. The #logontime property wont be reseted everytime I logoff, which is odd, and the onlineTime/#logontime sums are way higher than it should be. This is how the script looks like:
Logon.src
onlineTimer.src
Logoff.src
Thanks 
Logon.src
Code: Select all
SetObjProperty(mobile, "#logontime", ReadGameClock());
Start_Script(":onlineTime:onlineTimer", mobile);Code: Select all
use uo;
use os;
program online_timer()
while(1)
foreach character in EnumerateOnlineCharacters()
var startTime := GetObjProperty(character, "#logontime");
if(!startTime)
SetObjProperty(character, "#logontime", ReadGameClock());
endif
var onlineTimer := GetObjProperty(character, "onlineTimer");
if(!onlineTimer)
onlineTimer := 0;
endif
SetObjProperty(character, "onlineTimer", startTime+onlineTimer);
endforeach
Sleep(300);
endwhile
endprogramCode: Select all
EraseObjProperty(mobile, "#logontime");