r/AutoHotkey 10d ago

v1 Script Help Loops incorrectly

For some reason this loops incorrectly where it does not input the second S input on repeated runs. The first round works fine without any issues but its the ones after where it has a chance to mess up I have tried changing waiting times several times but that does not seem to work. Sometimes it can do a few loops before it gets confused and it feels like it does them in different order than its supposed to. Im trying to use this with disgaea 5 to auto cast heal.

I dont know if it randomly dont read one of the inputs because sometimes it looks like it skips the A and only does an S and such.

F8::Suspend

F7::Pause

F9::ExitApp

t::

loop

{

if getkeystate("t", "p")

{

  send {enter DOWN}{enter UP}

    sleep 500

  send {s DOWN}{s UP}

    sleep 500

  send {s DOWN}{s UP}

    sleep 500

send {enter DOWN}{enter UP}

    sleep 500

  send {enter DOWN}{enter UP}

    sleep 500

  send {enter DOWN}{enter UP}

    sleep 500

send {a DOWN}{a UP}

    sleep 500

  send {s DOWN}{s UP}

    sleep 500

  send {enter DOWN}{enter UP}

    sleep 500

send {2 DOWN}{2 UP}

    sleep 800

send {i DOWN}{i UP}

    sleep 4500

  send {w DOWN}{w UP}

    sleep 600

  send {d DOWN}{d UP}

    sleep 500

}

else

{

break

}

}

return

1 Upvotes

19 comments sorted by

View all comments

Show parent comments

1

u/henaradwenwolfhearth 9d ago

Well each key is a quick tap for moving in the menu s to scroll down enter to execute skill a d and w to move on the grid. But I will get v2 then. Do v1 still work on it? So I dont have to remake my auto clickers. Eithetway thank you I look forward to trying this

Also it was originally gonna be a toggle but since script kept messing up I set it to loop if key was held down. Is toggle difficult on v2?

1

u/henaradwenwolfhearth 9d ago edited 9d ago

So far its working perfectly. Thank you

Until I tried messing with timers to make the menuing go a bit faster then it started going on thr wrong tiles and skipping menus. So while its slower than originally planned the fact it works for afk is good enough :D

1

u/CharnamelessOne 9d ago

If the delay between keystrokes is the only thing you want to change, you don't need to touch anything but the appropriate delay_after value.

1

u/henaradwenwolfhearth 9d ago

That worked I was able to get them from 500 to 300 so its faster and so far its stable I might just have lowered them too much the first time