Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Tue Dec 07, 2021 8:45 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Code function problem
Thanked: 0 time(s)  Unread post Posted: Fri Sep 24, 2021 3:18 pm 
New User
New User



Joined: Sat Aug 07, 2021 8:11 pm
Posts: 9
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 16
hi
I have a macro that does the job of developing weapons. With a function to stop if the weapon becomes developed +10 and above, i specify the pixels of the + and 1 sign, but if the weapon becomes +10, it does not cancel the development of the weapon, and strangely enough, if the development fails +10, the function works and cancels the weapon even though it becomes broken and unusable.

stop code
begin
if Color.Pixel pattern can be located on screen near coordinate("171,171,171,0,-1,153,153,153,0,3,171,171,171,0,1,171,171,171,-1,-2,188,188,188,-1,0,144,144,144,2,0,188,188,188,1,0,188,188,188,1,0,144,144,144,3,-1,171,171,171,0,-2,153,153,153,0,1,163,163,163,-1,0,188,188,188,1,2,171,171,171,0,1,171,171,171,0,1,171,171,171", "16", "514", "621", "10")
begin
Mouse.Double click at coordinate("524", "643", "left")
end
end
The rest of the macro works perfectly
Another note, there is a code in the function. In the event that he sees a specific shape, he must move to the second stage, but it did not work in the past. Before I added the code to cancel the weapon, the transition to the second stage worked.
the code
if Color.Pixel pattern can be located on screen near the current mouse position("dash")
begin
Macro.Execute new("dash", "S2", "yes")
end
end
function


Top
 Profile  
Reply with quote  
 Post subject: Re: Code function problem
Thanked: 0 time(s)  Unread post Posted: Sun Sep 26, 2021 5:08 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
You should post your whole script. Since I can't see the whole thing, I'll have to go on what you posted and some assumptions to fill in the gaps:

1. The part of your script that handles the upgrading (development) has to be in a loop. More than likely there is RNG that determines if it passes or fails which would be different each time; since you don't know how many times to run it, then it would need to be in a loop to ensure it fully upgrades.

2. Therefore, if what you posted is accurate then I would guess that part is out of the loop and needs to be in it. I say this because you wrote "begin" and the top and "end" at the bottom which wouldn't need to be there if it was already in the loop. It needs to be in the upgrading loop to tell it when to stop...as an "if" statement so that BEM would read it as
- is it +10?
-- yes, then stop
-- no, run the loop again (continue upgrading)

3. The same for finding that "specific shape". I assume you need to be looking for that at all times, so it would need to be in that loop also. Additionally if that macro doesn't point back to this macro correctly then it could throw everything off also.

Your problem could be any number of things but it would depend on how it's scripted and where things are in your script. Without that information (the rest of your macro), then the above is my best guess as to what's going on. If we can't figure it out from there, then we would generally ask for you to post the execution log and the error log (if you're getting an error)...those are helpful also. In this case, if you post your macro I'd probably be able to tell why it's not working as intended.

FYI: if you don't want to copy/paste your code then you can export the .bem file and post that.

_________________
----------------------------------------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: Code function problem
Thanked: 0 time(s)  Unread post Posted: Mon Sep 27, 2021 7:20 am 
New User
New User



Joined: Sat Aug 07, 2021 8:11 pm
Posts: 9
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 16
I think I know what's wrong with writing my macro. I have only now converted the development command to a loop only and then added the stop function within the loop. Unfortunately, it did not work either, and the loop continued to develop without stopping, even though the stop command is at the beginning of the loop.
note1
Inside the loop code, there is an if command that checks for the existence of a weapon development cube. The purpose of this..Development in my game is similar to launching a skill. There is an interval of 1500ms, then it tells you the development result and the time interval is sometimes related to the speed of the Internet, so there is a delay sometimes..
Note 2
In the event that the development fails or succeeds, there must be an order at the end to remove the weapon from the development field so that he can add another weapon. If it doesn't, and the functions outside the function are turned on, you will add the new weapon in the cube slot, not the weapon slot.
Note 3
The problem of not moving to the next stage was solved strangely..Suddenly after I made the last modifications you told me about, the macro moved to the next stage according to the code command

This is my script but I didn't post the functions above the function.
The functions above will pass through all the weapon slots in the bag. If the slot is not empty, the function will start by double-clicking...etc.

Code:
function("md")
     begin
          if  Color.Pixel pattern can be located on screen near the current mouse position("// empty field image
")
               begin
                    Macro.Execute new("droob", "D2", "yes")
               end
     end
     begin
          // صورة الخانة الفارغة
          if  Color.Pixel pattern can not be located on screen near the current mouse position("// empty field image
")
               begin
// first development
                    Mouse.Double click("left")
                    Macro.Pause("200")
                    Mouse.Double click at coordinate("567", "646", "left")
                    Macro.Pause("100")
                    Mouse.Double click at coordinate("972", "287", "left")
                    Keyboard.Press key(" ")
// second development
                    Mouse.Move to coordinate("567", "647")
                    Macro.Pause("1600")
               end
     end
     begin
          if  Color.Pixel pattern can not be located on screen near the current mouse position("// color the cube in the development field
")
               begin
                    Mouse.Double click at coordinate("972", "286", "left")
                    // موقع المكعب في خانة التطوير
                    Mouse.Move to coordinate("567", "647")
               end
     end
     begin
          if  Color.Pixel pattern can be located on screen near the current mouse position("// the cube's location in the development field
")
               begin
                    Keyboard.Press key(" ")
                    Macro.Pause("1600")
               end
     end
// third development
     begin
          if  Color.Pixel pattern can not be located on screen near coordinate("// the cube's location in the development field
")
               begin loop()
                    if  Color.Pixel pattern can be located on screen near the current mouse position("// color the cube in the development field")
                         begin
                              Keyboard.Press key(" ")
                              Macro.Pause("2000")
                         end
               end
     end
     begin
Mouse.Double click at coordinate("518", "644", "left")
     end
function


Attachments:
Screenshot_12.png
Screenshot_12.png [ 6.36 KiB | Viewed 1483 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: Code function problem
Thanked: 1 time(s)  Unread post Posted: Mon Sep 27, 2021 11:17 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
Quote:
then added the stop function within the loop. Unfortunately, it did not work either
In your first post you stated that you had it looking for the "+10". In the image you posted, it looks like it still says "+10" but has a large red "x" across the image. I would suggest looking for the red X also:

If pixel pattern [+10 with a red X] is found...then it must have failed.
If pixel pattern [+10 with a red X] is not found...then it must have succeeded.

Which you may have to write a little more code (logic) like:
- if +10 is found, execute function pass/fail
In the function pass/fail
- if red X is found
begin
restart (upgrade) loop
end
[else] it passed; return to inventory and select next item for upgrade
*else is implied (and not used in BEM) because it wouldn't reach that point unless the red X wasn't there (it would have restarted the upgrade loop)

_________________
----------------------------------------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: Code function problem
Thanked: 0 time(s)  Unread post Posted: Tue Sep 28, 2021 2:53 pm 
New User
New User



Joined: Sat Aug 07, 2021 8:11 pm
Posts: 9
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 16
Everything is working fine now thank you you are really my hero
;)


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