Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Sat Aug 15, 2020 4:58 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Humanly.Move Mouse to Coordinates... getting stuck
Thanked: 0 time(s)  Unread post Posted: Wed Jul 01, 2020 5:56 pm 
New User
New User



Joined: Wed Jul 01, 2020 5:49 pm
Posts: 3
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 10
I'm having trouble with this script; at random, the Humanly.Move to Coordinates command gets stuck at its position and I can't move away from it, particularly when moving to the BonesInvX and BonesInvY position. Closing BE and restarting it is the only way to reset. Below is the code:

Code:
Begin
     Color.Find coordinate of occurrence on screen closest to coordinate (RGB)("187", "178", "178", "0", "1270", "740", "BonesX", "BonesY")
     Humanly.Move to coordinate("{BonesX}", "{BonesY}")
     Mouse.Click("Right")
     Function.Execute with timeout("WaitforBonesName", "200")
     if  Function.Did timeout("WaitforBonesName")
          begin
               Macro.Abort()
          end
     Variable.Set random number("RightClickPause", "100", "150")
     Macro.Pause("{RightClickPause}")
     Mouse.Move to coordinate("{RbonesX}", "{RbonesY}")
     Mouse.Click("Left")
     Function.Execute with timeout("WaitforPickup", "5000")
     Humanly.Move to coordinate("{BonesInvX}", "{BonesInvY}")
     Variable.Set random number("Delay1", "25", "50")
     Macro.Pause("{Delay1}")
     Humanly.Click("Left", "Yes")
     Variable.Set random number("Delay2", "1000", "1100")
     Macro.Pause("{Delay2}")
 end

function("WaitforBonesName")
     begin
          Color.Wait for and locate pixel pattern("255,144,64,0,2,255,144,64,0,2,255,144,64,0,2,255,144,64,0,2,255,144,64,2,0,255,144,64,3,-1,255,144,64,0,-2,255,144,64,-1,-2,255,144,64,1,-1,255,144,64,-1,-2,255,144,64,-2,3,255,144,64,0,-4,255,144,64,3,1,255,144,64,4,5,255,144,64,3,0,255,144,64,0,3,255,144,64,-3,0,255,144,64,2,-5,255,144,64,5,0,255,144,64,0,1,255,144,64,0,1,255,144,64,0,2,255,144,64,0,1,255,144,64,1,-4,255,144,64,2,0,0,0,0,2,1,255,144,64,0,2,255,144,64,4,-2,255,144,64,4,0,255,144,64,-2,-2,255,144,64,0,5,255,144,64,7,-5,255,144,64,3,0,255,144,64,-3,2,255,144,64,2,1,255,144,64,0,2,255,144,64,-2,0,255,144,64,-2,0,255,144,64", "0", "RbonesX", "RbonesY")
     end
function

function("WaitforPickup")
     begin
          Color.Wait for and locate pixel pattern("181,172,171,9,1,91,82,82,-11,-7,169,158,157,-1,11,179,170,169,-7,-7,66,58,58", "0", "BonesInvX", "BonesInvY")
     end
function


Any help is appreciated.

Thanks!
LJH


Top
 Profile  
Reply with quote  
 Post subject: Re: Humanly.Move Mouse to Coordinates... getting stuck
Thanked: 0 time(s)  Unread post Posted: Thu Jul 02, 2020 5:03 am 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 2100
Location: USA
Been thanked: 484 time(s)
Has thanked: 36 time(s)
Contribution Points: 17228
Make sure you're not getting an error or at least look through the execution log to see if it's picking up that pixel pattern for the second one. Looks like it could get stuck there, but the execution log would tell you.

Or...you have "function.did timeout" for the first one, have you tried it on the second one? the one you're having problems with? Perhaps it's timing out...then it would try to move to the coordinates for bonesInvX, but what are they set to? Are they predefined or do you have any values...if not predefined and it timed out, that would cause an error. Sometimes those errors display in the background, so if you don't find that message box and close it, then that may be why only closing BEM works for you...because that would close the error message also before allowing you to continue.

Anyway, I'd be interested in seeing what the execution log says.

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
 Post subject: Re: Humanly.Move Mouse to Coordinates... getting stuck
Thanked: 0 time(s)  Unread post Posted: Fri Jul 03, 2020 4:52 am 
New User
New User



Joined: Wed Jul 01, 2020 5:49 pm
Posts: 3
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 10
Hello Syrifina,

BE is not showing any errors, and the execution log is clean. Here is the latest.
If I catch it sticking early enough, I can still abort the macro without having to close BE. After a certain amount of time I abort the macro and the mouse is still stuck.

Thanks!
LJH


Attachments:
Test1.txt [5.61 KiB]
Downloaded 50 times
Top
 Profile  
Reply with quote  
 Post subject: Re: Humanly.Move Mouse to Coordinates... getting stuck
Thanked: 0 time(s)  Unread post Posted: Fri Jul 03, 2020 8:39 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 2100
Location: USA
Been thanked: 484 time(s)
Has thanked: 36 time(s)
Contribution Points: 17228
Well that log tells quite a story, but not the story you told above or the script you posted.

