Post by stevenm on Nov 3, 2022 4:04:08 GMT
I've got a macro that's about 200 lines, and it's deciding to just end the macro if I turn on this new part of the macro (called Box Collection)
I believe the logic is fine, and the clicks look correct. This is a sample of the macro that is misbehaving:
# Focus is at the top of the macro and does a GET WINDOW BY TITLE to make sure that the app is selected, and then it starts doing everything
I am trying to understand why the logs seem to say that it's going to the ClaimTroopBox line, but then ends... This looks to be coming from lines 167 - 169 because I need to wait a few seconds for the image to become available, but want to try every second or so to find the "OK" button to claim the reward and then I can process the next loop of the macro.
11/02/2022 08:43:01.22 PM Macro action - Finished Mouse Click (1 clicks in 0.1144495 seconds)
11/02/2022 08:43:01.32 PM Macro condition: 166 | IF | END IF (9)
11/02/2022 08:43:01.66 PM Macro action - Thread sleeping for 1000 milliseconds
11/02/2022 08:43:02.68 PM Macro action - RunningACTION: GOTO MACRO LINE - Macro line(ClaimTroopBox)
11/02/2022 08:43:03.00 PM Macro playback finished
Also, I was working on changing all the:
191 | X | Y | 2000 | Left Click Down
192 | X | Y | 100 | Left Click Release
To:
179 | RUN ACTION | MOUSE CLICK | Left click at X Y 1 times with 100 ms delay
In case there was an issue with the different syntax, but that didn't seem to help and this seems more like a bug/issue in the GOTO MACRO LINE inside the IF statement (unless anyone can find a problem with my logic).
* %IMAGES_PATH% is defined correctly and other DETECT IMAGE actions seem to run fine.
* pressing Run Entry on the individual lines in the script seem to work correctly (mouse clicks)
Help? Should I submit a bug request?
Please and Thank You,
Steven M
I believe the logic is fine, and the clicks look correct. This is a sample of the macro that is misbehaving:
# Focus is at the top of the macro and does a GET WINDOW BY TITLE to make sure that the app is selected, and then it starts doing everything
* | Before-Box-Collection
149 | RUN ACTION | DEBUG | logger::INFO::DEFEATS: %DEFEAT_COUNTER%
150 | IF | STRING VARIABLE | %BOX_COLLECTION_ON_OFF% | IS | OFF | THEN
151 | RUN ACTION | GOTO MACRO LINE | Focus
152 | IF | END IF
153 | IF | PIXEL RANGE | At Location [X:951 Y:74]::Size [W:70 H:10] | CHANGES::1::3::500 | THEN
154 | IF | DETECT IMAGE | image path %IMAGES_PATH%\empty-box.png::match full::move mouse yes | IMAGE FOUND | THEN
155 | RUN ACTION | DEBUG | logger::INFO::Empty Box Slot (box collection aborted)
156 | RUN ACTION | GOTO MACRO LINE | Focus
157 | IF | ELSE
158 | RUN ACTION | DEBUG | logger::INFO::Running Box collection
* | Click-Box-Slot-Button
159 | RUN ACTION | MOUSE CLICK | Left click at 998 130 1 times with 100 ms delay
* | ClickTroopOpen
160 | RUN ACTION | WAIT MILLISECONDS | 3000
161 | IF | PIXEL RANGE | At Location [X:617 Y:323]::Size [W:114 H:105] | CHANGES::1::4::0 | THEN
162 | IF | STRING VARIABLE | %BATTLE_LEVEL_OPTION% | IS | LEVEL-8000 | THEN
163 | RUN ACTION | MOUSE CLICK | Left click at 926 447 1 times with 100 ms delay
164 | IF | ELSE
165 | RUN ACTION | MOUSE CLICK | Left click at 926 396 1 times with 100 ms delay
166 | IF | END IF
* | ClaimTroopBox
167 | IF | DETECT IMAGE | image path %IMAGES_PATH%\troop-box-ok.png::match full::move mouse yes | IMAGE NOT FOUND | THEN
168 | RUN ACTION | WAIT MILLISECONDS | 1000
169 | RUN ACTION | GOTO MACRO LINE | ClaimTroopBox
170 | IF | ELSE
171 | RUN ACTION | MOUSE CLICK | Left click at 784 690 1 times with 100 ms delay
172 | RUN ACTION | GOTO MACRO LINE | Focus
173 | IF | END IF
174 | RUN ACTION | GOTO MACRO LINE | Focus
175 | IF | END IF
176 | IF | PIXEL RANGE | At Location [X:600 Y:531]::Size [W:116 H:55] | CHANGES::1::5::500 | THEN
* | HeroBoxOpen
177 | IF | STRING VARIABLE | %BATTLE_LEVEL_OPTION% | IS | LEVEL-8000 | THEN
178 | RUN ACTION | MOUSE CLICK | Left click at 926 447 1 times with 100 ms delay
179 | IF | ELSE
180 | RUN ACTION | MOUSE CLICK | Left click at 926 620 1 times with 100 ms delay
181 | IF | END IF
* | ClaimHeroBox
182 | IF | DETECT IMAGE | image path %IMAGES_PATH%\hero-box-ok.png::match full::move mouse yes | IMAGE NOT FOUND | THEN
183 | RUN ACTION | WAIT MILLISECONDS | 1000
184 | RUN ACTION | GOTO MACRO LINE | ClaimHeroBox
185 | IF | ELSE
186 | RUN ACTION | MOUSE CLICK | Left click at 784 690 1 times with 100 ms delay
187 | RUN ACTION | GOTO MACRO LINE | Focus
188 | IF | END IF
189 | IF | END IF
* | CloseBoxCollection
190 | 953 | 195 | 2000 | Left Click Down
191 | 953 | 195 | 100 | Left Click Release
192 | IF | END IF
193 | IF | END IF
149 | RUN ACTION | DEBUG | logger::INFO::DEFEATS: %DEFEAT_COUNTER%
150 | IF | STRING VARIABLE | %BOX_COLLECTION_ON_OFF% | IS | OFF | THEN
151 | RUN ACTION | GOTO MACRO LINE | Focus
152 | IF | END IF
153 | IF | PIXEL RANGE | At Location [X:951 Y:74]::Size [W:70 H:10] | CHANGES::1::3::500 | THEN
154 | IF | DETECT IMAGE | image path %IMAGES_PATH%\empty-box.png::match full::move mouse yes | IMAGE FOUND | THEN
155 | RUN ACTION | DEBUG | logger::INFO::Empty Box Slot (box collection aborted)
156 | RUN ACTION | GOTO MACRO LINE | Focus
157 | IF | ELSE
158 | RUN ACTION | DEBUG | logger::INFO::Running Box collection
* | Click-Box-Slot-Button
159 | RUN ACTION | MOUSE CLICK | Left click at 998 130 1 times with 100 ms delay
* | ClickTroopOpen
160 | RUN ACTION | WAIT MILLISECONDS | 3000
161 | IF | PIXEL RANGE | At Location [X:617 Y:323]::Size [W:114 H:105] | CHANGES::1::4::0 | THEN
162 | IF | STRING VARIABLE | %BATTLE_LEVEL_OPTION% | IS | LEVEL-8000 | THEN
163 | RUN ACTION | MOUSE CLICK | Left click at 926 447 1 times with 100 ms delay
164 | IF | ELSE
165 | RUN ACTION | MOUSE CLICK | Left click at 926 396 1 times with 100 ms delay
166 | IF | END IF
* | ClaimTroopBox
167 | IF | DETECT IMAGE | image path %IMAGES_PATH%\troop-box-ok.png::match full::move mouse yes | IMAGE NOT FOUND | THEN
168 | RUN ACTION | WAIT MILLISECONDS | 1000
169 | RUN ACTION | GOTO MACRO LINE | ClaimTroopBox
170 | IF | ELSE
171 | RUN ACTION | MOUSE CLICK | Left click at 784 690 1 times with 100 ms delay
172 | RUN ACTION | GOTO MACRO LINE | Focus
173 | IF | END IF
174 | RUN ACTION | GOTO MACRO LINE | Focus
175 | IF | END IF
176 | IF | PIXEL RANGE | At Location [X:600 Y:531]::Size [W:116 H:55] | CHANGES::1::5::500 | THEN
* | HeroBoxOpen
177 | IF | STRING VARIABLE | %BATTLE_LEVEL_OPTION% | IS | LEVEL-8000 | THEN
178 | RUN ACTION | MOUSE CLICK | Left click at 926 447 1 times with 100 ms delay
179 | IF | ELSE
180 | RUN ACTION | MOUSE CLICK | Left click at 926 620 1 times with 100 ms delay
181 | IF | END IF
* | ClaimHeroBox
182 | IF | DETECT IMAGE | image path %IMAGES_PATH%\hero-box-ok.png::match full::move mouse yes | IMAGE NOT FOUND | THEN
183 | RUN ACTION | WAIT MILLISECONDS | 1000
184 | RUN ACTION | GOTO MACRO LINE | ClaimHeroBox
185 | IF | ELSE
186 | RUN ACTION | MOUSE CLICK | Left click at 784 690 1 times with 100 ms delay
187 | RUN ACTION | GOTO MACRO LINE | Focus
188 | IF | END IF
189 | IF | END IF
* | CloseBoxCollection
190 | 953 | 195 | 2000 | Left Click Down
191 | 953 | 195 | 100 | Left Click Release
192 | IF | END IF
193 | IF | END IF
I am trying to understand why the logs seem to say that it's going to the ClaimTroopBox line, but then ends... This looks to be coming from lines 167 - 169 because I need to wait a few seconds for the image to become available, but want to try every second or so to find the "OK" button to claim the reward and then I can process the next loop of the macro.
11/02/2022 08:43:01.22 PM Macro action - Finished Mouse Click (1 clicks in 0.1144495 seconds)
11/02/2022 08:43:01.32 PM Macro condition: 166 | IF | END IF (9)
11/02/2022 08:43:01.66 PM Macro action - Thread sleeping for 1000 milliseconds
11/02/2022 08:43:02.68 PM Macro action - RunningACTION: GOTO MACRO LINE - Macro line(ClaimTroopBox)
11/02/2022 08:43:03.00 PM Macro playback finished
Also, I was working on changing all the:
191 | X | Y | 2000 | Left Click Down
192 | X | Y | 100 | Left Click Release
To:
179 | RUN ACTION | MOUSE CLICK | Left click at X Y 1 times with 100 ms delay
In case there was an issue with the different syntax, but that didn't seem to help and this seems more like a bug/issue in the GOTO MACRO LINE inside the IF statement (unless anyone can find a problem with my logic).
* %IMAGES_PATH% is defined correctly and other DETECT IMAGE actions seem to run fine.
* pressing Run Entry on the individual lines in the script seem to work correctly (mouse clicks)
Help? Should I submit a bug request?
Please and Thank You,
Steven M