Help on fixing script

Ask gaming related questions (AHK v1.1 and older)
CeboDeMacho
Posts: 6
Joined: 06 Dec 2022, 11:42

Help on fixing script

Post by CeboDeMacho » 06 Dec 2022, 11:47

Good day to all. I'm new in scripting and i just follow the guides on this site. I made this script out of the guides here but i need some help. I'm currently playing a game where you need to press 1 to 0 in order to cast skills and all. My script is working but the problem is the order of numbers are not being followed. Once activated it randomly activated 1 then 5 then 3 and so forth.

Any help on this is appreciated. I just want it to click numbers 1 to 0 in order.

Here is my script

$F8::
Counter := 1
send 1,2,3,4,5,6,7,8,9,0
sleep 50
return

Thank you in advance :D

User avatar
boiler
Posts: 16930
Joined: 21 Dec 2014, 02:44

Re: Help on fixing script

Post by boiler » 06 Dec 2022, 11:53

Remove all the commas. They identify the separation between parameters (at least before the last parameter). You don’t want to be sending commas anyway, so they shouldn’t be there in any case.

Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help on fixing script

Post by Rohwedder » 06 Dec 2022, 12:17

Hallo,
perhaps?:

Code: Select all

$F8::
Loop, 10
{ ; sends 1,2,3,4,5,6,7,8,9,0
	Send,% Mod(A_Index, 10)
	sleep 50
}
Return

CeboDeMacho
Posts: 6
Joined: 06 Dec 2022, 11:42

Re: Help on fixing script

Post by CeboDeMacho » 06 Dec 2022, 22:47

I tried doing that in this format
1234567890

Or even

1
2
3
4
5
6
7
8
9
0

But it's still clicking random numbers
@boiler

CeboDeMacho
Posts: 6
Joined: 06 Dec 2022, 11:42

Re: Help on fixing script

Post by CeboDeMacho » 06 Dec 2022, 22:49

@Rohwedder
Doesn't the loop will only make it repeat the script by 10 times? Or i maybe wrong. I will still try it. Thank you

Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help on fixing script

Post by Rohwedder » 07 Dec 2022, 01:43

If you don't want a repeat:

Code: Select all

$F8:: ; sends 1,2,3,4,5,6,7,8,9,0,1,2 …
++Counter
Send,% Mod(Counter, 10)
Return

CeboDeMacho
Posts: 6
Joined: 06 Dec 2022, 11:42

Re: Help on fixing script

Post by CeboDeMacho » 07 Dec 2022, 04:34

@Rohwedder
Thank you for the help and it works but somehow it's still doing random numbers. Is there any code that will make it use the numbers in order like 1 , 2 , 3 ,4 ,5 and so forth?

Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help on fixing script

Post by Rohwedder » 07 Dec 2022, 05:25

it's still doing random numbers ???
There is certainly no random command built into this script! Maybe you had pressed the F8 key too long so this hotkey was triggered several times? For testing a Tooltip shows the Counter just sent:

Code: Select all

$F8:: ; sends 1,2,3,4,5,6,7,8,9,0,1,2 …
++Counter
Send,% Counter := Mod(Counter, 10)
ToolTip,% Counter
KeyWait, F8
ToolTip
Return

CeboDeMacho
Posts: 6
Joined: 06 Dec 2022, 11:42

Re: Help on fixing script

Post by CeboDeMacho » 07 Dec 2022, 10:45

@Rohwedder

Yes it still does random numbers. i just pressed it once and it does random starting from 1 then 5 then 6 sometimes it starts with 9 then random again.

Should i just copy and paste every code there or do i need to remove anything?

Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help on fixing script

Post by Rohwedder » 07 Dec 2022, 11:57

Maybe the variable Counter is changed by another part of your script. I have renamed it:

Code: Select all

$F8:: ; sends 1,2,3,4,5,6,7,8,9,0,1,2 …
++F8Counter
Send,% F8Counter := Mod(F8Counter, 10)
ToolTip,% F8Counter
KeyWait, F8
ToolTip
Return

CeboDeMacho
Posts: 6
Joined: 06 Dec 2022, 11:42

Re: Help on fixing script

Post by CeboDeMacho » 08 Dec 2022, 10:19

@Rohwedder
I will try this new code. Thank you once again for your help :)

Post Reply

Return to “Gaming Help (v1)”