Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

AInput Module

AInput Module
Created by Alejandro Marzini (vgvgf)
Version: 3.10
Last Updated: 19/08/2010 (day/month/year)

Description
This script adds input detection for all keyboard and mouse keys to the default input module. A mouse input plugin is also available. Compatible with RMXP & RMVX

New in version 3.10
  • General
    • Removed ALibrary dependencies
    • Renamed AWorks.dll to AInput.dll
  • Keyboard
    • Changed default repeat time to 4 (previously 2)
    • Added repeat_config, setup_dir, setup_wasd, setup_default and block_input
    • Previous Input functions are preserved, joystick input will work.
  • Mouse
    • Fixed mouse_in_area? and mouse_visible bugs
    • Added mouse_double_click_time=, mouse_double_click_pix= and mouse_drag_pix=
  • Keys
    • Fixed typos and renamed some keys

How to add to your project
Copy and paste the AIM.txt script and AKM.txt script before main in a new section.
If you want to use mouse input detection, add AIM-M.txt too.
Place AInput.dll in the project folder.

For how to use documentation, see the scripts comments.

Download
AInput 3.10.zip
AInput.dll 3.10 Sources.zip

Special Thanks
Poccil (Peter O.) for his methods for accessing ruby objects.

License
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
 
Great job, vgvgf! But, what exactly is new/different between this version and the older version? Also, it looks like the Input/Keys module is now totally independant from the Aleworks libraries, such as Aleworks::API, does this mean that you no longer use/support the Aleworks::API module and other related libraries? Lastly, when you talk about how its "now faster than ever!" what exactly does that mean?

There was an issue I had with your older version, having to do with when a Print message was displayed on the window (with "p" or "print"). By default (without Aleworks), you can either close the print window by clicking the "OK" button on it, or by using a key like Enter (ie Input::C), without actually triggering an Input.trigger?(*) response. However, with Aleworks installed, the Input trigger now was triggered directly after closing the print window, causing accidental and undesired actions such as triggering scene changes in the Menu and the such. Is this something that has been resolved in the new version?

Lastly, what about your old addons, like the Name addon and the Password addon the one for Input Number? Do those still work with this version, or do you have to rescript those? (I always had a problem with Scene_Name not working but that might just be a personal problem in my project, or perhaps it conflicted with SDK maybe?) I appologize for bombarding you with questions, but I happened to utilize alot of your libraries functions in my scripts so there is alot I need to know about the new version.

Okay... I appologize, LAST QUESTION I promise...

Can your Input or Keys module detect the Mouse wheel scrolling up/down?
 
Code:
eval("Keys::#{Keys.constants[Keys.constants.index(name)]}")
THIS is WORSE!!
use
Code:
Keys.const_get(name)

PS: can your input detect "äöü" and other funny keys ala "Ŋ" ?

PPS: the last i do with Alt-Gr + Shift + G
 
...Wierd ascii character Input? Why..? I don't even know how to do those weird characters, why would anybody use 'em?

Oh yeah, vgvgf, remember when I asked you about using Input in conditional branches (using events), how they don't work and you wrote that patch for me? You need to include that for eventers, because conditional branch input is only read if you use the Call Script vs normal event conventions again...

Code:
@> Conditonal Branch: The DOWN button is being pressed
  @> Play SE: '004-System04', '100', '100'
  @>
@>

...Doesn't do anything, you have to do...

Code:
@> Conditonal Branch: Script: Input.press?(Input::DOWN)
  @> Play SE: '004-System04', '100', '100'
  @>
@>

...Would have to be used. Here, incase you lost it I still have the old patch you did awhile back, I'm assuming it still works with this newer version I don't have time to test it right now but here, you wrote this a long time ago for me.

Code:
#=============================================================================
# *** Aleworks Input Module Compability Patch 1(AIM CP1)
#=============================================================================
# Created by Aleworks
# Version: 1.00
# Last Update: 29/03/2007 (day/month/year)
#=============================================================================
#==== Description ====
# This patch, is for making AIM, compatible with the default interpreter script
# of RPG Maker XP, when using the Conditional Branch and Button Input Processing
# commands.
#=============================================================================
#==== Requeriments ====
# * Aleworks Input Module
#   - Version: 1.00 or superior
#=============================================================================
#==== Classes & Methods ====
# ** Class Interpreter
#   * Overwrite Methods: input_button; command_111
#=============================================================================

