I created a time system for my game that uses variables and common events, I am aware of time system scripts, and the event system I'm using works, so that in itself is not why I'm here.
What I'm looking at is a way to display the text for the day of the week, month and date on the game's screen, but without a message box in the background.
Something like this:
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fu93vxmzq857e3ahh9xn.jpg&hash=857ea8d1cee27e13dc0077c3b8f312410a0edf93)[/spoiler]
Here is the list of variables I'm using:
261: The date for January (1-31)
262: The date for February (1-28)
263: The date for March (1-31)
264: The date for April (1-30)
265: The date for May (1-31)
266: The date for June (1-30)
267: The date for July (1-31)
268: The date for August (1-31)
269: The date for September (1-30)
270: The date for October (1-31)
271: The date for November (1-30)
272: The date for December (1-31)
273: The current month (1-12)
274: The current day of the week (1-7)
275: The total number of years since the game started (not important)
Note, that if the variable for the current month's date is set to 0, then it is not active.
Basically, what I'm looking at is something like this:
If the current day of the week is 3 display: [Tuesday].
If the current month is 6 display: [June] and the current number for the June variable right next to it.
If possible, I'd like to have several different options for the on screen position, that would be assigned to a variable.
Example: If set to 0: disable visibility, if set to 1: appear at the screens X and Y position in the script, if set to 2: appear at another position that is also defined in the script.
Also, though it is not entirely necessary, I'd like for it to use a custom font, size and color if possible.
I've looked around and found similar scripts, but none of them are what I'm looking for.
If anyone is willing to make a script for this, I would be eternally grateful. ^_^
I'm busy making it for you ^^
good training for me :)
EDIT: could you post the set up of your evented system?
it would help me to see how to script it (would go faster)
Thanks and i'll post the script once it's done (let's say 2 days ^^ , i'm a beginner , but i'm not that bad at it :) )
Quote from: Mitsarugi on August 12, 2010, 04:53:15 PM
I'm busy making it for you ^^
good training for me :)
EDIT: could you post the set up of your evented system?
it would help me to see how to script it (would go faster)
Thanks and i'll post the script once it's done (let's say 2 days ^^ , i'm a beginner , but i'm not that bad at it :) )
Awesome, and thank you! ^_^
It will take me a few minutes to type up, so I'll edit this post when I'm done.
[Edit]
Basically, I have a common event that I can call to advance the time by 1 day.
I put several conditional branches that effect the variables in that common event.
So, if variable 274 is set to 1, then the current day is Sunday, and if I call the common event a conditional branch with a control variable will change the number to 2, which is Monday.
This process continues until the variable's number reaches 7 (Saturday), where it will reset the number to 1 (Sunday), and starts the whole week over.
The current month's date functions a little differently, instead of setting the number, I use the add command until it reaches the last day of the month, for January it is 31.
So in other words, if the number for the January date variable is between 1 and 31, it will add 1, so when the common event is called up, 1 becomes 2, 2 becomes 3, 3 becomes 4. etc.
After that, I used another conditional branch that is set to the same variable (the date for January), and I have it set to greater then 31.
Then I placed several control variables inside, the first sets variable 262 to 1 (thus starting the date system for the month of February), the next control variable sets 261 to 0 (placing January's date in the inactive position), and the third control variable changes variable 273 (months of the year) to 2, activating the month of February and ending the month of January.
Note, for December, I have an additional control variable that adds 1 to variable 275 (years).
The same basic practice is followed for all of the days and months.
Here is a picture of the common event, it will probably explain things better then I do:
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fsf42hi7colk1slgaflfx.png&hash=06f9d7e0464e1eb89d9e1e1d403981699c956632)[/spoiler]
I hope that explains things, let me know if you have any particular questions.
wow you still awake? O.O
PS: it's 3h in the morning here ^^
Quote from: Mitsarugi on August 13, 2010, 12:47:36 AM
wow you still awake? O.O
PS: it's 3h in the morning here ^^
It's actually 9 pm where I'm at, though I have been known to pull an all nighter on occasion. ;D
thanks this will help ^^
EDIT: Does it need to show the year too?
Quote from: Mitsarugi on August 13, 2010, 01:24:17 AM
thanks this will help ^^
EDIT: Does it need to show the year too?
No, just the day, month and date should be fine.
okay ^^
EDIT: Okay , so that is the event that checks the variables, but i would like to see what you used to add to them , manual or auto, parallel?
Quote from: Mitsarugi on August 13, 2010, 02:33:43 AM
okay ^^
EDIT: Okay , so that is the event that checks the variables, but i would like to see what you used to add to them , manual or auto, parallel?
I have the trigger set to none, because it activates in several different ways, so its on manual function.
Here's a brief explanation on that.
First, I have a day to night system that works with parallel processes, but it is only active when the player is on the field, so time resets to day and stops when you enter a town or go to the world map screen.
If the player is on the field, at midnight the day to night parallel process is set to call up the common event which causes the day and date, and depending on what date and month it is, the month and year to advance.
So if the player is on the field during December 31 on a Friday, then at midnight the time will change to January 1 on a Saturday the following year.
I've also placed a call common event with a time of day conditional branch in all of the events that transfer the player out of the field maps.
The conditional branch is set so that if the time of day is between evening and midnight, it will automatically be the next day when the player leaves.
This means that if the player has a deadline, then finishing up on the field and returning before evening will give the player an extra day, where if they leave after evening then they lose an extra day.
Also, since the common event is set to manual, it allows me to advance whenever I want.
The game I'm working on is a fan game of the Atelier series, so I might have it advance a day after synthesizing an item, but I haven't decided on that yet.
i'm making it with an auto mode so it would add to the variable by itself ^^
(works with a clock)
if the hours are 24 it adds to the variable and the day would change :)
if the days are the max of the month it starts the new month
and if the months reach there max it changes the year ^^
Quote from: Mitsarugi on August 14, 2010, 03:37:32 PM
i'm making it with an auto mode so it would add to the variable by itself ^^
(works with a clock)
if the hours are 24 it adds to the variable and the day would change :)
if the days are the max of the month it starts the new month
and if the months reach there max it changes the year ^^
Sounds cool, but the parallel process already changes the time, and the day to night system I'm using doesn't follow a 24 hour clock, so wouldn't that alter things a bit? or is it optional?
Quote from: Palsa on August 15, 2010, 02:05:24 AM
Quote from: Mitsarugi on August 14, 2010, 03:37:32 PM
i'm making it with an auto mode so it would add to the variable by itself ^^
(works with a clock)
if the hours are 24 it adds to the variable and the day would change :)
if the days are the max of the month it starts the new month
and if the months reach there max it changes the year ^^
Sounds cool, but the parallel process already changes the time, and the day to night system I'm using doesn't follow a 24 hour clock, so wouldn't that alter things a bit? or is it optional?
Yeah i'll make it optional ^^
and a switch to use the script or not ^^
EDIT: updated the variables , now uses only 3 :)
Cool. ^_^
I was just wondering, but would it be possible to have it set so that when the display is disabled, it can be called up for a certain amount of time, maybe 5 seconds, by pressing a key such as 'T'?
If not, then that's ok.
Quote from: Palsa on August 15, 2010, 05:33:29 PM
Cool. ^_^
I was just wondering, but would it be possible to have it set so that when the display is disabled, it can be called up for a certain amount of time, maybe 5 seconds, by pressing a key such as 'T'?
If not, then that's ok.
i'll try ^^
PS: almost done too :)
Quote from: Mitsarugi on August 16, 2010, 04:39:21 PM
Quote from: Palsa on August 15, 2010, 05:33:29 PM
Cool. ^_^
I was just wondering, but would it be possible to have it set so that when the display is disabled, it can be called up for a certain amount of time, maybe 5 seconds, by pressing a key such as 'T'?
If not, then that's ok.
i'll try ^^
PS: almost done too :)
Awesome! ^_^
Done so far:261: The date for January (1-31)
262: The date for February (1-28)
263: The date for March (1-31)
264: The date for April (1-30)
265: The date for May (1-31)
266: The date for June (1-30)
267: The date for July (1-31)
268: The date for August (1-31)
269: The date for September (1-30)
270: The date for October (1-31)
271: The date for November (1-30)
272: The date for December (1-31)
^Done Only 1 variable now (cause i'm good with variables :p )
273: The current month (1-12)
^Done
274: The current day of the week (1-7)
^Done
275: The total number of years since the game started (not important)
^ Done
Note, that if the variable for the current month's date is set to 0, then it is not active.
^Done
Basically, what I'm looking at is something like this:
If the current day of the week is 3 display: [Tuesday].
If the current month is 6 display: [June] and the current number for the June variable right next to it.
^Done
If possible, I'd like to have several different options for the on screen position, that would be assigned to a variable.
Example: If set to 0: disable visibility, if set to 1: appear at the screens X and Y position in the script, if set to 2: appear at another position that is also defined in the script.
^I'll add this too ^^
Also, though it is not entirely necessary, I'd like for it to use a custom font, size and color if possible.
^Done
QuoteI was just wondering, but would it be possible to have it set so that when the display is disabled, it can be called up for a certain amount of time, maybe 5 seconds, by pressing a key such as 'T'?
If not, then that's ok.
^Trying to add this :p
EDIT:
QuoteSounds cool, but the parallel process already changes the time, and the day to night system I'm using doesn't follow a 24 hour clock, so wouldn't that alter things a bit? or is it optional?
which day to night system? KGC?
Awesome! ^_^
Quote from: Mitsarugi on August 17, 2010, 01:54:52 AMEDIT:
QuoteSounds cool, but the parallel process already changes the time, and the day to night system I'm using doesn't follow a 24 hour clock, so wouldn't that alter things a bit? or is it optional?
which day to night system? KGC?
The day to night system is of my own creation.
I'll see if I can describe how it works.
Basically, I have an event on the field that is set to parallel process.
The event requires two switches to be active, one is the master switch and the other represents the current time of the day.
There are a total of 16 pages in the event, each representing a specific time of the day.
When the event starts, it loads 4 pictures as screen overlays: noon, evening, night and morning, all set to invisible on the first page, and it also loads a 5th picture for the time piece.
The reason I chose picture overlay instead of tint screen is because I like the way it looks more then tint screen.
Though I do use tint screen on some maps, I have to calculate the color change differently for each map.
After the pictures have loaded, it activates several switches for time based events, as well as the transfer event.
The last part of the event has two wait commands set to 500, and one or more picture moves set to adjust the visibility on the picture overlays that has a 500 wait attached to it.
So in total, the waiting time is approximately 1500 between the transitions.
After the transition has finished, it turns on the switch for the next time period and turns of the current, causing the event to move on to the next page, where the display pictures are set in the same manner as the picture moves were at the end of the last page.
The time piece is different for each page, and is actually one of the reasons why I was asking for the text to have more then one display location.
One thing to note, when I created this, I was still learning how to use variables, conditional branches and common events.
So I might redo the entire event so that it will work on a common event instead of a field event, and if so, I'll probably change all of the switches to variables.
Here are some screenshots showing all 16 periods in a full day:
[spoiler]
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fdckhond9yuzvvqz0k754.jpg&hash=7f30bda547bf7102e4e10d1d2ebc39337cf64c0b)(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fm9zkfm6yn26krbkcxiyn.jpg&hash=98c08a3bf513b701e9fea094bc4997b0283a298a)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fuuj1auimgfd50ifz5mtd.jpg&hash=449607b526c2e17a4cb9234781ef870ca58528e2)(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fe6dt3apir99dzeirb2v.jpg&hash=73fb1d7d88fde9a69dffead6578c6ca89b7a5186)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fbf0x4rgvf7xoqysddhpz.jpg&hash=7082f194f76a290f5095795cecd8131e94d3ebf0)(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2F3mjrfvr5sdss5a0657k0.jpg&hash=d26599edf026578db8865cc2d92290eb5c83ad24)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fuiujgp1an1k35kl5i564.jpg&hash=1562ba5afe78ad65347c985c5d08180804e59490)(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fpoip5xz9l252y19pt6u.jpg&hash=4cc27dc60f3d055469870ec9f5f16a5d54e2f818)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Ffq4x4bzflx7q15fopzt.jpg&hash=d80d591f3b4e937b22a0a24f317fd62974cd129e)(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fm8oxpdvxltynt268kmq0.jpg&hash=1c073d401937ed11972088085224fa635355f81f)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fu2ktbzioyj7g96rrof1p.jpg&hash=031f4af67b596be111a67eb401c835e576035bc4)(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2F8nhq2hlyib3446rn13qp.jpg&hash=16a4bcc7b8d7020f28c9c56ccdf2896901d1c06a)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Ff1h1e4b949r51f9lzow.jpg&hash=d84b4ae0e815b54f5686baeca3fab5b57668a909)(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fopsa2b51irr1fidb9gck.jpg&hash=9a36c619469745ee339be51afc8164053f3e80b2)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2F4tjfrkbktwpdv14jwpb.jpg&hash=6cc03d150a21b0b8d6e13254698090db45dd9536)(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fl7lndegq0vvc4n41cogx.jpg&hash=07026b897c1c8bd9a406ecbc2707c480e2338d25)
[/spoiler]
XP? O.o
EDIT: Could you send me a file with your clock images?
i'll make a little extra for you (you'll see ^^)
PS: i was wanting to request the same thing as you did , till i saw your request and decided to script it on my own :p
Quote from: Mitsarugi on August 17, 2010, 01:47:03 PM
XP? O.o
EDIT: Could you send me a file with your clock images?
i'll make a little extra for you (you'll see ^^)
PS: i was wanting to request the same thing as you did , till i saw your request and decided to script it on my own :p
How about if I just make a quick demo instead?
I'll include all of the graphics of course. ^_^
That would be great, but is it XP?
Quote from: Mitsarugi on August 19, 2010, 02:38:41 PM
That would be great, but is it XP?
No, I'm using VX, though the sprites are in the XP style.
Will that be a problem?
Quote from: Palsa on August 19, 2010, 06:25:56 PM
Quote from: Mitsarugi on August 19, 2010, 02:38:41 PM
That would be great, but is it XP?
No, I'm using VX, though the sprites are in the XP style.
Will that be a problem?
ah, phew....i almost tought it would be Xp (i can't script for XP)
i'm almost done but if you want i found this one
http://www.rpgmakervx.net/index.php?showtopic=28750&hl=
which i could modifie if needed ^^
Quote from: Mitsarugi on August 19, 2010, 10:18:08 PM
Quote from: Palsa on August 19, 2010, 06:25:56 PM
Quote from: Mitsarugi on August 19, 2010, 02:38:41 PM
That would be great, but is it XP?
No, I'm using VX, though the sprites are in the XP style.
Will that be a problem?
ah, phew....i almost tought it would be Xp (i can't script for XP)
i'm almost done but if you want i found this one
http://www.rpgmakervx.net/index.php?showtopic=28750&hl=
which i could modifie if needed ^^
Thanks, I've considered using that one, but I've already got the time features integrated through eventing, so all I really need is the display.
SOLVED!? ^^
I've been watching this request for some days now.
I usually make most requests in requests forums to keep my skills good, and I've had this request done for a while now.
If the person who took it on doesnt mind, I could give you my version of it.
i don't mind if i could see it too please ^^
Here it is then.
#------------------------------------------------------------------------------
# * Constants
#------------------------------------------------------------------------------
# Initial X Position
INITIAL_X_POSTION = 290
# Initial Y Position
INITIAL_Y_POSTION = 0
# Font names for display
FONT_NAME = ["Tahoma", "Arial"]
# Font size for display
FONT_SIZE = 22
# Month Vriable ID
MONTH_VARIABLE = 273
# Date information hash
DATE_MONTH_INFORMATION = {
# Month ID => [Month name, Days Variable ID]
1 => [ "January", 261],
2 => [ "February", 262],
3 => [ "March", 263],
4 => [ "April", 264],
5 => [ "May", 265],
6 => [ "June", 266],
7 => [ "July", 267],
8 => [ "August", 268],
9 => [ "September", 269],
10 => [ "October", 270],
11 => [ "November", 271],
12 => [ "December", 272],
}
# Day Variable ID
DAY_VARIABLE = 274
# Date day information
DATE_DAY_INFORMATION = {
1 => "Sunday",
2 => "Monday",
3 => "Tuesday",
4 => "Wednesday",
5 => "Thursday",
6 => "Friday",
7 => "Saturday",
}
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Set Display Date Position
# x : New display X coordinate
# y : New display Y coordinate
#--------------------------------------------------------------------------
def set_display_date_position(x, y)
# Set Date Display Positions
$game_map.date_display_x, $game_map.date_display_y = x, y
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Enable Date Display
#--------------------------------------------------------------------------
def enable_date_display
# Set Date Display Visibility to true
$game_map.date_display_visible = true
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Disable Date Display
#--------------------------------------------------------------------------
def disable_date_display
# Set Date Display Visibility to false
$game_map.date_display_visible = false
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Update Date Display
#--------------------------------------------------------------------------
def update_date_display
# Return if not on scene map
return if !$scene.is_a?(Scene_Map)
# Update Date Display
$scene.update_date_display
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :date_display_x # date display X position
attr_accessor :date_display_y # date display Y position
attr_accessor :date_display_visible # date display visibility flag
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias tds_date_display_game_map_initialize initialize
def initialize
tds_date_display_game_map_initialize
@date_display_x = INITIAL_X_POSTION
@date_display_y = INITIAL_Y_POSTION
@date_display_visible = true
end
#--------------------------------------------------------------------------
# * Get Day of the Week Date Display
#--------------------------------------------------------------------------
def get_day_name_date_display
# Get Day Name
day = DATE_DAY_INFORMATION[$game_variables[DAY_VARIABLE]]
return day == nil ? "" : day
end
#--------------------------------------------------------------------------
# * Get Day Number Date Display
#--------------------------------------------------------------------------
def get_day_number_date_display
# Get Day Number
var = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
day = var == nil ? nil : $game_variables[var[1]]
return day == nil ? "" : day
end
#--------------------------------------------------------------------------
# * Get Day of the Week Date Display
#--------------------------------------------------------------------------
def get_month_date_display
# Get Month Name
month = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
return month == nil ? "" : month[0]
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs the map screen processing.
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
alias tds_date_display_scene_map_start start
def start
tds_date_display_scene_map_start
# Create Date Display Sprite
@date_display = Sprite.new
@date_display.bitmap = Bitmap.new(200, 200)
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Update Date Display
#--------------------------------------------------------------------------
def update_date_display
# Set visibility
@date_display.visible = $game_map.date_display_visible
# Set display positions
@date_display.x, @date_display.y = $game_map.date_display_x, $game_map.date_display_y
# Set Display Font
@date_display.bitmap.font.name = FONT_NAME
# Set Display font size
@date_display.bitmap.font.size = FONT_SIZE
# Clear Bitmap Contents
@date_display.bitmap.clear
# Draw Weekday
@date_display.bitmap.draw_text(0, 0, 190, FONT_SIZE + 6, $game_map.get_day_name_date_display, 1)
# Text for date display
text = sprintf("%s %s", $game_map.get_month_date_display, $game_map.get_day_number_date_display)
# Draw Month
@date_display.bitmap.draw_text(0, 28, 190, FONT_SIZE + 6, text, 1)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias tds_date_display_scene_map_terminate terminate
def terminate
tds_date_display_scene_map_terminate
# Dispose of date display sprite and bitmap
@date_display.bitmap.dispose
@date_display.dispose
end
end
Since it's a time system that was made with event, I decided to make it as simple as possible with basic commands such as disable, enable and update.
To disable and enable the date display, use this in a call script:
Disable:
disable_date_display
Enable:
enable_date_display
To update the contents of the date display use this in a call script.
update_date_display
To set the position of the date display use this in a call script.
set_display_date_position(X, Y)
X and Y are the positions on the screen.
Example:
set_display_date_position(300, 100)
Let me know if it works for you or want anything changed and have a nice day.
Awesome, it works very well! ^_^
[spoiler]
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fwtu3jch8ohccvlyjgg.jpg&hash=c325bccadf95f7b3c4dcfce0485e4903c1cfba94)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fskngriktjd2pblftsi7.jpg&hash=f7c22a793f41f49b2e168df7d2c98f2650c96abe)
[/spoiler]
There's just one thing I forgot to mention, I'm using Yanfly's Common Event Menu script for the world map, and the day and month seems to disappear when the menu is called up:
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2F9dzyy1sy9jgr02sxbnf.jpg&hash=441b81025a0526706f34c207fb192f270af62a27)[/spoiler]
Would it be possible to add a switch function that would disable it from disappearing while other menu's are up?
It's not that it disappears.
The display date is a sprite that's added to the scene map to display information.
To make it work with other scripts it has to be added onto those scripts.
If you provide the script I will add it into it.
Quote from: Zanaziel on August 21, 2010, 09:12:38 PM
It's not that it disappears.
The display date is a sprite that's added to the scene map to display information.
To make it work with other scripts it has to be added onto those scripts.
If you provide the script I will add it into it.
K, here's the script:
[spoiler]
#===============================================================================
#
# Yanfly Engine RD - Common Event Menu
# Last Date Updated: 2009.06.12
# Level: Normal, Hard
#
# Similar to the Common Event Shop, the Common Event Menu lets you create your
# menus to list various common event options. Now, you don't have to use all of
# those obnoxiously tedious Show Choice branches and conditional branches just
# to let the player get somewhere in range.
#
# This script lets you create your own generated common event menus with ease.
# Set the style of the menu, the nature of the menu, and the contents of the
# menu. Afterwards, set the switches (if required) for the common events to
# even appear, any pictures to go along with it, and descriptions on what the
# common event can do for the player.
#
#===============================================================================
# Updates:
# ----------------------------------------------------------------------------
# o 2009.06.12 - Finished script.
# o 2009.06.11 - Started script.
#===============================================================================
# Instructions
#===============================================================================
#
# First, bind CE_MENU_VARIABLE to the variable you wish to launch common event
# menus with.
#
# Scroll down and edit the CE_MENU_HASH. This will reflect what common events
# appear in those menus, the style of the menu, and the title associated with
# the menu.
#
# Scroll down and edit the CE_MENU_ITEMS. This will determine how common events
# can be shown, what switches they require, and if it will display any pictures
# along with it.
#
# Then, to launch the menu, just change the CE_MENU_VARIABLE variable to the
# menu ID you want to launch. Simple as that.
#
#===============================================================================
# Style Names
# "General" - A very normal kind of menu.
# "Compact" - A smaller version of the General style.
# "Double" - Displays two columns for the menu.
# "Bottom" - Aligns the choices at the bottom of the screen.
# "Lefty" - Aligns the choices to the left side of the screen.
# "Righty" - Aligns the choices to the right side of the screen.
# "Gimmick" - A pretty gimmicky style.
#===============================================================================
#
# Compatibility
# - Alias: Game_Interpreter: command_122
#
#===============================================================================
$imported = {} if $imported == nil
$imported["CommonEventMenu"] = true
module YE
module EVENT
# This is the variable that triggers the kind of shop you want to open.
CE_MENU_VARIABLE = 70
#-------------------------------------------------------------------------
# Use the following hash to determine what common events you can launch
# from that menu ID. You can set the style, whether or not the player can
# cancel out of the menu, and the title of the menu. Of course, you also
# set what common events can be launched from this menu, too.
#
# Style Name - Style name used. Look in the instructions to view styles.
# Cancel - Can the player cancel out of the menu?
# Title - Title used for the menu.
# [Array] - Common events allowed to be choosen in the menu.
#-------------------------------------------------------------------------
CE_MENU_HASH ={ # Follow the example.
# MenuID => [ Style Name, Cancel, Title
1 => [ "Map Screen", false, "World Map",
[11, 25, 13, 14, 32, 15, 33, 24, 39, 40, 35, 36, 37, 38, 34, 26, 27, 28, 29, 30, 31,]
], # The above array lists the common events selectable.
2 => [ "Synthesis", true, "Item Synthesis",
[1, 2, 3, 4, 5, 6, 7, 8]
], # The above array lists the common events selectable.
3 => [ "Double", true, "Double the columns!",
[15, 16, 17]
], # The above array lists the common events selectable.
} # Do not remove this.
#-------------------------------------------------------------------------
# Use the following hash to determine how you want your common events to
# appear. To hide some items, set a switch number to the value shown. To
# display a picture along with the common event, include the picture name.
# To change the font size used, set the size. And finally, you can adjust
# the description given to the common event to be launched.
#
# Switch - Switch required to be on for it to appear. nil for no switch.
# Picture - Picture shown in the display window. nil for no picture shown.
# Size - Font size used for the display window.
# Descrip - Description used for event. Use | to create a new line.
#-------------------------------------------------------------------------
CE_MENU_ITEMS ={ # Follow the example.
# ItemID => [Switch, Picture, Size, Description]
1 => [ nil, "Items1", 16, "Items"],
2 => [ nil, "Materials1", 16, "Materials"],
3 => [ nil, "Ingredients1", 16, "Ingredients"],
4 => [ nil, "Garments1", 16, "Garments"],
5 => [ nil, "Weapons1", 16, "Weapons"],
6 => [ nil, "Accessories1", 16, "Accessories"],
7 => [ nil, "Special1", 16, "Special"],
8 => [ nil, "Recipes1", 16, "Recipes"],
11 => [ nil, "LN-Elirica Atelier", 16, "Elirica's Atelier"],
25 => [ nil, "LN-Brume Forest", 16, "Brume Forest"],
13 => [ nil, "LN-Ceresburg", 16, "Ceresburg"],
14 => [ nil, "LN-Galetown", 16, "Galetown"],
15 => [ nil, "LN-Chiharu Village", 16, "Chiharu Village"],
24 => [ nil, "LN-Larisa Landing", 16, "Larisa Landing"],
32 => [ nil, "LN-Alvina Village", 16, "Alvina Village"],
33 => [ nil, "LN-Elf Village", 16, "Elf Village"],
34 => [ 185, "LN-Puni Caravan", 16, "Puni Caravan"],
35 => [ nil, "LN-Tamarind Beach", 16, "Tamarind Beach"],
36 => [ nil, "LN-Old Mine", 16, "Old Mine"],
37 => [ nil, "LN-Amaterasu Highlands", 16, "Amaterasu Highlands"],
38 => [ nil, "LN-Ornella Marsh", 16, "Ornella Marsh"],
26 => [ nil, "LN-Air Mana", 16, "Air Mana Shrine"],
27 => [ nil, "LN-Earth Mana", 16, "Earth Mana Shrine"],
28 => [ nil, "LN-Water Mana", 16, "Water Mana Shrine"],
29 => [ nil, "LN-Fire Mana", 16, "Fire Mana Shrine"],
30 => [ nil, "LN-Light Mana", 16, "Light Mana Shrine"],
31 => [ nil, "LN-Darkness Mana", 16, "Darkness Mana Shrine"],
39 => [ nil, "LN-Ernesta Colosseum", 16, "Ernesta Colosseum"],
40 => [ nil, "LN-Azazel Tower", 16, "Azazel Tower"],
} # Do not remove this.
end # EVENT
end # YE
#===============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
# Therefore, edit at your own risk.
#===============================================================================
#===============================================================================
# Game_Interpreter
#===============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# alias control variables
#--------------------------------------------------------------------------
alias command_122_cemenu command_122 unless $@
def command_122
n = command_122_cemenu
if @params[0] == YE::EVENT::CE_MENU_VARIABLE and !$game_temp.in_battle and
$game_variables[YE::EVENT::CE_MENU_VARIABLE] != 0
$scene = Scene_Common_Event_Menu.new
end
return n
end
end # Game_Interpreter
#===============================================================================
# Scene_Common_Event_Menu
#===============================================================================
class Scene_Common_Event_Menu < Scene_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
menu_id = $game_variables[YE::EVENT::CE_MENU_VARIABLE]
@style = YE::EVENT::CE_MENU_HASH[menu_id][0]
@cancel = YE::EVENT::CE_MENU_HASH[menu_id][1]
@title = YE::EVENT::CE_MENU_HASH[menu_id][2]
@items = YE::EVENT::CE_MENU_HASH[menu_id][3]
end
#--------------------------------------------------------------------------
# start
#--------------------------------------------------------------------------
def start
super
@spriteset = Spriteset_Map.new
create_windows
refresh_display
end
#--------------------------------------------------------------------------
# create_windows
#--------------------------------------------------------------------------
def create_windows
#---
if @style == "General" # General Style
@title_window = Window_Base.new(0, 0, 544, 56)
@title_window.contents.draw_text(4, 0, 504, 24, @title, 1)
@command_width = 272
@columns = 1
create_command_window
@command_window.x = 0
@command_window.y = 56
@command_window.height = 360
@display_window = Window_Event_Display.new(272, 56, 272, 360, "tall")
return
end
#---
if @style == "Compact" # Compact Style
@title_window = Window_Base.new(48, 48, 448, 56)
@title_window.contents.draw_text(4, 0, 408, 24, @title, 1)
@command_width = 224
@columns = 1
create_command_window
@command_window.x = 48
@command_window.y = 104
@command_window.height = 264
@display_window = Window_Event_Display.new(272, 104, 224, 264, "tall")
return
end
#---
if @style == "Double" # Double Style
@title_window = Window_Base.new(0, 0, 544, 56)
@title_window.contents.draw_text(4, 0, 504, 24, @title, 1)
@command_width = Graphics.width
@columns = 2
create_command_window
@command_window.x = 0
@command_window.y = 56
@command_window.height = 232
@display_window = Window_Event_Display.new(0, 288, 544, 128, "wide")
return
end
#---
if @style == "Bottom" # Bottom Style
@title_window = Window_Base.new(0, 0, Graphics.width, 56)
@title_window.contents.draw_text(4, 0, Graphics.width-40, 24, @title, 1)
@command_width = Graphics.width
@columns = 2
create_command_window
@command_window.x = 0
@command_window.y = Graphics.height - 128
@command_window.height = 128
return
end
#---
if @style == "Lefty" # Lefty Style
@title_window = Window_Base.new(0, 0, 200, 56)
@title_window.contents.draw_text(4, 0, 160, 24, @title, 1)
@command_width = 200
@columns = 1
create_command_window
@command_window.x = 0
@command_window.y = 56
@command_window.height = Graphics.height - 56 - 128
@display_window = Window_Event_Display.new(0, 288, 200, 128, "no text")
return
end
#---
if @style == "Righty" # Righty Style
@title_window = Window_Base.new(344, 0, 200, 56)
@title_window.contents.draw_text(4, 0, 160, 24, @title, 1)
@command_width = 200
@columns = 1
create_command_window
@command_window.x = 344
@command_window.y = 56
@command_window.height = Graphics.height - 56 - 128
@display_window = Window_Event_Display.new(344, 288, 200, 128, "no text")
return
end
#---
if @style == "Gimmick" # Compact Style
@title_window = Window_Base.new(48, 48, 448, 56)
@title_window.contents.draw_text(4, 0, 408, 24, @title, 1)
@dummy_window = Window_Base.new(48, 104, 448, 264)
@command_width = 224
@columns = 1
create_command_window
@command_window.x = 48
@command_window.y = 104
@command_window.height = 264
@display_window = Window_Event_Display.new(272, 104, 224, 264, "tall")
@command_window.opacity = 0
@display_window.opacity = 0
return
end
#---
if @style == "Town" # Town Style
@title_window = Window_Base.new(0, 0, Graphics.width, 56)
@title_window.contents.draw_text(4, 0, Graphics.width-40, 24, @title, 1)
@command_width = Graphics.width
@columns = 2
create_command_window
@command_window.x = 0
@command_window.y = Graphics.height - 108
@command_window.height = 108
return
end
#---
if @style == "Synthesis" # Synthesis Menu
@title_window = Window_Base.new(0, 0, 544, 56)
@title_window.contents.draw_text(4, 0, 504, 24, @title, 1)
@dummy_window = Window_Base.new(0, 56, 544, 80)
@dummy_window_2 = Window_Base.new(0, 136, 384, 280)
@dummy_window_3 = Window_Base.new(384, 136, 160, 140)
@dummy_window_4 = Window_Base.new(384, 276, 160, 140)
@command_width = 500
@columns = 4
create_command_window
@command_window.x = 16
@command_window.y = 56
@command_window.height = 264
@display_window = Window_Event_Display.new(416, 148, 324, 364, "tall")
@command_window.opacity = 0
@display_window.opacity = 0
return
end
#---
if @style == "Map Screen" # Map Screen
@title_window = Window_Base.new(0, 0, 200, 56)
@title_window.contents.draw_text(4, 0, 160, 24, @title, 1)
@command_width = 200
@columns = 1
create_command_window
@command_window.x = 0
@command_window.y = 56
@command_window.height = Graphics.height - 56 - 0
@display_window = Window_Event_Display.new(184, -22, 376, 454, "no text")
@display_window.opacity = 0
return
end
end
#--------------------------------------------------------------------------
# create_command_window
#--------------------------------------------------------------------------
def create_command_window
commands = []
@data = []
for item_id in @items
next unless YE::EVENT::CE_MENU_ITEMS.include?(item_id)
next if YE::EVENT::CE_MENU_ITEMS[item_id][0] != nil and
!$game_switches[YE::EVENT::CE_MENU_ITEMS[item_id][0]]
item_name = $data_common_events[item_id].name
commands.push(item_name)
@data.push(item_id)
end
@command_window = Window_Command.new(@command_width, commands, @columns)
@last_id = commands.size + 1
end
#--------------------------------------------------------------------------
# terminate
#--------------------------------------------------------------------------
def terminate
super
@spriteset.dispose
@title_window.dispose if @title_window != nil
@command_window.dispose if @command_window != nil
@display_window.dispose if @display_window != nil
@dummy_window.dispose if @dummy_window != nil
@dummy_window_2.dispose if @dummy_window_2 != nil
@dummy_window_3.dispose if @dummy_window_3 != nil
@dummy_window_4.dispose if @dummy_window_4 != nil
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
@spriteset.update
$game_map.update
update_input
end
#--------------------------------------------------------------------------
# update_input
#--------------------------------------------------------------------------
def update_input
@command_window.update
if @last_id != @command_window.index
@last_id = @command_window.index
refresh_display
end
if Input.trigger?(Input::B) and @cancel
Sound.play_cancel
$game_variables[YE::EVENT::CE_MENU_VARIABLE] = 0
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if @data == []
Sound.play_buzzer
return
end
Sound.play_decision
$game_temp.common_event_id = @data[@command_window.index]
$game_variables[YE::EVENT::CE_MENU_VARIABLE] = 0
$scene = Scene_Map.new
end
end
#--------------------------------------------------------------------------
# refresh_display
#--------------------------------------------------------------------------
def refresh_display
return if @display_window == nil
@display_window.refresh(@data[@command_window.index])
end
end # Scene_Common_Event_Menu
#===============================================================================
# Window_Event_Display
#===============================================================================
class Window_Event_Display < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(x, y, w, h, type = "tall")
super(x, y, w, h)
@type = type
menu_id = $game_variables[YE::EVENT::CE_MENU_VARIABLE]
first_item = YE::EVENT::CE_MENU_VARIABLE[menu_id]
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(id = nil)
self.contents.clear
return if id == nil
return unless YE::EVENT::CE_MENU_ITEMS.include?(id)
txsize = YE::EVENT::CE_MENU_ITEMS[id][2]
self.contents.font.size = txsize
if YE::EVENT::CE_MENU_ITEMS[id][1] != nil # Draw a picture.
name = YE::EVENT::CE_MENU_ITEMS[id][1]
bitmap = Cache.picture(name)
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(0, 6, bitmap, rect)
if @type == "tall"
dy = bitmap.height + (txsize / 2)
dx = 0
elsif @type == "wide"
dx = bitmap.width + (txsize / 2)
dy = 0
end
bitmap.dispose
else
dy = 0
dx = 0
end
return if @type == "no text"
text = YE::EVENT::CE_MENU_ITEMS[id][3]
nwidth = Graphics.width
buf = text.gsub(/\\N(\[\d+\])/i) { "\\__#{$1}" }
lines = buf.split(/(?:[|]|\\n)/i)
lines.each_with_index { |l, i|
l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
self.contents.draw_text(dx, i * txsize + dy, nwidth, WLH, l, 0) }
end
end # Window_Event_Display
#===============================================================================
#
# END OF FILE
#
#===============================================================================
[/spoiler]
[Edit]
Oop's, wrong script, fixed.
The script you provided was not really any use at all, since it's configured to your game and resources.
Next time please provide a script that can work without your resources.
I did the edit by aliasing methods, so in theory it should work even though I could not test it.
Replace your other script with this one and place it below the one you provided.
#------------------------------------------------------------------------------
# * Constants
#------------------------------------------------------------------------------
# Initial X Position
INITIAL_X_POSTION = 290
# Initial Y Position
INITIAL_Y_POSTION = 0
# Font names for display
FONT_NAME = ["Tahoma", "Arial"]
# Font size for display
FONT_SIZE = 22
# Month Vriable ID
MONTH_VARIABLE = 273
# Date information hash
DATE_MONTH_INFORMATION = {
# Month ID => [Month name, Days Variable ID]
1 => [ "January", 261],
2 => [ "February", 262],
3 => [ "March", 263],
4 => [ "April", 264],
5 => [ "May", 265],
6 => [ "June", 266],
7 => [ "July", 267],
8 => [ "August", 268],
9 => [ "September", 269],
10 => [ "October", 270],
11 => [ "November", 271],
12 => [ "December", 272],
}
# Day Variable ID
DAY_VARIABLE = 274
# Date day information
DATE_DAY_INFORMATION = {
1 => "Sunday",
2 => "Monday",
3 => "Tuesday",
4 => "Wednesday",
5 => "Thursday",
6 => "Friday",
7 => "Saturday",
}
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Set Display Date Position
# x : New display X coordinate
# y : New display Y coordinate
#--------------------------------------------------------------------------
def set_display_date_position(x, y)
# Set Date Display Positions
$game_map.date_display_x, $game_map.date_display_y = x, y
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Enable Date Display
#--------------------------------------------------------------------------
def enable_date_display
# Set Date Display Visibility to true
$game_map.date_display_visible = true
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Disable Date Display
#--------------------------------------------------------------------------
def disable_date_display
# Set Date Display Visibility to false
$game_map.date_display_visible = false
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Update Date Display
#--------------------------------------------------------------------------
def update_date_display
# Return if not on scene map
return if !$scene.is_a?(Scene_Map) or !$scene.is_a?(Scene_Common_Event_Menu)
# Update Date Display
$scene.update_date_display
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :date_display_x # date display X position
attr_accessor :date_display_y # date display Y position
attr_accessor :date_display_visible # date display visibility flag
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias tds_date_display_game_map_initialize initialize
def initialize
tds_date_display_game_map_initialize
@date_display_x = INITIAL_X_POSTION
@date_display_y = INITIAL_Y_POSTION
@date_display_visible = true
end
#--------------------------------------------------------------------------
# * Get Day of the Week Date Display
#--------------------------------------------------------------------------
def get_day_name_date_display
# Get Day Name
day = DATE_DAY_INFORMATION[$game_variables[DAY_VARIABLE]]
return day == nil ? "" : day
end
#--------------------------------------------------------------------------
# * Get Day Number Date Display
#--------------------------------------------------------------------------
def get_day_number_date_display
# Get Day Number
var = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
day = var == nil ? nil : $game_variables[var[1]]
return day == nil ? "" : day
end
#--------------------------------------------------------------------------
# * Get Day of the Week Date Display
#--------------------------------------------------------------------------
def get_month_date_display
# Get Month Name
month = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
return month == nil ? "" : month[0]
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs the map screen processing.
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
alias tds_date_display_scene_map_start start
def start
tds_date_display_scene_map_start
# Create Date Display Sprite
@date_display = Sprite.new
@date_display.bitmap = Bitmap.new(200, 200)
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Update Date Display
#--------------------------------------------------------------------------
def update_date_display
# Set visibility
@date_display.visible = $game_map.date_display_visible
# Set display positions
@date_display.x, @date_display.y = $game_map.date_display_x, $game_map.date_display_y
# Set Display Font
@date_display.bitmap.font.name = FONT_NAME
# Set Display font size
@date_display.bitmap.font.size = FONT_SIZE
# Clear Bitmap Contents
@date_display.bitmap.clear
# Draw Weekday
@date_display.bitmap.draw_text(0, 0, 190, FONT_SIZE + 6, $game_map.get_day_name_date_display, 1)
# Text for date display
text = sprintf("%s %s", $game_map.get_month_date_display, $game_map.get_day_number_date_display)
# Draw Month
@date_display.bitmap.draw_text(0, 28, 190, FONT_SIZE + 6, text, 1)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias tds_date_display_scene_map_terminate terminate
def terminate
tds_date_display_scene_map_terminate
# Dispose of date display sprite and bitmap
@date_display.bitmap.dispose
@date_display.dispose
end
end
#===============================================================================
# Scene_Common_Event_Menu
#===============================================================================
class Scene_Common_Event_Menu < Scene_Base
#--------------------------------------------------------------------------
# start
#-------------------------------------------------------------------------
alias tds_date_display_scene_common_event_menu_start start
def start
tds_date_display_scene_common_event_menu_start
# Create Date Display Sprite
@date_display = Sprite.new
@date_display.bitmap = Bitmap.new(200, 200)
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Update Date Display
#--------------------------------------------------------------------------
def update_date_display
# Set visibility
@date_display.visible = $game_map.date_display_visible
# Set display positions
@date_display.x, @date_display.y = $game_map.date_display_x, $game_map.date_display_y
# Set Display Font
@date_display.bitmap.font.name = FONT_NAME
# Set Display font size
@date_display.bitmap.font.size = FONT_SIZE
# Clear Bitmap Contents
@date_display.bitmap.clear
# Draw Weekday
@date_display.bitmap.draw_text(0, 0, 190, FONT_SIZE + 6, $game_map.get_day_name_date_display, 1)
# Text for date display
text = sprintf("%s %s", $game_map.get_month_date_display, $game_map.get_day_number_date_display)
# Draw Month
@date_display.bitmap.draw_text(0, 28, 190, FONT_SIZE + 6, text, 1)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias tds_date_display_scene_common_event_menu_terminate terminate
def terminate
tds_date_display_scene_common_event_menu_terminate
# Dispose of date display sprite and bitmap
@date_display.bitmap.dispose
@date_display.dispose
end
end
Thanks, it's appearing now, and sorry about that.
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fthebenevolent.net%2Fimghost%2Ffiles%2Fl78v7ecnvjh7cnfcn2.jpg&hash=f9b4618daf29280b63979838e2f8bf7b4a85b66b)[/spoiler]
But now, none of the script commands are working.
When I use the script command 'enable_date_display', it only appears after the common event menu has displayed, and the script commands for disabling, changing position and updating don't seem to work anymore.
This should fix it.
#------------------------------------------------------------------------------
# * Constants
#------------------------------------------------------------------------------
# Initial X Position
INITIAL_X_POSTION = 290
# Initial Y Position
INITIAL_Y_POSTION = 0
# Font names for display
FONT_NAME = ["Tahoma", "Arial"]
# Font size for display
FONT_SIZE = 22
# Month Vriable ID
MONTH_VARIABLE = 273
# Date information hash
DATE_MONTH_INFORMATION = {
# Month ID => [Month name, Days Variable ID]
1 => [ "January", 261],
2 => [ "February", 262],
3 => [ "March", 263],
4 => [ "April", 264],
5 => [ "May", 265],
6 => [ "June", 266],
7 => [ "July", 267],
8 => [ "August", 268],
9 => [ "September", 269],
10 => [ "October", 270],
11 => [ "November", 271],
12 => [ "December", 272],
}
# Day Variable ID
DAY_VARIABLE = 274
# Date day information
DATE_DAY_INFORMATION = {
1 => "Sunday",
2 => "Monday",
3 => "Tuesday",
4 => "Wednesday",
5 => "Thursday",
6 => "Friday",
7 => "Saturday",
}
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Set Display Date Position
# x : New display X coordinate
# y : New display Y coordinate
#--------------------------------------------------------------------------
def set_display_date_position(x, y)
# Set Date Display Positions
$game_map.date_display_x, $game_map.date_display_y = x, y
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Enable Date Display
#--------------------------------------------------------------------------
def enable_date_display
# Set Date Display Visibility to true
$game_map.date_display_visible = true
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Disable Date Display
#--------------------------------------------------------------------------
def disable_date_display
# Set Date Display Visibility to false
$game_map.date_display_visible = false
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Update Date Display
#--------------------------------------------------------------------------
def update_date_display
# Return if not on scene map or scene common event menu
if $scene.is_a?(Scene_Map) or $scene.is_a?(Scene_Common_Event_Menu)
# Update Date Display
$scene.update_date_display
end
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :date_display_x # date display X position
attr_accessor :date_display_y # date display Y position
attr_accessor :date_display_visible # date display visibility flag
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias tds_date_display_game_map_initialize initialize
def initialize
tds_date_display_game_map_initialize
@date_display_x = INITIAL_X_POSTION
@date_display_y = INITIAL_Y_POSTION
@date_display_visible = true
end
#--------------------------------------------------------------------------
# * Get Day of the Week Date Display
#--------------------------------------------------------------------------
def get_day_name_date_display
# Get Day Name
day = DATE_DAY_INFORMATION[$game_variables[DAY_VARIABLE]]
return day == nil ? "" : day
end
#--------------------------------------------------------------------------
# * Get Day Number Date Display
#--------------------------------------------------------------------------
def get_day_number_date_display
# Get Day Number
var = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
day = var == nil ? nil : $game_variables[var[1]]
return day == nil ? "" : day
end
#--------------------------------------------------------------------------
# * Get Day of the Week Date Display
#--------------------------------------------------------------------------
def get_month_date_display
# Get Month Name
month = DATE_MONTH_INFORMATION[$game_variables[MONTH_VARIABLE]]
return month == nil ? "" : month[0]
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs the map screen processing.
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
alias tds_date_display_scene_map_start start
def start
tds_date_display_scene_map_start
# Create Date Display Sprite
@date_display = Sprite.new
@date_display.bitmap = Bitmap.new(200, 200)
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Update Date Display
#--------------------------------------------------------------------------
def update_date_display
# Set visibility
@date_display.visible = $game_map.date_display_visible
# Set display positions
@date_display.x, @date_display.y = $game_map.date_display_x, $game_map.date_display_y
# Set Display Font
@date_display.bitmap.font.name = FONT_NAME
# Set Display font size
@date_display.bitmap.font.size = FONT_SIZE
# Clear Bitmap Contents
@date_display.bitmap.clear
# Draw Weekday
@date_display.bitmap.draw_text(0, 0, 190, FONT_SIZE + 6, $game_map.get_day_name_date_display, 1)
# Text for date display
text = sprintf("%s %s", $game_map.get_month_date_display, $game_map.get_day_number_date_display)
# Draw Month
@date_display.bitmap.draw_text(0, 28, 190, FONT_SIZE + 6, text, 1)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias tds_date_display_scene_map_terminate terminate
def terminate
tds_date_display_scene_map_terminate
# Dispose of date display sprite and bitmap
@date_display.bitmap.dispose
@date_display.dispose
end
end
#===============================================================================
# Scene_Common_Event_Menu
#===============================================================================
class Scene_Common_Event_Menu < Scene_Base
#--------------------------------------------------------------------------
# start
#-------------------------------------------------------------------------
alias tds_date_display_scene_common_event_menu_start start
def start
tds_date_display_scene_common_event_menu_start
# Create Date Display Sprite
@date_display = Sprite.new
@date_display.bitmap = Bitmap.new(200, 200)
# Update Date Display
update_date_display
end
#--------------------------------------------------------------------------
# * Update Date Display
#--------------------------------------------------------------------------
def update_date_display
# Set visibility
@date_display.visible = $game_map.date_display_visible
# Set display positions
@date_display.x, @date_display.y = $game_map.date_display_x, $game_map.date_display_y
# Set Display Font
@date_display.bitmap.font.name = FONT_NAME
# Set Display font size
@date_display.bitmap.font.size = FONT_SIZE
# Clear Bitmap Contents
@date_display.bitmap.clear
# Draw Weekday
@date_display.bitmap.draw_text(0, 0, 190, FONT_SIZE + 6, $game_map.get_day_name_date_display, 1)
# Text for date display
text = sprintf("%s %s", $game_map.get_month_date_display, $game_map.get_day_number_date_display)
# Draw Month
@date_display.bitmap.draw_text(0, 28, 190, FONT_SIZE + 6, text, 1)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias tds_date_display_scene_common_event_menu_terminate terminate
def terminate
tds_date_display_scene_common_event_menu_terminate
# Dispose of date display sprite and bitmap
@date_display.bitmap.dispose
@date_display.dispose
end
end
Awesome, everything is working great now! ^_^
Thank you very much! ^_^
I'm not sure you said if it does seasons, I don't think so. But would it be difficult add them in? If not I'd be extremely grateful. Thanks!
Sol.
Quote from: Solomonghull on April 17, 2012, 08:33:21 PM
I'm not sure you said if it does seasons, I don't think so. But would it be difficult add them in? If not I'd be extremely grateful. Thanks!
Sol.
Sol you might not need it anymore by the time you read this but i have this for you :)
http://www.rpgmakervx.net/index.php?showtopic=43374