Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin =========================================================================
- Dekita's v1.0
- ★ Real Time Menu Window™ ★
- ================================================================================
- Script Information:
- ====================
- This script is a simple script to show the current time in the main menu
- Place this below any script that heavily modifies Scene_Menu.
- ================================================================================
- ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- ================================================================================
- 1. You must give credit to "Dekita"
- 2. You are NOT allowed to repost this script.(or modified versions)
- 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
- 4. You are NOT allowed to use this script for Commercial games.
- 5. ENJOY!
- "FINE PRINT"
- By using this script you hereby agree to the above terms and conditions,
- if any violation of the above terms occurs "legal action" may be taken.
- Not understanding the above terms and conditions does NOT mean that
- they do not apply to you.
- If you wish to discuss the terms and conditions in further detail you can
- contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
- ================================================================================
- History:
- =========
- D /M /Y
- 15/12/2o12 - started and finished,
- ================================================================================
- Credit and Thanks to :
- =======================
- ================================================================================
- Known Bugs:
- ============
- N/A
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- If a new bug is found please contact me at
- http://dekitarpg.wordpress.com/
- ================================================================================
- INSTRUCTIONS:
- ==============
- Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
- =end #==========================================================================#
- module Dekita__Real_Time
- Time_Vocab = "Time"
- Time_Mode = 3
- # 0 = Hour : Minutes (12 hour clock)
- # 1 = Hour : minutes (24 hour clock)
- # 2 = Hour : Minutes : Seconds (12 hour clock)
- # 3 = Hour : Minutes : Seconds (24 hour clock)
- # NOTE : 12 hour clock will show am/pm.
- end
- $imported = {} if $imported.nil?
- $imported[:Dekita_RealTime_Menu_Window] = true
- #==============================================================================
- class Window_Game_Time < Window_Base
- #==============================================================================
- include Dekita__Real_Time
- def initialize
- super(0, 0, window_width, fitting_height(1))
- refresh
- get_time_settings
- end
- def get_time_settings
- tn = Time.now
- t1 = Time_Mode == 0 || 2 ? tn.strftime("%I") : tn.strftime("%H")
- @curr_time = [t1,tn.strftime("%M"),tn.strftime("%S")]
- end
- def window_width
- return $imported[:Dekita_Pokemon_Menu] ? 120 : 160
- end
- def refresh
- contents.clear
- draw_current_time(value, time_vocab, 0, 0, window_width - 24)
- end
- def draw_current_time(value, unit, x, y, width)
- contents.font.size = Pokemon_MENU::Font_Size - 2 if $imported[:Dekita_Pokemon_Menu]
- change_color(normal_color)
- draw_text(x, y, width, line_height, value, 2)
- change_color(system_color)
- draw_text(x, y, width, line_height, unit)
- end
- def value
- pm_am = Time.now.strftime("%p") == "PM" ? "pm" : "am"
- tn = Time.now
- case Time_Mode
- when 0
- time_text = "#{tn.strftime("%I")}:#{tn.strftime("%M")}#{pm_am}"
- when 1
- time_text = "#{tn.strftime("%H")}:#{tn.strftime("%M")}"
- when 2
- time_text = "#{tn.strftime("%I")}:#{tn.strftime("%M")}:#{tn.strftime("%S")}#{pm_am}"
- when 3
- time_text = "#{tn.strftime("%H")}:#{tn.strftime("%M")}:#{tn.strftime("%S")}"
- end
- return time_text
- end
- def time_vocab
- return Time_Vocab
- end
- def open
- refresh
- super
- end
- def update
- super
- update_time
- end
- def update_time
- case Time_Mode
- when 0, 1
- id = 0 ; val = Time.now.strftime("%M")
- when 2, 3
- id = 2 ; val = Time.now.strftime("%S")
- end
- refresh if @curr_time[id] != val
- end
- end
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #==============================================================================
- alias startdetime_now! start
- def start
- startdetime_now!
- create_REALTIME_window
- end
- def create_REALTIME_window
- gwh = Graphics.height - @gold_window.height
- @realtime_window = Window_Game_Time.new
- gww = Graphics.width - @realtime_window.width
- @realtime_window.x = $imported[:Dekita_Pokemon_Menu] ? gww : 0
- @realtime_window.y = $imported[:Dekita_Pokemon_Menu] ? gwh : gwh - @realtime_window.height
- end
- end
- #===============================================================================#
- # - SCRIPT END - #
- #===============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement