i am too dumb to find out why its in infinite loop

Ask gaming related questions (AHK v1.1 and older)
Cromax
Posts: 22
Joined: 26 Jan 2021, 15:27

i am too dumb to find out why its in infinite loop

Post by Cromax » 07 Feb 2023, 16:17

Code: Select all

$6::
	GoSub, ss
	return
	
	
	ss:
		PixelSearch, FoundX, FoundY, 1116, 1070, 1136, 1091, 0x747474, 10, Fast RGB 
		If (ErrorLevel = 0)
		{	
			
			PixelSearch, FoundX, FoundY, 1175, 1143, 1184, 1152, 0x1B9202, 10, Fast RGB ; 
			{
				
				Send, +{6}
				GoSub, Breakcheck6
			}
			else
			{	
				PixelSearch, FoundX, FoundY, 1112, 1143, 1119, 1150, 0x881112, 10, Fast RGB 
				If (ErrorLevel = 0)
				{	
					Send {6}
					GoSub, Breakcheck6
				}
				else
				{
					PixelSearch, FoundX, FoundY, 1159, 1146, 1185, 1178, 0x761E0E, 10, Fast RGB 
					If (ErrorLevel = 0)
					{	
						
						Send +{6}
						GoSub, Breakcheck6
					}
					else
					{	
						PixelSearch, FoundX, FoundY, 1104, 1142, 1125, 1172, 0xD6E5ED, 10, Fast RGB
						If (ErrorLevel = 0)
						{	
							
							Send, {6}
							GoSub, Breakcheck6
						}
					
						
					}
				}	
			}	
			
		}
		else
		{	
			
			PixelSearch, FoundX, FoundY, 1175, 1143, 1184, 1152, 0x1B9202, 10, Fast RGB 
			If (ErrorLevel = 0)
			{
				
				Send, +{6}
				GoSub, Breakcheck6
			}
			else
			{	
				PixelSearch, FoundX, FoundY, 1112, 1143, 1119, 1150, 0x881112, 10, Fast RGB 
				If (ErrorLevel = 0)
				{	
					Send {6}
					GoSub, Breakcheck6
				}
				else
				{
					
					PixelSearch, FoundX, FoundY, 1159, 1146, 1185, 1178, 0x761E0E, 10, Fast RGB 
					If (ErrorLevel = 0)
					{	
						
						Send +{6}
						GoSub, Breakcheck6
					}
					else
					{	
						
						PixelSearch, FoundX, FoundY, 1104, 1142, 1125, 1172, 0xD6E5ED, 10, Fast RGB 
						{	
							
							Send, {6}
							GoSub, Breakcheck6
							
						}
					}
				}	
			}	
			
			
			
		}
	SetTimer, %A_ThisLabel%, 30
	return
	
	Breakcheck6: ; Provjerava jel 6 stisnut
		
		if (!GetKeyState("6", "P"))
		{	
			
			exit
		}
		Sleep, 100
		
	Return
	
	
	$6 up::
	SetTimer, ss, Off
	return
[Mod edit: [code][/code] tags added.]

If anyone can explain me why ss subroutine ss gets stuck and doesnt register 6 key isnt pressed in breakcheck subroutine ty..

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

Re: i am too dumb to find out why its in infinite loop

Post by boiler » 07 Feb 2023, 16:24

It's not possible to find the logic error in your actual script since the one you posted is not a working script. Need to see what you're actually running.

Cromax
Posts: 22
Joined: 26 Jan 2021, 15:27

Re: i am too dumb to find out why its in infinite loop

Post by Cromax » 07 Feb 2023, 16:42

boiler wrote:
07 Feb 2023, 16:24
It's not possible to find the logic error in your actual script since the one you posted is not a working script. Need to see what you're actually running.
it runs checks on abilities that are off cd and presses them only thing that doesnt work is after each press it doesnt get out of the loop when 6 key isnt pressed..

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

Re: i am too dumb to find out why its in infinite loop

Post by boiler » 07 Feb 2023, 16:50

It does not run. Copy what you posted into a file and run it and see what it does. You have an error in what you posted. You must be somehow running something else.

Cromax
Posts: 22
Joined: 26 Jan 2021, 15:27

Re: i am too dumb to find out why its in infinite loop

Post by Cromax » 07 Feb 2023, 16:59

