Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Wed Nov 20, 2019 1:33 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Need help with macro
Thanked: 0 time(s)  Unread post Posted: Wed Nov 06, 2019 8:37 pm 
New User
New User



Joined: Wed Nov 06, 2019 6:36 pm
Posts: 5
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 17
Hello, new user and first time poster here. I need some help with my macro. The main goal of this macro is to look for a pixel pattern and in a "small section" of the screen and move over 10 pixels if not found. I set a couple of variables for the coordinates of the "small section" to be increased when not found but it seems the macro isn't searching the appropriates sections. Help?

Code:
 begin
     Variable.Set global("X1", "530")
     Variable.Set global("Y1", "235")
     Humanly.Pause("250", "500")
     if  Color.Pixel pattern can be located on screen("0,112,255,1,0,0,112,255,0,1,0,112,255,1,0,0,112,255,-2,0,0,112,255,1,-2,0,112,255,-1,0,0,103,234,0,3,0,112,255,0,1,0,112,255,1,0,0,112,255,1,0,0,112,255,0,-1,0,112,255,0,-2,0,112,255,0,-1,0,112,255,-2,5,0,103,234,1,0,0,112,255,1,0,0,112,255,1,0,0,103,234,0,-1,0,112,255,1,0,0,103,234,0,-1,0,112,255,0,-1,0,112,255,0,-1,0,103,234,-1,0,0,112,255,0,-1,0,103,234,-4,0,2,34,76,0,1,0,103,234,0,1,0,112,255,0,1,0,112,255,0,1,0,103,234,2,-1,0,112,255,2,0,0,112,255,0,-1,0,112,255", "2")
          begin
               Humanly.Pause("100", "250")
               if  Color.At coordinate is within (RGB range)("0", "112", "255", "2", "{X1}", "{Y1}")
                    begin
                         Mouse.Click at color closest to coordinate (RGB)("0", "112", "255", "2", "{X1}", "{Y1}", "Left")
                         Function.Execute("Copy paste pole")
                    end
          end
 end
 begin
     //
     Variable.Add (Math)("X1", "10")
     if  Variable.Is greater than (Math)("X1", "1850")
          begin
               Variable.Set global("X1", "530")
               Mouse.Move to coordinate("1643", "1023")
               Mouse.Hold button("Left")
               Mouse.Move in direction("Up", "15")
               Mouse.Release button("Left")
          end
 end
 //
 if  Color.Pixel pattern can not be located on screen("0,112,255,1,1,0,112,255,0,1,0,112,255,-1,-1,0,112,255,-1,0,0,112,255,0,1,0,112,255,0,1,0,103,234,0,1,2,33,76,1,0,0,103,234,1,0,0,112,255,1,0,0,112,255,0,-1,0,112,255,1,0,0,112,255,0,-2,0,112,255,0,-1,0,112,255,0,-1,0,103,234,-1,0,0,112,255,-1,0,0,112,255,-1,0,0,103,234,-1,1,0,103,234,0,-1,1,33,75,2,1,0,112,255,1,1,0,112,255,1,1,0,112,255,-1,0,0,112,255,-2,0,0,112,255,1,1,0,112,255,1,-3,0,112,255,2,0,0,103,234,0,1,0,112,255,0,1,0,112,255,0,1,0,103,234,-1,1,0,103,234,-3,-1,0,112,255", "2")
     begin
          Mouse.Move to coordinate("510", "216")
          Mouse.Hold button("Left")
          Mouse.Move in direction("Down", "750")
          Mouse.Release button("Left")
          Mouse.Move to coordinate("800", "216")
          Mouse.Hold button("Left")
          Mouse.Move in direction("Left", "300")
          Mouse.Release button("Left")
          //
     end

