Master Clock

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Master Clock // Interactive Artwork

1  |  

Post by frankendaddy // Nov 17, 2008, 9:34am

Total Posts: 9
Hi all,

I'm working on a cellular automata project and need a "Master Clock" script to keep track of my iterations. The clock will be what determines the rotation of a planet, cycles of the seasons, life cycles of objects, that kind of thing.

Is there anything published out there that has all the jscript commands that TS uses? I've tried using the seconds from a timer event, but I can't seem to get them to do what I want.

If anyone would like to guide me, here is what I'm working with:

The clock is laid out as follows:

year: starting at 1099+

season: 0-3

week: 0-12

day: 0-6

hour: 0-23

minute: 0-59

second: 0.00-59.59

Any suggestions?

Thanks in advance!


Post by mrbones // Nov 17, 2008, 4:13pm

Total Posts: 1280
shouldnt week be month?

Post by frankendaddy // Nov 17, 2008, 7:40pm

Total Posts: 9
Actually, on my planet, we're not having months. There are four seasons that have 13 weeks each.

Post by trueBlue // Nov 17, 2008, 9:27pm

Total Posts: 1761
Here is something to get you started.
Date, Today, and Time are strings but you can use the other attributes for your purpose.

Post by frankendaddy // Nov 18, 2008, 1:35am

Total Posts: 9
Thanks, Bluey! I'll see what I can come up with from here.

Are the get.whatever commands that you're using here regular jscript commands or are they TS-exclusive commands?

Thanks again!:banana:

Post by trueBlue // Nov 18, 2008, 7:24am

Total Posts: 1761
All jScript in this script. You'll have to apply some math to convert from your PC's time to whatever time it is on your planet. :)

Post by mrbones // Nov 24, 2008, 7:39pm

Total Posts: 1280
Cool, Thats another way to think about it.:)

Actually, on my planet, we're not having months. There are four seasons that have 13 weeks each.

Post by frankendaddy // Nov 25, 2008, 12:10pm

Total Posts: 9
Ya, I'm thinking that it will be easier to regulate plant growth cycles that way.

Still not having a lot of luck with the clock script. I really need to have a pulse output that fires every secone. That way i can count them the way that I want instead of being tied to regular terran time. Would it be possible to use an AtvLoop for this?



p.s. I'm more of a motion control programmer than a jscript programmer, please bear with my n00bishness!:confused:

Post by frootee // Nov 25, 2008, 7:14pm

Total Posts: 2667
you can use a timer object, or an activity loop with a Pause in it. Set the Pause to 1 second.

Connect the Control Out of the Timer (or one of the Control Out connectors in your paused activity loop) to
whatever jscript command you need 'timed' to 1 second.

hm... trueblue... what's that node you're using? Is that a custom node you made?

Post by Délé // Dec 2, 2008, 9:48am

Total Posts: 1374
Attached is the Ultimate Counter script from the Elements of Game Design course. This may give you some ideas on how to create your own counter.

You might want to check out that section in the video course. I went over how the counter works in detail.


Post by frankendaddy // Dec 15, 2008, 10:46am

Total Posts: 9
Hi guys,

Just an update...I've gotten something that I think will fit with my little scheme. I haven't had a chance to look at Dele's script yet, and I'm sure it's better written than mine. We'll see what comes of it.

Thanks so much for all your help! Such a cool group of peeps!



edit: I am using a loop counter set at 1 iteration and a timer event to run the loop. I thought that it would save those, too!

Post by frankendaddy // Jan 6, 2009, 3:07am

Total Posts: 9

I have a "final" version of my master clock script. Thanks again for all your help!

Richard is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn