Project1
标题:
一个脚本~~不知道错在哪里~~希望哪位帮我看下好吗
[打印本页]
作者:
kula1900
时间:
2009-2-6 04:46
标题:
一个脚本~~不知道错在哪里~~希望哪位帮我看下好吗
class Window_Command_New2 < Window_Selectable
def initialize(actors=4,enemynums=0)
super(438, 20, 172, 160)
self.contents = Bitmap.new(width - 32, height - 32)
case $game_variables[2]
when 0
@commands = ["空"]
when 1
@commands = ["1"]
when 2
@commands = ["1","2"]
when 3
@commands = ["1","2","3"]
when 4
@commands = ["1","2","3","4"]
when 5
@commands = ["1","2","3","4","5"]
when 6
@commands = ["1","2","3","4","5","6"]
when 7
@commands = ["1","2","3","4","5","6","7"]
when 8
@commands = ["1","2","3","4","5","6","7","8"]
end
@item_max = 8
@column_max = 2
@actors = actors
draw_item(0, @actors==0 ? disabled_color : normal_color)
draw_item(1, @actors==0 ? disabled_color : normal_color)
draw_item(2, @actors==0 ? disabled_color : normal_color)
draw_item(3, @actors==0 ? disabled_color : normal_color)
draw_item(4, @actors==0 ? disabled_color : normal_color)
draw_item(5, @actors==0 ? disabled_color : normal_color)
draw_item(6, normal_color)
draw_item(7, normal_color)
self.index = 0
end
def draw_item(index, color)
self.contents.font.color = color
x = 4 + index % 2 * 70
y = index / 2 * 32
rect = Rect.new(x, y, 64, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
#错行 提示 typeerror
#错行 提示 cannot convert nil into string
self.contents.draw_text(rect, @commands[index], 1)
#错行 提示 typeerror
#错行 提示 cannot convert nil into string
end
def update_cursor_rect
x = 4 + index % 2 * 70
y = index / 2 * 32
self.cursor_rect.set(x, y, 64, 32)
end
end
#用脚本调用 $scene = Scene_Ydck.new
class Scene_Ydck
def initialize(ydck_index = 0)
@ydck_index = ydck_index
end
def main
# check_enemy_in_map($game_player.x,$game_player.y)
cmd = Window_Command_New2.new($game_party.actors.size)
cmd.index = @ydck_index
Graphics.transition
loop do
Graphics.update
Input.update
cmd.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
end
if Input.trigger?(Input::C)
case cmd.index
when 0
#回到地图
$scene = Scene_Map.new
#调用公共事件1 以下依次类推
$game_system.map_interpreter.setup($data_common_events[1].list, 0)
$game_system.map_interpreter.update
when 1
$scene = Scene_Map.new
$game_system.map_interpreter.setup($data_common_events[2].list, 0)
$game_system.map_interpreter.update
when 2
$scene = Scene_Map.new
$game_system.map_interpreter.setup($data_common_events[3].list, 0)
$game_system.map_interpreter.update
when 3
$scene = Scene_Map.new
$game_system.map_interpreter.setup($data_common_events[4].list, 0)
$game_system.map_interpreter.update
when 4
$scene = Scene_Map.new
$game_system.map_interpreter.setup($data_common_events[5].list, 0)
$game_system.map_interpreter.update
when 5
$scene = Scene_Map.new
$game_system.map_interpreter.setup($data_common_events[6].list, 0)
$game_system.map_interpreter.update
when 6
$scene = Scene_Map.new
$game_system.map_interpreter.setup($data_common_events[7].list, 0)
$game_system.map_interpreter.update
when 7
$scene = Scene_Map.new
$game_system.map_interpreter.setup($data_common_events[8].list, 0)
$game_system.map_interpreter.update
end
end
if $scene != self
break
end
end
Graphics.freeze
cmd.dispose
end
end [LINE]1,#dddddd[/LINE]
本贴由论坛斑竹天圣的马甲结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^
作者:
asperta
时间:
2009-2-6 05:00
错误的那行改为self.contents.draw_text(rect, @commands[index].to_s, 1)试试 [LINE]1,#dddddd[/LINE]
系统信息:本贴获得楼主认可,66RPG感谢您的热情解答~
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1