{Event_DayCycles} Events for your whole day! V16 8-27 - probably still broked :/

Poll

Should I add an auto-updater system? edit:help i'm trapped in the future

yes
90 (84.1%)
no
17 (15.9%)

Total Members Voted: 106

Author Topic: {Event_DayCycles} Events for your whole day! V16 8-27 - probably still broked :/  (Read 21352 times)

Event_DayCycle

What does this mod do?

It adds four events which should've been default as-per v21.
  • dayCycleOnDay
  • [0]dayCycleOnDusk
  • dayCycleOnMidnight
  • [0]dayCycleOnNoon.

    You can use these input events to cause events to happen throughout the day (requires DayCycles to be enabled in the environment settings GUI.)


Modders: This tool adds callbacks for all the events mentioned above! You can simply package onDay, onDusk, etc, and have those be triggers for scripts! Simply force this add-on. Also, you should read the code. I commented 80% of all lines. An english-speaking monkey could understand it.


This mod now includes cats. This mod also does not allow for actual clocks to be built (12:34, for example). I may add this functionality in the future.


Report bugs here

V2 Hotfix:
  • Removed debug messages. Oops.

V3:
  • Added toggleable debug code.

If you experience issues with daycycles, such as crashing, do this:
Open a server with the mod enabled, and put this into your console: $DayCycles::Debug = 1;

Then, reproduce the problem.

Then, attach your console.log in this thread.
[0]Commented more lines.

V4:
  • Is actually a change I made in V3. I didn't realize it would fix it, but it did, so I'm version whoring. Deal with it.
  • [0]What I did is I made my future-predictor work in smaller steps. not sure why this fixed it, judging by the rest of the system, but it did. I think.

V5:
  • Fixed what V4 made worse: my sup3r c00l future predictor. The system will no longer cause servers to crash if the daycycle daylength is more than... oh, say, 100. >.<

V6:
  • Changed event names from onX to dayCycleOnX for better grouping. The callbacks are still the same, as they are not 'grouped' anywhere. also because it just makes sense.

V7:
  • ACTUALLY MADE V6 WORK
  • [0]Commented almost all of remaining lines.
  • Fixed some logical errors
  • [0]Fixed some camelCase errors

V10:
  • SKIPPED 3 VERSIONS FOR LOLS
  • [0]FIXED CRASHES
  • FIXED EVENTS
  • [0]MADE FUTURE PREDICTOR WAY MORE EFFICIENT
  • SYSTEM ACTUALLY WORKS NOW

V11:
  • System now modifies brick list accordingly when /clearbricks is called.
  • [0]Placated Mold.
  • Added version checker - you might get a little popup warning to download a new update.

    V12:
  • temporarily removed minigame target on events until i can make it compatible with dedicated servers
  • [0]ADDED CAT ART
  • version system should be functioning

V13:
  • fixed a bunch of crap i can't remember a long time ago
  • [0]fixed support for loading bricks
  • removed remembemdermans

V14:
  • oops - left a syntax error behind

V15:
  • fixed goofs on V14 and 13, system is fully functional again. i should probably test stuff before releasing it

V16:
  • I LIED IT DIDN'T ACTUALLY WORK
  • [0]fixed horrific typo



« Last Edit: October 21, 2012, 02:44:24 PM by Lugnut »



Thank you mister super special awesome guy.

Here's the principle this mod relies on, for people who don't want to read my beautifully commented code.
Quote
[00:35:36] Lugnut: the daycycle time of day
[00:35:45] Lugnut: is determined based on a start of 0 sim time
[00:35:47] Lugnut: therefore
[00:35:57] Lugnut: it is possible to mathematically calculate where the day is supposed to be
[00:36:00] Lugnut: suppose this
[00:36:08] Lugnut: if the sun rises at 0 sim time
[00:36:14] Lugnut: and at 1 sim time it is at noon
[00:36:19] Lugnut: and at 2 it is at dusk
[00:36:19] Lugnut: etc
[00:36:25] Lugnut: where will it be at 4 sim time?
[00:36:34] Lugnut: dawn.
[00:36:39] Lugnut: that's the principle this mod uses.
Now, that example is overly simplified. The truth is that getSimTime actually returns time in milliseconds, and you can't get a day going full loop in 4 milliseconds. however, my example uses this.
« Last Edit: August 11, 2012, 02:32:03 AM by Lugnut »

$Sim::Time is in seconds matching the cycle time.

Did you just choose day/night as exactly half the cycle or did you add that "//night" in the file idea?
« Last Edit: August 11, 2012, 02:38:53 AM by Space Guy »

$Sim::Time is in seconds matching the cycle time.
. . .

Are you telling me
that I just spent

6 hours

making a workaround
Did you just choose day/night as exactly half the cycle or did you add that "//night" in the file idea?
exactly half because i wanted to release this asap
« Last Edit: August 11, 2012, 02:40:35 AM by Lugnut »



Wow nice thanks so much for this, it will be REALLY useful for gamemodes!

. . .

Are you telling me
that I just spent

6 hours

making a workaround
Just did some tests on $Sim::Time. My mod functions differently, and, if I may, better for this purpose than that. I understand now, it allows me to skip (getSimTime() * 1000)
« Last Edit: August 11, 2012, 02:48:48 AM by Lugnut »

released v2 hotfix: removes debug messages.
oops.


rtb?
not tonight


going to bed. night guys.
catch ya in the morning, tell your friends!