Compact Menu Add-on

0 Members and 1 Guest are viewing this topic.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Zero to Hero2014 Best IRC Quote2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Compact Menu
Version: 1.0
Author: Pacman
Date: 22nd August, 2011

Version History


  • <Version 1.0> 2011.08.22 - Original Release

Planned Future Versions

  • Whatever anyone wants...

Description


I was thinking, "the PAC menu has a pretty dang cool set-up, but not much to show. I need to write some visual parts to the menu". Then I remembered that not every dang command requires actor selection, and people like moving things and easy configuration. So, I decided I would write a cool add-on for the PAC menu that does that: centers the command window, moves it to the side upon actor selection and has a toggle feature for the gold window. And then I did.
Then I realized it worked standalone as well. And here we are now.

Features

  • Compact menu design
  • Centered command window (accounts for gold window when open)
  • Moving windows! Everyone loves those
  • Open and close gold window with a button
  • Determine how fast the windows move
  • Determine where the status window is placed, and where the command window moves to

Screenshots

Too lazy. It's plug-and-play, really.

Instructions

You should place this script as close to the bottom of your script list as you can (but still above Main). There are indeed further instructions in the script.

Script


Code: [Select]
#===============================================================================
#
# Compact Menu System
# 22/8/2011 - Pacman
# Paste above main and below any scripts that alter the menu. This script was
# first intended for usage with PAC Main Menu, but it works perfectly fine
# standalone.
# Edit the configuration module as you see fit below. I think I've explained
# everything pretty thoroughly.
#
#===============================================================================

module PAC
  module MM
   
    # Pixels per frame the windows move (number)
    COMPACT_SCROLL_SPEED = 4
    # Direction the command window will move to when actor selection begins
    # (:left / :right)
    COMPACT_SELECTION = :right
    # Button to toggle gold window visibility (Input::Button)
    GOLD_BUTTON = Input::L
    # Start scene with gold window visible? (true / false)
    START_GOLD_WINDOW = true
  end
end

#===============================================================================
#
# Why would you even think about editing this?
#
#===============================================================================

$imported = {} unless $imported
$imported["PAC Compact Menu"] = true

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # Include configuration data
  #--------------------------------------------------------------------------
  include PAC::MM
  #--------------------------------------------------------------------------
  # Alias listing
  #--------------------------------------------------------------------------
  alias pac_compact_start start
  alias pac_compact_start_actor_selection start_actor_selection
  alias pac_compact_end_actor_selection end_actor_selection
  alias pac_compact_update update
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    pac_compact_start
    pac_compact_windows
  end
  #--------------------------------------------------------------------------
  # * Make Windows Compact
  #--------------------------------------------------------------------------
  def pac_compact_windows
    @command_window.x = Graphics.width / 2 - @command_window.width / 2
    @gold_window.visible = START_GOLD_WINDOW
    @gold_window.x = @command_window.x
    @gold_window.openness = START_GOLD_WINDOW ? 255 : 0
    @status_window.x = case COMPACT_SELECTION
    when :left then Graphics.width - @status_window.width
    when :right then 0
    end
    @status_window.visible = false
    @status_window.openness = 0
    if @gold_window.visible
      @command_window.y = Graphics.height / 2 - (@command_window.height +
      @gold_window.height) / 2
    else
      @command_window.y = Graphics.height / 2 - @command_window.height / 2
    end
    @gold_window.y = @command_window.y + @command_window.height
    @check_x = @command_window.x
  end
  #--------------------------------------------------------------------------
  # * Start Actor Selection
  #--------------------------------------------------------------------------
  def start_actor_selection
    @status_window.visible = true
    check = case COMPACT_SELECTION
    when :left then 0
    when :right then Graphics.width - @command_window.width
    end
    begin
      @command_window.x -= case COMPACT_SELECTION
      when :left then COMPACT_SCROLL_SPEED
      when :right then -COMPACT_SCROLL_SPEED
      end
      @gold_window.x = @command_window.x
      Graphics.update
    end until @command_window.x == check
    @status_window.open
    begin
      @status_window.update
      Graphics.update
    end until @status_window.openness == 255
    pac_compact_start_actor_selection
  end
  #--------------------------------------------------------------------------
  # * End Actor Selection
  #--------------------------------------------------------------------------
  def end_actor_selection
    pac_compact_end_actor_selection
    @status_window.close
    begin
      @status_window.update
      Graphics.update
    end until @status_window.openness == 0
    @status_window.visible = false
    begin
      unless @command_window.x == @check_x
        @command_window.x += case COMPACT_SELECTION
        when :left then COMPACT_SCROLL_SPEED
        when :right then -COMPACT_SCROLL_SPEED
        end
      end
      @gold_window.x = @command_window.x
      Graphics.update
    end until @command_window.x == @check_x
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    pac_compact_update
    update_gold_visible
  end
  #--------------------------------------------------------------------------
  # * Update Visibility of Gold Window (and scroll to cater)
  #--------------------------------------------------------------------------
  def update_gold_visible
    @gold_window.x = @command_window.x if @gold_window.x != @command_window.x
    if Input.trigger?(GOLD_BUTTON)
      Sound.play_decision
      if @gold_window.visible
        @gold_window.close
        begin
          @gold_window.update
          Graphics.update
        end until @gold_window.openness == 0
        @gold_window.visible = false
        begin
          @command_window.y += COMPACT_SCROLL_SPEED
          @command_window.update
          Graphics.update
        end until @command_window.y == Graphics.height / 2 -
         @command_window.height / 2
       else
        begin
          @command_window.y -= COMPACT_SCROLL_SPEED
          @command_window.update
          Graphics.update
        end until @command_window.y == Graphics.height / 2 -
         (@command_window.height + @gold_window.height) / 2
        @gold_window.visible = true
        @gold_window.open
        begin
          @gold_window.update
          Graphics.update
        end until @gold_window.openness == 255
      end
    end
  end
end

Credit


  • Pacman

Thanks

  • Modern Algebra, I suppose. I think he made a script like this that I might've remembered sub-consciously...

Support


Post here. No matter how old you are the topic is. If you want help with an incompatibility error, post the conflicting scripts(s), tell me what the error is and the order of your scripts.

Known Compatibility Issues

Probably won't work with graphical CMSes, but why would you use two?
That is the only case this would be incompatible; of the 6 methods edited, 4 are aliased and 2 are new. This means it'll go well anywhere in the materials section of the editor, but would work best near the bottom so as to avoid overwritten methods.

Author's Notes


This doesn't have much to offer in the data side of a Menu System, so I recommend a script to go with this. I suggest something that isn't graphically based, like the current version of PAC MM, but this graphics system is going to be implemented into that anyway... eventually...

Restrictions

Non-commercial: credit me and we're cool. Commercial: PM me or post here. We'll negotiate.