Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Thu Nov 21, 2024 7:34 pm

All times are UTC




Post new topic Reply to topic  [ 103 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 11  Next
Author Message
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Mon Apr 26, 2010 3:56 pm 
Partner / Developer
Partner / Developer
User avatar



Joined: Mon Jan 18, 2010 11:51 am
Posts: 4525
Been thanked: 1346 time(s)
Has thanked: 133 time(s)
Contribution Points: 33209
saintsant wrote:
since i did not figure out the math youve made i thought bout something else
Code:
begin
     Image.Find location of first occurrence on screen("C:\basketBall.png", "25", "ballX", "ballY")
     if  Variable.Is greater than (Math)("ballY", "481")
          begin
               Variable.Evaluate (Math)("({ballY} - {basketY}) / 2)", "resultY")
               Variable.Evaluate (Math)("({ballX} - {basketX}) / 2)", "resultX")
               Variable.Evaluate (Math)("{ballY} - {basketY}", "differenceY")
               Mouse.Click button at coordinate("{resultX} - {differenceY}", "{resultY}", "left")
          end
          if  Variable.Is less than (Math)("ballY", "479")
               begin
                    Variable.Evaluate (Math)("({basketY} - {ballY}) / 2)", "resultY")
                    Variable.Evaluate (Math)("({ballX} - {basketX}) / 2)", "resultX")
                    Variable.Evaluate (Math)("(479 - {resultY}) + 150)", "differenceY")
                    Mouse.Click button at coordinate("{resultX}", "{resultY} + {differenceY}", "left")
               end
 end


dno how this works yet, i post before trying :D

have this: Error: Invalid convertion from one format to another (Probably a text to number conversion - Hint: Invalid variable value?)

/edit: oh i think i have huge misateks there



The following line is not valid.
Code:
Mouse.Click button at coordinate("{resultX} - {differenceY}", "{resultY}", "left")


the reason your are getting the error your are, is that it is trying to parse the following text (string) "{resultX} - {differenceY}" in to a number (integer) for the X coordinate of where to click.

using inline evaluations such as "{resultX} - {differenceY}" is not supported as arguments, use Variable.Evaluate (Math) to calculate that, and then pass the result to the Click button action.

I have though been thinking about allowing inline evaluations such as this one... It could save a few lines now and then.

_________________
Blue Eye - Developer / Moderator
Code:
Gigus


Please read the rules about contribution points - click here

Do you know everything about BE, the forum, licenses and contribution points?
Please take a minute to read this introduction & guidelines.


Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Mon Apr 26, 2010 4:11 pm 
Partner / Developer
Partner / Developer
User avatar



Joined: Mon Jan 18, 2010 11:51 am
Posts: 4525
Been thanked: 1346 time(s)
Has thanked: 133 time(s)
Contribution Points: 33209
Here is a detailed explanation of my form.

Code:
begin
     Image.Find location of first occurrence on screen("C:\basketBall.png", "25", "ballX", "ballY")
     if  Variable.Is greater than (Math)("ballY", "600")
          begin
               Variable.Evaluate (Math)("{basketY} - (({ballY} - {basketY}) / 2)", "resultY")
               Variable.Evaluate (Math)("{basketX} + (({ballX} - {basketX}) / 3) + (({ballX} - {basketX}) / 25)", "resultX")
          end
          if  Variable.Is less than (Math)("ballY", "601")
               begin
                    Variable.Set("resultY", "1")
                    Variable.Evaluate (Math)("{basketX} + 5 + (({ballX} - {basketX}) / 2) - ({ballX} / 85) - (({ballY} - {basketY}) / 8 )", "resultX")
               end
               Mouse.Click button at coordinate("{resultX}", "{resultY}", "left")
end


First i find the ball, and save its location in the following variables "ballX" and "ballY".
If the balls vertical position is more than 600 pixels from the top of the screen - ill go for a low and fast shot
begin
I figured out that the baskets y coordinate - ((the balls Y coordinate - the baskets y coordinate) divided by two) equals the vertical Y coordinate of where i want my mouse to click.
then i figured out that the baskets x coordinate - ((the balls x coordinate - the baskets x coordinate divided by three) roughly equals the horizontal X coordinate of where i want my mouse to click, however the further away on the horizontal axis the ball is, the more off the shot would be, but just by a bit. so thats why i'm adding (the balls x coordinate - the baskets x coordinate) divided by 25) to the current result for x coordinate. That would make the shot close to perfect (on my 16*9 monitor)
end
However if the ball was closer to the top of screen than 600 pixels then id go for a much higher and slower shot (moving the cursor to the top of the screen).
begin
id set the resultY to 1, because i want it to click at the very top of the screen on the y axis.
Then figuring out the X coordinate was a bit more tricky, i'm guessing trying to explain it wont be at much help, you can view the form yourself, however for the most part, i was just guessing, and seeing if i needed it to be closer or further away from the basket, and then modifying the formula accordingly.. which took a bit of time, and surely a much cleaner and better solution could be made.
end
Last but not least, i just click the left mouse button at the results it came up with, no matter if the ball was above or below the 600 pixels on the Y axis, id just save the result in to the same two variables, so id only need the Click button action once, using those two variables.

I hope all of this made just a bit of sense ;)

_________________
Blue Eye - Developer / Moderator
Code:
Gigus


Please read the rules about contribution points - click here

Do you know everything about BE, the forum, licenses and contribution points?
Please take a minute to read this introduction & guidelines.


Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Sun May 02, 2010 10:17 am 
New User
New User



Joined: Sun May 02, 2010 10:06 am
Posts: 1
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 10
i have this problems

Started
Executing: Image.Find location of first occurrence on screen(Path: C:\basketBall.png, Percent: 25, {X}: ballX, {Y}: ballY)
Error: Unknown
Checking if: Variable.Is greater than (Math)(Variable name: ballY, Value: 600)
Error: A variable called ballY, does not exist
Checking if: Variable.Is less than (Math)(Variable name: ballY, Value: 601)
Error: A variable called ballY, does not exist
Executing: Mouse.Click button at coordinate(X Coordinate: {resultX}, Y Coordinate: {resultY}, Mouse Button: left)
Error: Invalid convertion from one format to another (Probably a text to number conversion - Hint: Invalid variable value?)
Stopped


Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Sun May 02, 2010 2:54 pm 
Partner / Developer
Partner / Developer
User avatar



Joined: Mon Jan 18, 2010 11:51 am
Posts: 4525
Been thanked: 1346 time(s)
Has thanked: 133 time(s)
Contribution Points: 33209
bobi9876 wrote:
i have this problems

Started
Executing: Image.Find location of first occurrence on screen(Path: C:\basketBall.png, Percent: 25, {X}: ballX, {Y}: ballY)
Error: Unknown
Checking if: Variable.Is greater than (Math)(Variable name: ballY, Value: 600)
Error: A variable called ballY, does not exist
Checking if: Variable.Is less than (Math)(Variable name: ballY, Value: 601)
Error: A variable called ballY, does not exist
Executing: Mouse.Click button at coordinate(X Coordinate: {resultX}, Y Coordinate: {resultY}, Mouse Button: left)
Error: Invalid convertion from one format to another (Probably a text to number conversion - Hint: Invalid variable value?)
Stopped


Please go to Settings and turn on "show details for unknown errors".
Then run the macro again, and post the new log here.

_________________
Blue Eye - Developer / Moderator
Code:
Gigus


Please read the rules about contribution points - click here

Do you know everything about BE, the forum, licenses and contribution points?
Please take a minute to read this introduction & guidelines.


Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Tue May 04, 2010 9:41 pm 
Lifetime VIP Contributor
Lifetime VIP Contributor
User avatar



Joined: Sat Apr 24, 2010 12:51 pm
Posts: 355
Location: Tallinn
Been thanked: 18 time(s)
Has thanked: 1 time(s)
Contribution Points: 4647
well i got it workin :D

but im thinking of adding new variable as:
Code:
if  Variable.Is greater than (Math)("ballY", "600")
    Variable.Is greater than (Math)("ballX", "1400")

begin

something like that

because atm it only misses the very long shots, and tho this 2-3sec delay im having, when pressing the trigger (maybe its because of w7) close range shots are quite useless, since i can do them faster myself

ps: i got bout 180 max only using macro, but usually the score stays at 160 or so

_________________
Full time IT student/worker - BE showed me the way, so may the code be with you all!
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Thu May 06, 2010 10:21 pm 
Partner / Developer
Partner / Developer
User avatar



Joined: Mon Jan 18, 2010 11:51 am
Posts: 4525
Been thanked: 1346 time(s)
Has thanked: 133 time(s)
Contribution Points: 33209
saintsant wrote:
well i got it workin :D

but im thinking of adding new variable as:
Code:
if  Variable.Is greater than (Math)("ballY", "600")
    Variable.Is greater than (Math)("ballX", "1400")

begin

something like that

because atm it only misses the very long shots, and tho this 2-3sec delay im having, when pressing the trigger (maybe its because of w7) close range shots are quite useless, since i can do them faster myself

ps: i got bout 180 max only using macro, but usually the score stays at 160 or so



Im glad you got it working :)
About the 2-3 sec delay, thats probably the time it takes Blue Eye to recognize the image on your screen, and the higher your screen resolution, the longer it will take as there is more pixels for Blue Eye to run though searching for the patterns found inside the image your looking for.

