Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: wolfspirit on December 05, 2009, 02:49:54 pm

Title: cmon you guys I need some help with this...
Post by: wolfspirit on December 05, 2009, 02:49:54 pm
Hiya,
I've created a little script, but it doesn't work proparly...
It should show the world map, and it does, but when I click on esc. it doesn't go back to the menu, so I've created a "Back" option, but still it doesn't work...
This is the script:
Spoiler: ShowHide
#==============================================================================
# ** World Map
#------------------------------------------------------------------------------
#  This wil show the world map
#==============================================================================

class World_Map
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
s1 = "Back"
s2 = "test"
   # Make command window
   @command_window = Window_Command.new(160, [s1, s2])
   Graphics.transition(0)
   Audio.se_play("Audio/SE/" + Wolfspirit::SE, 100)    
   @sprite = Sprite.new
   @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture4)
   Graphics.update
   Graphics.update
   Graphics.update  
   Graphics.update
   Graphics.update
   @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture5)
   Graphics.update
   Graphics.update
   Graphics.update
   Graphics.update  
   Graphics.update  
   @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture6)
   Graphics.update
   Graphics.update
   Graphics.update  
   Graphics.update
   Graphics.update
   @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture7)
       # Execute transition
   Graphics.transition
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Abort loop if screen is changed
     if $scene != self
       break
     end
   end
   # Prepare for transition
   Graphics.freeze
   # If switching to title screen
   if $scene.is_a?(Scene_Title)
     # Fade out screen
     Graphics.transition
     Graphics.freeze
   end
 def update_command
   # 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)
     # If command other than save or end game, and party members = 0
     if $game_party.actors.size == 0 and @command_window.index < 4
       # Play buzzer SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # Branch by command window cursor position
     case @command_window.index
     when 0  # item
       $scene = World_Map.new(false)
       # Play decision SE
       $game_system.se_play($data_system.cancel_se)
       # Switch to item screen
       $scene = Scene_Menu.new
     end
    end
   end
  end
end

Anyone who knows the problm?
Title: Re: Don't know what the probleme is...
Post by: fugibo on December 05, 2009, 09:33:45 pm
First off, you're updating the graphics about a billion times more than you should be.

But your problem is that you're not checking for Input inside the loop.
Title: Re: Don't know what the probleme is...
Post by: wolfspirit on December 06, 2009, 03:35:06 am
I used the graphics update that much cause I needed the pictures to look like a little animation.
(Its a map that opens)
And what you are saying about the input thingy, is this what you mean?:
Spoiler: ShowHide
  def update_command
    # 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)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end

or maybe this?:
Spoiler: ShowHide
# Update input information
      Input.update

Could you explain what I dit wrong or still have to do?
But... in verry clear language please, I'm not that good in scripting or... eh english :^_^':
Title: Re: Don't know what the probleme is...
Post by: fugibo on December 06, 2009, 09:16:30 am
The

loop do
  #stuff
  if $scene != self
    break
  end
end

loop. You're not doing anything in it, which is the problem. You have to check for input there. In other words, you'll have to add the update_command code/call there.
Title: Re: Don't know what the probleme is...
Post by: G_G on December 06, 2009, 10:00:53 am
Replace your loop with this
loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      update_command
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
Title: Re: Don't know what the probleme is...
Post by: wolfspirit on December 06, 2009, 10:38:42 am
Ok thanks for the help you guys, but I'm still getting errors :<_<:
I think I was getting this errors because I copied certain parts from other scripts...
I've deleted the stuff I thought they where cousing the errors, but I don't know what to write there instead. Maybe you guys know what I have to write there instead?
I'll put this
:ninja:
on every place I've been messing around.
Spoiler: ShowHide
#==============================================================================
# ** World Map
#------------------------------------------------------------------------------
#  This wil show the world map
#==============================================================================

class World_Map
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
s1 = "Back"
s2 = "test"
    # Make command window
    @command_window = Window_Command.new(160, [s1, s2])
    Graphics.transition(0)
    Audio.se_play("Audio/SE/" + Wolfspirit::SE, 100)   
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture4)
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update
    Graphics.update
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture5)
    Graphics.update
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update   
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture6)
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update
    Graphics.update
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture7)
        # Execute transition
    Graphics.transition
    # Main loop
     loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      update_command
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
        def update_command
       if Input.repeat?(Input::UP)
      if @command_window.index == 0
        @command_window.index = ? :ninja:
      else
        @command_window.index -= 1
      end
      unless @questids.size == 1
        $game_system.se_play($data_system.cursor_se) unless ? :ninja:
        @status_window.refresh
      end
      end
      if Input.repeat?(Input::DOWN)
      if @command_window.index == ? :ninja:
        @command_window.index = 0
      else
        @command_window.index += 1
      end
      unless ? :ninja:
        $game_system.se_play($data_system.cursor_se)
        @status_window.refresh
      end
      end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(5)
      return
    end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # Back
        $scene = World_Map.new(false)
        # Play decision SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to menu screen
        $scene = Scene_Menu.new
      end
     end
    end
  end

Title: Re: Don't know what the probleme is...
Post by: G_G on December 06, 2009, 11:23:24 am
replace this
if Input.repeat?(Input::UP)
      if @command_window.index == 0
        @command_window.index = ? :ninja:
      else
        @command_window.index -= 1
      end
      unless @questids.size == 1
        $game_system.se_play($data_system.cursor_se) unless ? :ninja:
        @status_window.refresh
      end
      end
      if Input.repeat?(Input::DOWN)
      if @command_window.index == ? :ninja:
        @command_window.index = 0
      else
        @command_window.index += 1
      end
      unless ? :ninja:
        $game_system.se_play($data_system.cursor_se)
        @status_window.refresh
      end

