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.

Messages - R5GAMER

21
Script Requests / GamePad and Blizz-ABS
March 28, 2015, 10:08:08 pm
Hello!

I found a script which allows to use the gamepad but by trying him(it) on my project
I have the impression that the code doesn't works certainly because the system of Blizz ABS
takes the priority but I shall like that the player can have the possibility of playing either on the keyboard or on the gamepad:)


#≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
# ** Glitchfinder's Gamepad Input Module          [RPG Maker XP] [RPG Maker VX]
#    Version 1.00
#------------------------------------------------------------------------------
#  This script helps scripters to use an XInput-compatible gamepad with their
#  games.
#==============================================================================
# * Version History
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#   Version 1.00 ------------------------------------------------- (2010-08-20)
#     - Initial version
#     - Author: Glitchfinder
#==============================================================================
# * Instructions
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#  Place this script above Main, and below the default scripts. (I realize this
#  is obvious to most, but some people don't get it.)
#
#  You must also place Input.dll into the game's main project folder, since
#  this script needs it to access the XInput functions it uses.
#
#  This module is automatically updated by the default Input module, which
#  means that the only time you need to call the update method is in a scene
#  that does not update the default Input module.
#
#  This module does not break the functionality of the default Input module.
#
#  To use this module to check a gamepad button, simply use one of the four
#  methods (press?(button[, index]), trigger?(button[, index]),
#  repeat?(button[, index]), or release?(button[, index])), where button is the
#  constant of the button you want to check. Button may also be used as
#  Gamepad::BUTTONNAME. For a list of acceptable button names, look below the
#  header, in the section that declares button constants. The methods use index
#  to determine which gamepad to check. If no index is given, they will check
#  gamepad 0. Index is a value from 0 to 3.
#
#  To use this module to check a gamepad trigger or joystick, simply use one of
#  the four methods (axis_press?(axis[, index]), axis_trigger?(axis[, index]),
#  axis_repeat?(axis[, index]), or axis_release?(axis[, index])), where axis is
#  the constant of the axis you want to check. Axis may also be used as
#  Gamepad::AXISNAME. For a list of acceptable axis names, look below the
#  header, in the section that declares axis constants. The methods use index
#  to determine which gamepad to check. If no index is given, they will check
#  gamepad 0. Index is a value from 0 to 3.
#
#  To use this module to check the value on a gamepad triger or joystick axis,
#  use one of the two methods (axis_value(axis[, index]),
#  real_axis_value(axis[, index])), where axis is the constant of the axis you
#  want to check. Axis may also be used as Gamepad::AXISNAME. For a list of
#  acceptable axis names, look below the header, in the section that declares
#  axis constants. The methods use index to determine which gamepad to check.
#  If no index is given, they will check gamepad 0. Index is a value from 0 to
#  3. The difference between these two methods is that real_axis_value() will
#  always return the current value, while axis_value will return 0 if the
#  axis falls within its dead zone.
#
#  To use this module to cause a gamepad to "rumble", or vibrate, use the
#  vibrate() method. Details for that are below, in the method list.
#==============================================================================
# * Method List
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#  Gamepad.update
#    Updates gamepad input. Calls to this method are not necessary unless the
#    default Input module is not being updated.
#
#  Gamepad.press?(button[, index])
#    Determines whether the gamepad button determined by button is currently
#    being pressed. If the button is being pressed, returns true. If not,
#    returns false. Uses index to determine the gamepad to check, from 0 to 3.
#    The index defaults to 0.
#
#  Gamepad.trigger?(button[, index])
#    Determines whether the gamepad button determined by button is being
#    pressed again. "Pressed again" is seen as time having passed between the
#    button being not pressed and being pressed. If the button is being
#    pressed, returns true. If not, returns false. Uses index to determine the
#    gamepad to check, from 0 to 3. The index defaults to 0.
#
#  Gamepad.repeat?(button[, index])
#    Determines whether the gamepad button determined by button is being
#    pressed again. Unlike trigger?(), this takes into account the repeat input
#    of a button being held down continuously. If the button is being pressed,
#    returns true. If not, returns false. Uses index to determine the gamepad
#    to check, from 0 to 3. The index defaults to 0.
#
#  Gamepad.release?(button[, index])
#    Determines whether the gamepad button determined by button has just been
#    released. If the button has been released, returns true. If not, returns
#    false. Uses index to determine the gamepad to check, from 0 to 3. The
#    index defaults to 0.
#
#  Gamepad.axis_press?(axis[, index])
#    Determines whether the gamepad axis determined by axis is currently being
#    pressed. If the button is being pressed, returns true. If not, returns
#    false. Uses index to determine the gamepad to check, from 0 to 3. The
#    index defaults to 0.
#
#  Gamepad.axis_trigger?(axis[, index])
#    Determines whether the gamepad axis determined by axis is being pressed
#    again. "Pressed again" is seen as time having passed between the button
#    being not pressed and being pressed. If the button is being pressed,
#    returns true. If not, returns false. Uses index to determine the gamepad
#    to check, from 0 to 3. The index defaults to 0.
#
#  Gamepad.axis_repeat?(axis[, index])
#    Determines whether the gamepad axis determined by axis is being pressed
#    again. Unlike trigger?(), this takes into account the repeat input of a
#    button being held down continuously. If the button is being pressed,
#    returns true. If not, returns false. Uses index to determine the gamepad
#    to check, from 0 to 3. The index defaults to 0.
#
#  Gamepad.axis_release?(axis[, index])
#    Determines whether the gamepad axis determined by axis has just been
#    released. If the button has been released, returns true. If not, returns
#    false. Uses index to determine the gamepad to check, from 0 to 3. The
#    index defaults to 0.
#
#  Gamepad.axis_value(axis[, index])
#    Returns the current value of the gamepad axis determined by axis. The
#    gamepad checked is determined by index, from 0 to 3. The value for index
#    is 0 if none is provided. If the value for the axis falls within the dead
#    zone specified for that axis, then axis_value() will return 0.
#
#  Gamepad.real_axis_value(axis[, index])
#    Returns the current value of the gamepad axis determined by axis. The
#    gamepad checked is determined by index, from 0 to 3. The value for index
#    is 0 if none is provided. This method ignores the dead zone for the axis,
#    and will always return the current value.
#
#  Gamepad.vibrate(left_motor, right_motor, frames[, index])
#    Causes the motors to vibrate for the number of frames specified. The
#    values for left_motor and right_motor range from 0 to 65535, though the
#    motors themselves may differ in function, as they do in an Xbox 360
#    controller, resulting in a different "feel" depending on the motor you
#    select. Uses index to determine the gamepad to check, from 0 to 3. The
#    index defaults to 0.
#==============================================================================
# * Known Issues
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#  This script currently has trouble with the vibrate method, which does not
#  allow you to set one motor independently of the other. This part of a
#  planned update sometime in the future.
#==============================================================================
# * Glitchfinder's Advice
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#  This script is meant for people with a medium or advanced level of scripting
#  knowledge and ability, or for those using scripts that require this module.
#==============================================================================
# * Contact
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#  Glitchfinder, the author of this script, may be contacted through his
#  website, found at http://www.glitchkey.com
#
#  You may also find Glitchfinder at http://www.hbgames.org
#==============================================================================
# * Usage
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#  This script may be used with the following terms and conditions:
#
#    1. This script is free to use in any noncommercial project. If you wish to
#       use this script in a commercial (paid) project, please contact
#       Glitchfinder at his website.
#    2. This script may only be hosted at the following domains:
#         http://www.glitchkey.com
#         http://www.hbgames.org
#    3. If you wish to host this script elsewhere, please contact Glitchfinder.
#    4. If you wish to translate this script, please contact Glitchfinder. He
#       will need the web address that you plan to host the script at, as well
#       as the language this script is being translated to.
#    5. This header must remain intact at all times.
#    6. Glitchfinder remains the sole owner of this code. He may modify or
#       revoke this license at any time, for any reason.
#    7. Any code derived from code within this script is owned by Glitchfinder,
#       and you must have his permission to publish, host, or distribute his
#       code.
#    8. This license applies to all code derived from the code within this
#       script.
#    9. If you use this script within your project, you must include visible
#       credit to Glitchfinder, within reason.
#≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

