Product Chat / 2 Keys Pressed simultaneously - (Any)?

Author
Message
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 9th Jun 2020 23:43
Hey great forum crew! I have a request for help!
I'm working on a game that looks for to allow for any 2 keys on the keyboard to be
pressed simultaneously.
That is-- any 2 keys of the keyboard to be used at the same time! Thanks so much for the help. On top of the g_Scancode I found in global;

g_KeyPressE = 0
g_KeyPressQ = 0
g_KeyPressW = 0
g_KeyPressA = 0
g_KeyPressS = 0
g_KeyPressD = 0
g_KeyPressR = 0
g_KeyPressF = 0
g_KeyPressC = 0
g_KeyPressJ = 0


g_PlrKeyW = 0
g_PlrKeyA = 0
g_PlrKeyS = 0
g_PlrKeyD = 0
g_PlrKeyQ = 0
g_PlrKeyE = 0
g_PlrKeyF = 0
g_PlrKeyC = 0
g_PlrKeyZ = 0
g_PlrKeyR = 0
g_PlrKeyJ = 0

This is less than half the keyboard keys!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Jun 2020 00:06 Edited at: 10th Jun 2020 00:07
No can do unfortunately, the g_KeyPress variables will work, i.e. you can tell if E and R are pressed at the same time, also whether Shift or Ctrl are pressed but Scancode only reports a single key.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 10th Jun 2020 04:07 Edited at: 10th Jun 2020 04:12
Thanks AM - but to add the rest of the keys would be difficult??
===================================================================

If GG would let me into the engine code, and I was able to interpret it--
I would be happy to add the rest of the keys.

Basically it seems like a copy and past (+add a letter) would do the trick?!
15 minutes? -- after the technique was acquired!
PM
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 10th Jun 2020 08:44 Edited at: 10th Jun 2020 08:45
You only need the GetKeyState(key) command.


The command returns 1 if pressed and 0 if not pressed.
No need to change the source.

Here is a list of the scancodes:
Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 10th Jun 2020 18:36
Oh man! Look at that. Just perfect- it's hidden in there, (put this at the top of Global!)
but it's a perfect solution! Thanks Corno_1 All kinds of stuff hidden in there it seems.

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Jun 2020 19:04
Slight word of warning though, scancodes are not the same on all keyboards!
Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 10th Jun 2020 23:51
it works for me too.

Quote: "Slight word of warning though, scancodes are not the same on all keyboards! "

bad news if so, specially on standalone builds.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 11th Jun 2020 10:40
Quote: "bad news if so, specially on standalone builds."

Not so bad. Concentrate on the letters and number keys (above) and you are fine most of the time.
They not differ that much. The other keys can be different from country to country.

I always recommend the green keys in this picture and I never had a problem:
Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download
PM
Monkey Frog
4
Years of Service
User Offline
Joined: 5th Feb 2020
Location:
Posted: 11th Jun 2020 13:35
Quote: "Not so bad. Concentrate on the letters and number keys (above) and you are fine most of the time.
They not differ that much."


Except there are non-QWERTY keyboards, too. So, not all the letters are in the same place for all keyboards.
Intel i7-5820K 3.30GHz (overclocked to 4.6 GHz), 128 GB RAM, Nvidia GTX 1080 ti 8GB, Windows 10 64-bit, dual monitor display
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 11th Jun 2020 15:27
this is the keyboard map i put in Asset Manager if it helps

Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-9700K @4.2GHz - 32GB DDR4 RAM - GeForce RTX 2070 SUPER 8GB - 1TB NVe SSD 2TB Hybrid Data Drive
Test PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Laptop - Helios 300 Predator - i7 7700HQ - 32GB - Nvidia GTX1060 6GB - 525GB M2 - 500 SSD - 17.3" IPS LED Panel - Windows 10 Pro x64
Various Tutorials by me
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 11th Jun 2020 18:42
Best way around any issues is to make a define keys option That way the scancode of any device will be able to work
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.

Login to post a reply

Server time is: 2024-11-23 18:18:11
Your offset time is: 2024-11-23 18:18:11