#=============================================================================
# ** Interpreter
#=============================================================================
class Interpreter
  #---------------------------------------------------------------------------
  # * Input Button
  #---------------------------------------------------------------------------
  def input_button
    n = 1 if Input.trigger?(Input::LOWER_LEFT)
    n = 3 if Input.trigger?(Input::LOWER_RIGHT)
    n = 7 if Input.trigger?(Input::UPPER_LEFT)
    n = 9 if Input.trigger?(Input::UPPER_RIGHT)
    n = 2 if Input.trigger?(Input::DOWN)
    n = 4 if Input.trigger?(Input::LEFT)
    n = 6 if Input.trigger?(Input::RIGHT)
    n = 8 if Input.trigger?(Input::UP)
    n = 11 if Input.trigger?(Input::A)
    n = 12 if Input.trigger?(Input::B)
    n = 13 if Input.trigger?(Input::C)
    n = 14 if Input.trigger?(Input::X)
    n = 15 if Input.trigger?(Input::Y)
    n = 16 if Input.trigger?(Input::Z)
    n = 17 if Input.trigger?(Input::L)
    n = 18 if Input.trigger?(Input::R)
    if !n.nil?
      $game_variables[@button_input_variable_id] = n
      $game_map.need_refresh = true
      @button_input_variable_id = 0
    end
  end
  #---------------------------------------------------------------------------
  # * Conditional Branch
  #---------------------------------------------------------------------------
  def command_111
    result = false
    case @parameters[0]
    when 0
      result = ($game_switches[@parameters[1]] == (@parameters[2] == 0))
    when 1
      value1 = $game_variables[@parameters[1]]
      if @parameters[2] == 0
        value2 = @parameters[3]
      else
        value2 = $game_variables[@parameters[3]]
      end
      case @parameters[4]
      when 0
        result = (value1 == value2)
      when 1
        result = (value1 >= value2)
      when 2
        result = (value1 <= value2)
      when 3
        result = (value1 > value2)
      when 4
        result = (value1 < value2)
      when 5
        result = (value1 != value2)
      end
    when 2
      if @event_id > 0
        key = [$game_map.map_id, @event_id, @parameters[1]]
        if @parameters[2] == 0
          result = ($game_self_switches[key] == true)
        else
          result = ($game_self_switches[key] != true)
        end
      end
    when 3
      if $game_system.timer_working
        sec = $game_system.timer / Graphics.frame_rate
        if @parameters[2] == 0
          result = (sec >= @parameters[1])
        else
          result = (sec <= @parameters[1])
        end
      end
    when 4
      actor = $game_actors[@parameters[1]]
      if actor != nil
        case @parameters[2]
        when 0
          result = ($game_party.actors.include?(actor))
        when 1
          result = (actor.name == @parameters[3])
        when 2
          result = (actor.skill_learn?(@parameters[3]))
        when 3
          result = (actor.weapon_id == @parameters[3])
        when 4
          result = (actor.armor1_id == @parameters[3] or
                    actor.armor2_id == @parameters[3] or
                    actor.armor3_id == @parameters[3] or
                    actor.armor4_id == @parameters[3])
        when 5
          result = (actor.state?(@parameters[3]))
        end
      end
    when 5
      enemy = $game_troop.enemies[@parameters[1]]
      if enemy != nil
        case @parameters[2]
        when 0
          result = (enemy.exist?)
        when 1
          result = (enemy.state?(@parameters[3]))
        end
      end
    when 6
      character = get_character(@parameters[1])
      if character != nil
        result = (character.direction == @parameters[2])
      end
    when 7
      if @parameters[2] == 0
        result = ($game_party.gold >= @parameters[1])
      else
        result = ($game_party.gold <= @parameters[1])
      end
    when 8
      result = ($game_party.item_number(@parameters[1]) > 0)
    when 9
      result = ($game_party.weapon_number(@parameters[1]) > 0)
    when 10
      result = ($game_party.armor_number(@parameters[1]) > 0)
    when 11
      n = Input::DOWN if @parameters[1] == 2
      n = Input::LEFT if @parameters[1] == 4
      n = Input::RIGHT if @parameters[1] == 6
      n = Input::UP if @parameters[1] == 8
      n = Input::A if @parameters[1] == 11
      n = Input::B if @parameters[1] == 12
      n = Input::C if @parameters[1] == 13
      n = Input::X if @parameters[1] == 14
      n = Input::Y if @parameters[1] == 15
      n = Input::Z if @parameters[1] == 16
      n = Input::L if @parameters[1] == 17
      n = Input::R if @parameters[1] == 18
      result = (Input.press?(n))
    when 12
      result = eval(@parameters[1])
    end
    @branch[@list[@index].indent] = result
    if @branch[@list[@index].indent] == true
      @branch.delete(@list[@index].indent)
      return true
    end
    return command_skip
  end