function("Copy paste pole")
     begin
          Humanly.Pause("750", "1250")
          Mouse.Move to pixel pattern("215,215,215,0,1,239,239,239,1,0,120,120,120,0,1,232,232,232,0,1,247,247,247,1,0,247,247,247,0,-1,93,93,93,0,-1,75,75,75,0,-1,120,120,120,-1,0,75,75,75,-1,2,247,247,247,0,1,247,247,247,2,1,247,247,247,0,-5,172,172,172,0,-1,172,172,172,1,5,172,172,172,0,-1,75,75,75,1,0,215,215,215,0,-1,247,247,247,0,-1,247,247,247,-1,0,239,239,239,0,-1,247,247,247,-2,0,51,51,51,3,4,51,51,51,1,0,51,51,51,0,-1,247,247,247,1,0,247,247,247,0,-1,247,247,247,0,-1,247,247,247,-1,0,247,247,247,0,-1,247,247,247,-1,0,247,247,247,2,0,247,247,247,0,-1,247,247,247,-1,0,247,247,247,-1,0,247,247,247,1,3,247,247,247,1,-4,247,247,247,0,-1,247,247,247,1,5,247,247,247,1,0,199,199,199,0,-1,239,239,239,-1,-1,247,247,247,0,-1,247,247,247,0,-1,247,247,247,0,-1,247,247,247,-2,0,247,247,247,-1,0,247,247,247,-1,0,215,215,215,-1,0,75,75,75,0,1,120,120,120,3,0,247,247,247,-1,0,247,247,247,-1,0,239,239,239,-2,0,75,75,75,2,4,215,215,215,0,-3,247,247,247,-3,-1,215,215,215,0,2,199,199,199,1,-1,51,51,51,1,-3,93,93,93,-1,0,232,232,232,-2,5,247,247,247,-1,0,247,247,247,0,1,247,247,247,0,1,247,247,247,0,1,247,247,247,1,1,247,247,247,1,0,247,247,247,1,0,247,247,247,-1,-6,199,199,199,3,-3,75,75,75,5,1,199,199,199,0,1,239,239,239,1,0,120,120,120,0,1,142,142,142,0,1,142,142,142,1,0,75,75,75,0,1,93,93,93,0,1,142,142,142,-1,0,51,51,51,-3,2,51,51,51,0,1,247,247,247,0,1,247,247,247,1,0,247,247,247,0,-1,247,247,247,0,-1,51,51,51,1,0,199,199,199,0,-1,51,51,51,1,0,120,120,120,0,-2,120,120,120,1,-3,93,93,93,1,1,215,215,215,0,1,215,215,215,0,1,232,232,232,-3,-1,247,247,247,0,-1,247,247,247,2,0,75,75,75,-1,-2,51,51,51,-1,-1,51,51,51,-1,0,199,199,199,0,-1,51,51,51,1,0,172,172,172,1,1,93,93,93,1,0,232,232,232,0,1,142,142,142,-4,-1,247,247,247,0,-1,51,51,51,-1,0,51,51,51,-1,0,51,51,51,0,-1,247,247,247,-1,0,247,247,247,-1,0,247,247,247,0,1,247,247,247,-1,2,120,120,120,-2,0,247,247,247,0,1,247,247,247,0,1,247,247,247,2,-4,247,247,247,2,0,172,172,172,1,1,215,215,215,1,0,247,247,247,2,5,247,247,247,0,2,199,199,199,2,-8,247,247,247,-1,-1,247,247,247,-1,0,247,247,247,-1,0,247,247,247,-1,0,247,247,247,-1,11,247,247,247,1,0,247,247,247,3,0,247,247,247,1,0,247,247,247,0,-1,247,247,247,1,-1,239,239,239,1,0,247,247,247,-3,3,247,247,247,1,0,247,247,247,1,0,247,247,247,0,-1,247,247,247,0,-1,247,247,247,-9,-10,247,247,247", "2", "Yes")
          Mouse.Hold button("Left")
          Mouse.Move in direction("Right", "100")
          Mouse.Release button("Left")
          Clipboard.Copy()
          Humanly.Pause("250", "750")
          Window.Bring to front("Book1 - Excel", "Yes")
          Humanly.Pause("250", "750")
          Clipboard.Paste()
          Humanly.Pause("250", "750")
          Keyboard.Press key("{<down>}")
          Window.Bring to front("SCE_Santa Barbara - Google Chrome", "Yes")
          Humanly.Pause("250", "750")
     end
function
 


Top
 Profile  
Reply with quote  
 Post subject: Re: Need help with macro
Thanked: 0 time(s)  Unread post Posted: Wed Nov 06, 2019 9:14 pm 
New User
New User



Joined: Wed Nov 06, 2019 6:36 pm
Posts: 5
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 17
Hmm i think im missing the loop for the first section lol


Top
 Profile  
Reply with quote  
 Post subject: Re: Need help with macro
Thanked: 0 time(s)  Unread post Posted: Wed Nov 06, 2019 11:11 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1963
Location: USA
Been thanked: 437 time(s)
Has thanked: 34 time(s)
Contribution Points: 16782
You would need to give more information for us to figure out why it's not searching in the appropriate areas, like where is it searching instead? How many pixels off is the search? What kind of window are you searching? There could be various reasons that may not be in your script...or it may be your script, lol; I can't tell from what you posted.

Your script looks fine. The only thing I see is you're using global variables and not sure why. Are you running multiple macros at once (usually only reason to use globals)?

So when I'm testing a new macro I like to use visuals, like mouse.move, so I can see what's going on. After I get it working I switch to mouse.click or stuff I can't see...but I've already got it dialed in by then.

I did a test for what you described and the script below works fine. First open the attached image and put the window somewhere on your screen (I also shrunk it down pretty small). I assume if you're only moving 10 pixels at a time you're searching for something small too. Then set the x/y coordinates to the first block. Afterwards, select a color and change the RGB values in the script for the color you want to search for. Then run the macro.

It should move the mouse to the first location you set the variables for and then start moving right, 10 pixels at a time, until it reaches the correct color. At that time you will receive a pop-up that states it found the color.

Try this out and then you can modify the code to do what you want it to. Hope that helps!