#==============================================================================
# ** Gamepad
#------------------------------------------------------------------------------
#  This module performs gamepad input processing
#==============================================================================

module Gamepad
  #--------------------------------------------------------------------------
  # * Declare Button Constants
  #--------------------------------------------------------------------------
  DPAD_UP        = 0  # Directional pad up button
  DPAD_DOWN      = 1  # Directional pad down button
  DPAD_LEFT      = 2  # Directional pad left button
  DPAD_RIGHT     = 3  # Directional pad right button
  START          = 4  # Start button
  BACK           = 5  # Back button
  LEFT_THUMB     = 6  # Left thumb button
  RIGHT_THUMB    = 7  # Right thumb button
  LEFT_SHOULDER  = 8  # Left shoulder button
  RIGHT_SHOULDER = 9  # Right shoulder button
  A              = 10 # A button
  B              = 11 # B button
  X              = 12 # X Button
  Y              = 13 # Y Button
  #--------------------------------------------------------------------------
  # * Declare Axis Constants
  #--------------------------------------------------------------------------
  LEFT_TRIGGER   = 0  # Left trigger axis       (0 to 255)
  RIGHT_TRIGGER  = 1  # Right trigger axis      (0 to 255)
  LX             = 2  # Left thumbstick x axis  (-32768 to 32767)
  LY             = 3  # Left thumbstick y axis  (-32768 to 32767)
  RX             = 4  # Right thumbstick x axis (-32768 to 32767)
  RY             = 5  # Right thumbstick y axis (-32768 to 32767)
  #--------------------------------------------------------------------------
  # * Declare Module Variables
  #--------------------------------------------------------------------------
  begin
    # Declare API calls
    @gamepadGetCapabilities = Win32API.new('Input.dll',
      'GamepadGetCapabilities', 'IIP', 'I')
    @gamepadGetDSoundAudioDeviceGuids = Win32API.new('Input.dll',
      'GamepadGetDSoundAudioDeviceGuids', 'IPP', 'I')
    @gamepadGetState = Win32API.new('Input.dll', 'GamepadGetState', 'IP', 'I')
    @gamepadSetState = Win32API.new('Input.dll', 'GamepadSetState', 'IP', 'I')
    # Declare blank structures
    @capabilities = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].pack('c2S2c2s4S2')
    @gamepad = [0, 0, 0, 0, 0, 0, 0].pack('Sc2s4')
    @state = [0, 0, 0, 0, 0, 0, 0, 0].pack('ISc2s4')
    @vibrate = [0, 0].pack('n2')
    @gamepadGetCapabilities.call(0, 0, @capabilities)
    @capabilities.unpack('C2S2C2n6')
    # Create blank button array
    @buttons = Array.new(14, false)
    # Create a blank axis array
    @axis = Array.new(6, false)
    values = Array.new(6, 0)
    zones = [30, 30, 7849, 7849, 8689, 8689]
    # Declare controller information storage
    @controllers = {}
    # Declare default controller information
    @controllers.default = {
      'Active' => false,                   # Controller active flag
      'Change ID' => 0,                    # Current state change ID
      'Press' => @buttons.clone,           # Flags for button press state
      'Trigger' => @buttons.clone,         # Flags for button trigger state
      'Repeat' => @buttons.clone,          # Flags for button repeat state
      'Release' => @buttons.clone,         # Flags for button release state
      'Repeat Timer' => Array.new(14, 0),  # Timer for button repeat state
      'Base Repeat' => 15,                 # Base time for repeat flag (frames)
      'Axes' => Array.new(6, 0),           # Axis values
      'Axis Dead Zones' => zones.clone,    # Dead zone for the axes
      'Axis Press' => @axis.clone,         # Flags for axis press state
      'Axis Trigger' => @axis.clone,       # Flags for axis trigger state
      'Axis Repeat' => @axis.clone,        # Flags for axis repeat state
      'Axis Release' => @axis.clone,       # Flags for axis release state
      'Axis Repeat Timer' => values.clone, # Timer for axis repeat state
      'Vibrate State' => [0, 0],           # Current vibrate state
      'Vibrate Timer' => 0,                # Current vibrate timer
      'Vibrate Repeat Timer' => 0,         # Current rumbe repeat timer
      'Vibrate Minimum Timer' => 0         # Min. time before changing vibrate
    }
    # Iterate through the total number of controllers allowed
    for i in 0..3
      # Add a new controller to the controller array
      @controllers[i] = @controllers.default.clone
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def self.update
    # Iterate through all controllers
    for i in 0..3
      # Set up a blank state structure
      state = @state
      # Detect the controller state
      success = @gamepadGetState.call(i, state)
      # If the state was successfully obtained
      if success == 1
        # Set the controller to active
        @controllers[i]['Active'] = true
        # Backup the previous button states
        controller = @controllers[i].clone
        # Reset the controller button states
        @controllers[i]['Press']        = @buttons.clone
        @controllers[i]['Trigger']      = @buttons.clone
        @controllers[i]['Repeat']       = @buttons.clone
        @controllers[i]['Release']      = @buttons.clone
        @controllers[i]['Axis Press']   = @axis.clone
        @controllers[i]['Axis Trigger'] = @axis.clone
        @controllers[i]['Axis Repeat']  = @axis.clone
        @controllers[i]['Axis Release'] = @axis.clone
        # Unpack the controller state
        state = state.unpack('ISC2s4')
        # If the controller state has changed
        if state[0] != @controllers[i]['Change ID']
          # Add the controller button states to the controller state
          @controllers[i]['Press'][0]  = (state[1] & 0x00000001 == 0x00000001)
          @controllers[i]['Press'][1]  = (state[1] & 0x00000002 == 0x00000002)
          @controllers[i]['Press'][2]  = (state[1] & 0x00000004 == 0x00000004)
          @controllers[i]['Press'][3]  = (state[1] & 0x00000008 == 0x00000008)
          @controllers[i]['Press'][4]  = (state[1] & 0x00000010 == 0x00000010)
          @controllers[i]['Press'][5]  = (state[1] & 0x00000020 == 0x00000020)
          @controllers[i]['Press'][6]  = (state[1] & 0x00000040 == 0x00000040)
          @controllers[i]['Press'][7]  = (state[1] & 0x00000080 == 0x00000080)
          @controllers[i]['Press'][8]  = (state[1] & 0x0100 == 0x0100)
          @controllers[i]['Press'][9]  = (state[1] & 0x0200 == 0x0200)
          @controllers[i]['Press'][10] = (state[1] & 0x1000 == 0x1000)
          @controllers[i]['Press'][11] = (state[1] & 0x2000 == 0x2000)
          @controllers[i]['Press'][12] = (state[1] & 0x4000 == 0x4000)
          @controllers[i]['Press'][13] = (state[1] & 0x8000 == 0x8000)
          # Add the controller trigger states to the current controller state
          @controllers[i]['Axes'][0]   = state[2]
          @controllers[i]['Axes'][1]   = state[3]
          # Add the controller thumb coords to the current controller state
          @controllers[i]['Axes'][2]   = state[4]
          @controllers[i]['Axes'][3]   = state[5]
          @controllers[i]['Axes'][4]   = state[6]
          @controllers[i]['Axes'][5]   = state[7]
        end
        # Iterate through the buttons
        for button in 0...@controllers[i]['Press'].size
          # If the button is pressed, and the repeat count is at 0
          if ((@controllers[i]['Press'][button] == true) &&
            (@controllers[i]['Repeat Timer'][button] <= 0))
            # Set the button to repeat
            @controllers[i]['Repeat'][button] = true
            # Get the base repeat time
            repeat_timer = @controllers[i]['Base Repeat']
            # Reset the repeat timer
            @controllers[i]['Repeat Timer'][button] = repeat_timer
          # If the repeat timer is above 0
          elsif @controllers[i]['Repeat Timer'][button] > 0
            # Cycle down the repeat timer
            @controllers[i]['Repeat Timer'][button] -= 1
          end
          # If the button is pressed, and it wasn't pressed previously
          if ((@controllers[i]['Press'][button] == true) &&
            (controller['Press'][button] == false))
            # Set the button to trigger
            @controllers[i]['Trigger'][button] = true
          # If the button is not pressed, and it was previously
          elsif ((@controllers[i]['Press'][button] == false) &&
            (controller['Press'][button] == true))
            # Set the button to release
            @controllers[i]['Release'][button] = true
          end
        end
        # Iterate through the buttons
        for axis in 0...@controllers[i]['Axes'].size
          # If the trigger is greater than the dead zone, set it to pressed
          if (@controllers[i]['Axes'][axis].abs >
            @controllers[i]['Axis Dead Zones'][axis])
            # Set the axis to pressed
            @controllers[i]['Axis Press'][axis] = true
          end
          # If the axis is pressed, and the repeat count is at 0
          if ((@controllers[i]['Axis Press'][axis] == true) &&
            (@controllers[i]['Axis Repeat Timer'][axis] <= 0))
            # Set the axis to repeat
            @controllers[i]['Axis Repeat'][axis] = true
            # Get the base repeat time
            repeat_timer = @controllers[i]['Base Repeat']
            # Reset the repeat timer
            @controllers[i]['Axis Repeat Timer'][axis] = repeat_timer
          # If the repeat timer is above 0
          elsif @controllers[i]['Axis Repeat Timer'][axis] > 0
            # Cycle down the repeat timer
            @controllers[i]['Axis Repeat Timer'][axis] -= 1
          end
          # If the axis is pressed, and it wasn't pressed previously
          if ((@controllers[i]['Axis Press'][axis] == true) &&
            (controller['Axis Press'][axis] == false))
            # Set the axis to trigger
            @controllers[i]['Axis Trigger'][axis] = true
          # If the axis is not pressed, and it was previously
          elsif ((@controllers[i]['Press'][axis] == false) &&
            (controller['Axis Press'][axis] == true))
            # Set the axis to release
            @controllers[i]['Axis Release'][axis] = true
          end
        end
        # If the controller is set to vibrate
        if @controllers[i]['Vibrate Timer'] > 0
          # If the vibrate repeat timer has reached 0
          if @controllers[i]['Vibrate Repeat Timer'] <= 0
            # Get the current vibration values
            left_motor = @controllers[i]['Vibrate State'][0] - 1
            right_motor = @controllers[i]['Vibrate State'][1] - 1
            # Correct the motor values
            left_motor = 0 if left_motor < 0
            right_motor = 0 if right_motor < 0
            # Create the vibration state structure
            vibrate = [left_motor, right_motor].pack('n2')
            # Reset the controller vibrate state
            @gamepadSetState.call(i, vibrate)
            # Pack the current vibrate state
            vibrate_state = @controllers[i]['Vibrate State'].pack('n2')
            # Set the vibrate state to the current controller vibrate state
            @gamepadSetState.call(i, vibrate_state)
            # Reset the vibrate repeat timer
            @controllers[i]['Vibrate Repeat Timer'] = Graphics.frame_rate
          # If the vibrate repeat timer is greater than 0
          else
            # Decrement the vibrate repeat timer
            @controllers[i]['Vibrate Repeat Timer'] -= 1
          end
          # Decrement the vibrate timer
          @controllers[i]['Vibrate Timer'] -= 1
        # If the vibrate timer is 0, and the vibrate state is still set
        elsif ((@controllers[i]['Vibrate Timer'] <= 0) &&
          (@controllers[i]['Vibrate State'] != [0, 0]))
          # Reset the vibrate state
          @controllers[i]['Vibrate State'] = [0, 0]
          # Set the vibrate repeat timer to 1/3 of a second
          @controllers[i]['Vibrate Repeat Timer'] = Graphics.frame_rate / 3
        # If the vibrate timer is 0 and the vibrate state is cleared
        elsif ((@controllers[i]['Vibrate Timer'] <= 0) &&
          (@controllers[i]['Vibrate State'] == [0, 0]))
          # If the vibrate repeat timer is running
          if @controllers[i]['Vibrate Repeat Timer'] >= 0
            # Decrement the vibrate repeat timer
            @controllers[i]['Vibrate Repeat Timer'] -= 1
          # If the timer has run out
          else
            # Reset the vibrate repeat timer
            @controllers[i]['Vibrate Repeat Timer'] = 0
            # Reset the controller vibrate state
            @gamepadSetState.call(i, @vibrate)
          end
        end
        # If the controller's minimum vibrate update timer is running
        if @controllers[i]['Vibrate Minimum Timer'] > 0
          # Decrement the timer
          @controllers[i]['Vibrate Minimum Timer'] -= 1
        end
      # If the controller is not connected, or the state could not be read
      elsif success == 2 || success == -1
        # Set the controller to inactive
        @controllers[i]['Active'] = false
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Get Button Pressed State
  #     button : button number
  #     index  : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.press?(button, index = 0)
    # Return false if the controller is inactive
    return false if @controllers[index]['Active'] == false
    # Return button pressed state
    return @controllers[index]['Press'][button]
  end
  #--------------------------------------------------------------------------
  # * Get Button Triggered State
  #     button : button number
  #     index  : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.trigger?(button, index = 0)
    # Return false if the controller is inactive
    return false if @controllers[index]['Active'] == false
    # Return button triggered state
    return @controllers[index]['Trigger'][button]
  end
  #--------------------------------------------------------------------------
  # * Get Button Repeated State
  #     button : button number
  #     index  : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.repeat?(button, index = 0)
    # Return false if the controller is inactive
    return false if @controllers[index]['Active'] == false
    # Return button repeated state
    return @controllers[index]['Repeat'][button]
  end
  #--------------------------------------------------------------------------
  # * Get Button Released State
  #     button : button number
  #     index  : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.release?(button, index = 0)
    # Return false if the controller is inactive
    return false if @controllers[index]['Active'] == false
    # Return button released state
    return @controllers[index]['Release'][button]
  end
  #--------------------------------------------------------------------------
  # * Get Axis Pressed State
  #     axis  : axis number
  #     index : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.axis_press?(axis, index = 0)
    # Return false if the controller is inactive
    return false if @controllers[index]['Active'] == false
    # Return axis pressed state
    return @controllers[index]['Axis Press'][axis]
  end
  #--------------------------------------------------------------------------
  # * Get Axis Triggered State
  #     axis  : axis number
  #     index : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.axis_trigger?(axis, index = 0)
    # Return false if the controller is inactive
    return false if @controllers[index]['Active'] == false
    # Return axis triggered state
    return @controllers[index]['Axis Trigger'][axis]
  end
  #--------------------------------------------------------------------------
  # * Get Axis Repeated State
  #     axis  : axis number
  #     index : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.axis_repeat?(axis, index = 0)
    # Return false if the controller is inactive
    return false if @controllers[index]['Active'] == false
    # Return axis repeated state
    return @controllers[index]['Axis Repeat'][axis]
  end
  #--------------------------------------------------------------------------
  # * Get Axis Released State
  #     axis  : axis number
  #     index : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.axis_release?(axis, index = 0)
    # Return false if the controller is inactive
    return false if @controllers[index]['Active'] == false
    # Return axis released state
    return @controllers[index]['Axis Release'][axis]
  end
  #--------------------------------------------------------------------------
  # * Get Axis Value
  #     axis  : axis number
  #     index : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.axis_value(axis, index = 0)
    # Set a temporary variable to the axis value
    value = self.real_axis_value(axis, index)
    # Return axis value
    return value unless value.abs < @controllers[index]['Axis Dead Zones'][axis]
    # Return 0 if the axis is within the dead zone
    return 0
  end
  #--------------------------------------------------------------------------
  # * Get Real Axis Value
  #     axis  : axis number
  #     index : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.real_axis_value(axis, index = 0)
    # Return the axis value
    return @controllers[index]['Axes'][axis]
  end
  #--------------------------------------------------------------------------
  # * Set Controller to Vibrate
  #     left_motor  : left motor value (0 to 65535)
  #     right_motor : right motor value (0 to 65535)
  #     frames      : number of frames to vibrate
  #     index       : controller number (0 to 3)
  #--------------------------------------------------------------------------
  def self.vibrate(left_motor, right_motor, frames, index = 0)
    # Return false if the vibrate has updated too recently
    return false if @controllers[index]['Vibrate Minimum Timer'] > 0
    # Set the controller vibrate timer to the number of frames
    @controllers[index]['Vibrate Timer'] = frames
    # Correct the motor values if out of range
    left_motor = 0 if left_motor < 0
    left_motor = 65535 if left_motor > 65535
    right_motor = 0 if right_motor < 0
    right_motor = 65535 if right_motor > 65535
    # Set the controller motor values
    @controllers[index]['Vibrate State'] = [left_motor.to_i, right_motor.to_i]
    # Set the minimum update timer
    @controllers[index]['Vibrate Minimum Timer'] = Graphics.frame_rate / 4
    # Return true if the vibrate was successfully set
    return true
  end
  #--------------------------------------------------------------------------
  # * Initialize Module
  #--------------------------------------------------------------------------
  begin
    # Force an initial update of the gamepad
    self.update
  end