end

Also, I wrote this method-split for SDK which breaks up the Conditional Branch command (command_111), the current SDK doesn't use this yet but it'll probably come in the 2.5 version. Keep in mind, I highly doubt anybody would alter anything else within command_111 but I'll post it just incase. I also updated your "patch" with the new SDK branching I did.

Code:
#==============================================================================
# ** Enable Part II Check
#==============================================================================
if SDK::Parts.include?(2) || 
  SDK::Indidual_Parts.include?('INTERPRETER#COMMAND_111')
  
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
#  This interpreter runs event commands. This class is used within the
#  Game_System class and the Game_Event class.
#==============================================================================

class Interpreter
  #--------------------------------------------------------------------------
  # * SDK Log Branch
  #--------------------------------------------------------------------------
  SDK.log_branch(:Interpreter, :command_111, :condition_switch, 
  :condition_variable, :condition_local, :condition_timer, :condition_actor,
  :condition_enemy_state, :condition_facing, :condition_gold, :condition_items,
  :condition_weapons, :condition_armors, :condition_input, :condition_script)
  #---------------------------------------------------------------------------
  # * Conditional Branch
  #---------------------------------------------------------------------------
  def command_111
    result = false
    case @parameters[0]
    when 0  ; result = condition_switch
    when 1  ; result = condition_variable
    when 2  ; result = condition_local
    when 3  ; result = condition_timer
    when 4  ; result = condition_actor
    when 5  ; result = condition_enemy_state
    when 6  ; result = condition_facing
    when 7  ; result = condition_gold
    when 8  ; result = condition_items
    when 9  ; result = condition_weapons
    when 10 ; result = condition_armors
    when 11 ; result = condition_input
    when 12 ; result = condition_script
    end
    @branch[@list[@index].indent] = result
    if @branch[@list[@index].indent] == true
      @branch.delete(@list[@index].indent)
      return true
    end
    return command_skip
  end
  #-----------------------------------------------------------------------------
  # * Condition Switch
  #-----------------------------------------------------------------------------
  def condition_switch
    return ($game_switches[@parameters[1]] == (@parameters[2] == 0))
  end
  #-----------------------------------------------------------------------------
  # * Condition Variable
  #-----------------------------------------------------------------------------
  def condition_variable
    value1 = $game_variables[@parameters[1]]
    if @parameters[2].zero? ; value2 = @parameters[3]
    else                    ; value2 = $game_variables[@parameters[3]]
    end
    case @parameters[4]
    when 0 ; return (value1 == value2)
    when 1 ; return (value1 >= value2)
    when 2 ; return (value1 <= value2)
    when 3 ; return (value1 > value2)
    when 4 ; return (value1 < value2)
    when 5 ; return (value1 != value2)
    end
  end
  #-----------------------------------------------------------------------------
  # * Condition Local
  #-----------------------------------------------------------------------------
  def condition_local
    if @event_id > 0
      key = [$game_map.map_id, @event_id, @parameters[1]]
      if @parameters[2].zero? ; return ($game_self_switches[key] == true)
      else                    ; return ($game_self_switches[key] != true)
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Condition Timer
  #-----------------------------------------------------------------------------
  def condition_timer
    if $game_system.timer_working
      sec = $game_system.timer / Graphics.frame_rate
      if @parameters[2].zero? ; return (sec >= @parameters[1])
      else                    ; return (sec <= @parameters[1])
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Condition Actor
  #-----------------------------------------------------------------------------
  def condition_actor
    actor = $game_actors[@parameters[1]]
    unless actor.nil?
      case @parameters[2]
      when 0 ; return ($game_party.actors.include?(actor))
      when 1 ; return (actor.name == @parameters[3])
      when 2 ; return (actor.skill_learn?(@parameters[3]))
      when 3 ; return (actor.weapon_id == @parameters[3])
      when 4 ; return (actor.armor1_id == @parameters[3] or
                  actor.armor2_id == @parameters[3] or
                  actor.armor3_id == @parameters[3] or
                  actor.armor4_id == @parameters[3])
      when 5 ; return (actor.state?(@parameters[3]))
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Condition Enemy State
  #-----------------------------------------------------------------------------
  def condition_enemy_state
    enemy = $game_troop.enemies[@parameters[1]]
    unless enemy.nil?
      case @parameters[2]
      when 0 ; return (enemy.exist?)
      when 1 ; return (enemy.state?(@parameters[3]))
      end
    end    
  end
  #-----------------------------------------------------------------------------
  # * Condition Facing
  #-----------------------------------------------------------------------------
  def condition_facing
    character = get_character(@parameters[1])
    unless character.nil?
      return (character.direction == @parameters[2])
    end
  end
  #-----------------------------------------------------------------------------
  # * Condition Gold
  #-----------------------------------------------------------------------------
  def condition_gold
    if @parameters[2].zero? ; return ($game_party.gold >= @parameters[1])
    else                    ; return ($game_party.gold <= @parameters[1])
    end    
  end
  #-----------------------------------------------------------------------------
  # * Condition Items
  #-----------------------------------------------------------------------------
  def condition_items
    return ($game_party.item_number(@parameters[1]) > 0)
  end
  #-----------------------------------------------------------------------------
  # * Condition Weapons
  #-----------------------------------------------------------------------------
  def condition_weapons
    return ($game_party.weapon_number(@parameters[1]) > 0)
  end
  #-----------------------------------------------------------------------------
  # * Condition Armors
  #-----------------------------------------------------------------------------
  def condition_armors
    return ($game_party.armor_number(@parameters[1]) > 0)
  end
  #-----------------------------------------------------------------------------
  # * Condition Input
  #-----------------------------------------------------------------------------
  def condition_input
    return (Input.press?(@parameters[1]))
  end
  #-----------------------------------------------------------------------------
  # * Condition Script
  #-----------------------------------------------------------------------------
  def condition_script
    return eval(@parameters[1]).nil? ? false : eval(@parameters[1])
  end
