Blue Eye Logo

Blue Eye Macro

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

All times are UTC




Post new topic Reply to topic  [ 103 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next
Author Message
 Post subject: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Wed Apr 07, 2010 9:43 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
So yea... i couldn't help myself...

I desided to spent half an hour figuring out a better math form for the basket ball game at onlinegames.com

It is still not a 100% perfect, but now it will also set the aim correctly for basket balls in line with or above the basket.
It scores clean baskets about 95% of the time id guess.

Link: http://www.onlinegames.com/basketball/

Here is how it went when i tested it :)
Attachment:
BasketFirstPlace.jpg
BasketFirstPlace.jpg [ 21.69 KiB | Viewed 9634 times ]


And here is the BE code
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


Again, you need to create two variables of your baskets position:
(You can find the coordinate using Investigator, just like i did in the earlier basket tutorial video.)

basketX (the X coordinate of the baskets center position)
basketY (the Y coordinate of the baskets center position)

On my machine basketX is 160 and basketY is 410.

Also remember to create a image of the basket ball and save it at C:\basketBall.png (or somewhere else, and change the path in the macro)

How to find the baskets coordinates, and create the image of the basket ball, just do exactly as i did in the first basket ball macro tutorial
(You can see the video tutorial @ YouTube : http://www.youtube.com/watch?v=kctMU65yxWc)

Here is the (old and less than perfect) macro as a download (drag it in to your BE main window macros to install)
Attachment:
for fun.basket.bem [13.61 KiB]
Downloaded 825 times


(Remember to update the image of the basketball)

Enjoy :)


UPDATE:
A truly amazing macro has been posted by Papatsonis.
Ive chosen to copy it here, to make sure everyone will see it.

It is by far better than what i managed to come up with.
Great work Papatsonis! And thank you for sharing.

this is the macro he posted, go to page 3 to see his description of the development-process.
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


It requires 3 variables + an image of the basketball (view the video tut, to see how to get them).

These are the variables I'm using (you need to click "Display Variables" inside the wizard, once you edit the macro to fit your screen resolution (I'm running 1440x900)).

tanF = 1
basketX = 160
basketY = 410

Download: (new and improved version, created by papatsonis)
Attachment:
onlinegames.com.basket.bem [10.79 KiB]
Downloaded 805 times


This is how it went when i tested this one:
Attachment:
rank.png
rank.png [ 4.82 KiB | Viewed 9433 times ]

_________________
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 Apr 11, 2010 7:46 pm 
New User
New User



Joined: Wed Mar 31, 2010 9:06 am
Posts: 6
Been thanked: 2 time(s)
Has thanked: 0 time(s)
Contribution Points: 42
Gigus wrote:
So yea... i couldn't help myself...

I desided to spent half an hour figuring out a better math form for the basket ball game at onlinegames.com

It is still not a 100% perfect, but now it will also set the aim correctly for basket balls in line with or above the basket.
It scores clean baskets about 95% of the time id guess.

Link: http://www.onlinegames.com/basketball/

Here is how it went when i tested it :)
Attachment:
BasketFirstPlace.jpg


And here is the BE code
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


Again, you need to create two variables of your baskets position:
(You can find the coordinate using Investigator, just like i did in the earlier basket tutorial video.)

basketX (the X coordinate of the baskets center position)
basketY (the Y coordinate of the baskets center position)

On my machine basketX is 160 and basketY is 410.

Also remember to create a image of the basket ball and save it at C:\basketBall.png (or somewhere else, and change the path in the macro)

How to find the baskets coordinates, and create the image of the basket ball, just do exactly as i did in the first basket ball macro tutorial
(You can see the video tutorial @ YouTube : http://www.youtube.com/watch?v=kctMU65yxWc)

Here is the macro as a download (drag it in to your BE main window macros to install)
Attachment:
for fun.basket.bem


Enjoy :)


Ain't working for me :/!

btw.... Denmark on top of the rank list ;)!


Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Sun Apr 11, 2010 8:19 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
What part of it does not work for you imortalius?

Did you create the screendump/image of the ball? like i did in the v1 tutorial video? (and make sure not to have anything but the ball in the image (like in the video).

Here is the image I'm using for the image recognition:
Attachment:
basketBall.png
basketBall.png [ 795 Bytes | Viewed 9616 times ]



At what screen resolution are you running?
and what are the values of your basketX and basketY variables?


And yea, I live in Denmark, that would be why, hehe ;)

_________________
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 Apr 11, 2010 8:28 pm 
New User
New User



