Log in

View Full Version : [REL] SH3 Auto Watch Officer mod (v.0.3)


tekniq
10-21-11, 03:31 PM
My first contribution to the Subsim community, made it for myself but after all you guys shared with me it didn't seem fair to keep it only for myself.
I know this problem has been tried to solve before, but with a little extra effort i tried to make it so that it could work for all setups out there.
Only limited testing i'm afraid, only Win XP! would like to know if this works for your setups, esp. Vista, Win7.
Read Documentation for usage.
Maybe some off you don't like it and think its lame. Then don't use it.

Feedback very welcome.

http://www.gamefront.com/files/20910871/SH3AutoWOv0.3.7z

SH3AutoWO - SH3 Auto Watch Officer mod (v.0.3) Beta 10-21-2011, At this time only tested on XP SP3, LSH3v5, Macgui F and GWX.
-----------------------------------------------

THE PROBLEM
You're cruising across the Atlantic at high time-compression making your way to your assigned quadrant. You make regular hydrophone checks every 2 hours or so just to listen if some prey is stumbling on your path. Your crew won't get fatigued because their morale is outstanding!, except for the Watch Officer. Every time you resurface you have to drag him up from his bunk onto the bridge to join the rest of the watch crew like he's supposed to!

Some say it's a bug, other more diehard people say its a feature so you check up on your crew more often and spend more time listening whats going on around you.
Me personally i think it becoming annoying and consider it a bug.

To get rid of the problem i was looking and reading around SubSim.com for a solution but didn't find any. The bug is hard coded in the game, can't be fixed, others gave a go but it wouldn't work on all the different mods, gui's, hacks, resolutions etc.

So I decided myself to have a go to mod it, well it's really not a mod of any sort just a little AutoIt macro that simulates key-presses and mouse-moves. You can call it cheating! I did try to make it a little clever so it can work on all the different setups out there.


HOW IT WORKS
The macro works pretty simple, its a little program "SH3AutoWO.exe" that runs in the background and captures the press of a new key (default "v"), It then presses "s" for surface the boot, F7 for crew management, waits till the bright yellow star (or some other marker) appears above the bridge to indicate the boot is surfaced, drags the Watch Officer from his bunk to the bridge, switches back to the map with F5 and increases time-compression again if you want to.


INSTALLATION
Just extract "SH3AutoWO.exe" and "SH3AutoWO.ini" into your SilentHunterIII root game folder. You can also put them in a folder inside "MODS" and enable them with JSGME. You can then create a shortcut to "SH3AutoWO.exe".


RUNNING
By default when you run "SH3AutoWO.exe" it starts the macro and the game ("sh3.exe") up for you. If you don't want this for some reason for example if you start the game with SH3Commander set "AutoStartSH3 = 0" in the .ini file. You then have to start and exit the macro and the game separately. If your .exe is named differently (eg. SH3GWX.exe) change "SH3ExeName = SH3GWX.exe" in .ini.

The rest of the .ini file shouldn't need to be changed unless your having problems or you have/want different keys bindings, then see TROUBLE.


IN GAME CONFIG
The supplied config works for me with DX9HiResFix 1280x1024, LSHV5.1 and MuiGui F mods. If you have something similar maybe it will work for you, probably not. Start a game go to periscope depth and press "v" to surface ("s" for surface still works as it did). If your surfaced and your Watch Officer isn't on the bridge it didn't work. Don't worry you just need to show the macro where to look and click.

To do so: Go to periscope depth (p), then to crew-managment (F7) and surface the boot again (s). Notice that the area around the bridge changes, like the yellow star above the bridge, you need to show the macro a marker so that it knows when the boot is surfaced. Its not practical to make a config for every setup, so you have to do it yourself.

Follow these 4 steps exactly:
1. Surface the boot, Go to crew-managment and point your mouse exactly at the yellow star above the bridge (you could also use another distinquishing marker here). Press CTL+ALT+v. You should hear a beep, now the position of the marker is recorded.

2. Point your mouse at the position your Watch Officer should come from (top-left bow crew compartment). Press ENTER, you should hear another beep to indicate the step is done. The color of the marker in Step 1 is now recorded also.

3. Point you mouse at the position on the bridge your Watch Officer should go. Press ENTER, another beep.

4. Now input how many times you want to increase time-compression when the macro will resurface for you. If you’re cruising at high time compression and come to the crew-managment page time-compression will probably drop to 32x, so if you want to continue your cruise at 128x for example, time-compression should be increased 2x when you get back to the map. Press the "+(Add) Key" on the numeric keypad twice or more. You will hear another beep each time. Press ENTER. If you don't want extra time-compression back just press ENTER without pressing the +-key. Now its 3 times a beep to let you know you are finished.

If you screw up, just start again at step 1.

Try surfacing again, go back to the navmap, increase TC, periscope depth and resurface (press "v"). Hope it works now.


TESTING & FEEDBACK
Only tried on WIN XP SP3, LSH, Macgui F and GWX. If other systems work or don't work for you please put leave your feedback on Subsim.com



Tekniq
10-21-2011



TROUBLESHOOTING
If you still have problems or glitches there are a few things you can change in the .ini file:

- At release I've only tested this mod on WinXP SP3. If you use Vista or Win7 maybe you can try setting "Admin Rights" and "XP compatibility mode" on the .exe's. i really don't know more about this.

- Resolution? The macro has to know the correct resolution of the game to get the right coordinates. First it will look if it is overridden in the "SH3AutoWO.ini" file: ";ResX = 1280" and ";ResY = 1024" (note by default these are commented out). Didn't find any then it will look in the "d3d9.cfg" file if you have this hires-mod (You should). If it still can't find a setting it will assume you have 1024x768 as in stock SH3. If you have another hires-mod figure out its resolution and try to add these settings in the inifile "SH3AutoWO.ini".

- I want another key for auto-resurfacing? Change "AutoWoKey=v" into what you like and isn't used in the game. If you change this key the config combination CTL+ALT+AutoWoKey changes too. Also you could for example use SHIFT-v by adding a "+" and setting "+v" but in testing i had some problems with SHIFT combinations.

- My Mod/Gui uses different key-presses for surface, map, crew-managment etc? You can change them here too. Note for special keys like F7 you have use to add Curly brackets or special names like: {F7} and {NUMPADADD}. Look it up in AutoIt documentation.

- If you think the macro moves to fast between key-presses and before the screens change, thus mistiming things: increase delay between key-presses: "Delay = 100" its in ms.

- SurfaceTimeout = 30 is how many seconds the macro waits in the crew-managment page till the boot surfaces. If something goes wrong it just quits it waiting cycle after this time thus not waiting forever. If you are surfacing at 1x TC it could take a lot longer then this but then you should use normal surface "s" anyway.

DEFAULT INI
"SH3AutoWO.ini"
-----------------------
[]
;SH3AutoWO - SH3 Auto Watch Officer mod (v.0.3) Beta 10-21-2011

;this is the AutoWO surface key that you can choose
AutoWoKey=v
;the other keys depend on the game and or mod you use
SurfaceKey=s
MapStationKey={F5}
CrewstationKey={F7}
TimeCompKey={NUMPADADD}
;set you resolution here if its not detected right
;ResX = 1280
;ResY = 1024
;set to zero to not start sh3.exe at the same time
AutoStartSH3 = 1
;this file wil be run if you choose autostart
SH3ExeName = sh3.exe
;seconds before macro stop waiting for surface
SurfaceTimeout = 30
;delay beteen keypresses in ms.
Delay = 100
;--------Values Below are setup by the in game config by pressing "CTL+ALT+<Above AutoWoKey>", see SH3AutoWO.txt---------
TriggerColor=00FEED55
TriggerX=643
TriggerY=66
FromX=747
FromY=371
ToX=525
ToY=98
TcIncrement=2

vienna
10-21-11, 04:38 PM
Much appreciated! I'm going to give it a try; about time to get the WO out of his bunk and on his feet...

reaper7
10-21-11, 04:52 PM
Thanks Tekniq for sharing :up:.
In case you missed this h.sie also has a patch for this and other bugs in SH3 that are applied direct to the exe file permanetly patching it.
Can be found here http://www.subsim.com/radioroom/showthread.php?t=174225.
Your method has a great workaround to the problem and some great out of the box thinking.
look forward to seeing any future fixes you come up with :up:

Kafka BC
10-21-11, 05:14 PM
Thanks Tekniq for sharing :up:.
In case you missed this h.sie also has a patch for this and other bugs in SH3 that are applied direct to the exe file permanetly patching it.
Can be found here http://www.subsim.com/radioroom/showthread.php?t=174225.
Your method has a great workaround to the problem and some great out of the box thinking.
look forward to seeing any future fixes you come up with :up:

