Bonjour bonjour.
Et oui aujourd'hui j'ai besoin de votre aide .
Voila je voudrais savoir si il y a des numero pour les touches F1 , F2 ect. . .
Je sais que certaines touche comme leA , le Z ect. . ont des numero à stocker dans des variables pour validé la pression mais est ce que F1 ect... ont la même chose?
Salut Djipi :) Alors pour ton problème j'imagine que c'est pour testé les appuie de touches et les utilisées éventuellement dans ton jeu? Alors je crois que par défaut non, ce n'est pas possible, mais j'utilise un script qui permet l'utilisation de toutes les touches y compris les F, le seul défaut est qu'après les appels de touches normaux ne fonctionnent plus et qu'il faut tout changer pour le script, c'est pas si mal si tu commences, mais quelque chose me dit que c'est pour SA... Je te le postes si ça t'intéresse:
[spoiler]#if Input.trigger?(Keys::KEY_InsertYourKeyHere)
#
module Keys
KEY_BACK = 0x08 # BACKSPACE Keys
KEY_TAB = 0x09 # TAB Keys
KEY_RETURN = 0x0D # ENTER Keys
KEY_SHIFT = 0x10 # SHIFT Keys
KEY_PAUSE = 0x13 # PAUSE Keys
KEY_CAPITAL = 0x14 # CAPS LOCK Keys
KEY_CAPSLOCK = 0x14 # CAPS LOCK Key
KEY_ESCAPE = 0x1B # ESC Keys
KEY_SPACE = 0x20 # SPACEBAR
KEY_PRIOR = 0x21 # PAGE UP Keys
KEY_NEXT = 0x22 # PAGE DOWN Keys
KEY_END = 0x23 # END Keys
KEY_HOME = 0x24 # HOME Keys
KEY_LEFT = 0x25 # LEFT ARROW Keys
KEY_UP = 0x26 # UP ARROW Keys
KEY_RIGHT = 0x27 # RIGHT ARROW Keys
KEY_DOWN = 0x28 # DOWN ARROW Keys
KEY_SELECT = 0x29 # SELECT Keys
KEY_PRINT = 0x2A # PRINT Keys
KEY_SNAPSHOT = 0x2C # PRINT SCREEN Keys
KEY_INSERT = 0x2D # INS Keys
KEY_DELETE = 0x2E # DEL Keys
KEY_0 = 0x30 # 0 Keys
KEY_1 = 0x31 # 1 Keys
KEY_2 = 0x32 # 2 Keys
KEY_3 = 0x33 # 3 Keys
KEY_4 = 0x34 # 4 Keys
KEY_5 = 0x35 # 5 Keys
KEY_6 = 0x36 # 6 Keys
KEY_7 = 0x37 # 7 Keys
KEY_8 = 0x38 # 8 Keys
KEY_9 = 0x39 # 9 Keys
KEY_A = 0x41 # A Keys
KEY_B = 0x42 # B Keys
KEY_C = 0x43 # C Keys
KEY_D = 0x44 # D Keys
KEY_E = 0x45 # E Keys
KEY_F = 0x46 # F Keys
KEY_G = 0x47 # G Keys
KEY_H = 0x48 # H Keys
KEY_I = 0x49 # I Keys
KEY_J = 0x4A # J Keys
KEY_K = 0x4B # K Keys
KEY_L = 0x4C # L Keys
KEY_M = 0x4D # M Keys
KEY_N = 0x4E # N Keys
KEY_O = 0x4F # O Keys
KEY_P = 0x50 # P Keys
KEY_Q = 0x51 # Q Keys
KEY_R = 0x52 # R Keys
KEY_S = 0x53 # S Keys
KEY_T = 0x54 # T Keys
KEY_U = 0x55 # U Keys
KEY_V = 0x56 # V Keys
KEY_W = 0x57 # W Keys
KEY_X = 0x58 # X Keys
KEY_Y = 0x59 # Y Keys
KEY_Z = 0x5A # Z Keys
KEY_LWIN = 0x5B # Left Windows Keys (Microsoft Natural Keysboard)
KEY_RWIN = 0x5C # Right Windows Keys (Natural Keysboard)
KEY_APPS = 0x5D # Applications Keys (Natural Keysboard)
KEY_NUMPAD0 = 0x60 # Numeric Keyspad 0 Keys
KEY_NUMPAD1 = 0x61 # Numeric Keyspad 1 Keys
KEY_NUMPAD2 = 0x62 # Numeric Keyspad 2 Keys
KEY_NUMPAD3 = 0x63 # Numeric Keyspad 3 Keys
KEY_NUMPAD4 = 0x64 # Numeric Keyspad 4 Keys
KEY_NUMPAD5 = 0x65 # Numeric Keyspad 5 Keys
KEY_NUMPAD6 = 0x66 # Numeric Keyspad 6 Keys
KEY_NUMPAD7 = 0x67 # Numeric Keyspad 7 Keys
KEY_NUMPAD8 = 0x68 # Numeric Keyspad 8 Keys
KEY_NUMPAD9 = 0x69 # Numeric Keyspad 9 Keys
KEY_MULTIPLY = 0x6A # Multiply Keys (*)
KEY_ADD = 0x6B # Add Keys (+)
KEY_SEPARATOR = 0x6C # Separator Keys
KEY_SUBTRACT = 0x6D # Subtract Keys (-)
KEY_DECIMAL = 0x6E # Decimal Keys
KEY_DIVIDE = 0x6F # Divide Keys (/)
KEY_F1 = 0x70 # F1 Keys
KEY_F2 = 0x71 # F2 Keys
KEY_F3 = 0x72 # F3 Keys
KEY_F4 = 0x73 # F4 Keys
KEY_F5 = 0x74 # F5 Keys
KEY_F6 = 0x75 # F6 Keys
KEY_F7 = 0x76 # F7 Keys
KEY_F8 = 0x77 # F8 Keys
KEY_F9 = 0x78 # F9 Keys
KEY_F10 = 0x79 # F10 Keys
KEY_F11 = 0x7A # F11 Keys
KEY_F12 = 0x7B # F12 Keys
KEY_NUMLOCK = 0x90 # NUM LOCK Keys
KEY_SCROLL = 0x91 # SCROLL LOCK Keys
KEY_LSHIFT = 0xA0 # Left SHIFT Keys
KEY_RSHIFT = 0xA1 # Right SHIFT Keys
KEY_LCONTROL = 0xA2 # Left CONTROL Keys
KEY_RCONTROL = 0xA3 # Right CONTROL Keys
KEY_L_ALT = 0xA4 # Left ALT Keys
KEY_R_ALT = 0xA5 # Right ALT Keys
KEY_SEP = 0xBC # , Keys
KEY_DASH = 0xBD # - Keys
KEY_DOTT = 0xBE # . Keys
#par berka -----------------------------------------
KEY_POURCENT = 0xC0 # % or ù Keys
KEY_DOLLARD = 0xBA # $ Keys
KEY_UNDER = 0xDD # ^ Keys
KEY_STAR = 0xDC # * or µ Keys
KEY_DDOTT = 0xBF # : keys
KEY_DEG = 0xDB # ) or ° keys
KEY_DOTTS = 0xDF # ! keys
KEY_SQUARD = 0xDE # ² key
KEY_EGAL = 0xBB #=
for i in self.constants
attr_reader i
end
module_function
def each
for i in self.constants
yield self.const_get(i)
end
end
end
module Input
# Constants that need to be defined for overriding purposes
F5 = Keys::KEY_F5
F6 = Keys::KEY_F6
F7 = Keys::KEY_F7
F8 = Keys::KEY_F8
F9 = Keys::KEY_F9
UP = 1000
DOWN = 1001
LEFT = 1002
RIGHT = 1003
A = 2000
B = 2001
C = 2002
X = 3000
Y = 3001
Z = 3002
R = 4000
L = 4001
SHIFT = 5000
CTRL = 5001
ALT = 5002
for i in self.constants
attr_reader i
end
@KeysMap = Hash.new
@trigger = Hash.new(false)
@repeat = Hash.new(false)
@toggle = Hash.new(false)
@counts = Hash.new(0)
@delay = 5 # The number of frames in which repeat? will only return true once
# an array containing all the Keyss that correspond to the direction up, down,
# left, right, 'A', 'B', 'C', 'X', 'Y', 'Z', 'L', 'R', SHIFT, CTRL, and ALT,
# respectively.
@KeysMap[UP] = [Keys::KEY_UP]
@KeysMap[DOWN] = [Keys::KEY_DOWN]
@KeysMap
= [Keys::KEY_LEFT]
@KeysMap
= [Keys::KEY_RIGHT]
@KeysMap[A] = [Keys::KEY_LSHIFT, Keys::KEY_RSHIFT, Keys::KEY_Z]
@KeysMap
= [Keys::KEY_ESCAPE, Keys::KEY_NUMPAD0, Keys::KEY_X]
@KeysMap[C] = [Keys::KEY_SPACE, Keys::KEY_RETURN, Keys::KEY_C]
@KeysMap[X] = [Keys::KEY_A]
@KeysMap[Y] = [Keys::KEY_S]
@KeysMap[Z] = [Keys::KEY_D]
@KeysMap[L] = [Keys::KEY_Q]
@KeysMap[R] = [Keys::KEY_W]
@KeysMap[SHIFT] = [Keys::KEY_SHIFT, Keys::KEY_LSHIFT, Keys::KEY_RSHIFT]
@KeysMap[CTRL] = [Keys::KEY_LCONTROL, Keys::KEY_RCONTROL]
@KeysMap[ALT] = [Keys::KEY_L_ALT, Keys::KEY_R_ALT]
@KeyStates = 0.chr * 256
@getKeyStates = Win32API.new('user32', 'GetKeyboardState', ['P'], 'N')
for i in Keys
@trigger = false
@repeat = false
@counts = 4
end
module_function
# Determines whether the button num was pressed agian at the last update.
# "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.
def trigger?(num)
if @KeysMap.has_key?(num)
for i in @KeysMap[num]
return true if @trigger
end
return false
end
return @trigger[num]
end
alias triggered? trigger?
# Determines whether the button num was being pressed at the last update.
# Unlike trigger?, 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.
# Has a delay to prevent things from moving to fast, E.G. menu indecies.
def repeat?(num)
if @KeysMap.has_key?(num)
for i in @KeysMap[num]
return true if(@repeat and @counts == 0)
end
return false
end
return (@repeat[num] and @counts == 0)
end
alias repeated? repeat?
alias repeating? repeat?
# Same as repeat without the delay
def press?(num)
if @KeysMap.has_key?(num)
for i in @KeysMap[num]
return true if @repeat
end
return false
end
return @repeat
end
alias pressed? press?
def toggle?(num)
if @KeysMap.has_key?(num)
return false if @KeysMap[num].size != 1
return @toggle[@KeysMap[num][0]]
end
return @toggle[num]
end
alias toggled? toggle?
# Checks the status of the directional buttons, translates the data into a
# specialized 4-direction input format, and returns the number pad equivalent
# (2, 4, 6, 8).
# If no directional buttons are being pressed (or the equivalent), returns 0.
def dir4
dir = 0
for i in @KeysMap[UP]
if @repeat
dir = 8
end
end
for i in @KeysMap[DOWN]
if @repeat
if dir == 0
dir = 2
else
return 0
end
end
end
for i in @KeysMap if @repeat
if dir == 0
dir = 4
else
return 0
end
end
end
for i in @KeysMap
if @repeat
if dir == 0
dir = 6
else
return 0
end
end
end
return dir
end
# Checks the status of the directional buttons, translates the data into a
# specialized 8-direction input format, and returns the number pad equivalent
# (1, 2, 3, 4, 6, 7, 8, 9).
# If no directional buttons are being pressed (or the equivalent), returns 0.
def dir8
if press?(DOWN) and press?(LEFT)
return 1
elsif press?(DOWN) and press?(RIGHT)
return 3
elsif press?(UP) and press?(LEFT)
return 7
elsif press?(UP) and press?(RIGHT)
return 9
elsif press?(DOWN) and press?(UP)
return 0
elsif press?(LEFT) and press?(RIGHT)
return 0
elsif press?(DOWN)
return 2
elsif press?(LEFT)
return 4
elsif press?(RIGHT)
return 6
elsif press?(UP)
return 8
else
return 0
end
end
# Updates input data. As a rule, this method is called once per frame.
def update
@getKeyStates.call(@KeyStates)
for i in Keys
@toggle = (@KeyStates & 0x01 == 0x01)
if (@KeyStates & 0x80 > 0)
@trigger = !@repeat
@repeat = true
@counts += 1
@counts %= @delay
else
@repeat = false
@trigger = false
@counts = -1
end
end
end
# Additional functions of use
def getKeys(keyType)
if @KeysMap.has_key?(keyType)
return @KeysMap[keyType].dup
end
return [keyType]
end
def addKey(keyType, key)
legit = true
@KeysMap.each_key {| i | legit = remKey(i, key)}
return false if !legit
if @KeysMap.has_key?(keyType)
@KeysMap[keyType] = @KeysMap[keyType] | [key]
else
@KeysMap[KeyType] = [key]
end
return true
end
def addKeys(keyType, keys)
legits = Hash.new(false)
for i in keys
legits = addKey(keyType, i)
end
return legits
end
def removeKey(keyType, key)
return true if !@KeysMap.has_key?(keyType)
return false if @KeysMap[keyType] == [key]
@KeysMap[keyType] -= key
return true
end
def removeKeys(keyType, keys)
return true if !@KeysMap.has_key?(keyType)
return false if @KeysMap[keyType].size <= keys.size
for i in keys
return false if !@KeysMap[keyType].include?(i)
end
for i in keys
@KeysMap[keyType].remove(i)
end
return true
end
alias remKey removeKey
alias remKeys removeKeys
def removeGroup(keyGroup)
return false if !@KeysMap.has_key?(keyGroup)
@KeysMap[keyGroup] = []
return true;
end
alias remGroup removeGroup
def removeGroups(keyGroups)
ligits = Hash.new(false)
for i in keyGroups
ligits = removeGroup(i)
end
return legits
end
end[/spoiler]
Sinon, j'imagine qu'il y a moyen de les gérés avec une modification des scripts de RMXP mais je ne suis pas un pro et je ne pourrais pas dire où ce code se trouve... Au pire attend quelqu'un de plus callé que moi ;)
Merci supersonic_3 , c'est effectivement pour SA donc je ne peut utiliser ce script.
Par contre , est ce que quelqu'un connais les numéro attribué au touche du clavier ? Car si je ne peut utiliser F1 , F2 ect . . . je peut toujours m'arranger avec d'autre touche sachant que les touches "A" , "z" , "q" , "w" , "x" sont déjà utilisé sans parler de la barre espace.
Si quelqu'un peu m'aider plus que cela se serais vraiment cool car je voudrais implémenter un truc bien cool mais il me faudrait des touches disponible.
Merci en tous les cas^^
Trouvé en deux minutes sur Google (http://forum.relite.org/aide-generale-rpg-maker-xp/2030-rmxp-codes-de-touches.html), post sur Relite avec des infos intéressantes (on trouve une liste de 18 touches disponibles (exhaustive ?) ainsi que les commandes RUBY pour les différents appuis de touches).
J'espère que ça pourra t'aider ^_^.