tryin some scripting again, this time just a UI for a macro system im working on.
class Window_Macro < Window_Base
def initialize
super(220, 100, 288, 230)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
@actor = $game_party.actors[0]
@phealth = $game_variables[4]
@pforce = $game_variables[5]
self.contents.draw_text(32,0,96,32, "Health Macro")
self.contents.draw_text(32,32,128,32, "#{@phealth} / #{@actor.maxhp}")
draw_bar_beginner(32, 64, @phealth, @actor.maxhp, 192, 10,bar_color = Color.new(150, 0, 0, 255) )
self.contents.draw_text(32,96,96,32, "Force Macro")
self.contents.draw_text(32,128,128,32, "#{@pforce} / #{@actor.maxsp}")
draw_bar_beginner(32,160, @pforce, @actor.maxsp, 192, 10, bar_color = Color.new(0,0,150,255) )
end
end
class Window_Potion < Window_Selectable
def initialize
super (220,160,220,198)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = 0
end
def refresh
self.contents.clear
@item_max = 5
self.contents.draw_text(0,0,96,32, "100")
self.contents.draw_text(0,32,96,32, "250")
self.contents.draw_text(0,64,96,32, "500")
self.contents.draw_text(0,96,96,32, "1000")
self.contents.draw_text(0,128,96,32, "2000")
end
end
class Window_PotionF < Window_Selectable
def initialize
super (220,160,220,198)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = 0
end
def refresh
self.contents.clear
@item_max = 5
self.contents.draw_text(0,0,96,32, "50")
self.contents.draw_text(0,32,96,32, "125")
self.contents.draw_text(0,64,96,32, "250")
self.contents.draw_text(0,96,96,32, "500")
self.contents.draw_text(0,128,96,32, "1000")
end
end
class Scene_Macro
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
s1 = "Change HP Pots"
s2 = "Change FP Pots"
@command1_window = Window_Command.new(160, [s1, s2])
@command_window.index = @menu_index
end
@macro_window = Window_Macro.new
@potion_window = Window_Potion.new
@potion_window.visible = false
@potionf_window = Window_Potionf.new
@potionf_window.visible = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command1_window.dispose
@macro_window.dispose
@potion_window.dispose
@potionf_window.dispose
end
def update
@command1_window.update
@macro_window.update
@potion_window.update
@potionf_window.update
if @command1_window.active
update_command
return
end
if @potion_window.active
update_potion
return
end
if @potionf_window.active
update_potionf
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
$game_system.se_play($data_system.buzzer_se)
return
end
case @command1_window.index
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@potion_window.active = true
@potion_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@potionf_window.active = true
@potion_window.index = 0
end
return
end
def update_potion
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
$game_system.se_play($data_system.buzzer_se)
return
end
case @potion_window.index
when 1
$game_system.se_play($data_system.decision_se)
$game_variables[4] = 100
$scene = Scene_Macro
when 2
$game_system.se_play($data_system.decision_se)
$game_variables[4] = 250
$scene = Scene_Macro
when 3
$game_system.se_play($data_system.decision_se)
$game_variables[4] = 500
$scene = Scene_Macro
when 4
$game_system.se_play($data_system.decision_se)
$game_variables[4] = 1000
$scene = Scene_Macro
when 5
$game_system.se_play($data_system.decision_se)
$game_variables[4] = 2000
$scene = Scene_Macro
end
return
end
def update_potionf
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0
$game_system.se_play($data_system.buzzer_se)
return
end
case @potionf_window.index
when 1
$game_system.se_play($data_system.decision_se)
$game_variables[5] = 50
$scene = Scene_Macro
when 2
$game_system.se_play($data_system.decision_se)
$game_variables[5] = 125
$scene = Scene_Macro
when 3
$game_system.se_play($data_system.decision_se)
$game_variables[5] = 250
$scene = Scene_Macro
when 4
$game_system.se_play($data_system.decision_se)
$game_variables[5] = 500
$scene = Scene_Macro
when 5
$game_system.se_play($data_system.decision_se)
$game_variables[5] = 1000
$scene = Scene_Macro
end
return
end
end
end
the windows work fine, but then when i put the scene in as well i get an error.
script window_base line 17 no methoderror occured.
since i aint to used to scripting yet im sure there will be others.
edit.
taking out that end and putting it at the bottom worked, then i noticed a few other errors, sorted those out now and its working,