Help with a Macro please

Ask gaming related questions (AHK v1.1 and older)
Lithrys
Posts: 1
Joined: 07 Jan 2016, 22:31

Help with a Macro please

07 Jan 2016, 23:30

Hey there,

I haven't messed with any programs like this in quite a few years. I just recently started tinkering with AutoKeyText and have run into a minor problem that I would really appreciate some help with. I play an older game from the late 90's called Faldon. The script i'm useing is

^j::
Loop {
SetKeyDelay , 200, 200
Send, S Pets fetch{ENTER}
Send {1 5}
}
Pause::Pause

The issue I am having is that I can not seem to get the script to Pause or even stop. I have tried several different commands and placed them in several different positions. Ex- ExitApp, Exit, Break, Pause. No matter what I try though the script just continues to run on so I end up having to either task manager nuke it or just restart depending on how i tweak the keydelay. If someone could do an edit on this for meh please I would much appreciate it.

I am also trying to get another macro script for this game, that would use the arrow keys,
2 movements downwards, delay, 2 movements downwards, Right click, delay, 2 movements downward, delay
2 movements upwards, delay, Right Click, 2 movements upwards, delay, 2 movements upwards delay, Right Click,

Wanting it to spam Control throughout the entire thing or would that interfere with the keystroke commands? (Control button is the auto attack for this game.) Does Control need to be worked into the command keystrokes like ex-
2 movements downwards,
{Control, 15}
Or can it be macro'd at a faster rate than the movement script without affecting it?
Wanting it looped infinite so that I have to use a hotkey to stop it.
Will I need to add in mouse location for the right click into this? or can i have it just do a rightclick command with my mouse set at a specific point?

Thank you in advance too anyone who can & will help meh with this.

Much appreciated,

Lithrys
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Help with a Macro please

08 Jan 2016, 06:01

Code: Select all

SetKeyDelay , 200, 200 ; SetKeydelay only needs to be declared once.
macro_on := 0

^j::
macro_on := 1
Loop {
Send, S Pets fetch{ENTER}
Send {1 5}
Sleep 100 ; Put a sleep in the loop else it will use lots of CPU
if (!macro_on)
   break
}
return

Pause::
   macro_on := 0
   return
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: Help with a Macro please

08 Jan 2016, 09:40

This is untested, but I believe it will do what you want...

Code: Select all

SetKeyDelay, 20, 20    ; Your original delay of 200 is likely much higher than needed, although 20 may be too short.
PetFetch := False
AutoAttack := False
AutoMove := False

^j::
PetFetch := !PetFetch    ; Toggles true/false
SetTimer, DoPetFetch, -1
Return

^k::
AutoAttack := !AutoAttack
SetTimer, DoAutoAttack, -1
Return

^l::
AutoMove := !AutoMove
SetTimer, DoAutoMove, -1
Return

Pause::Pause    ; Pause key will disable the hotkeys, without affecting any active loops.
^Pause::Suspend    ; Ctrl+Pause will suspend any active loops.

DoPetFetch:
While PetFetch
{
	Send, S pets fetch{Enter}
	Send {1 5}
	Sleep 10
}
Return

DoAutoAttack:
While AutoAttack
{
	Send {Ctrl}
	Sleep 10
}
Return

DoAutoMove:
; Note: This will right-click whereever your mouse happens to be.
; If you would prefer it to click a specific location, simply replace
; "{Click Right}" with "{Click Right X, Y}" where X & Y are the coordinates
; you want to click.
While AutoMove
{
	Send {Down 2}
	Sleep 10    ; Adjust these sleep commands as needed.
	Send {Down 2}{Click Right}
	Sleep 10
	Send {Down 2}
	Sleep 10
	Send {Up 2}
	Sleep 10
	Send {Click Right}{Up 2}
	Sleep 10
	Send {Up 2}
	Sleep 10
	Send {Click Right}
	Sleep 10
}
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Stpham and 66 guests