Help With Caveman loop stop Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Help With Caveman loop stop

21 Feb 2018, 05:54

I´m trying to stop a loop from jumbling variable indexes and running while its subs do not finish.
I fixed the variable problem with a variable translation.
I partially fixed the subs running over each other with a msgbox. Wouldn´t help with subsequent subs called by the sub. Those would jumble with the loop subs.
I ended up with this:

Code: Select all


TC:=1
	Loop, %HotKeyLimit%
		{
			If (Hkey%TC%Toggle = 1) {
				If (HKey%TC%Type1 = 1) {
					Hk:= TC
					T1ConfigTrigger:= 0
					Gosub ConfigType1
					Sleep, 200
						If T1ConfigTrigger:= 1 {
							Continue
					Msgbox , 0,Hotkey %Hk%, Hotkey %Hk%`nType 1`nReady to Continue?
							If (HKey%TC%Type2 = 1) {
								Hk:= TC
								T2ConfigTrigger:= 0
								Gosub ConfigType2
								Sleep, 200
									If T2ConfigTrigger:= 1 {
										Continue
								Msgbox , 0,Hotkey %Hk%, Hotkey %Hk% Type 2`nReady to Continue?
										If (HKey%TC%Type3 = 1) {
											Hk:= TC
											T2ConfigTrigger:= 0
											Gosub ConfigType2
											Sleep, 200
												If T2ConfigTrigger:= 1 {
													Continue
											Msgbox , 0,Hotkey %Hk%, Hotkey %Hk% Type 3`nReady to Continue?
													If (HKey%TC%Type4 = 1) {
														Hk:= TC
														T3ConfigTrigger:= 0
														Gosub ConfigType3
														Sleep, 200
															If T3ConfigTrigger:= 1 {
																Continue
														Msgbox , 0,Hotkey %Hk%, Hotkey %Hk% Type 4`nReady to Continue?
																If (HKey%TC%Type5 = 1) {
																	Hk:= TC
																	T4ConfigTrigger:= 0
																	Gosub ConfigType4
																	Sleep, 200
																		If T4ConfigTrigger:= 1 {
																			Continue
																	Msgbox , 0,Hotkey %Hk%, Hotkey %Hk% Type 5`nReady to Continue?
																			If (HKey%TC%Type6 = 1) {
																				Hk:= TC
																				T5ConfigTrigger:= 0
																				Gosub ConfigType5
																				Sleep, 200
																					If T5ConfigTrigger:= 1 {
																						Continue
																				Msgbox , 0,Hotkey %Hk%, Hotkey %Hk% Type 6`nReady to Continue?
																						If (HKey%TC%Type7 = 1) {
																							Hk:= TC
																							T6ConfigTrigger:= 0
																							Gosub ConfigType6
																							Sleep, 200
																								If T6ConfigTrigger:= 1 {
																									Continue
																							Msgbox , 0,Hotkey %Hk%, Hotkey %Hk% Type 7`nReady to Continue?
																								}
																						}
																					}
																			}
																		}
																}
															}
													}
												}
										}
									}
							}
						}
				}
			}
		TC+=1
		}
Return
Does anyone want to share a civilized approach to this?
Thanks for the attention and regards
Rohwedder
Posts: 7616
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help With Caveman loop stop  Topic is solved

22 Feb 2018, 13:59

Hallo,
you have a problem.
Each of your "Continue" commands
causes the loop to start over before it reaches one of your MsgBoxes!
Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: Help With Caveman loop stop

22 Feb 2018, 17:44

Hey!
Thanks for the reply!
Yeah I forgot to remove the messageboxes!
I was using them to try to stop the loop but I found another solution.
I realized there could be only one type per hotkey so I used the first sub to Break, then the last sub of the sub sequence add index to the loop count variable and restart the loop :)
Thanks again for the Reply!
Regards

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 41 guests