Code: Select all

#Include D:\My Documents\Autohotkey\Lib\TapHoldManager.ahk
#SingleInstance Force
#NoEnv
#Persistent
#InstallKeybdHook
#InstallMouseHook
#UseHook, On
#MaxThreadsperHotkey 2
#Keyhistory 50

SetTitleMatchMode, 2
DetectHiddenWindows, On
SendMode, Event
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
SetControlDelay 1
SetWinDelay, -1
SetKeyDelay, -1, -1
SetMouseDelay 10
ListLines off
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen
Thread, interrupt, 0

$5::
	GoSub, Prim
	return
	
	
	Prim:
		PixelSearch, FoundX, FoundY, 1092, 1052, 1112, 1069, 0x09E1B5, 10, Fast RGB 
		If (ErrorLevel = 0)
		{	
			Send, {7}
			Send, {f8}
			GoSub, Breakcheck5
		}
		else
		{
			
			PixelSearch, FoundX, FoundY, 1113, 1234, 1124, 1248, 0xF7DF10, 10, Fast RGB 
			If (ErrorLevel = 0)
			{	
				
				
				Send +{6}
				GoSub, Breakcheck5
			}
			else
			{
				
				PixelSearch, FoundX, FoundY, 1372, 1145, 1403, 1192, 0x9A1011, 10, Fast RGB 
				If (ErrorLevel = 0)
				{	
					
					Send, {2}
					GoSub, Breakcheck5
				}
				else
				{
					PixelSearch, FoundX, FoundY, 1273, 1057, 1285, 1064, 0xB54402, 10, Fast RGB
					If (ErrorLevel = 0)
					{

						Send {5}
						GoSub, Breakcheck5
					}
				}
			}	
		}
	SetTimer, %A_ThisLabel%, -30
	Return
	
	Breakcheck5:				
		if (!GetKeyState("5", "P"))
		exit 
		Sleep, 50
	
	Return
	
	
	
	$5 up::
	SetTimer, Prim, Off
	return
this is also one part of it that works and it has same structure i dunno why 6 gets in infinite loop and this doesnt

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

Re: i am too dumb to find out why its in infinite loop

Post by boiler » 07 Feb 2023, 17:05

You have no loop in the last script you posted. You have a SetTimer with a negative number for the period parameter, which runs the routine only once. You have nothing else that would cause it to loop.

Cromax
Posts: 22
Joined: 26 Jan 2021, 15:27

Re: i am too dumb to find out why its in infinite loop

Post by Cromax » 07 Feb 2023, 17:10

boiler wrote:
07 Feb 2023, 17:05
You have no loop in the last script you posted. You have a SetTimer with a negative number for the period parameter, which runs the routine only once. You have nothing else that would cause it to loop.
ok makes sense but why breakcheck doesnt exits timer thread if not pressed even though when you put msgbox inside this if it works

Code: Select all

Breakcheck6: ; Provjerava jel 6 stisnut
		
		if (!GetKeyState("6", "P"))
		{	
			
			exit
		}
		Sleep, 100
		
Return

Cromax
Posts: 22
Joined: 26 Jan 2021, 15:27

Re: i am too dumb to find out why its in infinite loop

Post by Cromax » 07 Feb 2023, 17:20

so how to break set timer loop if key 6 isnt pressed if breakcheck6 obviously doesnt work

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

Re: i am too dumb to find out why its in infinite loop

Post by boiler » 07 Feb 2023, 17:53

Cromax wrote:
07 Feb 2023, 17:20
so how to break set timer loop if key 6 isnt pressed if breakcheck6 obviously doesnt work
You can try turning off the SetTimer in your Breakcheck6 routine.

Like I said, I can't check why the script that you say works isn't doing what you expect when the one you posted is not a working script. It has a mismatched if/else and won't even run, so it's not possible to check your logic when I can't see the script you're running. It doesn't even have a complete working logic, so the only thing I can say about why it doesn't work is that it doesn't even run. If you post a script that runs without producing an error, then I can try to analyze it.

Cromax
Posts: 22
Joined: 26 Jan 2021, 15:27

Re: i am too dumb to find out why its in infinite loop

Post by Cromax » 07 Feb 2023, 18:02

@boiler
wheres mismatch

Cromax
Posts: 22
Joined: 26 Jan 2021, 15:27