end

#==============================================================================
# ** Input
#------------------------------------------------------------------------------
#  This module performs input processing
#==============================================================================

module Input
  # Add class data
  class << self
    #------------------------------------------------------------------------
    # * Alias Methods
    #------------------------------------------------------------------------
    # If the update method has not been aliased
    unless method_defined?(:glitch_gamepad_input_update)
      # Alias the update method
      alias glitch_gamepad_input_update update
    end
    #------------------------------------------------------------------------
    # * Frame Update
    #------------------------------------------------------------------------
    def update
      # Call original method
      glitch_gamepad_input_update
      # Update Gamepad module
      Gamepad.update
    end
  end
end


Link code :: http://www.hbgames.org/forums/viewtopic.php?t=73959

Thanks :D
22
I waits for a volunteer so we can discuss price.
But, seen that it is paying I hope that they will be very well make.


Update *Nobody ??*
23
How much is the price?
I guess if I pay , work will be perfect and there will be ready within the time ?
24
Hello!

I need somebody or several people to create 22 monsters pulled by " Monster Hunter Frontier"
however, I would like that things take place in private, because I would want to have the resources only for me Lol :p
I know that it is not good not to share but I like keeping(guarding) the originality of my project...

Thanks..

EDITED *29/05/2015*

############################# REQUEST #############################

