Broken Loop

Advanced Macro Recorder/Editor.

Moderator: Pulover

DemonGamingLP
Posts: 6
Joined: 16 Apr 2021, 18:40

Broken Loop

Post by DemonGamingLP » 16 Apr 2021, 19:09

Code: Select all

[PMC Globals]|None||
[PMC Code v5.4.0]|F5||0|Window,2,Fast,0,1,InputThenPlay,-1,-1,1|1|AdvMHRebirth
Context=None|
Groups=Start:1
1|WinActivate||1|0|WinActivate|||||1|
2|[Pause]||1|5000|Sleep|||||2|
3|Left Move & Click|1419, 282 Left, 1|1|10|Click|||||3|
4|[LoopStart]|LoopStart|0|0|Loop|||||5|
5|Continue, Continue, FoundX, FoundY|956, 593, 957, 594, 0x34FF6D, 0, Fast RGB|1|0|PixelSearch|UntilFound|Window|||7|
6|[Pause]||1|1500|Sleep|||||13|
7|Left Move & Click|1068, 589 Left, 1|1|0|Click|||||14|
8|[Pause]||1|500|Sleep|||||15|
9|[Label]|Fail1|1|0|Label|||||16|
10|Move|1448, 139, 0|1|0|Click|||||17|
11|[Pause]||1|750|Sleep|||||18|
12|Continue, Continue, FoundX, FoundY|958, 582, 965, 589, 0xFF3459, 0, Fast RGB|1|0|PixelSearch||Window|||19|
13|If Image/Pixel Found||1|0|If_Statement|||||21|
14|Left Move & Click|1068, 589 Left, 1|1|0|Click|||||23|
15|[Pause]||1|3500|Sleep|||||24|
16|[Goto]|Fail1|1|0|Goto|||||25|
17|[Else]|Else|1|0|If_Statement|||||26|
18|[Goto]|Success1|1|0|Goto|||||29|
19|[End If]|EndIf|1|0|If_Statement|||||30|
20|[Label]|Success1|1|0|Label|||||31|
21|[Pause]||1|1500|Sleep|||||32|
22|[Label]|RepeatL|1|0|Label|||||33|
23|[Text]|l|1|0|SendRaw|||||34|
24|[Pause]||1|1000|Sleep|||||35|
25|Continue, Continue, FoundX, FoundY|1153, 711, 1184, 723, 0x59FF7A, 0, Fast RGB|1|0|PixelSearch||Window|||36|
26|If Image/Pixel Found||1|0|If_Statement|||||38|
27|Left Move & Click|1206, 715 Left, 1|1|0|Click|||||40|
28|[Pause]||1|6000|Sleep|||||41|
29|Continue, Continue, FoundX, FoundY|1155, 711, 1180, 721, 0xFFBA2E, 0, Fast RGB|1|0|PixelSearch||Window|||42|
30|If Image/Pixel Found||1|0|If_Statement|||||44|
31|[Goto]|Success2|1|0|Goto|||||46|
32|[Else]|Else|1|0|If_Statement|||||47|
33|[Goto]|RepeatL|1|0|Goto|||||50|
34|[End If]|EndIf|1|0|If_Statement|||||51|
35|[Else]|Else|1|0|If_Statement|||||52|
36|[Goto]|RepeatL|1|0|Goto|||||55|
37|[End If]|EndIf|1|0|If_Statement|||||56|
38|[Label]|Success2|1|0|Label|||||57|
39|[Pause]||1|1500|Sleep|||||58|
40|[Text]|c|1|0|SendRaw|||||59|
41|[LoopEnd]|LoopEnd|1|0|Loop|||||60|

Last edited by DemonGamingLP on 17 Apr 2021, 08:14, edited 1 time in total.
DemonGamingLP
Posts: 6
Joined: 16 Apr 2021, 18:40

Re: Broken Loop

Post by DemonGamingLP » 16 Apr 2021, 19:30

also tried the normal "input" keyboard and mouse mode
DemonGamingLP
Posts: 6
Joined: 16 Apr 2021, 18:40

Re: Broken Loop

Post by DemonGamingLP » 16 Apr 2021, 20:08

and after removing the loop function and using the loop function of the program itself (up in the right corner for me) doesnt loop it aswell
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Re: Broken Loop

Post by Pulover » 19 Apr 2021, 07:28

The Loop command is working fine. I suppose your script is stuck on line 5 because it has the `Loop Until Found` option checked. Try to use `WinActivate` before the Image/Pixel search commands to make sure the target window is active, otherwise the command will not find it. You might want to add some variation too.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
DemonGamingLP
Posts: 6
Joined: 16 Apr 2021, 18:40

Re: Broken Loop

Post by DemonGamingLP » 19 Apr 2021, 09:04

no the thing is; it STOPS after going through. its not about not finding the pixel it searches for, it just stops after loop end
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Re: Broken Loop

Post by Pulover » 19 Apr 2021, 09:09

No, it doesn't. Change the actions of the searches to `Prompt` and you should see that it's looping. You have no Sleep in the Until loop so it's just too fast.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
DemonGamingLP
Posts: 6
Joined: 16 Apr 2021, 18:40

Re: Broken Loop

Post by DemonGamingLP » 19 Apr 2021, 12:19

no you dont understand me here; it is stoping.

so i start the script via the control panel you get after pressing ctrl + enter (macro -> Activate macros)

there you choose the macro you want to run (if there are more than 1) and press the little blue play arrow.

after it went through the macro once it stops. it really stops. the double line (the blue "||" that indicates the macro is running) turns into the arrow again. (also probably worth to mention: the arrow is NOT clickable until i pressed the red square before)

also even if it would be too fast it immediatelly would stop at the first task after the loop beginn due to taking some time until the pixel is found; but it still just stops after the loop end with the said behaviour above
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Re: Broken Loop

Post by Pulover » 19 Apr 2021, 13:41

I think I see your problem now. You're using Goto pointing to a label inside the loop. That will actually break the loop because goto will jump to the label and continue from there and thus exiting the loop. Choose either Goto or Loop and Continue, don't mix them.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
DemonGamingLP
Posts: 6
Joined: 16 Apr 2021, 18:40

Re: Broken Loop

Post by DemonGamingLP » 19 Apr 2021, 14:52

ahh okay. maybe fixable? since imo it shouldnt considere it being outside of a loop when in fact its obviously inside it.

ig ill just add a label at the start of the loop and add a goto at the end of the loop. a loop with a label lol.
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Re: Broken Loop

Post by Pulover » 19 Apr 2021, 15:02

No, in fact labels shouldn't be allowed inside loops. Imagine jumping to a label from outside of the loop... There's no way to make this work. I shall add an error message for that.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Post Reply

Return to “Pulovers Macro Creator”