with
@command_window.update

You do not need to add the up and down movement of a window as it already has it.
Title: Re: Don't know what the probleme is...
Post by: wolfspirit on December 07, 2009, 01:26:45 pm
I'm close, I feel it.
I'm not getting any errors but when I click on "back" It doesn't do anything...
The code how it is right now:
#==============================================================================
# ** World Map
#------------------------------------------------------------------------------
#  This wil show the world map
#==============================================================================

class World_Map
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
s1 = "Back"
s2 = "test"
    # Make command window
    @command_window = Window_Command.new(160, [s1, s2])
    Graphics.transition(0)
    Audio.se_play("Audio/SE/" + Wolfspirit::SE, 100)   
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture4)
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update
    Graphics.update
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture5)
    Graphics.update
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update   
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture6)
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update
    Graphics.update
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture7)
        # Execute transition
    Graphics.transition
    # Main loop
     loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      @command_window.update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
        def update_command
      @command_window.update
      # Branch by command window cursor position
      case @command_window.index
      when 0  # Back
        $scene = World_Map.new(false)
        # Play decision SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to menu screen
        $scene = Scene_Menu.new
        return
      end
      return
    end
  end
end
Title: Re: Don't know what the probleme is...
Post by: G_G on December 07, 2009, 06:53:09 pm
#==============================================================================
# ** World Map
#------------------------------------------------------------------------------
#  This wil show the world map
#==============================================================================

class World_Map
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
s1 = "Back"
s2 = "test"
    # Make command window
    @command_window = Window_Command.new(160, [s1, s2])
    Graphics.transition(0)
    Audio.se_play("Audio/SE/" + Wolfspirit::SE, 100)   
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture4)
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update
    Graphics.update
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture5)
    Graphics.update
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update   
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture6)
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update
    Graphics.update
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture7)
        # Execute transition
    Graphics.transition
    # Main loop
     loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      update_command
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
        def update_command
      @command_window.update
      # Branch by command window cursor position
      case @command_window.index
      when 0  # Back
        $scene = World_Map.new(false)
        # Play decision SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to menu screen
        $scene = Scene_Menu.new
        return
      end
      return
    end
  end
end


There now try it
Title: Re: Don't know what the probleme is...
Post by: wolfspirit on December 08, 2009, 03:01:57 am
(http://img40.imageshack.us/img40/9268/78785233.png)
Dang...
Title: Re: Don't know what the probleme is...
Post by: wolfspirit on December 08, 2009, 03:08:37 pm
nobodhy's answering... :twitch:
Title: Re: Don't know what the probleme is...
Post by: fugibo on December 08, 2009, 06:31:10 pm
Post your entire script, please.
Title: Re: Don't know what the probleme is...
Post by: wolfspirit on December 09, 2009, 04:39:51 am
Game_guy has posted the editted version of my script how it 'chould' work.
(I know its a small script. :^_^': I'm not really a good scripter...)
Title: Re: Don't know what the probleme is...
Post by: wolfspirit on December 10, 2009, 07:08:58 am
 :wong: Bump
Title: Re: Don't know what the probleme is...
Post by: wolfspirit on December 16, 2009, 02:12:02 pm
Bump, and if you really need it, here's my script (again :P)
#==============================================================================
# ** World Map
#------------------------------------------------------------------------------
#  This wil show the world map
#==============================================================================

class World_Map
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
s1 = "Back"
    # Make command window
    @command_window = Window_Command.new(160, [s1])
    @command_window.x = 480
    @command_window.y = 0
    Graphics.transition(0)
    Audio.se_play("Audio/SE/" + Wolfspirit::SE, 100) 
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture4)
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update
    Graphics.update
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture5)
    Graphics.update
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update   
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture6)
    Graphics.update
    Graphics.update
    Graphics.update 
    Graphics.update
    Graphics.update
    @sprite.bitmap = RPG::Cache.picture(Wolfspirit::Picture7)
        # Execute transition
    Graphics.transition
    # Main loop
     loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      @command_window.update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @sprite.bitmap.dispose
    @sprite.dispose
    end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
        # 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_Menu.new(5)
      return
    end
      # Branch by command window cursor position
      case @command_window.update
      when 1  # Back
        # Play decision SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to menu screen
        $scene = Scene_Menu.new(5)
         return
      end
    return
  end
end
Title: Re: cmon you guys I need some help with this...
Post by: wolfspirit on December 23, 2009, 05:18:49 pm
BUMP! :sos:
Title: Re: cmon you guys I need some help with this...
Post by: wolfspirit on January 06, 2010, 12:37:36 pm
BUMP!! :<_<:
Title: Re: cmon you guys I need some help with this...
Post by: winkio on January 06, 2010, 05:52:01 pm
Look, this script is nowhere near close to being correct.  You have a better chance of posting a request and getting that filled than someone taking the time to fix the mountain of issues with this.
Title: Re: cmon you guys I need some help with this...
Post by: Blizzard on January 07, 2010, 03:01:12 am
Mountain? You mean mountain chain. :V:
Title: Re: cmon you guys I need some help with this...
Post by: wolfspirit on January 07, 2010, 11:53:18 am
Ergh... ok, so far for trying to script :(