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

Project1

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

[推荐问答] 请问VX有日历功能的脚本吗?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
76
在线时间
150 小时
注册时间
2012-1-29
帖子
122
跳转到指定楼层
1
发表于 2012-3-19 13:14:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 狂人狂者 于 2012-4-8 14:12 编辑

如果可以最好可以控制日期时间和星期几的。
脚本冲突去死去死!!!

Lv1.梦旅人

梦石
0
星屑
50
在线时间
32 小时
注册时间
2011-7-15
帖子
38
2
发表于 2012-3-20 16:38:29 | 只看该作者
本帖最后由 414447674 于 2012-3-25 14:11 编辑

辛苦了两个小时啊, 不懂问我, 第一次写脚本, 很多地方没有标注释, 请见谅, 不懂问我
这段脚本参考了地图名显示脚本:http://rpg.blue/thread-73692-1-1.html
建议配合随着时间而改变地图颜色的脚本使用, 这里有一个:http://rpg.blue/thread-107005-1-1.html
  1. #==============================================================================
  2. # ■ 日期時間顯示腳本
  3. #     by 414447674
  4. #------------------------------------------------------------------------------
  5. # 在Main的上方插入一個頁,將本腳本複製到那頁中即可
  6. #==============================================================================

  7. #==============================================================================
  8. # ■ Window_Time
  9. #------------------------------------------------------------------------------
  10. #  顯示日期時間的視窗。
  11. #==============================================================================

  12. class Window_Time < Window_Base
  13.   #--------------------------------------------------------------------------
  14.   # ● 類常量定義
  15.   #--------------------------------------------------------------------------

  16.   # 日期、時間的變數
  17.   $v_year = 1        #年份
  18.   $v_month = 2       #月份
  19.   $v_day = 3         #日期
  20.   $v_hour = 4        #小時
  21.   $v_min = 5         #分鐘
  22.   $v_sec = 6         #秒鐘
  23.   $v_battle_sec = 7  #戰鬥時遺留的時間
  24.   $v_week = 8        #今天的星期數
  25.   
  26.   # 正常時是否顯示時間的開關
  27.   $normal_switch = 1
  28.   
  29.   # 戰鬥時是否顯示時間的開關
  30.   $battle_switch = 2
  31.   
  32.   # 開始時間流動的開關
  33.   $start_time = 3
  34.   
  35.   # 戰鬥時時間是否流動的開關
  36.   $battle_time = 4
  37.   
  38.   # 戰鬥時時間流動是正常的多少分之一
  39.   $battle_flow_time = 60
  40.   
  41.   # 現實中一秒等於游戲裏的多少分鐘
  42.   $min = 1

  43.   # 常規設定
  44.   $month = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
  45.   $week_day_name = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
  46.   $start_date = [2012, 1, 1, 0, 0, 0, 0]
  47.   # 起始時間 [年份, 月份, 日期, 小時, 分鐘, 秒鐘, 第一天星期幾]
  48.   
  49.   # 窗口位置設定
  50.   NAME_X = 0        # 矩形左上頂點X座標
  51.   NAME_Y = 0        # 矩形左上頂點Y座標
  52.   NAME_W = 280      # 矩形寬
  53.   NAME_H = 60       # 矩形高
  54.   
  55.   # 完全可見時的透明度設置
  56.   OPACITY_1 = 244   # 邊框
  57.   OPACITY_2 = 100   # 背景
  58.   OPACITY_3 = 255   # 文字
  59.   
  60.   # 日曆的顏色
  61.   TEXT_COLOR = Color.new(255, 255, 255, 255)
  62.    
  63.   #--------------------------------------------------------------------------
  64.   # ● 初始化狀態
  65.   #--------------------------------------------------------------------------
  66.   def initialize
  67.     super(NAME_X , NAME_Y, NAME_W, NAME_H)
  68.     # 初始化窗口透明度
  69.     self.opacity = 0
  70.     self.back_opacity = 0
  71.     self.z = 9999
  72.     self.contents_opacity = 0
  73.     self.contents = Bitmap.new(width - 32, height - 32)
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 輸出時間
  77.   #--------------------------------------------------------------------------
  78.   def settime(in_battle = false, see = true)
  79.     self.contents.clear
  80.     self.contents.font.color = TEXT_COLOR
  81.     text = sprintf("%4d/%2d/%2d (", $game_variables[$v_year], $game_variables[$v_month], $game_variables[$v_day])
  82.     text += $week_day_name[$game_variables[$v_week]]
  83.     text += sprintf(")  %02d:%02d", $game_variables[$v_hour], $game_variables[$v_min])
  84.     if in_battle
  85.       text += sprintf(":%02d", $game_variables[$v_sec])
  86.     end
  87.     # 描繪時間
  88.     self.contents.draw_text(4, 0 , width - 40, 32, text, 1)
  89.     # 窗口透明度
  90.     if see
  91.       self.opacity = OPACITY_1
  92.       self.back_opacity = OPACITY_2
  93.       self.contents_opacity = OPACITY_3
  94.     else
  95.       self.opacity = 0
  96.       self.back_opacity = 0
  97.       self.contents_opacity = 0
  98.     end
  99.   end
  100. end

  101. #==============================================================================
  102. # ■ Scene_Map
  103. #------------------------------------------------------------------------------
  104. #  處理地圖畫面的類。(追加定義)
  105. #==============================================================================

  106. class Scene_Map
  107.   
  108.   def date_refresh
  109.     if $game_variables[$v_day] > $month[$game_variables[$v_month]] and $game_variables[$v_month] != 2
  110.       $game_variables[$v_day] -= $month[$game_variables[$v_month]]
  111.       $game_variables[$v_month] += 1
  112.     elsif (($game_variables[$v_year] % 4 == 0 and $game_variables[$v_year] % 100 != 0) or $game_variables[$v_year] % 400 == 0) and $game_variables[$v_month] == 2 and $game_variables[$v_day] > 29
  113.       $game_variables[$v_day] -= 29
  114.       $game_variables[$v_month] = 3
  115.     elsif ($game_variables[$v_year] % 4 != 0 or ($game_variables[$v_year] % 100 == 0 and $game_variables[$v_year] % 400 != 0)) and $game_variables[$v_month] == 2 and $game_variables[$v_day] > 28
  116.       $game_variables[$v_day] -= 28
  117.       $game_variables[$v_month] = 3
  118.     end
  119.     if $game_variables[$v_month] > 12
  120.       $game_variables[$v_month] -= 12
  121.       $game_variables[$v_year] += 1
  122.     end
  123.     if $game_variables[$v_day] < 0 and $game_variables[$v_month - 1] != 2
  124.       $game_variables[$v_day] += $month[$game_variables[$v_month - 1]]
  125.       $game_variables[$v_month] -= 1
  126.     elsif (($game_variables[$v_year] % 4 == 0 and $game_variables[$v_year] % 100 != 0) or $game_variables[$v_year] % 400 == 0) and $game_variables[$v_month - 1] == 2 and $game_variables[$v_day] < 0
  127.       $game_variables[$v_day] += 29
  128.       $game_variables[$v_month] = 2
  129.     elsif ($game_variables[$v_year] % 4 != 0 or ($game_variables[$v_year] % 100 == 0 and $game_variables[$v_year] % 400 != 0)) and $game_variables[$v_month - 1] == 2 and $game_variables[$v_day] < 0
  130.       $game_variables[$v_day] += 28
  131.       $game_variables[$v_month] = 2
  132.     end
  133.     if $game_variables[$v_month] < 0
  134.       $game_variables[$v_month] += 12
  135.       $game_variables[$v_year] -= 1
  136.     end
  137.   end
  138.   
  139.   def time_refresh
  140.     while $game_variables[$v_sec] >= 60
  141.       $game_variables[$v_sec] -= 60
  142.       $game_variables[$v_min] += 1
  143.     end
  144.     while $game_variables[$v_min] >= 60
  145.       $game_variables[$v_min] -= 60
  146.       $game_variables[$v_hour] += 1
  147.     end
  148.     while $game_variables[$v_hour] >= 24
  149.       $game_variables[$v_hour] -= 24
  150.       $game_variables[$v_day] += 1
  151.       $game_variables[$v_week] += 1
  152.       $game_variables[$v_week] %= 7
  153.       date_refresh
  154.     end
  155.     while $game_variables[$v_sec] < 0
  156.       $game_variables[$v_sec] += 60
  157.       $game_variables[$v_min] -= 1
  158.     end
  159.     while $game_variables[$v_min] < 0
  160.       $game_variables[$v_min] += 60
  161.       $game_variables[$v_hour] -= 1
  162.     end
  163.     while $game_variables[$v_hour] < 0
  164.       $game_variables[$v_hour] += 24
  165.       $game_variables[$v_day] -= 1
  166.       $game_variables[$v_week] -= 1
  167.       $game_variables[$v_week] += 7 if $game_variables[$v_week] < 0
  168.       date_refresh
  169.     end
  170.   end
  171.   
  172.   alias day_start start
  173.   def start
  174.     @time = Window_Time.new
  175.     day_start
  176.   end
  177.   
  178.   alias day_dispose terminate
  179.   def terminate
  180.     day_dispose
  181.     @time.dispose
  182.   end
  183.   
  184.   alias day_update update
  185.   def update
  186.      day_update
  187.     if $game_switches[$start_time]
  188.       $game_variables[$v_sec] += $min
  189.       if $game_variables[$v_sec] >= 60
  190.         time_refresh
  191.       end
  192.     end
  193.     if $game_switches[$normal_switch]
  194.       @time.settime
  195.     else
  196.       @time.settime(false, false)
  197.     end
  198.   end
  199. end

  200. #==============================================================================
  201. # ** Scene_Title
  202. #------------------------------------------------------------------------------
  203. #  這個類用來執行顯示標題畫面的程式。(追加定義)
  204. #==============================================================================

  205. class Scene_Title < Scene_Base
  206.   
  207.   alias new_game command_new_game
  208.   def command_new_game
  209.     new_game
  210.     $game_variables[$v_year] = $start_date[0]
  211.     $game_variables[$v_month] = $start_date[1]
  212.     $game_variables[$v_day] = $start_date[2]
  213.     $game_variables[$v_hour] = $start_date[3]
  214.     $game_variables[$v_min] = $start_date[4]
  215.     $game_variables[$v_sec] = $start_date[5]
  216.     $game_variables[$v_week] = $start_date[6]
  217.   end
  218. end

  219. #==============================================================================
  220. # ** Scene_Battle
  221. #------------------------------------------------------------------------------
  222. #  這個類用來執行顯示作戰畫面的程式。(追加定義)
  223. #==============================================================================

  224. class Scene_Battle < Scene_Base
  225.   
  226.   alias day_start start
  227.   def start
  228.     @time = Window_Time.new
  229.     day_start
  230.   end
  231.   
  232.   alias day_update update_basic
  233.   def update_basic(main = false)
  234.     day_update(main)
  235.     if $game_switches[$battle_time]
  236.       $game_variables[$v_battle_sec] += $min
  237.       if $game_variables[$v_battle_sec] >= $battle_flow_time
  238.         @time2 = Scene_Map.new
  239.         $game_variables[$v_battle_sec] -= $battle_flow_time
  240.         $game_variables[$v_sec] += 1
  241.         if $game_variables[$v_sec] >= 60
  242.           @time2.time_refresh
  243.         end
  244.       end
  245.     end
  246.     if $game_switches[$battle_switch]
  247.       @time.settime(true)
  248.     else
  249.       @time.settime(true, false)
  250.     end
  251.   end

  252.   alias day_terminate terminate
  253.   def terminate
  254.     @time.dispose
  255.     day_terminate
  256.   end
  257. end
  258. #==============================================================================
  259. # ** Scene_File
  260. #------------------------------------------------------------------------------
  261. #  這個類用來執行顯示存取進度畫面的程式。(追加定義)
  262. #==============================================================================

  263. class Scene_File < Scene_Base
  264.   def write_save_data(file)
  265.     characters = []
  266.     for actor in $game_party.members
  267.       characters.push([actor.character_name, actor.character_index])
  268.     end
  269.     $game_system.save_count += 1
  270.     $game_system.version_id = $data_system.version_id
  271.     @last_bgm = RPG::BGM::last
  272.     @last_bgs = RPG::BGS::last
  273.     Marshal.dump(characters,           file)
  274.     Marshal.dump(Graphics.frame_count, file)
  275.     Marshal.dump(@last_bgm,            file)
  276.     Marshal.dump(@last_bgs,            file)
  277.     Marshal.dump($game_system,         file)
  278.     Marshal.dump($game_message,        file)
  279.     Marshal.dump($game_switches,       file)
  280.     Marshal.dump($game_variables,      file)
  281.     Marshal.dump($game_self_switches,  file)
  282.     Marshal.dump($game_actors,         file)
  283.     Marshal.dump($game_party,          file)
  284.     Marshal.dump($game_troop,          file)
  285.     Marshal.dump($game_map,            file)
  286.     Marshal.dump($game_player,         file)
  287.     Marshal.dump($min,                 file)
  288.   end
  289.   def read_save_data(file)
  290.     characters           = Marshal.load(file)
  291.     Graphics.frame_count = Marshal.load(file)
  292.     @last_bgm            = Marshal.load(file)
  293.     @last_bgs            = Marshal.load(file)
  294.     $game_system         = Marshal.load(file)
  295.     $game_message        = Marshal.load(file)
  296.     $game_switches       = Marshal.load(file)
  297.     $game_variables      = Marshal.load(file)
  298.     $game_self_switches  = Marshal.load(file)
  299.     $game_actors         = Marshal.load(file)
  300.     $game_party          = Marshal.load(file)
  301.     $game_troop          = Marshal.load(file)
  302.     $game_map            = Marshal.load(file)
  303.     $game_player         = Marshal.load(file)
  304.     $min                 = Marshal.load(file)
  305.     if $game_system.version_id != $data_system.version_id
  306.       $game_map.setup($game_map.map_id)
  307.       $game_player.center($game_player.x, $game_player.y)
  308.     end
  309.   end
  310. end
  311. #==============================================================================
  312. # ** Game_Interpreter
  313. #------------------------------------------------------------------------------
  314. #  這個類是用來執行事件指令的直譯器。
  315. #  這個類作為 Game_Map、Game_Troop 和 Game_Event 的內部類使用。(追加定義)
  316. #==============================================================================

  317. class Game_Interpreter
  318.   def change_time(year, month, day, hour, min, sec)
  319.     $game_variables[$v_year] += year
  320.     $game_variables[$v_month] += month
  321.     $game_variables[$v_day] += day
  322.     $game_variables[$v_hour] += hour
  323.     $game_variables[$v_min] += min
  324.     $game_variables[$v_sec] += sec
  325.     @time = Scene_Map.new
  326.     @time.time_refresh
  327.   end
  328. end