Re: i am too dumb to find out why its in infinite loop

Post by Cromax » 07 Feb 2023, 18:05

yeah just put under last pixelsearch If (ErrorLevel = 0) i deleted it accidentally with comment

Cromax
Posts: 22
Joined: 26 Jan 2021, 15:27

Re: i am too dumb to find out why its in infinite loop

Post by Cromax » 07 Feb 2023, 19:19

Code: Select all

#Include D:\My Documents\Autohotkey\Lib\TapHoldManager.ahk
#SingleInstance Force
#NoEnv
#Persistent
#InstallKeybdHook
#InstallMouseHook
#UseHook, On
#MaxThreadsperHotkey 2
#Keyhistory 50

SetTitleMatchMode, 2
DetectHiddenWindows, On
SendMode, Event
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
SetControlDelay 1
SetWinDelay, -1
SetKeyDelay, -1, -1
SetMouseDelay 10
ListLines off
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen
Thread, interrupt, 0


if not A_IsAdmin
{
   Run *RunAs "%A_ScriptFullPath%"  ; Requires v1.0.92.01+
   ExitApp
}


; TapandHold
;----------------------------

thm := new TapHoldManager(250,300,,,"ahk_exe Wow.exe")
thm.Add("+", Func("MyFunc"))
thm.Add("0", Func("Defensive"))
thm.Add("MButton", Func("Tot"))

MyFunc(isHold, taps, state)
{

If(isHold == 0)
{
	if(state == -1)
		{
	
			if (taps == 1)
			{
				Send, +{0}
			} 
			else if (taps == 2)
			{
				Send, +{i}
			}
		}
}
else if(isHold == 1)
{
	if (taps == 1)
		{
			Send, {+}
		}
}

}

Defensive(isHold, taps, state)
{
If(isHold == 0)
{
	if(state == -1)
		{
	
			if (taps == 1)
			{
				Send, {f}
			} 
			else if (taps == 2)
			{
				Send, +{4}
			}
		}
}
else if(isHold == 1)
{
	if (taps == 1)
		{
			Send, {e}
		}
}
}