In version 1.2 of Blue Eye a new function called Find object is introduced, that will be usable as an alternative to using image recognition, and in most cases will be a faster choice.

We are expecting to release version 1.2 saturday or sunday this week if no major bugs is found during tests.

_________________
Blue Eye - Developer / Moderator
Code:
Gigus


Please read the rules about contribution points - click here

Do you know everything about BE, the forum, licenses and contribution points?
Please take a minute to read this introduction & guidelines.


Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Fri May 21, 2010 5:06 am 
Lifetime VIP Contributor
Lifetime VIP Contributor



Joined: Fri May 21, 2010 12:05 am
Posts: 14
Location: Greece
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 765
Greetings from Greece.

i discovered yesterday this handy proggie, and im a amazed :). The reason was this famous(?) basketball game, and try to prove (at least only to me...) that some top scores in a Greek forum's group were using cheat(either blue eye, or flash hack).
I had to freshen up my high school knowledge in coordinate geometry, but the result is perfect as you'll see ;). There are infinite parabolas crossing the 2 points (the ball and the basket), so i had to add an extra "constant" to limit the solution to only one.Tried at first, custom fuzzy height, but wasnt as elegant id like:P, so added the "impact angle" F setting.Due to not supporting trigonometric functions, u have to set directly the tanF (the windows scientific cals is just fine) of this angle.u can see which angle i mean in this photo
Image
you want of course, to have as low F angle, as possible u can, so the "flight" time to be as low as possible as to be ready for the next shot ;) (u can have an estimation of minimum angle from this formula, F=arcTan(BallDiameter/BasketDiameter) , or u can just start trying :)
The script code is this:
Code:
 begin
     Image.Find location of first occurrence on screen("C:\xxxxx\basketball.png", "25", "ballX", "ballY")
     Variable.Evaluate (Math)("({ballY}-{basketY})/({ballX}-{basketX})", "R1")
     Variable.Evaluate (Math)("(2*{R1}*{basketX}+{tanF}*({basketX}+{ballX}))/(2*({R1}+{tanF}))", "M")
     Variable.Evaluate (Math)("{M}-{basketX}", "p1")
     Variable.To power of (Math)("p1", "2")
     Variable.Evaluate (Math)("{ballX}-{M}", "p2")
     Variable.To power of (Math)("p2", "2")
     Variable.Evaluate (Math)("({p1}*{ballY}-{p2}*{basketY})/({p1}-{p2})", "B")
     Mouse.Double click button at coordinate("{M}", "{B}", "Left")
 end


