[XP] Mouse Map Menu

Started by nathmatt, August 07, 2010, 10:27:20 am

Previous topic - Next topic

nathmatt

August 07, 2010, 10:27:20 am Last Edit: July 09, 2011, 12:07:07 pm by nathmatt
Mouse Map Menu
Authors: Nathmatt
Version: 1.25
Type: Map Menu
Key Term: Custom Menu System



Introduction

allows you to create click able icons on the map to access any specified scene
requires Mouse_Controller &  Blizz-ABS, RMXOS, or Tons custom controls



Features


  • vertical or horizontal icon command list
  • Can place the command anywhere you want
  • Can change graphic while over an icon
  • can add pictures behind each icon
  • can add a picture to use as a window
  • Can disable and enable each command
  • Can disable entire menu
  • Can call commands with a defined key
  • Opacity will lower if you are under this menu
  • No limit on the commands



Screenshots

Maybe later


Demo

No demo


Script





Instructions

in the config of the script

to disable a command use $mouse_map_menu.disable(index)
to enable a command use $mouse_map_menu.enable(index)
to enable/disable the menu use $mouse_map_menu.menu_disabled = condition



Compatibility

no compatibility issues known



Credits and Thanks


  • Nathmatt



Author's Notes

if you have any issues / suggestions post here
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


legacyblade

This'll be great for making a mouse-only game menu system. Is there a way to make these carry over into the scenes you call? (so you can click on a dif icon and go to a dif scene)?

G_G

Looks good. I edited your post, you had a syntax error, forgot the last end in Scene_Map.

legacyblade

After playing around with it, I realized adding this to new scenes would be REALLY easy. I like that. However, I have a few suggestions. Feel free to ignore them if they aren't what you want your script to be like.

First, I want to be able to change the cursor graphic or the icon graphic when one of the icons is moused over. Not a real big feature, but it'd be nice. Second, I'd like the ability to define an icon back (like blizzABS hotkeys), or to have a picture drawn below the icons. Third, I'd like to be able to disable menu items, like in the default menu. The icon would be grayed out and unusable. When you click it, you'd get the error buzzer noise.

If you don't want to make those additions, I'll probably try to make an enhancement add-on for your mouse map menu. I love what you've been doing with blizz's mouse system, it's very useful.

P.S. I know it's kind of a given, but you might want to mention in your post that this requires blizz's mouse script.

G_G

Got bored. See if this works :P
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Mouse Map Menu by Nathmatt
# Version: 1.00
# Type: Menu
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Mouse_Map_Menu
 
  Version = 1.00
  #============================================================================
  # Mouse_Map_Menu::Config
  #----------------------------------------------------------------------------
  #  This module performs the the configurations.
  #============================================================================
  module Config
    Condition = 0               # 0 for Horizontal 1 for Vertical
Icon_Back = "Background"    # Change it to "" if you do not want this option
# Displays a background behind each icon. Place
# In pictures folder
    Icons     = ['040-Item09']  # Array of menu icons
    Scenes    = ['Scene_Menu']  # Array of scenes
    X         = 0               # The x co-ordanance is by 32
    Y         = 14              # The y co-ordanance is by 32
  end
  #============================================================================
  # Mouse_Map_Menu::Processor
  #----------------------------------------------------------------------------
  #  This class performs the mouse processing.
  #============================================================================
  class Processor
   
    def main
      size = Config::Icons.size
      if size != Config::Scenes.size
        raise 'You must have the same amount of icons & scenes'
      end
  @enable = []
      @x = Config::X * 32
      @y = Config::Y * 32
      @screen_x = []
      @screen_y = []
      @sprite   = []
  @back     = []
      (0...size).each{|i|
  @back[i] = Sprite.new
  @back[i].bitmap = RPG::Cache.picture(Config::Icon_Back)
      @sprite[i] = Sprite.new
      @sprite[i].bitmap = RPG::Cache.icon(Config::Icons[i])
      if Config::Condition == 0
        @sprite[i].x = 4 + @x + i * 32
        @sprite[i].y = 4 + @y
      else
        @sprite[i].x = 4 + @x
        @sprite[i].y = 4 + @y + i * 32
      end
  @back[i].x = @sprite[i].x
  @back[i].y = @sprite[i].y
      @sprite[i].z = 100
      @screen_x[i] = (@sprite[i].x + $game_map.display_x / 4) / 32
      @screen_y[i] = (@sprite[i].y + $game_map.display_y / 4) / 32
  @enable[i] = true}
    end
   
    def update
      x,y = $mouse.pos
      (0...Config::Scenes.size).each{|i|
      if x == @screen_x[i] && y == @screen_y[i]
        if Input.trigger?(Input::Key['Mouse Left'])
  if @enable[i]
            $game_system.se_play($data_system.decision_se)
            eval("$scene = #{Config::Scenes[i]}.new")
            break
  end
else
  $game_system.se_play($data_system.buzzer_se)
  break
        end
      end}
     
    end
   
