Joined
Jan 23, 2014
Messages
171
Reaction score
24
First Language
English
Primarily Uses
RMMZ
Hi Selchar,

This might be a silly question, but for the live of me I can't figure this out.

I have a common event called "wait" that allows the player to move time forward by a certain amount of hours.

It works fine, but if the player waits for longer than a value more than 24 hours it doesn't do the time correctly.

This is for the Calendar Clock Add-on (as far as I know) but could also be the Calender itself.

Example: Ideally, if the player decides to wait 13 hours after 9PM it should be 10AM right?

What happens: It makes it 22PM and then switches it to 12AM the next day. Any idea how to fix this?

The Game Variable for hour would be at 21, and the wait command would add 13 to that, making the total 34.

I think it has something to do with this: 

def self.current_time? hour = $game_variables[HOUR] minute = $game_variables[MIN] if hour == 0 hour = 12 else if hour >= 13 hour -= 12 end end #.to_s when used on a number's variable, turns it into a string? if hour < 10 hour = ' ' + hour.to_s else hour.to_s end if minute < 10 minute = '0' + minute.to_s else minute.to_s end #Resulting text for the method. return hour.to_s #+ ':' + minute.to_s end 
EDIT: I found a solution actually, in my common event I just took the input from the user and when added (if bigger than 24) and subtracted 24 to get the correct number. So the time is correct and but the day isn't >:C

I am curious if there is a script version of my solution? If not, I'll keep my common event. :D

EDIT2: I got the day to work with the script call HM::SEL::next_day($game_variables[228])

$game_variables[228] is my Hour variable. :D Hooray~
 
Last edited by a moderator:

SleepyGremlin

Meat Eater
Member
Joined
Sep 27, 2012
Messages
14
Reaction score
0
First Language
English
Primarily Uses
Hey Selchar first of all, amazing work on the script and the HM demo! It's so much fun to tinker with, and your code's are always easy to read.

I wanted to ask about the code for "HM Farm" in the demo.

Say I wanted 12 months of the year, but each month was grouped into a specific season (for example, Winter would be December, January and Febuary, Spring would be March, April, May, etc) so that crops would grow over a span of those months within the season, how would I adjust the code?

I tried the adjustment below, but I have zero experiance with code, so this came back as an error.

It's probably a more easy fix than I realise lD;

Code:
 case season      when 3,4 or 5  #SPRING------------------------------------------------        for eventid in events          if self_metadata([mapid, eventid, 1]) == 'Crop'            $game_self_switches[[mapid, eventid, 'A']] = false            $game_self_switches[[mapid, eventid, 'B']] = false            #F/G/H/I are Crop Indexes            #After that are water requirement for crop stages.            crop_control(mapid, eventid, 'F', 2, 3, 5)            crop_control(mapid, eventid, 'G', 3, 6, 8)            crop_control(mapid, eventid, 'H', 4, 8, 12)            crop_control(mapid, eventid, 'I', 3, 6, 9)          end        end
 
Last edited by a moderator:

Selchar

Veteran
Veteran
Joined
Dec 28, 2012
Messages
299
Reaction score
82
First Language
English
Primarily Uses
@MrPurple: I haven't tested, but I think it has something to do with prog_day. I just lazily set the time to midnight istead of subtracting 24 hours. luckily the next_day scriptcall does the job as you found out.

@Sleepy: Not knowing the error I can only guess, but I'd say it's the 'or' you used. I never tried an or inn a when statement as it's been unnecessary but that could be the cause. Anyways try using the following. I simply added a hash at the beginning to make it easier to choose what months are what season, modified the 1st line of crop progress to reflect it, and modified the conditions for the monthly purge to seasonal purge.

Code:
#This script holds data for the scriptcall that is to be used to progress#your crop events.#crop_progress(mapid)  #Using the provided event, there are 3 stages of progression, 4 crops per#season, 12 crops total.module HM_Farm  Month = {  #Month => Season  0 => 4, #Match this to your last month, in this case 12  1 => 4,  2 => 4,  3 => 1,  4 => 1,  5 => 1,  6 => 2,  7 => 2,  8 => 2,  9 => 3,  10 => 3,  11 => 3,  12 => 4,  } #Do Not Removeendclass Game_Interpreter  def crop_progress(mapid)    season = HM_Farm::Month[$game_variables[HM_SEL::MONTH]]    events = load_data(sprintf("Data/Map%03d.rvdata2", mapid)).events.keys    case season    when 1  #SPRING------------------------------------------------      for eventid in events        if self_metadata([mapid, eventid, 1]) == 'Crop'          $game_self_switches[[mapid, eventid, 'A']] = false          $game_self_switches[[mapid, eventid, 'B']] = false          #F/G/H/I are Crop Indexes          #After that are water requirement for crop stages.          crop_control(mapid, eventid, 'F', 2, 3, 5)          crop_control(mapid, eventid, 'G', 3, 6, 8)          crop_control(mapid, eventid, 'H', 4, 8, 12)          crop_control(mapid, eventid, 'I', 3, 6, 9)        end      end    when 2  #SUMMER------------------------------------------------      for eventid in events        if self_metadata([mapid, eventid, 1]) == 'Crop'          $game_self_switches[[mapid, eventid, 'A']] = false          $game_self_switches[[mapid, eventid, 'B']] = false          crop_control(mapid, eventid, 'F', 3, 6, 10)          crop_control(mapid, eventid, 'G', 2, 9, 15)          crop_control(mapid, eventid, 'H', 2, 6, 8)          crop_control(mapid, eventid, 'I', 3, 5, 10)        end      end    when 3  #FALL--------------------------------------------------      for eventid in events        if self_metadata([mapid, eventid, 1]) == 'Crop'          $game_self_switches[[mapid, eventid, 'A']] = false          $game_self_switches[[mapid, eventid, 'B']] = false          crop_control(mapid, eventid, 'F', 2, 6, 10)          crop_control(mapid, eventid, 'G', 2, 7, 8)          crop_control(mapid, eventid, 'H', 3, 6, 8)          crop_control(mapid, eventid, 'I', 4, 10, 15)        end      end    end      #If raining, then...    if $game_variables[HM_SEL::WEATHA] == 2      for eventid in events        if self_metadata([mapid, eventid, 1]) == 'Crop'          rain_control(mapid, eventid, 'F')          rain_control(mapid, eventid, 'G')          rain_control(mapid, eventid, 'H')          rain_control(mapid, eventid, 'I')        end      end    end        if $game_variables[HM_SEL::DAYB] == 1      prev_month_season = HM_Farm[$game_variables[HM_SEL::MONTH]-1]      return if  season == pre_month_season      for eventid in events        if self_metadata([mapid, eventid, 1]) == 'Crop'          if $game_variables[HM_SEL::WEATHA] != 4            crop_death(mapid, eventid, 'F')            crop_death(mapid, eventid, 'G')            crop_death(mapid, eventid, 'H')            crop_death(mapid, eventid, 'I')          else            crop_wipe_out(mapid, eventid)          end        end      end    end  end    #Do not Edit Below-----------------------------------------X  def crop_control(mapid, eventid, index, var1, var2, var3)    if $game_self_switches[[mapid, eventid, index]]      if self_variable([mapid, eventid, 1]) >= var1        $game_self_switches[[mapid, eventid, 'C']] = true      end      if self_variable([mapid, eventid, 1]) >= var2        $game_self_switches[[mapid, eventid, 'D']] = true      end      if self_variable([mapid, eventid, 1]) >= var3        $game_self_switches[[mapid, eventid, 'E']] = true      end    end  end  def rain_control(mapid, eventid, index)    if $game_self_switches[[mapid, eventid, index]]      if $game_self_switches[[mapid, eventid, 'B']] == false        self_variable([mapid, eventid, 1], 1, 1)        $game_self_switches[[mapid, eventid, 'B']] = true      end    end  end  def crop_death(mapid, eventid, index)    if $game_self_switches[[mapid, eventid, index]]      $game_self_switches[[mapid, eventid, 'J']] = true    end  end  def crop_wipe_out(mapid, eventid)    self_variable([mapid, eventid, 1], 0, 0)    $game_self_switches[[mapid, eventid, 'A']] = false    $game_self_switches[[mapid, eventid, 'B']] = false    $game_self_switches[[mapid, eventid, 'C']] = false    $game_self_switches[[mapid, eventid, 'D']] = false    $game_self_switches[[mapid, eventid, 'E']] = false    $game_self_switches[[mapid, eventid, 'F']] = false    $game_self_switches[[mapid, eventid, 'G']] = false    $game_self_switches[[mapid, eventid, 'H']] = false    $game_self_switches[[mapid, eventid, 'I']] = false    $game_self_switches[[mapid, eventid, 'J']] = false  endend
 
Last edited by a moderator:

SleepyGremlin

Meat Eater
Member
Joined
Sep 27, 2012
Messages
14
Reaction score
0
First Language
English
Primarily Uses
@Selchar Sorry, I should have pasted up the error, but it pretty much came down to the "or". But thank you very much for adjusting the code, especially with a seasonal purge rather than a monthly!

EDIT: Alright, I placed the code you provided me with into a copy of the demo, and got this error!

Q0mqE7k.png


Combing through the error, I found that if I removed

crop_progress(2)from the events, then the day would progress as normal; of course the crops wouldn't have advanced. I've tried to look into it to see if there was anything I could do myself - I can post up all the code that I editted to match the months to seasons if that helps.