has one minor flaw though, the ball isnt a "point".. has some measurable diameter, so in very close to basket shots, the ball will hit the basket ascending.

Happy scores :D


Last edited by papatsonis on Thu May 27, 2010 1:19 am, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Fri May 21, 2010 6:04 am 
Lifetime VIP Contributor
Lifetime VIP Contributor
User avatar



Joined: Sat Apr 24, 2010 12:51 pm
Posts: 355
Location: Tallinn
Been thanked: 18 time(s)
Has thanked: 1 time(s)
Contribution Points: 4647
very nice macro
tho i eddited this a bit
Code:
 begin
     Image.Find location of first occurrence on screen("C:/macro/ball.png", "25", "ballX", "ballY")
     if  Variable.Exists("ballX")
          begin
               Variable.Evaluate (Math)("({ballY} - {basketY}) / ({ballX} - {basketX})", "R1")
               Variable.Evaluate (Math)("(2 * {R1} * {basketX} + {tanF} * ({basketX} + {ballX}) )/ (2 * ({R1} + {tanF}))", "M")
               Variable.Evaluate (Math)("{M} - {basketX}", "p1")
               Variable.To power of (Math)("p1", "2")
               Variable.Evaluate (Math)("{ballX} - {M}", "p2")
               Variable.To power of (Math)("p2", "2")
               Variable.Evaluate (Math)("({p1}  *{ballY} - {p2}*{basketY}) / ({p1} - {p2})", "B")
               Mouse.Click button at coordinate("{M}", "{B}", "left")
          end
     if  Variable.Does not exist("ballX")
          begin
               Macro.Restart()
          end
 end
 

it needs left click only (not double) to throw, and since i have bit problems with finding images, i added the bottom lines, to make the macro try again find the ball :)
also for myself i replaced the image. to mouse.save coordinates, so i just put my mouse ~middle of the ball and scored 353 :P

_________________
Full time IT student/worker - BE showed me the way, so may the code be with you all!
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Fri May 21, 2010 7:16 am 
Partner / Developer
Partner / Developer
User avatar



Joined: Mon Jan 18, 2010 11:51 am
Posts: 4525
Been thanked: 1346 time(s)
Has thanked: 133 time(s)
Contribution Points: 33209
papatsonis wrote:
Greetings from Greece.
...
Happy scores :D


Absolutely fantastic work Papatsonis!

I'm very impressed, this macro is way better than anything I was even close to being able to come up with.

Thank you very much for sharing, and welcome to the forum.

Ps.
I updated the main post, to include your macro, to make sure everyone will see it.

_________________
Blue Eye - Developer / Moderator
Code:
Gigus


Please read the rules about contribution points - click here

Do you know everything about BE, the forum, licenses and contribution points?
Please take a minute to read this introduction & guidelines.


Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Fri May 21, 2010 7:19 am 
Partner / Developer
Partner / Developer
User avatar



Joined: Mon Jan 18, 2010 11:51 am
Posts: 4525
Been thanked: 1346 time(s)
Has thanked: 133 time(s)
Contribution Points: 33209
saintsant wrote:
I replaced the image. to mouse.save coordinates, so i just put my mouse ~middle of the ball and scored 353 :P


Yea, you can save 300~750 milliseconds per shot (depending on your image recognition settings and screen resolution), simply by moving your cursor to the ball, and save the current coordinate to variables before starting instead of finding the ball using image recognition.

_________________
Blue Eye - Developer / Moderator
Code:
Gigus


Please read the rules about contribution points - click here

Do you know everything about BE, the forum, licenses and contribution points?
Please take a minute to read this introduction & guidelines.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 103 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 11  Next

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