Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Sat Nov 27, 2021 2:20 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Macro run order
Thanked: 0 time(s)  Unread post Posted: Wed Oct 27, 2021 9:47 pm 
Active User
Active User



Joined: Sun Oct 17, 2021 9:07 pm
Posts: 32
Been thanked: 0 time(s)
Has thanked: 6 time(s)
Contribution Points: 67
Ok, Im hoping someone can please clarify something for me.
I am using multiple macro's as co routines to run consecutive watches on the global variables interacting between them, but it doesn't seem to be interacting as expected.
Launching using Macro.Execute("Blah", "Blahmacro", "no") to no wait (consecutive running?) but that doesnt exactly seem to be happening.
what should be happening:

Macro A controls attacking/enemy watch
Macro A Detects an enemy near XY position and sets a Global of Idle to false (remove global)
Macro B Controls my timer watches
Macro B Should detect this change in idle (idle exists) and reset idle timer.

What is Happening:
Macro A Detects an enemy near XY position and sets a Global of Idle to false (remove global)
Continues running the attack

Macro B
Doesnt detect the change until AFTER the attack is complete then resets the timer (if it hasnt already gone over the max idle time setting.


Top
 Profile  
Reply with quote  
 Post subject: Re: Macro run order
Thanked: 0 time(s)  Unread post Posted: Wed Oct 27, 2021 10:29 pm 
Active User
Active User



Joined: Sun Oct 17, 2021 9:07 pm
Posts: 32
Been thanked: 0 time(s)
Has thanked: 6 time(s)
Contribution Points: 67
Macro A
Code:
function("FindClosest")
     begin
          If  Variable.Exists("EnemyX")
               begin
                    Variable.Remove("EnemyX")
                    Variable.Remove("EnemyY")
               end
          if  Color.Pixel pattern can be located on screen near coordinate("{Pattern}", "10", "{PlayerX}", "{PlayerX}", "500")
               //               if  Color.Near coordinate is (RGB)("230", "131", "197", "{PlayerX}", "{PlayerY}", "400")
               //               if  Color.Can be located on screen (RGB)("0", "165", "198", "10")
               begin
                    Variable.Remove global("Idle")
                    Macro.Pause("1000")
                    Color.Find pixel pattern closest to coordinate("{Pattern}", "10", "yes", "{PlayerX}", "{PlayerY}", "EnemyX", "EnemyY")
                    //                    Color.Find coordinate of occurrence on screen closest to coordinate (RGB)("230", "131", "197", "10", "{PlayerX}", "{PlayerY}", "EnemyX", "EnemyY")
                    Macro.Reset stopwatch("Reset")
                    Window.Close html dialog("ResetTimer")
                    Window.Display html dialog("CloseRange", "350", "100", "yes", "Close Range")
               end
          Color.Unlimit area of interest()
          if  Variable.Does not exist("EnemyX")
               begin
                    Variable.Set global("Idle", "true")
                    Macro.Pause("100")
                    if  Color.Pixel pattern can be located on screen("{Pattern}", "10")
                         //                         if  Color.Can be located on screen (RGB)("230", "131", "197", "10")
                         begin
                              Color.Find pixel pattern closest to coordinate("{Pattern}", "10", "yes", "{PlayerX}", "{PlayerY}", "EnemyX", "EnemyY")
                              //                              Color.Find coordinate of occurrence on screen closest to coordinate (RGB)("230", "131", "197", "10", "964", "530", "EnemyX", "EnemyY")
                              Window.Display html dialog("CloseRange", "350", "100", "yes", "Long Range")
                         end
                    Macro.Pause("100")
               end
     end
function


Macro B
Code:

 begin
     Variable.Set("MaxIdle", "30000")
     //     while  Macro.Is not running("ROBot", "ROBotMain")
     while  Variable.Does not exist("Terminate")
          begin
               if  Variable.Global exists("Idle")
                    begin
                         Macro.Start stopwatch("IdleTime")
                         Macro.Read stopwatch("IdleTime", "idlefor")
                         Variable.Evaluate (Math)("{idlefor}/1000", "Aidlefor")
                         Variable.Evaluate (Text)("No attacks for {Aidlefor}", "saythis")
                         Window.Display html dialog("Idle Time", "450", "25", "yes", "{saythis}")
                         if  Variable.Global exists("Attacking")
                              begin
                                   Function.Execute("ResetIdle")
                              end
                         if  Variable.Global exists("Busy")
                              begin
                                   Function.Execute("ResetIdle")
                              end
                         Function.Execute("CheckIdle")
                    end
          end
     if  Variable.Global does not exist("Idle")
          begin
               Macro.Reset stopwatch("IdleTime")
          end
 end

function("ResetIdle")
     begin
          if  Macro.Stopwatch exists("IdleTime")
               begin
                    Macro.Read stopwatch("IdleTime", "IdleFor")
                    if  Variable.Is greater than (Math)("IdleFor", "0")
                         begin
                              Speech.Say("Reseting Idle", "no")
                              Macro.Reset stopwatch("IdleTime")
                              Macro.Stop stopwatch("IdleTime")
                              Variable.Set("Teleport", "true")
                         end
               end
     end
function


While the attack is in progress the timer html dialogue is only updating periodicly and is not resetting the timer, and macro B is not kicking in for any calls until macro A has completed what its doing


Top
 Profile  
Reply with quote  
 Post subject: Re: Macro run order
Thanked: 1 time(s)  Unread post Posted: Thu Oct 28, 2021 4:02 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 2218
Location: USA
Been thanked: 520 time(s)
Has thanked: 38 time(s)
Contribution Points: 17606
I think the execution log would help with this one.

The first thing I see is:
Code:
if  Color.Pixel pattern can be located on screen near coordinate("{Pattern}", "10", "{PlayerX}", "{PlayerX}", "500")
- you have the variable PlayerX in there twice, once for what's supposed to be for the Y coordinate. Since "Variable.remove global ("Idle")" follows that (conditional based upon that), it shouldn't be able to find that pattern near that coordinate and therefore should not remove the "idle" global --> therefore in macro B, "Idle" exists.

Additional you have something new in MacroB; you replaced "while ROBotMain is running" with "while the variable Terminate does not exist".
There's no mention of this in either of the macros you posted to tell if it does or not, so you could check the log. Just realize that if it does exist then it's not going to check if "Idle" exists.
- I believe you need something in MacroA to trigger, check, or change the state of the variable "Terminate" to make this work (or in the attack macro)
-- if you do have the state change in another macro running simultaneous, you need to realize that if MacroB executes and gets to this point faster, then it's not going to reset; it's going to be a timing issue

_________________
----------------------------------------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: Macro run order
Thanked: 0 time(s)  Unread post Posted: Fri Oct 29, 2021 12:09 am 
Active User
Active User



Joined: Sun Oct 17, 2021 9:07 pm
Posts: 32
Been thanked: 0 time(s)
Has thanked: 6 time(s)
Contribution Points: 67
lol thank you. I hadnt even spotted that :) that is the perfect example of what I've previously mentioned about someone else spotting the obvious lol.
Yes, but forms of that while loop are just a way to continue the macro's looping until terminated manually. with the while robotmain option, if the main macro closes it allows the dependancies to close along with it, the terminate variable doesnt exist, but rather just creates a continuous loop until I tell the macro to end while testing it on its own (main macro not running)
the parts before those while loops are initialization settings to be run on launch with the parts in the while loops to be run as a loop. reinitializing variables each loop is inefficient and can reset variables not wanted to be reset each time.
Hope that clarifies why they are in use?


Top
 Profile  
Reply with quote  
 Post subject: Re: Macro run order
Thanked: 0 time(s)  Unread post Posted: Fri Oct 29, 2021 5:01 am 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 2218
Location: USA
Been thanked: 520 time(s)
Has thanked: 38 time(s)
Contribution Points: 17606
Quote:
the terminate variable doesnt exist, but rather just creates a continuous loop
Nice; creative work around!

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