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

Project1

 找回密码
 注册会员
搜索
楼主: 我不宅
打印 上一主题 下一主题

[已经解决] 求一与众不同的日期脚本

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
220
在线时间
24 小时
注册时间
2008-8-2
帖子
128
21
发表于 2009-7-3 10:44:44 | 只看该作者
本帖最后由 谢谢合作 于 2009-7-3 10:47 编辑

http://rpg.blue/viewthread.php?tid=127342&page=2#pid1294427
回复你,昼夜系统你用事件设置就行了。
GRESK
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
276 小时
注册时间
2009-6-6
帖子
1732

贵宾

22
 楼主| 发表于 2009-7-3 10:50:31 | 只看该作者
21# 谢谢合作
可以教教我吗?日期会自动加吗?如何设置昼夜?(要和日期同步,就是1天刚好过去,正好是晚上)
还有时间呢?(时分)
欢迎大家加入AGM大军
群号:82696728
AGM区:http://rpg.blue/forum-77-1.html
玛姐我爱你~玛莉妲大人鞭挞我吧!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
220
在线时间
24 小时
注册时间
2008-8-2
帖子
128
23
发表于 2009-7-3 10:51:37 | 只看该作者
好吧,你要求还真多,我再写一些东西……
GRESK
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
276 小时
注册时间
2009-6-6
帖子
1732

贵宾

24
 楼主| 发表于 2009-7-3 11:05:14 | 只看该作者
谢谢!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
220
在线时间
24 小时
注册时间
2008-8-2
帖子
128
25
发表于 2009-7-3 11:14:52 | 只看该作者
本帖最后由 谢谢合作 于 2009-7-3 11:19 编辑

$sec = 0
#==============================================================================
#==============================================================================

class Window_MapDate2 < Window_Base
  SWITCH = 2
  
  # 小时变量
  VARIABLES4 = 4
  
  # 分钟变量
  VARIABLES5 = 5
  
  # 颜色
  TEXT_COLOR = Color.new(255, 255, 255, 255)
  #--------------------------------------------------------------------------
  # ● 初始化窗口
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 160, 64)
    # 初始化窗口透明度
    self.opacity = 0
    self.back_opacity = 0
    self.contents_opacity = 0
    self.contents = Bitmap.new(width - 32, height - 32)
    setname
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def setname
    if $game_switches[SWITCH] == true
      @total_sec = Graphics.frame_count / Graphics.frame_rate
      if $sec != @total_sec % 60
        $sec = @total_sec % 60
        $game_variables[VARIABLES5] += 1
      end
      if $game_variables[VARIABLES5] > 59
        $game_variables[VARIABLES5] -= 59
        $game_variables[VARIABLES4] += 1
      end
      if $game_variables[VARIABLES4] > 23
        $game_variables[VARIABLES4] -= 23
        $game_variables[VARIABLES1] += 1
      end
      self.contents.clear
      self.contents.font.color = TEXT_COLOR
      self.contents.draw_text(32, 0, 32, 32, "时")
      self.contents.draw_text(96, 0, 32, 32, "分")
      self.contents.draw_text(0, 0, 32, 32, "#{$game_variables[VARIABLES4]}")
      self.contents.draw_text(64, 0, 32, 32, "#{$game_variables[VARIABLES5]}")
      self.opacity = 192
      self.back_opacity = 192
      self.contents_opacity = 192
    end
  end