1.
Spoiler: ShowHide

2.
Spoiler: ShowHide

3.
Spoiler: ShowHide

4.
Spoiler: ShowHide

5.
Spoiler: ShowHide

6.
Spoiler: ShowHide

7.
Spoiler: ShowHide

8.
Spoiler: ShowHide

9.
Spoiler: ShowHide

10.
Spoiler: ShowHide

11.
Spoiler: ShowHide

12.
Spoiler: ShowHide

13.
Spoiler: ShowHide

14.
Spoiler: ShowHide

15.
Spoiler: ShowHide

16.
Spoiler: ShowHide

17.
Spoiler: ShowHide

18.
Spoiler: ShowHide

19.
Spoiler: ShowHide

20.
Spoiler: ShowHide

21.
Spoiler: ShowHide

22.
Spoiler: ShowHide


############################# EXEMPLE #############################

Example animation (flight to some monster):
Spoiler: ShowHide


Example animation (ground for all monsters):
Spoiler: ShowHide


############################## END ###############################

If you need more precision asks me ! :)
25
Hello!

Im looking some videos on youtube , I found someone who was able to do something interesting :

It using RMVX:


But im using RMXP and I use 100% of the Blizz ABS and Visual Equipement.. I would like to know if it is possible to do the same?
Thanks!
26
i have this error ..

27
Quote from: PhoenixFire on March 13, 2015, 02:47:06 pm
Need a bit more information than that; where do you plan to use the information after you've saved it? Is it being used where the other players will need access to the saved information as well? Is it being pushed by the client to the server and stored in the database? Note: most of these questions I'm just pulling out of thin air, and may not even matter, but you need to kinda let people know what you're trying to do. Otherwise, you might get answers that won't help you at all. I mean, I could tell you yes, you can have it save to a text file in a sub-folder in the game folder; that might not be what you're looking for though.


I apologize for not detailing my request more thoroughly. So first of all, as everyone knows I am currently developing a monster hunter like.  For now everything is perfect except for a few details on which
I am working on. I am asking for a lot of help in order to try to free some tasks I am struggling with. For this particular request, I am going to detail what I need, first RMX-OS uses an automatic backup system,
this backup system (see code below) uses if I understand correctly a sort container, which holds various information as for example (items, argents etc ..)
it also saves the precise location on a map (MAP_ID, X, Y) which later transmits it to the server which  wisely keeps it in the database. However, I refuse it to back up in anything else than the main map.
I'll give you an example:
The player1 in MAP 1 (Main Map) accept the quest and goes in his mission in MAP2 (secondary Map) If he gets disconnected or if he turns off the game or anything else, I want in any case the backup to not save on MAP2 (secondary Map) but on the MAP 1 (Main Map).
In summary, I would like it to only load in the MAP1 and not on any other map ..

Spoiler: ShowHide

    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   # Save Data
   # - see the documentation to learn how to set up which data is being saved
   #   by RMX-OS.
   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   # save container variable definitions
   SAVE_CONTAINERS = [
       '$game_system',
       '$game_party',
       '$game_actors',
       '$game_map',
       '$game_player',
       'Graphics.frame_count'
   ]
   # general save data setup
   SAVE_DATA['Graphics.frame_count'] = []
   SAVE_DATA[Game_System] = ['@timer', '@timer_working', '@menu_disabled']
   SAVE_DATA[Game_Party] = ['@gold', '@steps', '@actors', '@items',
       '@weapons', '@armors']
   SAVE_DATA[Game_Actors] = ['@data']
   SAVE_DATA[Game_Map] = ['@map_id']
   SAVE_DATA[Game_Player] = ['@x', '@y', '@real_x', '@real_y',
       '@character_name', '@encounter_count']
   SAVE_DATA[Game_Actor] = ['@actor_id', '@name', '@character_name',
       '@character_hue', '@class_id', '@weapon_id', '@armor1_id',
       '@armor2_id', '@armor3_id', '@armor4_id', '@level', '@exp', '@skills',
       '@hp', '@sp', '@states', '@maxhp_plus', '@maxsp_plus', '@str_plus',
       '@dex_plus', '@agi_plus', '@int_plus']
   # for all classes that must have default arguments specified
   CREATION_DATA[Game_Actor] = '1'
 
 end


