Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

script error

i have this script and I can't seem to find the error. I keep getting a syntax error on the last line of it (line 107). Please not that I did not write this script. It was written as an alternate for my mp3 player by Optimistshadow.
anyways, the script is as follows.....

Code:
class MP3_Case
  attr_accessor :contents
  def initialize
    @contents = []
  end
  
  def add_item(item_id)
    @contents += item_id
    return
  end
  
  def delete_item(item_id)
    for i in 0..@contents.size - 1
      if @contents[i] == item_id
        @contents.delete_at(i)
        return
      end
    end
    return
  end
end

class Scene_MP3
  def initialize
    $spriteset = Spriteset_Map.new
    @window_mp3 = Window_Command.new(160, $mp3_case.contents)
  end
  
  def main
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
    end
    Graphics.freeze
    $spriteset.dispose
    @window_mp3.dispose
  end
  
  def update
    $spriteset.update
    @window_mp3.update
    update_action
  end
  
  def update_action
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      $game_system.bgm_play("#{@window_mp3[@window_mp3.index]}.mp3")
      $scene = Scene_Map.new
    end
  end
end
      
class Scene_Title
  alias os_cng command_new_game
  def command_new_game
    $mp3_case = MP3_Case.new
    os_cng
  end
end

class Scene_Save
  alias os_wsd write_save_data
  def write_save_data(file)
    os_wsd
    Marshal.dump($mp3_case, file)
  end
end

class Scene_Load
  def read_save_data(file)
    # Read character data for drawing save file
    characters = Marshal.load(file)
    # Read frame count for measuring play time
    Graphics.frame_count = Marshal.load(file)
    # Read each type of game object
    $game_system        = Marshal.load(file)
    $game_switches      = Marshal.load(file)
    $game_variables     = Marshal.load(file)
    $game_self_switches = Marshal.load(file)
    $game_screen        = Marshal.load(file)
    $game_actors        = Marshal.load(file)
    $game_party         = Marshal.load(file)
    $game_troop         = Marshal.load(file)
    $game_map           = Marshal.load(file)
    $game_player        = Marshal.load(file)
    $mp3_case           = Marshal.load(file)
    # If magic number is different from when saving
    # (if editing was added with editor)
    if $game_system.magic_number != $data_system.magic_number
      # Load map
      $game_map.setup($game_map.map_id)
      $game_player.center($game_player.x, $game_player.y)
    end
    # Refresh party members
    $game_party.refresh
  end
end

Thanks for any and all help in advance.
 

khmp

Sponsor

Glad to help out. There's a lot of Silent Hill fans here so do them proud and as always signing off with...

Good luck with your game xgamexfreakx! :thumb:

Topic resolved!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top