def disable_item(i)
  @enable[i] = false
end

def enable_item(i)
  @enable[i] = true
end

    def dispose
      (0...Config::Scenes.size).each{|i|@sprite[i].dispose if @sprite[i] != nil}
      @sprite.clear
    end
     
   
  end
 
end
   
class Mouse
     
  def pos
    return if $game_map.display_x == nil
    x, y = self.position
    x = ( x + $game_map.display_x / 4) / 32
    y = ( y + $game_map.display_y / 4) / 32
    return x, y
  end
end
     
$mouse_map_menu = Mouse_Map_Menu::Processor.new

class Scene_Map
 
  alias mouse_map_menu_main main
  def main
    $mouse_map_menu.main
    mouse_map_menu_main
    $mouse_map_menu.dispose
  end
 
  alias mouse_map_menu_update update
  def update
    $mouse_map_menu.update
    mouse_map_menu_update
  end

end

arialks

oh this scripit is so fken sexy :P
Ive been waiting for something like this for a long time
but i found a small bug, when I click on the center of the icon, it doesnt work, but it works if you click on the very very left of the Icon O:

G_G

Try this
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Mouse Map Menu by Nathmatt
# Version: 1.00
# Type: Menu
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Mouse_Map_Menu
 
  Version = 1.00
  #============================================================================
  # Mouse_Map_Menu::Config
  #----------------------------------------------------------------------------
  #  This module performs the the configurations.
  #============================================================================
  module Config
    Condition = 0               # 0 for Horizontal 1 for Vertical
Icon_Back = "Background"    # Change it to "" if you do not want this option
# Displays a background behind each icon. Place
# In pictures folder
    Icons     = ['040-Item09']  # Array of menu icons
    Scenes    = ['Scene_Menu']  # Array of scenes
    X         = 0               # The x co-ordanance is by 32
    Y         = 14              # The y co-ordanance is by 32
  end
  #============================================================================
  # Mouse_Map_Menu::Processor
  #----------------------------------------------------------------------------
  #  This class performs the mouse processing.
  #============================================================================
  class Processor
   
    def main
      size = Config::Icons.size
      if size != Config::Scenes.size
        raise 'You must have the same amount of icons & scenes'
      end
  @enable = []
      @x = Config::X * 32
      @y = Config::Y * 32
      @screen_x = []
      @screen_y = []
      @sprite   = []
  @back     = []
      (0...size).each{|i|
  @back[i] = Sprite.new
  @back[i].bitmap = RPG::Cache.picture(Config::Icon_Back)
      @sprite[i] = Sprite.new
      @sprite[i].bitmap = RPG::Cache.icon(Config::Icons[i])
      if Config::Condition == 0
        @sprite[i].x = 4 + @x + i * 32
        @sprite[i].y = 4 + @y
      else
        @sprite[i].x = 4 + @x
        @sprite[i].y = 4 + @y + i * 32
      end
  @back[i].x = @sprite[i].x
  @back[i].y = @sprite[i].y
      @sprite[i].z = 100
      @screen_x[i] = (@sprite[i].x + $game_map.display_x / 4) / 32
      @screen_y[i] = (@sprite[i].y + $game_map.display_y / 4) / 32
  @enable[i] = true}
    end
   
    def update
      x,y = $mouse.pos
      (0...Config::Scenes.size).each{|i|
      if x >= @sprite[i].x && y >= @sprite[i].y && x <= @sprite[i].bitmap.width
  && y <= @sprite[i].bitmap.height
        if Input.trigger?(Input::Key['Mouse Left'])
  if @enable[i]
            $game_system.se_play($data_system.decision_se)
            eval("$scene = #{Config::Scenes[i]}.new")
            break
  end
else
  $game_system.se_play($data_system.buzzer_se)
  break
        end
      end}
     
    end
   
def disable_item(i)
  @enable[i] = false
end

def enable_item(i)
  @enable[i] = true
end

    def dispose
      (0...Config::Scenes.size).each{|i|@sprite[i].dispose if @sprite[i] != nil}
      @sprite.clear
    end
     
   
  end
 
end
   
class Mouse
     
  def pos
    return if $game_map.display_x == nil
    x, y = self.position
    x = ( x + $game_map.display_x / 4) / 32
    y = ( y + $game_map.display_y / 4) / 32
    return x, y
  end
