Key Mappings in 1.02

Freeform discussion about anything related to modding Transcendence.
Post Reply
george moromisato
Developer
Developer
Posts: 2979
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Sat Jul 31, 2010 5:43 pm

If you look at Settings.xml you can see that there is a mapping table between keys and commands.

You can map any single key to any command (you can map multiple keys to the same command, but not a single key to multiple commands).

Currently, the full list of supported commands is the in the Settings.xml file.

To specify a key, you can always use the hexadecimal representation for the virtual key code passed in wParam of WM_KEYDOWN (http://msdn.microsoft.com/en-us/library ... S.85).aspx)

Or you can use one of the following key names:

Code: Select all

"Backspace"
"Tab"
"Clear"
"Return"
"Shift"
"Control"
"Menu"
"Pause"
"Capital"
"Kana"
"Junja"
"Final"
"Kanji"
"Escape"
"Convert"
"NonConvert"
"Accept"
"ModeChange"
"Space"
"PageUp"
"PageDown"
"End"
"Home"
"Left"
"Up"
"Right"
"Down"
"Select"
"Print"
"Execute"
"Snapshot"
"Insert"
"Delete"
"Help"
"0"
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
"A"
"B"
"C"
"D"
"E"
"F"
"G"
"H"
"I"
"J"
"K"
"L"
"M"
"N"
"O"
"P"
"Q"
"R"
"S"
"T"
"U"
"V"
"W"
"X"
"Y"
"Z"
"LWindows"
"RWindows"
"Apps"
"Sleep"
"Numpad0"
"Numpad1"
"Numpad2"
"Numpad3"
"Numpad4"
"Numpad5"
"Numpad6"
"Numpad7"
"Numpad8"
"Numpad9"
"NumpadStar"
"NumpadPlus"
"NumpadSeparator"
"NumpadMinus"
"NumpadPeriod"
"NumpadSlash"
"F1"
"F2"
"F3"
"F4"
"F5"
"F6"
"F7"
"F8"
"F9"
"F10"
"F11"
"F12"
"F13"
"F14"
"F15"
"F16"
"F17"
"F18"
"F19"
"F20"
"F21"
"F22"
"F23"
"F24"
"NumLock"
"ScrollLock"
"FJ_Jisho"
"FJ_Masshou"
"FJ_Touroku"
"FJ_Loya"
"FJ_Roya"
"BrowserBack"
"BrowserForward"
"BrowserRefresh"
"BrowserStop"
"BrowserSearch"
"BrowserFavorites"
"BrowserHome"
"VolumeMute"
"VolumeDown"
"VolumeUp"
"MediaNext"
"MediaPrev"
"MediaStop"
"MediaPlay"
"LaunchMail"
"LaunchMediaSelect"
"LaunchApp1"
"LaunchApp2"
"SemiColon"
"Equal"
"Comma"
"Minus"
"Period"
"Slash"
Note: Many of the above key names refer to non-English keyboards, so they may not work for you. You will have to do some experimenting.

I'd appreciate it if someone could put this information on the Wiki.[/url]

User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Sun Aug 01, 2010 12:08 am

I see there will be ToggleEnableDevice00 through ToggleEnableDevice32 soon. I was wondering if we could do that with invoking items also. That way we could tie script with a key.

A separate idea when invoking an item with a key it could be tied to multiple keys. Would it be possible to tell in script what key was used?
Crying is not a proper retort!

george moromisato
Developer
Developer
Posts: 2979
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Sun Aug 01, 2010 5:32 pm

Yes, I want to do that--though it wont make it for 1.03.

I think it will have to be done as follows:

1. A mod will define a new "command" (by name) and add some code to it. When the command is invoked, the code is run (which could then invoke an item). Each command name must be unique (with respect to other mods), or the mod won't load.

2. A mod can request a binding between a command and a key. But if two mods request the same key, then the game will arbitrarily assign a different key to one of the mods.

3. The help system will have to show the new commands and the bindings. Plus we need functions to request the list of custom commands and their bindings.

4. A user can override the above by binding any command to any key using the normal method.

As you can see, this is not entirely trivial, so it may take a while. If anyone can think of a simpler scheme that would still be useful, I'd love to hear it.

User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Sun Aug 01, 2010 6:27 pm

What about mangling command names to avoid conflicts?

Suppose two mods define a command "dostuff" one has the mod UNID DEF012300 and the other EF012300. They could then be differentiated in the configuration file as "DEF012300_dostuff" and "EF012300_dostuff".

User avatar
Ttech
Fleet Admiral
Fleet Admiral
Posts: 2756
Joined: Tue Nov 06, 2007 12:03 am
Location: Traveling in the TARDIS
Contact:

Sun Aug 01, 2010 7:17 pm

Atarlost wrote:What about mangling command names to avoid conflicts?

Suppose two mods define a command "dostuff" one has the mod UNID DEF012300 and the other EF012300. They could then be differentiated in the configuration file as "DEF012300_dostuff" and "EF012300_dostuff".
what a modname? instead of modying unid
Image
Image

*** AWAY ON SABBATICAL ***
** USE EMAIL TO CONTACT ME **

User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Sun Aug 01, 2010 7:37 pm

I think having a mod "request" a binding is unnecessary. It should be enough that the user can simply define this binding himself. The mod should provide a readme that states high and clear that it provides a command that can be bound to an arbitrary keyof the users choice. What if the mod requests a key that I have already usedin my settings. Then we will have to deal with clobbering issues there also, ending up with the mods command on an entirely different key, defeating the purpose of defining one in the first place.

I say, YAGNI and KISS should prevail here. :)

