• Log in or sign up for an account here: https://www.sythe.org/login

my findColor method

Status
Not open for further replies.

slashshot007

Active Member
Joined
May 6, 2006
Sythe Gold
0
Messages
164
my findColor method
basically what the title says.
Code:
	Private Function findColor(ByVal Color As Color, ByVal Area As Rectangle) As Point
		Dim AreaSize As Size = Area.Size
		Dim TempBitmap As New Bitmap(AreaSize.Width, AreaSize.Height)
		Graphics.FromImage(TempBitmap).CopyFromScreen(Area.Location, New Point(), AreaSize)
		For x As Integer = 0 To Area.Height - 1
			For y As Integer = 0 To Area.Width - 1
				If TempBitmap.GetPixel(x, y) = Color Then Return New Point(Area.X + x, Area.Y + y)
			Next
		Next
		Return New Point(-1, -1)
	End Function

for actually getting the Color to find:
or using a button where you press down, and release over the selected color, use this as an example
in this case, a picturebox called PictureBoxColor has its background color changed to the hovered over color.

Code:
	Private Sub btnGetColor_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnGetColor.MouseDown
		tmrGetColor.Start()
	End Sub


	Private Sub tmrGetColor_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrGetColor.Tick
		Dim TempBitmap As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
		Graphics.FromImage(TempBitmap).CopyFromScreen(Screen.PrimaryScreen.Bounds.Location, New Point(), Screen.PrimaryScreen.Bounds.Size)
		PictureBoxColor.BackColor = TempBitmap.GetPixel(System.Windows.Forms.Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y)
	End Sub

	Private Sub btnGetColor_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnGetColor.MouseUp
		tmrGetColor.Stop()
	End Sub
 
my findColor method
please help me i want to make a bot which, using colour detection will go to a general store on runescape, buy items (i want water filled vials) then go back and bank. I have tried to do this with a simple autoclicker but it does not work as the shopkeeper moves!
will your thingy above help me? if so wat on earth do i do with it? where do i paste it etc... thanks
 
my findColor method
please help me i want to make a bot which, using colour detection will go to a general store on runescape, buy items (i want water filled vials) then go back and bank. I have tried to do this with a simple autoclicker but it does not work as the shopkeeper moves!
will your thingy above help me? if so wat on earth do i do with it? where do i paste it etc... thanks

Please don't revive a thread; make your own if you feel necessary.
 
Status
Not open for further replies.
Runescape Gamblingrunescape gambling
Back
Top