Keyboard numpad help

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
Argonaught
Poor
Poor
Posts: 4
Joined: Wed Jul 02, 2008 10:11 am

Keyboard numpad help

Post by Argonaught »

Hello,

I've googled for the values for the keyboard numpad in order for me to move all flight controls to the numpad for easier flying. However I can't seem to find the codes i need..all i'm finding are the codes to make symbols.

If anyone has the decimal codes for pc numpad it would be greatly appreciated if you could post them here.

Thanks in advance,

Argonaught.
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

I thought the point of the num pad was that with NUM-LOCK on there wasn't any difference in the code for '5' on the num pad and '5' on the top line. Could be wrong (often am).
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

not sure if it will work, but on my windows Vista the values are, i even had to write a little program to find out...


With Numlock set to off they are

Numpad 9:....73
Numpad 8:....72
Numpad 7:....71
Numpad 6:....77
Numpad 5:.... Does not respond to ordinary keypress with numlock off
Numpad 4.....75
Numpad 3:... 81
Numpad 2:.... 80
Numpad 1:.... 79
numpad 0:.... 82

With numlock on the corrorsponding values are like the ones for 1 to 9

However i know that Oolite will treat the arrow keys on the numpad like arrowkeys even if numlock is on...

so i´m not exactly sure what you want as the arrow keys on the numpad should allready work...
Bounty Scanner
Number 935
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

NUMLOCK Off Keypad 5 doesn't have any other function (i.e. 3 = PgDn) that's why it doesn't respond/produce an ASCII value - which is kinda what I said in my previous posting.
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
Argonaught
Poor
Poor
Posts: 4
Joined: Wed Jul 02, 2008 10:11 am

Post by Argonaught »

I found the hex values and converted them using the hex/dec calc linked to in the wiki and set them out as follows:

key_roll_left = 102; // numpad 6
key_roll_right = 100; // numpad 4
key_pitch_forward = 104; // numpad 8
key_pitch_back = 101; // numpad 5
key_yaw_left = 103; // numpad 7
key_yaw_right = 105; // numpad 9

When trying this numpads 8,4 & 6 work as intended but the yaw keys don't do anything and back pitch binds to numpad 2, had figured I messed up somewhere or other files were stealing some of the flight keys back. Or it maybe that numpad settings are'nt really supported in oolite.

Having the flight keys all bunched together in a setup away from the main keyboard key would be cool and I could also then add targetting or missiles etc to numpads 1,2 & 3 .

Maybe it's not to be...thanks for the replies thouigh :)

Argonaught
User avatar
JohnnyBoy
---- E L I T E ----
---- E L I T E ----
Posts: 490
Joined: Mon May 05, 2008 9:41 pm
Location: West Sussex, UK (rich agricultural)

Post by JohnnyBoy »

Argonaught wrote:
Maybe it's not to be...thanks for the replies thouigh :)
I think that moving flight controls to the num pad is a great idea, but I'm a bit lost here Argonaught...

Did you want 'pitch back' bound to the '5' key or the '2' key? Which one couldn't you get to work?
"That's no vicious Treeoid. That's my wife."
Argonaught
Poor
Poor
Posts: 4
Joined: Wed Jul 02, 2008 10:11 am

Post by Argonaught »

JohnnyBoy wrote:
Argonaught wrote:
Maybe it's not to be...thanks for the replies thouigh :)
I think that moving flight controls to the num pad is a great idea, but I'm a bit lost here Argonaught...

Did you want 'pitch back' bound to the '5' key or the '2' key? Which one couldn't you get to work?
I wanted it bound to key '5' but it always ends up binding to key '2'. Afaik I have the correct values according to the calc converter. It's abit weird.

Here's a link to where I found the hex values, halfway down the page shows numpad values:

http://api.farmanager.com/en/winapi/vir ... codes.html

I then used the suggested hex/dec converter on the wiki to change the values.

Late here so off to sleep will check back in morning though.

Thanks :)

Argonaught
Last edited by Argonaught on Thu Jul 03, 2008 3:50 pm, edited 2 times in total.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

i´m sry to write, that those keycodes are for when you are writing a windows API program. you cant use them any other way.

you use it in c++ code like this...

Code: Select all

//c++ code example

if (keys[VK_RIGHT])
				{
					GLcy+=j;
				}
so you cant use the values for Anything.. while they do corrorspond nicely to the ASCII table... however for the arrow keys.. these are special case..

looking at oolites keyconfig.plist..

i can see this..

Code: Select all

	key_roll_left				= 253;		// left arrow
	key_roll_right				= 252;		// right arrow
	key_pitch_forward			= 255;		// up arrow
	key_pitch_back				= 254;		// down arrow
So i`m looking into the code to see if a can get anything in regard to the arrow keys

Code: Select all

enum GameViewKeys
{
	gvArrowKeyUp = 255,
	gvArrowKeyDown = 254,
	gvArrowKeyLeft = 253,
	gvArrowKeyRight = 252,
	gvFunctionKey1 = 241,
	gvFunctionKey2 = 242,
	gvFunctionKey3 = 243,
	gvFunctionKey4 = 244,
	gvFunctionKey5 = 245,
	gvFunctionKey6 = 246,
	gvFunctionKey7 = 247,
	gvFunctionKey8 = 248,
	gvFunctionKey9 = 249,
	gvFunctionKey10 = 250,
	gvFunctionKey11 = 251,
	gvMouseLeftButton = 301,
	gvMouseDoubleClick = 303,
	gvHomeKey = 302,
	gvNumberKey0 = 48,
	gvNumberKey1 = 49,
	gvNumberKey2 = 50,
	gvNumberKey3 = 51,
	gvNumberKey4 = 52,
	gvNumberKey5 = 53,
	gvNumberKey6 = 54,
	gvNumberKey7 = 55,
	gvNumberKey8 = 56,
	gvNumberKey9 = 57
};
I tried looking for the values for Cocoa , but i cant find any documentation on if numpad 5 would have any specific value...

Anyone here more abled with Cocoa which is not my field might know more....
Bounty Scanner
Number 935
Argonaught
Poor
Poor
Posts: 4
Joined: Wed Jul 02, 2008 10:11 am

Post by Argonaught »

Ah..well I should have said before that I am not a coder/programmer so api doesn't mean much to me :S.
I thought I had found the true key vals.
I can tinker and follow instructions for altering params for progs no problem and sometimes while tweaking I even learn a thing or 2.

Don't go out of your way to find this, I had though it a simple thing, I can relearn to fly oolite as I had to learn in the early days with elite :)

Thanks for making the effort though, is much appreciated :)

Argonaught
Post Reply