OR

Spoiler: ShowHide

  #----------------------------------------------------------------------------
 # Sets up the map data for a loaded game. In case the game of a newly
 # registered user, a new game will be started.
 #----------------------------------------------------------------------------
 def load_game
   # if game was loaded
   if $game_map.map_id != 0
     # setup map and player
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   else
     # start a new game
     $game_party.setup_starting_members
     $game_map.setup($data_system.start_map_id)
     $game_player.moveto($data_system.start_x, $data_system.start_y)
   end
   # prepare everything for starting the game
   $game_party.refresh
   $game_player.refresh
   $game_map.autoplay
   $game_temp.entering_map = true
   $game_map.update
   $network.game_loaded = true
 end
28
Hello!!

I want to know in RMX-OS how can save of the map.
exemply :

[map_id] + [x,y]
29
RMXP Script Database / Re: [XP] RMX-OS
March 12, 2015, 01:21:43 am
Quote from: PhoenixFire on March 11, 2015, 09:27:12 pm
Unless it's something already built into RMX-OS, I would think the simplest way to do that would be to have a global variable that is increased by one every time a client connects, and decreased by one each time a disconnect happens. When you want to display that number, you just grab the value of the variable.. I would think it would probably be very simple to integrate in that manner, though, there are others on here more experienced than I with this system.


I use this method , but I told myself that if there was a more optimized method it will better ^^
30
RMXP Script Database / Re: [XP] RMX-OS
March 11, 2015, 08:13:42 pm
You know how to display the number of people there in the server?
31
Script Troubleshooting / Re: RMX-OS Problem Save
March 09, 2015, 03:15:08 pm
Quote from: KK20 on March 09, 2015, 01:33:10 pm
Just a crazy thought, have you set LEGACY_SAVE_METHOD to true?


Is work!
32
Script Troubleshooting / Re: RMX-OS Problem Save
March 09, 2015, 12:31:21 pm
Quote from: KK20 on March 09, 2015, 12:13:25 pm
I've said before that I don't work with RMX-OS, so I'm not entirely sure of specific things that can be done.
With that said, you could throw this in your project (anywhere below RMX-OS)

module RMXOS
 class Network
   #--------------------------------------------------------------------------
   # Saves the game. Only data from selected classes will be saved.
   #  classes - an array of classes which should be saved.
   #--------------------------------------------------------------------------
   alias check_if_saving save
   def save
     check_if_saving
     p "Your game saved" rescue nil
     msgbox_p "Your game saved" rescue nil
   end
 end
end

And it should pop-up a message stating that your game data was sent to the server to be ultimately saved in the database.

If the message pops up but the data wasn't saved, clearly your database or save containers are not set up properly. If it doesn't pop up, you have events running in the background or your game is "corrupted".


Ok, I tested it and it appears that the save was sent to the server in the database, even when have events running in the background
but it does not change ...

*Update* :: The save appears in the database! But it doesn't work ..

In my RMX-OS::