end
     
$mouse_map_menu = Mouse_Map_Menu::Processor.new

class Scene_Map
 
  alias mouse_map_menu_main main
  def main
    $mouse_map_menu.main
    mouse_map_menu_main
    $mouse_map_menu.dispose
  end
 
  alias mouse_map_menu_update update
  def update
    $mouse_map_menu.update
    mouse_map_menu_update
  end

end

arialks


G_G

Not sure if this fixed it.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Mouse Map Menu by Nathmatt
# Version: 1.00
# Type: Menu
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Mouse_Map_Menu
 
  Version = 1.00
  #============================================================================
  # Mouse_Map_Menu::Config
  #----------------------------------------------------------------------------
  #  This module performs the the configurations.
  #============================================================================
  module Config
    Condition = 0               # 0 for Horizontal 1 for Vertical
Icon_Back = "Background"    # Change it to "" if you do not want this option
# Displays a background behind each icon. Place
# In pictures folder
    Icons     = ['040-Item09']  # Array of menu icons
    Scenes    = ['Scene_Menu']  # Array of scenes
    X         = 0               # The x co-ordanance is by 32
    Y         = 14              # The y co-ordanance is by 32
  end
  #============================================================================
  # Mouse_Map_Menu::Processor
  #----------------------------------------------------------------------------
  #  This class performs the mouse processing.
  #============================================================================
  class Processor
   
    def main
      size = Config::Icons.size
      if size != Config::Scenes.size
        raise 'You must have the same amount of icons & scenes'
      end
  @enable = []
      @x = Config::X * 32
      @y = Config::Y * 32
      @screen_x = []
      @screen_y = []
      @sprite   = []
  @back     = []
      (0...size).each{|i|
  @back[i] = Sprite.new
  @back[i].bitmap = RPG::Cache.picture(Config::Icon_Back)
      @sprite[i] = Sprite.new
      @sprite[i].bitmap = RPG::Cache.icon(Config::Icons[i])
      if Config::Condition == 0
        @sprite[i].x = 4 + @x + i * 32
        @sprite[i].y = 4 + @y
      else
        @sprite[i].x = 4 + @x
        @sprite[i].y = 4 + @y + i * 32
      end
  @back[i].x = @sprite[i].x
  @back[i].y = @sprite[i].y
      @sprite[i].z = 100
      @screen_x[i] = (@sprite[i].x + $game_map.display_x / 4) / 32
      @screen_y[i] = (@sprite[i].y + $game_map.display_y / 4) / 32
  @enable[i] = true}
    end
   
    def update
      x,y = $mouse.pos
      (0...Config::Scenes.size).each{|i|
      if x >= @sprite[i].x && y >= @sprite[i].y && x <= @sprite[i].bitmap.width && y <= @sprite[i].bitmap.height
        if Input.trigger?(Input::Key['Mouse Left'])
  if @enable[i]
            $game_system.se_play($data_system.decision_se)
            eval("$scene = #{Config::Scenes[i]}.new")
            break
  end
else
  $game_system.se_play($data_system.buzzer_se)
  break
        end
      end}
     
    end
   
def disable_item(i)
  @enable[i] = false
end

def enable_item(i)
  @enable[i] = true
end

    def dispose
      (0...Config::Scenes.size).each{|i|@sprite[i].dispose if @sprite[i] != nil}
      @sprite.clear
    end
     
   
  end
 
end
   
class Mouse
     
  def pos
    return if $game_map.display_x == nil
    x, y = self.position
    x = ( x + $game_map.display_x / 4) / 32
    y = ( y + $game_map.display_y / 4) / 32
    return x, y
  end
end
     
$mouse_map_menu = Mouse_Map_Menu::Processor.new

class Scene_Map
 
  alias mouse_map_menu_main main
  def main
    $mouse_map_menu.main
    mouse_map_menu_main
    $mouse_map_menu.dispose
  end
 
  alias mouse_map_menu_update update
  def update
    $mouse_map_menu.update
    mouse_map_menu_update
  end

end


It'd help to know what the error said.

Shalaren

now the Icon doesnt do anything xD

G_G

I'll look into it, I'm not sure how he's actually drawing the sprites.

Shalaren


arialks

August 07, 2010, 05:39:32 pm #12 Last Edit: August 07, 2010, 06:04:06 pm by arialks
Quote from: Borat on August 07, 2010, 04:28:02 pm
Not sure if this fixed it.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Mouse Map Menu by Nathmatt
# Version: 1.00
# Type: Menu
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Mouse_Map_Menu
 
  Version = 1.00
  #============================================================================
  # Mouse_Map_Menu::Config
  #----------------------------------------------------------------------------
  #  This module performs the the configurations.
  #============================================================================
  module Config
    Condition = 0               # 0 for Horizontal 1 for Vertical
