SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH4 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 07-31-07, 11:35 AM   #1
panthercules
The Old Man
 
Join Date: Apr 2005
Posts: 1,336
Downloads: 6
Uploads: 0
Default [TEC] Tutorial for mapping commands to keys?

I know there's got to be one out there somewhere, but I couldn't find it when I searched so I hope someone can point me to it here. There are lots of commands listed in the command.cfg file that don't seem to have keys mapped to them, and I'd like to map a few to be able to use them with voice recognition.

Can someone point out how to go about mapping some of these commands to keys? (such as the following one, for example):

[Cmd152]
Name=Propulsion_recharge
Ctxt=1
MnID=0x3F0F0002
__________________
panthercules is offline   Reply With Quote
Old 07-31-07, 01:34 PM   #2
CaptainCox
Sea Lord
 
Join Date: Feb 2007
Location: A Swede in Frankfurt am Main
Posts: 1,897
Downloads: 4
Uploads: 0
Default

This is a pretty good tut
http://www.subsim.com/radioroom/showthread.php?t=113354

and this written by myself :p (example of adding the "weather report button")
http://www.subsim.com/radioroom/showthread.php?t=118548

Then you need to do the graphics of the button if you want to do it properly
All the buttons are found here
Quote:
C:\Program Files\Ubisoft\Silent Hunter 4 Wolves of the Pacific\Data\Menu\Gui\Layout
Called
Quote:
Hud.dds
__________________
CaptainCox is offline   Reply With Quote
Old 07-31-07, 08:38 PM   #3
panthercules
The Old Man
 
Join Date: Apr 2005
Posts: 1,336
Downloads: 6
Uploads: 0
Default

Capt - thanks for the response and the links to the buttons tutorials.

Unfortunately, I must not have been clear enough - I'm not looking to make new buttons at all here. Just looking to be able to assign some commands to keys (so I can then use the speech recognition program that works by recognizing a spoken command and outputting a key stroke signal). In my example above, I was looking to be able to assign a key to toggle "recharge batteries", so I could speak a command to do that instead of having to push the button for it.

I know it's fairly easy to re-assign keys for game commands that have already been assigned to keys (e.g., changing "fire" to be "Ctrl+Enter" instead of just "Enter"), but I'm not sure how to do it for a command that hasn't been assigned to a key in the first place.

Any ideas?
__________________
panthercules is offline   Reply With Quote
Old 07-31-07, 09:02 PM   #4
DirtyHarry3033
Weps
 
Join Date: Aug 2005
Posts: 351
Downloads: 0
Uploads: 0
Default

Panthercules, do this:

1) Download and install SetKeys 1.11 for SH3, it's in the download section here at subsim.

2) Make a copy of your commands.cfg file somewhere else on your drive. That is important, you don't want to edit your real commands.cfg with SetKeys as there are some keys it will break in SH4 (it was written for SH3...)

3) Point SetKeys to the copy you made. Locate the commands you want and assign keys to them, then save the file.

4) Open up your edited copy in Notepad or your favorite editor, and open the real commands.cfg in another session of your editor.

5) Locate and copy/paste the commands you changed in the copied/edited commands.cfg into the real commands.cfg. Then save and enjoy!

Of course, back up your live commands.cfg 1st in case something goes wrong I've done a number of keymappings this way and it works great!

HTH!

DH
DirtyHarry3033 is offline   Reply With Quote
Old 07-31-07, 09:49 PM   #5
Fearless
Ace of the Deep
 
Join Date: Feb 2007
Location: Adelaide, Australia
Posts: 1,047
Downloads: 340
Uploads: 1
Default

I for one go into the Commands.cfg and look for key commands that have been disabled with the ; then
I check to make sure that key hasn't been re-allocated to some other command.
If it hasn't, I copy that key command line and paste it where I want to activate a particular command.

Eg,

[Cmd152]
Name=Propulsion_recharge
Ctxt=1
MnID=0x3F0F0002
SetKey=0x34D,,"T"

At work now so can't fully remember what the key= line looks like but is similar to that I think.
__________________
Fearless

System Specs: AMD Ryzen 7 5800X 8 Core 16 Thread CPU, 3.8GHz Base Clock, 4.7GHz Boost, 105W TDP, 32MB L3 cache | MSI GeForce RTX3060Ti 8Gb Graphics | Corsair Vengeance RGB Pro 32Gb (2x16Gb) 3200 MHz CL16 DDR4 Ram | Samsung 970 Evo Plus NVMe SSD 1TB | Seagate Barracuda 2.5in 2TB HDD | AOC QHD 165 Hz FreeSync HDR curved 31.5in Monitor | ASUS ROG Strix LC 240 ARGB AIO Liquid CPU Cooler White Edition | ASUS ROG Strix Gold 750W Modular Power Supply | Corsair iCUE 5000X RGB Tempered Glass Mid Tower Case White.

Last edited by Fearless; 07-31-07 at 11:41 PM.
Fearless is offline   Reply With Quote
Old 07-31-07, 10:06 PM   #6
DirtyHarry3033
Weps
 
Join Date: Aug 2005
Posts: 351
Downloads: 0
Uploads: 0
Default

That's the cool thing about SetKeys, it will tell you if there's a conflict with the key you picked. Also it gives the right hex-code for the key and the right syntax, so it is a no-brainer for a brain-dead moron like me :rotfl:

Only prob is, as I mentioned, if you edit the live SH4 commands.cfg with it, some keys get broken. Two that I noticed were, gramophone and radio. Neither keys nor buttons would work. But if you edit a copy of commands.cfg and then just paste in only the changed commands to the live file, it's no problem at all. Nothing breaks and you don't have to worry about hex codes or syntax!

DH
DirtyHarry3033 is offline   Reply With Quote
Old 07-31-07, 10:18 PM   #7
Payoff
Captain
 
Join Date: Mar 2005
Location: Nash Town, USA
Posts: 525
Downloads: 1
Uploads: 0
Default

Quote:
Originally Posted by DirtyHarry3033
That's the cool thing about SetKeys, it will tell you if there's a conflict with the key you picked. Also it gives the right hex-code for the key and the right syntax, so it is a no-brainer for a brain-dead moron like me :rotfl:

Only prob is, as I mentioned, if you edit the live SH4 commands.cfg with it, some keys get broken. Two that I noticed were, gramophone and radio. Neither keys nor buttons would work. But if you edit a copy of commands.cfg and then just paste in only the changed commands to the live file, it's no problem at all. Nothing breaks and you don't have to worry about hex codes or syntax!

DH
I was never able to get SetKeys to work for me with SHIII. I know what you mean about editing the commands.cfg and breaking commands. I got so fed up with this I went through the entire file and deleted every command that had been remarked out (and there were a bunch of them). After cleaning up the file like that, I can edit at will now without losing a single command.
__________________
"Hit Shokaku class carrier with three out of six torpedos. Recieved 105 depth charges during three hour period. Heard four terrific explosions in the direction of target, two and one half hours after attack. Believe that baby sank!" Lieutenant Commander Herman Kossler USS Cavalla

Last edited by Payoff; 07-31-07 at 10:33 PM.
Payoff is offline   Reply With Quote
Old 07-31-07, 11:34 PM   #8
panthercules
The Old Man
 
Join Date: Apr 2005
Posts: 1,336
Downloads: 6
Uploads: 0
Default

Quote:
Originally Posted by Fearless
I for one go into the Commands.cfg and look for key commands that have been disabled with the ; then
I check to make sure that key hasn't been re-allocated to some other command.
If it hasn't, I copy that key command line and paste it where I want to activate a particular command.
Problem I have is with the commands where there just isn't any key line (disabled or otherwise), like the one below:
[Cmd152]
Name=Propulsion_recharge
Ctxt=1
MnID=0x3F0F0002
Does the SetKeys thing work for those kinds of commands which never had key lines? If so, guess I'll give that setkeys thing a try - I remember seeing some posts about it during the SH3 days, but I never messed with it so this will be another adventure

Thanks for the tips on how to protect my real file - I suspect that will prove to be very sage advice
__________________
panthercules is offline   Reply With Quote
Old 07-31-07, 11:53 PM   #9
Fearless
Ace of the Deep
 
Join Date: Feb 2007
Location: Adelaide, Australia
Posts: 1,047
Downloads: 340
Uploads: 1
Default

Quote:
Originally Posted by panthercules
Problem I have is with the commands where there just isn't any key line (disabled or otherwise), like the one below:
[Cmd152]
Name=Propulsion_recharge
Ctxt=1
MnID=0x3F0F0002







Does the SetKeys thing work for those kinds of commands which never had key lines? If so, guess I'll give that setkeys thing a try - I remember seeing some posts about it during the SH3 days, but I never messed with it so this will be another adventure

