查看: 3172|回复: 2

[已经解决] 为啥我的时间系统工作不正常?

[复制链接]
梦石
0
星屑
136
在线时间
1050 小时
注册时间
2006-5-3
回帖
602
发表于 2013-2-21 09:52:54 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 gaofei677 于 2013-2-21 11:17 编辑

-------------------update(start)--------------------------------
自己研究了半天,最后自己找出了问题

问题1,把所有的逻辑或(or)取消,写成并列条件,虽然不知道为什么,大概是 or 的用法没写对
问题2,年份进制写法错误,应该修改成
[pre lang="ruby" line="1"]if $game_variables[31][1] == 1 and $game_variables[31][2] == 2 and $game_variables[31][3] == 3 and $game_variables[31][4] == 2
$game_variables[31][3] = 0
$game_variables[31][4] = 1
$game_variables[31][1] = 0
$game_variables[31][2] = 1
$game_variables[31][0] += 1
end

if  $game_variables[31][1] > 0 and $game_variables[31][2] > 2
$game_variables[31][3] = 0
$game_variables[31][4] = 1
$game_variables[31][1] = 0
$game_variables[31][2] = 1
$game_variables[31][0] += 1
end
[/pre]
-------------------update(end)--------------------------------
我在执行以下的时间系统的时候,当时间从 2014,01,01 增加到 2014,03,31 的时候没有问题
但是当时间应该为2014,04,01的时候,系统却显示为 2014,03,32
往后我再怎么增加天,只有号数增加正常,号数甚至可以到100,但是月份和年份就是不增加
这两天被这个时间系统弄得心力交瘁
求大侠帮我纠正一下错误

[pre lang="ruby" line="1"]#此定义了一个2014-2016 的时间系统
#game_variables[31][0] 为2014年
#game_variables[31][1] 为月份的十位
#game_variables[31][2] 为月份的个位
#game_variables[31][3] 为天数的十位
#game_variables[31][4] 为天数的个位

$game_variables[31] = [4,0,1,0,1]

#此定义了号数的个位到十位的十进制
if $game_variables[31][4] > 9
$game_variables[31][3] += 1
$game_variables[31][4] = 0
end

#此定义了月份的个位到十位的十进制
if $game_variables[31][2] > 9
$game_variables[31][1] += 1
$game_variables[31][2] = 0
end

#此定义了年份满12月,年数进一位
if $game_variables[31][1] == 1 and $game_variables[31][2] == 3
$game_variables[31][1] = 0
$game_variables[31][2] = 1
$game_variables[31][0] += 1
end

#此定义了大月31天月份进一位
if ($game_variables[31][1] == 0 and $game_variables[31][2] == 1 or 3 or 5 or 7 or 8) or ($game_variables[31][1] == 1 and $game_variables[31][2] == 0 or 2)
if $game_variables[31][3] == 3 and $game_variables[31][4] == 2
  $game_variables[31][3] = 0
  $game_variables[31][4] = 1
  $game_variables[31][2] += 1
end
end

#此定义了小月30天月份进一位
if ($game_variables[31][1] == 0 and $game_variables[31][2] == 4 or 6 or 9) or ($game_variables[31][1] == 1 and $game_variables[31][2] == 1)
if $game_variables[31][3] == 3 and $game_variables[31][4] == 1
  $game_variables[31][3] = 0
  $game_variables[31][4] = 1
  $game_variables[31][2] += 1
end
end

#此定义了2月28天月份进一位(2014年到2016年没有闰年)
if $game_variables[31][1] == 0 and $game_variables[31][2] == 2
if $game_variables[31][3] == 2 and $game_variables[31][4] == 9
  $game_variables[31][3] = 0
  $game_variables[31][4] = 1
  $game_variables[31][2] += 1
end
end[/pre]

点评

我只是在想……为什么不把这一大段做成事件?好像无非也就是变量操作和条件分歧  发表于 2013-2-21 10:06
漏夏同人
《咱的夏天》
下载地址:http://tieba.baidu.com/p/2681607456
人员招募:http://rpg.blue/thread-339747-1-1.html

送快递的水表员

梦石
10
星屑
5259
在线时间
3304 小时
注册时间
2012-6-27
回帖
7028

开拓者贵宾

发表于 2013-2-21 10:07:53 | 显示全部楼层
我只是在想……为什么不把这一大段做成公共事件,然后目标——并行处理?
好像无非也就是变量操作和条件分歧……而且条件分歧也可以判断脚本……
回复

使用道具 举报

梦石
0
星屑
136
在线时间
1050 小时
注册时间
2006-5-3
回帖
602
 楼主| 发表于 2013-2-21 10:09:14 | 显示全部楼层
本来使用事件写的,只是懒得截图,所以就直接写代码在论坛上了
漏夏同人
《咱的夏天》
下载地址:http://tieba.baidu.com/p/2681607456
人员招募:http://rpg.blue/thread-339747-1-1.html
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部