Product Chat / [SOLVED] Any key for parentheses "(" , ")" in GG lua?

Author
Message
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Sep 2019 02:30 Edited at: 28th Sep 2019 02:40
Many entities on GG has parentheses on their name such "Empty Barrel (Hazard)" or many others.

I've the "scankey" pic, but does not found any key.
I've tried with "GetScancode()" and even with "g_inkey" just in case. New build...

Working on getting user input via lua, and I've got it, the problem comes when user need to type something like example above, user can't type parentheses, and this is a great issue when you need make comparisons, since you need the exact name to work with.

Wonder if this maybe comes because the key combo needed, in parentheses case you would need to press "shift + /" keys. Therefore this is another issue I'm having.

Edit just for adding something I missed.
In standard LUA "io.read()" would work fine on this case, but it looks do not work that fine on GG.

With "io.read()" you can get any key pressed by the user as input, just put something like: answers = io.read() and you are done.
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

The author of this post has marked a post as an answer.

Go to answer
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Sep 2019 03:25
I am going to delete all the characters from the names that are not covered by GG, such as removing all the parentheses from the previous example, in this way they coincide in a comparison or search by name.
Anyway it is still necessary to read the keystroke when keys combination.
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
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 28th Sep 2019 12:01
This post has been marked by the post author as the answer.


Seems to work OK. Cheers.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Sep 2019 12:02
"(" = Shift + 9 on my keyboard so just get the scancode value for 9 and check if the Shift key is also pressed?
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Sep 2019 12:03
Lol, great minds think alike …. fools seldom differ.
Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Sep 2019 23:09
@ Ciber
Nice tip mate, now it works.
I've missed that lua command.

thanks.
Now I've got the user input as I want to work with.
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

Login to post a reply

Server time is: 2024-10-06 22:22:11
Your offset time is: 2024-10-06 22:22:11