When I try and use this script in my project that has no added scripts,
it says that on line 73, there is no implicit conversion from nil to integer.
This is the script
And this is the line indicated in the error message
Please Help!
it says that on line 73, there is no implicit conversion from nil to integer.
This is the script
Code:
class Window_Base < Window
def draw_actor_battler(actor, x, y)
face = RPG::Cache.battler(actor.character_name, actor.character_hue)
fw = face.width
fh = face.height
src_rect = Rect.new(3, -1, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect, opacity)
end
end
class Window_Location < Window_Base
def initialize
super(0, 0, 322, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
$defaultfontsize=$fontsize
$defaultfonttype=$fonttype
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
$data_map_infos = load_data("Data/MapInfos.rxdata")
self.contents.draw_text(150, 0, 124, 32, $data_map_infos[$game_map.map_id].name, 2)
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 120, 32, "Location")
end
end
class Window_Title < Window_Base
def initialize
super(0, 0, 322, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 120, 32, 'Your Title Here')
end
end
class Window_Chapter < Window_Base
def initialize
super(0, 0, 322, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 120, 32, 'Chapter')
self.contents.font.color = normal_color
self.contents.draw_text(250, 0, 120, 32, $game_variables[1].to_s)
end
end
class Window_PlayTime < Window_Base
def initialize
super(0, 0, 160, 129)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, -10, 120, 32, "Play Time")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 10, 120, 32, text, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 38, 120, 32, "Real Time")
@time_string = Time.now
text = @time_string.strftime("%A %H:%M:%S")
self.contents.font.color = normal_color
self.contents.draw_text(4, 60, 120, 32, text, 2)
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
class Window_MenuStatus < Window_Selectable
def initialize
super(0, 0, 640, 289)
@column_max = 4
bw = 152 * @column_max
bh = (($game_party.actors.size - 1) / @column_max + 1) * 256
self.contents = Bitmap.new(bw, bh)
refresh
self.active = false
self.index = - 1
end
def refresh
self.contents.clear
self.contents.font.size = 20
self.contents.font.name = $defaultfonttype
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = i % @column_max * 152 + 8
y = i / @column_max * 256 + 96
actor = $game_party.actors[i]
draw_actor_battler(actor, x, y + 100)
draw_actor_name(actor, x, y - 100)
draw_actor_level(actor, x, y + 46)
draw_actor_state(actor, x + 64, y + 46)
self.contents.font.color = system_color
self.contents.draw_text(x, y + 130, 32, 32, "Next")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y + 130, 100, 32, actor.next_rest_exp_s, 2)
draw_actor_hp(actor, x, y + 74)
draw_actor_sp(actor, x, y + 102)
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
cursor_width = 152
x = @index % @column_max * 152
y = @index / @column_max * 256 - self.oy
self.cursor_rect.set(x, y, cursor_width, 256)
self.oy = @index / @column_max * 256
end
end
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Save"
s6 = "Exit"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.height = 5 * 32 + 32
@command_window.x = 480
@command_window.y = 288
@command_window.index = @menu_index
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_system.save_disabled
@command_window.disable_item(4)
end
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 288
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
@location_window = Window_Location.new
@location_window.x = 159
@location_window.y = 416
@chapter_window = Window_Chapter.new
@chapter_window.x = 159
@chapter_window.y = 352
@title_window = Window_Title.new
@title_window.x = 159
@title_window.y = 288
@status_window = Window_MenuStatus.new
@status_window.x = 0
@status_window.y = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@playtime_window.dispose
@gold_window.dispose
@location_window.dispose
@chapter_window.dispose
@title_window.dispose
@status_window.dispose
end
def update
@command_window.update
@playtime_window.update
@gold_window.update
@location_window.update
@chapter_window.update
@title_window.update
@status_window.update
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
And this is the line indicated in the error message
self.contents.font.size = $defaultfontsize
Please Help!