Help with dual boxing script...

Ask gaming related questions (AHK v1.1 and older)
Xeokis
Posts: 5
Joined: 19 Apr 2024, 15:15

Help with dual boxing script...

Post by Xeokis » 19 Apr 2024, 15:22

Scenario: 2 Roblox games running 1 from Microsoft store, 1 from the Roblox website. I snap to a 2x2 grid, 1 client going in the top left and 1 going in the top right, my cords are accurate because when I use them by themselves it spams the correct part of the screen in that client, the problem I have is when I use both sets of cords so that it will click the spot on the left client then click the same spot on the right client back and forth it gets through 1 loop, then the left ones stops receiving the click, the right one still receives them just fine and I can not figure out why for the life of me why it will successfully do 1 loop than not repeat it successfully.

Code: Select all

Pause On ;
Loop
{
 CoordMode "Mouse", "Screen"
 Click, 28 58
 Sleep, 200
 Click, 1057 58
 Sleep, 200
}
Return

#z::Pause ; Pause Script
esc::Exitapp ; Exit Script
Any help on getting this to work would be greatly appreciated! thank you


[Mod action: Moved topic to the v1 section since this is primarily v1 code. The main section is for v2.]

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

Re: Help with dual boxing script...

Post by boiler » 19 Apr 2024, 15:30

You posted this in the v2 section, but your code is v1 (with one exception), so it was moved there. You don’t put quotes around the parameters in CoordMode in v1. Without fixing that, it uses the default CoordMode of Window, so you need to fix that before considering what else might be wrong.

Xeokis
Posts: 5
Joined: 19 Apr 2024, 15:15

Re: Help with dual boxing script...

Post by Xeokis » 20 Apr 2024, 15:57

boiler wrote:
19 Apr 2024, 15:30
You posted this in the v2 section, but your code is v1 (with one exception), so it was moved there. You don’t put quotes around the parameters in CoordMode in v1. Without fixing that, it uses the default CoordMode of Window, so you need to fix that before considering what else might be wrong.
Thanks, corrected and now the script will not go outside of the first window, I copied and tested this multiple times without the "" around Mouse and Screen the clicks are stuck inside whatever window it first clicks in. I did find that I am on version 1.1, sorry for posting in the wrong thread.

Code: Select all

Pause On ;
Loop
{
 CoordMode, Mouse, Screen
 Click, 28 58
 Sleep, 2000
 Click, 1057 58
 Sleep, 2000
}
Return

#z::Pause ; Pause Script
esc::Exitapp ; Exit Script

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

Re: Help with dual boxing script...

Post by boiler » 21 Apr 2024, 05:57

How wide is each window?

Xeokis
Posts: 5
Joined: 19 Apr 2024, 15:15

Re: Help with dual boxing script...

Post by Xeokis » 22 Apr 2024, 11:28

boiler wrote:
21 Apr 2024, 05:57
How wide is each window?
Top left corner window shows 1026 x 631 and the top right window shows 1024 x 631 using the snippet method, if there is a better method let me know and I'll use that one.

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

Re: Help with dual boxing script...

Post by boiler » 22 Apr 2024, 13:23

Do you have just one monitor, and does Window Spy show the top-left corner pixel as being screen coordinate (0, 0)? And does it also show the two other locations you want to click as screen coordinates (28, 58) and (1057, 58)? Maybe it's worth attaching a screenshot.

Xeokis
Posts: 5
Joined: 19 Apr 2024, 15:15

Re: Help with dual boxing script...

Post by Xeokis » 23 Apr 2024, 12:33

boiler wrote:
22 Apr 2024, 13:23
Do you have just one monitor, and does Window Spy show the top-left corner pixel as being screen coordinate (0, 0)? And does it also show the two other locations you want to click as screen coordinates (28, 58) and (1057, 58)? Maybe it's worth attaching a screenshot.
Yes 1 monitor and yes the top left corner shows 0,0 in the mouse position screen spot for Window Spy, that is where the numbers in my script came from. The cords work fine and click where they are supposed to if I use them independently.

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

Re: Help with dual boxing script...

Post by boiler » 23 Apr 2024, 13:01

Maybe the first click just activates the window and you have to click again before it registers clicks in the window, as is the case with many applications (MS Excel being one example).

Xeokis
Posts: 5
Joined: 19 Apr 2024, 15:15

Re: Help with dual boxing script...

Post by Xeokis » 25 Apr 2024, 13:36

boiler wrote:
23 Apr 2024, 13:01
Maybe the first click just activates the window and you have to click again before it registers clicks in the window, as is the case with many applications (MS Excel being one example).
Thank you this is what I needed! This seems to have fixed it, again I have no idea why adding the quotes breaks the CoordMode, but it works this way so I don't care LoL

Code: Select all

Pause On ;
Loop
{
 CoordMode, Mouse, Screen
 Click, 28 58 0
 Sleep, 2000
 Click, 28 58 2
 Sleep, 2000
 Click, 1057 58 0
 Sleep, 2000
 Click, 1057 58 2
 Sleep, 2000
}
Return

#z::Pause ; Pause Script
esc::Exitapp ; Exit Script
Thank you everyone for your help!

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

Re: Help with dual boxing script...

Post by boiler » 26 Apr 2024, 15:35

Xeokis wrote: I have no idea why adding the quotes breaks the CoordMode, but it works this way so I don't care LoL
Well, I'll explain it anyway so hopefully you don't have to ask again to fix similar issues in the future: You don't quote literal strings in legacy/command syntax. That's only in expressions. If you want to avoid dealing with the distinction between legacy/expressions, v2 uses expressions only.

Post Reply

Return to “Gaming Help (v1)”