Orange Time System

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

  1. dinomanjj

    dinomanjj Warper Member

    Messages:
    4
    Likes Received:
    2
    Location:
    A random shack in Tamriel's mountainous province
    First Language:
    English
    Thank you very much. With this and many other plugins people will be able to make rpg's similar to Skyrim.
     
    #41
    Hudell likes this.
  2. jamzkie143

    jamzkie143 CuteGranny Member

    Messages:
    21
    Likes Received:
    12
    First Language:
    English
    Primarily Uses:
    N/A
    Thanks for solving the problem. This is an optional request - please add the ability to change the name of the months instead of numbers. :) Thank you!
     
    #42
    Hudell likes this.
  3. matthew30903

    matthew30903 Veteran Veteran

    Messages:
    82
    Likes Received:
    31
    Location:
    United States
    First Language:
    English
    First I would like to say that this is a wonderful plugin, but I do have a question.

    Is it possible to modify the flow of time dynamically? Through tileset index or Region IDs. Lest say the player is moving on a forest tile and thus should be moving more slowly, time would speed up to simulate that. On roads time would slow down to simulate that the player is moving faster.

    Is it possible to do the same with plugin commands? That way events can effect the flow of time. Say the weather is good so the party can move 1.5 times faster. So when the player is moving through the forest and it is good weather the effects can add together and the player can move at normal speed.

    Thank you for this great plugin.
     
    #43
    Hudell likes this.
  4. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,316
    Likes Received:
    2,928
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    How do you want to use the month names?

    Would it help if I added an option to load the "secondLength" param from a variable?
     
    #44
  5. matthew30903

    matthew30903 Veteran Veteran

    Messages:
    82
    Likes Received:
    31
    Location:
    United States
    First Language:
    English
    Yes, that would be great.
     
    #45
    Hudell likes this.
  6. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,316
    Likes Received:
    2,928
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    I've updated this script with a lot of new features, check the main post :)
     
    #46
    DoctorMolotov and Kane Hart like this.
  7. eternien

    eternien Villager Member

    Messages:
    27
    Likes Received:
    5
    Location:
    In spaaaaace
    First Language:
    French
    Is there a way to show the timer only on the menu ?
     
    #47
    Hudell likes this.
  8. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,316
    Likes Received:
    2,928
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Not yet, I don't have any plugin to add it to the menu
     
    #48
  9. Volz Rocksti

    Volz Rocksti He, or she, who hesitates is lost. Member

    Messages:
    13
    Likes Received:
    9
    Location:
    Wisconsin, USA
    First Language:
    English
    I apologize in advance if this was already answered, but using the mainSwitchId, would it be possible to pause the flow of time when in specific maps? I would like to implement this but have it pause while the player is in a town or dungeon and only have time flow while travelling via the overworld or sleeping at an inn.  This would allow me to create time-of-day specific npc behaviors without having to stress out about completely scheduling their movements to sync up with an always-running clock.
     
    #49
    Hudell likes this.
  10. kranasAngel

    kranasAngel Wanderer Veteran

    Messages:
    122
    Likes Received:
    41
    First Language:
    English
    Primarily Uses:
    RMMV
    Question, is there any way to set the time? Like if it was currently 17:00, and you wanted to set the time to 3:00, is there any way to do this?
     
    #50
  11. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,316
    Likes Received:
    2,928
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Script call:

    OrangeTimeSystem.setTime(seconds, minutes, hour, day, month, year);
    To set it to 3:00:

    Code:
    OrangeTimeSystem.setTime(0, 0, 3);
     
    #51
  12. DoctorMolotov

    DoctorMolotov Adrenochrome... Veteran

    Messages:
    222
    Likes Received:
    114
    Location:
    Earth
    First Language:
    English
    Does this mean you can use a script call to fast forward time like say, staying at an inn, or sleeping in your bed will cause it to be morning thus being able to skip ahead if needed?
     
    #52
  13. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,316
    Likes Received:
    2,928
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Yes, you can also call this for example:
    OrangeTimeSystem.addHours(8);
    I thought I had replied to this. But well, you can currently do it with variables. I can add switches to a plugin to make it easier.
     
    Last edited by a moderator: Nov 5, 2015
    #53
    DoctorMolotov likes this.
  14. koldsack

    koldsack Veteran Veteran

    Messages:
    45
    Likes Received:
    25
    First Language:
    english
    would like to report a glitch.

    The Setup:

    Using your TimeSystemEvent plugin to activate a common event with the following code:

    var a = $gameVariables.value(3); if (a === 13) { $gameVariables.setValue(13, 1); } else if (a === 14) { $gameVariables.setValue(13, 2); } else if (a === 15) { $gameVariables.setValue(13, 3); } else if (a === 16) { $gameVariables.setValue(13, 4); } else if (a === 17) { $gameVariables.setValue(13, 5); } else if (a === 17) { $gameVariables.setValue(13, 5); } else if (a === 18) { $gameVariables.setValue(13, 6); } else if (a === 19) { $gameVariables.setValue(13, 7); } else if (a === 20) { $gameVariables.setValue(13, 8); } else if (a === 21) { $gameVariables.setValue(13, 9); } else if (a === 22) { $gameVariables.setValue(13, 10); } else if (a === 23) { $gameVariables.setValue(13, 11); } else if (a === 0) { $gameVariables.setValue(13, 12); } else { $gameVariables.setValue(13, a); }var b = $gameVariables.value(8);if (b === 1) { $gameVariables.setValue(14, "AM"); } else if (b === 2) { $gameVariables.setValue(14, "AM"); } else if (b === 3) { $gameVariables.setValue(14, "PM"); } else if (b === 4) { $gameVariables.setValue(14, "PM"); }All that to convert 24hr time to 12 hour time as well as determine AM/PM.
    The Problem:

    [​IMG][​IMG]
    This only happens if i'm using OrangeTimeSystem.addHours(n); to push time forward.
    Would also like to squeeze in a request for OrangeTimeSystem.setTime(seconds, minutes, hour, day, month, year); to be respective, as in OrangeTimeSystem.setTime(day); OrangeTimeSystem.setTime(month); and etc. this is so that i can have a common event to change some particular months manually when they don't have 31 days. Feb to switch over to 1 March on the 28th for example. The current plugin uses 31 days for all months. thanks in advance and for this wonderful plugin :)

    oh btw, if i can like this plugin/post 10 times i would! this system when coupled with your event activator is ingenious, since it would not be constantly listening every tick but would only do something at a certain juncture or when conditions are met. thanks alot!
     
    Last edited by a moderator: Nov 5, 2015
    #54
  15. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,316
    Likes Received:
    2,928
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Hmm.. I'm writing this from my phone, so I don't know if it will work or not, but you can do something like this:

    var ampm = "am";var hour = OrangeTimeSystem.hour;if (OrangeTimeSystem.hour >= 12) { ampm = "pm";}hour = hour % 12;if (hour === 0) { hour = 12;}$gameVariables.setValue(1, ampm);$gameVariables.setValue(2, hour);To specify only one value for the time system, you can do it like this:

    OrangeTimeSystem.setDateTime({month: 15});But to use months with different lengths, your best option is to change the regular plugin methods to make it progress time accordingly. You will also have to change the method that calculates the week day.
    I can make your job much easier by adding a new param to use real time system without syncing it with the computer clock.
     
    Last edited by a moderator: Nov 5, 2015
    #55
    koldsack likes this.
  16. koldsack

    koldsack Veteran Veteran

    Messages:
    45
    Likes Received:
    25
    First Language:
    english
    actually i was reporting a glitch with OrangeTimeSystem.addHours(n), it apparently does hour addition either 1 step early or 1 step late, see screenies i attached on my last post. hope i'm making sense.
     

    Thank you, i will try it out, looks like a better way to do 12hr with meridian conversion.
     

    Excellent! Thanks!
     

    Nah, actually i like the way you device the system as it is. when used with your event plugin, it saves resources without incessant calls. besides i run real time at a faster rate, 10 ticks instead of the default 1000/100. thanks alot.

    EDIT: Just tried the month call on a common event:

    var a = $gameVariables.value(6);var b = $gameVariables.value(5);var c = $gameVariables.value(4);var d = 2016 || 2020;if (a == d && b == 2 && c >= 30) {OrangeTimeSystem.setDateTime({month: 3});} else if (a != d && b == 2 && c >= 29) {OrangeTimeSystem.setDateTime({month: 3});} it works flawlessly, except when i push time forward artificially with OrangeTimeSystem.addHours(23); it only updates the month on feb 30th (for non Leap years) and feb 31th on leap years (specified by var d). this 1 step delay in updating the month causes the day var to fall 1 day short and hence wrong day.
     
    Last edited by a moderator: Nov 5, 2015
    #56
    Hudell likes this.
  17. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,316
    Likes Received:
    2,928
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Try using this version of the plugin.


    I couldn't properly test it, but if you set the useRealTimeStructure param to true, the time would probably work the way you want it to and you won't need to add any common event.


    It will automatically consider leap years and everything.


    The problem with the addHours method is kind of weird, because everytime I increase the day, I remove 24 hours from the hour variable. Your screenshot should only be possible if the time was increased in 25 hours.


    Are there any setTime or setDateTime calls left anywhere on your code?
     
    #57
    koldsack likes this.
  18. koldsack

    koldsack Veteran Veteran

    Messages:
    45
    Likes Received:
    25
    First Language:
    english
    Thanks so much! I will have a go at it.

    EDIT: I think this version broke the 24 hour time cycle unfortunately, when realtime structure is activated.

    Not that i know of, i did changed OrangeHudClock.js' line.VariableSecond and  variableData.VariableSecond > 0 conditional to return a string instead of a number. so that i can use the seconds %3 pattern to call a var with stored AM/PM data. Most likely it's due to me shuffling the days around so that 0 would be a Thursday (was monday by default), since the beginning of 2016 starts on a Friday, while starting day is defined as 1.

    EDIT: ok i think i found out what was the issue:

    if i use the code you provided for 12hr/meridian conversion, the update does so exactly at 12 AM (though the HUD didn't update the time as 12 AM, F9 console showed that it indeed is 12 AM - or 0 hour).

    If i do the day change to Mar using:

    var day = OrangeTimeSystem.day;var month = OrangeTimeSystem.month;var year = OrangeTimeSystem.year;var leapyears = 2016 || 2020;if (day >= 30 && month === 2 && year === leapyears) { OrangeTimeSystem.setDateTime({month: 3});}if (day >= 29 && month === 2 && year != leapyears) { OrangeTimeSystem.setDateTime({month: 3});}it works! without any 1 day delay!

    I believe the common denominator with both, is that they do not compare variables in the js conditionals. the conditionals are purely using script calls from your plugin direct, that seemed to have eradicated the problem.
     
    Last edited by a moderator: Nov 6, 2015
    #58
    Hudell likes this.
  19. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,316
    Likes Received:
    2,928
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Oh, sorry, I hadn't seen that you had edited your post. I tested and fixed the useRealTimeStructure here now. I'm currently uploading a demo that uses an am/pm system using that snippet I showed you.


    Edit:


    Demo download


    Play demo online
     
    Last edited by a moderator: Nov 6, 2015
    #59
    max7 and koldsack like this.
  20. koldsack

    koldsack Veteran Veteran

    Messages:
    45
    Likes Received:
    25
    First Language:
    english
    Yep, realtimestructure works perfect now. Thank you very much!

    ps: until this demo, i didn't know i can use \[v] as a string pattern for HUDDate lol.
     
    #60
    Hudell likes this.

Share This Page