end
GRESK
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
220
在线时间
24 小时
注册时间
2008-8-2
帖子
128
26
发表于 2009-7-3 11:15:22 | 只看该作者
修正一下刚才的脚本:解决了闰年的一个BUG
  1. #==============================================================================
  2. # ■ 日期显示脚本
  3. #     by 謝謝合作
  4. #------------------------------------------------------------------------------
  5. # 在Main的上方插入一个页,将本脚本复制到那页中即可
  6. #==============================================================================
  7. $abc = false
  8. #==============================================================================
  9. # ■ Window_MapDate
  10. #------------------------------------------------------------------------------
  11. #  显示日期的窗口。
  12. #==============================================================================

  13. class Window_MapDate < Window_Base
  14.   #--------------------------------------------------------------------------
  15.   # ● 类常量定义
  16.   #--------------------------------------------------------------------------

  17.   # 游戏中你设定的闰年
  18.   LEAPYEAR = [800,804,808,812]
  19.   
  20.   # 开启用的开关
  21.   SWITCH = 2
  22.   
  23.   # 月份变量
  24.   VARIABLES1 = 1
  25.   
  26.   # 日期变量
  27.   VARIABLES2 = 2
  28.   
  29.   # 年份变量
  30.   VARIABLES3 = 3
  31.   
  32.   # 窗口位置设定
  33.   NAME_X = 0        # 矩形左上顶点X坐标
  34.   NAME_Y = 0        # 矩形左上顶点Y坐标
  35.   NAME_W = 204      # 矩形宽
  36.   NAME_H = 64       # 矩形高
  37.   
  38.   # 地图名字的颜色
  39.   TEXT_COLOR = Color.new(255, 255, 255, 255)
  40.    
  41.   #--------------------------------------------------------------------------
  42.   # ● 初始化状态
  43.   #--------------------------------------------------------------------------
  44.   def initialize
  45.     super(NAME_X , NAME_Y, NAME_W, NAME_H)
  46.     # 初始化窗口透明度
  47.     self.opacity = 0
  48.     self.back_opacity = 0
  49.     self.contents_opacity = 0
  50.     self.contents = Bitmap.new(width - 32, height - 32)
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 输出文字
  54.   #--------------------------------------------------------------------------
  55.   def setname
  56.     unless $game_switches[SWITCH] == false
  57.       if $game_variables[VARIABLES2] > 28
  58.         
  59.       if $game_variables[VARIABLES1] == 1
  60.         if $game_variables[VARIABLES2] > 31
  61.           $game_variables[VARIABLES1] += 1
  62.           $game_variables[VARIABLES2] -= 31
  63.         end
  64.       end
  65.       if $game_variables[VARIABLES1] == 2
  66.         if $game_variables[VARIABLES2] > 28
  67.           for i in 0...LEAPYEAR.size
  68.             if $game_variables[VARIABLES3] == LEAPYEAR[i]
  69.               $abc = true
  70.               if $game_variables[VARIABLES2] > 29
  71.                 $game_variables[VARIABLES1] += 1
  72.                 $game_variables[VARIABLES2] -= 29
  73.                 break
  74.               end
  75.             elsif $game_variables[VARIABLES3] != LEAPYEAR[i]
  76.               if $abc != true
  77.                 $game_variables[VARIABLES1] += 1
  78.                 $game_variables[VARIABLES2] -= 28
  79.                 break
  80.               end
  81.             end
  82.           end
  83.         end
  84.       end
  85.       if $game_variables[VARIABLES1] == 3
  86.         if $game_variables[VARIABLES2] > 31
  87.           $game_variables[VARIABLES1] += 1
  88.           $game_variables[VARIABLES2] -= 31
  89.         end
  90.       end
  91.       if $game_variables[VARIABLES1] == 4
  92.         if $game_variables[VARIABLES2] > 30
  93.           $game_variables[VARIABLES1] += 1
  94.           $game_variables[VARIABLES2] -= 30
  95.         end
  96.       end
  97.       if $game_variables[VARIABLES1] == 5
  98.         if $game_variables[VARIABLES2] > 31
  99.           $game_variables[VARIABLES1] += 1
  100.           $game_variables[VARIABLES2] -= 31
  101.         end
  102.       end
  103.       if $game_variables[VARIABLES1] == 6
  104.         if $game_variables[VARIABLES2] > 30
  105.           $game_variables[VARIABLES1] += 1
  106.           $game_variables[VARIABLES2] -= 30
  107.         end
  108.       end
  109.       if $game_variables[VARIABLES1] == 7
  110.         if $game_variables[VARIABLES2] > 31
  111.           $game_variables[VARIABLES1] += 1
  112.           $game_variables[VARIABLES2] -= 31
  113.         end
  114.       end
  115.       if $game_variables[VARIABLES1] == 8
  116.         if $game_variables[VARIABLES2] > 31
  117.           $game_variables[VARIABLES1] += 1
  118.           $game_variables[VARIABLES2] -= 31
  119.         end
  120.       end
  121.       if $game_variables[VARIABLES1] == 9
  122.         if $game_variables[VARIABLES2] > 30
  123.           $game_variables[VARIABLES1] += 1
  124.           $game_variables[VARIABLES2] -= 30
  125.         end
  126.       end
  127.       if $game_variables[VARIABLES1] == 10
  128.         if $game_variables[VARIABLES2] > 31
  129.           $game_variables[VARIABLES1] += 1
  130.           $game_variables[VARIABLES2] -= 31
  131.         end
  132.       end      
  133.       if $game_variables[VARIABLES1] == 11
  134.         if $game_variables[VARIABLES2] > 30
  135.           $game_variables[VARIABLES1] += 1
  136.           $game_variables[VARIABLES2] -= 30
  137.         end
  138.       end
  139.       if $game_variables[VARIABLES1] == 12
  140.         if $game_variables[VARIABLES2] > 31
  141.           $game_variables[VARIABLES1] += 1
  142.           $game_variables[VARIABLES2] -= 31
  143.         end
  144.       end  
  145.       if $game_variables[VARIABLES1] > 12
  146.         $game_variables[VARIABLES3] += 1
  147.         $game_variables[VARIABLES1] -= 12
  148.       end
  149.       end
  150.       if @date1 != $game_variables[VARIABLES1] or @date2 != $game_variables[VARIABLES2]
  151.         @date1 = $game_variables[VARIABLES1]
  152.         @date2 = $game_variables[VARIABLES2]
  153.         return
  154.       end
  155.       self.contents.clear
  156.       self.contents.font.color = TEXT_COLOR
  157.       # 描绘日期
  158.           self.contents.draw_text(48, 0, 32, 32, "年")
  159.           self.contents.draw_text(0, 0, 48, 32, "#{$game_variables[VARIABLES3].to_s}")
  160.       
  161.       if @date1 < 10
  162.         if @date2 < 10
  163.           self.contents.draw_text(80, 0, width - 40, 32, "  月" + "  日")
  164.           self.contents.draw_text(80, 0, width - 40, 32, " " + @date1.to_s + "   " + @date2.to_s)
  165.         else
  166.           self.contents.draw_text(80, 0, width - 40, 32, "  月" + "  日")
  167.           self.contents.draw_text(80, 0, width - 40, 32, " " + @date1.to_s + "  " + @date2.to_s)
  168.         end
  169.       else
  170.         if @date2 < 10
  171.           self.contents.draw_text(80, 0, width - 40, 32, "  月" + "  日")
  172.           self.contents.draw_text(80, 0, width - 40, 32, @date1.to_s + "   " + @date2.to_s)
  173.         else
  174.           self.contents.draw_text(80, 0, width - 40, 32, "  月" + "  日")
  175.           self.contents.draw_text(80, 0, width - 40, 32, @date1.to_s + "  " + @date2.to_s)
  176.         end
  177.       end
  178.       self.opacity = 192
  179.       self.back_opacity = 192
  180.       self.contents_opacity = 192
  181.     end
  182.   end
  183. end

  184. #==============================================================================
  185. # ■ Scene_Map
  186. #------------------------------------------------------------------------------
  187. #  处理地图画面的类。(追加定义)
  188. #==============================================================================

  189. class Scene_Map
  190.   alias md_main main
  191.   def main
  192.     @mapdate = Window_MapDate.new
  193.     @mapdate2 = Window_MapDate2.new
  194.     md_main
  195.     @mapdate.dispose
  196.     @mapdate2.dispose
  197.   end
  198.   
  199.   alias md_update update
  200.   def update
  201.     @mapdate.setname
  202.     @mapdate2.setname
  203.     md_update
  204.   end
  205. end