复制代码
sample.rar (279.44 KB, 下载次数: 70)
sample.zip (292.18 KB, 下载次数: 76)

‘‘──414447674于2012-3-21 14:00补充以下内容

還有不懂可以問我
’’


‘‘──414447674于2012-3-22 18:50补充以下内容

是將RGSS202E.dll改成RGSS200E.dll才對
’’
如果想改变时间流动的速度可以直接在事件裏输入RGSS脚本: $min = X, X是现实一秒, 游戏过多少分钟(储存时会储存)
如果想改时间也是在事件裏输入RGSS脚本 change_time(A, B, C, D, E, F), 这是时间增加多少(减少的话就输入负数), A是年, B是月, C是日, D是小时, E是分钟, F是秒钟
(脚本改了一点, 复制上面的脚本就是了)������

点评

怎么样把这个运用于条件的分歧?就是如果时间在几点~几点这种可以表示出来吗?  发表于 2012-3-30 17:36
最后还有一个问题,怎样才能更改时间流动的速度? 或者是怎样让时间改变?  发表于 2012-3-24 12:18
不是,是数据错误,文件被破坏 sample\Data\Scripts.rvdata C:\Users\linda\Downloads\sample.rar  发表于 2012-3-22 19:57
是不是找不到某个档案? 把game.ini里的RGSS202J 改成 RGSS200J吧  发表于 2012-3-22 15:53
范例出错..  发表于 2012-3-22 13:06

评分

参与人数 1星屑 +200 收起 理由
iisnow + 200 原创脚本奖励

查看全部评分

E
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
76
在线时间
150 小时
注册时间
2012-1-29
帖子
122
3
 楼主| 发表于 2012-3-28 18:18:08 | 只看该作者
414447674 发表于 2012-3-20 16:38
辛苦了两个小时啊, 不懂问我, 第一次写脚本, 很多地方没有标注释, 请见谅, 不懂问我
这段脚本参考了地图名 ...

最后一个,能解答给你加悬赏。
怎么样把这个运用于条件的分歧?就是如果时间在几点~几点这种可以表示出来吗?
脚本冲突去死去死!!!
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
32 小时
注册时间
2011-7-15
帖子
38
4
发表于 2012-4-2 06:22:45 | 只看该作者
這個很簡單==
if x < y and $game_variables[$hour] > x and $game_variables[$hour] < y or x > y and $game_variables[$hour] > y and $game_variables[$hour] < x
x 是早的時間, y 是晚的時間

点评

算了,我自己试吧  发表于 2012-4-8 14:11
X 和Y是按照什么格式来打?是按照月,日,几点什么的来打吗?  发表于 2012-4-4 20:19
E
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-3 19:09

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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