Joined: Tue Apr 06, 2010 2:10 pm
Posts: 8
Been thanked: 1 time(s)
Has thanked: 0 time(s)
Contribution Points: 252
I tried it a few days ago, worked alright for me, think i had about 90-95% clean basket rate.

Im running in a 1440x900 screen resolution, and used 160 for basketX and 409 for basketY.


Top
 Profile  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Tue Apr 20, 2010 7:01 pm 


Hi,

How can i download this?

It says i don't have the necessary permission?


Top
  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Tue Apr 20, 2010 7:15 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
Guest wrote:
Hi,

How can i download this?

It says i don't have the necessary permission?


Please create a forum account.

_________________
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: Sat Apr 24, 2010 1:02 pm 


both dont work it just dont do nothing

lets take the 1st try with 1st vers

Code:
begin
     Image.Find location of first occurrence on screen("C:\users\*******\ball.png", "25", "ballX", "ballY")
     Variable.Copy("ballX", "distanceX")
     Variable.Copy("ballY", "distanceY")
     Variable.Subtract (Math)("distanceX", "{basketX}")
     Variable.Subtract (Math)("distanceY", "{basketY}")
     Variable.Copy("distanceX", "adjustX")
     Variable.Divide (Math)("adjustX", "25")
     Variable.Divide (Math)("distanceX", "3")
     Variable.Divide (Math)("distanceY", "2")
     Variable.Copy("basketX", "resultX")
     Variable.Copy("basketY", "resultY")
     Variable.Add (Math)("resultX", "{distanceX}")
     Variable.Add (Math)("resultX", "{adjustX}")
     Variable.Subtract (Math)("resultY", "{distanceY}")
     Mouse.Click button at coordinate("{resultX}", "{resultY}", "left")
end


i did all the same

i have the basket X and Y (187,480)

if i press the trigger button nothing happens at all, tho its macro there should not be problem with OS or browser.


Top
  
Reply with quote  
 Post subject: Re: Basket Ball Bot v2
Thanked: 0 time(s)  Unread post Posted: Sat Apr 24, 2010 1:04 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
forgot to login earlier, btw this macro only gets you 220 score?

my record is bout 210 w/o help :o

_________________
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: Sat Apr 24, 2010 1:08 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
Guest wrote:
both dont work it just dont do nothing

lets take the 1st try with 1st vers

Code:
begin
     Image.Find location of first occurrence on screen("C:\users\*******\ball.png", "25", "ballX", "ballY")
     Variable.Copy("ballX", "distanceX")
     Variable.Copy("ballY", "distanceY")
     Variable.Subtract (Math)("distanceX", "{basketX}")
     Variable.Subtract (Math)("distanceY", "{basketY}")
     Variable.Copy("distanceX", "adjustX")
     Variable.Divide (Math)("adjustX", "25")
     Variable.Divide (Math)("distanceX", "3")
     Variable.Divide (Math)("distanceY", "2")
     Variable.Copy("basketX", "resultX")
     Variable.Copy("basketY", "resultY")
     Variable.Add (Math)("resultX", "{distanceX}")
     Variable.Add (Math)("resultX", "{adjustX}")
     Variable.Subtract (Math)("resultY", "{distanceY}")
     Mouse.Click button at coordinate("{resultX}", "{resultY}", "left")
end


i did all the same

i have the basket X and Y (187,480)

if i press the trigger button nothing happens at all, tho its macro there should not be problem with OS or browser.


The first version is really not very good, id suggest to go with only the second version.
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


And make sure you create the image of the ball to search for, (or download the one i used from the link above)
And place the image at C:\basketBall.png (or change the following line to reflect your own location)
Code:
 Image.Find location of first occurrence on screen("C:\basketBall.png", "25", "ballX", "ballY")


Did you remember to add the desired trigger inside the wizard?
Can you see in the "History" box inside the main window that your macro was actually executed?

If it did, then press the "Log" link in the main window after you have executed the macro, that will tell you exactly what happened.

If you are still not able to get it to work, please post the log here, and ill try to see what is going on.

_________________
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: Sat Apr 24, 2010 3:22 pm 


oh i see the log now
Code:
Started
Executing: Image.Find location of first occurrence on screen(Path: C:\basketBall.png, Percent: 25, {X}: ballX, {Y}: ballY)
[color=#FF0000]Error: The image was not recognized anywhere on the screen[/color]

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: 343,8, 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


it wont find the basketball img on the screen, i even tryed to use your image

ps! the confirmation code is quite unreadable 50% of times :|


Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 103 posts ]  Go to page 1, 2, 3, 4, 5 ... 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