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.

Original Input Script?

Hey I was wondering... does anyone know what the original Input script looks like? Is there a link to it somewhere?

I've seen Near's (very nice btw), but that's not quite what I'm looking for, since it's not the line-for-line original.

Thanks!
 
The Input module probably looks real close to the Keyboard module.

Constant Setup:
Code:
DOWN = 2
ALT = 23
L = 17
C = 13
F7 = 27
RIGHT = 6
CTRL = 22
Z = 16
B = 12
F6 = 26
UP = 8
SHIFT = 21
Y = 15
F9 = 29
A = 11
F5 = 25
LEFT = 4
R = 18
X = 14
F8 = 28

How I got that:
Code:
cs = Input.constants
for c in cs
  p c, (eval "Input::#{c}")
end


Now these values are drastically different then the keyboard module. This means because you can change keys button when you open the F1 menu, there is more or less likely a second hash somewhere hidden the RGSS library, with the numbers up there as keys, and whatever you setup in the F1 menu as values. Something like:

Code:
True_Keys = {
  # Alt = 23
  23 => the_keyboard_key_for_whatever_you_setup_in_f1,
  # Y = 15
  15 => as_above,
  # ...
}

Then the input methods would end up being something like:
Code:
def self.trigger?(constant)
  return self.state(True_Keys[constant])
end

def self.state(keyboard_key)
  # returns if triggered or not
end

I don't know for 100%, but I can speculate that's how it is done.

EDIT : If you wanted, you can view all the different classes, instances, constants, etc. with this:
Code:
myary = []
Symbol.all_symbols.map.each {|itm| myary.push(itm.to_s)}
open("list.txt", "w") {|outfile| myary.sort.each {|i| outfile.write(i + "\n")}}

Somewhere in there might be something that proves me correctly. I suggest deleting all your scripts from a project to test this, or you will get all your window, game, scene, etc. object classes as well.
 
hey seph, does this code
myary = []
Symbol.all_symbols.map.each {|itm| myary.push(itm.to_s)}
open("list.txt", "w") {|outfile| myary.sort.each {|i| outfile.write(i + "\n")}}

go like in a call script or what. just put begin around and end around these two and delete all other scripts?
 

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