复制代码
GRESK
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
276 小时
注册时间
2009-6-6
帖子
1732

贵宾

27
 楼主| 发表于 2009-7-3 11:18:39 | 只看该作者
25# 谢谢合作


插在哪啊?!............还有昼夜呢?!
欢迎大家加入AGM大军
群号:82696728
AGM区:http://rpg.blue/forum-77-1.html
玛姐我爱你~玛莉妲大人鞭挞我吧!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
220
在线时间
24 小时
注册时间
2008-8-2
帖子
128
28
发表于 2009-7-3 11:19:43 | 只看该作者
也对?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

穿越一季:朔

梦石
0
星屑
50
在线时间
333 小时
注册时间
2007-4-11
帖子
5369

贵宾

29
发表于 2009-7-3 11:20:33 | 只看该作者
本帖最后由 塑望 于 2009-7-3 12:50 编辑
  1. #--------------------------------------------------------------------------
  2.   # 使用方法:打开50号(默认)开启时间功能,关闭50号则窗口关闭
  3.   #
  4.   #
  5.   #
  6.   #
  7.   #                                       66RPG 沉默一秒钟(塑望)
  8.   #                                       Blog:hi.baidu.com/yuilife
  9.   #(加入昼夜系统版。2.0版)
  10.   #转载请保留以上信息
  11.   #--------------------------------------------------------------------------
  12. class Window_Time < Window_Base
  13.   
  14.   $时间窗口开关 = 50 #时间的开关
  15.   #----------以上为开关----------#
  16.   #----------以下为变量----------#
  17.   $天 = 49 #天的变量
  18.   $时 = 48 #时的变量
  19.   $分 = 47 #分的变量
  20.   $秒 = 46 #秒的变量

  21.   $白天 = Tone.new(0,0,0,0)#白天的色调值
  22.   $晚上 = Tone.new(-100,-100,-100,0)#夜晚的色调值

  23.   HOUSE_ID = [2,3,4,5,6] #进入指定地图(ID)后不改变色调(天气).可以进行修改或添加
  24.   
  25.   #--------------------------------------------------------------------------
  26.   # ● 初始化对像
  27.   #--------------------------------------------------------------------------
  28.   def initialize
  29.     super(0, 0, 250, 55) #窗口坐标以及大小
  30.     self.contents = Bitmap.new(width - 32, height - 32)
  31.     self.opacity = 0
  32.     @id = $game_map.map_id
  33.     refresh
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 刷新  
  37.   #--------------------------------------------------------------------------
  38.   def refresh
  39.     if $game_switches[$时间窗口开关]
  40.     self.opacity = 255
  41.     self.contents.font.color = system_color
  42.     self.contents.font.size = 18
  43.          $game_variables[$秒] += 0.1#日期速度
  44.    if $game_variables[$秒] >= 60
  45.      $game_variables[$秒] = 0
  46.      $game_variables[$分] += 1
  47.    end
  48.    
  49.    if $game_variables[$分] >= 60
  50.      $game_variables[$分] = 0
  51.      $game_variables[$时] += 1
  52.    end
  53.    
  54.    if $game_variables[$时] >= 24
  55.      $game_variables[$时] = 0
  56.      $game_variables[$天] += 1
  57.    end
  58.       if $game_variables[$天] >= 8
  59.      $game_variables[$天] = 1
  60.    end
  61.     self.contents.clear  
  62.     if $game_variables[$时] >= 0 and $game_variables[$时] <= 12
  63.       $game_screen.start_tone_change($白天,0)
  64.       self.contents.draw_text(4, -2, 120, 32, "AM")
  65.     elsif $game_variables[$时] >= 12 and $game_variables[$时] <= 24
  66.       $game_screen.start_tone_change($晚上,0)
  67.       self.contents.draw_text(4, -2, 120, 32, "PM")
  68.     end
  69.     if HOUSE_ID.include?($game_map.map_id)
  70.         $game_screen.start_tone_change($白天,0)
  71.       end  
  72.     self.contents.font.color = system_color
  73.     text = sprintf("星期"+"%01d  %02d:%02d:%02d", $game_variables[$天], $game_variables[$时], $game_variables[$分], $game_variables[$秒])
  74.     self.contents.font.color = normal_color
  75.     self.contents.draw_text(0, -2, 250, 32, text, 1)
  76.   else
  77. self.contents.clear
  78.     self.opacity = 0
  79.   end
  80. end
  81. #--------------------------------------------------------------------------
  82.   # ● 刷新画面
  83.   #--------------------------------------------------------------------------
  84.   def update
  85.     super
  86.       refresh
  87.   end
  88. end
  89. #以下请无视 =_=
  90. class Scene_Map
  91.   #--------------------------------------------------------------------------
  92.   # ● 主处理
  93.   #--------------------------------------------------------------------------
  94.   def main
  95.     # 生成活动块
  96.     @spriteset = Spriteset_Map.new
  97.     # 生成信息窗口
  98.     @message_window = Window_Message.new
  99.     @time_window = Window_Time.new
  100.     $game_variables[$天] = 1
  101.     # 执行过渡
  102.     Graphics.transition
  103.     # 主循环
  104.     loop do
  105.       # 刷新游戏画面
  106.       Graphics.update
  107.       # 刷新输入信息
  108.       Input.update
  109.       # 刷新画面
  110.       update
  111.       # 如果画面切换的话就中断循环
  112.       if $scene != self
  113.         break
  114.       end
  115.     end
  116.     # 准备过渡
  117.     Graphics.freeze
  118.     # 释放活动块
  119.     @spriteset.dispose
  120.     # 释放信息窗口
  121.     @message_window.dispose
  122.     @time_window.dispose
  123.     # 标题画面切换中的情况下
  124.     if $scene.is_a?(Scene_Title)
  125.       # 淡入淡出画面
  126.       Graphics.transition
  127.       Graphics.freeze
  128.     end
  129.   end

  130. alias timedate_update update
  131. def update
  132.   @time_window.update
  133.    timedate_update
  134. end
  135. end
