Author Topic: [HELP] Code PlayedTime no return Seconds  (Read 963 times)

arthurvalenca

  • Sr. Member
  • ****
  • Posts: 121
    • View Profile
[HELP] Code PlayedTime no return Seconds
« on: July 17, 2020, 06:20:24 AM »
I have a problem with this code, it is returning "0 Seconds" for games that are played less than a minute, if I remove the code Seconds it returns "0 Minutes", could someone help me with this problem, or the Attract Mode does not count seconds. thank you!

PS: Hours, Minutes and No time return the correct values, the problem is in the return of the Seconds.


Code: [Select]
################## Played Time ##################

function PlayedTime( ioffset ) {
 
local pt = fe.game_info(Info.PlayedTime,ioffset);
try {
pt = pt.tointeger();
}

catch(e) {
pt = 0
}

if (pt>0) {
pt = pt/60;

if (pt>60) {
pt=pt/60;

if (pt>1) {
return pt.tostring() + " Hours" ;
}

else {
return pt.tostring() + " Hour";
}
}

else if (pt<1){
return pt.tostring() + " Seconds";
}

else {
return pt.tostring() +" Minutes";
}
}
else {
return "No Time";
}
}
« Last Edit: July 17, 2020, 06:26:09 AM by arthurvalenca »