Icon_Back = "Background"    # Change it to "" if you do not want this option
# Displays a background behind each icon. Place
# In pictures folder
    Icons     = ['040-Item09']  # Array of menu icons
    Scenes    = ['Scene_Menu']  # Array of scenes
    X         = 0               # The x co-ordanance is by 32
    Y         = 14              # The y co-ordanance is by 32
  end
  #============================================================================
  # Mouse_Map_Menu::Processor
  #----------------------------------------------------------------------------
  #  This class performs the mouse processing.
  #============================================================================
  class Processor
   
    def main
      size = Config::Icons.size
      if size != Config::Scenes.size
        raise 'You must have the same amount of icons & scenes'
      end
  @enable = []
      @x = Config::X * 32
      @y = Config::Y * 32
      @screen_x = []
      @screen_y = []
      @sprite   = []
  @back     = []
      (0...size).each{|i|
  @back[i] = Sprite.new
  @back[i].bitmap = RPG::Cache.picture(Config::Icon_Back)
      @sprite[i] = Sprite.new
      @sprite[i].bitmap = RPG::Cache.icon(Config::Icons[i])
      if Config::Condition == 0
        @sprite[i].x = 4 + @x + i * 32
        @sprite[i].y = 4 + @y
      else
        @sprite[i].x = 4 + @x
        @sprite[i].y = 4 + @y + i * 32
      end
  @back[i].x = @sprite[i].x
  @back[i].y = @sprite[i].y
      @sprite[i].z = 100
      @screen_x[i] = (@sprite[i].x + $game_map.display_x / 4) / 32
      @screen_y[i] = (@sprite[i].y + $game_map.display_y / 4) / 32
  @enable[i] = true}
    end
   
    def update
      x,y = $mouse.pos
      (0...Config::Scenes.size).each{|i|
      if x >= @sprite[i].x && y >= @sprite[i].y && x <= @sprite[i].bitmap.width && y <= @sprite[i].bitmap.height
        if Input.trigger?(Input::Key['Mouse Left'])
  if @enable[i]
            $game_system.se_play($data_system.decision_se)
            eval("$scene = #{Config::Scenes[i]}.new")
            break
  end
else
  $game_system.se_play($data_system.buzzer_se)
  break
        end
      end}
     
    end
   
def disable_item(i)
  @enable[i] = false
end

def enable_item(i)
  @enable[i] = true
end

    def dispose
      (0...Config::Scenes.size).each{|i|@sprite[i].dispose if @sprite[i] != nil}
      @sprite.clear
    end
     
   
  end
 
end
   
class Mouse
     
  def pos
    return if $game_map.display_x == nil
    x, y = self.position
    x = ( x + $game_map.display_x / 4) / 32
    y = ( y + $game_map.display_y / 4) / 32
    return x, y
  end
end
     
$mouse_map_menu = Mouse_Map_Menu::Processor.new

class Scene_Map
 
  alias mouse_map_menu_main main
  def main
    $mouse_map_menu.main
    mouse_map_menu_main
    $mouse_map_menu.dispose
  end
 
  alias mouse_map_menu_update update
  def update
    $mouse_map_menu.update
    mouse_map_menu_update
  end

end


It'd help to know what the error said.

yeah now when I click the icon, nothing happens X:
and how do I add more Icons? instead of just one.
me and Kyle tried to pu more icons in so many ways X:

G_G

Fixed I think
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Mouse Map Menu by Nathmatt
# Version: 1.00
# Type: Menu
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Mouse_Map_Menu
 
  Version = 1.00
  #============================================================================
  # Mouse_Map_Menu::Config
  #----------------------------------------------------------------------------
  #  This module performs the the configurations.
  #============================================================================
  module Config
    Condition = 0               # 0 for Horizontal 1 for Vertical
