Needing help tweaking my first script (only causes a black screen) (RMXP)

hello! i have started to learn Ruby, so please be patient with me on this, i need help tweaking my script slightly, because when I use it, it causes no errors, just a black screen, So if anyone has the time, please feel free to help out when you can!

Spoiler: CODE
C++:
#==============================================================================
# ** Character
#------------------------------------------------------------------------------
#  This class represents a character with hunger, fear, and hallucination attributes.
#==============================================================================

class Character
  attr_accessor :hunger_meter, :fear_meter, :hallucination

  def initialize
    @hunger_meter = 100
    @fear_meter = 0
    @hallucination = false
  end
 
  def increase_hunger
    @hunger_meter += 1 unless @hunger_meter >= 100
  end
 
  def increase_fear
    @fear_meter += 1 if @hunger_meter <= 1
  end
 
  def trigger_hallucination
    if @fear_meter >= 50
      @hallucination = true
      # Play darkness audio
      Audio.bgs_play("Audio/BGS/018-Darkness01", 80, 100)
    else
      @hallucination = false
    end
  end
end

#==============================================================================
# ** Window_Meter
#------------------------------------------------------------------------------
#  This window displays the character's hunger, fear, and hallucination status.
#==============================================================================

class Window_Meter < Window_Base
  def initialize(character)
    super(0, 0, 160, 120)
    self.opacity = 0
    @character = character
    create_bitmap
    refresh
  end

  def create_bitmap
    @bitmap = Bitmap.new(width - 32, height - 32)
  end

  def refresh
    @bitmap.clear
    @bitmap.draw_text(0, 0, 100, 24, "Hunger: #{@character.hunger_meter}")
    @bitmap.draw_text(0, 24, 100, 24, "Fear: #{@character.fear_meter}")
    @bitmap.draw_text(0, 48, 160, 24, "Hallucination: #{@character.hallucination ? 'Yes' : 'No'}")
    self.contents = @bitmap
  end
end

#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================

class Scene_Map
  def main
    character = Character.new
    @meter_window = Window_Meter.new(character)
   
    loop do
      Graphics.update
      Input.update
      update
      @meter_window.refresh
      break unless $scene == self
    end
   
    Graphics.freeze
    @meter_window.dispose
  end
 
  def update
    # Your custom update logic goes here
  end
end
You must have deleted some default script then. Your script cannot be incompatible with the default scripts because the Character class never existed.
You must have deleted some default script then. Your script cannot be incompatible with the default scripts because the Character class never existed.
I see, how would i go about making this all work then? and no, all the default scripts are in my project so..
You've redefined Scene_Map's update method with an empty one, so maps are never going to do anything.

You've also replaced the scene's main method with one that doesn't do half the stuff the default one did, which doesn't make any more sense.
You've redefined Scene_Map's update method with an empty one, so maps are never going to do anything.

You've also replaced the scene's main method with one that doesn't do half the stuff the default one did, which doesn't make any more sense.
okay, instead of saying it doesn't make sense, can you help me understand why instead? like i said im new to scripting. Don't have to be harsh
You set your window's opacity to 0 when it should be 255.
You set your window's opacity to 0 when it should be 255.
ah, i see, i guess i type to fast for my own good, thanks.
okay, instead of saying it doesn't make sense, can you help me understand why instead? like i said im new to scripting. Don't have to be harsh
Sorry, I wasn't intending to be harsh there.

The original main method of Scene_Map:

Ruby:
def main
    # Make sprite set
    @spriteset = Spriteset_Map.new
    # Make message window
    @message_window = Window_Message.new
    # Transition run
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of sprite set
    @spriteset.dispose
    # Dispose of message window
    @message_window.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
  end

And its original update:
Ruby:
def update
    # Loop
    loop do
      # Update map, interpreter, and player order
      # (this update order is important for when conditions are fulfilled 
      # to run any event, and the player isn't provided the opportunity to
      # move in an instant)
      $game_map.update
      $game_system.map_interpreter.update
      $game_player.update
      # Update system (timer), screen
      $game_system.update
      $game_screen.update
      # Abort loop if player isn't place moving
      unless $game_temp.player_transferring
        break
      end
      # Run place move
      transfer_player
      # Abort loop if transition processing
      if $game_temp.transition_processing
        break
      end
    end
    # Update sprite set
    @spriteset.update
    # Update message window
    @message_window.update
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Change to title screen
      $scene = Scene_Title.new
      return
    end
    # If transition processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If showing message window
    if $game_temp.message_window_showing
      return
    end
    # If encounter list isn't empty, and encounter count is 0
    if $game_player.encounter_count == 0 and $game_map.encounter_list != []
      # If event is running or encounter is not forbidden
      unless $game_system.map_interpreter.running? or
             $game_system.encounter_disabled
        # Confirm troop
        n = rand($game_map.encounter_list.size)
        troop_id = $game_map.encounter_list[n]
        # If troop is valid
        if $data_troops[troop_id] != nil
          # Set battle calling flag
          $game_temp.battle_calling = true
          $game_temp.battle_troop_id = troop_id
          $game_temp.battle_can_escape = true
          $game_temp.battle_can_lose = false
          $game_temp.battle_proc = nil
        end
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # If event is running, or menu is not forbidden
      unless $game_system.map_interpreter.running? or
             $game_system.menu_disabled
        # Set menu calling flag or beep flag
        $game_temp.menu_calling = true
        $game_temp.menu_beep = true
      end
    end
    # If debug mode is ON and F9 key was pressed
    if $DEBUG and Input.press?(Input::F9)
      # Set debug calling flag
      $game_temp.debug_calling = true
    end
    # If player is not moving
    unless $game_player.moving?
      # Run calling of each screen
      if $game_temp.battle_calling
        call_battle
      elsif $game_temp.shop_calling
        call_shop
      elsif $game_temp.name_calling
        call_name
      elsif $game_temp.menu_calling
        call_menu
      elsif $game_temp.save_calling
        call_save
      elsif $game_temp.debug_calling
        call_debug
      end
    end
  end

