Orange Time System

Discussion in 'JS Plugin Releases (RMMV)' started by Hudell, Oct 24, 2015.

  1. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,320
    Likes Received:
    2,945
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV

    Orange Time System
    Hudell




    Introduction
    This plugin provides a Time System framework for your game. You need other plugins to make use of this time system core in order to effectively use it.


    Params

    useRealTime:
    If you set this to true, the plugin will load the computer time instead of calculating it's own. All of the *Length params will be ignored.
    Default is false


    secondLength:
    How many real-life milliseconds should an ingame second be?
    Default is 1000

    secondLengthVariable:
    You can use a variable ID here to use the value of that variable instead of the fixed value of secondLength.
    Default is 0
    Every time you change this variable, you have to call the following plugin command:


    restart time system




    minuteLength:
    How many ingame seconds should a minute be?
    Default is 6

    hourLength:
    How many ingame minutes should an hour be?
    Default is 6

    dayLength:
    How many ingame hours should a day be?
    Default is 24

    weekLength:
    How many ingame days should a week be?
    Default is 7

    monthLength:
    How many ingame days should a month be?
    Default is 31

    yearLength:
    How many ingame months should a year be?
    Default is 4

    dayPeriod1Hour:
    At what hour does the "morning" day period starts?
    Default is 6

    dayPeriod2Hour:
    At what hour does the "day" day period starts?
    Default is 9

    dayPeriod3Hour:
    At what hour does the "evening" day period starts?
    Default is 18

    dayPeriod4Hour:
    At what hour does the "night" day period starts?
    Default is 20
     
    pauseClockDuringConversations:
    If true, the clock will be paused while text is being displayed with the Show Text command.

    insideSwitch:
    If you set the number of a switch here, the screen tint effect of the OrangeDayAndNight will be disabled when the switch is ON (other add-ons will use the same information to determine if the player is inside a closed space or not)

    tilesetList:
    You can set a list of comma separated tilesets that will always be treated as "inside", regardless of the switch value.
    Example value: 1, 2, 3


    mainSwitchId:
    Set this to the number of a switch to be able to pause / unpause the time system with that switch.

    If you don't use a switch, you can pause/unpause with the following script calls:


    OrangeTimeSystem.paused = true;OrangeTimeSystem.paused = false;


    This plugin uses Orange Event Manager to enable event listeners on the passage of time. This is a list of available events:


    changeSecondchangeMinutechangeHourchangeDayPeriodchangeDaychangeMonthchangeYear


    You can also attach a method or a common event to a specific time. The following example will trigger the common event 10 every day at 10:00:00 AM:


    var commonEventId = 10;OrangeTimeSystem.onTime(commonEventId, 10, , );


    The following example will trigger common event 15 on day 20 of month 2:


    var commonEventId = 15;OrangeTimeSystem.onDate(commonEventId, 20, 2, );


    You can also attach a common event to a day of the week:


    OrangeTimeSystem.onWeekDay(commonEventId, 5);


    Now with plugin commands. Some example of commands:


    run common event 10 every hour
    run common event 1 every minute
    run common event 2 every second
    run common event 3 every day
    run common event 4 every month
    run common event 5 every year


    New Feature: Run common events after some time.
    Those instructions will be saved on the save file, so the common event will be executed even if the player stops plaing and comes back another day.


    run common event 6 in 5 minutes
    run common event 7 in 2 hours
    run common event 8 in 10 seconds
    run common event 9 in 20 days


    New Feature: Enable / DIsable / Toggle Switches and self switches. Some examples:


    toggle self switch A in 10 seconds
    toggle self switch B every second
    enable switch 40 on hour 10 minute 20
    disable self switch D in 1 hour




    Plugin
    Get it from here

    Dependencies
    None



    Add-Ons
    Variables
    Events
    Day and Night

    License
    - Free for any game


    - No credits required
     
    Last edited by a moderator: Jan 29, 2017
    #1
  2. Joronjo

    Joronjo Veteran Veteran

    Messages:
    155
    Likes Received:
    29
    First Language:
    English Spanish
    With this plugin\, would it be possible to "push" time a few hours after certain events like sleeping?
     
    #2
    Synyster likes this.
  3. xein

    xein A stranger in a strange world Veteran

    Messages:
    306
    Likes Received:
    15
    I'm trying to make an event run when the computer/real time hits 10am daily. How should I set this?
     
    #3
  4. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,320
    Likes Received:
    2,945
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    I've updated the plugin, you can now use the following script call:

    I'll also create an add-on to do those things with plugin commands.

    OrangeTimeSystem.addHours(8);
    OrangeTimeSystem.onTime(1, 10);
    This will run common event 1 at 10am every day.
     
    #4
    Synyster likes this.
  5. Serpent

    Serpent Villager Member

    Messages:
    5
    Likes Received:
    3
    Location:
    US
    First Language:
    English
    Is there a way to change to a specific time? I can see you provided something for adding hours, but suppose I want to make an event that will always change the time to 6am, regardless of what time it's triggered?
     
    #5
    Synyster and Hudell like this.
  6. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,320
    Likes Received:
    2,945
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Yup:

    Code:
    OrangeTimeSystem.hour = 6;
     
    #6
    Synyster likes this.
  7. tati light

    tati light Veteran Veteran

    Messages:
    160
    Likes Received:
    108
    First Language:
    English
    Wow, this sounds just like what I was looking for... but I need to ask something.

    Can this plugin accept day of the week? Like, is it possible to get the weekday (realtime) from the user device?

    On another note, it's really impressive you are doing all this kind of plugins for free! I was just thinking in paying someone to do a plugin like this for me in the near future... Your plugins have outstanding potential, please let me know if you have any donation links!
     
    #7
    Hudell likes this.
  8. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,320
    Likes Received:
    2,945
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Yup, the weekDay property should have the user day of the week. You can put it in a variable with the "Variables" add-on. (0 is sunday, 1 is monday ... 6 is saturday)
    Thank You! I don't have any donation link at the moment, but I may create one at some point.
     
    #8
    tati light likes this.
  9. EternalShadow

    EternalShadow Veteran Veteran

    Messages:
    5,805
    Likes Received:
    1,049
    First Language:
    English
    I planned to make something similar to this back before MV was released, but I guess I got beaten to it :p
     
    #9
    Hudell likes this.
  10. Luiiferu

    Luiiferu Flying kiwi Member

    Messages:
    11
    Likes Received:
    8
    First Language:
    Sumerian
    Sounds great!

    Can I set a clock somewhere for the player to check?
     
    #10
    Hudell likes this.
  11. Marvelous TK

    Marvelous TK Veteran Veteran

    Messages:
    23
    Likes Received:
    6
    First Language:
    English
    So, say you wanted a specific event to run on a specific day, like - hell, let's say Halloween, that's close - could you set an event to show up during that day? Or more complicated, could you set an event to show up, like, between 7PM and 10PM on a specific day? Is that level of control in here?
     
    #11
    Hudell likes this.
  12. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,320
    Likes Received:
    2,945
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Yes, I'm preparing a demo with one of those, I'll upload it shortly.

    Edit: Demo uploaded.

    If you want something to run on Halloween, you can do this:

    OrangeTimeSystem.onDate(1, 31, 10);And it will trigger the common event 1 on halloween. The event will be triggered again every second of that day. If you want to call it on a specific time, you can do:

    OrangeTimeSystem.onDateTime(1, 31, 10, undefined, undefined, undefined, 0);
    The order of the params are:

    • number of the common event
    • day,
    • month,
    • year,
    • hour,
    • minute,
    • second
    When you pass "undefined" to one of the params, you're saying that you don't care about the value of that variable.

    On the example I gave, we're ignoring the year, the hour and the minute. This means that the event will be triggered every time the "seconds" variable is 0, the "day" is 31 and the "month" is 10.

    Basically: once a minute on october 31st, every year.

    Currently there's no way to make it automatically run only once at any time of the day, but I'll add this feature today.

    If you want to run it only once at a specific time (say: 15:34:20), you can call:

    OrangeTimeSystem.onDateTime(1, 31, 10, undefined, 15, 34, 20)
    Hmmm, that's a nice feature to add!

    Currently you would have to do it this way:

    OrangeTimeSystem.on('changeMinute', 1);
    This would trigger the common event 1 every time the minute changes. You'd then have to check for the hour variables manually inside it.

    When you say "show up between 7PM and 10PM" you mean you want it to randomly appear once within that time frame? I can add a feature like that too! :)
     
    Last edited by a moderator: Oct 27, 2015
    #12
    Luiiferu likes this.
  13. Luiiferu

    Luiiferu Flying kiwi Member

    Messages:
    11
    Likes Received:
    8
    First Language:
    Sumerian
    Thanks, that was fast!

    Maybe an npc that only shows up from 7PM till 10PM every night?
     
    #13
    Hudell likes this.
  14. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,320
    Likes Received:
    2,945
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    You can do that with variable conditions :)
     
    #14
  15. gekigengar

    gekigengar Villager Member

    Messages:
    23
    Likes Received:
    5
    First Language:
    English
    Hello, I wanted to request an option to pause time when a dialogue box is open. (Conversation, choices, etc)

    I think this might be very useful, instead of having to have $.paused = true on every NPC with dialogues~
     
    #15
  16. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,320
    Likes Received:
    2,945
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Ah, indeed, I should've though of that. I'll add that feature tonight.
     
    #16
  17. Ruff_Demon

    Ruff_Demon Villager Member

    Messages:
    11
    Likes Received:
    1
    First Language:
    English
    I finally got this to work in my project, thanks to your demo. I love it! It's exactly what my project needed. Thank you so much! :D
     
    #17
    Hudell likes this.
  18. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,320
    Likes Received:
    2,945
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    I've updated the plugin. Now it no longer needs any other plugin installed.

    I've also added a new param: pauseClockDuringConversations.

    The demo and the thread were also updated.
     
    #18
  19. Kane Hart

    Kane Hart Elmlor.com Veteran

    Messages:
    656
    Likes Received:
    166
    Location:
    Barrie, Ontario, Canada
    First Language:
    English
    Just checking to see if that idea was added I'm in no rush did not want to miss it.

    The idea again was that you could add a reset type switch (sorry about I'm sure the wrong terminology) so when you say run an event like remove something from a chest you can say 100 in game hours (60min?) it would reset it back again.

    Thank you so much in advance :)
     
    #19
    Hudell likes this.
  20. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,320
    Likes Received:
    2,945
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    It's on the oven right now! :)
     
    #20
    Kane Hart likes this.

Share This Page