Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Sat Dec 16, 2017 8:22 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Trying to give my bot a fail-safe. Timelimit to if statment?
Thanked: 0 time(s)  Unread post Posted: Thu Oct 12, 2017 5:20 am 
New User
New User



Joined: Thu Oct 12, 2017 5:14 am
Posts: 2
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 14
Sorry for that horrible subject title, but I'm trying to add a time limit of sorts to my if statement, so that if it did fail to catch the splash, it would reset. The one part of my bot that fails is spotting the splash.
Code:
 begin
     Mouse.Move to coordinate("1311", "557")
     Macro.Pause("100")
     Mouse.Click("Left")
     Macro.Pause("200")
     Keyboard.Press key("1")
     Macro.Pause("2500")
     Mouse.Move in direction while color is not (RGB)("Up", "800", "190", "90", "50", "80")
 end
 begin loop()
     Macro.Pause("100")
     if  Color.Near the current mouse position is within (RGB range)("255", "255", "255", "10", "75 ")
          begin
               Macro.Pause("500")
               Mouse.Click("right")
               Macro.Pause("1000")
               Mouse.Click("Right")
               Macro.Break from loop("no")
          end

 end
     


So could I add something so that if it gets stuck on searching for the splash that already occurred, it would just end and continue the infinite loop?

Thanks for any feedback :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Trying to give my bot a fail-safe. Timelimit to if statm
Thanked: 0 time(s)  Unread post Posted: Thu Oct 12, 2017 9:31 am 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1689
Location: USA
Been thanked: 358 time(s)
Has thanked: 26 time(s)
Contribution Points: 15915
You have another post asking about "timing"...so I'm assuming that you want it to search for a certain amount of time and then give up (restart). This is where the "stopwatch" comes into play.

- So in your loop (2nd part of your script)
- After your "if" statement (and after the begin/end portion)
This is where you would add your stopwatch portion. So if the color near the current mouse position is not the color you're looking for, BEM will skip the "if" statement and since you have it in a loop it will continue to look for it. After the "if" statement add:
- read stopwatch
- then another if statement; if stopwatch is greater than x...
- macro.restart
or something to that affect

*note: you need to create a stopwatch before this and start it, but it doesn't have to be in this loop; you could put it anywhere where you think it will work best. Refer to the link I posted in your other post about how to time macros. Additionally, if you keep posting new threads about the same question, it's going to be hard to find answers...easier to make one thread and keep the answers together so you don't have to go back and forth and piece everything together.

_________________
----------------------------------------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  [ 2 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