Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - AngryPacman

1
Sea of Code / A Challenge!
January 15, 2012, 10:34:24 am
My brother and I stumbled across something interesting whilst playing around with wolfram between watching Digimon and gaining weight. For some reason we got onto square roots of 2 to power x. I noticed that when x is even, then result is always whole, and when x is odd, the result is always the same as x-1, multiplied by sqrt(2). I also noticed that the whole number in the result doubles with every even number x. To illustrate what I'm saying...
sqrt(2^0) = 1 -> As 2^0 = 1.
sqrt(2^1) = 1 * sqrt(2) -> Previous result multiplied by sqrt(2)
sqrt(2^2) = 2 -> Original result (1) doubled.
sqrt(2^3) = 2 * sqrt(2) -> Previous result multiplied by sqrt(2)
sqrt(2^4) = 4 -> Last whole number result (2) doubled.
sqrt(2^5) = 4 * sqrt(2) -> Previous result multiplied by sqrt(2)
sqrt(2^6) = 8 -> Last whole number result (4) doubled.
sqrt(2^7) = 8 * sqrt(2) -> Previous result multiplied by sqrt(2)
And so on in that fashion. I'm not surprised by this, but I found it intriguing, and I'm almost certainly not the first one to find it (but I've never seen it before). My brother, however, was really fascinated and challenged me to write a little formula to calculate the result of sqrt(2^n). I've decided to take him up on that and try and write it in Ruby.
The first thing I realized I had to do was determine if n was even or odd. Easy stuff there (i = n % 2), no problem. The easy part is the even formula. That's still pretty easy (x = Math.sqrt(2 ** n)).
The part that stumped me a bit was the odd formula, but I figured out eventually, whilst typing this topic, so it's actually kinda pointless because I was going to ask for help but now I don't need it.  :facepalm: I ended up going with x = Math.sqrt(2 ** (n - 1)) * Math.sqrt(2), but any improvements would be accepted before I rub my brother's face in this relatively simple fomula.
Here's the method:
def whocares(n)
  i = n % 2
  if i == 0
    x = Math.sqrt(2 ** n)
  elsif i == 1
    x = Math.sqrt(2 ** (n - 1))
    x = x.to_s + (" root 2") # Or x *= Math.sqrt(2)
  end
  return x
end

Does anyone know anything about this formula? Is it famous and I'm just stupid? Are there any improvements that could be done?

Anyway, thanks for being a sound board without even knowing it. I just happened to solve this pretty simple problem too soon.  :facepalm: I'mma post this anyway.
2
RMVX Script Database / [VX] Item Cap
January 03, 2012, 09:06:43 am
Item Cap
Authors: Pacman
Version: 2.3
Type: Individual Item Cap System
Key Term: Player / Party / Troop Add-on



Introduction

There are quite a few scripts that serve a similar purpose to this one, but to my knowledge this is the only one that does this specifically: gives each item, weapon or armor it's own possession cap, that is displayed in shop, equip and item screens. You can also set (and change in-game) the maximum amount of gold attainable. You can also now set certain items to not have their cap drawn in the windows.


Features


  • Notebox tag for setting individual item caps on each item

  • Notebox tag for not drawing the item's cap in windows

  • Altering limit on gold, also changeable in-game

  • Displays item cap in item (battle), equip and shop scenes

  • You can set which types of items (items, weapons and armors) have their cap displayed in the inventory scenes




Screenshots


Screenshot of rgangsta's CyberDrive.



Demo

Not necessary.


Script

Spoiler: ShowHide

#===============================================================================
#
# Item Cap - Pacman (29/12/2011)
# Version 2.3
# Written for rgangsta (http://www.omega-dev.net/forums/showthread.php?tid=1280)
# Suggestion by Scalinger2
# Use the tag <item cap: x> to set the cap of an item to number x.
# Use the tax \EXEMPT_CAP to make the windows not draw the cap at all in the
# item and shop scenes.
# Set the default maximum gold in the module below.
# Set the default caps of items (when not set through notebox) in the module.
# Change the TEXT if you want for some reason.
# You can change the maximum amount of gold with the script call:
# $game_system.gold_max = x
# Where x is the maximum amount of gold.
# Set which items can have their item cap drawn in the below module. The
# available options are:
#   :items
#   :weapons
#   :armors
# New in 2.1: no longer crashes upon entering equip scene.
# New in 2.2: no longer crashes upon entering shop scene.
# New in 2.3: draws item name more efficiently.
#
#===============================================================================
#
# CONFIGURATION
#
#===============================================================================

module ITEM_CAP
  GOLD_MAX = 40000    # Maximum amount of gold
  DEFAULT_LIMIT = 50  # Default item cap (if not set through notebox)
  TEXT = ": %s / %s"    # Text to display the cap
  SHOW_CAP = [        # Show cap of which items?
    :items,           # Items
    :weapons,         # Weapons
    :armors,          # Armors
  ]
end

#===============================================================================
#
# NO EDITING >:D
#
#===============================================================================

#==============================================================================
# ** RPG::BaseItem
#------------------------------------------------------------------------------
# Superclass of Skill, Item, Weapon, and Armor.
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # * Maximum possession of item
  #--------------------------------------------------------------------------
  def item_cap
    return if self.is_a?(RPG::Skill)  # Only items, weapons and armors
    return @item_cap if @item_cap != nil  # Don't perform if already set
    @item_cap = ITEM_CAP::DEFAULT_LIMIT
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /<(?:ITEM_CAP|item cap):[ ](\d+)>/i
        @item_cap = $1.to_i
      end
    }
    return @item_cap
  end
  #--------------------------------------------------------------------------
  # * Don't draw the item's cap
  #--------------------------------------------------------------------------
  def exempt_cap?
    return if self.is_a?(RPG::Skill)
    return @exempt if @exempt != nil
    @exempt = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /\\EXEMPT_CAP/i
        @exempt = true
      end
    }
    return @exempt
  end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :gold_cap
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    item_max_initialize
    @gold_cap = ITEM_CAP::GOLD_MAX
  end
