![]() |
Quote:
add this to key_codes.csv CTRL-ENTER,0xA2+0x0D,0x00 As you'll notice from other lines near the bottom of that file, 0xA2 is obviously CTRL and ENTER is already defined up above as 0x0D. You can combine up to two keys using + in this way. Codes for SHIFT and ALT and anything else I forgot can be found here: http://delphi.about.com/od/objectpascalide/l/blvkc.htm (just preface all with 0x) Next, in key_commands.csv, change the line: 12,Key,Fire,ENTER to 12,Key,Fire,CTRL-ENTER Since CTRL-ENTER matches the entry in key_codes.csv, that's it, you're done! These are separate from voice_command.csv so that you can add a dozen voice commands for "fire" without worrying about putting in the right key. It's all documented at the bottom of the readme (though I realize I forgot to include the URL for the key codes... I've updated the readme.txt with this and also included links in a "docs" subfolder in the zip.) |
AHA! I'm 99% sure I've fixed the installer problems. There were two: First, one command was prompting an invisible question which would stick the bat to prevent you from reaching the next step. Second, since I'm running PPM which is actually a bat file from within another bat file, it's best to use the "call" prefix. So I'm quite sure these installer problems will go away for anyone else.
|
Quote:
Had to help someone do something tonight, so didn't get any sub time in tonight :( Will have to try this out on patrol tomorrow - Now that I got my RFB install tweaked up I'm really looking forward to testing it out with this voice thing. Thanks again! |
Just did some more testing (just in test mode) to check the key change for firing - looks like it's going to work great.
This is going to be very cool - I really like being able to have multiple voice comands assigned to the same key/action, especially for things like diving (I've added "Clear the bridge" and "Lookouts below") and firing each tube. I know you still have to work a bit on the tube selection aspect, but I went ahead and set it up so "Fire one", Fire two", Fire three", etc. up to "Fire ten" all work, so I can now order the crew to fire the correct tube (assuming I've selected the right tube before I say it :D ) I hope there's a way to map a key/combo to open a specific tube door or doors - I'd love to be able to say "make ready all bow tubes", or "open outer doors on tubes 1 and 2" and have it actually work. I never really played using the keyboard much unless I had to (tried to use the mouse on everything possible) - with this though I'm going to have to rethink that, and check into all the possibilities of assigning keys to things I never would have messed with before. Is there a list somewhere of every action that folks have figured out can be mapped to keys? That would be really handy for working with this speech thing (for example, can you map the weather report function to a key, or just to a button on the orders bar? - it would be great to be able to ask your watch officer for a weather report by voice command). |
Quote:
"Lower all masts" - both scopes & snorkel are lowered. "Prepare to dive" - all masts are lowered & tubes closed & dive ordered. "Silent running" - silent running is ordered & gramophone turned off. "At ease men" - secure from silent running & the gramophone switched back on. "Emergency Surface" - blow ballast-go to flank speed-surface-blow ballast. I even mapped timed inputs for the arrow keys to walk the Free camera from one station to the next, climbing ladders & going through hatches and so forth based on a verbal command. Below are a few snippets from Commands.cfg [Cmd315] Name=Select_tube_1 Ctxt=1 [Cmd316] Name=Select_tube_2 Ctxt=1 [Cmd317] Name=Select_tube_3 Ctxt=1 [Cmd318] Name=Select_tube_4 Ctxt=1 [Cmd319] Name=Select_tube_5 Ctxt=1 [Cmd320] Name=Select_tube_6 Ctxt=1 ;NAVIGATION OFFICER [Cmd250] Name=Navigation_officer Ctxt=1 GoBack=Navigator_view [Cmd251] Name=Choose_destination_point Ctxt=1 [Cmd252] Name=Plot_course Ctxt=1,11 MnID=0x3F060001 [Cmd253] Name=Return_to_course Ctxt=1 Key0=0x56,C,"V" MnID=0x3F060004 [Cmd254] Name=Search_pattern_1 Ctxt=1 MnID=0x3F240002 [Cmd255] Name=Search_pattern_2 Ctxt=1 MnID=0x3F240003 [Cmd256] Name=Search_pattern_3 Ctxt=1 MnID=0x3F240004 [Cmd257] Name=Report_time_to_turn Ctxt=1 Key0=0x4e,Cc,"Ctl+N" MnID=0x3F250002 [Cmd258] Name=Report_time_to_course_end Ctxt=1 MnID=0x3F250003 [Cmd259] Name=Report_range_to_course_end Ctxt=1 Key0=0x42,Cc,"Ctl+B" MnID=0x3F250004 [Cmd260] Name=Report_depth_under_keel Ctxt=1 Key0=0x42,C,"B" [Cmd261] Name=Report_weather Ctxt=1 Key0=0x56,Cc,"Ctl+V" MnID=0x3F250006 Like I said I'm just getting started customizing my SHIV. |
I'll have to add some basic pausing so that you can issue two keys or a series of keys with one command... should be very easy.
|
Nice work minsc_tdp. Were you able to get the mouse inputs going, or is this still in progress?
Thanks |
OK - I'm still not following one aspect - what exactly is a "scan code" (third column in the key_codes.csv file) and how do I know what it's supposed to be.
I'm trying to add a command for opening/closing the recognition manual, which is assigned to the "N" key in game. So, I went to the website linked to above, and found that the code for the "N" key is 4E. So, I started adding an entry to the bottom of the key_codes.csv file file, as "N | 0x4E | ???", but I can't figure out what belongs in that third column as the "scan code". Making the changes to the key_commands.csv file seemed easy enough (presumably "59 | Key | Recognition Manual | N"), as did the changes in the voice_commands.csv file (presumably "59 | Recognition manual | Recognition manual"), but this "scan code" thing has me stumped - I couldn't detect any pattern in looking at the scan codes for the other entries in the key_codes.csv file, but then again I'm a total noob at hex stuff so I probably wouldn't be able to spot a pattern even if there is one. Have I read right past this part in the previous explanations, or can you shed some light on how to determine what the entry in the scan code column should be for new commands we add? [edit] OK - I still don't know what a scan code is, but I had to put something in there when I closed the files, so I just chose "0x00" like you suggested in the example about "CTRL-ENTER". This seemed to work in test mode - when I say "Recognition manual" it says it recognizes it and that it's outputting the letter "N", so I guess it worked - but if 0x00 always works, why are all the other scan codes something else? What is a scan code and what does it do? |
Well I thought I needed the scancodes and I entered them all in. Then I noticed I got some of them wrong due to being an idiot and using multiple info sources for the scan codes. Then I noticed that they tended to actually screw up the function call so I just zeroed it out in the code. Therefore it basically ignores whatever you put in that field (but it's best to put something like 0x00 to prevent warnings about empty variables and such.)
I still haven't got the mouse stuff started, I'm on vacation in TN all week. But I can't resist checking in here :) |
Quote:
I think the reason is that the python listener writes a file anytime an event is fired for the voice rec. This can happen at any moment. The perl script scans the file written by python, but to do this needs to open it, and if the python is writing to it at that exact moment, the file is locked, it throws an error and misses the command. For now I'll just hack this so that it detects this condition and retries until it's unlocked. The right solution is to have the two programs communicate with a better system than reading and writing files. Maybe the registry or a local IP port. I'm not much of a python coder but I'll figure something out. |
Hi, I got some troubles installing the ActivePerl. I downloaded the file and unzipped it. But executing the Installer.bat always shows this error message:
Can't locate warnings/register.pm in @INC (@INC contains: C:/Perl/Perl/lib .) at C:/Perl/Perl/lib/vars.pm line 7. BEGIN failed--compilation aborted at C:/Perl/Perl/lib/vars.pm line 7. Compilation failed in require at C:/Perl/Perl/lib/base.pm line 4. BEGIN failed--compilation aborted at C:/Perl/Perl/lib/base.pm line 4. Compilation failed in require at C:/Perl/Perl/lib/ActiveState/Prompt.pm line 7. BEGIN failed--compilation aborted at C:/Perl/Perl/lib/ActiveState/Prompt.pm line 7. Compilation failed in require at Installer.bat line 47. BEGIN failed--compilation aborted at Installer.bat line 47. What am I doing wrong? (The os is Win Vista Premium) thx for any help! |
Hi all, I´ve got a little problem, too!
I followed all the instructions and everything was fine so far. All installing, adjusting the microphone, no problem at all. But then I wanted to start the programm ( Run "sh4speech.bat" to start the program. When you run it, it will open a new window that says "Listening for voice commands from voice_commands.csv".) the window opens only for less than a second and immediately closes again. Nothing happens furtheron (I think I should be able to give to commands in SH4 then, but I´m not) Does anyone know what I did wrong / can do now? Thanks a lot, moselgott! EDIT: Ok, I made that window run entering "hear.py" instead of "sh4speech.bat". So that window appears with the sentence "listening for phrases from voice_commands.csv", and commands like "map" or "dive" appear there if I speek into the microphone. So I started SH4 parallel to that window and gave several commands, but nothing happened. I went back to desktop and the window showed up with all the commands I gave while Sh ran. What do I do wrong!?!?!? Any ideas? |
Noone? I´m really desperate because I don´t manage to achieve anything...:cry:
|
Quote:
However, I did the same thing you did and I noticed that while it opens up the one window that repeats the commands you say, it doesn't open up the other window that opens up when I use the sh4speech.bat file - it's that second window that appears to output the key commands that are spawned by your spoken commands, and without those key commands getting output, you're not going to see any effect in the game of speaking the commands. I noticed that when I first tried this I was getting the same "fleeting window" issue you describe - the window closes too fast to be able to tell what error message you're getting so it's hard to track down the problem. One thing you should try - run the sh4speech.bat file from a DOS command prompt box instead of from a shortcut in Windows - that way, since the DOS/command prompt window stays open, you should be able to read what error message you get when sh4speech.bat fails - depending on what that error message is, we might be able to figure out how to fix it (if it's the same message I was getting, as outlined in some of the posts above) or at least minsc might be able to give you a solution when he sees it. Good luck! |
Quote:
Second, it looks like some basic libraries are not functioning - vars, base, prompt, those are really basic ones that should work fine with the default installation of activeperl. third, I notice your paths are c:/Perl/Perl/lib/...etc. There should only be one /perl/ in there so it should be c:/perl/lib/...etc. SO, I would recommend fully uninstalling Perl using Control Panel > Add Remove Programs and reinstalling, making sure that the full install path is simply c:\Perl. Hopefully that'll get you one step closer! |
All times are GMT -5. The time now is 07:01 AM. |
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.