Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-20-2011, 11:21 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Time and MOD

I have this, and the seconds and mins are going right, but its almost like the hours, days, and year aren't MOD at all, being it shows up 797 hours and 51 days and 1 year and there are definitely not that many seconds.

I was just trying to calculate the seconds up to years, without showing more than an actual min, hour, day, week, and year, in a year, allowed.

PHP Code:
function configureOnlinetime(time) {
  
//calculate time frames
  
temp.seconds int(time 60);
  
temp.minutes int((time 60) % 60);
  
temp.hours int((time 3600) % 3600);
  
temp.days int((time 86400) % 86400);
  
temp.weeks int((time 604800) % 604800);
  
temp.years int((time 3153600) % 3153600);
  
//display time
  
Profile_TextEdit23.text = @ years " yrs," weeks 
    
" wks," days " days," 
    
hours " hrs," minutesro " mins," 
    
seconds " secs";


time = the seconds i have.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 12-20-2011, 11:25 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by sssssssssss View Post
PHP Code:
"..." minutesro "..." 
Off topic: shouldn´t it be minutes?
__________________
MEEP!
Reply With Quote
  #3  
Old 12-20-2011, 11:27 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
PHP Code:
temp.hours int(time/3600 1) % 12 
note: 12 (or 24), not 3600.

&c.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #4  
Old 12-20-2011, 11:29 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
It should be minutes, i changed it after posting. What would days, weeks and years mod by? i thought it was the number of seconds in them but i guess not. :x And for my learning, why 12 for hours?
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #5  
Old 12-20-2011, 11:33 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by sssssssssss View Post
It should be minutes, i changed it after posting. What would days, weeks and years mod by? i thought it was the number of seconds in them but i guess not. :x And for my learning, why 12 for hours?
7 days in a week, so maybe mod days by 7. Approximately 52 weeks in a year, so I'd mod by 52 (although who reports weeks?). Don't mod years. There's no limit for years... I mean unless you want to do decades or millenia or something...
12 (or 24) is for hours in a day. You've already converted from seconds to hours (by dividing by 3600), so you're now working with FULL hours, which you want to cap at 12 (or 24). I think 24 is more appropriate for what you're trying to do here, so mod by 24 (because there are 24 in a day, you know).

e: I didn't read carefully, I thought you were reporting clock time, so the int(x-1)%m+1 hack isn't necessary.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 12-20-2011 at 11:39 PM.. Reason: Wow, did I completely forget what grammar is? x-x
Reply With Quote
  #6  
Old 12-20-2011, 11:36 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
lol xD thanks. I should have known that.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.