Project1
标题:
在修改状态栏脚本(Window_Status),显示变量显示问题
[打印本页]
作者:
鬼双鱼
时间:
2013-4-22 13:56
标题:
在修改状态栏脚本(Window_Status),显示变量显示问题
我的脚本大致如下,目的是在状态栏中显示几个我以变量形式添加的属性。
变量1-7都没有问题,这些脚本也都是复制粘贴过来的,但是变量8和9就会显示发生了Syntax Error (报错脚本我已经用红色标出)。
另外:之后我有跳过这两个变量,改用10 和11 ,测试游戏没问题,但是变量无法正确显示。
(例如我调用变量12为毒术,在游戏中毒术增加,用分歧条件变量测试OK,但是状态栏始终显示为0。也就是说,这变量其实变化了,但是无法显示)
self.contents.font.color = system_color
self.contents.draw_text(320, 140, 96, 32, "资质")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 20, 140, 96, 32, $game_variables[0001].to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 204, 96, 32, "拳掌")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 20, 204, 96, 32, $game_variables[0002].to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 236, 96, 32, "使剑")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 20, 236, 96, 32, $game_variables[0003].to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 268, 96, 32, "使刀")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 20, 268, 96, 32, $game_variables[0004].to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 300, 96, 32, "奇门")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 20, 300, 96, 32, $game_variables[0005].to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 332, 96, 32, "暗器")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 20, 332, 96, 32, $game_variables[0006].to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 172, 96, 32, "运气")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 20, 172, 96, 32, $game_variables[0007].to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 364, 96, 32, "医术")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 20, 364, 96, 32, $game_variables[0008].to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 396, 96, 32, "用毒")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 20, 396, 96, 32, $game_variables[0009].to_s, 2)
作者:
cinderelmini
时间:
2013-4-22 22:33
首先把变量括弧里的000去掉没关系……
然后……把那个设置颜色的换一行吧……(虽然没什么关系)
去掉0之后试试看~
不行再试试看在这行之前输出一下变量看看~
p $game_variables[8]
p $game_variables[8].to_s
看看是不是能输出指定的值~
作者:
joe5491
时间:
2013-4-22 22:52
本帖最后由 joe5491 于 2013-4-22 22:59 编辑
沒換行是有關係的...
沒換行的話,兩個東西中間要打分號(ex: x+=1;y+=1 )
整理一下(附加防止nil錯誤):
for i_i in 1 .. 9
if $game_variables[i_i]==nil
$game_variables[i_i]=0
end
end
self.contents.font.color = system_color
self.contents.draw_text(320, 140, 96, 32, "资质")
self.contents.draw_text(320, 204, 96, 32, "拳掌")
self.contents.draw_text(320, 236, 96, 32, "使剑")
self.contents.draw_text(320, 268, 96, 32, "使刀")
self.contents.draw_text(320, 300, 96, 32, "奇门")
self.contents.draw_text(320, 332, 96, 32, "暗器")
self.contents.draw_text(320, 172, 96, 32, "运气")
self.contents.draw_text(320, 364, 96, 32, "医术")
self.contents.draw_text(320, 396, 96, 32, "用毒")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 20, 140, 96, 32, $game_variables[1].to_s, 2)
self.contents.draw_text(320 + 20, 204, 96, 32, $game_variables[2].to_s, 2)
self.contents.draw_text(320 + 20, 236, 96, 32, $game_variables[3].to_s, 2)
self.contents.draw_text(320 + 20, 268, 96, 32, $game_variables[4].to_s, 2)
self.contents.draw_text(320 + 20, 300, 96, 32, $game_variables[5].to_s, 2)
self.contents.draw_text(320 + 20, 332, 96, 32, $game_variables[6].to_s, 2)
self.contents.draw_text(320 + 20, 172, 96, 32, $game_variables[7].to_s, 2)
self.contents.draw_text(320 + 20, 364, 96, 32, $game_variables[8].to_s, 2)
self.contents.draw_text(320 + 20, 396, 96, 32, $game_variables[9].to_s, 2)
复制代码
作者:
鬼双鱼
时间:
2013-4-23 11:38
问题已解决,多谢
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1