复制代码
------------------
补充:因为无聊,所以现在把上面修改成了支持昼夜的 =_= 原版点以下地址飞过去
http://rpg.blue/viewthread.php?tid=125202
--------------

自己定义以上变量的数值。如48号变量定义为10  那么就是10点  其他类推。时间运行速度自己改。
昼夜系统除外的房间自己定义即可
仅供参考而已。。。。
6R复活?别扯淡了.

柳柳一旦接手66RPG,我果断呵呵啊。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
220
在线时间
24 小时
注册时间
2008-8-2
帖子
128
30
发表于 2009-7-3 11:30:55 | 只看该作者
  1. $sec = 0
  2. #==============================================================================
  3. #==============================================================================

  4. class Window_MapDate2 < Window_Base
  5.   SWITCH = 2
  6.   
  7.   # 小时变量
  8.   VARIABLES4 = 4
  9.   
  10.   # 分钟变量
  11.   VARIABLES5 = 5
  12.   
  13.   # 颜色
  14.   TEXT_COLOR = Color.new(255, 255, 255, 255)
  15.   
  16.   # 画面色调
  17.   COLOR = Tone.new(-119,-119,-68,0)    #晚上
  18.   COLOR2 = Tone.new(0,0,0,0)           #日常
  19.   COLOR3 = Tone.new(34,34,34,0)        #正午
  20.   #--------------------------------------------------------------------------
  21.   # ● 初始化窗口
  22.   #--------------------------------------------------------------------------
  23.   def initialize
  24.     super(0, 64, 160, 64)
  25.     # 初始化窗口透明度
  26.     self.opacity = 0
  27.     self.back_opacity = 0
  28.     self.contents_opacity = 0
  29.     self.contents = Bitmap.new(width - 32, height - 32)
  30.     setname
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 刷新
  34.   #--------------------------------------------------------------------------
  35.   def setname
  36.     if $game_switches[SWITCH] == true
  37.       @total_sec = Graphics.frame_count / Graphics.frame_rate
  38.       if $sec != @total_sec % 60
  39.         $sec = @total_sec % 60
  40.         $game_variables[VARIABLES5] += 1
  41.       end
  42.       if $game_variables[VARIABLES5] > 59
  43.         $game_variables[VARIABLES5] -= 59
  44.         $game_variables[VARIABLES4] += 1
  45.       end
  46.       if $game_variables[VARIABLES4] > 23
  47.         $game_variables[VARIABLES4] -= 23
  48.         $game_variables[VARIABLES1] += 1
  49.       end
  50.       if $game_variables[VARIABLES4] > 18
  51.           $game_screen.start_tone_change(COLOR, 100)
  52.       end
  53.       if $game_variables[VARIABLES4] > 7
  54.         if $game_variables[VARIABLES4] < 12
  55.           $game_screen.start_tone_change(COLOR2, 100)
  56.         end
  57.       end
  58.       if $game_variables[VARIABLES4] > 13
  59.         if $game_variables[VARIABLES4] < 19
  60.           $game_screen.start_tone_change(COLOR2, 100)
  61.         end
  62.       end
  63.       if $game_variables[VARIABLES4] < 8
  64.           $game_screen.start_tone_change(COLOR, 100)
  65.       end
  66.       if $game_variables[VARIABLES4] > 11
  67.         if $game_variables[VARIABLES4] < 14
  68.           $game_screen.start_tone_change(COLOR3, 100)
  69.         end
  70.       end
  71.       self.contents.clear
  72.       self.contents.font.color = TEXT_COLOR
  73.       self.contents.draw_text(32, 0, 32, 32, "时")
  74.       self.contents.draw_text(96, 0, 32, 32, "分")
  75.       self.contents.draw_text(0, 0, 32, 32, "#{$game_variables[VARIABLES4]}")
  76.       self.contents.draw_text(64, 0, 32, 32, "#{$game_variables[VARIABLES5]}")
  77.       self.opacity = 192
  78.       self.back_opacity = 192
  79.       self.contents_opacity = 192
  80.     end
  81.   end
  82. end
复制代码
GRESK
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 04:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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