Keys like [ENTER],[SHIFT]...

Non-platform specific questions.

Keys like [ENTER],[SHIFT]...

Postby BogdansB » Thu Oct 27, 2011 7:35 am

hello,
I want to know how to make: If the Key Enter is pressed, then [...]. in script.
if i want to press [a] the code would be like :
Code: Select all
if(key[KEY_a])

so what about ENTER,SHIFT,STRG...?
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: Keys like [ENTER],[SHIFT]...

Postby skydereign » Thu Oct 27, 2011 9:21 am

Code: Select all
char* key = GetKeyState();
if(key[KEY_RETURN]==1) { };
if(key[KEY_LSHIFT]==1) { };
if(key[KEY_RSHIFT]==1) { };

// I think by STRG you mean control so
if(key[KEY_RCTRL]==1) { };
if(key[KEY_LCTRL]==1) { };

You can find the full list here (search for valid key entries). http://game-editor.com/docs/script_reference.htm
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Keys like [ENTER],[SHIFT]...

Postby BogdansB » Thu Oct 27, 2011 10:04 am

thanks
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: Keys like [ENTER],[SHIFT]...

Postby BogdansB » Thu Oct 27, 2011 11:57 am

and how can i write the numbers in script, wich are on the NumPad and not on the top of the keyboard?
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: Keys like [ENTER],[SHIFT]...

Postby foleyjo » Thu Oct 27, 2011 12:10 pm

Code: Select all
if(key[KEY_PAD_0]) //change the 0 to whatever number you want


Full list can be found here
http://game-editor.com/docs/script_reference.htm
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: Keys like [ENTER],[SHIFT]...

Postby BogdansB » Thu Oct 27, 2011 12:20 pm

thank you
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: Keys like [ENTER],[SHIFT]...

Postby Game A Gogo » Thu Oct 27, 2011 12:49 pm

Since you have to scroll a horrible amount, here is that list:
Code: Select all
KEY_BACKSPACE
KEY_TAB
KEY_CLEAR
KEY_RETURN
KEY_PAUSE
KEY_ESCAPE
KEY_SPACE
KEY_EXCLAIM
KEY_QUOTEDBL
KEY_HASH
KEY_DOLLAR
KEY_AMPERSAND
KEY_QUOTE
KEY_LEFTPAREN
KEY_RIGHTPAREN
KEY_ASTERISK
KEY_PLUS
KEY_COMMA
KEY_MINUS
KEY_PERIOD
KEY_SLASH
KEY_0
KEY_1
KEY_2
KEY_3
KEY_4
KEY_5
KEY_6
KEY_7
KEY_8
KEY_9
KEY_COLON
KEY_SEMICOLON
KEY_LESS
KEY_EQUALS
KEY_GREATER
KEY_QUESTION
KEY_AT
KEY_LEFTBRACKET
KEY_BACKSLASH
KEY_RIGHTBRACKET
KEY_CARET
KEY_UNDERSCORE
KEY_BACKQUOTE
KEY_a
KEY_b
KEY_c
KEY_d
KEY_e
KEY_f
KEY_g
KEY_h
KEY_i
KEY_j
KEY_k
KEY_l
KEY_m
KEY_n
KEY_o
KEY_p
KEY_q
KEY_r
KEY_s
KEY_t
KEY_u
KEY_v
KEY_w
KEY_x
KEY_y
KEY_z
KEY_PAD_0
KEY_PAD_1
KEY_PAD_2
KEY_PAD_3
KEY_PAD_4
KEY_PAD_5
KEY_PAD_6
KEY_PAD_7
KEY_PAD_8
KEY_PAD_9
KEY_PAD_PERIOD
KEY_PAD_DIVIDE
KEY_PAD_MULTIPLY
KEY_PAD_MINUS
KEY_PAD_PLUS
KEY_PAD_ENTER
KEY_PAD_EQUALS
KEY_UP
KEY_DOWN
KEY_RIGHT
KEY_LEFT
KEY_INSERT
KEY_HOME
KEY_END
KEY_PAGEUP
KEY_PAGEDOWN
KEY_F1
KEY_F2
KEY_F3
KEY_F4
KEY_F5
KEY_F6
KEY_F7
KEY_F8
KEY_F9
KEY_F10
KEY_F11
KEY_F12
KEY_F13
KEY_F14
KEY_F15
KEY_NUMLOCK
KEY_CAPSLOCK
KEY_SCROLLOCK
KEY_RSHIFT
KEY_LSHIFT
KEY_RCTRL
KEY_LCTRL
KEY_RALT
KEY_LALT
KEY_RMETA
KEY_LMETA
KEY_LWINDOWS
KEY_RWINDOWS
KEY_ALT_GR
KEY_HELP
KEY_PRINT
KEY_SYSREQ
KEY_BREAK
KEY_MENU
KEY_MAC_POWER
KEY_EURO
KEY_POCKET_UP
KEY_POCKET_DOWN
KEY_POCKET_LEFT
KEY_POCKET_RIGHT
KEY_POCKET_A
KEY_POCKET_B
KEY_POCKET_C
KEY_POCKET_START
KEY_POCKET_AUX1
KEY_POCKET_AUX2
KEY_POCKET_AUX3
KEY_POCKET_AUX4
KEY_POCKET_AUX5
KEY_POCKET_AUX6
KEY_POCKET_AUX7
KEY_POCKET_AUX8
KEY_GP2X_BUTTON_UP
KEY_GP2X_BUTTON_DOWN
KEY_GP2X_BUTTON_LEFT
KEY_GP2X_BUTTON_RIGHT
KEY_GP2X_BUTTON_UPLEFT
KEY_GP2X_BUTTON_UPRIGHT
KEY_GP2X_BUTTON_DOWNLEFT
KEY_GP2X_BUTTON_DOWNRIGHT
KEY_GP2X_BUTTON_CLICK
KEY_GP2X_BUTTON_A
KEY_GP2X_BUTTON_B
KEY_GP2X_BUTTON_X
KEY_GP2X_BUTTON_Y
KEY_GP2X_BUTTON_L
KEY_GP2X_BUTTON_R
KEY_GP2X_BUTTON_START
KEY_GP2X_BUTTON_SELECT
KEY_GP2X_BUTTON_VOLUP
KEY_GP2X_BUTTON_VOLDOWN


this isn't an actual code, it's just to keep the size of this post to a minimum
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Keys like [ENTER],[SHIFT]...

Postby BogdansB » Thu Oct 27, 2011 5:08 pm

thank you very much
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest