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.

[FILLED] Easiest fucking menu ever.

First off, this is Despain. I'm on a secondary account because I was accidentally banned (and yes- it was accidentaly. The warning system is glitched and added instead of subtracting).

Now that that's cleared up, this is for my Two Week Game contest entry. Ah, yes. That's why I don't want to wait until my real account is unbanned.

It's really fucking simple- take a look.

http://img222.imageshack.us/img222/1896 ... bledn6.png[/img]

Displays the gold, the game's level (the number determined by a variable, please). Then there's three options: items, which calls the item menu, roster, which calls a common event, and exit, which returns to the game and backs out of the menu.

Should be really easy. And as I said, this is for the contest, so I need it as soon as possible. Of course you'll be credited, and if I win the contest, in which the prize is twenty dollars, I'll throw you a few of them through paypal.

Thanks.
 
I would do this, but I don't know how to make the Command Window horizantal.
Are there any other menus that use a horizntal menu?

Edit:

I don't want anything in return, this would take 5 sec with my Wizard.
 
My turn. Demo here(FIXED),
Code:
#--------------------------------------------------------------------------
# Window
#--------------------------------------------------------------------------
class Window_PreMenu < Window_Selectable
  def initialize(x, y, w, h)
    super(x, y, w, h)
    @item_max = 3
    @column_max = 3
    @index = 0
    self.active = true
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  def update_cursor_rect
    super
    tx = self.cursor_rect.x - 8
    ty = self.cursor_rect.y - 8
    tw = self.cursor_rect.width + 16
    th = 32
    self.cursor_rect.set(tx, ty, tw, th)
  end
end

#--------------------------------------------------------------------------
# Scene
#--------------------------------------------------------------------------
class Scene_PreMenu
  # Initialize it with the variable ID and the Common Event ID.
  # You can even define the font and the color used to draw
  # the texts.
  def initialize(var_id=0,ce_id=0, font=Font.new("Tahoma",16), color=Color.new(0,0,0))
    @variable_id = var_id
    @common_event_id = ce_id
    @font = font
    @font.color = color
    @font.bold = true
  end
  #--------------------------------------------------------------------------
  def main
    @effect_close = false
    @common_event = nil
    @effect_resize_progress = 1
    @effect_resize_rate = 4
    @spriteset = Spriteset_Map.new
    
    iw, ih = 320, 100
    iy = $game_player.screen_y - (ih + 32)
    ix = $game_player.screen_x - (iw / 2)
    ix = 0 if ix < 0
    ix = 640-iw if ix+iw > 640
    iy = 0 if iy < 0
    iy = 480-ih if iy+ih > 480
    
    @info_window = Window_Base.new(ix, iy, iw, 1)
    @command_window = Window_PreMenu.new(ix, iy+52, iw, 1)
    @info_window.contents = Bitmap.new(iw-32,16)
    @info_window.contents.font = @font
    @info_window.contents.draw_text(0,0,iw-32,16,"Gold: " + $game_party.gold.to_s)
    @info_window.contents.draw_text(0,0,iw-32,16,"Level: " + $game_variables[@variable_id].to_s, 2)
    @command_window.contents = Bitmap.new(iw-32,16)
    @command_window.contents.font = @font
    @command_window.contents.draw_text(-8,0,96,16,"Items",1)
    @command_window.contents.draw_text(96,0,96,16,"Roster",1)
    @command_window.contents.draw_text(200,0,96,16,"Exit",1)
    
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    
    Graphics.freeze
    @spriteset.dispose
    @info_window.dispose
    @command_window.dispose
  end
  #--------------------------------------------------------------------------
  def update
    @spriteset.update
    @info_window.update
    @command_window.update
    update_command
    update_effects
  end
  #--------------------------------------------------------------------------
  def update_effects
    if @effect_resize_progress == 1
      if @info_window.height >= 48
        @info_window.height = 48
        @effect_resize_progress = 0
        @command_window.height = @info_window.height
        $scene = Scene_Map.new if @effect_close
      else
        @info_window.height += 48 / (Graphics.frame_rate/@effect_resize_rate)
        @command_window.height = @info_window.height
      end
    elsif @effect_resize_progress == -1
      if @info_window.height <= 0
        @effect_resize_progress = 0
        @command_window.height = @info_window.height
        $scene = Scene_Map.new if @effect_close
      else
        @info_window.height -= 48 / (Graphics.frame_rate/@effect_resize_rate)
        @command_window.height = @info_window.height
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_command
    return if @effect_close
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      # Taken off the effect for skipping with the ESC key.
      # If you want it dis-comment the below lines and define
      # $scene = Scene_Map.new
      #@effect_resize_progress = -1
      #@effect_close = true
      $scene = Scene_Menu.new
      return
    end
    
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0  # Action taken when: Items
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new(1)
      when 1  # Action taken when: Roster
        $game_system.se_play($data_system.decision_se)
        $game_temp.common_event_id = @common_event_id
        @effect_resize_progress = -1
        @effect_close = true
      when 2  # Action taken when: Back
        $game_system.se_play($data_system.cancel_se)
        @effect_resize_progress = -1
        @effect_close = true
      end
      return
    end
  end
end

#--------------------------------------------------------------------------
# Updates (Just for testing issues)
#--------------------------------------------------------------------------
class Scene_Map
  def call_menu
    $game_temp.menu_calling = false
    if $game_temp.menu_beep
      $game_system.se_play($data_system.decision_se)
      $game_temp.menu_beep = false
    end
    $game_player.straighten
    $scene = Scene_PreMenu.new
  end
end

#--------------------------------------------------------------------------
# Updates (Just for testing issues)
#--------------------------------------------------------------------------
class Scene_Item
  def initialize(last=0)
    @last_scene = last
  end
  #--------------------------------------------------------------------------
  def update_item
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      if @last_scene == 0
        $scene = Scene_Menu.new(0)
      else
        $scene = Scene_PreMenu.new
      end
      return
    end
    if Input.trigger?(Input::C)
      @item = @item_window.item
      unless @item.is_a?(RPG::Item)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      unless $game_party.item_can_use?(@item.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      if @item.scope >= 3
        @item_window.active = false
        @target_window.x = (@item_window.index + 1) % 2 * 304
        @target_window.visible = true
        @target_window.active = true
        if @item.scope == 4 || @item.scope == 6
          @target_window.index = -1
        else
          @target_window.index = 0
        end
      else
        if @item.common_event_id > 0
          $game_temp.common_event_id = @item.common_event_id
          $game_system.se_play(@item.menu_se)
          if @item.consumable
            $game_party.lose_item(@item.id, 1)
            @item_window.draw_item(@item_window.index)
          end
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
end

The script is very straightforward. Just copy and paste it above main and below the default scripts, and if you want to know more about it, take a look at the comments. It´s ready to use if you want to use this as a new menu. And, lastly, i think you´re smart enough to not make your game starting from this demo ^^
 
How about that?
Code:
module Despain
  GOLD_ID = 1   # Id of the varaible for the gold
  LEVEL_ID = 2  # Id of the varaible for the level
  COMMON_EVENT_ID = 1 # Id of the common event
end

class Scene_Menu
  def main
    @spriteset = Spriteset_Map.new
    @window_detail = Window_Details.new
    @window_choose = Window_Choose.new
    Graphics.transition
    # Main loop
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @spriteset.dispose
    @window_detail.dispose
    @window_choose.dispose
  end
  
  def update
    @spriteset.update
    @window_choose.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      case @window_choose.index
      when 0
        $scene = Scene_Item.new
      when 1
        $scene = Scene_Map.new
        $game_temp.common_event_id = Despain::COMMON_EVENT_ID
      when 2
        $scene = Scene_Map.new
      end
    end
  end
  
end

class Window_Details < Window_Base
  def initialize
    super (120, 176, 400, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  
  def refresh
    self.contents.clear
    self.contents.draw_text(4, 0, 256, 32, "Gold: #{$game_variables[Despain::GOLD_ID]}")
    self.contents.draw_text(4, 0, 336, 32, "Level: #{$game_variables[Despain::LEVEL_ID]}", 2)
  end
  
end

class Window_Choose < Window_Selectable
  def initialize 
    super(120, 240, 400, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.active = true
    self.index = 0
    @column_max = 3
    @item_max = 3
    refresh
  end
  
  def refresh
    self.contents.clear
    self.contents.draw_text(4, 0, 85, 32, $data_system.words.item, 1)
    self.contents.draw_text(137, 0, 85, 32, "Roster", 1)
    self.contents.draw_text(264, 0, 85, 32, "Exit", 1)
  end
  
  def update_cursor_rect
    self.cursor_rect.set(4 + @index * 133, 0, 85, 32)
  end
  
end

Edit:
Seems like Linkin_T was faster than me. :P
 
? I don't want anything in return. I just did it because I'm bored...

Anyways, here is mine;
Delete the Default Menu that comes with RMXP, It might cause problems.
Code:
#==============================================================================
# Scene_Menu
#==============================================================================
COMMON_EVENTID = 1 #ID of the Common Event
class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main - Handles drawing/disposing windows and the main loop 
  #--------------------------------------------------------------------------
  def main
    #Draw Windows
    main_draw
    #Execute transition
    Graphics.transition
    #Main Loop
    loop do
      #Main Loop
      main_loop
      break if main_scenechange?
    end
    #Prepare for transition
    Graphics.freeze
    #Dispose Windows
    main_dispose
  end
  #--------------------------------------------------------------------------
  # * Main Draw - Handles drawing windows
  #--------------------------------------------------------------------------
  def main_draw
    # Draw Windows
    # Draw Background
    @background = Spriteset_Map.new
    # Command_window
    @command_window = Window_MenuCommand.new
    # Info_window
    @info_window = Info_window.new
  end
  #--------------------------------------------------------------------------
  # * Main Scene Change 
  #--------------------------------------------------------------------------
  def main_scenechange?
    # Abort loop if screen is changed
    return true if $scene != self
    return false
  end
  #--------------------------------------------------------------------------
  # * Main Dispose 
  #--------------------------------------------------------------------------
  def main_dispose
    # Dispose All Windows
    # Dispose Background
    @background.dispose
    # Dispose Command_window
    @command_window.dispose
    # Dispose Info_window
    @info_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Main Loop 
  #--------------------------------------------------------------------------
  def main_loop
    # Update game screen
    Graphics.update
    # Update input information
    Input.update
    # Frame update
    update
  end
  #--------------------------------------------------------------------------
  # * Update 
  #--------------------------------------------------------------------------
  def update
    # Update Windows
    update_windows
    #Update Menu
    update_menucommand
  end
  #--------------------------------------------------------------------------
  # * Update Menu Command
  #--------------------------------------------------------------------------
  def update_menucommand
    # 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
    return if !Input.trigger?(Input::C)
    # Branch by command window cursor position
    case @command_window.index
    when 0 #Item
      $scene = Scene_Item.new
    when 1 #Rooster
      $scene = Scene_Map.new
      # Command event call reservation
      $game_temp.common_event_id = COMMON_EVENTID
    when 2 #Exit
      $scene = Scene_Map.new
    end
  end
  #--------------------------------------------------------------------------
  # * Window Update 
  #--------------------------------------------------------------------------
  def update_windows
    # Update Command_window
    @command_window.update if @command_window.visible
    # Update Info_window
    @info_window.update if @info_window.visible
    #Update Background
    @background.update
  end
end

#==============================================================================
# Info_window
#==============================================================================
class Info_window < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization 
  #--------------------------------------------------------------------------
  def initialize
    super(126, 141, 390, 44)
    #Create Bitmap
    self.contents = Bitmap.new(width - 32, height - 32)
    #Z-Pos
    self.z = 100
    #Refresh and add the contents to window
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh 
  #--------------------------------------------------------------------------
  def refresh
    #Clear Bitmap
    self.contents.clear
    #Get Font Size
    self.contents.font.size = 19
    #Draw Gold Text
    cx = contents.text_size("Gold: ").width
    self.contents.draw_text(9, -9, cx, 32, "Gold: ")
    #Draw Gold
    self.contents.draw_text(54, -9, 32, 32, $game_party.gold.to_s)
    #Draw Level Text
    cx = contents.text_size("Level: ").width
    self.contents.draw_text(277, -9, cx, 32, "Level: ")
    #Draw Level
    actor = $game_party.actors[0]
    self.contents.draw_text(333, -9, 45, 32, actor.level.to_s)
  end
end
#==============================================================================
# ** Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(127, 187, 390, 44)
    self.contents = Bitmap.new(width - 32, height - 32)
    #Get commands
    @commands = ["Item", "Roster", "Exit"]
    @item_max = 3
    @column_max = 2
    #Get Font Size
    self.contents.font.size = 19
    #Draw Text
    draw_item(0, normal_color)
    draw_item(1, normal_color)
    draw_item(2, normal_color)
    #Do Index
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #     color : text character color
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(index * 130 - 10, -9, 128 - 10, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index], 1)
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    self.cursor_rect.set(index * 130, -9, 100, 32)
  end
end
 
Jeez, I made a joke -.- Those are less than 20 bucks, you could go out on the streets, screaming out that you lost your mother and you'd get 200 bucks that way... without having to do a WS, though ^_^
 
I would have jumped on the train to, because he said it himself "easy fucking request."

Any moderate scripter could do it in about 20 mintues tops. :P

But the design is also nice, so that helps as well.


If everyone asked for such simple scripts, said what they wanted clearly, throw in a screen, and offered cash prize, even a little, you would see [FILLED] alot in this sub-forum. Despain does do a good job asking for simple things well (as aposed to "give me a mario cart script").
 

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