Project1
标题:
当SCENE不为MAP时,如何显示文章?
[打印本页]
作者:
奶油Da蛋糕
时间:
2009-8-25 13:15
标题:
当SCENE不为MAP时,如何显示文章?
好像
$game_temp.message_text= "这里的版主是猪!!!"
这个指令只能在SCENE_MAP里面用?
如果SCENE不为MAP,也就是自己定义的一个新窗口。
如何显示文章呢?
我已经把Window_Message初始化打开了。
并且update里面刷新了。
但是,如果使用这个显示文章,它会出。
脚本 'Scene_Xiulian' 的 240 行 发生了 NoMethodError。
undefined method `message_text=' for #<Game_Temp:0x3438b90>
class Scene_Xiulian
def main
@xl = Window_Xiulian.new
@hd = Window_Head2.new
@Map = Window_Xiulian_Map.new
@Day = Window_Xiulian_Day.new
@mes = Window_Message.new
Graphics.transition
@menu = Sprite.new
@menu.y = 390
@menu.x = 170
@menu.z = 151
@menu.bitmap = Bitmap.new("Pictures/Menu")
@map = Sprite.new
@map.y = 139
@map.x = 128
@map.z = 101
@map.bitmap = Bitmap.new("Pictures/Room_卧室")
@a1 = Sprite.new
@a1.y = 390-41
@a1.x = 170
@a1.z = 10
@a1.bitmap = Bitmap.new("Pictures/打杂")
@a2 = Sprite.new
@a2.y = 390-41
@a2.x = 170+77*1
@a2.z = 10
@a2.bitmap = Bitmap.new("Pictures/基本功")
@a3 = Sprite.new
@a3.y = 390-41
@a3.x = 170+77*2
@a3.z = 10
@a3.bitmap = Bitmap.new("Pictures/招式")
@a4 = Sprite.new
@a4.y = 390-41
@a4.x = 170+77*3
@a4.z = 10
@a4.bitmap = Bitmap.new("Pictures/闲逛")
@a5 = Sprite.new
@a5.y = 390-41
@a5.x = 170+77*4
@a5.z = 10
@a5.bitmap = Bitmap.new("Pictures/休息")
@a6 = Sprite.new
@a6.y = 390-41
@a6.x = 170+77*5
@a6.z = 10
@a6.bitmap = Bitmap.new("Pictures/系统")
@b1 = Sprite.new
@b1.y = 390-41
@b1.x = 170
@b1.z = 10
@b1.bitmap = Bitmap.new("Pictures/打扫")
@b2 = Sprite.new
@b2.y = 390-41
@b2.x = 170+77*1
@b2.z = 10
@b2.bitmap = Bitmap.new("Pictures/挑水")
@b3 = Sprite.new
@b3.y = 390-41
@b3.x = 170+77*2
@b3.z = 10
@b3.bitmap = Bitmap.new("Pictures/洗衣")
@b4 = Sprite.new
@b4.y = 390-41
@b4.x = 170+77*3
@b4.z = 10
@b4.bitmap = Bitmap.new("Pictures/泡茶")
@b5 = Sprite.new
@b5.y = 390-41
@b5.x = 170+77*4
@b5.z = 10
@b5.bitmap = Bitmap.new("Pictures/下厨")
@b6 = Sprite.new
@b6.y = 390-41
@b6.x = 170+77*5
@b6.z = 10
@b6.bitmap = Bitmap.new("Pictures/上一页")
@c1 = Sprite.new
@c1.y = 390-41
@c1.x = 170
@c1.z = 10
@c1.bitmap = Bitmap.new("Pictures/体质")
@c2 = Sprite.new
@c2.y = 390-41
@c2.x = 170+77*1
@c2.z = 10
@c2.bitmap = Bitmap.new("Pictures/力量")
@c3 = Sprite.new
@c3.y = 390-41
@c3.x = 170+77*2
@c3.z = 10
@c3.bitmap = Bitmap.new("Pictures/魔力")
@c4 = Sprite.new
@c4.y = 390-41
@c4.x = 170+77*3
@c4.z = 10
@c4.bitmap = Bitmap.new("Pictures/魅力")
@c5 = Sprite.new
@c5.y = 390-41
@c5.x = 170+77*4
@c5.z = 10
@c5.bitmap = Bitmap.new("Pictures/敏捷")
@head = Sprite.new
@head.y = 18
@head.x = 367
@head.z = 151
@head.bitmap = Bitmap.new("Pictures/touxiang.png")
@tili = Sprite.new
@tili.y = 18
@tili.x = 367
@tili.z = 150
@tili.bitmap = Bitmap.new("Pictures/tili.png")
@huoli = Sprite.new
@huoli.y = 18
@huoli.x = 367
@huoli.z = 150
@huoli.bitmap = Bitmap.new("Pictures/huoli.png")
@head2 = Sprite.new
@head2.y = 25
@head2.x = 390
@head2.z = 152
if $game_variables[14] == 0
@head2.bitmap = Bitmap.new("Graphics/Battlers/泪无痕_f")
elsif $game_variables[14] == 1
@head2.bitmap = Bitmap.new("Graphics/Battlers/凌波燕_f")
else
@head2.bitmap = Bitmap.new("Graphics/Battlers/泪无痕_f")
end
$xl = 0
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@xl.dispose
@hd.dispose
@Map.dispose
@Day.dispose
@mes.dispose
@menu.bitmap.dispose
@menu.dispose
@map.bitmap.dispose
@map.dispose
@a1.bitmap.dispose
@a1.dispose
@a2.bitmap.dispose
@a2.dispose
@a3.bitmap.dispose
@a3.dispose
@a4.bitmap.dispose
@a4.dispose
@a5.bitmap.dispose
@a5.dispose
@a6.bitmap.dispose
@a6.dispose
@b1.bitmap.dispose
@b1.dispose
@b2.bitmap.dispose
@b2.dispose
@b3.bitmap.dispose
@b3.dispose
@b4.bitmap.dispose
@b4.dispose
@b5.bitmap.dispose
@b5.dispose
@b6.bitmap.dispose
@b6.dispose
@c1.bitmap.dispose
@c1.dispose
@c2.bitmap.dispose
@c2.dispose
@c3.bitmap.dispose
@c3.dispose
@c4.bitmap.dispose
@c4.dispose
@c5.bitmap.dispose
@c5.dispose
@head2.bitmap.dispose
@head2.dispose
@head.bitmap.dispose
@head.dispose
@tili.bitmap.dispose
@tili.dispose
@huoli.bitmap.dispose
@huoli.dispose
end
def update
@mes.update
case $xl
when 0
mouse_x, mouse_y = Mouse.get_mouse_pos
if mouse_x > (170) and mouse_x < (170+68) and mouse_y > (390) and mouse_y < (390+73)
@a1.z = 152
if Mouse.press?(Mouse::LEFT)
$xl = 1
@a1.z = 10
@menu.bitmap = Bitmap.new("Pictures/daza_menu")
10.times{Graphics.update}
end
else
@a1.z = 10
end
if mouse_x > (170+77) and mouse_x < (170+77+68) and mouse_y > (390) and mouse_y < (390+73)
@a2.z = 152
if Mouse.press?(Mouse::LEFT)
$xl = 2
@a2.z = 10
@menu.bitmap = Bitmap.new("Pictures/jibengong_menu")
10.times{Graphics.update}
end
else
@a2.z = 10
end
if mouse_x > (170+77*2) and mouse_x < (170+77*2+68) and mouse_y > (390) and mouse_y < (390+73)
@a3.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@a3.z = 10
end
if mouse_x > (170+77*3) and mouse_x < (170+77*3+68) and mouse_y > (390) and mouse_y < (390+73)
@a4.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@a4.z = 10
end
if mouse_x > (170+77*4) and mouse_x < (170+77*4+68) and mouse_y > (390) and mouse_y < (390+73)
@a5.z = 152
if Mouse.press?(Mouse::LEFT)
$game_variables[33] += 1
@xl.update
10.times{Graphics.update}
$game_temp.message_text= "您休息了一天,体力和活力都得到了恢复!"
end
else
@a5.z = 10
end
if mouse_x > (170+77*5) and mouse_x < (170+77*5+68) and mouse_y > (390) and mouse_y < (390+73)
@a6.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@a6.z = 10
end
when 1
daza
when 2
jibengong
end
end
def daza
mouse_x, mouse_y = Mouse.get_mouse_pos
if mouse_x > (170) and mouse_x < (170+68) and mouse_y > (390) and mouse_y < (390+73)
@b1.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@b1.z = 10
end
if mouse_x > (170+77) and mouse_x < (170+77+68) and mouse_y > (390) and mouse_y < (390+73)
@b2.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@b2.z = 10
end
if mouse_x > (170+77*2) and mouse_x < (170+77*2+68) and mouse_y > (390) and mouse_y < (390+73)
@b3.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@b3.z = 10
end
if mouse_x > (170+77*3) and mouse_x < (170+77*3+68) and mouse_y > (390) and mouse_y < (390+73)
@b4.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@b4.z = 10
end
if mouse_x > (170+77*4) and mouse_x < (170+77*4+68) and mouse_y > (390) and mouse_y < (390+73)
@b5.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@b5.z = 10
end
if mouse_x > (170+77*5) and mouse_x < (170+77*5+68) and mouse_y > (390) and mouse_y < (390+73)
@b6.z = 152
if Mouse.press?(Mouse::LEFT)
$xl = 0
@b6.z = 10
@menu.bitmap = Bitmap.new("Pictures/Menu")
10.times{Graphics.update}
end
else
@b6.z = 10
end
end
def jibengong
mouse_x, mouse_y = Mouse.get_mouse_pos
if mouse_x > (170) and mouse_x < (170+68) and mouse_y > (390) and mouse_y < (390+73)
@c1.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@c1.z = 10
end
if mouse_x > (170+77) and mouse_x < (170+77+68) and mouse_y > (390) and mouse_y < (390+73)
@c2.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@c2.z = 10
end
if mouse_x > (170+77*2) and mouse_x < (170+77*2+68) and mouse_y > (390) and mouse_y < (390+73)
@c3.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@c3.z = 10
end
if mouse_x > (170+77*3) and mouse_x < (170+77*3+68) and mouse_y > (390) and mouse_y < (390+73)
@c4.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@c4.z = 10
end
if mouse_x > (170+77*4) and mouse_x < (170+77*4+68) and mouse_y > (390) and mouse_y < (390+73)
@c5.z = 152
if Mouse.press?(Mouse::LEFT)
10.times{Graphics.update}
end
else
@c5.z = 10
end
if mouse_x > (170+77*5) and mouse_x < (170+77*5+68) and mouse_y > (390) and mouse_y < (390+73)
@b6.z = 152
if Mouse.press?(Mouse::LEFT)
$xl = 0
@b6.z = 10
@menu.bitmap = Bitmap.new("Pictures/Menu")
10.times{Graphics.update}
end
else
@b6.z = 10
end
end
end
复制代码
作者:
猫哥哥
时间:
2009-8-25 13:53
报错信息是找不到Game_Temp里的message_text方法。你修改过Game_Temp?
作者:
奶油Da蛋糕
时间:
2009-8-25 14:04
报错信息是找不到Game_Temp里的message_text方法。你修改过Game_Temp?
猫哥哥 发表于 2009-8-25 13:53
OK,谢谢您的提示,我发现我错在哪里了。原来我的等号是中文的=而不是英文的=,
这段脚本还是我复制到那个教程上的,我以为教程上写的不会有错。
话说当年看《跟我从头学脚本》中,第二章讲 P 变量的时候,就是两个中文的”引号。当初学脚本的时候急的我团团转,原来教程有问题。
这个事件转换脚本的命令汇总的教程中,好多都是中文的字符。又害我纳闷了那么久。
哎。
今后脚本高手写教程的时候能不能细心点。
作者:
ONEWateR
时间:
2009-8-25 14:42
吐槽:
引用:
好像
$game_temp.message_text=
"这里的版主是猪!!!"
这个指令只能在SCENE_MAP里面用?
如果SCENE不为MAP,也就是自己定义的一个新窗口。
如何显示文章呢?
我已经把Window_Message初始化打开了。
并且update里面刷新了。
但是,如果使用这个显示文章,它会出。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1