Icon_Back = "Background"    # Change it to "" if you do not want this option
# Displays a background behind each icon. Place
# In pictures folder
    Icons     = ['040-Item09']  # Array of menu icons
    Scenes    = ['Scene_Menu']  # Array of scenes
    X         = 0               # The x co-ordanance is by 32
    Y         = 14              # The y co-ordanance is by 32
  end
  #============================================================================
  # Mouse_Map_Menu::Processor
  #----------------------------------------------------------------------------
  #  This class performs the mouse processing.
  #============================================================================
  class Processor
   
    def main
      size = Config::Icons.size
      if size != Config::Scenes.size
        raise 'You must have the same amount of icons & scenes'
      end
  @enable = []
      @x = Config::X * 32
      @y = Config::Y * 32
      @screen_x = []
      @screen_y = []
      @sprite   = []
  @back     = []
      (0...size).each{|i|
  @back[i] = Sprite.new
  @back[i].bitmap = RPG::Cache.picture(Config::Icon_Back)
      @sprite[i] = Sprite.new
      @sprite[i].bitmap = RPG::Cache.icon(Config::Icons[i])
      if Config::Condition == 0
        @sprite[i].x = 4 + @x + i * 32
        @sprite[i].y = 4 + @y
      else
        @sprite[i].x = 4 + @x
        @sprite[i].y = 4 + @y + i * 32
      end
  @back[i].x = @sprite[i].x
  @back[i].y = @sprite[i].y
      @sprite[i].z = 100
      @screen_x[i] = (@sprite[i].x + $game_map.display_x / 4) / 32
      @screen_y[i] = (@sprite[i].y + $game_map.display_y / 4) / 32
  @enable[i] = true}
    end
   
    def update
      x,y = $mouse.pos
      (0...Config::Scenes.size).each{|i|
      if x >= @sprite[i].x && y >= @sprite[i].y && x <= @sprite[i].bitmap.width + @sprite[i].x && y <= @sprite[i].bitmap.height + @sprite[i].y
        if Input.trigger?(Input::Key['Mouse Left'])
  if @enable[i]
            $game_system.se_play($data_system.decision_se)
            eval("$scene = #{Config::Scenes[i]}.new")
            break
  end
else
  $game_system.se_play($data_system.buzzer_se)
  break
        end
      end}
     
    end
   
def disable_item(i)
  @enable[i] = false
end

def enable_item(i)
  @enable[i] = true
end

    def dispose
      (0...Config::Scenes.size).each{|i|@sprite[i].dispose if @sprite[i] != nil}
      @sprite.clear
    end
     
   
  end
 
end
   
class Mouse
     
  def pos
    return if $game_map.display_x == nil
    x, y = self.position
    x = ( x + $game_map.display_x / 4) / 32
    y = ( y + $game_map.display_y / 4) / 32
    return x, y
  end
end
     
$mouse_map_menu = Mouse_Map_Menu::Processor.new

class Scene_Map
 
  alias mouse_map_menu_main main
  def main
    $mouse_map_menu.main
    mouse_map_menu_main
    $mouse_map_menu.dispose
  end
 
  alias mouse_map_menu_update update
  def update
    $mouse_map_menu.update
    mouse_map_menu_update
  end

end

arialks

no  :^_^': still not working,
but what nathmatt gave is better then nothing  :wacko:

any Idea how to put more then 1 Icon?

Shalaren

August 07, 2010, 10:18:09 pm #15 Last Edit: August 07, 2010, 10:19:27 pm by Protoss
Quote from: arialks on August 07, 2010, 03:36:16 pm
oh this scripit is so fken sexy :P
Ive been waiting for something like this for a long time
but i found a small bug, when I click on the center of the icon, it doesnt work, but it works if you click on the very very left of the Icon O:

is there a chance its like that because we use Blizz-Abs?
does that change anything? because we use the special mouse system that is made for those who use
blizz abs

Quote from: arialks on August 07, 2010, 06:26:48 pm
no  :^_^': still not working,
but what nathmatt gave is better then nothing  :wacko:

any Idea how to put more then 1 Icon?

you just put more icons like that
    Icons= ['040-Item09','039-Item08']
    Scenes= ['Scene_Menu','Scene_Hotkeys']

nathmatt

update 1.10 added change the mouse graphic while over a command ,disable/enable commands, and fixed alignment bug

@legacyblade about the graphic behind it you wanted was you wanting an actual picture or just the colored box
like Blizz Abs
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Shalaren

Alright so. X: I was exploring the scripit, didnt find how to fix it.
so Ill just tell you what I found, A WIERD BUG THAT MAKES A WIERD SOUND
I like rhyming :D
ok to topic
i found 2 bugs, one of them is
test it your self, make a big map
make the icon
try clicking it
it works
but if you move and the map scrolls, the link of the Icon does not scrolls with it xD!
and then the icon is unclickble O:!

nathmatt

update 1:11 now fixed alignment bug  :^_^':
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


legacyblade

@nath, I personally want the picture behind it. But I think, to add some extra flexibility, you should allow for picture backs for each icon. (so you could simulate having a picture back for a menu with a non predefined amount of options). Thanks for the updates though, now the script is that much more epic. *levels up*

*cues a level up for later*