Code:
 begin
     Variable.Set("x", "205")
     Variable.Set("y", "465")
     begin loop()
          Mouse.Move to coordinate("{x}", "{y}")
          if  Color.At the current mouse position is (RGB)("255", "255", "0")
               begin
                    Window.Display message box("Found the color", "yes")
                    Macro.Abort()
               end
          Macro.Pause("500")
          Function.Execute("ChangeVariableCoordinates")
     end
end

function("ChangeVariableCoordinates")
          begin
               Variable.Add (Math)("x", "10")
          end
function
     
After you get this working and see what it's doing, you should be able to figure out the rest for your script.


Attachments:
ColorBoxes.png
ColorBoxes.png [ 1.26 KiB | Viewed 61 times ]

_________________
----------------------------------------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: Need help with macro
Thanked: 1 time(s)  Unread post Posted: Thu Nov 07, 2019 5:07 am 
Gold Contributor
Gold Contributor



Joined: Thu Nov 24, 2016 12:55 am
Posts: 269
Been thanked: 60 time(s)
Has thanked: 5 time(s)
Contribution Points: 69
skymacro wrote:
Hello, new user and first time poster here. I need some help with my macro. The main goal of this macro is to look for a pixel pattern and in a "small section" of the screen and move over 10 pixels if not found. I set a couple of variables for the coordinates of the "small section" to be increased when not found but it seems the macro isn't searching the appropriates sections. Help?



Rather doing that I think it would be much easier to use:

Code:

      Color.Limit area of interest to coordinates("{x1}", "{y1}", "10", "10")



The first two arguments is the coordinate set specifying the top left corner of the limited region, the remaining two argument specifies the width and height of the region.

also remember to use color.unlimit area of interest after checking.

then if not found you can just add the increment in the variables..


also this part of your code is not a part of your main code or isn't a function. so BEM will not execute it.. If I remember correctly.

skymacro wrote:
Code:
 begin
     //
     Variable.Add (Math)("X1", "10")
     if  Variable.Is greater than (Math)("X1", "1850")
          begin
               Variable.Set global("X1", "530")
               Mouse.Move to coordinate("1643", "1023")
               Mouse.Hold button("Left")
               Mouse.Move in direction("Up", "15")
               Mouse.Release button("Left")
          end
 end
 //
 if  Color.Pixel pattern can not be located on screen("0,112,255,1,1,0,112,255,0,1,0,112,255,-1,-1,0,112,255,-1,0,0,112,255,0,1,0,112,255,0,1,0,103,234,0,1,2,33,76,1,0,0,103,234,1,0,0,112,255,1,0,0,112,255,0,-1,0,112,255,1,0,0,112,255,0,-2,0,112,255,0,-1,0,112,255,0,-1,0,103,234,-1,0,0,112,255,-1,0,0,112,255,-1,0,0,103,234,-1,1,0,103,234,0,-1,1,33,75,2,1,0,112,255,1,1,0,112,255,1,1,0,112,255,-1,0,0,112,255,-2,0,0,112,255,1,1,0,112,255,1,-3,0,112,255,2,0,0,103,234,0,1,0,112,255,0,1,0,112,255,0,1,0,103,234,-1,1,0,103,234,-3,-1,0,112,255", "2")
     begin
          Mouse.Move to coordinate("510", "216")
          Mouse.Hold button("Left")
          Mouse.Move in direction("Down", "750")
          Mouse.Release button("Left")
          Mouse.Move to coordinate("800", "216")
          Mouse.Hold button("Left")
          Mouse.Move in direction("Left", "300")
          Mouse.Release button("Left")
          //
     end


 

_________________
Ragnarok Online

Bot4You ROPH (will also work on other servers but you need to make your own bypass)
http://www.blueeye-macro.com/viewtopic.php?f=437&t=30450

Creating .spr file or sprite for Pixel bot
http://www.blueeye-macro.com/viewtopic.php?f=435&t=30445

Changing monster sprite and items sprite
http://www.blueeye-macro.com/viewtopic.php?f=435&t=30516


Top
 Profile  
Reply with quote  
 Post subject: Re: Need help with macro
Thanked: 0 time(s)  Unread post Posted: Fri Nov 08, 2019 12:39 am 
New User
New User



Joined: Wed Nov 06, 2019 6:36 pm
Posts: 5
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 17
Syrifina wrote:

Try this out and then you can modify the code to do what you want it to. Hope that helps!

Code:
 begin
     Variable.Set("x", "205")
     Variable.Set("y", "465")
     begin loop()
          Mouse.Move to coordinate("{x}", "{y}")
          if  Color.At the current mouse position is (RGB)("255", "255", "0")
               begin
                    Window.Display message box("Found the color", "yes")
                    Macro.Abort()
               end
          Macro.Pause("500")
          Function.Execute("ChangeVariableCoordinates")
     end
end

function("ChangeVariableCoordinates")
          begin
               Variable.Add (Math)("x", "10")
          end
function
     


Thanks so much, this logic worked perfectly with what i was trying to do!


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