Well, I was wondering if the advanced scripters can help me with this messy code, I Think is too big, and too dirty... (I haven't put comments yet), what do you think?, a tip, an advice?.. something?.
The code
Thanks for your time.
The code
Code:
class Scene_Fish_Equipment < SDK::Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize
super()
end
#--------------------------------------------------------------------------
# * Main Sprite_Set
#--------------------------------------------------------------------------
def main_spriteset
# Sets Up Spriteset
@spriteset = Spriteset_Map.new
end
#--------------------------------------------------------------------------
# * Main Processing : Window Initialization
#--------------------------------------------------------------------------
def main_window
super
@fishing_items = Window_Fishing_Items.new
@fishing_equipment = Window_Fishing_Equipment.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.set_text('Equipa tu Caña de Pescar y pon una Carnada', 1)
@item_help = Window_Help.new
@item_help.x = @fishing_equipment.x
@item_help.y = @fishing_equipment.y - 64
@item_help.width = 256
@item_help.contents = Bitmap.new(@item_help.width - 32, 32)
@item_help.back_opacity = 160
@fishing_items.help_window = @item_help
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the item window
@item = @fishing_items.item
# If Item at Cursor Position is nil
if @item.nil?
# Play Buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
if @item.element_set.include?(Fishing::Equipment_Elements['Rods'][0])
unless $game_party.fishing_level >= Fishing::Rod_Required_Level[@item.id]
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.equip_se)
$game_party.equipped_rod = @item.id
unless $game_party.equipped_rod_bait == 0
$game_party.gain_item($game_party.equipped_rod_bait, 1)
$game_party.equipped_rod_bait = 0
end
@fishing_items.refresh
@fishing_equipment.refresh
return
end
if @item.element_set.include?(Fishing::Equipment_Elements['Baits'][0])
unless $game_party.equipped_rod != 0
$game_system.se_play($data_system.buzzer_se)
return
end
unless Fishing::Rod_Baits[$game_party.equipped_rod].include?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
# Play Equip SE
$game_system.se_play($data_system.equip_se)
unless $game_party.equipped_rod_bait == 0
$game_party.gain_item($game_party.equipped_rod_bait, 1)
end
$game_party.equipped_rod_bait = @item.id
$game_party.lose_item(@item.id, 1)
@fishing_items.refresh
@fishing_equipment.refresh
return
end
return
end
# If X button was pressed
if Input.trigger?(Input::X)
if $game_party.equipped_rod == 0
# Play Buzzer SE
$game_system.se_play($data_system.buzzer_se)
else
# Play Equip SE
$game_system.se_play($data_system.equip_se)
$game_party.equipped_rod = 0
if $game_party.equipped_rod_bait != 0
$game_party.gain_item($game_party.equipped_rod_bait, 1)
$game_party.equipped_rod_bait = 0
@fishing_items.refresh
end
@fishing_equipment.refresh
end
return
end
# If Y button was pressed
if Input.trigger?(Input::Y)
if $game_party.equipped_rod_bait == 0
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.equip_se)
$game_party.gain_item($game_party.equipped_rod_bait, 1)
$game_party.equipped_rod_bait = 0
@fishing_items.refresh
@fishing_equipment.refresh
end
return
end
end
end
Thanks for your time.