Ramiro + RMVXA = ♥

Ramiro's script collection for ACE!

Extended Input

Joke002

Sure, it's a miracle than I can put this kind of jokes here without being killed by anyone.

Do you like to have a warm and cool  input system?

Are you an scripter than is boring to use, ALL THE TIME the same system?

This is the solution for you:
 DOWNLOAD LINK

This is an advanced Input system, yeah it sounds cool, but remember.

And… yes I’ll use them and make scripts for you later with this, stay tuned please.

It’s an SCRIPTER’s TOOL so if you are not a scripter… forget about this.

To use it just read this “Short manual of usage, not for dummies”:

(remember they are in the script too)

# Instructions of use:
#
# 1 About Keyboard:
#
# 1.1 Keyboard Normal methods:
# you have the options to choose the original inputs:
#
# Keyboard.trigger?(sym[, sym, ...])
# Keyboard.press?(sym[, sym, ...])
# Keyboard.repeat?(sym[, sym, ...])
# Keyboard.release?(sym[, sym, ...])
#
# If you put more than 1 symbol or key id, you will get true if any of the
# keys choosed are selected.
# Examples of key symbols are:
# :CTRL (Control key), :LEFT_SHIFT (Left Shift), :ARROW_UP ( arrow up)
# :FN (with N from 1 to 12) to function keys
# You can check the ASCII_SYM table to view all the other Symbols.
# You can also use the number key eg: 65, means "A key". Check an ASCII table
# if you wish to know more about.
#
# You can check insthead of any of the pressed keys, all of the pressed keys.
#
# Keyboard.all_trigger?(sym[, sym, ...])
# Keyboard.all_press?(sym[, sym, ...])
# Keyboard.all_repeat?(sym[, sym, ...])
# Keyboard.all_release?(sym[, sym, ...])
#
# 1.2 How each method works:
#
# trigger is activated on the first frame the key was pressed, and not again
# until you release the key.
#
# press will give true each time the key is pressed, even on consecutive frames.
#
# repeat is a special case, it will check between frames, alternating between
# true and false if the key is pressed. its more convenient to use it if you want
# a slower version of 'press'
#
# Finally release, will be set to true, when you release the key. but only the
# first frame.
#
# 1.3 Keyboard's input character:
#
# You can get the keyboard's input character using the next function:
#
# Keyboard.character
#
# This system supports custom Keyboard layauts with api calls, you yes,
# you'll never have to configure each Keyboard version or use the "Only English"
# keyboard.
#
# 2.1 About the mouse.
#
# The Mouse has great influence on modern pcs, or at least when touchscreens
# were expensive and were hard to manufacture.
#
# It doesn't matter anyway, because touchscreens still acts like a Mouse
# sometimes.
#
# 2.2 Mouse position
#
# If you use a Mouse, you can use this next functions:
#
# Mouse.screen_x
# Mouse.screen_y
# Mouse.x
# Mouse.y
#
# if you want to know the real position (in the OS) use screen_x and screen_y
# functions.
#
# to get the relative positions (the position in the game) of the Mouse, use x,
# and y.
#
# 2.3 Mouse keys
#
# You have this same functions from the Keyboard, with some differences:
#
# Mouse.trigger?([sym])
# Mouse.press?([sym])
# Mouse.repeat?([sym])
# Mouse.release?([sym])
#
# sym has to be: :PRIMARY, :SECONDARY, :MIDDLE, :MOUSE4 or :MOUSE5
#
# Each one refered to a key of the mouse, it supports left handed mouses,
# primary, means the principal key, not the left key, and the same for the
# secondary.
#
# if you don't use ANY of the symbols, it will be :PRIMARY by default.
#
# 2.4 Getting areas of mouse:
#
# you can check if the mouse is inside a rect with the next commands:
#
# Mouse.in_area?(x, y, width, height)
# Mouse.in_area?(rect)
#
# both returns true if the mouse is INSIDE the rect and false if the mouse is
# OUTSIDE.
#
# 3.1 About Gamepad
#
# Gamepad works quite different like all the other Inputs, well not really.
# to use it just call this:
#
# Gamepad[index].method(args)
#
# Where index is a number from 1 to the supported numbers of gamepad by
# the system.
#
# On windows 2k it can only support 2 Gamepads
# On windows XP and newer it can support up to 16 Gamepads at least
#
# You can always get the max number of joypads by using the function:
#
# Gamepad.pugged_joypads
#
# 3.2 Getting Gamepad input
#
# The functions are te same of the Keyboard:
#
# Gamepad[id].trigger?(sym[, sym, ...])
# Gamepad[id].press?(sym[, sym, ...])
# Gamepad[id].repeat?(sym[, sym, ...])
# Gamepad[id].release?(sym[, sym, ...])
#
# Gamepad[id].all_trigger?(sym[, sym, ...])
# Gamepad[id].all_press?(sym[, sym, ...])
# Gamepad[id].all_repeat?(sym[, sym, ...])
# Gamepad[id].all_release?(sym[, sym, ...])
#
# The difference here is about the symbols, you can only use symbols and has to
# be one of the next:
# :UP, :DOWN, :LEFT, :RIGHT, :JOY1, :JOY2, :JOY3, :JOY4, :JOY5, :JOY6, :JOY7,
# :JOY8, :JOY9, :JOY10, :JOY11, :JOY12
#
# If you like a more RM Style Gamepad, you can still use the original syms:
#
# :A, :B, :C, :X, :Y, :Z, :L, :R
#
# The are refering from JOY1, to JOY8
#
# if you wisth to know the X axis, the Y axis or the Z axis of an analog stick
# (if supported by your gamepad/s, of course) you can use this functions:
#
# Gamepad[id].x
# Gamepad[id].y
# Gamepad[id].z
#
# They work giving a number from - 32511 to 32511.

Advertisements

17 Comments

  1. brr
    • FIXED!

      • Brr

        Thanks 🙂

  2. A.mithril

    Script ‘Game_Interpreter’ line 449: NameError Occured
    undefined local variable or method ‘keyboard’ for #

    • A.mithril

      My Mistake. I type “keyboard”…
      thank yoo for coding this script

  3. Death_Nova

    what do I do with the .rb file?

    • just open it with notepad… or notepad++

  4. the_bored_gamer

    Mmm… sorry for the noob question but… when I get in fullscreen the mouse don’t show up.
    Values of the mouse seems to have changed too. What am I doing wrong?

    • Absolutly Nothing!
      Because usually when you switch to fullscreen there is a nice function called named ShowCursor(FALSE) on Win32API…
      I suggest you SHOULD use a Mouse cursor implemented in your game:
      An easy way to do this is something like this:
      https://dl.dropbox.com/u/55382447/mouse%20sprite%20snippets.rb
      You will need an image cursor in “Graphics/System”
      Here take this one as an example:

      For an animated Mouse or something like that, Just use your imagination… it’s not as hard as you may think…

      • Sorry for the long waiting…

  5. the_bored_gamer

    Thank you Ramiro 🙂
    You’re the best!

  6. traplesstrapless

    http://pastebin.com/tGzbDFZ1
    ^ the code i am having a problem with.

    i have a scene accepting input. my gamepad if not registering trigger? correctly.

    i have my console print an array of keys that == trigger? that frame.
    when i “press?” a key… the console prints that key is triggering every other frame.

    any ideas why my controller wont register trigger only on initial pressing of a key?

    thanks ahead of time for any help with this, whoever you may be 🙂

    • Are you actually doing Joypad.update in your Updates ? And ‘trigger?’ works only on the first time you press without releasing…

      • i did Gamepad.update. in my in my update definition “super” is my first instruction witch calls SceneBase.update.. calling update_basic calling Input.update that you aliased like so:

        module Input
        class << self
        alias ramiro_input_mod_update update
        def update
        Keyboard.update
        Mouse.update
        Gamepad.update
        ramiro_input_mod_update
        end

        i did not let go up the button and still got trigger? == true every other frame as if it were repeat? == true.

        maybe it was the controllers

  7. help Extended Input release? not working fix
    ^ maybe search engine will find this comment 😀

    I noticed that Keyboard.release? didn’t work. Here is my modified Keyboard.update that corrects it. This edit also offsets Keyboard.repeat? by one frame so it does not initiate at the same time as Keyboard.trigger?. I felt that it shouldn’t by reason

    module Keyboard

    def self.update
    @language_layout = Api::GetKeyboardLayout.call(0)
    Api::GetKeyboardState.call(@state)
    @frame_keys.clear
    KEY_SIZE.times do |key|
    if Api::GetKeyState.call(key) & DOWN_STATE_MASK == DOWN_STATE_MASK
    @released[key] = false
    if !@pressed[key]
    @pressed[key] = true
    @triggered[key] = true
    @repeated[key] = true #<- was false, now true to avoid
    # simultaneous (triggered and repeated)
    else
    @triggered[key] = false
    end
    @repeated[key] = !@repeated[key]
    @frame_keys.push(key)
    elsif !@released[key] && @pressed[key] #<- was missing @pressed[key]
    @triggered[key] = false
    @pressed[key] = false
    @repeated[key] = false
    @released[key] = true
    else
    @released[key] = false
    end
    end
    @character = make_character
    end

    end

Trackbacks

  1. YEA – LSP Punishment | Yanfly Channel
  2. Ralph? Ralph! RAAAALLLLPPPHHH!!!! | Division Heaven

Wanna leave a comment?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: