click coordinates in a certain order Topic is solved

Ask gaming related questions (AHK v1.1 and older)
lewis100a5
Posts: 5
Joined: 22 May 2022, 21:24

click coordinates in a certain order

Post by lewis100a5 » 22 May 2022, 21:26

Need help with making a ahk code cracker that sends the mouse to a buttons coordinates and then clicks.
This is for a 4 digit keypad which ONLY accepts mouseclicks

the coordinates of the buttons are:

button1 = 808,376
button2 = 964,377
button3 = 1109,381
button4 = 807,502
button5 = 947,500
button6 = 1108,498
button7 = 800,640
button8 = 949,635
button9 = 1093,619
button0 = 942,739
buttonsend = 1104,761



I tried to put them in variables and create a loop but I was unsuccessful.
Last edited by gregster on 23 May 2022, 02:03, edited 1 time in total.
Reason: Changed topic name to sth more adequate.

gregster
Posts: 8921
Joined: 30 Sep 2013, 06:48

Re: code cracker (mouse)

Post by gregster » 22 May 2022, 22:39

"code cracker" sounds rather malicious and not like something that would conform to our forum rules and forum spirit. (Note: originally, this wasn't posted in the Gaming subsection - I just moved it under a certain assumption.)
On the other hand, it seems like a rather trivial task. Nevertheless, we might have to close this topic.
@lewis100a5, please elaborate if you think that this doesn't break the forum rules.

lewis100a5
Posts: 5
Joined: 22 May 2022, 21:24

Re: code cracker (mouse)

Post by lewis100a5 » 22 May 2022, 22:52

@gregster

I basically want something like this but instead of inputing text i want clicks. I want this script for a game

viewtopic.php?t=69926

there are numerous topics like mines already


This idea for this script is not on the basis of intending to do any harm

gregster
Posts: 8921
Joined: 30 Sep 2013, 06:48

Re: code cracker (mouse)

Post by gregster » 22 May 2022, 23:00

You should rather tell us what this is for exactly.

That there are other similarly trivial topics is not a justification (along with the fact that our standards might have evolved over time). If you want to use that already posted info, that is your personal choice and responsibility.
But if we actively support your specific request will depend on your actual goal.

Edit: I see that you edited your last post. So for which game is it? Could you post a screenshot and provide more details?

lewis100a5
Posts: 5
Joined: 22 May 2022, 21:24

Re: code cracker (mouse)

Post by lewis100a5 » 22 May 2022, 23:06

Image
gmod

User avatar
Xtra
Posts: 2744
Joined: 02 Oct 2015, 12:15

Re: code cracker (mouse)  Topic is solved

Post by Xtra » 22 May 2022, 23:25

Code: Select all

#NoEnv
SetWorkingDir, %A_ScriptDir%
CoordMode, Mouse, Screen

keypad := {0:{x:942,y:739}
          ,1:{x:808,y:376}
          ,2:{x:964,y:377}
          ,3:{x:1109,y:381}
          ,4:{x:807,y:502}
          ,5:{x:947,y:500}
          ,6:{x:1108,y:498}
          ,7:{x:800,y:640}
          ,8:{x:949,y:635}
          ,9:{x:1093,y:619}
	   ,Send:{x:1104,y:761}}

; <<< Add hotkey here if you like

Loop, 9999
{
	n := SubStr(000 . A_Index, -3)
	Loop, Parse, n
	{
		MouseClick, Left, keypad[A_LoopField].x, keypad[A_LoopField].y
		Sleep 100
	}
	MouseClick, Left, keypad["Send"].x, keypad["Send"].y
}

return
Should be enough to get you started.

lewis100a5
Posts: 5
Joined: 22 May 2022, 21:24

Re: code cracker (mouse)

Post by lewis100a5 » 22 May 2022, 23:45

Xtra wrote:
22 May 2022, 23:25

Code: Select all

#NoEnv
SetWorkingDir, %A_ScriptDir%
CoordMode, Mouse, Screen

keypad := {0:{x:942,y:739}
          ,1:{x:808,y:376}
          ,2:{x:964,y:377}
          ,3:{x:1109,y:381}
          ,4:{x:807,y:502}
          ,5:{x:947,y:500}
          ,6:{x:1108,y:498}
          ,7:{x:800,y:640}
          ,8:{x:949,y:635}
          ,9:{x:1093,y:619}
	   ,Send:{x:1104,y:761}}

; <<< Add hotkey here if you like

Loop, 9999
{
	n := SubStr(000 . A_Index, -3)
	Loop, Parse, n
	{
		MouseClick, Left, keypad[A_LoopField].x, keypad[A_LoopField].y
		Sleep 100
	}
	MouseClick, Left, keypad["Send"].x, keypad["Send"].y
}

return
Should be enough to get you started.

Hey man I appreciate the reply and your help however I need the script to input 0001 (send) all the way up to 9999


Edit:
I managed to get it working thank you so much but when I try to make the script faster (had to increase sleep time due to it making my camera go behind me xd) it only does 3 clicks
for example: 300(send) - This seems to happen when the script needs to press the same number on the keypad twice


When i try to set the script to start the count from 3000 it resets to 0000 once the number reaches double digits

User avatar
Xtra
Posts: 2744
Joined: 02 Oct 2015, 12:15

Re: code cracker (mouse)

Post by Xtra » 23 May 2022, 00:55

If you make changes and then something does not work post the script with changes you made.

This should show how to start at the number you choose.

Code: Select all

#NoEnv
SetWorkingDir, %A_ScriptDir%
CoordMode, Mouse, Screen

keypad := {0:{x:942,y:739}
          ,1:{x:808,y:376}
          ,2:{x:964,y:377}
          ,3:{x:1109,y:381}
          ,4:{x:807,y:502}
          ,5:{x:947,y:500}
          ,6:{x:1108,y:498}
          ,7:{x:800,y:640}
          ,8:{x:949,y:635}
          ,9:{x:1093,y:619}
	   ,Send:{x:1104,y:761}}

; Add hotkey here if you like

startNumber := 3000    ; Change to the number you want to start with

Loop % 9999 - startNumber
{
	n := SubStr(000 . startNumber++, -3)
	Loop, Parse, n
	{
		MouseClick, Left, keypad[A_LoopField].x, keypad[A_LoopField].y
		Sleep 100
	}
	MouseClick, Left, keypad["Send"].x, keypad["Send"].y
	Sleep 100
}

return

lewis100a5
Posts: 5
Joined: 22 May 2022, 21:24

Re: code cracker (mouse)

Post by lewis100a5 » 23 May 2022, 01:01

@Xtra

Code: Select all

Loop, 9999
{
	n := SubStr(000 . A_Index,-3)
	Loop, Parse, n
	{
    send e
    sleep 100
		MouseClick, Left, keypad[A_LoopField].x, keypad[A_LoopField].y,1,0
	}
	MouseClick, Left, keypad["Send"].x, keypad["Send"].y,1,0
  send e
}

return

for example, if two zero's need to be inputted it only sends one

so when the script is meant to enter 3011 it just enters 301

edit: the input error is actually due to the game limiting how fast you can press the buttons on keypad, i'll try find the sweet spot
so in saying that... The script works perfectly thank you very much

Post Reply

Return to “Gaming Help (v1)”