Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------------------------
- # Display Local Time v1.1
- #-- Shows the local time in a message box.
- #-- By mjshi
- #-------------------------------------------------------------------------------
- # Usage: In an event, create a new Script command (tab 3) and type in showTime
- # If you chose to store the message in a variable, type \V[id] in a dialogue
- # box to display the message.
- #-------------------------------------------------------------------------------
- # Installation: Put anywhere above Main.
- #-------------------------------------------------------------------------------
- module DisplayLocalTime
- #-----------------------------------------------------------------------------
- # **CONFIGURATION**
- #-----------------------------------------------------------------------------
- # Set to true for 24 hour time, false for 12 hour, AM/PM time
- Time24Hour = false
- #-----------------------------------------------------------------------------
- # What should be shown in-between hours and minutes?
- # Set to "" for something like military time (1200 hrs)
- Separator = ":"
- #-----------------------------------------------------------------------------
- # What should the message be?
- # %TIME will be replaced by something like
- # 11:00 PM
- # or, if you have Time24Hour = true
- # 23:00
- # Set this to just "%TIME" if you want just the time with no messages.
- Message = "It's %TIME."
- #-----------------------------------------------------------------------------
- # Store the message into a variable? Set to false to directly display the
- # message in a text box, or a variable ID to store it in that variable.
- StoreMessage = false
- #-----------------------------------------------------------------------------
- end
- def showTime
- time = Time.new
- if time.min < 10
- time_min = "0" + (time.min).to_s
- else
- time_min = (time.min).to_s
- end
- if not DisplayLocalTime::Time24Hour
- if time.hour >= 12
- t_hr = (time.hour - 12).to_s + DisplayLocalTime::Separator + time_min
- t_hr += " PM"
- else
- t_hr = (time.hour).to_s + DisplayLocalTime::Separator + time_min
- t_hr += " AM"
- end
- else
- t_hr = time.hour.to_s + DisplayLocalTime::Separator + time_min
- end
- if !DisplayLocalTime::StoreMessage
- $game_message.add(DisplayLocalTime::Message.gsub(/%TIME/, t_hr))
- else
- $game_variables[DisplayLocalTime::StoreMessage] = DisplayLocalTime::Message.gsub(/%TIME/, t_hr)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement