Code executes but the game doesn't perform action Topic is solved

Ask gaming related questions
Kapsi
Posts: 4
Joined: 23 Mar 2023, 15:14

Code executes but the game doesn't perform action

Post by Kapsi » 23 Mar 2023, 16:23

My son is on a camp right now and he asked me to play his Roblox game for him since there was a event of some kind on there.
It's quite simple he has a simple but effective setup made for himself in the game, where you only need to press E multiple times to refill the shelves in the game without moving.
So I thought this was the perfect motivator for learning AHK finally, so I scrambled something up.
The input works perfectly when I try it on the in-game chat but the game character doesn't refill the shelves / press the button element in the game.
I need it to run in the background since I still need to do some work on the pc.

I'd be grateful if anyone would help me out with this! :D
Code:

Code: Select all

; Set toggle to false initially
toggle := false

; Set the input mode to "Input"
SendMode Input

; Press Alt + R to start/stop spamming the E key
!r::
    toggle := !toggle
    While toggle {
        ControlSend, , e, ahk_exe RobloxPlayerBeta.exe
        Sleep, 500
    }
return

; Press Alt + S to stop the script
!s::
    toggle := false
return

[Mod actions: Topic moved to "[V1] Gaming Help" from "Ask for Help (v2)" since this is for a game and it is v1 code. Fixed code tags which go around the code, not at the top of the post.]
[Mod follow-up: Topic moved to v2 "Gaming" as requested.]

Kapsi
Posts: 4
Joined: 23 Mar 2023, 15:14

Re: Code executes but the game doesn't perform action

Post by Kapsi » 23 Mar 2023, 16:51

I noticed this got moved to "[V1] Gaming Help" from "Ask for Help (v2)
Is the v2 able to fix my problem / get better support?
I didn't know this was v1 code to begin with. I apologize

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

Re: Code executes but the game doesn't perform action

Post by boiler » 23 Mar 2023, 16:55

Either version will be just as effective regarding performance, and you will get support from the community in either place. Since you're new to AHK, I recommend you start with v2. I can move it to the v2 gaming section if you would like to proceed with v2.

Kapsi
Posts: 4
Joined: 23 Mar 2023, 15:14

Re: Code executes but the game doesn't perform action

Post by Kapsi » 23 Mar 2023, 17:10

If you recommend V2 then it shall be that. So yes please move it

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Code executes but the game doesn't perform action  Topic is solved

Post by swagfag » 23 Mar 2023, 19:11

theres no guarantees ControlSend would work on anything(anything beyond win32 controls, that is, since thats what it was originally designed to operate on). if u want to make it work, ull have to try urself in ur game:
it will be easier to just run the game in a vm(eg Windows Sandbox or whathaveyou) and run an ahk script inside it, sending regular Sends and not ControlSends

Kapsi
Posts: 4
Joined: 23 Mar 2023, 15:14

Re: Code executes but the game doesn't perform action

Post by Kapsi » 23 Mar 2023, 21:59

Yea I was actually thinking of running it in Virtualbox. Seems like the easiest answer here. Might still try the stuff mentioned out see if they fix it
swagfag wrote:
23 Mar 2023, 19:11
theres no guarantees ControlSend would work on anything(anything beyond win32 controls, that is, since thats what it was originally designed to operate on). if u want to make it work, ull have to try urself in ur game:
it will be easier to just run the game in a vm(eg Windows Sandbox or whathaveyou) and run an ahk script inside it, sending regular Sends and not ControlSends

Post Reply

Return to “Gaming”