Thanks for the tips on how to protect my real file - I suspect that will prove to be very sage advice
That's true. Thing is if no key has been disabled then I'm assuming that not all keys are used bearing in mind that I'm trying to visualise the keyboard un-assigned keys from memory :hmm: One key that does prop up is the 'G' key. Now I don't know what the hex code id for the 'G' key is but may well be worth trying to copy a SetKey line then placing it against that [Cmd152] location, change the letter to 'G' and see what happens. Worst thing that could happen the way I see it is that because of the hex id code for the key that was copied could cause a conflict with the original SetKey command.

A brainwave

Copy a SetKey line like as per my example above ie:

SetKey=0x34D,,"T" then use the shift or ctrl as an addition, then you can use the same SetKey command but it now looks like:

SetKey=0x34D,s,"Shift+T" or
SetKey=0x34D,c,"Ctrl+T"

You still need to check that those combinations haven't already been used. You therefore then use the shift or control key as well.
__________________
Fearless

System Specs: AMD Ryzen 7 5800X 8 Core 16 Thread CPU, 3.8GHz Base Clock, 4.7GHz Boost, 105W TDP, 32MB L3 cache | MSI GeForce RTX3060Ti 8Gb Graphics | Corsair Vengeance RGB Pro 32Gb (2x16Gb) 3200 MHz CL16 DDR4 Ram | Samsung 970 Evo Plus NVMe SSD 1TB | Seagate Barracuda 2.5in 2TB HDD | AOC QHD 165 Hz FreeSync HDR curved 31.5in Monitor | ASUS ROG Strix LC 240 ARGB AIO Liquid CPU Cooler White Edition | ASUS ROG Strix Gold 750W Modular Power Supply | Corsair iCUE 5000X RGB Tempered Glass Mid Tower Case White.

Last edited by Fearless; 08-01-07 at 12:05 AM.
Fearless is offline   Reply With Quote
Old 08-01-07, 12:52 AM   #10
panthercules
The Old Man
 
Join Date: Apr 2005
Posts: 1,336
Downloads: 6
Uploads: 0
Default

Well, didn't have much luck with that effort. I figured out that SetKey seems to want the commands file named the same as it was in SH3, so I renamed my copy of my SH4 commands.cfg file as "commands_en.cfg" and SetKey found it and opened it up, so I thought everything was going well. I found and added a few key mappings to commands that didn't seem to have any yet, and that all seemed to go well too, BUT when I tried to save and exit SetKey it threw off a bunch of error messages about not being able to find the right path or something, and when I quit I checked my copy of the file and no changes had been made to it

Any idea what's going wrong with this? It seemed like it was gonna be so easy once I got it pointed to the right file, but something obviously went wrong.
__________________
panthercules is offline   Reply With Quote
Old 08-01-07, 01:19 AM   #11
Fearless
Ace of the Deep
 
Join Date: Feb 2007
Location: Adelaide, Australia
Posts: 1,047
Downloads: 340
Uploads: 1
Default

I'll try it out myself when I get home from work otherwise I've reached the end of my limited skills I have got with tweaking stuff.
__________________
Fearless

System Specs: AMD Ryzen 7 5800X 8 Core 16 Thread CPU, 3.8GHz Base Clock, 4.7GHz Boost, 105W TDP, 32MB L3 cache | MSI GeForce RTX3060Ti 8Gb Graphics | Corsair Vengeance RGB Pro 32Gb (2x16Gb) 3200 MHz CL16 DDR4 Ram | Samsung 970 Evo Plus NVMe SSD 1TB | Seagate Barracuda 2.5in 2TB HDD | AOC QHD 165 Hz FreeSync HDR curved 31.5in Monitor | ASUS ROG Strix LC 240 ARGB AIO Liquid CPU Cooler White Edition | ASUS ROG Strix Gold 750W Modular Power Supply | Corsair iCUE 5000X RGB Tempered Glass Mid Tower Case White.
Fearless is offline   Reply With Quote
Old 08-01-07, 04:25 AM   #12
CaptainCox
Sea Lord
 
Join Date: Feb 2007
Location: A Swede in Frankfurt am Main
Posts: 1,897
Downloads: 4
Uploads: 0
Default

@panthercules. I think I was a bit drunk when answering this yesterday :p I re-read the topic now and see my mistake.
__________________
CaptainCox is offline   Reply With Quote
Old 08-01-07, 05:39 AM   #13
DirtyHarry3033
Weps
 
Join Date: Aug 2005
Posts: 351
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by panthercules
Well, didn't have much luck with that effort. I figured out that SetKey seems to want the commands file named the same as it was in SH3, so I renamed my copy of my SH4 commands.cfg file as "commands_en.cfg" and SetKey found it and opened it up, so I thought everything was going well. I found and added a few key mappings to commands that didn't seem to have any yet, and that all seemed to go well too, BUT when I tried to save and exit SetKey it threw off a bunch of error messages about not being able to find the right path or something, and when I quit I checked my copy of the file and no changes had been made to it

Any idea what's going wrong with this? It seemed like it was gonna be so easy once I got it pointed to the right file, but something obviously went wrong.
What's the exact error msg? I just put my copy of Commands.cfg in the same folder with SetKeys.exe and never had any problems saving. Maybe something got corrupted when you downloaded it?

One thing I totally forgot to mention is, if you don't rename to "Commands_en.cfg" the file open dialog won't automatically show the file. A way to get around that without renaming is to type "*.cfg" in the file name box and hit "Enter", then Commands.cfg will show up in the dialog.

DH
DirtyHarry3033 is offline   Reply With Quote
Old 08-01-07, 06:23 PM   #14
panthercules
The Old Man
 
Join Date: Apr 2005
Posts: 1,336
Downloads: 6
Uploads: 0
Default

Quote:
Originally Posted by DirtyHarry3033
Quote:
Originally Posted by panthercules
Well, didn't have much luck with that effort. I figured out that SetKey seems to want the commands file named the same as it was in SH3, so I renamed my copy of my SH4 commands.cfg file as "commands_en.cfg" and SetKey found it and opened it up, so I thought everything was going well. I found and added a few key mappings to commands that didn't seem to have any yet, and that all seemed to go well too, BUT when I tried to save and exit SetKey it threw off a bunch of error messages about not being able to find the right path or something, and when I quit I checked my copy of the file and no changes had been made to it

Any idea what's going wrong with this? It seemed like it was gonna be so easy once I got it pointed to the right file, but something obviously went wrong.
What's the exact error msg? I just put my copy of Commands.cfg in the same folder with SetKeys.exe and never had any problems saving. Maybe something got corrupted when you downloaded it?

One thing I totally forgot to mention is, if you don't rename to "Commands_en.cfg" the file open dialog won't automatically show the file. A way to get around that without renaming is to type "*.cfg" in the file name box and hit "Enter", then Commands.cfg will show up in the dialog.

DH
Well, I had figured out the renaming thing when the file didn't show to SetKey up initially, but I had created a separate folder for my backup copy of the commands file - I'll try putting the renamed comands file in the same folder as the SetKey program and see if that does the trick. Thanks for the suggestions.
__________________
panthercules is offline   Reply With Quote
Old 08-01-07, 06:38 PM   #15
panthercules
The Old Man
 
Join Date: Apr 2005
Posts: 1,336
Downloads: 6
Uploads: 0
Default

Wow - that's definitely weird. Based on the error message (really long, but dealt with not being able to find part of the path blah blah blah...), I was able to figure out that in addition to renaming the commands file to commands_en.cfg and putting the renamed commands file in the same folder as SetKey is in, you also have to create a copy of the commands file in that same folder and call it "commands_en.bak".

Once that was done, SetKey saved the changes down just fine, without error messages.

Now, just have to compare the changed file to the old one and see if it made all the changes I asked it to without breaking something inside the file.

[EDIT] Good suggestion to just find the specific commands that got changed and then paste the new key lines into a clean copy of the SH4 commands.cfg file, because SetKey really does screw up/change a bunch of unintended stuff inside that file when it's doing its thing. However, just pasting in to a clean copy only the changed key line in the specific commands you know you changed worked just fine. I was able to map a key to "get depth below sub keel" and use the key in game just fine.

(Note for those interested - there is also a command called "report depth below keel" or something like that. I tried that first, but while the mapping worked and the key called up a report in game, the answer was always wrong - it always said depth below keel was 0. So you need to use the one that starts with "get" - using the key mapped to that command brought back the same answer that clicking the depth-below-keel button did.)

Now to map the other commands and get them entered into the speech recognition program files, then it's out to sea again
__________________

Last edited by panthercules; 08-01-07 at 07:52 PM.
panthercules is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:18 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.