end

#==============================================================================
# ** Ends Enable Part II Check
#==============================================================================
end
Code:
#=============================================================================
# *** Aleworks Input Module Compability Patch 1(AIM CP1)
#=============================================================================
# Created by Aleworks
# Version: 1.00
# Last Update: 29/03/2007 (day/month/year)
#=============================================================================
#==== Description ====
# This patch, is for making AIM, compatible with the default interpreter script
# of RPG Maker XP, when using the Conditional Branch and Button Input Processing
# commands.
#=============================================================================
#==== Requeriments ====
# * Aleworks Input Module
#   - Version: 1.00 or superior
# * Standard Development Kit
#   - Version : 2.50 or superior
#=============================================================================
#==== Classes & Methods ====
# ** Class Interpreter (SDK)
#   * Overwrite Methods: condition_input
#=============================================================================
#-----------------------------------------------------------------------------
# * SDK Log
#-----------------------------------------------------------------------------
SDK.log('Aleworks Input Interpreter', 'vgvgf+Kain Nobel', 1.01, '2007-27-08')
SDK.log_overwrite(Interpreter, :condition_input)
#-----------------------------------------------------------------------------
# * SDK Enabled Test - BEGIN
#-----------------------------------------------------------------------------
if SDK.enabled?('Aleworks Input Interpreter')
#=============================================================================
# ** Interpreter
#=============================================================================
class Interpreter
  #---------------------------------------------------------------------------
  # * Input Button
  #---------------------------------------------------------------------------
  def input_button
    n = 1 if Input.trigger?(Input::LOWER_LEFT)
    n = 3 if Input.trigger?(Input::LOWER_RIGHT)
    n = 7 if Input.trigger?(Input::UPPER_LEFT)
    n = 9 if Input.trigger?(Input::UPPER_RIGHT)
    n = 2 if Input.trigger?(Input::DOWN)
    n = 4 if Input.trigger?(Input::LEFT)
    n = 6 if Input.trigger?(Input::RIGHT)
    n = 8 if Input.trigger?(Input::UP)
    n = 11 if Input.trigger?(Input::A)
    n = 12 if Input.trigger?(Input::B)
    n = 13 if Input.trigger?(Input::C)
    n = 14 if Input.trigger?(Input::X)
    n = 15 if Input.trigger?(Input::Y)
    n = 16 if Input.trigger?(Input::Z)
    n = 17 if Input.trigger?(Input::L)
    n = 18 if Input.trigger?(Input::R)
    if !n.nil?
      $game_variables[@button_input_variable_id] = n
      $game_map.need_refresh = true
      @button_input_variable_id = 0
    end
  end
  #-----------------------------------------------------------------------------
  # * Condition Input
  #-----------------------------------------------------------------------------
  def condition_input
    n = Input::DOWN if @parameters[1] == 2
    n = Input::LEFT if @parameters[1] == 4
    n = Input::RIGHT if @parameters[1] == 6
    n = Input::UP if @parameters[1] == 8
    n = Input::A if @parameters[1] == 11
    n = Input::B if @parameters[1] == 12
    n = Input::C if @parameters[1] == 13
    n = Input::X if @parameters[1] == 14
    n = Input::Y if @parameters[1] == 15
    n = Input::Z if @parameters[1] == 16
    n = Input::L if @parameters[1] == 17
    n = Input::R if @parameters[1] == 18
    return (Input.press?(n))
  end