User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Sun Aug 01, 2010 8:22 pm

Ttech wrote:
Atarlost wrote:What about mangling command names to avoid conflicts?

Suppose two mods define a command "dostuff" one has the mod UNID DEF012300 and the other EF012300. They could then be differentiated in the configuration file as "DEF012300_dostuff" and "EF012300_dostuff".
what a modname? instead of modying unid
Mod's always have UNIDs. They don't always have names.
alterecco wrote:I think having a mod "request" a binding is unnecessary. It should be enough that the user can simply define this binding himself. The mod should provide a readme that states high and clear that it provides a command that can be bound to an arbitrary keyof the users choice. What if the mod requests a key that I have already usedin my settings. Then we will have to deal with clobbering issues there also, ending up with the mods command on an entirely different key, defeating the purpose of defining one in the first place.

I say, YAGNI and KISS should prevail here. :)
Default keybindings are needed in order to support adventure extensions, which, being exclusive, can use interfering key assignments.

User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Sun Aug 01, 2010 8:45 pm

Atarlost wrote: Default keybindings are needed in order to support adventure extensions, which, being exclusive, can use interfering key assignments.
I fail to see why adventure extensions should require keybindings. Being mods that are downloaded and placed in the Extensions folder they fall under the same rules as any other mod. It is up the the player to make sure he does not willfully break the adventure mod, and if it provides any particular commands, he could/should bind these in his settings.xml. That could easily be stated in a readme, and would not require mucking about with handling keys clobbering other (which can not be handled very good in any case).

User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Sun Aug 01, 2010 9:03 pm

alterecco wrote:
Atarlost wrote: Default keybindings are needed in order to support adventure extensions, which, being exclusive, can use interfering key assignments.
I fail to see why adventure extensions should require keybindings. Being mods that are downloaded and placed in the Extensions folder they fall under the same rules as any other mod. It is up the the player to make sure he does not willfully break the adventure mod, and if it provides any particular commands, he could/should bind these in his settings.xml. That could easily be stated in a readme, and would not require mucking about with handling keys clobbering other (which can not be handled very good in any case).
You cannot expect users to be capable of hand editing even a simple configuration file.

george moromisato
Developer
Developer
Posts: 2979
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Sun Aug 01, 2010 9:04 pm

alterecco wrote:That could easily be stated in a readme, and would not require mucking about with handling keys clobbering other (which can not be handled very good in any case).
I agree that this might be a short-term solution, but I don't want to force users to have to map keys before they can even play a game.

I will definitely start simple: for example, add the custom key bindings before connecting them to the help system (which has its own set of complexity).

User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Sun Aug 01, 2010 9:09 pm

Atarlost wrote: You cannot expect users to be capable of hand editing even a simple configuration file.
I think users are more capable, and at least more motivated than you think. But sure, there will be some that will have problems with it, probably the same amount that will have problems because the keybinding that was "F1" in their last game is "Alt+F1" in this one, and all they did was add a mod?!? The first problem is clear and easy to diagnose and fix, the second problem much less so.

User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Wed Sep 01, 2010 1:48 am

random thought will the custom commands be able to still use the old function of the key? So we can piggy back onto the old function (and maybe even disallow it if needed)
Crying is not a proper retort!

User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Fri Nov 26, 2010 8:08 pm

After some delay, it is now on our wiki, on the page that collects tidbits we don't know what else to do with (at lest tidbits I don't know what to do with)

http://wiki.neurohack.com/transcendence ... rom_george

Post Reply