Войти на сайт

Авторизация, ждите ...
×
Правила раздела:
1 Задавайте конкретные вопросы. Для болтовни есть свободный раздел.
2 По возможности давайте конкретные ответы.
3 Один вопрос=одна тема. Если хотите задать ещё вопрос, то начинайте новую тему.
4 Название темы должно составлять сам вопрос, и быть максимально конкретным. Рекомендуется начинать тему словами "Как", "Что", "Почему". А первый пост повторяет вопрос и даёт расширенные сведения.
5 Рекомендуется указывать версию мейкера (2000, 2003, RMXP, RMVX, ACE, IGM, и.т.д.. Это важно, и всё равно ведь спросят.
6 Темы "Пара вопросов", "Помогите", и подобные им - самый лёгкий путь к бану.
7 Поиск находится вверху справа.
А. Названия подразделов этого раздела уточняются. Советы принимаются.

ТЕМА: [XP] Скрипт Mousie ни у кого не завалялся?

[XP] Скрипт Mousie ни у кого не завалялся? 10 года 11 мес. назад #60055

  • gelad
  • gelad аватар
  • Вне сайта
  • Путник
  • Сообщений: 5
  • Спасибо получено: 1
Всем привет!
Увидел интересный скрипт тут Mousie 3.1, но все ссылки битые, с других ресурсов ведут туда же на умерший fileden.com. Если у кого есть этот скрипт, поделитесь пожалуйста. Заранее спасибо!
Последнее редактирование: 10 года 11 мес. назад от gelad.
Администратор запретил публиковать записи гостям.

[XP] Скрипт Mousie ни у кого не завалялся? 10 года 11 мес. назад #60059

  • DeadElf79
  • DeadElf79 аватар
  • Вне сайта
  • Звездный Страж
  • Сообщений: 3147
  • Спасибо получено: 2650
  • ВетеранПроект месяца 2 местоПрограммист Ruby3 местоПисатель 3 место1 место в ГотвПроект месяца 1 местоУчительОрганизатор конкурсов
Нет, именно этого скрипта, к сожалению, нет. Есть несколько альтернатив с демками, с теми же возможностями. Сейчас поищу их у себя...

Страница 1. Инструкция
#===============================================================================
# ** MOUSIE!  The Mouse system
#===============================================================================
#    Version 3.1
#    by DerVVulfman
#    October 3, 2012
#===============================================================================
#
#   SETTING UP THE MOUSE ICON SYSTEM
#
#   Mouse icons are stored in a hash array.
#
#   The system is designed  so you can create  your custom names or handles for
#   each mouse cursor/icon, let alone assign the custom icon(s) for your mouse.
#
#   Custom handles are string values  that you can use  in map events to change
#   the appearance of the 'mouse' when it is over same said event.  Each handle
#   is tagged to an icon filename.   When the mouse is dragged over a map event
#   with this handle  in the required 'comment',  the cursor itself will change
#   to that of the icon it is assigned.
#
#   Icon filenames are the custom graphics  that are used  to show the mouse on
#   the screen.   These 24x24 graphics are stored in the Graphics\Icons folder.
#
#   The MOUSE_DEFAULT value holds the handle of the regular/default mouse as it
#   is seen throughout the game.   As the mouse typically  keeps the same shape
#   throughout the game, this feature is rather under-used. But it is necessary
#   to assign a name nonetheless.
#
#   The MOUSE_ICON hash array  holds the custom handles for each icon  (and the
#   mouse icons) that are shown when the mouse is over an event.   It is fairly
#   straightforward and uses only a pair of values...  the handle and the icon.
#   First, enter the custom handle, then have it point to an Icon filename. The
#   one thing to remember is that you must also include the MOUSE_DEFAULT value
#   and assign it a custom icon as well.  The startup handles of the MOUSE_ICON
#   array can be changed in-game by the use of the $mouse.mouse_icon_set script
#   call.
#
#   The MOUSE_MOVE_FUNCTION determines if the system allows the player  to move
#   the character around the screen with the mouse.  It is very straightforward
#   and can be enabled/disabled with the 'mouse_move' script call.
#
#   The MOUSE_EVENT_FUNCTION determines if the system allows the player to move
#   the cursor over events on which to simply click and activate.   This allows
#   for the game designer  to make sim-like games.  It is  very straightforward
#   and can be enabled/disabled with the 'mouse_event' script call.   One thing
#   to note is that it disables the ability  to move the player with the mouse.
#   Also, it only functions if the event is set to 'Action Button'.
#
#   The MOUSE_MENU_FUNCTION determines if the system  allows you to control the
#   menu with the mouse.   It is very simple to use and can be enabled/disabled
#   with the 'mouse_menu' script call.
#
#   The MOUSE_STARTUP_VISIBLE  informs the system if the mouse icon  is visible
#   when the game begins.  The visibility of the mouse icon can be turned on or
#   off with the $game_system.mouse_visible_bool script call.
#
#-------------------------------------------------------------------------------
#  
#   CALL VALUES FOR YOUR PROJECT
#
#   This system  is designed  to update  all mouse data automatically  as it is
#   tied into the  Input class  and is processed through the Input.update calls
#   throughout the default system.
#
#   Only a few actual calls are necessary:
#
#       Mouse.click?  *  Mouse.dbclick?  *  Mouse.press?  *  Mouse.pos
#        Mouse.pos_set  *  Mouse.pos_x  *  Mouse.pos_y  *  Mouse.screen
#                      Mouse.screen_x  *  Mouse.screen_y
#                       $game_system.mouse_visible_bool
#                           $mouse.mouse_icon_set
#                   mouse_move * mouse_event * mouse_menu
#
#
#   Mouse.click?(key)
#       This call determines whether a mouse button is currently being pressed.
#       If the button is being pressed, it returns TRUE. If not, returns FALSE.
#       It works in the same manner as the Input.press? & Input.trigger? calls.
#           The 'key' value passed into the call  defines which mouse button is
#           to be tested:  Left_Click, Right_Click or Middle_Click
#
#   Mouse.dbclick?(key)
#       This call  determines whether  a mouse button  has been quickly pressed
#       and released twice.   If the button was twice-clicked,  it returns TRUE
#       If not, it returns FALSE.
#           The 'key' value passed into the call  defines which mouse button is
#           to be tested:  Left_Click, Right_Click or Middle_Click
#
#   Mouse.press?(key)
#       This call  determines whether a mouse button has been depressed and not
#       yet released.  While depresses, it returns TRUE. If not, returns FALSE.
#           The 'key' value passed into the call  defines which mouse button is
#           to be tested:  Left_Click, Right_Click or Middle_Click
#
#   Mouse.pos
#       This call returns the mouse cursor's X and Y position (in pixels) based
#       on the game's screen.  Under normal conditions, this is a 640x480 area.
#           A passable value of 'false' allows this method to return a value of
#           'nil' if the mouse os outside the gaming window, otherwise it re-
#           turns a position of -1,-1.
#
#   Mouse.pos_set(x, y)
#       This call sets the mouse cursor's position specified by x and y.
#
#   Mouse.pos_x
#       This call returns  the mouse cursor's X position  (in pixels)  based on
#       the game's screen. Under normal conditions, would be a value up to 640.
#
#   Mouse.pos_y
#       This call returns  the mouse cursor's Y position  (in pixels)  based on
#       the game's screen. Under normal conditions, would be a value up to 480.
#
#   Mouse.screen
#       This call returns the mouse cursor's X and Y position (in pixels) based
#       on the entire window screen, regardless if it is within the game window
#       or not.  The returned value is based solely on the screen and the reso-
#       lution settings for your display.
#
#   Mouse.screen_x
#       This call returns  the mouse cursor's X position  (in pixels)  based on
#       the entire window screen,  regardless if it's within the game window or
#       not.
#
#   Mouse.screen_y
#       This call returns  the mouse cursor's X position  (in pixels)  based on
#       the entire window screen,  regardless if it's within the game window or
#       not.
#
#   $game_system.mouse_visible_bool
#       Not exactly one  that controls the mouse,  but determines  if the mouse
#       is visible.  By setting this value to true, the mouse is visible on the
#       screen.  But setting it to nil (not false), erases it.
#
#   $mouse.mouse_icon_set
#       This allows the game designer  to allow the mouse icons  to change from
#       one complete set of icons to another set depending upon gameplay.
#
#   mouse_move(true/false)
#       This call allows you to turn on/off mouse movement function during game
#       play.   A value of true lets the player move the character with the use
#       of the mouse while false prevents movement.
#
#   mouse_event(true/false)
#       This call lets you turn on/off the ability of the mouse to activate the
#       list of commands  within a map event.   A value of true  lets the mouse
#       click and run a map event while false prevents it. Please remember that
#       this disables mouse point-n-click movement.
#
#   mouse_menu(true/false
#       This call allows you to turn on/off menu highlight & selection features
#       during gameplay.   This extends to the use of the right mouse button to
#       enter the main menu  from the map screen.   A value of true enables the
#       ability to control menu functions with the mouse while a value of false
#       prevents them.
#
#-------------------------------------------------------------------------------
#
#  NOTES:
#
#  Odd as it may sound, Mousie prefers to use Near Fantastica's V1 Pathfinding
#  system in preferance  over Version 2.   This is merely because  version 1's
#  pathfinding algorythm, though more primitive,  takes less time to calculate
#  than version 2 and is thus more instantaneous.
#
#  If you change the on/off features of the menu and/or mouse movement options,
#  they only get saved  into the savegame file.  On startup,  the values within
#  the configuration system  will be  loaded  before the  savegame values  take
#  effect.  If one desires to have the effects of the mouse menu option to take
#  effect the moment  you enter the Title screen,  they will have to make their
#  own special save file.   This system covers only  the normal operations that
#  are expected in gameplay.
#
#  The Event Click feature was designed solely so the mouse can move overtop of
#  events and activate them with a single mouse click. This is a common feature
#  in sim and real time tactical games (such as Age of Empires, Warcraft, etc).
#  It also disables mouse movement (even if configured)  as it would appear odd
#  if clicking on an event  within a simulation game  moves a character towards
#  the same clicked object.  It is not a bug.  It is a feature.
#
#  For compatability  with an older 'Full Keyboard' script by Cybersam,  a new
#  method was added for the Input.pressed? command which his system uses.   It
#  is a basic replica  of the '.press?' method within the Input class,  merely
#  changing alias names and calls to suit Cybersam's input method.
#
#-------------------------------------------------------------------------------
#
#  CREDITS AND THANKS
#
#  Some routines within this script  have been based  on the work of Mr.Mo,
#  Lambchop, Behemoth and Near Fantastica.  I also have to thank Delmaschio
#  of RMVXP.Com and House Slasher  for noticing that autorun events did not
#  hinder point-n-click movement... now fixed.   Along with that,  allow me
#  to thank sixtyandaquarter for bringing up the idea  of enabling and dis-
#  abling menu and movement functions in the system.   And thanks to Reives
#  for the idea of changing  the entire set o f mouse icons in-game.  Some,
#  thanks to sixtyandaquarter for getting me off my butt and allow the sys-
#  tem click on events and run them immediately.  And finally to MeKool for
#  noticing an event freeze problem, and that I failed  to insert all of my
#  mouse positioning system.
#  
#===============================================================================
 

Страница 2. Код
 
  # Default Handle                    Default String
    MOUSE_DEFAULT                 =   "Default"
 
  # Mouse Array    Cursor Handle      Mouse Icon file
    MOUSE_ICON = { MOUSE_DEFAULT  =>  "Arrow",
                   "NPC"          =>  "Arrow-Event",
                   "Boom"         =>  "Arrow-Event2",
                   "Monster"      =>  "Arrow4"  }                   
 
  # Left-Clicking Control---
  # 0 = single click action
  # 1 = double-click action
  MOUSE_LEFT_ACTION = 0
 
  # Right-Clicking Control--
  # 0 = Menu / 'B' pressed
  # 1 = Stop Movement
  MOUSE_RIGHT_ACTION = 0
 
 
  # Mouse Movement on Startup --
  # true          = Mouse Movement is available
  # false or nil  = Movement disabled
  #
  # *  You can change point-n-click movement with the script call:
  #    mouse_move(boolean) where boolean is true or false.
  # ** Movement still relies on the use of a pathfinding script.
  MOUSE_MOVE_FUNCTION   = true
 
  # Mouse Event Click on Startup --
  # true          = Event Clicking is available
  # false or nil  = Event Clicking disabled
  #
  # *  You can change event clicking with the script call:
  #    mouse_click(boolean) where boolean is true or false.
  # ** This disables mouse movement altogether
  MOUSE_EVENT_FUNCTION  = true  
 
  # Mouse Menu Functions on Startup --
  # true          = Mouse Menu Control is available
  # false or nil  = Menu Control is disabled
  #
  # *  You can change menu control with the script call:
  #    mouse_menu(boolean) where boolean is true or false.
  # ** Unless you make your own configuration system, the
  #    Scene_Title functions will default to this regardless
  #    of any save game values.
  MOUSE_MENU_FUNCTION   = false
 
  # Visible on Startup --
  # true          = Mouse visible as normal
  # false or nil  = Mouse is hidden
  #
  # * You can change visibility with $game_system.mouse_visible_bool
  #   $game_system.mouse_visible_bool = false will hide the mouse.
  #   $game_system.mouse_visible_bool = true will reveal it again.
  #
  MOUSE_STARTUP_VISIBLE = true
 
  #  Movement range--
  #  Range in 'steps' the pathfinding
  #  for NF Pathfinding version 2 beta
  #  High values & large maps causes lag
  PF_RANGE = 100
 
 
module Mouse
  #-------------------------------------------------------------------------
  # * Win32API calls
  #-------------------------------------------------------------------------
  @cursor_pos_get = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
  @cursor_pos_set = Win32API.new('user32', 'SetCursorPos', 'ii', 'i')
  @cursor_show    = Win32API.new('user32', 'ShowCursor', 'L', 'i')
  @window_find    = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')  
  @window_c_rect  = Win32API.new('user32', 'GetClientRect', %w(l p), 'i')
  @window_scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i')
  @window_cli2scr = Win32API.new('user32', 'ClientToScreen', %w(l p), 'i')
  @readini        = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
  @key            = Win32API.new("user32", "GetAsyncKeyState", 'i', 'i')
  #-------------------------------------------------------------------------
  # * Mouse Button Values
  #-------------------------------------------------------------------------
  Left_Click    = 1
  Right_Click   = 2
  Middle_Click  = 4
  MOUSE_BUTTONS = { Left_Click    => 1,
                    Right_Click   => 2,
                    Middle_Click  => 4 }
  MOUSE_REPEAT = MOUSE_BUTTONS.clone
  MOUSE_REPEAT.keys.each { |k| MOUSE_REPEAT[k] = [false, false, 10]}  
  #-------------------------------------------------------------------------
  # * Game Initialization Values
  #-------------------------------------------------------------------------
  @game_window = nil    # Set game handle to nil
  @cursor_show.call(0)  # Turn off system mouse
  @mouse_visible = true # default mouse setting
  #-------------------------------------------------------------------------
  # * Click?
  #     button : button to check
  #-------------------------------------------------------------------------
  def Mouse.click?(button)
    MOUSE_REPEAT[button][1] >= 1
  end
  #-------------------------------------------------------------------------
  # * Double Clicked?
  #     button : button to check
  #-------------------------------------------------------------------------
  def Mouse.dbclick?(button)
    MOUSE_REPEAT[button][1] == 2
  end  
  #-------------------------------------------------------------------------
  # * press?
  #     button : button to check
  #-------------------------------------------------------------------------
  def Mouse.press?(button)
    MOUSE_REPEAT[button][0] == true
  end    
  #-------------------------------------------------------------------------
  # * Get Mouse Position
  #-------------------------------------------------------------------------
  def Mouse.pos(catch_anywhere = true)
    x, y = screen_to_client(screen_x, screen_y)
    width, height = client_size
    if catch_anywhere or (x >= 0 and y >= 0 and x < width and y < height)  
      return x, y
    else
      return 0, 0
    end    
  end
  #-------------------------------------------------------------------------
  # * Set Mouse Position
  #     x      : new x-coordinate (0 to 640)
  #     y      : new y-coordinate (0 to 480)
  #-------------------------------------------------------------------------
  def Mouse.pos_set(x, y)
    x = [[x, 0].max, 640].min
    y = [[y, 0].max, 480].min
    x, y = client_to_screen(x, y)
    @cursor_pos_set.call(x, y)
  end
  #-------------------------------------------------------------------------
  # * Get Mouse X-Coordinate Position
  #-------------------------------------------------------------------------
  def Mouse.pos_x
    x, y = pos
    return x
  end
  #-------------------------------------------------------------------------
  # * Get Mouse Y-Coordinate Position
  #-------------------------------------------------------------------------
  def Mouse.pos_y
    x, y = pos
    return y
  end
  #-------------------------------------------------------------------------
  # * Get Mouse Screen Position
  #-------------------------------------------------------------------------
  def Mouse.screen
    pos = [0, 0].pack('ll')
    @cursor_pos_get.call(pos)
    return pos.unpack('ll')
  end  
  #-------------------------------------------------------------------------
  # * Get Mouse Screen X-Coordinate Position
  #-------------------------------------------------------------------------
  def Mouse.screen_x
    pos = [0, 0].pack('ll')
    @cursor_pos_get.call(pos)
    return pos.unpack('ll')[0]
  end
  #-------------------------------------------------------------------------
  # * Get Mouse Screen Y-Coordinate Position
  #-------------------------------------------------------------------------
  def Mouse.screen_y
    pos = [0, 0].pack('ll')
    @cursor_pos_get.call(pos)
    return pos.unpack('ll')[1]
  end
  #-------------------------------------------------------------------------
  #                           AUTOMATIC FUNCTIONS                          #
  #-------------------------------------------------------------------------
  #-------------------------------------------------------------------------
  # * Get the Game Window's width and height
  #-------------------------------------------------------------------------
  def Mouse.client_size
    rect = [0, 0, 0, 0].pack('l4')
    @window_c_rect.call(Mouse.hwnd, rect)
    right, bottom = rect.unpack('l4')[2..3]
    return right, bottom
  end  
  #-------------------------------------------------------------------------
  # * Get the game window handle (specific to game)
  #-------------------------------------------------------------------------
  def Mouse.hwnd
    if @game_window.nil?
      game_name = "\0" * 256
      @readini.call('Game','Title','',game_name,255,".\\Game.ini")
      game_name.delete!("\0")
      @game_window = @window_find.call('RGSS Player',game_name)
    end
    return @game_window
  end  
  #-------------------------------------------------------------------------  
  # * Convert game window coordinates from screen coordinates
  #-------------------------------------------------------------------------  
  def Mouse.screen_to_client(x, y)
    return nil unless x and y
    pos = [x, y].pack('ll')
    if @window_scr2cli.call(hwnd, pos) != 0
       return pos.unpack('ll')
     else
       return nil
    end
  end
  #-------------------------------------------------------------------------  
  # * Converts client coordinates to screen coordinates
  #-------------------------------------------------------------------------  
  def Mouse.client_to_screen(x, y)
    return nil unless x and y
    pos = [x, y].pack('ll')
    if @window_cli2scr.call(hwnd, pos) != 0
       return pos.unpack('ll')
    else
       return nil
    end
  end  
  #--------------------------------------------------------------------------
  # * Frame Update (Mouse version)
  #--------------------------------------------------------------------------
  def Mouse.update
    MOUSE_BUTTONS.keys.each do |key|
      temp = MOUSE_REPEAT[key][0]
      key_pres = @key.call(MOUSE_BUTTONS[key]) != 0
      key_trig = temp == key_pres ? 0 : (key_pres ? (MOUSE_REPEAT[key][2].between?(1, 9) ? 2 : 1) : -1)
      count = key_trig > 0 ? 0 : [MOUSE_REPEAT[key][2]+1, 20].min
      MOUSE_REPEAT[key] = [key_pres, key_trig, count]
    end
  end
  #-------------------------------------------------------------------------
  # * Visible?
  #-------------------------------------------------------------------------
  def Mouse.visible?(visible=true)
    if visible
      @cursor_show.call(-1)
    else
      @cursor_show.call(0)
    end
  end
end
 
 
 
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of
#  this class.
#==============================================================================
 
class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :mouse_pf1                # Path Finding v1 detection bool
  attr_accessor :mouse_pf2                # Path Finding v2 detection bool
  attr_accessor :mouse_visible_bool       # Mouse System Visibility bool
  attr_accessor :menu_enabled             # Mouse Controlled Menu bool
  attr_accessor :move_enabled             # Mouse Controlled Movement bool
  attr_accessor :eclick_enabled           # Mouse Event Clicking bool
  attr_accessor :mouse_icon_set           # Mouse icons
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias mouse_init initialize
  def initialize
    mouse_init
    @mouse_pf1          = nil
    @mouse_pf2          = nil
    @mouse_visible_bool = MOUSE_STARTUP_VISIBLE
    @move_enabled       = nil
    @menu_enabled       = nil
    @eclick_enabled     = nil
    @mouse_icon_set     = {}
  end
end
 
 
 
#==============================================================================
# ** Sprite_Mouse
#------------------------------------------------------------------------------
#  This sprite is used to display the mouse.  It observes the Mouse module and
#  automatically changes mouse graphic conditions.
#==============================================================================
 
class Sprite_Mouse
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :icon
  attr_accessor :x
  attr_accessor :y
  attr_accessor :clicked
  attr_accessor :menu_enabled
  attr_accessor :move_enabled
  attr_accessor :eclick_enabled
  attr_accessor :mouse_icon_set
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @x              = 0
    @y              = 0
    @clicked        = nil
    @sprite         = Sprite.new
    @sprite.z       = 5000
    @draw           = false
    @events         = {}
    @move_enabled   = MOUSE_MOVE_FUNCTION
    @menu_enabled   = MOUSE_MENU_FUNCTION
    @eclick_enabled = MOUSE_EVENT_FUNCTION
    @mouse_icon_set = MOUSE_ICON
    reset
  end
  #--------------------------------------------------------------------------
  # * Reset
  #--------------------------------------------------------------------------
  def reset
    @icon = RPG::Cache.icon(@mouse_icon_set[MOUSE_DEFAULT])
    @icon_name = @mouse_icon_set[MOUSE_DEFAULT]
    @sprite.bitmap.dispose if @sprite.bitmap != nil and @sprite.bitmap.disposed?
    @sprite.bitmap = @icon
    @draw = false
    # Updates the co-ordinates of the icon
    @x, @y = Mouse.pos
    @sprite.x = @x
    @sprite.y = @y
    @sprite.z = 5000
    unless defined?($game_system.mouse_visible_bool)
      @sprite.visible = MOUSE_STARTUP_VISIBLE  
    else
      @sprite.visible = $game_system.mouse_visible_bool ? true : false
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    Mouse.update
    @sprite.visible = $game_system.mouse_visible_bool ? true : false
    # Updates the co-ordinates of the icon
    @x, @y = Mouse.pos
    # Skip if not on the screen
    return if @x == nil or @y == nil
    #Get Client Size
    width,height = Mouse.client_size
    @sprite.x = @x
    @sprite.y = @y
    #Check if needs to restart
    (@draw = (@x < 0 or @y < 0 or @x > width or @y > height)) if !@draw
    #Reset if need to reset
    reset if @draw and @x > 1 and @y > 1 and @x < width and @y < height
    #Show mouse if need to
    if (@x < 0 or @y < 0 or @x > width or @y > height) and @visible
      Mouse.visible?
    elsif (@x > 0 or @y > 0 or @x < width or @y < height) and !@visible
      Mouse.visible?(false)
    end
    #Return if Scene is not Scene_Map
    return if !$scene.is_a?(Scene_Map)
    # Return if mouse movement disabled
    return unless $mouse.move_enabled or $mouse.eclick_enabled
    # Prevent movement if event running or message showing
    unless $game_system.map_interpreter.running? or
      $game_temp.message_window_showing    
      #Check if the mouse is clicked
      mouse_pressed if Mouse.click?(Mouse::Left_Click) and !$game_temp.message_window_showing
      if MOUSE_RIGHT_ACTION == 1
        if $game_system.mouse_pf1
          $game_player.clear_path if Mouse.click?(Mouse::Right_Click)
        end
        if $game_system.mouse_pf2
          $path_finding.setup_depth(PF_RANGE)
          $path_finding.setup_player if Mouse.click?(Mouse::Right_Click)
        end
      end
    end    
    #Check for mouse over
    mouse_over_icon
  end
  #--------------------------------------------------------------------------
  # * Mouse Pressed
  #--------------------------------------------------------------------------
  def mouse_pressed(button_type = nil)
    @clicked = 1
    if Mouse.dbclick?(Mouse::Left_Click)
      @clicked = 2
    end
    # If event Clicking
    if @eclick_enabled
      evented = get_object
      if evented[0]
        evented[1].start if evented[1].trigger == 0
      end
    else
      # Routines called for Path Finding v1
      if $game_system.mouse_pf1
        # Turn to face regardless
        $game_player.find_facing(tile_x, tile_y)
        #If there is nothing than move
        return if !$game_map.passable?(tile_x, tile_y, 0, $game_player)
        $game_player.find_path(tile_x, tile_y)
      end
      # Routines called for Path Finding v2
      if $game_system.mouse_pf2
        $path_finding.setup_depth(PF_RANGE)
        $path_finding.setup_player
        $path_finding.add_paths_player(tile_x, tile_y, true)
        $path_finding.start_player      
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Mouseover Icon
  #--------------------------------------------------------------------------
  def mouse_over_icon
    object = get_object
    if object[0]
      event = @events[object[1].id]
      return if event == nil
      list = event.list
      return if list == nil
      #Check what the list is
      for key in @mouse_icon_set.keys
        next if !list.include?(key)
        next if @icon_name == @mouse_icon_set[key]
        @icon = RPG::Cache.icon(@mouse_icon_set[key])
        @icon_name = @mouse_icon_set[key]
        @sprite.bitmap.dispose if @sprite.bitmap != nil or @sprite.bitmap.disposed?
        @sprite.bitmap = @icon
      end
    elsif @icon_name != @mouse_icon_set[MOUSE_DEFAULT]
      @icon = RPG::Cache.icon(@mouse_icon_set[MOUSE_DEFAULT])
      @icon_name = @mouse_icon_set[MOUSE_DEFAULT]
      @sprite.bitmap.dispose if @sprite.bitmap != nil or @sprite.bitmap.disposed?
      @sprite.bitmap = @icon
    end
  end
  #--------------------------------------------------------------------------
  # * Get the current x-coordinate of the tile
  #--------------------------------------------------------------------------
  def tile_x
    return ((($game_map.display_x.to_f/4.0).floor + @x.to_f)/32.0).floor
  end
  #--------------------------------------------------------------------------
  # * Get the current y-coordinate of the tile
  #--------------------------------------------------------------------------
  def tile_y
    return ((($game_map.display_y.to_f/4.0).floor + @y.to_f)/32.0).floor
  end  
  #--------------------------------------------------------------------------
  # * Get Object
  #--------------------------------------------------------------------------
  def get_object
    for event in $game_map.events.values
      return [true,event] if event.x == tile_x and event.y == tile_y
    end
    return [false,nil]
  end  
  #--------------------------------------------------------------------------
  # * MOUSE Refresh(Event, List, Characterset Name
  #--------------------------------------------------------------------------
  def refresh(event, list)
    @events.delete(event.id)
    if event.list && event.list[0].code == 108
      icon = event.list[0].parameters
    end
    @events[event.id] = Mouse_Event.new(event.id)
    @events[event.id].list = icon
  end
end
 
 
 
$mouse = Sprite_Mouse.new
 
 
#==============================================================================
# ** Mouse_Event
#------------------------------------------------------------------------------
#  This class deals with events. It adds new functionality between events and
#  the mouse system.  It's used within the Game_Map class.
#==============================================================================
 
class Mouse_Event
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :id
  attr_accessor :list
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(id)
    @id = id
    @list = nil
  end
end
 
 
 
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
#  switching via condition determinants, and running parallel process events.
#  It's used within the Game_Map class.
#==============================================================================
 
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Event ID
  #--------------------------------------------------------------------------
  def id
    return @id
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  alias nf_game_event_refresh refresh
  def refresh
    nf_game_event_refresh
    $mouse.refresh(self, @list)
  end
end
 
 
 
#==============================================================================
# ** Input
#------------------------------------------------------------------------------
#   Adds new Mouse Input functions into a new class
#==============================================================================
class << Input
  #--------------------------------------------------------------------------
  # * Update old input calls
  #--------------------------------------------------------------------------
  alias old_update update unless $@
  def Input.update
    old_update
    $mouse.update
  end
  #--------------------------------------------------------------------------
  # * Update old input triggers
  #     num : A, B, C
  #--------------------------------------------------------------------------
  alias old_trigger? trigger? unless $@
  def Input.trigger?(num)
    return old_trigger?(num) if Mouse.pos(false) == nil
    case num
    when Input::A
      if  $mouse.menu_enabled && !$scene.is_a?(Scene_Map)
        return (old_trigger?(num) or Mouse.click?(Mouse::Middle_Click))
      else
        return old_trigger?(num)
      end
    when Input::B
      if MOUSE_RIGHT_ACTION == 0
        if $mouse.menu_enabled
          return (old_trigger?(num) or Mouse.click?(Mouse::Right_Click))
        else
          return old_trigger?(num)
        end
      else
        if $mouse.menu_enabled
          return (old_trigger?(num) or Mouse.click?(Mouse::Right_Click))          
        else
          return (old_trigger?(num))
        end
      end
    when Input::C
      if MOUSE_LEFT_ACTION == 0
        if $mouse.menu_enabled && !$scene.is_a?(Scene_Map)
          return (old_trigger?(num) or Mouse.click?(Mouse::Left_Click))        
        elsif $mouse.move_enabled && $scene.is_a?(Scene_Map)
          return (old_trigger?(num) or Mouse.click?(Mouse::Left_Click))        
        elsif $mouse.eclick_enabled && $scene.is_a?(Scene_Map)
          return Mouse.click?(Mouse::Left_Click)
        else
          return old_trigger?(num)
        end
      else
        if !$scene.is_a?(Scene_Map)
          if $mouse.menu_enabled
            return (old_trigger?(num) or Mouse.click?(Mouse::Left_Click))
          else
            return old_trigger?(num)
          end
        else
          if $mouse.clicked == 2
            return (old_trigger?(num) or Mouse.click?(Mouse::Left_Click))
          else
            return (old_trigger?(num))
          end
        end
      end
    else
      return old_trigger?(num)
    end
  end
  #--------------------------------------------------------------------------
  # * Update old input presses
  #     num : A, B, C
  #--------------------------------------------------------------------------
  alias old_press? press? unless $@
  def Input.press?(num)
    return old_press?(num) if Mouse.pos(false) == nil
    case num
    when Input::A
      if  $mouse.menu_enabled && !$scene.is_a?(Scene_Map)
        return (old_press?(num) or Mouse.press?(Mouse::Middle_Click))
      else
        return old_press?(num)
      end
    when Input::B
      if MOUSE_RIGHT_ACTION == 0
        if $mouse.menu_enabled
          return (old_press?(num) or Mouse.press?(Mouse::Right_Click))
        else
          return old_press?(num)
        end
      else
        if $mouse.menu_enabled
          return (old_press?(num) or Mouse.press?(Mouse::Right_Click))          
        else
          return (old_press?(num))
        end
      end
    when Input::C
      if MOUSE_LEFT_ACTION == 0
        if $mouse.menu_enabled && !$scene.is_a?(Scene_Map)
          return (old_press?(num) or Mouse.press?(Mouse::Left_Click))        
        elsif $mouse.move_enabled && $scene.is_a?(Scene_Map)
          return (old_press?(num) or Mouse.press?(Mouse::Left_Click))        
        elsif $mouse.eclick_enabled && $scene.is_a?(Scene_Map)
          return Mouse.press?(Mouse::Left_Click)
        else
          return old_press?(num)
        end
      else
        if !$scene.is_a?(Scene_Map)
          if $mouse.menu_enabled
            return (old_press?(num) or Mouse.press?(Mouse::Left_Click))
          else
            return old_press?(num)
          end
        else
          return (old_press?(num))
        end
      end
    else
      return old_press?(num)
    end
  end
  #--------------------------------------------------------------------------
  # * Update old input presses (Cybersam Version)
  #     num : A, B, C
  #--------------------------------------------------------------------------
  if defined?(Input.pressed?)
    alias old_pressed? pressed? unless $@
    def Input.pressed?(num)
      return old_press?(num) if Mouse.pos(false) == nil
      case num
      when Input::A
        if  $mouse.menu_enabled && !$scene.is_a?(Scene_Map)
          return (old_pressed?(num) or Mouse.press?(Mouse::Middle_Click))
        else
          return old_pressed?(num)
        end
      when Input::B
        if MOUSE_RIGHT_ACTION == 0
          if $mouse.menu_enabled
            return (old_pressed?(num) or Mouse.press?(Mouse::Right_Click))
          else
            return old_pressed?(num)
          end
        else
          if $mouse.menu_enabled
            return (old_pressed?(num) or Mouse.press?(Mouse::Right_Click))          
          else
            return (old_pressed?(num))
          end
        end
      when Input::C
        if MOUSE_LEFT_ACTION == 0
          if $mouse.menu_enabled && !$scene.is_a?(Scene_Map)
            return (old_pressed?(num) or Mouse.press?(Mouse::Left_Click))        
          elsif $mouse.move_enabled && $scene.is_a?(Scene_Map)
            return (old_pressed?(num) or Mouse.press?(Mouse::Left_Click))        
          elsif $mouse.eclick_enabled && $scene.is_a?(Scene_Map)
            return Mouse.press?(Mouse::Left_Click)
          else
            return old_pressed?(num)
          end
        else
          if !$scene.is_a?(Scene_Map)
            if $mouse.menu_enabled
              return (old_pressed?(num) or Mouse.press?(Mouse::Left_Click))
            else
              return old_pressed?(num)
            end
          else
            return (old_pressed?(num))
          end
        end
      else
        return old_pressed?(num)
      end
    end
  end
end
 
 
 
 
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================
 
class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------  
  attr_accessor :facingpath               # direction faced if 1 tile away
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias mouse_init initialize
  def initialize
    mouse_init
    # Path Finding v1 Detection
    if defined?(find_path)
      $game_system.mouse_pf1 = true
    else
      if defined?(pf_passable?)
        $game_system.mouse_pf2 = true
      end
    end
  end  
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias mouse_update update
  def update
    turn_facing if @facingpath != 0
    mouse_update
  end  
  #--------------------------------------------------------------------------
  # * Find Facing Direction
  #   Addition to Path Finding v 1
  #--------------------------------------------------------------------------  
  def find_facing(x,y)
    sx, sy = @x, @y      
    @facingpath = find_direction(sx,sy,x,y)
  end  
  #--------------------------------------------------------------------------
  # * Find Direction
  #   Addition to Path Finding v 1
  #--------------------------------------------------------------------------  
  def find_direction(sx,sy,ex,ey)
    ffx = sx - ex
    ffy = sy - ey
    facing = 0
    case ffx
    when 1 ; facing = 4
    when -1; facing = 6
    when 0
      case ffy
      when 1 ; facing = 8
      when -1; facing = 2
      end
    end
    return facing
  end  
  #--------------------------------------------------------------------------
  # * Turn Towards Object
  #   Addition to Path Finding v 1
  #--------------------------------------------------------------------------
  def turn_to(b)
    # Get difference in player coordinates
    sx = @x - b.x
    sy = @y - b.y
    # If coordinates are equal
    if sx == 0 and sy == 0
      return
    end
    # If horizontal distance is longer
    if sx.abs > sy.abs
      # Turn to the right or left towards player
      sx > 0 ? turn_left : turn_right
    # If vertical distance is longer
    else
      # Turn up or down towards player
      sy > 0 ? turn_up : turn_down
    end
  end
  #--------------------------------------------------------------------------
  # * Turn Facing Click
  #   Addition to Path Finding v 1
  #--------------------------------------------------------------------------  
  def turn_facing
    case @facingpath
    when 2; turn_down
    when 4; turn_left
    when 6; turn_right
    when 8; turn_up
    end
    # Turn off
    @facingpath = 0
  end  
  #--------------------------------------------------------------------------
  # * Run Path
  #   EDIT to Path Finding v 1
  #--------------------------------------------------------------------------
  def run_path
    return if moving?
    step = @map[@x,@y]
    if step == 1
      @map = nil
      @runpath = false
      turn_to(@object) if @object != nil and in_range?(self, @object, 1)
      return
    end
    dir = rand(2)
    case dir
    when 0
      move_right  if @map[@x+1, @y]   == step - 1 and step != 0
      move_down   if @map[@x,   @y+1] == step - 1 and step != 0
      move_left   if @map[@x-1, @y]   == step - 1 and step != 0
      move_up     if @map[@x,   @y-1] == step - 1 and step != 0
    when 1
      move_up     if @map[@x,   @y-1] == step - 1 and step != 0
      move_left   if @map[@x-1, @y]   == step - 1 and step != 0
      move_down   if @map[@x,   @y+1] == step - 1 and step != 0
      move_right  if @map[@x+1, @y]   == step - 1 and step != 0
    end
  end  
end
 
 
 
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
#  This interpreter runs event commands. This class is used within the
#  Game_System class and the Game_Event class.
#==============================================================================
 
class Interpreter
  #--------------------------------------------------------------------------
  # * Mouse Movement Enabler
  #     boolean : (true/false)
  #--------------------------------------------------------------------------
  def mouse_move(boolean = true)
    if boolean == true
      $mouse.move_enabled = true
    else
      $mouse.move_enabled = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Mouse Menu Enabler
  #     boolean : (true/false)
  #--------------------------------------------------------------------------
  def mouse_menu(boolean = true)
    if boolean == true
      $mouse.menu_enabled = true
    else
      $mouse.menu_enabled = nil
    end
  end  
  #--------------------------------------------------------------------------
  # * Mouse Event Enabler
  #     boolean : (true/false)
  #--------------------------------------------------------------------------
  def mouse_event(boolean = true)
    if boolean == true
      $mouse.eclick_enabled = true
    else
      $mouse.eclick_enabled = nil
    end
  end
end
 
 
 
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
#  This class performs save screen processing.
#==============================================================================
 
class Scene_Save < Scene_File
  #--------------------------------------------------------------------------
  # * Write Save Data
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  alias mouse_wsd write_save_data
  def write_save_data(file)
    # Store Mouse Values
    $game_system.move_enabled   = $mouse.move_enabled
    $game_system.menu_enabled   = $mouse.menu_enabled
    $game_system.eclick_enabled = $mouse.eclick_enabled   
    $game_system.mouse_icon_set = $mouse.mouse_icon_set
    # Perform the original call
    mouse_wsd(file)
  end
end
 
 
#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================
 
class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Read Save Data
  #     file : file object for reading (opened)
  #--------------------------------------------------------------------------
  alias mouse_rsd read_save_data
  def read_save_data(file)
    # Perform the original call
    mouse_rsd(file)
    # Restore Mouse values
    $mouse.move_enabled   = $game_system.move_enabled
    $mouse.menu_enabled   = $game_system.menu_enabled
    $mouse.eclick_enabled = $game_system.eclick_enabled
    $mouse.mouse_icon_set = $game_system.mouse_icon_set
  end
end

Источник: взято отсюда (требуется регистрация и знание испанского)
Последнее редактирование: 10 года 11 мес. назад от DeadElf79.
Администратор запретил публиковать записи гостям.

[XP] Скрипт Mousie ни у кого не завалялся? 10 года 11 мес. назад #60060

  • strelokhalfer
  • strelokhalfer аватар
  • Вне сайта
  • Архитектор Миров
  • Знатный грамотей
  • Сообщений: 1640
  • Спасибо получено: 1078
  • 2 место Даритель СтимкеяПрограммист RubyПереводчик2 место Сбитая кодировкаОрганизатор конкурсов
Насколько я помню, поддержка мыши глючная.
"Стрелок, что-то ты неочень похож на свой аватар..."(с)
Администратор запретил публиковать записи гостям.

[XP] Скрипт Mousie ни у кого не завалялся? 10 года 11 мес. назад #60063

  • DeadElf79
  • DeadElf79 аватар
  • Вне сайта
  • Звездный Страж
  • Сообщений: 3147
  • Спасибо получено: 2650
  • ВетеранПроект месяца 2 местоПрограммист Ruby3 местоПисатель 3 место1 место в ГотвПроект месяца 1 местоУчительОрганизатор конкурсов
Стрелок, примеры, доказательства?

Если действительно некачественный скрипт (а не руки кривые), дам ссылки на рабочие альтернативы, мною же проверенные.
Сразу предупреждаю - большинство систем, работающих с мышью несовместимы с CMS, основанных на изображениях, я не на со стандартным классом Window.
Последнее редактирование: 10 года 11 мес. назад от DeadElf79.
Администратор запретил публиковать записи гостям.
Время создания страницы: 0.277 секунд