end
#-------------------------------------------------------------------------------
# * SDK Enabled Test - END
#-------------------------------------------------------------------------------
end

After testing the Print command VS Input::C triggering afterwards, its slightly better. If I release Enter/C or whatever quick enough, the key doesn't trigger in-game (just like its supposed to not do), but... its not supposed to trigger at all if you're still holding an Input::C key until you press it again. I'm not sure how you'd fix this, maybe I'll figure out how and post it. But basically, you might need to use some API magic to see if the Game's main window is active, or if another window (such as the Print window) is active, and clear the trigger if so, or set some kinda flag.

Other than that, great improvement, I think I see what you mean now by "faster". In the old version, I don't think the key would clear right away after I released it, this one responds a little bit better to real-time pushing and releasing.
 
äöü can i input because i have a german keyboard layout

Ã…Å  can i input bacause i have linux :P
 
Great job, vgvgf! But, what exactly is new/different between this version and the older version? Also, it looks like the Input/Keys module is now totally independant from the Aleworks libraries, such as Aleworks::API, does this mean that you no longer use/support the Aleworks::API module and other related libraries? Lastly, when you talk about how its "now faster than ever!" what exactly does that mean?
Thanks. The difference is that now it uses a DLL for updating the input states, so all the update methods are now in c which is really faster than ruby. Also, I forgot to say that the script was in BETA version, and temporaly I have removed the dependency of Aleworks Library, because I am rewriting it in a better way. Also I am doing the same with all my scripts and some new.

There was an issue I had with your older version, having to do with when a Print message was displayed on the window (with "p" or "print"). By default (without Aleworks), you can either close the print window by clicking the "OK" button on it, or by using a key like Enter (ie Input::C), without actually triggering an Input.trigger?(*) response. However, with Aleworks installed, the Input trigger now was triggered directly after closing the print window, causing accidental and undesired actions such as triggering scene changes in the Menu and the such. Is this something that has been resolved in the new version?
I have never realised of that, but I will see what can I do.

Lastly, what about your old addons, like the Name addon and the Password addon the one for Input Number? Do those still work with this version, or do you have to rescript those? (I always had a problem with Scene_Name not working but that might just be a personal problem in my project, or perhaps it conflicted with SDK maybe?) I appologize for bombarding you with questions, but I happened to utilize alot of your libraries functions in my scripts so there is alot I need to know about the new version.
I have not included that yet, because I am also rewritting them and the script is now in BETA version.

Can your Input or Keys module detect the Mouse wheel scrolling up/down?
Not yet, but I will see if I can include that for the release version.

@hanmac, thanks I will update that. Also, äëïöü, áéíóú, àèìòù, and more characters, can be detected as buttons, but not seeing which characters it represents. However with my other script, a writing system, these characters all well detected. Also, I am rewritting the writing system, too.

After testing the Print command VS Input::C triggering afterwards, its slightly better. If I release Enter/C or whatever quick enough, the key doesn't trigger in-game (just like its supposed to not do), but... its not supposed to trigger at all if you're still holding an Input::C key until you press it again. I'm not sure how you'd fix this, maybe I'll figure out how and post it. But basically, you might need to use some API magic to see if the Game's main window is active, or if another window (such as the Print window) is active, and clear the trigger if so, or set some kinda flag.
My idea is to alias the "p" and "print" methods, and say to the input module not to update next frame. I will see if it work.
 
can your mouse input also check the position of the mouse?

The other scripts I found are slow. So, Vgvgf, if your DLL can do this too, it will be cool. :)


Can your Input or Keys module detect the Mouse wheel scrolling up/down?

I tested all Keyboard and mouse input, but I never found a value which corresponds to wheel scrolling...
It's because it's another system ?
Because the wheel has been implemented after keyboard and mouse without wheel on computers ?
 
Hi, king
3 apis pour la reception de données externes / you've to use these Win32apis to send the scrollwheel message to the window
Code:
get_message = Win32API.new('User32', 'GetMessage', 'plll', 'l')
translate_message = Win32API.new('User32', 'TranslateMessage', 'p', 'l')
dispatch_message = Win32API.new('User32', 'DispatchMessage', 'p', 'l')

et j'ai un lien pour toi: ^^ / I give you an url about it:
ici/here
le probleme c'est que le systeme est très lent / but this system is quite slow...
pas réussi à l'optimiser... pour scroller la map...

amicalement/best regards

berka
 
> berka
I'm in interest with this script. I want to use some kind of :

Code:
if Input::trigger?(Input::WheelDown)

For my applications.

Using Winapi is very slow... I know people, when they use my scripts, they have 7 FPS.
I delete the use of keyboard, and they have more than 37 FPS.

I don't have test the vgvgf's script. I hope it will be faster. ;)

I send a MP to vgvgf to have explanations about compatibility with your script (I didn't notice your answer).
 
can your mouse input also check the position of the mouse?
I haven't added mouse functions yet, but I will.
Can your Input or Keys module detect the Mouse wheel scrolling up/down?
I am working on that.
et j'ai un lien pour toi: ^^ / I give you an url about it:
ici/here
le probleme c'est que le systeme est très lent / but this system is quite slow...
pas réussi à l'optimiser... pour scroller la map...
Thanks, I will see how can I convert this to C for DLL, or something better if I can find something so.
Code:
Using Winapi is very slow... I know people, when they use my scripts, they have 7 FPS.
I delete the use of keyboard, and they have more than 37 FPS.

I don't have test the vgvgf's script. I hope it will be faster. ;)
Yeah, but my script runs as fast as the original one, or at maximum 1 FPS less.
 
Now I have done the release version of the script, not more in beta version, and now it comes with a Mouse Plugin for mouse input detection. Also, I have added some demos for XP and VX of the script.
 
GREAT!!!

now i only need a window where you can input letters (and use your dll)

PS: i shound be use the keyboard layout

Edit:

error:

#-------------------------------------------------------------------------
# * Get RTP Path
#-------------------------------------------------------------------------
def get_rtp_path(rtp = 0)
API::RGSSGetPathWithRTP.call(API::RGSSGetRTPPath.cal(rtp))
end

PS: can i turn your script into a APD version? (you also get credit)
 