Your rewrite of Scene_Map in your script is removing the creation of the spriteset and message window from main, and the entirety of update. So everything that was being done there isn't being done now.
Sorry, I wasn't intending to be harsh there.

The original main method of Scene_Map:

Ruby:
def main
    # Make sprite set
    @spriteset = Spriteset_Map.new
    # Make message window
    @message_window = Window_Message.new
    # Transition run
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of sprite set
    @spriteset.dispose
    # Dispose of message window
    @message_window.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
  end

And its original update:
Ruby:
def update
    # Loop
    loop do
      # Update map, interpreter, and player order
      # (this update order is important for when conditions are fulfilled
      # to run any event, and the player isn't provided the opportunity to
      # move in an instant)
      $game_map.update
      $game_system.map_interpreter.update
      $game_player.update
      # Update system (timer), screen
      $game_system.update
      $game_screen.update
      # Abort loop if player isn't place moving
      unless $game_temp.player_transferring
        break
      end
      # Run place move
      transfer_player
      # Abort loop if transition processing
      if $game_temp.transition_processing
        break
      end
    end
    # Update sprite set
    @spriteset.update
    # Update message window
    @message_window.update
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Change to title screen
      $scene = Scene_Title.new
      return
    end
    # If transition processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If showing message window
    if $game_temp.message_window_showing
      return
    end
    # If encounter list isn't empty, and encounter count is 0
    if $game_player.encounter_count == 0 and $game_map.encounter_list != []
      # If event is running or encounter is not forbidden
      unless $game_system.map_interpreter.running? or
             $game_system.encounter_disabled
        # Confirm troop
        n = rand($game_map.encounter_list.size)
        troop_id = $game_map.encounter_list[n]
        # If troop is valid
        if $data_troops[troop_id] != nil
          # Set battle calling flag
          $game_temp.battle_calling = true
          $game_temp.battle_troop_id = troop_id
          $game_temp.battle_can_escape = true
          $game_temp.battle_can_lose = false
          $game_temp.battle_proc = nil
        end
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # If event is running, or menu is not forbidden
      unless $game_system.map_interpreter.running? or
             $game_system.menu_disabled
        # Set menu calling flag or beep flag
        $game_temp.menu_calling = true
        $game_temp.menu_beep = true
      end
    end
    # If debug mode is ON and F9 key was pressed
    if $DEBUG and Input.press?(Input::F9)
      # Set debug calling flag
      $game_temp.debug_calling = true
    end
    # If player is not moving
    unless $game_player.moving?
      # Run calling of each screen
      if $game_temp.battle_calling
        call_battle
      elsif $game_temp.shop_calling
        call_shop
      elsif $game_temp.name_calling
        call_name
      elsif $game_temp.menu_calling
        call_menu
      elsif $game_temp.save_calling
        call_save
      elsif $game_temp.debug_calling
        call_debug
      end
    end
  end

Your rewrite of Scene_Map in your script is removing the creation of the spriteset and message window from main, and the entirety of update. So everything that was being done there isn't being done now.
i see, makes sense now, i guess ill keep figuring out how to re write this soon enough. thanks.
I don't know why I thought I had read your custom script in full. :eswt: So you DID modify Scene_Map class and that explains a lot here.

Before you make more changes to Scene_Map, learn how to use alias to prevent you from overwriting existing methods that have useful stuff like start or even the most basic of any scene's methods: main.

This is how you do alias a method:

Ruby:
alias old_method new_method
alias :old_method2 :new_method2

There's a third way to do it that other scripters use but not me. I just happen to find it more convoluted than those above.

You know what an alias is, a nickname or secret agent's name or a codename. Well, here it won't disguise a method's identity at all. It will just keep the access to the original method's contents and procedures.

Ruby:
def main
  # Your custom code
  old_main
  # More code
end

It's optional to add code ABOVE or BELOW the call to the aliased method. Yet, you can place your code in both locations if deemed necessary.

You can redefine a method the way you did in your original code, but it's not very convenient for patches or small additions to the default behavior. That's exactly how you realize you need to alias it. One of the methods you'd like to alias would be Scene_Map's start method.

Original thread: https://forums.rpgmakerweb.com/threads/needing-help-tweaking-my-first-script-only-causes-a-black-screen-rmxp.168653/