Open cowboy opened 2 months ago
Hi, would you mind opening a merge request? The current script is stored here https://github.com/Numerlor/Auto_Neutron/blob/master/auto_neutron/constants.py#L49-L67
I'll download the game and try it out. Then it'll go into the next release hopefully along with AHK 2 suppport
If you're going to use AHK 2.0, you may want to do something like this. This way you can:
#Requires AutoHotkey v2.0
#SingleInstance Force
SYSTEM_NAME_UNSET := "SYSTEM_NAME_UNSET"
SYSTEM_NAME := SYSTEM_NAME_UNSET
If (A_Args.Length == 0) {
Exit
}
SYSTEM_NAME := A_Args[1]
#HotIf WinActive("ahk_exe EliteDangerous64.exe")
${hotkey}:: {
if (SYSTEM_NAME == SYSTEM_NAME_UNSET) {
MsgBox("Error: No system name selected", "Auto_Neutron", "Icon!")
} else {
PlotRoute()
}
}
#HotIf
SetKeyDelay(50, 50)
SendMode("Event")
PasteSystemName() {
OriginalClipboard := ClipboardAll()
A_Clipboard := SYSTEM_NAME
Send("^v")
A_Clipboard := OriginalClipboard
OriginalClipboard := unset
}
${user_script}
And then the user script could define the PlotRoute()
function, which could use the PasteSystemName()
function defined above, like so:
PlotRoute() {
; Open galaxy map
Send("{YourGalaxyMapKey}")
Sleep(3000)
; Focus search field
Send("{Up}{Space}")
; Paste system name
PasteSystemName()
Sleep(2000)
; Select first item from dropdown
Send("{Down}{Space}")
Sleep(100)
; Click in the center of the screen seems to be needed here
MouseMove(A_ScreenWidth / 2, A_ScreenHeight / 2)
Click
; Hold space for a second to actually lock in destination
Send("{Space Down}")
Sleep(1000)
Send("{Space Up}")
Sleep(1000)
; Map can be closed immediately, before route is fully calculated
Send("{YourGalaxyMapKey}")
}
I've tested this on a system 363 jumps away, so I know it works on my machine, but I don't know if the sleep timings will work for everyone.
I had some "problems" previously with re-running as icons kept filling up the tray, I'll see how things will go; haven't really looked at anything yet apart from knowing AHK 2 is a thing. The plan is to keep support for both as 2's penetration doesn't seem that high
From what I can tell, if you want to support both versions of AHK, you'll need 2 versions of the scripts, because the syntax isn't backwards compatible. If you're interested, I can create a v1 version of the above script, that uses the same approach.
#SingleInstance Force
allows the script to be re-run without spawning a new instance, see the docs. Works in v1 and v2.
Yeah 2 implementations is the plan. The current stdin piping seems to be working fine without launching new processes so I'm not too concerned about changing that behaviour
Ok, good luck then
One other thing I should point out: it seems that, generally, the first item in the dropdown list when searching in the galaxy map always matches the system name that was entered unless you have any bookmarks that also match, in which case those will appear first. There doesn't seem to be any way around this. Just something to note.
FYI the current AHK script doesn't work for me in Odyssey. My map looks like this (which is very different than the map in the README):
This script is working for me (tested with AutoHotkey 1.1.37.02). Just uncheck "Simple mode", paste this in, and replace the two instances of
YourGalaxyMapKey
with your galaxy map key. AHK key reference