Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tut] Find color on screen | Good for beginner bots [VB.Net]
#1
Finding and Clicking a color on you Screen
By MMKI


Hey guys
I posted this tut on HF a while ago. Thought i would post here also. Only thing i worry of is if there is a way easier way to do this
that i haven't found Tongue Please don't use the code without looking over it. Its to learn not to use.
It scans each pixel on the screen for a RGB color. In this case i'm using it to find the light red ball on a game on pool in the popular game website OMGPOP.
The color im using is 217, 59, 73 (light red)

Place a button on your form and double click it to edit its code
Code:
Dim screensize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
  Dim screenshot As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
  Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(screenshot)
  g.CopyFromScreen(New Point(0, 0), New Point(0, 0), screensize)

This code takes a screenshot of the screen at sets it to full size (you will not be able to see it) Its from this invisible screenshot that the program will find the color
Next add the following
Code:
Dim pointx As Integer = 1
Dim pointy As Integer = 1
Dim looking As Boolean = True

Just declaring some integers and a boolean we are about to use. pointx
and pointy are the pixel that the program will scan for the correct colored pixel
Now add
Code:
Try
    While looking = True
    Dim atpoint As Color = screenshot.GetPixel(pointx, pointy)
    Dim red As Color = Color.FromArgb(255, 217, 59, 73) 'light red ball colour

    If atpoint = red Then
    Cursor.Position = New Point(pointx, pointy)
    looking = False
    pointx = 1
    pointy = 1
    End If

    pointy = pointy + 1
    If pointy = My.Computer.Screen.Bounds.Height Then
    pointy = 0
    pointx = pointx + 1
    End If

    End While

This code starts at the first pixel (1, 1). Then continues to scan each pixel until
it reaches the correct colored pixel.

Dim red As Color = Color.FromArgb(255, 217, 59, 73) 'light red
It is with that line in the previous code that you choose what color you want to find. In my case light red (255, 217, 59, 73)

Next add:
Code:
Catch ex As Exception
    MsgBox("Cannot find Color", , "HELP")
  End Try
This ends our try. With it is a catch, meaning it will come up with the
error msgbox saying the color cannot be found.

[Image: 49026587.png]
You can see here, kinda, that my mouse has found the color ball i selected and moved the mouse there.

http://www.hackforums.net/showthread.php?tid=232812 < This tutorial, by hackurheart, tells you how to simulate a mouse click. Which will come in handy if your trying to make a bot with this method or something.

Thanks for reading Smile
Hope i helped some people Smile
[Image: blanktemplate.png]
Reply
#2
Said it on HF and I'll say it again here, fantastic tutorial. I've been wondering how to do this for a long time but never actually gave it a shot.
Reply
#3
Very nice tutorial man! Well done and thank you.
[Image: electricdreamswithborde.png]
Reply
#4
Awesome tutorial,thanks man.
Reply
#5
Thanks peeps Smile
Glad you liked it Smile
[Image: blanktemplate.png]
Reply
#6
saw this on hf and would like to say that its a great tutorial. well done and would like to see an advanced version for variable changes and colors on screen.
[Image: deities.jpg]
Reply
#7
I've added this to my compilation thread. Hope you don't mind! :]
Reply
#8
Nice tutorial , but one think I don't understand .
Here you use 217 = red , 59 = green , 73 = blue. What means the 255 ?
Dim red As Color = Color.FromArgb(255, 217, 59, 73)
My only goal is to help other people .
[Image: gNQgw]
How to make a Photo Viewer [HQ]
Reply
#9
Cool.

this is also how basic aimbots work.

Smile
Reply
#10
(08-13-2010, 12:17 AM)BlaiR Wrote: Cool.

this is also how basic aimbots work.

Smile

That are pixels bots . Bit slow and laggy though :p
My only goal is to help other people .
[Image: gNQgw]
How to make a Photo Viewer [HQ]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to hook the keyboard. [VB.NET] [TuT] Vorfin 92 53,914 09-23-2019, 11:55 AM
Last Post: Jamimartin
  VB.NET Port Scanner [TUT] Fragma 30 12,597 11-27-2012, 11:26 PM
Last Post: ƃu∀ ıʞƃu∀
  [TUT] MD5 Encrypter & Finder [VB.NET] Fragma 12 6,867 11-25-2012, 10:36 PM
Last Post: ƃu∀ ıʞƃu∀
  [TUT] How to make a simple WebBrowser in VB 2010! [TUT] - [ Pictures] Statics 95 54,977 10-07-2012, 06:56 AM
Last Post: a99
  [VB.Net][SRC]ProgressBar Color HF~Legend 14 6,768 09-08-2012, 04:18 PM
Last Post: spesificrelax

Forum Jump:


Users browsing this thread: 1 Guest(s)