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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 07-22-07, 07:34 PM   #4
minsc_tdp
XO
 
Join Date: Mar 2007
Posts: 411
Downloads: 1
Uploads: 0
Default

I get a crash trying to load a simple profile with one command in Shoot:

An unexpected error occurred. Full error message:
Object reference not set to an instance of an object:
at shoot.config.Configuration.load(String filename)
at shoot.MainForm.loadProfile(String file)
at shoot MainForm.openDialog_FilOk(Object sender, CancelEventArgs e)
at System.Windows.Forms.FileDialog.OnFileOk(CancelEve ntArgs e)
at System.Windows.Forms.FileDialog.DoFileOk(IntPtr lpOFN)

Any help with that?

In the meantime, I've been experimenting with sending mouse input and keystrokes to SH4. Both work well. Here's an example of keyboard input:

use Win32::API;
my $keybd_event = new Win32::API("user32", "keybd_event" , [qw(I I N P)], 'V') or die "keybd_event: " . Win32::FormatMessage (Win32::GetLastError ());

use constant F1 => 0x70;
use constant SC_F1 => 0x3B;
use constant X => 0x58;
use constant SC_X => 0x2D;

while (1) { # keep pressing the key so i can switch to sh4
sleep(2);
press_key(C, SC_C); # Crash dive!
}

sub press_key {

my $bVk = shift;
my $bScan = shift;
$keybd_event->Call($bVk, $bScan, KEYEVENTF_EXTENDEDKEY, 0);
sleep(1);
$dwFlags = KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP;
$keybd_event->Call($bVk, $bScan, $dwFlags, 0); # release key

}

And here is an example mouse movement:

use Win32::GuiTest qw/:ALL/;

MouseMoveAbsPix(693,692);
sleep(1);
MouseMoveAbsPix(723,693);
SendMouse("{LEFTDOWN}");
sleep(1);
SendMouse("{LEFTUP}");
sleep(1);
# Speed is now set to Full, will break with different resolutions though.


So, assuming I can get the voice recognition code to work properly, which doesn't look too hard, I have everything I need for precise SH4 control, including specific depth levels and all the keys! Exciting... now to see if I actually finish this

If someone can give me a basic Shoot profile for SH4 that does even a few keys, I'll prefer that route and I'll probably go to the trouble of finishing the profile. I've heard it has trouble with certain keys like the backtick ` but we'll have to see.
__________________
June 29 2016 - shSpeech v2.55 - Voice Command for Silent Hunter 4! View Thread

Last edited by minsc_tdp; 07-22-07 at 07:55 PM.
minsc_tdp is offline   Reply With Quote
 


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 11:05 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.