end

#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#  This class handles the party. It includes information on amount of gold
# and items. The instance of this class is referenced by $game_party.
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_gain_gold gain_gold
  alias item_max_gain_item gain_item
  #--------------------------------------------------------------------------
  # * Gain Gold (or lose)
  #     n : amount of gold
  #--------------------------------------------------------------------------
  def gain_gold(n)
    new_gold = item_max_gain_gold(n)
    @gold = [new_gold, $game_system.gold_cap].min
  end
  #--------------------------------------------------------------------------
  # * Gain Items (or lose)
  #     item          : Item
  #     n             : Number
  #     include_equip : Include equipped items
  #--------------------------------------------------------------------------
  def gain_item(item, n, include_equip = false)
    unless $scene.is_a?(Scene_Equip)
      number = item_number(item)
      cap = item.item_cap
      case item
      when RPG::Item
        @items[item.id] = [[number + n, 0].max, cap].min
      when RPG::Weapon
        @weapons[item.id] = [[number + n, 0].max, cap].min
      when RPG::Armor
        @armors[item.id] = [[number + n, 0].max, cap].min
      end
      n += number
      if include_equip and n < 0
        for actor in members
          while n < 0 and actor.equips.include?(item)
            actor.discard_equip(item)
            n += 1
          end
        end
      end
    else
      item_max_gain_item(item, n, include_equip)
    end
  end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This is a superclass of all windows in the game.
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Item Name
  #     item    : Item (skill, weapon, armor are also possible)
  #     x       : draw spot x-coordinate
  #     y       : draw spot y-coordinate
  #     enabled : Enabled flag. When false, draw semi-transparently.
  #     ctext   : Text to display the cap.
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, enabled = true, ctext = "")
    if item != nil
      w = self.contents.text_size(ctext).width - 48
      draw_icon(item.icon_index, x, y, enabled)
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(x + 24, y, 172 - w, WLH, item.name)
    end
  end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_cap_draw_item draw_item
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    if draw_cap?(index)
      rect = item_rect(index)
      self.contents.clear_rect(rect)
      item = @data[index]
      if item != nil
        number1 = $game_party.item_number(item); number2 = item.item_cap
        enabled = enable?(item)
        rect.width -= 4
        ctext = sprintf(ITEM_CAP::TEXT, number1, number2)
        draw_item_name(item, rect.x, rect.y, enabled, ctext)
        self.contents.draw_text(rect, ctext, 2)
      end
    else
      item_cap_draw_item(index)
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @data[index]
    return true if item == nil and $scene.is_a?(Scene_Equip)
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
#  This window displays buyable goods on the shop screen.
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (item.price <= $game_party.gold and number < item.item_cap)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
    self.contents.draw_text(rect, item.price, 2)
  end
