Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: nathmatt on March 08, 2009, 08:29:05 am

Title: main menu help
Post by: nathmatt on March 08, 2009, 08:29:05 am
ok iv been working on a menu by updating the main 1 know i keep getting an game error saying i can report it then it crashes dont know y was wondering if it have something to to with my menu here is the code
Spoiler: ShowHide
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  #     menu_index
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  def main
    @window = Window_Command.new(90, ["Item", "Skills","Party", "Info", "Opitions", "File"])
    @window2 = Window_Command.new(90, [$data_system.words.item, $data_system.words.equip])
    @window3 = Window_Command.new(90, [$data_system.words.skill, "Skills"])
    @window4 = Window_Command.new(90, ["Replace", "Status",  "Behavior", "Triggers"])
    @window5 = Window_Command.new(90, ["Bestiary", "Quest"])
    @window6 = Window_Command.new(90, ["Load",  "Exit"])
    @window.x, @window.y, @window.back_opacity = 0, 80 , 160
    @window2.x, @window2.y, @window2.back_opacity, @window2.visible, @window2.active = 90, 80 , 160, false, false
    @window3.x, @window3.y, @window3.back_opacity, @window3.visible, @window3.active = 90, 80 , 160, false, false
    @window4.x, @window4.y, @window4.back_opacity, @window4.visible, @window4.active = 90, 80 , 160, false, false
    @window5.x, @window5.y, @window5.back_opacity, @window5.visible, @window5.active = 90, 80 , 160, false, false
    @window6.x, @window6.y, @window6.back_opacity, @window6.visible, @window6.active = 90, 80 , 160, false, false
    @spriteset = Spriteset_Map.new
    @bwindow, @bwindow.x, @bwindow.y, @bwindow.back_opacity = Window_Bottom.new, 0, 429, 160
    @swindow, @swindow.x, @swindow.y, @swindow.back_opacity =  Window_my_MenuStatus.new, 180, 80, 160
    @mwindow, @mwindow.x, @mwindow.y, @mwindow.opacity = Window_Main_Menu.new, 0, 0, 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @window.dispose
    @window2.dispose
    @window3.dispose
    @window4.dispose
    @window5.dispose
    @window6.dispose
    @mwindow.dispose
    @bwindow.dispose
    @swindow.dispose
  end
  #--------------------------------------------------------------------------
  def update
    @window.update
    @window2.update
    @window3.update
    @window4.update
    @window5.update
    @window6.update
    @bwindow.update
    @swindow.update
    @mwindow.update
    if @window.active
      update_command
      return
    end
    if @window2.active
      update_command2
      return
    end
    if @window3.active
      update_command3
      return
    end
    if @window4.active
      update_command4
      return
    end
    if @window5.active
      update_command5
      return
    end
    if @window6.active
      update_command6
      return
    end
    if @swindow.active
      update_status
      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 and @command_window.index < 4
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @window.index
      when 0 
        $game_system.se_play($data_system.decision_se)
        @window.active, @window2.visible, @window2.active, @window2.index = false, true , true, 0
      when 1
        $game_system.se_play($data_system.decision_se)
        @window.active, @window3.visible, @window3.active, @window3.index = false, true , true, 0
      when 2 
        $game_system.se_play($data_system.decision_se)
        @window.active, @window4.visible, @window4.active, @window2.index = false, true , true, 0
      when 3 
        $game_system.se_play($data_system.decision_se)
        @window.active, @window5.visible, @window5.active, @window5.index = false, true , true, 0
      when 4 
       $game_system.se_play($data_system.decision_se)
        $scene = Scene_Options.new
      when 5 
        @window.active, @window6.visible, @window6.active, @window6.index = false, true , true, 0
      end
      return
    end
  end
  #-------------------------------------------------------------------------------------
   def update_command2
   
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @window2.active, @window2.visible, @window.active, @window.index = false, false , true, 0
      return
    end
    if Input.trigger?(Input::C)
      case @window2.index
      when 0 
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new
      when 1 
        $game_system.se_play($data_system.decision_se)
        @window2.active, @swindow.active, @swindow.index = false, true, 0
        end
      return
    end
  end
#----------------------------------------------------------------------------------
def update_command3
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @window3.active, @window3.visible, @window.active, @window.index = false, false , true, 1
      return
    end
    if Input.trigger?(Input::C)
      case @window3.index
      when 0 
        $game_system.se_play($data_system.decision_se)
        @window3.active, @swindow.active, @swindow.index = false, true, 0
      when 1 
        $game_system.se_play($data_system.decision_se)
        #skills
        end
      return
    end
  end
  #-------------------------------------------------------------------------------------------------
  def update_command4
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @window4.active, @window4.visible, @window.active, @window.index = false, false , true, 2
      return
    end
    if Input.trigger?(Input::C)
      case @window4.index
      when 0
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_PartySwitcher.new(1)
      when 1 
        $game_system.se_play($data_system.decision_se)
         @window4.active, swindow.active, @swindow.index = false, true, 0
      when 2
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_AI_Behavior.new
      when 3
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_AI_Triggers.new
          end
      return
    end
  end
  #--------------------------------------------------------------------------------------------------
   def update_command5
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @window5.active, @window5.visible, @window.active, @window.index = false, false , true, 3
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.actors.size == 0 and @command_window.index < 4
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @window5.index
      when 0
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Bestiary.new
      when 1
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Questbook.new($scene)
        end
      return
    end
  end
  #------------------------------------------------------------------------------------------
  def update_command6
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @window6.active, @window6.visible, @window.active, @window.index = false, false , true, 5
      return
    end
    if Input.trigger?(Input::C)
      case @window6.index
      when 0 
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Load2.new
      when 1
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_End.new
        end
      return
    end
  end
  #--------------------------------------------------------------------------
  def update_status
    if  @window2.visible == true
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @window2.active, @swindow.active, @swindow.index = true, false, -1
      return
    end
    if Input.trigger?(Input::C)
      case @window2.index
      when 1 
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Equip.new(@swindow.index)
        end
      return
    end
  end
  #-----------------------------------------------------------------------------------------
    if  @window3.visible == true
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @window3.active, @swindow.active, @swindow.index = true, false, -1
      return
    end
    if Input.trigger?(Input::C)
      case @window3.index
        when 0 
        $game_system.se_play($data_system.decision_se)
       $scene = Scene_Skill.new(@swindow.index)
      when 1 
        $game_system.se_play($data_system.decision_se)
        ## skills #############
      end
      return
    end
  end
  #----------------------------------------------------------------------------------------------
   if  @window4.visible == true
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @window4.active, @swindow.active, @swindow.index = true, false, -1
      return
    end
    if Input.trigger?(Input::C)
      case @window4.index
        when 1 
        $game_system.se_play($data_system.decision_se)
       $scene = Scene_Status.new(@swindow.index)
      end
      return
    end
   end
  end
end
#==============================================================================
# ■ Window_MenuStatus
#-----------------------------------------------------------------------------
class Window_my_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 460, 350)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = 15
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 54
      y = i * 80
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 40, y + 50)
      draw_actor_name(actor, x, y - 10)
      draw_actor_level(actor, x, y + 10)
      draw_actor_exp(actor, x, y + 34)
      draw_actor_hp(actor, x + 236, y + 2)
      draw_actor_sp(actor, x + 236, y + 34)
    end
  end
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
    end
  end
end
#==============================================================================
# ■ Window_Bottom
#------------------------------------------------------------------------------
class Window_Bottom < Window_Base
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 50)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 15
    refresh
  end
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(340, - 10, 120, 32, "Play Time")
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    text = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.font.color = normal_color
    self.contents.draw_text(350, -10, 120, 32, text, 2)
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(480, - 10, 120-cx-2, 32, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(600-cx, - 10, cx, 32, $data_system.words.gold, 2)
  end
  #--------------------------------------------------------------------------
  def update
    super
    if Graphics.frame_count / Graphics.frame_rate != @total_sec
      refresh
    end
  end
end
#==============================================================================
# ■ Window_Main_menu
#-----------------------------------------------------------------------------

class Window_Main_Menu < Window_Base
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 40
    refresh
  end
  #--------------------------------------------------------------------------
  def refresh

    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(40, 0, 120, 32, "Main Menu", 2)
  end
end
Title: Re: main menu help
Post by: fugibo on March 08, 2009, 08:39:12 am
1) Give us the error, please

2) I'm sorry, but that's some of the messiest, unusable code I've ever seen. Look at my (ancient) Enhanced DMS on this forum if you want to see a simple implementation of some advanced features. Everything is commented out for you, I believe, and it's only ~450 lines IIRC.
Title: Re: main menu help
Post by: nathmatt on March 08, 2009, 03:29:14 pm
heres the pick of the error

Spoiler: ShowHide
(http://i184.photobucket.com/albums/x287/nathmatt/NewBitmapImage2-1.jpg)
Title: Re: main menu help
Post by: Landith on March 08, 2009, 03:35:57 pm
That has nothing to do with your script >.>

Are you using PKE?
Title: Re: main menu help
Post by: nathmatt on March 08, 2009, 03:42:24 pm
yea
Title: Re: main menu help
Post by: Landith on March 08, 2009, 03:54:56 pm
Yeah, thought so.
That's a common error with PKE I would suggest to try and get the real version to prevent that.
Otherwise, I think you need to save then restart your computer and try opening it again and if it still doesn't work then try and open up the game.exe instead of the game.rgproject. The orange icon.
Title: Re: main menu help
Post by: Tazero on March 09, 2009, 02:58:11 pm
Can't you replace the dll or something? :huh:
Title: Re: main menu help
Post by: Jackolas on March 09, 2009, 05:21:59 pm
nope.. u need to replace every basic script... the dll
and change some stuff in the core... the last 1 is the hard (almost impossible) 1
Title: Re: main menu help
Post by: fugibo on March 09, 2009, 08:13:23 pm
Or crack the full version. I "know" a guy who did it twice. Unfortunately, I can't remember where to find it :/

I do know that you have to replace one of the .dll's; I think it has PS in its name.
Title: Re: main menu help
Post by: G_G on March 09, 2009, 08:38:36 pm
*cough*use a keygen*cough* *coughs again* search rpg maker xp keygen on youtube then use it on full version *coughs again*
Title: Re: main menu help
Post by: Jackolas on March 09, 2009, 08:43:55 pm
ore more easy... just buy it.
Title: Re: main menu help
Post by: fugibo on March 09, 2009, 08:45:29 pm
Or more cheap.... follow our advice ;)
Title: Re: main menu help
Post by: G_G on March 09, 2009, 08:50:29 pm
*cough*yes save 60.00*cough*
Title: Re: main menu help
Post by: Blizzard on March 10, 2009, 03:17:47 am
If you like the program, buy it.
Title: Re: main menu help
Post by: Landith on March 10, 2009, 06:59:48 pm
I agree, it's better to have a program legally, *cough*not illegally.*cough*

But if you can't buy it, like financially troubled, then I suggest what G_G said, although you can download the trial for free.