Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Wed Jan 17, 2018 9:54 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Question:need to meet 2 condition then trigger next action
Thanked: 0 time(s)  Unread post Posted: Tue Jan 16, 2018 6:41 am 
New User
New User



Joined: Tue Jun 19, 2012 6:49 am
Posts: 7
Location: Malaysia
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 22
Hye guys,

I have a question regarding the coding which i will explain in below detailed because i dont know the correct term to say it.

Im already try to look around and searching any post related to my question but seems like im not find the answer or maybe im not using the right keyword to search it.

Here is my question,

i want to make a simple program which is need to meet 2 or more condition then only trigger the action
example :

if color at (point A) & if color at (point B)
Begin looping
keyboard.hold (B)
Human.pause
keyboard.releas (B)

-which mean only if the macro detect that 2 point only the next action will triggered

Anyone can help me to give some sample so i try it later at home

Thanx
Dmei


Top
 Profile  
Reply with quote  
 Post subject: Re: Question:need to meet 2 condition then trigger next acti
Thanked: 1 time(s)  Unread post Posted: Tue Jan 16, 2018 1:40 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1703
Location: USA
Been thanked: 360 time(s)
Has thanked: 27 time(s)
Contribution Points: 15955
You just need to use logic builders if your script has more than one condition that needs to be met; they are located here: viewforum.php?f=570

There's an example for each of them if you follow the link and select one, but here you go:

Code:
begin
     Variable.Set random number("x", "1", "5")
     Variable.Set random number("y", "1", "5")
     if  Variable.Is equal to("x", "3")
          and
          Variable.Is equal to("y", "3")
          begin
               Window.Display message box("Both paramenters were met", "yes")
               Macro.Abort()
          end
     Window.Display message box("Both paramenters were not met", "yes")
     Macro.Restart("yes")
 end

_________________
----------------------------------------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: Question:need to meet 2 condition then trigger next acti
Thanked: 0 time(s)  Unread post Posted: Tue Jan 16, 2018 2:30 pm 
New User
New User



Joined: Tue Jun 19, 2012 6:49 am
Posts: 7
Location: Malaysia
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 22
Syrifina wrote:
You just need to use logic builders if your script has more than one condition that needs to be met; they are located here: viewforum.php?f=570

There's an example for each of them if you follow the link and select one, but here you go:

Code:
begin
     Variable.Set random number("x", "1", "5")
     Variable.Set random number("y", "1", "5")
     if  Variable.Is equal to("x", "3")
          and
          Variable.Is equal to("y", "3")
          begin
               Window.Display message box("Both paramenters were met", "yes")
               Macro.Abort()
          end
     Window.Display message box("Both paramenters were not met", "yes")
     Macro.Restart("yes")
 end


Million thanx mate, will try it :P


Top
 Profile  
Reply with quote  
 Post subject: Re: Question:need to meet 2 condition then trigger next acti
Thanked: 0 time(s)  Unread post Posted: Wed Jan 17, 2018 1:08 am 
New User
New User



Joined: Tue Jun 19, 2012 6:49 am
Posts: 7
Location: Malaysia
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 22
Syrifina wrote:
You just need to use logic builders if your script has more than one condition that needs to be met; they are located here: viewforum.php?f=570

There's an example for each of them if you follow the link and select one, but here you go:

Code:
begin
     Variable.Set random number("x", "1", "5")
     Variable.Set random number("y", "1", "5")
     if  Variable.Is equal to("x", "3")
          and
          Variable.Is equal to("y", "3")
          begin
               Window.Display message box("Both paramenters were met", "yes")
               Macro.Abort()
          end
     Window.Display message box("Both paramenters were not met", "yes")
     Macro.Restart("yes")
 end


Hi Syrifina,

yesterday i had try below code by using and logic which is to set the macro to start this particular function if meet both 'IF" requirement but my result is, the macro still run the action even it detect 1 of the requirement instead of skip this "and" script.
Im not really expert in programming but can u try and check my program below


function("RightLast-2")
// IF MIDDLE MINION IS THE LAST SURVIVOR AND NEED TO BUILD AP
if Color.At coordinate is not (RGB)("253", "253", "253", "731", "347")
and
Color.At coordinate is not (RGB)("252", "248", "248", "500", "357")
begin loop()
Function.Execute("Human Pause")
Function.Execute("AP14")
Function.Execute("Human Pause")
Function.Execute("APNot14")
// Same RGB from above
if Color.At coordinate is (RGB)("253", "253", "253", "731", "347")
and
Color.At coordinate is (RGB)("252", "248", "248", "500", "357")
begin
Macro.Restart("no")
end
end
function