end

#==============================================================================
# ** Window_ShopStatus
#------------------------------------------------------------------------------
#  This window displays number of items in possession and the actor's equipment
# on the shop screen.
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # Alias listing
  #--------------------------------------------------------------------------
  alias item_cap_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if draw_cap?(@item)
      self.contents.clear
      if @item != nil
        number = $game_party.item_number(@item); cap = @item.item_cap
        text = sprintf(ITEM_CAP::TEXT, number, cap)
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
        self.contents.font.color = normal_color
        self.contents.draw_text(4, 0, 200, WLH, text, 2)
        for actor in $game_party.members
          x = 4
          y = WLH * (2 + actor.index * 2)
          draw_actor_parameter_change(actor, x, y)
        end
      end
    else
      item_cap_refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @item
    return true unless item
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # * Update Buy Item Selection
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or
       number == @item.item_cap
        Sound.play_buzzer
      else
        Sound.play_decision
        max = @item.price == 0 ? @item.item_cap : $game_party.gold / @item.price
        max = [max, @item.item_cap - number].min
        @buy_window.active = false
        @buy_window.visible = false
        @number_window.set(@item, max, @item.price)
        @number_window.active = true
        @number_window.visible = true
      end
    end
  end
end

#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================



Instructions

Paste near the top of your custom script list, but still below Materials. I'll be directing you to the instructions included in the script, conveniently situated next to the applicable configuration options.


Compatibility

I overwrote some methods, but I don't know if that was avoidable. Paste at the top of your script list for improved compatibility. If you discover an issue, post it here or at RMRK.


Credits and Thanks


  • Rgangsta, for the request

  • Xzygon for reporting a kind of bug

  • Scalinger2, for suggesting something

  • Mog, I used his similar XP script as guidance




Author's Notes

Ham?
3
Electronic and Computer Section / WAV to MIDI
November 11, 2011, 05:53:45 am
So, I was doing a lot of work on my super-sexy composition for the semester, and I was pretty much done, exported the audio (WAV) file from Sibelius and uploaded it to SoundCloud, then promptly lost my USB that held all of my work on it. I have downloaded the WAV from SoundCloud and am trying to work from that, but it's not easy at all.
I had the idea of reopening the file in Sibelius and finishing it off from there, but Sibelius can't open WAV files; the only sound file it can open is MIDI. Knowing the fundamental differences between WAV and MIDI, would anyone know of a way of converting my WAV file into a MIDI file? It would make my life infinitely easier.
4
Entertainment / Taking portals to a new level
September 14, 2011, 10:21:44 am
For your entertainment, I need you to imagine this Portal situation. Consider this: you have 2 portals, as usual, and one metal rod. The rod is just long enough for its ends to meet when put into the portals perfectly orthogonal. You adhere the two ends together to make one continuous, endless rod.
Now, here's the insane stuff.
What happens if you let go of the rod? Does it accelerate downwards, move at a constant speed or not move at all?
If one of the portal's surface is relocatable and free to move, what happens if you let it fall from its original location? How does it affect the rod?
If you have a portal gun and shoot one of the portals to a different location, what should happen to the rod?

My brother doing a university course in physics (real physics, mind you) gave up. If your mind hasn't been blown, congratulations. Speculation takes place in this thread.
5
RMVX Script Database / [VX] PAC Main Menu
July 29, 2011, 07:46:57 pm
PAC Main Menu
Authors: Pacman
Version: 1.7a
Type: Custom Menu System
Key Term: Custom Menu System



Introduction

This script is protected by an attribution share-alike creative commons license.
It's about time I posted something from my engine, PAC, here. I've been doing it for a couple of months and it seems as though nobody here might know about it. You know Yanfly's engines? Yeah, it's like that, but I'm making it, so it's different!
Anyway, the script. My first CMS. Finally. The PAC Main Menu is focused around simple customization. Only a little has been done in terms of display to the menu, the focus of the first version, 1.7, was to get the core code out of the way so I could focus more on exotic displays in later versions. Now that's been redone and finalized, I've begun focus on display work. So far, there is one graphical 'mode'.


