Scrpit stops working after one loop

Ask gaming related questions (AHK v1.1 and older)
suizo
Posts: 1
Joined: 16 May 2022, 13:42

Scrpit stops working after one loop

Post by suizo » 16 May 2022, 13:46

so i dont see why i cant use this scrpit, after 1 Loop the J key gets just pressed once and doesnt get holddown as i need. Can someone pls help me with this

Code: Select all

Menu, Tray, NoIcon

#SingleInstance, force
#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.
DetectHiddenWindows, On
SetTitleMatchMode, 2

keywait, MButton, D
keywait, MButton
mousegetpos, w1mx, w1my, w1id
wingettitle, w1title, ahk_id %w1id%
msgbox,0x1020, , This window's id and title are`nId:`t%w1id%`ntitle:`t%w1title%

Gui,1:
Gui, Add, Edit, x12 y60 w120 h20 vPressA gTime_all,
Gui, Add, Edit, x12 y90 w120 h20 vPressD gTime_all,

Gui, Add, Text, x142 y60 w100 h25 , How long you press A
Gui, Add, Text, x142 y90 w100 h25 , How long you press D
Gui, Add, Text, x142 y120 w100 h25 , Change CLick to J and Sneak to R
Gui, Add, Text, x12 y10 w610 h20 , Sigma
Gui, Add, Text, x230 y10 w610 h20 , V1
Gui, Add, Text, x12 y170 w170 h25 , Press Ctrl + O for auto walk and auto click
; Generated using SmartGUI Creator for SciTE
Gui, Show, w260 h200, Netherward
return

GuiClose:
    ExitApp

Time_all:
Gui, Submit, NoHide
^o::
Loop 
{
    ControlSend,, {j down}, ahk_id %w1id%
    sleep 10
    ControlSend,, {a down}, ahk_id %w1id%
    sleep %PressA%
    ControlSend,, {a up}, ahk_id %w1id%
    sleep 10
    ControlSend,, {d down}, ahk_id %w1id%
    sleep %PressD%
    ControlSend,, {d up}, ahk_id %w1id%
    sleep 50
    ControlSend,, {/}, ahk_id %w1id%
    sleep 100
    ControlSend,, {i Down}, ahk_id %w1id%
    sleep 80
    ControlSend,, {i up}, ahk_id %w1id%
    sleep 80
    ControlSend,, {s Down}, ahk_id %w1id%
    sleep 80
    ControlSend,, {s up}, ahk_id %w1id%
    sleep 80
    ControlSend,, {Enter}, ahk_id %w1id%
    sleep 1500
    ControlSend,, {r down}, ahk_id %w1id%
    sleep 500
    ControlSend,, {r up}, ahk_id %w1id%
    sleep 10
    ControlSend,, {j up}, ahk_id %w1id%
    sleep 10
}
Return

F12:
ExitApp
[Mod edit: [code][/code] tags added.]
Attachments
netherward.ahk
(2.01 KiB) Downloaded 42 times

User avatar
mikeyww
Posts: 26888
Joined: 09 Sep 2014, 18:38

Re: Scrpit stops working after one loop

Post by mikeyww » 16 May 2022, 17:14

Welcome to this AutoHotkey forum!

I will offer a debugging strategy: remove your GUI and your Loop command. Use a test script that has about five lines. These lines will get your HWND and then use a hotkey to send your text to the window. This approach will enable you to pinpoint the problem quickly.

Post Reply

Return to “Gaming Help (v1)”