设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1824|回复: 9
打印 上一主题 下一主题

[已经解决] 时间的疑问

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
230 小时
注册时间
2014-2-16
帖子
175
跳转到指定楼层
1
发表于 2014-3-17 12:49:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 落月小天魔 于 2014-4-5 13:55 编辑

我正在做一个农场系统,种上植物之后要等待植物成熟,但是存档之后关闭游戏,下次打开,还是游戏里的时间,而我想调用系统的时间,以系统的时间做植物成熟的依据,这个要怎么做?@喵呜喵5 调用系统时间就像礼包系统这个的系统时间吧。

@Sion 求助......

点评

你直接用我这个礼包系统来判定不就好了  发表于 2014-3-17 20:21

Lv1.梦旅人

梦石
0
星屑
155
在线时间
129 小时
注册时间
2014-2-22
帖子
233
2
发表于 2014-3-17 12:54:49 | 只看该作者
你看看这个行不行(把75行改成true)
  1. #Advanced Game Time + Night/Day v1.4.2
  2. #----------#
  3. #Features: Provides a series of functions to set and recall current game time
  4. #          as well customizable tints based on current game time to give the
  5. #          appearance of night and day in an advanced and customizable way.
  6. #
  7. #Usage:   Script calls:
  8. #           GameTime.sec?                      #current second
  9. #           GameTime.min?                      #current minute
  10. #           GameTime.hour?                     #current hour
  11. #           GameTime.hour_nom?                 #current hour (12-hour)
  12. #           GameTime.day?                      #current day of month
  13. #           GameTime.day_week?                 #current day of the week
  14. #           GameTime.day_year?                 #current day of the year
  15. #           GameTime.month?                    #current month
  16. #           GameTime.year?                     #current year
  17. #           GameTime.year_post("set")          #changes the year post to set
  18. #           GameTime.pause_tint(true/false)    #pauses/unpauses tint
  19. #           GameTime.notime(true/false)        #stops time based on true/false
  20. #           GameTime.change(s,m,h,d,dw,mn,y)      #manually set the time
  21. #                                    seconds,minutes,hours,days,weekday,months,years
  22. #                                              any can be nil to not be changed
  23. #           GameTime.set("handle",n)           #increases a certain time portion
  24. #                                             valid arguments are:
  25. #                                               addsec,addmin,addhour,addday
  26. #                                               addmonth,addyear
  27. #                                             and:
  28. #                                               remsec,remmin,remhour,remday
  29. #                                               remmonth,remyear
  30. #           GameTime.clock?(true/false)        #hides/shows the clock
  31. #           GameTime.save_time                 #saves the current time
  32. #           GameTime.load_time                 #loads the saved time
  33. #
  34. #         Message Codes:
  35. #           GTSEC    #Inputs the current second
  36. #           GTMIN    #Inputs the current minute
  37. #           GTHOUR   #Inputs the current hour
  38. #           GTDAYN   #Inputs the day of the month
  39. #           GTDAYF   #Inputs the day of the week (full)
  40. #           GTDAYA   #Inputs the day of the week (abbreviated)
  41. #           GTMONN   #Inputs the month of the year
  42. #           GTMONF   #Inputs the name of the month (full)
  43. #           GTMONA   #Inputs the name of the month (abbreviated)
  44. #           GTYEAR   #Inputs the current year
  45. #
  46. #         Map Note Tags: (These go in the note box of Map Properties)
  47. #           Notint   #These maps will not tint!
  48. #           Notime   #Stops time from moving in that map
  49. #        
  50. #Customization: Set below, in comments.
  51. #
  52. #Examples: GameTime.pause_tint = false
  53. #          GameTime.change(nil,30,4,1,1,1,2012)
  54. #          GameTime.set("addyear",5)
  55. #          GameTime.clock?(true)
  56. #
  57. #----------#
  58. #-- Script by: V.M of D.T
  59. #
  60. #- Questions or comments can be:
  61. #    posted on the thread for the script
  62. #    given by email: [email protected]
  63. #    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
  64. #    posed on site: daimonioustails.wordpress.com
  65. #
  66. #--- Free to use in any non-commercial project with credit given
  67. #-- License required for commercial project use

  68. #_# BEGIN_CUSTOMIZATION #_#


  69. #What time a new game starts at: [sec, min, hour, day, month, year]
  70. START_TIME = [0,0,0,16,10,1746]
  71. #Wether or not to set time to PC (Real) Time
  72. USE_REAL_TIME = false
  73. #Time does not increase while the message window is visible:
  74. NOTIMEMESSAGE = false
  75. #Time does not increase unless you are on the map
  76. PAUSE_IN_MENUS = true
  77. #Time does not increase if you are in battle
  78. NOBATTLETIME = false
  79. #Clock is shown
  80. USECLOCK = true
  81. #Set to true to have the clock show up in the menu!
  82. USECLOCK_MENU = true
  83. #Set the format for the clock both in and out of menu
  84. #1. hh:mm am/pm
  85. #2. Sun dd hh:mm am/pm
  86. #3. hh:mm        (24 hour clock)
  87. #4. Sun dd hh:mm (24 hour clock)
  88. #5. Custom clock, see below
  89. CLOCK_FORMAT = 5
  90. MENU_CLOCK_FORMAT = 5
  91. #Clock window background opacity
  92. CLOCK_BACK = 128
  93. #Button to be used to toggle the clock
  94. CLOCK_TOGGLE = :SHIFT
  95. #X and Y position of clock
  96. CLOCK_X = 0
  97. CLOCK_Y = 0
  98. #Finetune the width of the clock window here:
  99. CLOCK_WIDTH = 175
  100. #Whether or not those little dots on the clock blink
  101. USE_BLINK = true
  102. #The speed at which they blink
  103. BLINK_SPEED = 120
  104. #Here is where you would insert the array of commands for the custom clock:
  105. CUSTOM_CLOCK = ["weekshort"," ","day"," ","year","yearp"]
  106. CUSTOM_CLOCK2 = ["hour","blinky","min"," ","meri"]
  107. #Available commands for CUSTOM_CLOCK:
  108. # "sec" - seconds         "min" - minutes
  109. # "hour" - hour (24)      "hour12" - hour (12)
  110. # "meri" - AM/PM          "day" - day of the month
  111. # "weekshort" - day of the week abbr
  112. # "weeklong" - day of the week long
  113. # "month" - month         "monthshort" - month name abbr
  114. # "monthlong" - month name
  115. # "year" - year           "yearp" - year post
  116. # "blinky" - those blinky dots


  117. #Using KHAS lighting effects script? Turn this on to use that tint
  118. USE_KHAS = true
  119. #Using Victor Engine Light effects? Turn this on to use that tint
  120. USE_VICTOR = true
  121. #Variables that count down each gametime second/minute
  122. TIMER_VARIABLES = []

  123. #Use Tint in the Battles
  124. BATTLE_TINT = false

  125. #Time it takes for a second (or minute) to pass, in frames by default
  126. #(Frame rate is 60 frames per second)
  127. DEFAULT_TIMELAPSE = 45
  128. #Variable ID containing the current speed of time!
  129. TIMELAPSE_VARIABLE = 80
  130. #Whether to use seconds or not
  131. NOSECONDS = true
  132. #Number of seconds in a minute
  133. SECONDSINMIN = 60
  134. #Number of minutes in an hour
  135. MINUTESINHOUR = 60
  136. #Number of hours in a day
  137. HOURSINDAY = 24
  138. #Names of the days (As little or as many days in the week as you want)
  139. DAYNAMES = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
  140. #Day name abbreviations
  141. DAYNAMESABBR = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]
  142. #Number of days in each month (Also represents number of months in a year)
  143. MONTHS = [31,28,31,30,31,30,31,31,30,31,30,31]
  144. #Names of the months
  145. MONTHNAMES = ["January","February","March","April","May","June",
  146.               "July","August","September","October","November","December"]
  147. #Abrreviated names of the months
  148. MONTHNAMESABBR = ["Jan","Feb","Mar","Apr","May","Jun",
  149.                   "Jul","Aug","Sep","Oct","Nov","Dec"]
  150. #The default letters to be posted before the year in dates
  151. DEFAULT_YEAR_POST = "VCX"
  152. #NOT YET IMPLEMENTED *IGNORE*
  153. USE_PERIODS = true
  154.                  
  155. #Gradual tint effects! (The hardest part)
  156. #It may look daunting, and it is, but here is where you put the tint
  157. #to be shown at each hour (the actual tint is usually somewhere in between)
  158. #The number of Color.new objects here must equal the number of hours in a day
  159. #Starts from hour 0 (or 12am)
  160. #A color object is -> Color.new(r,g,b,a)
  161. # Where r is red,g is green,b is blue,and a is opacity and all are (0-255)
  162. TINTS = [Color.new(30,0,40,155),
  163.          Color.new(20,0,30,135),
  164.          Color.new(20,0,30,135),
  165.          Color.new(10,0,30,135),
  166.          Color.new(10,0,20,125),
  167.          Color.new(0,0,20,125),
  168.          Color.new(80,20,20,125),
  169.          Color.new(130,40,10,105),
  170.          Color.new(80,20,10,85),
  171.          Color.new(0,0,0,65),
  172.          Color.new(0,0,0,35),
  173.          Color.new(0,0,0,15),
  174.          Color.new(0,0,0,0),
  175.          Color.new(0,0,0,0),
  176.          Color.new(0,0,0,5),
  177.          Color.new(0,0,0,15),
  178.          Color.new(0,0,0,25),
  179.          Color.new(0,0,10,55),
  180.          Color.new(80,20,20,85),
  181.          Color.new(130,40,30,105),
  182.          Color.new(80,20,40,125),
  183.          Color.new(10,0,50,135),
  184.          Color.new(20,0,60,135),
  185.          Color.new(30,0,70,155)]

  186. #NOT YET IMPLEMENTED *IGNORE*
  187. PERIODS = [["Night",0,5],
  188.            ["Morning",6,11],
  189.            ["Afternoon",12,17],
  190.            ["Evening",18,23]]
  191.          
  192. $gametimeclockvisible = true
  193. #_# END CUSTOMIZATION #_#
  194.          
  195. module GameTime
  196.   def self.run
  197.     $game_time = Current_Time.new
  198.     $game_time_tint = Sprite_TimeTint.new
  199.   end
  200.   def self.update
  201.     return if $game_message.busy? and NOTIMEMESSAGE
  202.     if !SceneManager.scene.is_a?(Scene_Map) and PAUSE_IN_MENUS
  203.       return $game_time_tint.update if SceneManager.scene.is_a?(Scene_Title)
  204.       return $game_time_tint.update if SceneManager.scene.is_a?(Scene_File)
  205.       return unless SceneManager.scene.is_a?(Scene_Battle) and !NOBATTLETIME
  206.     end
  207.     $game_time.update
  208.     $game_time_tint = Sprite_TimeTint.new if $game_time_tint.disposed?
  209.     update_tint
  210.   end
  211.   def self.update_tint
  212.     $game_time_tint.update unless @pause_tint
  213.   end
  214.   def self.sec?
  215.     return $game_time.sec
  216.   end
  217.   def self.min?
  218.     return $game_time.min
  219.   end
  220.   def self.hour?
  221.     return $game_time.hour
  222.   end
  223.   def self.hour_nom?
  224.     hour = $game_time.hour
  225.     hour -= 12 if hour > 11
  226.     hour = 12 if hour == 0
  227.     return hour
  228.   end
  229.   def self.day?
  230.     return $game_time.day if USE_REAL_TIME
  231.     return $game_time.day + 1
  232.   end
  233.   def self.day_week?
  234.     return $game_time.dayweek
  235.   end
  236.   def self.day_year?
  237.     month = month? - 1
  238.     day = day?
  239.     while month > 0
  240.       day += MONTHS[month]
  241.       month -= 1
  242.     end
  243.     day
  244.   end
  245.   def self.day_name
  246.     return DAYNAMES[$game_time.dayweek-1] if USE_REAL_TIME
  247.     return DAYNAMES[$game_time.dayweek]
  248.   end
  249.   def self.day_name_abbr
  250.     return DAYNAMESABBR[$game_time.dayweek-1] if USE_REAL_TIME
  251.     return DAYNAMESABBR[$game_time.dayweek]
  252.   end
  253.   def self.month_name_abbr
  254.     return MONTHNAMESABBR[$game_time.month-1] if USE_REAL_TIME
  255.     return MONTHNAMESABBR[$game_time.month]
  256.   end
  257.   def self.month?
  258.     return $game_time.month if USE_REAL_TIME
  259.     return $game_time.month + 1
  260.   end
  261.   def self.month_name
  262.     return MONTHNAMES[$game_time.month-1] if USE_REAL_TIME
  263.     return MONTHNAMES[$game_time.month]
  264.   end
  265.   def self.year?
  266.     return $game_time.year
  267.   end
  268.   def self.pause_tint(set)
  269.     @pause_tint = set
  270.   end
  271.   def self.change(s = nil,m = nil,h = nil,d = nil,dw = nil, mn = nil,y = nil)
  272.     $game_time.manual(s,m,h,d,dw,mn,y)
  273.   end
  274.   def self.set(handle,n)
  275.     $game_time.forward(handle,n)
  276.   end
  277.   def self.clock?(set)
  278.     SceneManager.scene.clock_visible?(set)
  279.   end
  280.   def self.year_post(set)
  281.     $game_time.year_post = set
  282.   end
  283.   def self.save_time
  284.     $saved_game_time = $game_time.dup
  285.   end
  286.   def self.load_time
  287.     $game_time = $saved_game_time.dup
  288.   end
  289.   def self.no_time_map
  290.     note = $game_map.map_note
  291.     /Notime/ =~ note
  292.     return false unless $~
  293.     return true
  294.   end
  295.   def self.notime(set)
  296.     $game_time.notime = set
  297.   end

  298.   class Current_Time
  299.    
  300.     attr_reader     :sec
  301.     attr_reader     :min
  302.     attr_reader     :hour
  303.     attr_reader     :day
  304.     attr_reader     :dayweek
  305.     attr_reader     :month
  306.     attr_reader     :year
  307.     attr_accessor   :year_post
  308.     attr_accessor   :notime
  309.    
  310.     def initialize
  311.       reset_all_values
  312.     end
  313.     def reset_all_values
  314.       @sec = START_TIME[0]
  315.       [url=home.php?mod=space&uid=25749]@min[/url] = START_TIME[1]
  316.       @hour = START_TIME[2]
  317.       [url=home.php?mod=space&uid=11519]@day[/url] = START_TIME[3]
  318.       @dayweek = 0
  319.       [url=home.php?mod=space&uid=26122]@Month[/url] = START_TIME[4]
  320.       @year = START_TIME[5]
  321.       @notime = false
  322.       @year_post = DEFAULT_YEAR_POST
  323.     end
  324.     def update
  325.       if @hour == 0 && @min== 10  #12:10 启动公共事件8
  326.       $game_temp.reserve_common_event(8)
  327.       end
  328.       return realtime if USE_REAL_TIME
  329.       return if GameTime.no_time_map or @notime
  330.       $game_variables[TIMELAPSE_VARIABLE] = DEFAULT_TIMELAPSE if $game_variables[TIMELAPSE_VARIABLE] <= 0
  331.       return unless Graphics.frame_count % $game_variables[TIMELAPSE_VARIABLE] == 0
  332.       NOSECONDS ? addmin(1) : addsec(1)
  333.       update_timers
  334.     end
  335.     def update_timers
  336.       return unless TIMER_VARIABLES.size > 0
  337.       for i in TIMER_VARIABLES
  338.         $game_variables[i] -= 1 unless $game_variables[i] == 0
  339.       end
  340.     end
  341.     def realtime
  342.       @sec = Time.now.sec
  343.       @sec = 0 if @sec == 60
  344.       @min = Time.now.min
  345.       @hour = Time.now.hour
  346.       @day = Time.now.day
  347.       @dayweek = Time.now.wday
  348.       @month = Time.now.month
  349.       @year = Time.now.year
  350.       0
  351.     end
  352.     def addsec(s)
  353.       @sec += s
  354.       return unless @sec == SECONDSINMIN
  355.       @sec = 0
  356.       addmin(1)
  357.     end
  358.     def addmin(m)
  359.       @min += m
  360.       return unless @min == MINUTESINHOUR
  361.       @min = 0
  362.       addhour(1)
  363.     end
  364.     def addhour(h)
  365.       @hour += h
  366.       return unless @hour == HOURSINDAY
  367.       @hour = 0
  368.       addday(1)
  369.     end
  370.     def addday(d)
  371.       @day += d
  372.       @dayweek += d
  373.       @dayweek = 0 if @dayweek == DAYNAMES.size
  374.       return unless @day == MONTHS[@month]
  375.       @day = 0
  376.       addmonth(1)
  377.     end
  378.     def addmonth(mn)
  379.       @month += mn
  380.       return unless @month == MONTHS.size
  381.       @month = 0
  382.       addyear(1)
  383.     end
  384.     def addyear(y)
  385.       @year += y
  386.     end
  387.     def manual(s = nil,m = nil,h = nil,d = nil,dw = nil,mn = nil,y = nil)
  388.       @sec = s if !s.nil?
  389.       @sec = SECONDSINMIN - 1 if @sec >= SECONDSINMIN
  390.       @min = m if !m.nil?
  391.       @min = MINUTESINHOUR - 1 if @min >= MINUTESINHOUR
  392.       @hour = h if !h.nil?
  393.       @hour = HOURSINDAY - 1 if @hour >= HOURSINDAY
  394.       @day = d if !d.nil?
  395.       @day = MONTHS[@month] - 1 if @day >= MONTHS[@month]
  396.       @dayweek = dw if !dw.nil?
  397.       @dayweek = 0 if @dayweek >= DAYNAMES.size
  398.       @month = mn if !mn.nil?
  399.       @month = MONTHS.size - 1 if @month >= MONTHS.size
  400.       @year = y if !y.nil?
  401.     end
  402.     def forward(handle,n)
  403.       handle = handle.to_s + "(1)"
  404.       n.times do |s| eval(handle) end
  405.     end
  406.     def remsec(s)
  407.       @sec -= s
  408.       return unless @sec == -1
  409.       @sec = SECONDSINMIN
  410.       remmin(1)
  411.     end
  412.     def remmin(m)
  413.       @min -= m
  414.       return unless @min == -1
  415.       @min = MINUTESINHOUR
  416.       remhour(1)
  417.     end
  418.     def remhour(h)
  419.       @hour -= h
  420.       return unless @hour == -1
  421.       @hour = HOURSINDAY - 1
  422.       remday(1)
  423.     end
  424.     def remday(d)
  425.       @day -= d
  426.       @dayweek -= d
  427.       @dayweek = DAYNAMES.size - 1 if @dayweek == -1
  428.       return unless @day == -1
  429.       @day = MONTHS[@month] - 1
  430.       remmonth(1)
  431.     end
  432.     def remmonth(mn)
  433.       @month -= mn
  434.       return unless @month == -1
  435.       @month = MONTHS.size - 1
  436.       remyear(1)
  437.     end
  438.     def remyear(y)
  439.       @year -= y
  440.     end
  441.   end

  442.   class Sprite_TimeTint < Sprite_Base
  443.     def initialize(viewport = nil)
  444.       super(viewport)
  445.       self.z = 1
  446.       create_contents
  447.       update
  448.       @old_tint = [0,0,0,0]
  449.       @old_time = 0
  450.     end
  451.     def create_contents
  452.       self.bitmap = Bitmap.new(Graphics.width,Graphics.height)
  453.       self.visible = false
  454.     end
  455.     def update
  456.       return use_default if SceneManager.scene.is_a?(Scene_Battle) and BATTLE_TINT
  457.       return use_khas if USE_KHAS
  458.       return use_victor if USE_VICTOR
  459.       return use_default
  460.     end
  461.     def use_default
  462.       return if self.disposed?
  463.       create_contents if self.bitmap.height != Graphics.height
  464.       create_contents if self.bitmap.width != Graphics.width
  465.       self.visible = SceneManager.scene.is_a?(Scene_Map)
  466.       self.visible = true if SceneManager.scene.is_a?(Scene_Battle) and BATTLE_TINT
  467.       self.visible = false if SceneManager.scene.is_a?(Scene_Title)
  468.       self.visible = false if no_tint
  469.       self.bitmap.clear if no_tint
  470.       return unless self.visible
  471.       min = $game_time.min
  472.       return if min == @old_time
  473.       @old_time = min
  474.       rgba = get_new_tint(min)
  475.       return if rgba == @old_tint
  476.       @old_tint = rgba
  477.       self.bitmap.clear
  478.       self.bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(rgba[0],rgba[1],rgba[2],rgba[3]))
  479.     end
  480.     def use_khas      
  481.       begin
  482.       temp = $game_map.light_surface.opacity
  483.       rescue
  484.       return
  485.       end
  486.       self.visible = false
  487.       $game_map.effect_surface.change_color(1,0,0,0,0) if no_tint
  488.       return if no_tint
  489.       min = $game_time.min
  490.       return if min == @old_time
  491.       @old_time = min
  492.       rgba = get_new_tint(min)
  493.       return if rgba == @old_tint
  494.       @old_tint = rgba
  495.       $game_map.effect_surface.change_color(1,rgba[0],rgba[1],rgba[2],rgba[3])
  496.     end
  497.     def no_tint
  498.       return if $game_map.nil?
  499.       note = $game_map.map_note
  500.       /Notint/ =~ note
  501.       return false unless $~
  502.       return true
  503.     end
  504.     def use_victor
  505.       return if $game_map.nil?
  506.       self.visible = false
  507.       $game_map.screen.shade.change_color(0,0,0,0) if no_tint
  508.       $game_map.screen.shade.change_opacity(0) if no_tint
  509.       return if no_tint
  510.       $game_map.screen.shade.show if !$game_map.screen.shade.visible
  511.       min = $game_time.min
  512.       return if min == @old_time
  513.       @old_time = min
  514.       rgba = get_new_tint(min)
  515.       return if rgba == @old_tint
  516.       @old_tint = rgba
  517.       $game_map.screen.shade.change_color(rgba[0],rgba[1],rgba[2],0)
  518.       $game_map.screen.shade.change_opacity(rgba[3],0)
  519.     end
  520.     def get_new_tint(min)
  521.       ctint = TINTS[$game_time.hour]
  522.       ntint = TINTS[$game_time.hour + 1] unless $game_time.hour + 1 == HOURSINDAY
  523.       ntint = TINTS[0] if $game_time.hour + 1 == HOURSINDAY
  524.       r = ctint.red.to_f - ((ctint.red.to_f - ntint.red) * (min.to_f / MINUTESINHOUR))
  525.       g = ctint.green.to_f - ((ctint.green.to_f - ntint.green) * (min.to_f / MINUTESINHOUR))
  526.       b = ctint.blue.to_f - ((ctint.blue.to_f - ntint.blue) * (min.to_f / MINUTESINHOUR))
  527.       a = ctint.alpha.to_f - ((ctint.alpha.to_f - ntint.alpha) * (min.to_f / MINUTESINHOUR))
  528.       return [r,g,b,a]
  529.     end
  530.   end

  531.   class Window_GameClock < Window_Base
  532.     def initialize
  533.       super(CLOCK_X,CLOCK_Y,CLOCK_WIDTH,clock_height)
  534.       self.opacity = CLOCK_BACK unless SceneManager.scene.is_a?(Scene_Menu)
  535.       update
  536.       self.visible = $gametimeclockvisible unless SceneManager.scene.is_a?(Scene_Menu)
  537.     end
  538.     def clock_height
  539.       return 80 if !CUSTOM_CLOCK2.nil? and CLOCK_FORMAT == 5 and SceneManager.scene.is_a?(Scene_Map)
  540.       return 80 if !CUSTOM_CLOCK2.nil? and MENU_CLOCK_FORMAT == 5 and SceneManager.scene.is_a?(Scene_Menu)
  541.       return 56
  542.     end
  543.     def update
  544.       if NOSECONDS && @set_minute == $game_time.min
  545.         if Graphics.frame_count % BLINK_SPEED / 2 == 0 && USE_BLINK
  546.           return
  547.         end
  548.       end
  549.       contents.clear
  550.       @set_minute = $game_time.min if NOSECONDS
  551.       if SceneManager.scene.is_a?(Scene_Map)
  552.         v = CLOCK_FORMAT
  553.       else
  554.         v = MENU_CLOCK_FORMAT
  555.       end
  556.       string = normal_clock if v == 1
  557.       string = dated_clock if v == 2
  558.       string = military_clock if v == 3
  559.       string = dated_military_clock if v == 4
  560.       string = custom(CUSTOM_CLOCK) if v == 5
  561.       string2 = custom(CUSTOM_CLOCK2) if !CUSTOM_CLOCK2.nil? and v == 5
  562.       contents.draw_text(0,0,contents.width,24,string,1)
  563.       contents.draw_text(0,24,contents.width,24,string2,1) if !CUSTOM_CLOCK2.nil? and v == 5
  564.     end
  565.     def military_clock
  566.       hour = $game_time.hour
  567.       minute = $game_time.min
  568.       if hour < 10 then hour = " " + hour.to_s else hour.to_s end
  569.       if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
  570.       string =  hour.to_s + blinky + minute.to_s
  571.       return string
  572.     end
  573.     def dated_military_clock
  574.       hour = $game_time.hour
  575.       minute = $game_time.min
  576.       dayweek = DAYNAMESABBR[$game_time.dayweek]
  577.       day = $game_time.day
  578.       day += 1 unless USE_REAL_TIME
  579.       if hour < 10 then hour = " " + hour.to_s else hour.to_s end
  580.       if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
  581.       if day < 10 then day = " " + day.to_s end
  582.       string = dayweek.to_s + " " + day.to_s + " "
  583.       string += hour.to_s + blinky + minute.to_s
  584.       return string
  585.     end
  586.     def normal_clock
  587.       meri = "AM"
  588.       hour = $game_time.hour
  589.       minute = $game_time.min
  590.       if hour > 11 then meri = "PM" end
  591.       if hour == 0 then hour = 12; meri = "AM" end
  592.       if hour > 12 then hour -= 12 end
  593.       if hour < 10 then hour = " " + hour.to_s else hour.to_s end
  594.       if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
  595.       string =  hour.to_s + blinky + minute.to_s + " " + meri
  596.       return string
  597.     end
  598.     def dated_clock
  599.       meri = "AM"
  600.       hour = $game_time.hour
  601.       minute = $game_time.min
  602.       dayweek = DAYNAMESABBR[$game_time.dayweek]
  603.       day = $game_time.day
  604.       day += 1 unless USE_REAL_TIME
  605.       if hour > 11 then meri = "PM" end
  606.       if hour == 0 then hour = 12; meri = "AM" end
  607.       if hour > 12 then hour -= 12 end
  608.       if hour < 10 then hour = " " + hour.to_s else hour.to_s end
  609.       if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
  610.       if day < 10 then day = " " + day.to_s end
  611.       string = dayweek.to_s + " " + day.to_s + " "
  612.       string += hour.to_s + blinky + minute.to_s + " " + meri
  613.       return string
  614.     end
  615.     def blinky
  616.       return ":" unless USE_BLINK
  617.       return " " if Graphics.frame_count % BLINK_SPEED > (BLINK_SPEED / 2)
  618.       return ":"
  619.     end
  620.     def custom(array)
  621.       string = ""
  622.       for command in array
  623.         case command
  624.         when "sec"
  625.           sec = $game_time.sec
  626.           sec = "0" + sec.to_s if sec < 10
  627.           string += sec.to_s
  628.         when "min"
  629.           minute = $game_time.min
  630.           minute = "0" + minute.to_s if minute < 10
  631.           string += minute.to_s
  632.         when "hour"
  633.           hour = $game_time.hour
  634.           hour >= 12 ? meri = "PM" : meri = "AM"
  635.           hour = " " + hour.to_s if hour < 10
  636.           string += hour.to_s
  637.         when "hour12"
  638.           hour12 = $game_time.hour
  639.           hour12 -= 12 if hour12 > 12
  640.           hour12 = 12 if hour12 == 0
  641.           string += hour12.to_s
  642.         when "meri"
  643.           string += meri.to_s
  644.         when "weekshort"
  645.           dayweek = DAYNAMESABBR[$game_time.dayweek]
  646.           string += dayweek.to_s
  647.         when "weeklong"
  648.           dayweekn = DAYNAMES[$game_time.dayweek]
  649.           string += dayweekn.to_s
  650.         when "day"
  651.           day = $game_time.day
  652.           day += 1 unless USE_REAL_TIME
  653.           string += day.to_s
  654.         when "month"
  655.           month = $game_time.month
  656.           month += 1 unless USE_REAL_TIME
  657.           string += month.to_s
  658.         when "monthshort"
  659.           monthna = MONTHNAMESABBR[$game_time.month]
  660.           string += monthna.to_s
  661.         when "monthlong"
  662.           monthn = MONTHNAMES[$game_time.month]
  663.           string += monthn.to_s
  664.         when "year"
  665.           year = $game_time.year
  666.           string += year.to_s
  667.         when "yearp"
  668.           string += $game_time.year_post
  669.         when "blinky"
  670.           string += blinky
  671.         else
  672.           string += command.to_s
  673.         end
  674.       end
  675.       return string
  676.     end
  677.   end

  678. end

  679. GameTime.run

  680. class Window_Base < Window
  681.   alias real_time_convert_escape_characters convert_escape_characters
  682.   def convert_escape_characters(text)
  683.     result = real_time_convert_escape_characters(text)
  684.     result.gsub!(/GTSEC/) { GameTime.sec? }
  685.     result.gsub!(/GTMIN/) { GameTime.min? }
  686.     result.gsub!(/GTHOUR/) { GameTime.hour? }
  687.     result.gsub!(/GTDAYN/) { GameTime.day? }
  688.     result.gsub!(/GTDAYF/) { GameTime.day_name }
  689.     result.gsub!(/GTDAYA/) { GameTime.day_name_abbr }
  690.     result.gsub!(/GTMONF/) { GameTime.month? }
  691.     result.gsub!(/GTMONN/) { GameTime.month_name }
  692.     result.gsub!(/GTMONA/) { GameTime.month_name_abbr }
  693.     result.gsub!(/GTYEAR/) { GameTime.year? }
  694.     result
  695.   end
  696. end

  697. class Scene_Base
  698.   alias game_time_update update
  699.   def update
  700.     game_time_update
  701.     GameTime.update
  702.   end
  703. end

  704. class Scene_Map
  705.   alias game_time_post_transfer post_transfer
  706.   alias game_time_init create_all_windows
  707.   alias game_time_map_update update
  708.   alias game_time_start start
  709.   def start
  710.     game_time_start
  711.     GameTime.update_tint
  712.   end
  713.   def create_all_windows
  714.     game_time_init
  715.     @gametimeclock = GameTime::Window_GameClock.new if USECLOCK
  716.   end
  717.   def post_transfer
  718.     GameTime.update_tint
  719.     game_time_post_transfer
  720.   end
  721.   def update
  722.     game_time_map_update
  723.     return unless USECLOCK
  724.     @gametimeclock.update unless SceneManager.scene != self
  725.     if Input.trigger?(CLOCK_TOGGLE) and @gametimeclock.nil? == false
  726.       @gametimeclock.visible ? @gametimeclock.visible = false : @gametimeclock.visible = true
  727.       $gametimeclockvisible = @gametimeclock.visible
  728.     end
  729.   end
  730.   def clock_visible?(set)
  731.     @gametimeclock.visible = set
  732.   end
  733.   def update_encounter
  734.     if $game_player.encounter
  735.       $game_time_tint.use_default
  736.       SceneManager.call(Scene_Battle)
  737.     end
  738.   end
  739. end

  740. class Game_Map
  741.   def map_note
  742.     return @map.note unless @map.nil?
  743.   end
  744. end

  745. class Scene_Menu
  746.   alias gt_start start
  747.   alias gt_update update
  748.   def start
  749.     gt_start
  750.     [url=home.php?mod=space&uid=434406]@clock[/url] = GameTime::Window_GameClock.new if USECLOCK_MENU
  751.     return if @clock.nil?
  752.     @clock.x = 0
  753.     @clock.y = @gold_window.y - @clock.height
  754.     @clock.width = @gold_window.width
  755.     @clock.create_contents
  756.   end
  757.   def update
  758.     gt_update
  759.     @clock.update unless @clock.nil?
  760.     @clock.contents.clear if SceneManager.scene != self and [email protected]?
  761.   end
  762. end

  763. class Scene_Battle
  764.   def pre_terminate
  765.     super
  766.     Graphics.fadeout(30) if SceneManager.scene_is?(Scene_Map)
  767.     Graphics.fadeout(60) if SceneManager.scene_is?(Scene_Title)
  768.     $game_time_tint.update
  769.   end
  770. end

  771. module DataManager
  772.   class << self
  773.   alias gametime_msc make_save_contents
  774.   alias gametime_esc extract_save_contents
  775.   alias gametime_sng setup_new_game
  776.   end
  777.   def self.make_save_contents
  778.     contents = gametime_msc
  779.     contents[:gametime] = $game_time
  780.     contents
  781.   end
  782.   def self.extract_save_contents(contents)
  783.     gametime_esc(contents)
  784.     $game_time = contents[:gametime]
  785.   end
  786.   def self.setup_new_game
  787.     gametime_sng
  788.     $game_time = GameTime::Current_Time.new
  789.   end
  790. end