So you're running more than 1 macro and the script you posted above is (at least) the second running macro. Since you didn't mention any of this I have to make some assumptions; from this log it seems like the starting macro calls the script above (which is a separate macro) named "Bones?"

Regardless, this isn't the execution log of the script you posted, it's for the starting (or other) macro. This one says it executed the new macro "bones", waited for it to complete, then came back; which it did 4 times before the macro was aborted...so there's no information about what happened in the script you posted. Additionally, we don't know if the function "WaitforBonesName" completed or timed out and aborted the (second) macro...although you might have an idea since you can watch what's happening when it's running. Since the timeout is only 200ms, it should be visible to someone watching the macros play out.

But I actually get the feeling that the error is here in the original macro though. You didn't mention if the problem happened with this run from this log...so again, I have to make some assumptions. If it did, then I would suspect it's because of the function "waitfordeath" timing out. Since you haven't posted this script I can only go off of the log, but it usually waits for the pixel pattern to appear then disappear. You can see in this log that it waits for it to appear then aborts (due to timeout) and doesn't seem to finish that function (or start the one that waits for it to disappear). Then it continues on with the macro like nothing happened, breaking the "normal" cycle. It calls the second macro, "bones", to start checking for other things...which is where you start to notice things going wrong, which I would assume is an effect of the problem generated in the previous macro. If it only happens at this point in time...I would say you need to add more then "abort function" to in "waitfordeath" so that it clears things up before starting new color/pixel searches.

Hope that helps...I have to go for now, but I'll take another look at it later when I have more time. That's the first thing that caught my attention.

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
 Post subject: Re: Humanly.Move Mouse to Coordinates... getting stuck
Thanked: 0 time(s)  Unread post Posted: Tue Jul 14, 2020 2:42 am 
New User
New User



Joined: Wed Jul 01, 2020 5:49 pm
Posts: 3
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 10
Hello again,

You are correct, a second macro is called upon at the end of the first. The second one only runs for a couple seconds but it is quite long and was easier to wrap into its own macro then include in this one.
The error happens within both. All 'wait for' commands have some kind of timeout in case the pixel patter/color ends up not appearing for some reason.

The mouse got stuck during that execution before I aborted it.

I really don't want to pack the whole macro into a function that times out to avoid this problem, because I've had it run flawlessly for hours but sometimes only a few minutes.

Are you sure this a coding error? It seems to happen with just about everything I write using this particular command.

Thanks,
LJH


Top
 Profile  
Reply with quote  
 Post subject: Re: Humanly.Move Mouse to Coordinates... getting stuck
Thanked: 0 time(s)  Unread post Posted: Tue Jul 14, 2020 12:19 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 2100
Location: USA
Been thanked: 484 time(s)
Has thanked: 36 time(s)
Contribution Points: 17228
Quote:
Are you sure this a coding error?
No. I couldn't be sure of a coding error without viewing the execution log of the second macro. You would need to run the second one on it's own - actually this would help you out also.

I would not run the first macro and set a trigger up for the second macro. When you get to the point that it (the second one) would normally run, start it manually. This will do a couple of things. First it will allow us to view it's execution log, but more importantly you will be able to verify the error is from this macro or not. If you can't reproduce this error with only this macro running, then you know it's because of the first macro. If you can, then you know it's in this macro and we'll be able to view the execution log to see what is happening.

This is one example of what I imagine could happen (and you would see by only running this macro):
- if it finds the pixel pattern for "waitforbonesname", meaning it didn't timeout and abort (which I'll address next), then...
you have this:
Code:
     Function.Execute with timeout("WaitforPickup", "5000")
     Humanly.Move to coordinate("{BonesInvX}", "{BonesInvY}")
So, lets' go through 2 scenarios:
1. If finds the pixel, it gets the coordinates (invx and invy), then humanly moves to that coordinate
2. or WaitforPickup times out...hmmm, what happens now? The coordinates for InvX & InvY were supposed to be set in this function, but it timed out before getting them. So it tries to move to "invx & invy" but they are currently undefined. You should get an error or (at least) the mouse is not going to move...and perhaps you're perceiving it as "getting stuck", but really it's because there's no coordinates for it move to.

* You should clearly see this in the execution log. There should be a line that says, "trying to Move to coordinate("{BonesInvX}", "{BonesInvY}")"' followed by it saying "the variables don't exist".
** Additionally, if it did work then it will state the coordinates. You can compare the starting coordinates with these new ones to see if it was actually trying to move to where you anticipated or not. Perhaps it's not going to the coordinates you think it should.

So, what about "waitforbonesname". You have a timout of 200ms, but in the function you have "color.wait"...well it can only wait for 200ms which is really short (what is that, like 1/5 a second) so basically it's either there or it's not. That part should easy to see and of course if it's not there then the macro doesn't get to the humanly move portion of the other function.

That still leaves what I mentioned in the post above. It still could be the disconnect of trying to find the pixel pattern in the first macro and not aborting that search before starting a new one. Although I wouldn't look into that until after you rule out this macro.

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group