Scripts / Detect, Turn Capslock on or off in lua

Author
Message
hiredgunz48
8
Years of Service
User Offline
Joined: 9th Sep 2015
Location: Seattle, Washington
Posted: 4th Nov 2015 13:15
Well, ran into a capslock issue. I can make the player's key entry a lowercase and check then, but I was wondering if anyone's come up with a way to detect if the capslock is already on and turn it off through scripting?

If not, I'll just have to change all the player's keypresses to lowercase i guess, and there is a lot change ... Yep, I'm being lazy

Thanks,

Jan

Windows 10 64bit, Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz, 3301 Mhz, 4 Core(s), NVIDIA GeForce GTX 960 2 gig GDDR5, 16 gigs ram
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 4th Nov 2015 13:41
Here you go your lazyness. (lol)

You can in the setup.ini file change the flag fulldebugview=0 to fulldebugview=1

What this should do is show you the values for keystroke combinations from your keyboard. This should yield the results you are looking for.

Change the setting while GameGuru is closed down. also when done with it, you should turn it back off.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

hiredgunz48
8
Years of Service
User Offline
Joined: 9th Sep 2015
Location: Seattle, Washington
Posted: 4th Nov 2015 15:25 Edited at: 4th Nov 2015 15:29
lol, thanks myke! coool, a new toy to play with! But, will this detect capslock on in testmode and/or standalone? I've already found nothing that can detect the capslock state (On or Off).. current key detection functions only show a zero until the capslock key is pressed (even if it's already "On"), and then shows 58, which is useless as I want to turn off the capslock key if it's detected "On" while in testing or standalone mode. Sorry if I wasn't clear.

As you know, none of the "press [e] to continue" prompts work if the capslock state is "On" unless you stuff the keypress into a variable and convert the string to lowercase ( at least in test mode. Haven't tried standalone yet)... Since I've already got about 32 dialog scripts done, I just didn't want to manually change them all and instead notify the player before they get the first convo from AI.

I guess I could just make some regex and do a mass search and replace to lowercase all inputs with phped if there's no other solution... still gonna have to check throughout the game in case someone hits the capslock key along with the shift, now that I think about it. Oh well, it's gonna be "a four letter word" (work) no matter what, so thanks anyway Myke. later!
Windows 10 64bit, Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz, 3301 Mhz, 4 Core(s), NVIDIA GeForce GTX 960 2 gig GDDR5, 16 gigs ram
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 4th Nov 2015 17:01
Perhaps this might help a bit:

http://www.strokesplus.com/forum/topic/599/small-annoyance-capslock-sensitive

3com
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

PM
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 4th Nov 2015 17:06 Edited at: 4th Nov 2015 17:09
I think this one might work.

http://www.theasciicode.com.ar/ascii-control-characters/shift-in-ascii-code-15.html

If not, let me ask the programmers if they are polling those keys, in Game Guru yet.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 4th Nov 2015 17:35
Programmer says we can get this code using this command in LUA.

GetInkey

This is it in the global.lua file


Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Nov 2015 18:32 Edited at: 4th Nov 2015 18:33
i would convert to GetScancode()
yes it's a bit of a pain to change them all over now as you have already coded them but it's easier than checking both upper and lower case as the code will return the same number for both.

i had actually already started doing this myself when i remembered due to that very same realisation

p.s. the codes can be found here
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
hiredgunz48
8
Years of Service
User Offline
Joined: 9th Sep 2015
Location: Seattle, Washington
Posted: 5th Nov 2015 02:22 Edited at: 5th Nov 2015 02:28
@3com.. thanks, I tried a variation of that code and it crashed Gameguru, but I will try your link's code out. Appreciate the link.

@Myke.. About the most awesome ASCII tables I've ever seen, thanks Yes, GetInKey() does well at getting a keypress input, but it doesn't detect the keypress until it actually is pressed. So, if someone's capslock in "On" before they start the test mode or standalone, it will report a "0". Or, if someone accidentally hits both the shift and caplock keys while playing and gets an "e" Prompt, only the "e" Prompt will be detected but not work if it's a capitol "E" instead. I need a state of the capslock key before and during gameplay, and to either tell the player or turn it of by script.

@smallg.. Thanks for the suggestion. That is a better idea than the additional and repeated lowercase string conversions, then input check. That both satisfies my laziness, AND reduces the game's workload!

Thanks again everyone
Windows 10 64bit, Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz, 3301 Mhz, 4 Core(s), NVIDIA GeForce GTX 960 2 gig GDDR5, 16 gigs ram
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 5th Nov 2015 03:15
Cool, glad I could assist a bit.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

hiredgunz48
8
Years of Service
User Offline
Joined: 9th Sep 2015
Location: Seattle, Washington
Posted: 5th Nov 2015 14:29
y'all always are helpful and why I keep coming back for assistance
Windows 10 64bit, Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz, 3301 Mhz, 4 Core(s), NVIDIA GeForce GTX 960 2 gig GDDR5, 16 gigs ram

Login to post a reply

Server time is: 2024-05-05 00:23:33
Your offset time is: 2024-05-05 00:23:33