复制代码

点评

脚本324行错误syntaxError  发表于 2014-3-17 12:57
很多年了呢,坑还是没填完…………(草
回复 支持 反对

使用道具 举报

Lv2.观梦者 (暗夜天使)

梦石
0
星屑
266
在线时间
2355 小时
注册时间
2009-3-13
帖子
2309

贵宾

3
发表于 2014-3-17 13:52:02 | 只看该作者
搜索 Ruby Time。

点评

搜到了怎么写脚本,可是看不懂...  发表于 2014-3-17 18:44
回复 支持 反对

使用道具 举报

david_ng223 该用户已被删除
4
发表于 2014-3-17 19:42:54 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者 (暗夜天使)

梦石
0
星屑
266
在线时间
2355 小时
注册时间
2009-3-13
帖子
2309

贵宾

5
发表于 2014-3-17 19:48:14 | 只看该作者
本帖最后由 Sion 于 2014-3-17 19:49 编辑

你要是想好好做,就不要去到处找脚本用着玩。静下心来去学点有用的东西。

点评

现在我有上面的系统时间脚本了,只是不知道怎么来判断是不是到了时间而已,而且现在我Ruby代码才刚学完变量那里。  发表于 2014-3-17 20:01

评分

参与人数 1星屑 +100 收起 理由
喵呜喵5 + 100 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
230 小时
注册时间
2014-2-16
帖子
175
6
 楼主| 发表于 2014-3-17 20:30:39 | 只看该作者
本帖最后由 落月小天魔 于 2014-3-17 20:59 编辑

@喵呜喵5  @喵呜喵5 明白了,十分感谢,脑子没转过弯来。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
230 小时
注册时间
2014-2-16
帖子
175
7
 楼主| 发表于 2014-3-17 21:03:59 | 只看该作者
本帖最后由 落月小天魔 于 2014-3-17 21:09 编辑

@喵呜喵5 新的疑问又来了,使用这个脚本的话,判断就只能判断一棵植物,再加另一棵植物就不行了。
要怎么判断多个呢?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
155
在线时间
129 小时
注册时间
2014-2-22
帖子
233
8
发表于 2014-3-18 12:20:17 | 只看该作者
落月小天魔 发表于 2014-3-17 21:03
@喵呜喵5 新的疑问又来了,使用这个脚本的话,判断就只能判断一棵植物,再加另一棵植物就不行了。
要怎么判 ...

我觉得可以考虑用变量来判断,也就是说吧种下的时间记录下来,用脚本来判定,这个理论上应该可行

点评

没看懂意思,可以发个范例吗?  发表于 2014-3-18 12:41
def update if @hour == 0 && @min== 10 #12:10 启动公共事件8 $game_temp.reserve_common_event(8) end 参考这个吧,其中0和10应该可以用变量代替 @sion 教我的   发表于 2014-3-18 12:24
要怎么使用脚本来判定呢?  发表于 2014-3-18 12:21
很多年了呢,坑还是没填完…………(草
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
155
在线时间
129 小时
注册时间
2014-2-22
帖子
233
9
发表于 2014-3-18 12:44:35 | 只看该作者
1003492579 发表于 2014-3-18 12:20
我觉得可以考虑用变量来判断,也就是说吧种下的时间记录下来,用脚本来判定,这个理论上应该可行 ...

额…………我先试着做一个,因为准备月考了,时间不太够。还是艾特sion比较好
很多年了呢,坑还是没填完…………(草
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21484
在线时间
9389 小时
注册时间
2012-6-19
帖子
7114

开拓者短篇九导演组冠军

10
发表于 2014-3-18 14:33:46 | 只看该作者
更新了脚本,现在可以判定多个时间了

点评

赞一个~  发表于 2014-3-18 18:53
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-25 07:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表