Improved on my first attempt, just need one final bit of help

Ask gaming related questions (AHK v1.1 and older)
Howard Moon
Posts: 2
Joined: 21 Jul 2017, 10:27

Improved on my first attempt, just need one final bit of help

23 Jul 2017, 15:02

Hi all,

Didn't get a response to my first post, but have been back and tried to work out where I went wrong and have managed to improve on the original attempt quite a lot. I'm just having an issue in getting the final part of the command to work properly, which is where I am hoping for a pointer :) This is my script:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

PgDn::Suspend
RButton::
Send {Numpad2}
Sleep 20
Click
Send {Numpad3}
Sleep 20
Click
Send {Numpad4}
Sleep 20
Click
Send {Numpad5}
Sleep 20
Click

So I am using this for a ship-based game where you have 5 ships in a fleet, with number 1, 2, 3, 4 and 5 corresponding to the 5 ships in your fleet. Number 1 is usually the tank, and 2, 3, 4 and 5 usually hide behind the tank in relative safety. In the above script, I right click, and ships 2, 3, 4 and 5 move to where I want them to altogether rather than splitting up, which is great. The part I am missing is that I would like the string of commands above to finish with my tank (#1 ship) to be highlighted so I can choose where to send that with a left click. So I tried adding "Send {Numpad1}" directly beneath the last Click command above, but it does not have the desired effect at all, it's almost as though I have pressed a tonne of different keys, it's hard to explain.

Please can someone help with this? All I need is a pointer on how to make the command above end with the Numpad 1 key being pressed. No mouseclick after the press.

Please put me out of my misery lol

Thanks in advance!
Rohwedder
Posts: 7645
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Improved on my first attempt, just need one final bit of help

25 Jul 2017, 08:01

Hallo,
try:

Code: Select all

PgDn::Suspend
RButton::
Loop, 4
{
	Key := A_Index + 1 ;Key = 2,3,4,5
	Send {Numpad%Key%}
	Sleep 20
	If GetKeyState("Numpad1","P")
		Break ;No mouseclick after the press
	Click
}
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Ineedhelplz, Shoobis and 85 guests