Keyboard Shortcut for Closing Windows?

Distant Worlds is a vast, pausable real-time, 4X space strategy game which models a "living galaxy" with incredible options for replayability and customizability. Experience the full depth and detail of large turn-based strategy games, but with the simplicity and ease of real-time, and on the scale of a massively-multiplayer online game. Now greatly enhanced with the new Universe release, which includes all four previous releases as well as the new Universe expansion!

Moderators: elliotg, Icemania

Post Reply
Chimera533
Posts: 3
Joined: Thu Aug 02, 2018 1:12 pm

Keyboard Shortcut for Closing Windows?

Post by Chimera533 »

I'm looking to map a button on my Steam Controller to close windows in the game. The best I can find is a guide for AutoHotKey. Since I can't post links, you can google this to find it:

How to create a hotkey to close in game screens and dialogues (AutoHotKey solution) + some other cool shortcuts

I'm not familiar with AutoHotKey but it looks like the script is doing a lot more than just remapping a key. Just wondering if there is a simple way to do this. If this is the only way I suppose I can just use this script then map my controller button to the button in the script.
Chimera533
Posts: 3
Joined: Thu Aug 02, 2018 1:12 pm

RE: Keyboard Shortcut for Closing Windows?

Post by Chimera533 »

If anyone is interested, I could not find a shortcut to natively close in-game windows but the AutoHotKey script works a charm. I gave myself a crash course in AutoHotKey and bound the window close commands to a key combo that I'm pretty sure Distant Worlds doesn't use. Then I bound that key combo to my Steam Controller and it works without fail (so far).
User avatar
rxnnxs
Posts: 661
Joined: Sat Jun 01, 2013 10:25 am
Location: what goes on
Contact:

RE: Keyboard Shortcut for Closing Windows?

Post by rxnnxs »

I am interested in your AHK script.
I also did not like the ESC behaviour. I would like to close all open windows before going into optinos mode.
Now if you already have a AHK script that, lets say, lays all close windows commands to "Q", this would be fantastic!
Chimera533
Posts: 3
Joined: Thu Aug 02, 2018 1:12 pm

RE: Keyboard Shortcut for Closing Windows?

Post by Chimera533 »

Here it is. It's just the same script from the guide that you can google but with different key bindings:

Code: Select all

 #IfWinActive, Distant Worlds
 #MaxThreads 1
 SendMode Event
 SetControlDelay, -1
 SetKeyDelay, 20
 SetMouseDelay, -1
 FirstTime:=True
 
 >^]::Suspend
 
 >^\::  ; Change XButton1 to Esc if you prefer standard UI feel keys
 	{
 	ControlClick, Close
 	;ControlClick, Cancel
 	ControlGet, isGoodbyeVis, Visible, , Goodbye
 	ControlGet, isNothanksVis, Visible, , No thanks
 	If isGoodbyeVis
 	{
 		ControlFocus, Goodbye
 		ControlSend, Goodbye, {Enter}
 	}
 	If isNothanksVis
 	{
 		ControlFocus, No thanks
 		ControlSend, No thanks, {Enter}
 	}
 	return
 	}
 


This binds RCTL+] to suspend the script and RCTL+\ to close windows. I haven't had a need to suspend the script but I kept the functionality just in case. If you want to use the Q key to close windows, you should just be able to replace this line:

Code: Select all

>^\::  ; Change XButton1 to Esc if you prefer standard UI feel keys

with this line:

Code: Select all

q::  ; Change XButton1 to Esc if you prefer standard UI feel keys
There are ways to launch the game from the AHK script and close the script after the game closes but don't ask me how. I basically just learned enough to get me going. I also use another program to change my desktop resolution before launching the game so I have a hacked together solution that calls a bunch of things from a batch file including this AHK script.
Post Reply

Return to “Distant Worlds 1 Series”