I'm just sorry if this is starting to be a major bother.  uu;;;
 
Last edited by a moderator:

Selchar

Veteran
Veteran
Joined
Dec 28, 2012
Messages
299
Reaction score
82
First Language
English
Primarily Uses
Try getting the code again, I just edited it. Sorry I should have checked that it worked properly instead of assuming there were no typos. That and that downtime the forums had... so sorry fo the delay!


edit: nvm that other error I saw was from another script, the edited version above doesn't crash.
 
Last edited by a moderator:

SleepyGremlin

Meat Eater
Member
Joined
Sep 27, 2012
Messages
14
Reaction score
0
First Language
English
Primarily Uses
@Selchar

Don't worry about the delay - I wasn't able to get up the "HALP!" until an hour ago, so you came back pretty quickly!

Just put the code in and it works without any issue! Thank you so so much Selchar! :'D You're making a silly, long-term dream/project of mine come true with all these wonderful scripts!
 

Fitcher

Veteran
Veteran
Joined
May 3, 2015
Messages
50
Reaction score
7
First Language
Finnish
Primarily Uses
Hello, is it possible to get some help with the script?

after setting in the main script i keep getting an error at the beginning of a new game, but the funny thing is that it says its in game_screen line 103

Here is the full error

Script 'Game_Screen' line 103: Type Error occurred.

Can't clone NillClass

But when i use the scripts taken from steam day and night cycle pack it works, but then i got other issues with the clock HUD not hiding and time stop not working. 
 

Fitcher

Veteran
Veteran
Joined
May 3, 2015
Messages
50
Reaction score
7
First Language
Finnish
Primarily Uses
Okey so i manage to fix the error by my self by changing the code  in Game_screen 

 

def start_tone_change(tone, duration)

    @tone_target = tone.clone

    @tone_duration = duration

    @tone = @tone_target.clone if @tone_duration == 0

  end

 

To this makes it work but i dont think thats the right solution for it.

 

def start_tone_change(t, duration)

    @tone_target = tone.clone

    @tone_duration = duration

    @tone = @tone_target.clone if @tone_duration == 0

  end

 

Now the other problem i got is Calendar Clock HUD Add-On does not seem to update the year correct.

EDIT

Ahh now i get it the number after the month is not the year it the day of the month... that explains it.

 
 
Last edited by a moderator:

chungsie

Veteran
Veteran
Joined
Sep 9, 2015
Messages
665
Reaction score
877
First Language
English
Primarily Uses
N/A
When using just your first script, the main file, I get an error message from Game_Screen script, that can't clone NillClass
 

Selchar

Veteran
Veteran
Joined
Dec 28, 2012
Messages
299
Reaction score
82
First Language
English
Primarily Uses
Sorry to Fitcher for not being around at the time of his problem, at least you fixed it for yourself, was the same problem you chungsie just reported.  It seems I edited the script at some point but forgot a line.  It's been fixed so grab the script again.

The error was that it was reading a nil from the TONES hash, by default there were gaps in it and it was intended that when those gaps are there, it'd default to the Default Tone setting.  You can either fill in those gaps or leave them and grab the new script.
 

Halcy0n

Smoke and Mirrors
Veteran
Joined
Feb 6, 2013
Messages
383
Reaction score
252
First Language
English
Primarily Uses
RMMZ
Great script, Selchar! Thanks!
 
Last edited by a moderator:

Valnorth1001

Veteran
Veteran
Joined
Apr 15, 2015
Messages
35
Reaction score
2
First Language
English
Primarily Uses
How does HM farm work? I can't understand just through the demo
 

AllyJamy

Veteran
Veteran
Joined
Sep 24, 2015
Messages
65
Reaction score
36
First Language
English
Primarily Uses
RMVXA
-this was a mistake-
 
Last edited by a moderator:

MaxMoonS

Veteran
Veteran
Joined
Oct 28, 2015
Messages
20
Reaction score
0
First Language
Italian
Primarily Uses
hi, i have a problem. I wish it came in a closed space was always day and time you return to an open space resumption normal day-night cycle. How can I do? I tried the no-tone command, but does not work.
 

MaxMoonS

Veteran
Veteran
Joined
Oct 28, 2015
Messages
20
Reaction score
0
First Language
Italian
Primarily Uses
This script is beatiful! But I have a problem. In maps indoors I wish it were not dark when night falls. Example when entering home I wish it was always day although we 4 am
 

Jiffy

Veteran
Veteran
Joined
Jan 30, 2017
Messages
110
Reaction score
131
First Language
English
Primarily Uses
N/A
I'll give this one a try, looks promising.
 

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
First Language
English
Primarily Uses
RMVXA
Hello,

