Ships At Sea

Ships At Sea

Not enough ratings
In-Game ETA Calculator (AHK Script)
By Nu_Gundam
Opens a GUI while in-game and allows you to quickly calculate your ETA.
   
Award
Favorite
Favorited
Unfavorite
What is this?
An AutoHotkey script that only appears while the game is focused and hotkey is pressed (default F5).



The colour will gradually transition from green (15m)...



To yellow (30m)...



To red (1h)...



Until the developers implement an actual in-game solution, you can use this to quickly do maffs and get a fast estimation on your ETA every time!


Setup
(Note: I never actually upgraded from AutoHotkey v1.1 and so I cannot confirm if v2.0 is compatible with the below script.)

1. Download and install AutoHotkey v1.1 @ https://www.autohotkey.com

2. Create a new blank AHK file and paste the following into it, then save:

#IfWinActive, ahk_exe Sas-Win64-Shipping.exe ; Change hotkey here! Use modifiers like + for shift, ! for Alt, and ^ for CTRL. F5:: ; Destroy any existing GUI to avoid duplicate control variable errors Gui, Calc:Destroy ; Create single GUI for both inputs Gui, Calc:+OwnDialogs Gui, Calc:Font, s16, Arial Gui, Calc:Add, Text,, Distance (Nautical Miles): Gui, Calc:Add, Edit, vDistance w200 gUpdateResult Gui, Calc:Add, Text,, Current Speed (Knots): Gui, Calc:Add, Edit, vSpeed w200 gUpdateResult Gui, Calc:Add, Text, vResult w300, ; Placeholder for result Gui, Calc:Show,, Travel Time Calculator return UpdateResult: Gui, Calc:Submit, NoHide if (Distance = "" || Distance <= 0 || Speed = "" || Speed <= 0) { GuiControl, Calc:, Result, ; Clear result if inputs are invalid return } ; Calculate travel time TravelTimeMinutes := (Distance / Speed) * 60 TravelTimeMinutes := Round(TravelTimeMinutes, 1) ; Determine display format (minutes or hours) if (TravelTimeMinutes >= 60) { TravelTimeDisplay := Round(TravelTimeMinutes / 60, 1) Unit := "Hours" } else { TravelTimeDisplay := TravelTimeMinutes Unit := "Minutes" } ; Determine color based on travel time (in minutes) if (TravelTimeMinutes <= 15) { Color := "008000" ; Green } else if (TravelTimeMinutes >= 60) { Color := "CC0000" ; Red } else if (TravelTimeMinutes >= 30) { ; Interpolate between yellow (CCCC00) and red (CC0000) from 30 to 60 minutes Ratio := (TravelTimeMinutes - 30) / 30 GreenComponent := Round((1 - Ratio) * 0xCC) ; Green fades from CC to 00 Color := Format("{:02X}{:02X}00", 0xCC, GreenComponent) } else { ; Interpolate between green (008000) and yellow (CCCC00) from 15 to 30 minutes Ratio := (TravelTimeMinutes - 15) / 15 RedComponent := Round(Ratio * 0xCC) ; Red increases from 00 to CC GreenComponent := Round((1 - Ratio) * 0x80 + Ratio * 0xCC) ; Green from 80 to CC Color := Format("{:02X}{:02X}00", RedComponent, GreenComponent) } ; Update result in bold with calculated color Gui, Calc:Font, s16 bold, Arial GuiControl, Calc:Font, Result ; Apply bold font GuiControl, Calc:+c%Color%, Result ; Set text color GuiControl, Calc:, Result, Travel Time: %TravelTimeDisplay% %Unit% return GuiClose: Gui, Calc:Destroy return


3. Run the script (it docks to your system tray), and always make sure the game is open AND focused before pressing the hotkey.

If you wish to change the hotkey, it's near the top of the script. I recommend using modifiers like:

+ (Shift)
^ (Ctrl)
! (Alt)

So "+Space" would be "Shift+Space" to activate, or "^!z" would be "Ctrl+Alt+Z".

What if script no longer works?
If the script ever breaks, it's because the name of the executable has changed.

I can't think of a game off the top of my head where the developers changed the name of the executable this late into development, and so you most likely won't ever have to do any of this.

The code itself works completely independently from the game... but a single line requires the game to be open and focused for the code to even execute:

#IfWinActive, ahk_exe Sas-Win64-Shipping.exe

Therefore, removing this line will cause the hotkey to work again immediately.
If you want to update the line itself to retain the focused window functionality, there are two methods:


Method A: Window Spy
Use Windows search to find "Window Spy", which is a script included with AHK installations.

Run it, and click on the game to focus it. Doing so will update Window Spy's GUI, but we want this line:




Method B: Task Manager
Open Task Manager (Ctrl+Shift+ESC). and find your Ships At Sea executable.

Right click on it and go to Properties to find the executable name.




And that's it.




No one likes to like and subscribe but rating this guide will genuinely help others find it.

That is all! Dismissed!