Help in script Topic is solved

Ask gaming related questions (AHK v1.1 and older)
zanusso
Posts: 19
Joined: 23 Mar 2018, 17:49

Help in script

23 Mar 2018, 18:00

Hello friends of the community, it says 2 scripts where one calls the other, but one of the scripts is with (while) but it is not being called by the other script, and from what I read the [while GetKeyState ("numpad0" be triggered by a person by actually pressing the button. I wonder if I would have any other solution to my problem.
Follow the 2 scripts ..

Code: Select all

numpad2::
MouseGetPos,a,b, xpos,ypos

Loop
{
sleep 4500
Send ^z
sleep 1000
MouseClick, left, 1189, 622
sleep 25000
Send ^z
sleep 1000
sleep 1000
Send {f1}
sleep 500
Send {f8}
sleep 500
Send {f6}
sleep 500
Send {numpad0}
}
return

insert::Exitapp

Code: Select all


#SingleInstance, force
#MaxThreadsPerHotkey, 2

~numpad0:: 
while (GetKeyState("numpad0", "p"))
  { 

loop 3 
  {
           
    PixelSearch, OutputVarX, OutputVarY, 0, 0, 1024, 720, 0x905848, 0, Fast
    If ErrorLevel = 0
     {
	Send, {end}
	Click, %OutputVarX%, %OutputVarY%
	sleep 1000
     }


    PixelSearch, OutputVarX, OutputVarY, 0, 0, 1024, 720, 0xE09818, 0, Fast
    If ErrorLevel = 0
     {
		Send, {end}
		Click, %OutputVarX%, %OutputVarY%
		sleep 1000
     }
     


    PixelSearch, OutputVarX, OutputVarY, 0, 0, 1024, 720, 0x0038D0, 0, Fast
    If ErrorLevel = 0
     {
		Send, {end}
		Click, %OutputVarX%, %OutputVarY%
		sleep 1000
     }
   }
  }
Return
insert::Exitapp

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

Re: Help in script  Topic is solved

24 Mar 2018, 03:50

Hallo,
try:
Script 1 with SendLevel

Code: Select all

numpad2::
MouseGetPos,a,b, xpos,ypos
Loop
{
	sleep 4500
	Send ^z
	sleep 1000
	MouseClick, left, 1189, 622
	sleep 25000
	Send ^z
	sleep 1000
	sleep 1000
	Send {f1}
	sleep 500
	Send {f8}
	sleep 500
	Send {f6}
	sleep 500
	SendLevel 1
	Send {numpad0}
	SendLevel 0
}
return
insert::Exitapp
Script 2 GetKeyState("numpad0") without "P"

Code: Select all

#SingleInstance, force
#MaxThreadsPerHotkey, 2
~numpad0::
while (GetKeyState("numpad0"))
{
	loop 3
	{
		PixelSearch, OutputVarX, OutputVarY, 0, 0, 1024, 720, 0x905848, 0, Fast
		If ErrorLevel = 0
		{
			Send, {end}
			Click, %OutputVarX%, %OutputVarY%
			sleep 1000
		}
		PixelSearch, OutputVarX, OutputVarY, 0, 0, 1024, 720, 0xE09818, 0, Fast
		If ErrorLevel = 0
		{
			Send, {end}
			Click, %OutputVarX%, %OutputVarY%
			sleep 1000
		}
		PixelSearch, OutputVarX, OutputVarY, 0, 0, 1024, 720, 0x0038D0, 0, Fast
		If ErrorLevel = 0
		{
			Send, {end}
			Click, %OutputVarX%, %OutputVarY%
			sleep 1000
		}
	}
}
Return
insert::Exitapp
zanusso
Posts: 19
Joined: 23 Mar 2018, 17:49

Re: Help in script

27 Mar 2018, 02:05

thank you so much
zanusso
Posts: 19
Joined: 23 Mar 2018, 17:49

Re: Help in script

27 Mar 2018, 23:49

Rohwedder wrote:Hallo,
try:
Script 1 with SendLevel

Code: Select all

numpad2::
MouseGetPos,a,b, xpos,ypos
Loop
{
	sleep 4500
	Send ^z
	sleep 1000
	MouseClick, left, 1189, 622
	sleep 25000
	Send ^z
	sleep 1000
	sleep 1000
	Send {f1}
	sleep 500
	Send {f8}
	sleep 500
	Send {f6}
	sleep 500
	SendLevel 1
	Send {numpad0}
	SendLevel 0
}
return
insert::Exitapp
Script 2 GetKeyState("numpad0") without "P"

Code: Select all

#SingleInstance, force
#MaxThreadsPerHotkey, 2
~numpad0::
while (GetKeyState("numpad0"))
{
	loop 3
	{
		PixelSearch, OutputVarX, OutputVarY, 0, 0, 1024, 720, 0x905848, 0, Fast
		If ErrorLevel = 0
		{
			Send, {end}
			Click, %OutputVarX%, %OutputVarY%
			sleep 1000
		}
		PixelSearch, OutputVarX, OutputVarY, 0, 0, 1024, 720, 0xE09818, 0, Fast
		If ErrorLevel = 0
		{
			Send, {end}
			Click, %OutputVarX%, %OutputVarY%
			sleep 1000
		}
		PixelSearch, OutputVarX, OutputVarY, 0, 0, 1024, 720, 0x0038D0, 0, Fast
		If ErrorLevel = 0
		{
			Send, {end}
			Click, %OutputVarX%, %OutputVarY%
			sleep 1000
		}
	}
}
Return
insert::Exitapp

Hello friend, it worked the script using 2 separate scripts, thank you.
Just throw a doubt, if I wanted to use the 2 codes in just one script, would it be possible? if so what would it be necessary to change to work out?

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 51 guests