*bump*


Question: does your script support qwertz-keyboards?

or can you get the string of the key witch is set by the keybroad layout?
 
can i turn your script into a APD version? (you also get credit)
Question: does your script support qwertz-keyboards?
or can you get the string of the key witch is set by the keybroad layout?
Well, I don't know what APD is, it works with qwerty keyboards and should with azerty, too, and also it should work with all keyboards layouts, as the Virtual keys corresponding to each key are the same except for the OEM keys/characters. Also, I am still working on the writing system, aka getting the real character for the user keyboard and configuration. However, I still don't know when I will finish it.

The error will be fixed in the next version. I thought that I have already fixed it in this new version, I it seems I have forgotten it.
 
1.
the APD is a script manage system (like the sdk) but its for both, and has more intresting functions
2. im also work on a writing system ... (because i need it for my save)


PS: how can a mark a thead that i get email if it change?
 
this is for mouse wheel:

Code:
=begin

 

RGSS MOUSE WHEEL (VERSION 2)

 

== Credits == 

Copyright 2009 by Cremno (cremno[A mit Kringel]mail[PÃœNKTCHEN]ru).

 

== License ==

Published under [url=http://creativecommons.org/licenses/by-sa/3.0/]http://creativecommons.org/licenses/by-sa/3.0/[/url]

 

=end

 

module WinAPI

 

  module Functions

 

    def self.add(proc, import, export = 'L', dllname = @dll_name)

      ::Win32API.new(dllname, proc, import, export)

    end

 

    @dll_name = 'user32'

    GetMessage       = add('GetMessage',       'PLLL')

    TranslateMessage = add('TranslateMessage', 'P'   )

    DispatchMessage  = add('DispatchMessage',  'P'   )

  end

 

  module Structures

    MSG = "\0" * 32

  end

 

  module Macros

    UnpackDWORD = lambda do |buffer, offset|

      retval  =  buffer[offset]                 & 0x000000FF

      retval |= (buffer[offset + 1] << (8 * 1)) & 0x0000FF00

      retval |= (buffer[offset + 2] << (8 * 2)) & 0x00FF0000

      retval |= (buffer[offset + 3] << (8 * 3)) & 0xFF000000

      retval

    end

 

    LOWORD = lambda do |n|

      n & 0xFFFF

    end

 

    HIWORD = lambda do |l|

      (l >> 16) & 0xFFFF

    end

 

    GET_WHEEL_DELTA_WPARAM = lambda do |wparam|

       hiword = HIWORD.call(wparam)

       (hiword & 0x8000).zero? ? hiword : -1 * ((~hiword & 0x7FFF).succ)

    end

  end

 

  [Functions, Structures, Macros].each do |mod|

    mod.constants.each{|const| const.freeze}

  end

 

end

 

 

Mouse = Module.new if !Object.const_defined?(:Mouse)

 

module Mouse::Wheel

 

  WHEEL_DELTA = 120.freeze

 

  def self.delta()

    msg = ::WinAPI::Structures::MSG.dup

    retval = ::WinAPI::Functions::GetMessage.call(msg, 0, 0, 0)

    case retval

      when -1  # Error

        section_name = $RGSS_SCRIPTS.at(__FILE__.sub(/Section/, '').to_i).at(1)

        raise("Skript '#{section_name}': Fehler bei Anruf von GetMessage!")

      when  0  # WM_QUIT

        exit()

      else

        ::WinAPI::Functions::TranslateMessage.call(msg)

        ::WinAPI::Functions::DispatchMessage.call(msg)

        if ::WinAPI::Macros::UnpackDWORD.call(msg, 4).eql?(522)  # MSG->message

          wparam = ::WinAPI::Macros::UnpackDWORD.call(msg, 8)    # MSG->wParam

          return ::WinAPI::Macros::GET_WHEEL_DELTA_WPARAM.call(wparam)

        end

    end

    0

  end

 

  def self.rotation_direction()

    d = delta()

    d.zero? ? (:none) : ((d > 0) ? (:up) : (:down))

  end

 

end
 
Thanks hanmac. I will see if I make some free time for updating the script, now that you remembered me that I still have to finish some things.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top