I'm hoping there's somebody following this thread that may know how to help me. I'm having a lot of difficulty getting Khas's Awesome Light Effects to work with this script.

There's a pack on Steam (or there was atleast) that managed to get it all working together but sadly the link is either dead or has been removed.

I've tried rearranging the scripts to see if one was overwriting the other etc but no joy. I have no other scripts in my list that mess with the screen tone so I'm at a loose end here and have been troubleshooting this for the last few hours on and off and it's starting to do my nut in!

If anybody has any advice for me it would be most welcome!!

Thanks!
 

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
First Language
English
Primarily Uses
RMVXA
Hello again,

I realize this is an old script now and I don't know if Selchar is even active anymore but if there are any savvy scripters on here who could take a look at his code it would be much appreciated.

I'm having big problems with the map/tileset notetags. I can put a note tag in my map and tileset and set the switches to disable tone/inside map and weather however the script never calls these and simply changes the tone regardless and it even rains indoors sometimes (lovely).

I've even gone as far as trying to completely disable the scripts tone feature by # out lines of code but I end up with an error that I can't fix. I've tried removing all the hourly tones but the script automatically calls the "default" tone of 0,0,0,0 if there are no tones provided so I cant even do the screen tints manually in my game as soon as the next hour pops up it just switches the tone to 0,0,0,0....

I think the code to call these functions is broken or not functioning fully but I can't work out how to fix it. I really like this script but I'm struggling to sort this problem out.

I've based my current project around this system as it seemed perfectly stable to begin with. I can't start over. If anybody can help me I'd greatly appreciate it!

(I'm using the most recent 2.1 version of the script in the first post. Along with the Calender Clock add on.)

EDIT:

FIRST OFF: If your having issues with the notetags check your script files as many of the notetag codes seem broken and you'll see stuff like <no [_-]tone> in stead of <no_tone> etc. Correct me if I'm wrong.

I have a little bit of a tip for you guys.

Well for any of you that's looking to use this calendar system without the automatic screen tone change. If you're struggling like I am in getting the note tags or in game switches to do as their told you should consider altering these lines of code just do as I did and # out the 3 lines below:

<script>
#-----------------------------------------------------------------------------
#Tone Related---------------------------------------------------------------
#-----------------------------------------------------------------------------
def self.show_tint(dura = 60)
hour = $game_variables[HOUR];hour = 0 if hour == 24
t = if no_tone?
#TONE_DEFAULT
else
if is_forest?
Forest_Tones[hour]
else
TONES[hour]
end
end
#t = TONE_DEFAULT unless t
#$game_map.screen.start_tone_change(t, dura)

end
#-----------------------------------------------------------------------------
#Weather Related-----------------------------------------------------------
#-----------------------------------------------------------------------------
</script>

This will completely void the tone changes within the script allowing you to create a more flexible event based tinting system for your tone changes.

I tried altering the code but had no luck, but I noticed the irritating thing about the code is that it automatically runs TONE_DEFAULT if you set your map to <no_tone>

IMO, if you setup a "no tone" feature in a script I would make it so that it stops the script from auto toning every hour thus giving the developer more power over a certain scene/map/whatever they want until they leave that map or switch off the corresponding SWITCH setup at the beginning of the script.

The "problem" (depends how this feature was intended by the scripter but I think this was an oversight on their part) with the script at present is that it checks every hour and adjusts the screen tone to TONE_DEFAULT so regardless of having "no tone" set up it changes the screen tone regardless, back to the same tone over and over again, what the script does do is avoid setting the predefined hourly screen tones which sorta makes sense but if you think about it this way.... You have a map in your game like a cave...abandoned building with no lights in it, wouldn't it be nice to use the <no_tone> command and set the map with 1 screen tone via a simple Autorun/Erase Event to DARK and not have it light back up every in game hour?

Rant over. If anybody can fix this script or improve on it I would be eternally grateful (plus credits in my game of course!)
 
Last edited:

Latest Threads

Latest Profile Posts

I am supposed to be preparing to teach my students this afternoon and tomorrow morning about Refugees, Asylees, and Fraud/Misrepresentation and all I can think about is how to improve my Turn Order display. :stickytongue:
Try changing POV battle, near and far away like suikoden...
watercave2.jpg

diablofar.jpg

In the end I choose near over shoulder resembles RE4. Tight close window better. The correlation between battleback, monster style and battler should also be observed and merged.
Upgraded my avatar to be cuter.
When you look for several things for ages and then suddenly find it all at once.

Status.png
Status2.png
equip.png
I'm going to see if I can set up a triple booting setup. Windows for standard use & gaming, debian for linux development and manjaro for linux gaming, wine & proton use.

Forum statistics

Threads
129,702
Messages
1,204,409
Members
170,767
Latest member
Akemyin
Top