From my current understanding now,
if the macro not detect both of abive "IF" requirement..the macro will skip this function am i right? Or there some error which cause the macro still execute the function inside this script even it just meet 1 of the "IF" requirement

Regards,
Dmei


Top
 Profile  
Reply with quote  
 Post subject: Re: Question:need to meet 2 condition then trigger next acti
Thanked: 0 time(s)  Unread post Posted: Wed Jan 17, 2018 10:55 am 
Contributor
Contributor
User avatar



Joined: Tue Aug 01, 2017 11:16 pm
Posts: 65
Been thanked: 29 time(s)
Has thanked: 4 time(s)
Contribution Points: 111
clawruxz wrote:
Syrifina wrote:
You just need to use logic builders if your script has more than one condition that needs to be met; they are located here: viewforum.php?f=570

There's an example for each of them if you follow the link and select one, but here you go:

Code:
begin
     Variable.Set random number("x", "1", "5")
     Variable.Set random number("y", "1", "5")
     if  Variable.Is equal to("x", "3")
          and
          Variable.Is equal to("y", "3")
          begin
               Window.Display message box("Both paramenters were met", "yes")
               Macro.Abort()
          end
     Window.Display message box("Both paramenters were not met", "yes")
     Macro.Restart("yes")
 end


Hi Syrifina,

yesterday i had try below code by using and logic which is to set the macro to start this particular function if meet both 'IF" requirement but my result is, the macro still run the action even it detect 1 of the requirement instead of skip this "and" script.
Im not really expert in programming but can u try and check my program below


function("RightLast-2")
// IF MIDDLE MINION IS THE LAST SURVIVOR AND NEED TO BUILD AP
if Color.At coordinate is not (RGB)("253", "253", "253", "731", "347")
and
Color.At coordinate is not (RGB)("252", "248", "248", "500", "357")
begin loop()
Function.Execute("Human Pause")
Function.Execute("AP14")
Function.Execute("Human Pause")
Function.Execute("APNot14")
// Same RGB from above
if Color.At coordinate is (RGB)("253", "253", "253", "731", "347")
and
Color.At coordinate is (RGB)("252", "248", "248", "500", "357")
begin
Macro.Restart("no")
end
end
function


From my current understanding now,
if the macro not detect both of abive "IF" requirement..the macro will skip this function am i right? Or there some error which cause the macro still execute the function inside this script even it just meet 1 of the "IF" requirement

Regards,
Dmei


I see it well, if it does not detect those RGB`s, it enters the loop AP14 and APNot14 and when it detects the RGB`s it resets macro, if it has any problem it has to be inside the functions of AP14 and APNot14

Code:
 begin
     // Neither of these two colors has to appear
     if  Color.At coordinate is not (RGB)("253", "253", "253", "731", "347")
          and
          Color.At coordinate is not (RGB)("252", "248", "248", "500", "357")
          begin loop()
               Function.Execute("Human Pause")
               Function.Execute("AP14")
               Function.Execute("Human Pause")
               Function.Execute("APNot14")
               // The two colors have to appear to stop
               if  Color.At coordinate is (RGB)("253", "253", "253", "731", "347")
                    and
                    Color.At coordinate is (RGB)("252", "248", "248", "500", "357")
                    begin
                         Macro.Restart("no")
                    end
          end
 end

function("AP14")
     if  Color.At coordinate is (RGB)("", "", "", "", ")
          begin
               // Start
          end
function

function("APNot14")
     if  Color.At coordinate is not (RGB)("", "", "", "", "")
          begin
               // Start
          end
function

_________________
 
                   Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Question:need to meet 2 condition then trigger next acti
Thanked: 0 time(s)  Unread post Posted: Wed Jan 17, 2018 12:32 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1703
Location: USA
Been thanked: 360 time(s)
Has thanked: 27 time(s)
Contribution Points: 15955
The easiest way to tell what it's doing is by checking the "execution log." After you run the macro open the execution log and it will tell you everything.

In your script it will tell you:
- running if color is not ... and then give you an answer of what BEM saw; yes or no
and then the next line will be
- running if the second color is not ... and then give you an answer of what BEM saw; yes or no

then BEM will tell you what line it executed next...which will line up with the answers it gave above, for example if both answers were "yes" it should say:

beginning loop and then executing function ("Human Pause")

Usually, it's a problem with the answers above not matching up with what you were expecting to happen. You said only one of them should not have been the color and it ran it anyway (instead of skipping the next part), but I imagine BEM's execution log said "yes" for both and then ran it.

If you can't fix it from here, post a copy of the execution log and we can match it up with your script and explain it.

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