can someone help me fix my code? Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Sahunn
Posts: 4
Joined: 10 May 2021, 12:54

can someone help me fix my code?

12 May 2021, 09:47

can someone help me fix my code? i want it to run the clicks first like 10 times yk then i want it to do d for 3 seconds and then stop D and change it to A for 3 seconds and stop A and then just repeat the whole process. here is my code

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
Gui, Font, S8 CGreen, Verdana
Gui,1:+AlwaysOnTop
Gui, Add, Text, x142 y60 w100 h25 , Start Script By Pressing Windows+I
Gui, Add, Text, x142 y90 w100 h25 , Stop Script By Pressing F1
Gui, Add, Text, x12 y10 w610 h20 , Sahun's Growtopia BFG Script
Gui, Add, Text, x12 y30 w610 h20 , Made by Sahun#5093 <3
Gui, Add, Text, x12 y150 w610 h20 , Paypal: Sahunnn
Gui, Add, Text, x12 y170 w170 h25 , Press Win+I To Start Scripting
Gui, Add, Text, x220 y170 w170 h25 , V1.2
; Gui Made By Sahun
Gui, Show, w260 h200, Sahun's GtScript
#CommentFlag changethefilelocationbelovethisline
F2::Run, D:\Growtopia\Growtopia.exe
return
#i::
loop
{
loop 10
{
#CommentFlag farmables
mouseMove, 912, 1021
click
#CommentFlag place1
mouseMove, 1109, 499
click
sleep, 350
#CommentFlag place2
mouseMove, 1239, 501
click
sleep, 350
#CommentFlag hand
mouseMove, 809, 1017
click
sleep, 350
#CommentFlag place1x22
mouseMove, 1109, 499
click
sleep, 350
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 200
mouseMove, 1109, 499
click
sleep, 350
#CommentFlag place2x22
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 200
mouseMove, 1239, 501
click
sleep, 350
}
Send {d down}
Sleep 300
Send {a down}
return
}
return
F1::
reload
return
[Mod edit: [code][/code] tags added.]
Rohwedder
Posts: 7623
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: can someone help me fix my code?

13 May 2021, 01:43

Hallo,
perhaps ??:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
Gui, Font, S8 CGreen, Verdana
Gui,1:+AlwaysOnTop
Gui, Add, Text, x142 y60 w100 h25 , Start Script By Pressing Windows+I
Gui, Add, Text, x142 y90 w100 h25 , Stop Script By Pressing F1
Gui, Add, Text, x12 y10 w610 h20 , Sahun's Growtopia BFG Script
Gui, Add, Text, x12 y30 w610 h20 , Made by Sahun#5093 <3
Gui, Add, Text, x12 y150 w610 h20 , Paypal: Sahunnn
Gui, Add, Text, x12 y170 w170 h25 , Press Win+I To Start Scripting
Gui, Add, Text, x220 y170 w170 h25 , V1.2
; Gui Made By Sahun
Gui, Show, w260 h200, Sahun's GtScript
; changethefilelocationbelovethisline
F2::Run, D:\Growtopia\Growtopia.exe
return
#i::
loop
{
	loop 10
	{
		; farmables
		click, 912, 1021
		; place1
		click, 1109, 499
		sleep, 350
		; place2
		click, 1239, 501
		sleep, 350
		; hand
		click, 809, 1017
		sleep, 350
		; place1x22
		click, 1109, 499
		sleep, 350
		Loop, 20
		{
			click, 1109, 499
			sleep, 200
		}
		click, 1109, 499
		sleep, 350
		; place2x22
		Loop, 20
		{
			click, 1239, 501
			sleep, 200
		}
		click, 1239, 501
		sleep, 350
	}
	Switch Mod(A_Index, 3) ; = 1,2,0,1,2,0 ...
	{
	Case 0: Send, {w up}
	Case 1: Send, {d down}
	Case 2: Send, {d up}{w down}
	}
}
return
F1::
reload
return
Sahunn
Posts: 4
Joined: 10 May 2021, 12:54

Re: can someone help me fix my code?

14 May 2021, 11:13

Rohwedder only problem with that code is that it does not stop the clicking stuff for the time that its pressing a and d
@Rohwedder
Rohwedder
Posts: 7623
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: can someone help me fix my code?

14 May 2021, 12:23

Then it was a misunderstanding.
I understood your wish as follows:
First clicks without holding down any key, then clicks holding down D, then clicks holding down W, then again without holding any key ...
i want it to run the clicks first like 10 times yk then i want it to do d for 3 seconds
Which does yk mean?
Which does then i want it to do d for 3 seconds mean?
Sahunn
Posts: 4
Joined: 10 May 2021, 12:54

Re: can someone help me fix my code?

15 May 2021, 02:24

@Rohwedder so what i ment was that i wanted the script to start doing the clicks they do it 10 times then the clicks stop and it starts pressing d for 3 seconds then that stops and it starts pressing a for 3 seconds and this whole thing repeats so the clicks 10x again and then the a and d
Rohwedder
Posts: 7623
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: can someone help me fix my code?  Topic is solved

15 May 2021, 02:47

Then:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
Gui, Font, S8 CGreen, Verdana
Gui,1:+AlwaysOnTop
Gui, Add, Text, x142 y60 w100 h25 , Start Script By Pressing Windows+I
Gui, Add, Text, x142 y90 w100 h25 , Stop Script By Pressing F1
Gui, Add, Text, x12 y10 w610 h20 , Sahun's Growtopia BFG Script
Gui, Add, Text, x12 y30 w610 h20 , Made by Sahun#5093 <3
Gui, Add, Text, x12 y150 w610 h20 , Paypal: Sahunnn
Gui, Add, Text, x12 y170 w170 h25 , Press Win+I To Start Scripting
Gui, Add, Text, x220 y170 w170 h25 , V1.2
; Gui Made By Sahun
Gui, Show, w260 h200, Sahun's GtScript
; changethefilelocationbelovethisline
F2::Run, D:\Growtopia\Growtopia.exe
return
#i::
loop
{
	loop 10 ;the script does the clicks they do 10 times 
	{
		; farmables
		click, 912, 1021
		; place1
		click, 1109, 499
		sleep, 350
		; place2
		click, 1239, 501
		sleep, 350
		; hand
		click, 809, 1017
		sleep, 350
		; place1x22
		click, 1109, 499
		sleep, 350
		Loop, 20
		{
			click, 1109, 499
			sleep, 200
		}
		click, 1109, 499
		sleep, 350
		; place2x22
		Loop, 20
		{
			click, 1239, 501
			sleep, 200
		}
		click, 1239, 501
		sleep, 350
	} ;then the clicks stop
	Send, {d Down} ;and it starts pressing d for 3 seconds
	Sleep, 3000
	Send, {d Up} ;then that stops
	Sleep, 200
	Send, {a Down} ;and it starts pressing a for 3 seconds
	Sleep, 3000
	Send, {a Up}	
} ;and this whole thing repeats
return
F1::
reload
return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 74 guests