Tot(isHold, taps, state)
{

If(isHold == 0)
{
	if(state == -1)
		{
	
			if (taps == 1)
			{
				Send, ^{2}
			} 
			else if (taps == 2)
			{
				Send, {'}
			}
		}
}
else if(isHold == 1)
{
	if (taps == 1)
		{
			Send, {f5}
		}
}

}
; TapandHold
;----------------------------





	

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	$f4::
	Send, {s down}
	Gosub, Rot
	return
	
	
	
	$f4 up::
	Send, {s up}
	Gosub, Rot
	return
	
	$4::
	GoSub, wf
	return
	
	
	wf:
	
	PixelSearch, FoundX, FoundY, 1144, 458, 1179, 489, 0xE5D5F2, 10, Fast RGB 
	If (ErrorLevel = 0)
	{	
		
		Send, +{r}
		GoSub, Breakcheck4
	}
	else
	{	
		PixelSearch, FoundX, FoundY, 1096, 458, 1132, 487, 0x5F7661, 10, Fast RGB 
		If (ErrorLevel = 0)
		{	
			
			Send, +{g}
			GoSub, Breakcheck4
			
		}
		else
		{	
			
			PixelSearch, FoundX, FoundY, 1466, 1130, 1530, 1164, 0xF3EEC8, 10, Fast RGB 
			If (ErrorLevel = 1)
			{
				Send, {4}
				GoSub, Breakcheck4
			}
		}
	}			
	SetTimer, %A_ThisLabel%, -30
	Return
	
	Breakcheck4:				; Provjerava jel 4 stisnut
	
		if (!GetKeyState("4", "P"))
		Exit
		sleep, 50
	Return
	
	
	
	$4 up::
	SetTimer, wf, Off
	Return
	
	
	
	$5::
	GoSub, Prim
	return
	
	
	Prim:
		PixelSearch, FoundX, FoundY, 1092, 1052, 1112, 1069, 0x09E1B5, 10, Fast RGB 
		If (ErrorLevel = 0)
		{	
			Send, {7}
			Send, {f8}
			GoSub, Breakcheck5
		}
		else
		{
			
			PixelSearch, FoundX, FoundY, 1113, 1234, 1124, 1248, 0xF7DF10, 10, Fast RGB 
			If (ErrorLevel = 0)
			{	
				
				
				Send +{6}
				GoSub, Breakcheck5
			}
			else
			{
				
				PixelSearch, FoundX, FoundY, 1372, 1145, 1403, 1192, 0x9A1011, 10, Fast RGB 
				If (ErrorLevel = 0)
				{	
					
					Send, {2}
					GoSub, Breakcheck5
				}
				else
				{
					PixelSearch, FoundX, FoundY, 1273, 1057, 1285, 1064, 0xB54402, 10, Fast RGB
					If (ErrorLevel = 0)
					{

						Send {5}
						GoSub, Breakcheck5
					}
				}
			}	
		}
	SetTimer, %A_ThisLabel%, -30
	Return
	
	Breakcheck5:				; Provjerava jel 2 stisnut
	
		if (!GetKeyState("5", "P"))
		exit 
		Sleep, 50
	
	Return
	
	
	
	$5 up::
	SetTimer, Prim, Off
	return
	
	
	$1::
	Send, {a down}
	Gosub, Rot
	return
	
	
	
	$1 up::
	Send, {a up}
	SetTimer, Rot, Off
	return
	
	$2::
	Send, {d down}
	Gosub, Rot
	return
	
	
	$2 up::
	Send, {d up}
	SetTimer, Rot, Off
	return
	
	
	
	
	$3::	
	
	GoSub, Rot
	return
	
	
	
	
	Rot:
		
	PixelSearch, FoundX, FoundY, 1116, 1070, 1136, 1091, 0x747474, 10, Fast RGB
	If (ErrorLevel = 0)
	{
		
		
	/*	GoSub, Breakcheck
		PixelSearch, FoundX, FoundY, 1092, 1052, 1112, 1069, 0x09E1B5, 10, Fast RGB 
		If (ErrorLevel = 0)
		{	
			
			Send, {f8}
		}
		else
		{
	*/		GoSub, Breakcheck
			PixelSearch, FoundX, FoundY, 1196, 1080, 1205, 1087, 0x1A6702, 10, Fast RGB 
			If (ErrorLevel = 0)
			{
						
				
				Send, {3}
				GoSub, Breakcheck		
			}
			else
			{
			
				PixelSearch, FoundX, FoundY, 1381, 1153, 1404, 1168, 0x7B9F0B, 10, Fast RGB 
				If (ErrorLevel = 0)
				{	
											
					Send, {2}
					GoSub, Breakcheck			
				}
				else
				{	
					
					PixelSearch, FoundX, FoundY, 1175, 1143, 1184, 1152, 0x1B9202, 10, Fast RGB 
					If (ErrorLevel = 0)
					{	
						
						Send, +{6}
						GoSub, Breakcheck
					}
					else
					{
						
						PixelSearch, FoundX, FoundY, 1454, 1224, 1474, 1241, 0xD45F31, 8, Fast RGB 
						If (ErrorLevel = 0)
						{	
							
							Send, {q}
							GoSub, Breakcheck	
						}
						else
						{
							
								
								PixelSearch, FoundX, FoundY, 1087, 1204, 1105, 1216, 0x57DEF4, 10, Fast RGB 
								If (ErrorLevel = 0)
								{
									
									Send, {f3}
									GoSub, Breakcheck
								}
								else
								{	
									
									PixelSearch, FoundX, FoundY, 1112, 1143, 1119, 1150, 0x881112, 10, Fast RGB 
									If (ErrorLevel = 0)
									{
										Send {6}
										GoSub, Breakcheck
									}
									else
									{
										
									
										
										PixelSearch, FoundX, FoundY, 1118, 1108, 1158, 1131, 0x3B64AA, 10, Fast RGB 
										If (ErrorLevel = 0)
										{
											
											Send, +{2}
											GoSub, Breakcheck
										}
										else
										{	
											PixelSearch, FoundX, FoundY, 1458, 1228, 1470, 1237, 0x045227, 10, Fast RGB 
											If (ErrorLevel = 0)
											{	
												
												Send, {q}
												GoSub, Breakcheck
											}
											else
											{	
												PixelSearch, FoundX, FoundY, 1376, 1145, 1399, 1158, 0xBDFFFF, 10, Fast RGB 
												If (ErrorLevel = 0)
												{	
																			
													Send, {2}
													GoSub, Breakcheck
												}
												else
												{
												
													
													PixelSearch, FoundX, FoundY, 1104, 1142, 1125, 1172, 0xD6E5ED, 10, Fast RGB 
													If (ErrorLevel = 0)
													{	
														
														Send {6}
														GoSub, Breakcheck
													}
													else
													{	
														
														PixelSearch, FoundX, FoundY, 1159, 1146, 1185, 1178, 0x761E0E, 10, Fast RGB 
														If (ErrorLevel = 0)
														{	
															
															
															Send, +{6}
															GoSub, Breakcheck
														}
														else 
														{	
															
														
																
																PixelSearch, FoundX, FoundY, 1371, 1146, 1410, 1182, 0x0F521B, 10, Fast RGB 
																If (ErrorLevel = 0)
																{	
																	
																	Send, {2}
																	GoSub, Breakcheck
																}
																else
																{	
																	
																	PixelSearch, FoundX, FoundY, 1124, 1102, 1154, 1130, 0x52B1ED, 8, Fast RGB  
																	If (ErrorLevel = 0)
																	{
																		
																		Send, +{2}
																		GoSub, Breakcheck
																	}
																	else
																	{	
																		GoSub, Breakcheck
																		PixelSearch, FoundX, FoundY, 1067, 1080, 1095, 1096, 0x1BC2FD, 10, Fast RGB 
																		If (ErrorLevel = 0)
																		{	
																			
																			Send, {1}
																			GoSub, Breakcheck
																		}
																		else
																		{
																			Send, {3}
																			GoSub, Breakcheck
																		}	
																	}				
																}												
															}
														}
													}
												}
											}	
									}
								}
						}		
					}
				}	
			}
		;}
	}
	
	
	PixelSearch, FoundX, FoundY, 1122, 1068, 1133, 1076, 0x147D0F, 10, Fast RGB 
	If (ErrorLevel = 0)
	{	
			
			GoSub, Breakcheck
			PixelSearch, FoundX, FoundY, 1067, 1080, 1095, 1096, 0x1BC2FD, 10, Fast RGB
			If (ErrorLevel = 0)
			{
				
				Send, {1}
				GoSub, Breakcheck					
			}
			else
			{
		/*		GoSub, Breakcheck
				PixelSearch, FoundX, FoundY, 1092, 1052, 1112, 1069, 0x09E1B5, 10, Fast RGB 
				If (ErrorLevel = 0)
				{	
					
					Send, {f8}
				}
				else
				{	
		*/			
					PixelSearch, FoundX, FoundY, 1196, 1080, 1205, 1087, 0x1A6702, 10, Fast RGB 
					If (ErrorLevel = 0)
					{
						
						Send, {3}
						GoSub, Breakcheck		
								
					}
					else
					{
						PixelSearch, FoundX, FoundY, 1372, 1145, 1403, 1192, 0x9A1011, 10, Fast RGB 
						If (ErrorLevel = 0)
						{	
													
							Send, {2}
							GoSub, Breakcheck			
						}
						else
						{
							
							PixelSearch, FoundX, FoundY, 1454, 1224, 1474, 1241, 0xD45F31, 10, Fast RGB 
							If (ErrorLevel = 0)
							{	
								
								Send, {q}
								GoSub, Breakcheck	
							}
							else
							{
						
							
								
								PixelSearch, FoundX, FoundY, 1113, 1234, 1124, 1248, 0xF7DF10, 10, Fast RGB 
								If (ErrorLevel = 0)
								{	
									
									
									Send +{6}
									GoSub, Breakcheck
								}
								else
								{
									
									PixelSearch, FoundX, FoundY, 1087, 1204, 1105, 1216, 0x57DEF4, 10, Fast RGB 
									If (ErrorLevel = 0)
									{
										
										Send, {f3}
										GoSub, Breakcheck
									}
									else
									{	
										
										
										PixelSearch, FoundX, FoundY, 1118, 1108, 1158, 1131, 0x3B64AA, 10, Fast RGB
										If (ErrorLevel = 0)
										{
											
											Send, +{2}
											GoSub, Breakcheck
										}
										else
										{		
											
											
											PixelSearch, FoundX, FoundY, 1175, 1143, 1184, 1152, 0x1B9202, 10, Fast RGB 
											If (ErrorLevel = 0)
											{	
												
												Send, +{6}
												GoSub, Breakcheck
											}
											else
											{	
												
												PixelSearch, FoundX, FoundY, 1112, 1143, 1119, 1150, 0x881112, 10, Fast RGB 
												If (ErrorLevel = 0)
												{
													Send {6}
													GoSub, Breakcheck
												}
												else
												{
													GoSub, Breakcheck
													PixelSearch, FoundX, FoundY, 1458, 1228, 1470, 1237, 0x045227, 10, Fast RGB 
													If (ErrorLevel = 0)
													{	
														
														Send, {q}
														
													}
													else
													{
														
														PixelSearch, FoundX, FoundY, 1408, 1101, 1433, 1120, 0x2377C6, 10, Fast RGB 
														If (ErrorLevel = 0)
														{	
															
															Send, +{3}
															GoSub, Breakcheck
														}
														else
														{
															
															PixelSearch, FoundX, FoundY, 1104, 1142, 1125, 1172, 0xD6E5ED, 10, Fast RGB 
															If (ErrorLevel = 0)
															{
																
																Send, {6}
																GoSub, Breakcheck
															}
															else 
															{				
																PixelSearch, FoundX, FoundY, 1159, 1146, 1185, 1178, 0x761E0E, 10, Fast RGB 
																If (ErrorLevel = 0)
																{
																	
																	Send +{6}
																	GoSub, Breakcheck
																}
																else
																{	
															
															
																		
																	PixelSearch, FoundX, FoundY, 1408, 1099, 1435, 1132, 0x054807, 10, Fast RGB 
																	If (ErrorLevel = 0)
																	{	
																		
																		Send, +{3}
																		GoSub, Breakcheck
																	}
																	else
																	{
																		
																		
																		PixelSearch, FoundX, FoundY, 1124, 1102, 1154, 1130, 0x52B1ED, 8, Fast RGB 
																		If (ErrorLevel = 0)
																		{
																			
																			Send, +{2}
																			GoSub, Breakcheck	
																		}
																		else
																		{
																			Send, {3}
																			GoSub, Breakcheck
																		}
																		
																	}
																}	
															}
														}
													}
												}	
											}
										}	
									
									}
								}
							}		
						}
				;}	
				
			}
		}
		
	}
	
	PixelSearch, FoundX, FoundY, 1121, 1069, 1133, 1080, 0x017ED8, 5, Fast RGB 
	If (ErrorLevel = 0)
	{	
			
			GoSub, Breakcheck
			PixelSearch, FoundX, FoundY, 1067, 1080, 1095, 1096, 0x1BC2FD, 10, Fast RGB 
			If (ErrorLevel = 0)
			{
				
				Send, {1}
				GoSub, Breakcheck					
			}
			else
			{
		/*		GoSub, Breakcheck
				PixelSearch, FoundX, FoundY, 1092, 1052, 1112, 1069, 0x09E1B5, 10, Fast RGB 
				{	
					
					Send, {f8}
				}
				else
				{	
		*/			PixelSearch, FoundX, FoundY, 1196, 1080, 1205, 1087, 0x1A6702, 10, Fast RGB 
					If (ErrorLevel = 0)
					{
						
						Send, {3}
						GoSub, Breakcheck		
					}
					else
					{
						PixelSearch, FoundX, FoundY, 1372, 1145, 1403, 1192, 0x9A1011, 10, Fast RGB 
						If (ErrorLevel = 0)
						{	
													
							Send, {2}
							GoSub, Breakcheck			
						}
						else
						{
							
							
							
							PixelSearch, FoundX, FoundY, 1408, 1101, 1433, 1120, 0x2377C6, 10, Fast RGB 
							If (ErrorLevel = 0)
							{	
								
								Send, +{3}
								GoSub, Breakcheck
							}
							else
							{
							
								
								PixelSearch, FoundX, FoundY, 1113, 1234, 1124, 1248, 0xF7DF10, 10, Fast RGB 
								If (ErrorLevel = 0)
								{	
									
									Send +{6}
									GoSub, Breakcheck
								}
								else
								{
									GoSub, Breakcheck
									PixelSearch, FoundX, FoundY, 1087, 1204, 1105, 1216, 0x57DEF4, 10, Fast RGB 
									If (ErrorLevel = 0)
									{
										
										Send, {f3}
										GoSub, Breakcheck
									}
									else
									{	
										
										
										PixelSearch, FoundX, FoundY, 1118, 1108, 1158, 1131, 0x3B64AA, 10, Fast RGB 
										If (ErrorLevel = 0)
										{
											
											Send, +{2}
											GoSub, Breakcheck
										}
										else
										{		
											
											
											PixelSearch, FoundX, FoundY, 1175, 1143, 1184, 1152, 0x1B9202, 10, Fast RGB 
											If (ErrorLevel = 0)
											{	
												
												
												Send, +{6}
												GoSub, Breakcheck
											}
											else
											{	
												
												PixelSearch, FoundX, FoundY, 1112, 1143, 1119, 1150, 0x881112, 10, Fast RGB 
												If (ErrorLevel = 0)
												{
													Send {6}
													GoSub, Breakcheck
												}
												else
												{
													
													PixelSearch, FoundX, FoundY, 1104, 1142, 1125, 1172, 0xD6E5ED, 10, Fast RGB 
													If (ErrorLevel = 0)
													{
														
														Send, {6}
														GoSub, Breakcheck
													}
													else 
													{				
														PixelSearch, FoundX, FoundY, 1159, 1146, 1185, 1178, 0x761E0E, 10, Fast RGB 
														If (ErrorLevel = 0)
														{
															
															Send +{6}
															GoSub, Breakcheck
														}
														else
														{	
															
															
															PixelSearch, FoundX, FoundY, 1458, 1228, 1470, 1237, 0x045227, 10, Fast RGB 
															If (ErrorLevel = 0)
															{	
																
																Send, {q}
																GoSub, Breakcheck
															}
															else
															{
																	
																PixelSearch, FoundX, FoundY, 1408, 1099, 1435, 1132, 0x054807, 10, Fast RGB 
																If (ErrorLevel = 0)
																{	
																	
																	Send, +{3}
																	GoSub, Breakcheck
																}
																else
																{
																	
																	
																	PixelSearch, FoundX, FoundY, 1124, 1102, 1154, 1130, 0x52B1ED, 8, Fast RGB 
																	If (ErrorLevel = 0)
																	{
																		
																		Send, +{2}
																		GoSub, Breakcheck	
																	}
																	else
																	{
																		
																		Send, {3}
																		GoSub, Breakcheck
																	}
																	
																}
															}	
														}
														
													}
												}
											}	
										}
									}	
									
								}
							}
						}		
						
				;}	
				
			}
		}
		
	}
	SetTimer, %A_ThisLabel%, 30
	return
	
	Breakcheck:
	    
		   if ((!GetKeyState("1", "P")) && (!GetKeyState("2", "P")) && (!GetKeyState("3", "P")) && (!GetKeyState("f4", "P")))
			 { 
				 exit 
			 
			 }
		  
		   
	   
    return

	
	
	
	$3 up::
	SetTimer, Rot, Off
	return
	
	
	
	
	$6::
	GoSub, ss
	return
	
	
	ss:
		PixelSearch, FoundX, FoundY, 1116, 1070, 1136, 1091, 0x747474, 10, Fast RGB 
		If (ErrorLevel = 0)
		{	
			
			PixelSearch, FoundX, FoundY, 1175, 1143, 1184, 1152, 0x1B9202, 10, Fast RGB 
			If (ErrorLevel = 0)
			{
				
				Send, +{6}
				GoSub, Breakcheck6
			}
			else
			{	
				PixelSearch, FoundX, FoundY, 1112, 1143, 1119, 1150, 0x881112, 10, Fast RGB 
				If (ErrorLevel = 0)
				{	
					Send {6}
					GoSub, Breakcheck6
				}
				else
				{
					PixelSearch, FoundX, FoundY, 1159, 1146, 1185, 1178, 0x761E0E, 10, Fast RGB 
					If (ErrorLevel = 0)
					{	
						
						Send +{6}
						GoSub, Breakcheck6
					}
					else
					{	
						PixelSearch, FoundX, FoundY, 1104, 1142, 1125, 1172, 0xD6E5ED, 10, Fast RGB 
						If (ErrorLevel = 0)
						{	
							
							Send, {6}
							GoSub, Breakcheck6
						}
					
						
					}
				}	
			}	
			
		}
		else
		{	
			
			PixelSearch, FoundX, FoundY, 1175, 1143, 1184, 1152, 0x1B9202, 10, Fast RGB 
			If (ErrorLevel = 0)
			{
				
				Send, +{6}
				GoSub, Breakcheck6
			}
			else
			{	
				PixelSearch, FoundX, FoundY, 1112, 1143, 1119, 1150, 0x881112, 10, Fast RGB 
				If (ErrorLevel = 0)
				{	
					Send {6}
					GoSub, Breakcheck6
				}
				else
				{
					
					PixelSearch, FoundX, FoundY, 1159, 1146, 1185, 1178, 0x761E0E, 10, Fast RGB 
					If (ErrorLevel = 0)
					{	
						
						Send +{6}
						GoSub, Breakcheck6
					}
					else
					{	
						
						PixelSearch, FoundX, FoundY, 1104, 1142, 1125, 1172, 0xD6E5ED, 10, Fast RGB 
						If (ErrorLevel = 0)
						{	
							
							Send, {6}
							GoSub, Breakcheck6
							
						}
					}
				}	
			}	
			
			
			
		}
	SetTimer, %A_ThisLabel%, 30
	return
	
	Breakcheck6: ; Provjerava jel 6 stisnut
		
		if (!GetKeyState("6", "P"))
		{	
			exit
		}
		Sleep, 100
		
	Return
	
	
	$6 up::
	SetTimer, ss, Off
	return
	
	
	
	$7::
	loop
	{
	    while (GetKeyState("7", "P"))
	    {
		   Send, {7}
		   
		   Send, {r}
		   
		   Send, {f7}
		   
	    }
	    if (!GetKeyState("7", "P"))  
	    {
		   break
	    }
	    Sleep, 100
	}
	return
	
	
	
	
	$7 up::
	
	return
	
	~WheelDown::
	Send, {e}
	Send, {f}
	Send, {t}
	Send, {0}
	return
	
	$9::
	GoSub, Def
	return
	
	
	
	Def: 
	PixelSearch, FoundX, FoundY, 1245, 1197, 1271, 1224, 0x730712, 10, Fast RGB 
	If (ErrorLevel = 0) 
	{	
		Send, {9)
		Send, +{4}
		Send, +{e}
		Sleep, 50
		Send, {e)
		Send, {f)
 		Send, {t}
		GoSub, Breakcheck9
	}
	else        	
	{	
		;PixelSearch, FoundX, FoundY, 1147, 1060, 1164, 1080, 0xB9A247, 10, Fast RGB 
		;If (ErrorLevel = 0)
		;{	
			
			PixelSearch, FoundX, FoundY, 1235, 1191, 1267, 1207, 0xDEBB11, 10, Fast RGB
			If (ErrorLevel = 0)
			{	
				Send, {t}
				Send, {e}
				Send, {f)
				Send, {9)
				GoSub, Breakcheck9	
			}
			else
			{	
				Send, {t}
				Sleep, 50
				Send, {9)
				GoSub, Breakcheck9
			}
			
		;}
		;else
		;{
			;Send, ^{f}
			
			
		;}
		
		
	}
	SetTimer, %A_ThisLabel%, 30
	Return
	Breakcheck9:
	if (!GetKeyState("9", "P"))
		{
			exit
		}
		sleep, 100
	return
	
	
	$9 up::
	SetTimer, Def, Off
	return
	
+!s::Suspend, Toggle
this is whole script if you can fix breakcheck subroutines that script doesnt register i would appreciate it

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

Re: i am too dumb to find out why its in infinite loop

Post by boiler » 07 Feb 2023, 19:58

Whoa, now it's over 1000 lines. You were on the right track in trying to make a shorter script that isolates the issue. It just has to be a working script. It should be as short of a script as possible that demonstrates what you think should work but doesn't. And it should stand on its own without outside scripts needed to be included and such.

Cromax
Posts: 22
Joined: 26 Jan 2021, 15:27

Re: i am too dumb to find out why its in infinite loop

Post by Cromax » 07 Feb 2023, 20:16

y i think i found culprit not enough breakchecks before initial 2 pixelsearch

Post Reply

Return to “Gaming Help (v1)”