Okay as I'm sure many of you know I've been learning to script, so far so good. I've encountered a problem with a new script I started recently displaying a specific entry stored in an array, for now it shows all entries at once. I'm only trying to have it draw the text at a single index after a set amount of time.
Other problems that I'll tackle later will be increasing the day by one when you stay at an inn. I've got it so that it will display the "in game pseudo-time" properly and I have my days stored inside an array and then increasing the index by 1 every 24 "hours" to display a different day.
This is it so far
class Window_DateTime < Window_Base
def initialize
d1 = "Sunday"
d2 = "Monday"
d3 = "Tuesday"
d4 = "Wednesday"
d5 = "Thursday"
d6 = "Friday"
d7 = "Saturday"
@day = [d1, d2, d3, d4, d5, d6, d7]
super (0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
# refresh method to display time and date
def refresh
self.contents.clear
@time = Graphics.frame_count / Graphics.frame_rate
@min = @time / 15 % 60
@hour = @time / 15 / 15
# reset the hour to 0 and increase the index of the array @day
if @hour == 24
@day.index ++
@hour = 0
end
text = sprintf("%02d:%02d", @hour, @min)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
#Here's the problem this is the only way I've been able to display anything
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, @day.to_s, 2)
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @time
refresh
end
end
end
It's not much since it's a simple script to show a simple date/time.
Anyone here able to fix this problem please give me guidance.
Thanks,
~TheCrym
I fixed the problem, so far I did away with the array and replaced it with a simple variable that is initialized at 0 (0 = Sunday)
Anyone interested in helping me figure out how to change the screen tone in this script as well as how in increase the day every time the player stays at an inn? Anyone who can help figure that out will be rewarded with hugs and/or cake.
After testing a few times I realized, it's military time. Hopefully someone knows of an easy way to make it display in standard time. Any help will be appreciated with cookies and cake.
Okay as I'm sure many of you know I've been learning to script, so far so good. I've encountered a problem with a new script I started recently displaying a specific entry stored in an array, for now it shows all entries at once. I'm only trying to have it draw the text at a single index after a set amount of time.
Other problems that I'll tackle later will be increasing the day by one when you stay at an inn. I've got it so that it will display the "in game pseudo-time" properly and I have my days stored inside an array and then increasing the index by 1 every 24 "hours" to display a different day.
This is it so far
It's not much since it's a simple script to show a simple date/time.
Anyone here able to fix this problem please give me guidance.
Thanks,
~TheCrym
I fixed the problem, so far I did away with the array and replaced it with a simple variable that is initialized at 0 (0 = Sunday)
Here's the fixed one so far,
Anyone interested in helping me figure out how to change the screen tone in this script as well as how in increase the day every time the player stays at an inn? Anyone who can help figure that out will be rewarded with hugs and/or cake.
After testing a few times I realized, it's military time. Hopefully someone knows of an easy way to make it display in standard time. Any help will be appreciated with cookies and cake.
Edited by CrymShare this post
Link to post
Share on other sites