PDA

View Full Version : execKeyInt



kung foo man
4th August 2013, 20:41
dunno if it was working, at least i tried back then lol

#include "ui_mp/menudef.h"

#define KEY_ESCAPE 27
#define KEY_BACKSPACE 8

{
menuDef
{
name "bet"
rect 0 0 640 480
style WINDOW_STYLE_EMPTY
focuscolor .2 .2 .2 1

execKeyInt KEY_ESCAPE { scriptMenuResponse "cancel" }
execKeyInt KEY_BACKSPACE { scriptMenuResponse "backspace" }

// scriptMenuResponse not possible in onESC, but it prevents closing
onESC {}
[21:39] IzNoGoD: nofuckway
[21:39] IzNoGoD: fucknice.
[21:39] IzNoGoD: post this on killtube plz ;)
[21:39] kung foo man: first try ^^
[21:39] IzNoGoD: ill try some other time
[21:40] IzNoGoD: dont have login menu atm




Somebody might want to recheck ^^

RobsoN
4th August 2013, 22:07
Doesn't work in my menu :( .

kung foo man
5th August 2013, 00:05
That's what I kinda had in mind, though the ASCII-code was working in general. KEY_ESCAPE worked?


#define KEY_BACKSPACE 8 might be the problem, you can google that constant. Could you try 14 for it?

RobsoN
5th August 2013, 09:13
Wow, ESC works, but Backspace still not.

RobsoN
5th August 2013, 09:28
Tried 08,8,14 for backspace, 10,13 for enter, 32 for backspace, 127 for DEL, nothing work :(

emz
14th August 2013, 14:59
execKey "a" { scriptMenuResponse "a" }
execKey "b" { scriptMenuResponse "b" }
execKey "c" { scriptMenuResponse "c" }
execKey "d" { scriptMenuResponse "d" }
execKey "e" { scriptMenuResponse "e" }
execKey "f" { scriptMenuResponse "f" }
execKey "g" { scriptMenuResponse "g" }
execKey "h" { scriptMenuResponse "h" }
execKey "i" { scriptMenuResponse "i" }
execKey "j" { scriptMenuResponse "j" }
execKey "k" { scriptMenuResponse "k" }
execKey "l" { scriptMenuResponse "l" }
execKey "m" { scriptMenuResponse "m" }
execKey "n" { scriptMenuResponse "n" }
execKey "o" { scriptMenuResponse "o" }
execKey "p" { scriptMenuResponse "p" }
execKey "q" { scriptMenuResponse "q" }
execKey "r" { scriptMenuResponse "r" }
execKey "s" { scriptMenuResponse "s" }
execKey "t" { scriptMenuResponse "t" }
execKey "u" { scriptMenuResponse "u" }
execKey "v" { scriptMenuResponse "v" }
execKey "w" { scriptMenuResponse "w" }
execKey "x" { scriptMenuResponse "x" }
execKey "y" { scriptMenuResponse "y" }
execKey "z" { scriptMenuResponse "z" }
execKey "0" { scriptMenuResponse "0" }
execKey "1" { scriptMenuResponse "1" }
execKey "2" { scriptMenuResponse "2" }
execKey "3" { scriptMenuResponse "3" }
execKey "4" { scriptMenuResponse "4" }
execKey "5" { scriptMenuResponse "5" }
execKey "6" { scriptMenuResponse "6" }
execKey "7" { scriptMenuResponse "7" }
execKey "8" { scriptMenuResponse "8" }
execKey "9" { scriptMenuResponse "9" }
execKey "-" { scriptMenuResponse "-" }
execKey "," { scriptMenuResponse "," }
execKey "." { scriptMenuResponse "." }
execKey "+" { scriptMenuResponse "+" }
execKey "/" { scriptMenuResponse "/" }
execKey "*" { scriptMenuResponse "*" }
execKeyInt 9 { scriptMenuResponse "tab" }
execKeyInt 13 { scriptMenuResponse "enter" }
execKeyInt 27 { scriptMenuResponse "esc" }
execKeyInt 32 { scriptMenuResponse "space" }
execKeyInt 127 { scriptMenuResponse "backSpace" }
execKeyInt 132 { scriptMenuResponse "á" }
execKeyInt 138 { scriptMenuResponse "é" }
execKeyInt 142 { scriptMenuResponse "ó" }
execKeyInt 143 { scriptMenuResponse "ö" }
execKeyInt 146 { scriptMenuResponse "ú" }
execKeyInt 147 { scriptMenuResponse "ü" }
execKeyInt 151 { scriptMenuResponse "capsLock" }
execKeyInt 153 { scriptMenuResponse "pBreak" }
execKeyInt 154 { scriptMenuResponse "up" }
execKeyInt 155 { scriptMenuResponse "down" }
execKeyInt 156 { scriptMenuResponse "left" }
execKeyInt 157 { scriptMenuResponse "right" }
execKeyInt 158 { scriptMenuResponse "alt" }
execKeyInt 159 { scriptMenuResponse "altgrCtrl" }
execKeyInt 160 { scriptMenuResponse "shift" }
execKeyInt 161 { scriptMenuResponse "insert" }
execKeyInt 162 { scriptMenuResponse "delete" }
execKeyInt 163 { scriptMenuResponse "pagedown" }
execKeyInt 164 { scriptMenuResponse "pageup" }
execKeyInt 165 { scriptMenuResponse "home" }
execKeyInt 166 { scriptMenuResponse "end" }
execKeyInt 167 { scriptMenuResponse "f1" }
execKeyInt 168 { scriptMenuResponse "f2" }
execKeyInt 169 { scriptMenuResponse "f3" }
execKeyInt 170 { scriptMenuResponse "f4" }
execKeyInt 171 { scriptMenuResponse "f5" }
execKeyInt 172 { scriptMenuResponse "f6" }
execKeyInt 173 { scriptMenuResponse "f7" }
execKeyInt 174 { scriptMenuResponse "f8" }
execKeyInt 175 { scriptMenuResponse "f9" }
execKeyInt 176 { scriptMenuResponse "f10" }
execKeyInt 177 { scriptMenuResponse "f11" }
execKeyInt 178 { scriptMenuResponse "f12" }
execKeyInt 197 { scriptMenuResponse "numlock" }
execKeyInt 191 { scriptMenuResponse "kp_enter" }
execKeyInt 200 { scriptMenuResponse "mouse1" }
execKeyInt 201 { scriptMenuResponse "mouse2" }
execKeyInt 202 { scriptMenuResponse "mouse3" }
execKeyInt 237 { scriptMenuResponse "í" }
execKeyInt 245 { scriptMenuResponse "ő" }
execKeyInt 251 { scriptMenuResponse "ű" }

kung foo man
14th August 2013, 16:00
execKeyInt 127 { scriptMenuResponse "backSpace" }


Is it tested? Robson just said that he tested 127, but that was for DEL

RobsoN
14th August 2013, 19:19
Thanks u mate, every key is working well!

Mitch
14th August 2013, 20:27
Thanks u mate, every key is working well!

Very nice. Now we can finally use our delete button in menus to delete something (likely text).

Tally
15th August 2013, 09:59
// scriptMenuResponse not possible in onESC, but it prevents closing

Is that correct? I've never played around with using scriptmenresponse in on Esc{} in COD2, but it works in COD4/COD5:


menuDef
{
name "cac_editor"
rect 0 0 640 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
focuscolor COLOR_FOCUSED
style WINDOW_STYLE_EMPTY
blurWorld 7.0
onOpen
{
UPDATE_PERK1;
UPDATE_SECONDARY_PERK1;
setfocus "primary_weapon_selection";
}
onEsc
{
scriptMenuResponse "back";
}


That works in COD4/COD5. I'll have to try experimenting with it in COD2 when I reinstall it (just switched to solid state drives).

kung foo man
15th August 2013, 11:26
Pretty sure with that, though already a year ago or so when I tested that.

Tally
15th August 2013, 11:46
Pretty sure with that, though already a year ago or so when I tested that.

I reinstalled COD2 just to see if this was correct ( that scriptmenuresponse doesn't work in onEsc{} ), and it isn't the case - scriptmenuresponse DOES work in onEsc{}! I did a simple test:

1. I put this in the menu "ingame":


menuDef
{
name "ingame"
rect 0 0 640 480
focuscolor GLOBAL_FOCUSED_COLOR
style WINDOW_STYLE_EMPTY
blurWorld 5.0
onEsc
{
close ingame;
scriptMenuResponse "test";
}


2. Next, I monitored for the menu response "test" in maps\mp\gametypes\_menus.gsc:


for( ;; )
{
self waittill( "menuresponse", menu, response );

if( response == "test" )
{
self iprintlnbold( "test" );
}


3. This was the result after opening the "ingame" menu and hitting the ESC key:

http://www.xfire.com/videos/60c33f

As you can clearly, see, it works fine in onEsc{}.

Para
28th October 2014, 05:08
I added some keys but when I store them into a header file, I can't include it in my menu-file (#include "ui_mp/keydefs.h"). Is it possible to include custom header files?



#define KEY_TAB 9 //HTABULATOR
#define KEY_ENTER 13 //ENTER
#define KEY_ESCAPE 27 //ESCAPE
#define KEY_SPACE 32 //SPACE
#define KEY_SHARP 35 //#'
#define KEY_PLUS 43 //+*~
#define KEY_COMMA 44 //,;
#define KEY_MINUS 45 //-_
#define KEY_DOT 46 //.:
#define KEY_0 48 //0=}
#define KEY_1 49 //1!
#define KEY_2 50 //2"²
#define KEY_3 51 //3§³
#define KEY_4 52 //4$
#define KEY_5 53 //5%
#define KEY_6 54 //6&
#define KEY_7 55 //7/{
#define KEY_8 56 //8([
#define KEY_9 57 //9)]
#define KEY_PIPE 60 //<>|
#define KEY_A 97 //A,a
#define KEY_B 98 //B,b
#define KEY_C 99 //C,c
#define KEY_D 100 //D,d
#define KEY_E 101 //E,e,€
#define KEY_F 102 //F,f
#define KEY_G 103 //G,g
#define KEY_H 104 //H,h
#define KEY_I 105 //I,i
#define KEY_J 106 //J,j
#define KEY_K 107 //K,k
#define KEY_L 108 //L,l
#define KEY_M 109 //M,m,µ
#define KEY_N 110 //N,n
#define KEY_O 111 //O,o
#define KEY_P 112 //P,p
#define KEY_Q 113 //Q,q,@
#define KEY_R 114 //R,r
#define KEY_S 115 //S,s
#define KEY_T 116 //T,t
#define KEY_U 117 //U,u
#define KEY_V 118 //V,v
#define KEY_W 119 //W,w
#define KEY_X 120 //X,x
#define KEY_Y 121 //Y,y
#define KEY_Z 122 //Z,z
#define KEY_BACKSPACE 127 //BACKSPACE
#define KEY_QUESTION 130 //ß?\
#define KEY_AE 133 //Ä,ä
#define KEY_OE 143 //Ö,ö
#define KEY_UE 147 //Ü,ü
#define KEY_CAPSLOCK 151 //CAPSLOCK
#define KEY_PAUSE 153 //PAUSE
#define KEY_UP 154 //UP
#define KEY_DOWN 155 //DOWN
#define KEY_LEFT 156 //LEFT
#define KEY_RIGHT 157 //RIGHT
#define KEY_ALT 158 //ALT
#define KEY_CTRL 159 //CTRL, ALTGR
#define KEY_SHIFT 160 //SHIFT
#define KEY_INS 161 //INSERT
#define KEY_DEL 162 //DELETE
#define KEY_PGDN 163 //PAGEDOWN
#define KEY_PGUP 164 //PAGEUP
#define KEY_HOME 165 //HOME
#define KEY_END 166 //END
#define KEY_F1 167 //F1
#define KEY_F2 168 //F2
#define KEY_F3 169 //F3
#define KEY_F4 170 //F4
#define KEY_F5 171 //F5
#define KEY_F6 172 //F6
#define KEY_F7 173 //F7
#define KEY_F8 174 //F8
#define KEY_F9 175 //F9
#define KEY_F10 176 //F10
#define KEY_F11 177 //F11
#define KEY_F12 178 //F12
#define KEY_ACCENT 180 //´`
#define KEY_KP_HOME 182 //KEYPAD_7_HOME
#define KEY_KP_UP 183 //KEYPAD_8_UP
#define KEY_KP_PGUP 184 //KEYPAD_9_PAGEUP
#define KEY_KP_LEFT 185 //KEYPAD_4_LEFT
#define KEY_KP_5 186 //KEYPAD_5
#define KEY_KP_RIGHT 187 //KEYPAD_6_RIGHT
#define KEY_KP_END 188 //KEYPAD_1_END
#define KEY_KP_DOWN 189 //KEYPAD_2_DOWN
#define KEY_KP_PGDN 190 //KEYPAD_3_PAGEDOWN
#define KEY_KP_ENTER 191 //KEYPAD_ENTER
#define KEY_KP_INS 192 //KEYPAD_0_INSERT
#define KEY_KP_DEL 193 //KEYPAD_DEL
#define KEY_KP_SLASH 194 //KEYPAD_DIV
#define KEY_KP_MINUS 195 //KEYPAD_MIN
#define KEY_KP_PLUS 196 //KEYPAD_PLUS
#define KEY_KP_NUMLOCK 197 //KEYPAD_NUMLOCK
#define KEY_KP_STAR 198 //KEYPAD_MUL
#define KEY_MOUSE1 200 //MOUSE_LEFT
#define KEY_MOUSE2 201 //MOUSE_RIGHT
#define KEY_MOUSE3 202 //MOUSE_WHEEL
#define KEY_MOUSE4 203 //MOUSE_SIDE_1
#define KEY_MOUSE5 204 //MOUSE_SIDE_2


When I read mp.exe, I've found some weird keys. Where are those keys supposed to be on the keyboard? (KEY_AUXx, KEY_COMMAND, KEY_KP_EQUALS...) KEY_MWHEELDOWN and KEY_MWHEELUP don't work for execKeyInt (at least not with my mouse).


KEY_COMMAND KEY_SEMICOLON KEY_PAUSE KEY_KP_EQUALS KEY_KP_STAR KEY_KP_NUMLOCK KEY_KP_PLUS KEY_KP_MINUS KEY_KP_SLASH KEY_KP_DEL KEY_KP_INS KEY_KP_ENTER KEY_KP_PGDN KEY_KP_DOWNARROW KEY_KP_END KEY_KP_RIGHTARROW KEY_KP_5 KEY_KP_LEFTARROW KEY_KP_PGUP KEY_KP_UPARROW KEY_KP_HOME KEY_AUX16 KEY_AUX15 KEY_AUX14 KEY_AUX13 KEY_AUX12 KEY_AUX11 KEY_AUX10 KEY_AUX9 KEY_AUX8 KEY_AUX7 KEY_AUX6 KEY_AUX5 KEY_AUX4 KEY_AUX3 KEY_AUX2 KEY_AUX1 KEY_MWHEELDOWN KEY_MWHEELUP KEY_MOUSE5 KEY_MOUSE4 KEY_MOUSE3 KEY_MOUSE2 KEY_MOUSE1 KEY_END KEY_HOME KEY_PGUP KEY_PGDN KEY_DEL KEY_INS KEY_F12 KEY_F11 KEY_F10 KEY_F9 KEY_F8 KEY_F7 KEY_F6 KEY_F5 KEY_F4 KEY_F3 KEY_F2 KEY_F1 KEY_CAPSLOCK KEY_SHIFT KEY_CTRL KEY_ALT KEY_RIGHTARROW KEY_LEFTARROW KEY_DOWNARROW KEY_UPARROW KEY_BACKSPACE KEY_SPACE KEY_ESCAPE KEY_ENTER KEY_TAB 252 250 249 248 246 243 242 241 236 233 232 231 230 229 228 225 224 223 191 181 COMMAND SEMICOLON PAUSE KP_EQUALS KP_STAR KP_NUMLOCK KP_PLUS KP_MINUS KP_SLASH KP_DEL KP_INS KP_ENTER KP_PGDN KP_DOWNARROW KP_END KP_RIGHTARROW KP_5 KP_LEFTARROW KP_PGUP KP_UPARROW KP_HOME AUX16 AUX15 AUX14 AUX13 AUX12 AUX11 AUX10 AUX9 AUX8 AUX7 AUX6 AUX5 AUX4 AUX3 AUX2 AUX1 MWHEELDOWN MWHEELUP MOUSE5 MOUSE4 MOUSE3 MOUSE2 MOUSE1 END HOME PGUP PGDN DEL INS F12 F11 F10 F9 F8 F7 F6 F5 F4 F3 F2 F1 CAPSLOCK SHIFT CTRL ALT RIGHTARROW LEFTARROW DOWNARROW UPARROW BACKSPACE SPACE ESCAPE ENTER TAB

Tally
28th October 2014, 09:21
Is it possible to include custom header files?

No, you can't add your own header files. The header file has to be compiled at source in order to be read.