Features


  • Easy configuration

  • Menu Icons

  • Auto-remembering command index

  • Simple support for other custom scripts

  • REALLY easy configuration.

  • Customizable, comprehensive display.




Screenshots

Try it out for yourself. It can be used as plug-and-play.


Demo

This will be included in the PAC 1.7 demo, which will be released in about two weeks.


Script

Paste below materials, above main. If using the :compact window display, it would work best lower in the custom scripts list.
Spoiler: ShowHide
#===============================================================================
#
# Pacman Advanced Creative (PAC) Engine - Main Menu 1.7a
# 22/8/2011
# Type: Menu
# Installation: Heavy arrays and hashes, booleans and values.
# Level: Simple, Average, Difficult
#
#===============================================================================
#
# Description:
# So, here's the main menu. I'm sure you were looking for this. The setup is
# now revolutionized; all the commands are done in one hash filled with arrays.
# I'm pretty certain the configuration's going to stay like this.
# With base code truly out of the way, I've begun working on aesthetic aspects
# of the menu. So far, I've made one 'mode' for the menu, but others are sure
# to follow.
# Enjoy.
#
#===============================================================================
#
# Instructions:
# INSTALLATION
# Paste above main, below materials. It's not very difficult, even an XP
# user could do it.
# CONFIGURATION
# There are detailed instructions for the configuration beginning at line 44.
# Follow them closely, they shall lead you to your dream menu.
#
#===============================================================================
#
# CONFIGURATION BEGINS AT LINE 44
#
#==============================================================================

$pac = {} if $pac == nil
$pac["Main Menu"] = true

module PAC
  module MM
 
#==============================================================================
#
# BEGIN CONFIGURATION
#
#==============================================================================

    #--------------------------------------------------------------------------
    # Use icons in the main menu? (true / false)
    #--------------------------------------------------------------------------
   
    USE_ICONS = true
   
    #--------------------------------------------------------------------------
    # Setup for commands in the menu. Each entry must be an array ([]), ended
    # with a comma and begin with a number (the place where it is in the menu.
    # The indexes start at 0, so make sure you have a 0 command.
    # Syntax:
    # COMMANDS = {
    #   INDEX (number) => [
    #     'Command Name',
    #     'Command action',
    #     IconID,
    #     'Disable action', (optional)
    #   ],
    # }
    # Command action should be left as is unless you know what you are doing.
    # For example, if you are implementing a custom scene into this menu, you
    # have to know the name of the scene and the arguments required. Disable
    # action is code that will be evaluated; if it returns true then the command
    # will not be allowed. Command Name, Command action and Disable action
    # must all be string, i.e. in quotation marks ''. If you do not want a
    # disable action, either do not enter one or enter it as nil.
    # Note that for the command action, if the scene requires actor selection,
    # place an @status_window.index in the paranthesis. It will trigger actor
    # selection upon pressing the command.
    # If you do not want to use an icon for a particular index, enter that
    # entry as nil.
    #--------------------------------------------------------------------------
   
    #--------------------------------------------------------------------------
    COMMANDS = {  # Do not touch this!
    #--------------------------------------------------------------------------
      0 => [  # Do not touch this!
        #----------------------------------------------------------------------
        # Entry for command 1 (index 0)
        #----------------------------------------------------------------------
        'Inventory',                # Name
        '$scene = Scene_Item.new',  # Command
        144,                        # Icon
        nil                         # Disable
      #------------------------------------------------------------------------
      ],  # Do not touch this!
      #------------------------------------------------------------------------
      1 => [  # Do not touch this!
        #----------------------------------------------------------------------
        # Entry for command 2 (index 1)
        #----------------------------------------------------------------------
        'Skills',                                           # Name
        '$scene = Scene_Skill.new(@status_window.index)',   # Command
        137                                                 # Icon
                                                            # No disable needed.
      #------------------------------------------------------------------------
      ],  # Do not touch this!
      #------------------------------------------------------------------------
      2 => [  # Do not touch this!
        #----------------------------------------------------------------------
        # Entry for command 3 (index 2)
        #----------------------------------------------------------------------
        'Equip',                                          # Name
        '$scene = Scene_Equip.new(@status_window.index)', # Command
        1,                                                # Icon       
      #------------------------------------------------------------------------
      ],  # Do not touch this!
      #------------------------------------------------------------------------
      3 => [
        'Status',
        '$scene = Scene_Status.new(@status_window.index)',
        130,
      ],
      4 => [
        'Save',
        '$scene = Scene_File.new(true, false, false)',
        200,
        '$game_system.save_disabled',
      ],
      5 => [
        'End Game',
        '$scene = Scene_End.new',
        224,
      ],
     
    #--------------------------------------------------------------------------
    } # Do not touch this!
    #--------------------------------------------------------------------------
   
    # Mode of graphics used for the menu. So far, only :compact is usable.
    # If you do not want to use this, set it to nil.
   
    WINDOW_MODE = :compact
    #--------------------------------------------------------------------------
    # THESE OPTIONS ARE FOR THE COMPACT OPTION
    #--------------------------------------------------------------------------
      # 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)
      COMPACT_GOLD_BUTTON = Input::L
      # Start scene with gold window visible? (true / false)
      COMPACT_GOLD_WINDOW = true
    #--------------------------------------------------------------------------

#===============================================================================
#
# END CONFIGURATION
#
#===============================================================================

   
  end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :menu_index
  attr_accessor :menu_window_mode
  #--------------------------------------------------------------------------
  # Alias listing
  #--------------------------------------------------------------------------
  alias pac_menu_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    pac_menu_initialize
    @menu_index = 0
    @menu_window_mode = PAC::MM::WINDOW_MODE
  end
end

#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
#  This window displays selectable commands on the menu screen.
#==============================================================================

class Window_MenuCommand < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     width      : window width
  #     commands   : command string array
  #     column_max : digit count (if 2 or more, horizontal selection)
  #     row_max    : row count (0: match command count)
  #     spacing    : blank space when items are arrange horizontally
  #--------------------------------------------------------------------------
  def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
    if row_max == 0
      row_max = (commands.size + column_max - 1) / column_max
    end
    super(0, 0, width, row_max * WLH + 32, spacing)
    @commands = commands
    @item_max = commands.size
    @column_max = column_max
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index   : item number
  #     enabled : enabled flag. When false, draw semi-transparently.
  #--------------------------------------------------------------------------
  def draw_item(index, enabled = true)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    if PAC::MM::COMMANDS[index][2] != nil and PAC::MM::USE_ICONS
      draw_icon(PAC::MM::COMMANDS[index][2], rect.x, rect.y)
      rect.x += 24
    end
    self.contents.draw_text(rect, PAC::MM::COMMANDS[index][0])
  end
end

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

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # Include Configuration Data
  #--------------------------------------------------------------------------
  include PAC::MM
  #--------------------------------------------------------------------------
  # Alias listing
  #--------------------------------------------------------------------------
  alias pac_menu_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = $game_system.menu_index)
    pac_menu_initialize(menu_index)
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    commands = COMMANDS
    @command_window = Window_MenuCommand.new(160, commands)
    @command_window.index = @menu_index
    pac_menu_disable_commands
  end
  #--------------------------------------------------------------------------
  # * Disable Menu Commands
  #--------------------------------------------------------------------------
  def pac_menu_disable_commands
    if $game_party.members.size == 0
      for i in 0...COMMANDS.size
        if selection?(i)
          @command_window.draw_item(i, false)
        end
      end
    end
    for i in 0...COMMANDS.size
      unless COMMANDS[i][3].nil?
        if eval(COMMANDS[i][3])
          text = COMMANDS[i[0]]
          @command_window.draw_item(text, false)
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Require Selection?
  #     command : command to be determined whether or not to have selection
  #--------------------------------------------------------------------------
  def selection?(command)
    return COMMANDS[command][1].include?('@status_window.index')
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    $game_system.menu_index = @command_window.index
    selection = @command_window.index
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and selection?(selection)
        Sound.play_buzzer
        return
      elsif !COMMANDS[selection][3].nil?
        if eval(COMMANDS[selection][3])
          Sound.play_buzzer
          return
        end
      end
      Sound.play_decision
      if selection?(selection)
        start_actor_selection
      else
        eval(COMMANDS[selection][1])
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Actor Selection
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_actor_selection
    elsif Input.trigger?(Input::C)
      selection = @command_window.index
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      eval(COMMANDS[selection][1])
    end
  end
#===============================================================================
# COMPACT MODE
#===============================================================================
  if WINDOW_MODE == :compact
  $pac["Compact Menu"] = true
  #--------------------------------------------------------------------------
  # 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 = COMPACT_GOLD_WINDOW
    @gold_window.x = @command_window.x
    @gold_window.openness = COMPACT_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?(COMPACT_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 COMPACT MODE
#===============================================================================
  end
end

#==============================================================================
# ** Scene_Base
#------------------------------------------------------------------------------
#  This is a superclass of all scenes in the game.
#==============================================================================

class Scene_Base
  #--------------------------------------------------------------------------
  # * Dispose of Background for Menu Screen
  #--------------------------------------------------------------------------
  def dispose_menu_background
    @menuback_sprite.dispose if @menuback_sprite != nil
  end
end

#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs the item screen processing.
#==============================================================================

class Scene_Item < Scene_Base
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new
  end
end

#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
#  This class performs the skill screen processing.
#==============================================================================

class Scene_Skill < Scene_Base
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new
  end
end

#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
#  This class performs the equipment screen processing.
#==============================================================================

class Scene_Equip < Scene_Base
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new
  end
end

#==============================================================================
# ** Scene_Status
#------------------------------------------------------------------------------
#  This class performs the status screen processing.
#==============================================================================

class Scene_Status < Scene_Base
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new
  end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This class performs the save and load screen processing.
#==============================================================================

class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    if @from_title
      $scene = Scene_Title.new
    elsif @from_event
      $scene = Scene_Map.new
    else
      $scene = Scene_Menu.new
    end
  end
end

#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
#  This class performs game end screen processing.
#==============================================================================

class Scene_End < Scene_Base
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new
  end
end

#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================



Instructions

I'll be directing you to the instructions included in the script, conveniently situated next to the applicable configuration options.


Compatibility

Obviously, it won't work with other CMS's. To check if a script is compatible, here is a list of methods altered/created in the script:

  • Game_System#initialize - alias

  • Window_MenuCommand (entire class) - new

  • Scene_Menu#initialize - alias

  • Scene_Menu#create_command_window, update_command_selection, update_actor_selection - overwritten

  • Scene_Menu#pac_mm_disable_commands, selection? - new

  • Scene_Base#dispose_menu_background - overwritten

  • Scene_Item, Scene_Skill, Scene_Equip, Scene_Status, Scene_File, Scene_End#return_scene - overwritten

  • The following apply if using the :compact window option:
  • Scene_Menu#start, start_actor_selection, end_actor_selection, update - alias

  • Scene_Menu#pac_compact_windows, update_gold_visible - new




Credits and Thanks


  • Pacman

  • Enterbrain, for making such a terrible DMS in the first place.




Author's Notes

If you need support, post here or on RMRK, no matter how old the topic is. I'll probably respond to PMs as well. It won't work with any other menu systems. Custom scenes will probably return to the wrong index: I've posted a short tutorial on how to fix this. It can get a bit problematic, so don't hesitate to ask for help.
If you want the compact display, but not the data of the menu (for whatever insane reason :V), find it at this thread.

I'd like to thank Twb6543 for helping me deal with the command index issue, Modern Algebra for inspiring a display, and LoganForrests, Cozziekuns and the almighty Zeriab for generally helping out and showing me how I can improve in Ruby. And, of course, Yanfly for inspiring PAC by creating YERD, YEZ and YEM.
6
Welcome! / Arcade characters have feelings too.
April 18, 2011, 12:33:42 pm
Greetings, CP. I, as you may have noticed, am Pacman. However, in a bit of a mid-life crisis, I've become angry. So, I am AngryPacman.
I have come to this forum to enhance my RGSS2 skills and worship Blizzard, Ryex and game_guy. There is a .538% chance you know me from RMRK.net, where I have established myself as both a scripter and a troll. I promise to do the same here.
If you want to take a look at my scripting work, just take a glance at my entry in the RMRK VX Script Index.
So, I live at RMRK, but look forward to making a holiday home here at CP.
Catchya.