Spoiler: ShowHide

   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   # System
   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   USERPASS_MIN_LENGTH = 3
   USERPASS_MAX_LENGTH = 16
   CHATINPUT_WIDTH = 300
   CHATBOX_WIDTH = 350
   CHATBOX_LINES = 10
   CHATINPUT_MAX_LENGTH = 40
   PM_MAX_LENGTH = 100
   GUILDNAME_MAX_LENGTH = 32
   CHAT_BUBBLES = false
   REMEMBER_LOGIN = true
   DISABLED_CHAT_COMMANDS = []
   AUTOSAVE_FREQUENCY = 10
   GUILD_NAME_SPRITES = true
   LEGACY_SAVE_METHOD = false
   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   # Exchange Data
   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   EXCHANGE_VARIABLES = ['@character_name', '@x', '@y', '@direction',
       '@move_speed', '@walk_anime', '@step_anime', '@real_x', '@real_y',
       '@pattern']
   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   # Save Data
   # - see the documentation to learn how to set up which data is being saved
   #   by RMX-OS.
   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   # save container variable definitions
   SAVE_CONTAINERS = [
       '$game_system',
       '$game_switches',
       '$game_variables',
       '$game_self_switches',
       '$game_party',
       '$game_actors',
       '$game_map',
       '$game_player',
       'Graphics.frame_count'
   ]
   # general save data setup
   SAVE_DATA['Graphics.frame_count'] = []
   SAVE_DATA[Game_System] = ['@timer', '@timer_working', '@menu_disabled']
   SAVE_DATA[Game_Switches] = ['@data']
   SAVE_DATA[Game_Variables] = ['@data']
   SAVE_DATA[Game_SelfSwitches] = ['@data']
   SAVE_DATA[Game_Party] = ['@gold', '@steps', '@actors', '@items',
       '@weapons', '@armors']
   SAVE_DATA[Game_Actors] = ['@data']
   SAVE_DATA[Game_Map] = ['@map_id']
   SAVE_DATA[Game_Player] = ['@x', '@y', '@real_x', '@real_y',
       '@character_name', '@encounter_count']
   SAVE_DATA[Game_Actor] = ['@actor_id', '@name', '@character_name',
       '@character_hue', '@class_id', '@weapon_id', '@armor1_id',
       '@armor2_id', '@armor3_id', '@armor4_id', '@level', '@exp', '@skills',
       '@hp', '@sp', '@states', '@maxhp_plus', '@maxsp_plus', '@str_plus',
       '@dex_plus', '@agi_plus', '@int_plus']
   # for all classes that must have default arguments specified
   CREATION_DATA[Game_Actor] = '1'
 end
end


And my Database for server:

Spoiler: ShowHide
33
Script Troubleshooting / Re: RMX-OS Problem Save
March 09, 2015, 11:53:03 am
I tested my map on a new project with RMX-OS and it does not change ...
34
Script Troubleshooting / Re: RMX-OS Problem Save
March 08, 2015, 02:14:17 pm
I change 29074 to 29088 and the save doesn't not work ..
More information: I use 4 event [Parallel Process]->(run non stop) and 1 [Parallel Process] for intro -> (desactivate if the end of intro)

*Update* :: I found the problem!
When i use a map (40x40) the save is done and when i use a higher size (40x40) the save does not work!
my main map use (103x71) and I thought it was related to it is not divisible by 32, but it does not save any of although it was higher (40x40) ..
35
Script Troubleshooting / Re: RMX-OS Problem Save
March 08, 2015, 03:32:21 am
Nobody have solution ...?
36
Script Troubleshooting / Re: RMX-OS Problem Save
March 07, 2015, 03:06:58 pm
I think my problem is related to my tileset .. I used every tileset and more Pandora posted in the forum and save running, But! when I use mine tileset the save does not work .. the size of my tileset is (256x29074) ... I know it's enormous ...

But, if this problem is not resolved, I fear having to stop my project MORPG mode and put in offline mode .. :/
37
Ok! I will get it and if I find something I will share! :)
38
Hello!
I want to change my Scene_Menu that was created by a friend and myself,
This scene_menu has the possibility to have the vision of the map and events that run in background.

I have no idea how RMX-OS and Blizz-ABS is that work for this request... I wish it also runs in the background, menu actions will be carried out with the Arrows and moving system with keyboard letters for exemply: "W, A, S, D" and attack button is disabled at this time there ..

Thanks..
39
Script Troubleshooting / Re: RMX-OS Problem Save
March 06, 2015, 07:48:38 am
Nobody..?
40
Script Troubleshooting / Re: RMX-OS Problem Save
March 04, 2015, 10:04:43 pm
Quote from: chaucer on March 04, 2015, 08:32:29 pm
try running a query in your SQL management software. run the file named RMX-OS SQL Database.sql the files located in Server/Data folder of RMX-OS folder(this will delete all data, just a warning but it MIGHT work. Don't know if you have any important save data or not.). Also in RMX-OS Options try searching for
AUTOSAVE_FREQUENCY = 

you could try changing it to a lower number.


I tested and i doesn't save ...
I change AUTOSAVE_FREQUENCY = 30 to 10 and -1 (lol)
And i doesn't save ....

But is very strange.... when don't touch maps defaults by RMX-OS the save is works fine and when we create a new map... it does not save ...

Update :: *I understand where is the problem ... When I create in the database a new tileset for example: "52"
The save does not work ... And when I use the 51 given by default for RMX-OS the saves work ...*
Update²:: *I tested on my project and it doesn't not change...*