From what I understand h.sie's patch is only for copies of the game that didn't come with Starforce copy protection, so this will be very useful for people with other versions that did.

I'll give it a try. :up:

reaper7
10-21-11, 06:10 PM
From what I understand h.sie's patch is only for copies of the game that didn't come with Starforce copy protection, so this will be very useful for people with other versions that did.

I'll give it a try. :up:


Yes that is true, a very good point. And an excellent addition for thise with starforce or steam version of the sim. :yep:

Fish In The Water
10-21-11, 08:37 PM
Thanks Tekniq for sharing :up:.
In case you missed this h.sie also has a patch for this and other bugs in SH3 that are applied direct to the exe file permanetly patching it.
Can be found here http://www.subsim.com/radioroom/showthread.php?t=174225.
Your method has a great workaround to the problem and some great out of the box thinking.
look forward to seeing any future fixes you come up with :up:

Quite agree...

I use the h.sie patch, but this is still a very interesting idea. Thanks very much for sharing and I too look forward to any future applications this may have. Thanks again! :up:

SquareSteelBar
10-22-11, 02:14 AM
From what I understand h.sie's patch is only for copies of the game that didn't come with Starforce copy protection...That's not right.

HW3
10-22-11, 02:54 AM
Quote:
Originally Posted by Kafka BC http://www.subsim.com/radioroom/images_acpb/buttons/viewpost.gif (http://www.subsim.com/radioroom/showthread.php?p=1772424#post1772424)
From what I understand h.sie's patch is only for copies of the game that didn't come with Starforce copy protection...

That's not right.

You are quite correct SquareSteelBar, h.sie's patch works just fine with my original release SH3 disk, Starforce and all.

:salute:

Kafka BC
10-22-11, 05:22 AM
You are quite correct SquareSteelBar, h.sie's patch works just fine with my original release SH3 disk, Starforce and all.

:salute:

When did that change? I haven't read all of the stickied thread, but early on when h.sie started work on it, he stated that it was for the Starforce free version, which left people wandering where they could get a replacement .exe and associated files so they could try it.

In either case, I would still like to try this version. I don't know anything about them, but this macro idea sounds like it has potential and possibilities for other areas besides the watch officer.

And I applaud tekniq's effort. :rock:

HW3
10-22-11, 06:36 AM
I'm not sure when it did change but, just found out about it recently, and it does work. I'm looking forward to the wolfpacks they are working on. They are in Alfa testing on those.

h.sie
10-22-11, 08:18 AM
Currently 5 different versions of sh3.exe are supported, and it would be easy to add more, if necessary.

Thanks anyway for your work, tekniq, even if there is already a solution.

tekniq
10-23-11, 12:27 PM
Hey,

Really great that someone finally found a hardcode solution! Should be alot nicer than my workaround solution. Thanks for pointing it out to me. Going to try it out.

VONHARRIS
10-23-11, 12:40 PM
Thank you for that.
My PC refused to run h.sie patch for some unknown reason!
I will try it.

Edit
Question: I want to start the game with Commander. So do I run this macro first and then commander or the other way around?
Thank you.

tekniq
10-23-11, 01:55 PM
It doesn't really matter. Just start the macro before starting the game, Before SH3Commander or before you click start in sh3commander. If you forget you could also just ALT-Tab and start it while the game is running.

Set "AutoStartSH3 = 0" in the .ini file with notepad so not to start the game without SH3commander.

When finished playing exit the macro by right-clicking on it in the system tray.

Note:
The CTL+ALT+v config should only need to be done once or when changing Gui, mod, resolutions etc.

VONHARRIS
10-24-11, 12:33 AM
Thank you for replying.

SquareSteelBar
10-24-11, 01:29 AM
...My PC refused to run h.sie patch for some unknown reason!...Maybe some anti virus soft etc. prevents it - switch it temporarily off...



...
This patch adds code to sh3.exe. Some Antivirus-Programs maybe don't like this
...




.

jowy
10-24-11, 01:57 AM
good job ¡¡¡

Fish In The Water
10-24-11, 03:52 AM
good job ¡¡¡

Welcome aboard and thanks for the positive feedback! :sunny:

Rubini
10-24-11, 05:55 AM
Hi tekniq,

Thanks for this also great tool.
Your tool opens a new door for some others common issues on Sh3. For example, I should like to put my watch crew on flak guns and start to fire medium range without press the mouse 3 or 4 times, etc. Can your tool be adapted for any combination of sh3 keys/commands?

Magic1111
10-24-11, 06:42 AM
good job ¡¡¡

:salute::salute::salute:Welcome aboard!!!:salute::salute::salute:

tekniq
10-24-11, 09:07 PM
Hi tekniq,

Thanks for this also great tool.
Your tool opens a new door for some others common issues on Sh3. For example, I should like to put my watch crew on flak guns and start to fire medium range without press the mouse 3 or 4 times, etc. Can your tool be adapted for any combination of sh3 keys/commands?


Thanks. Yes my tool could be adapted for this no problem.
Fortunately what you want is already possible in game, which works much nicer than a work around.
Use "SH3 SetKeys" (recommended) or Notepad to edit "data/cfg/Commands_en.cfg" and add keyboard shorcuts to the following entries. if you use Notepad only add the "key0=" line to your entry don't copy paste the rest of mine.

[Cmd431]
Name=Man_the_flak_gun
Ctxt=1
MnID=0x3F2D0003
Str=2945
Key0=0x46,s,"SHIFT F"

[Cmd433]
Name=Watch_crew
Ctxt=1
MnID=0x3F2D0005
Str=2947
Key0=0x57,s,"SHIFT W"

Now you can switch between your watch and flak crews with Shift-F and Shift-W. You should only need to set "Medium Range" and "Fire at Will" once with you mouse and it should stay on those settings. If you want to be sure its always "Medium Range" and "Fire at Will" when you press shift-F you could add shift-F at the same time to those commands as well:


[Cmd419]
Name=AAGuns_Fire_at_will
Ctxt=1
MnID=0x3F180006
Str=1063
Key0=0x46,s,"SHIFT F"

[Cmd422]
Name=AAGuns_Medium_range
Ctxt=1
MnID=0x3F180009
Str=1066
Key0=0x46,s,"SHIFT F"

Try it out in the Flak academy mission.
There are lots more of possibilities in Commands_en.cfg.

Rubini
10-25-11, 09:31 AM
Thanks. Yes my tool could be adapted for this no problem.
Fortunately what you want is already possible in game, which works much nicer than a work around.
Use "SH3 SetKeys" (recommended) or Notepad to edit "data/cfg/Commands_en.cfg" and add keyboard shorcuts to the following entries. if you use Notepad only add the "key0=" line to your entry don't copy paste the rest of mine.

[Cmd431]
Name=Man_the_flak_gun
Ctxt=1
MnID=0x3F2D0003
Str=2945
Key0=0x46,s,"SHIFT F"

[Cmd433]
Name=Watch_crew
Ctxt=1
MnID=0x3F2D0005
Str=2947
Key0=0x57,s,"SHIFT W"

Now you can switch between your watch and flak crews with Shift-F and Shift-W. You should only need to set "Medium Range" and "Fire at Will" once with you mouse and it should stay on those settings. If you want to be sure its always "Medium Range" and "Fire at Will" when you press shift-F you could add shift-F at the same time to those commands as well:


[Cmd419]
Name=AAGuns_Fire_at_will
Ctxt=1
MnID=0x3F180006
Str=1063
Key0=0x46,s,"SHIFT F"

[Cmd422]
Name=AAGuns_Medium_range
Ctxt=1
MnID=0x3F180009
Str=1066
Key0=0x46,s,"SHIFT F"

Try it out in the Flak academy mission.
There are lots more of possibilities in Commands_en.cfg.
Thanks by the reply tekniq!
Yes, I already know about the possibility that Sh3 execute various keys functions at once, we already use them on some situations/mods, like uboat flags, pennants, etc. The example that I asked is just to have sure that your tool isn´t only for the WO issue, so a very good news :up:, we now have a macro that works outside of SH3. I´m sure that someone will find more suitable situations for use it.:yeah:

Anvart
10-25-11, 01:26 PM
...
Yes, I already know about the possibility that Sh3 execute various keys functions at once, we already use them on some situations/mods, like uboat flags, pennants, ...
Dear friend, do not confuse the penis with the finger... :haha:

Rubini
10-25-11, 03:05 PM
Dear friend, do not confuse the penis with the finger... :haha:

Perhaps my bad english?:hmmm::O: