Help w/ bot function menu

Shout-Out

User Tag List

Results 1 to 8 of 8
  1. #1
    Fenryr's Avatar Member
    Reputation
    58
    Join Date
    Mar 2007
    Posts
    114
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help w/ bot function

    i'm new to C#, and despite my best efforts to search the internet, i can't seem to find anything similar to auto-it's "pixelsearch" function in C#.

    What i'm basically trying to do is to have the program search the screen to find all pixels that are a certain color, and then output the coordinates of those pixels so that i can click on them.

    So far, all i can think of is to take a screenshot, and search that, but that seems far too complicated and slow.

    Also if someone could point me in the right direction about making some sort of system that woiuld allow for color tolerance(find similar colors, not just the exact color i provide) any help would be greatly appreciated.

    Help w/ bot function
  2. #2
    Fenryr's Avatar Member
    Reputation
    58
    Join Date
    Mar 2007
    Posts
    114
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have another question, i know vb .net pretty well, so would it be bad practice to use the information from C Sharp syntax - Wikipedia, the free encyclopedia and learn c# through trial and error, or should i read some tutorials / books?

  3. #3
    Reconsider's Avatar Member
    Reputation
    2
    Join Date
    Jun 2009
    Posts
    31
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [ame=http://www.amazon.com/Beginning-Visual-2005-Wrox-Guides/dp/0764578472]Amazon.com: Beginning Visual C# 2005 (Wrox Beginning Guides): Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White: Books[/ame]

    This is a really good C# book, easy to learn from.
    Check out his other books aswell.

  4. #4
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Fenryr View Post

    So far, all i can think of is to take a screenshot, and search that, but that seems far too complicated and slow.
    I assume that's exactly what AutoIt does behind the scene
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  5. #5
    namelessgnome's Avatar Contributor
    Reputation
    108
    Join Date
    May 2007
    Posts
    263
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually AutoIt contains a com controll that you can include in your project.

    Simply add this dll file to your project and you should be able to use AutoIt's features

    If you have autoit installed you can find the dll in WhereEverYouInstalledIt\AutoItX\AutoItX3.dll

  6. #6
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wrote my very first fishbot with that com reference, it's a good start

  7. #7
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Isn't there a P/Invoke that you can call to read a windows pixels? I'm pretty sure there is...

    BAM! I'd write a wrapper for GetPixel so it reads ~every two pixels(depending on your resolution) and returns an array of Points. Use GetDC and ReleaseDC + FindWindow to grab the window DC/handle. This would be faster than using AutoITs library. I'm almost positive.
    Last edited by lanman92; 07-07-2009 at 01:41 PM.

  8. #8
    abuckau907's Avatar Active Member
    Reputation
    49
    Join Date
    May 2009
    Posts
    225
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    GetPixelColor vb.net code

    I just copy/pasted this from my vb.net code but there's nothing that's hard to conver to C#..i would, but....

    Declare Function GetPixel Lib "gdi32" (ByVal hDC As Integer, ByVal x As Integer, ByVal y As Integer) As Integer
    Declare Function GetDesktopWindow Lib "user32" () As Long
    Declare Function GetWindowDC Lib "user32" (ByVal hWnd As IntPtr) As IntPtr
    Declare Function ReleaseDC Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal hDC As IntPtr) As Integer


    Public Function GetPixColor(ByVal x As Int32, ByVal y As Int32) As Short()
    Dim hWnd As IntPtr = 0
    Dim hDC As IntPtr
    hWnd = GetDesktopWindow()

    hDC = GetWindowDC(hWnd)

    Dim lColor As Int32 = GetPixel(hDC, x, y)
    ReleaseDC(hWnd, hDC)
    '' convert to rgb
    Dim rgbs(2) As Short

    rgbs(0) = ColorTranslator.FromWin32(lColor).R
    rgbs(1) = ColorTranslator.FromWin32(lColor).G
    rgbs(2) = ColorTranslator.FromWin32(lColor).B
    Return rgbs
    End Function

    Later down the road you will need
    Public Declare Sub mouse_event Lib "user32.dll" (ByVal dwflags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal dwData As Integer, ByVal dwExtraInfo As Integer)
    Public Declare Function SetCursorPos Lib "user32.dll" (ByVal X As Int32, ByVal Y As Int32) As Boolean


    Public Enum MouseFlags As UInt32

    LEFTDOWN = &H2
    LEFTUP = &H4
    MIDDLEDOWN = &H20
    MIDDLEUP = &H40
    MOVE = &H1
    ABSOLUTE = &H8000
    RIGHTDOWN = &H8
    RIGHTUP = &H10
    End Enum

    Good luck.

Similar Threads

  1. The: Help My Bot Wont Work Thread
    By Technoguy420 in forum World of Warcraft General
    Replies: 7
    Last Post: 02-12-2009, 08:22 AM
  2. [HELP] AFK Bot
    By nightshack in forum Programming
    Replies: 27
    Last Post: 11-17-2008, 08:20 PM
  3. [Help] Accessing a function Out of Process
    By cenron in forum WoW Memory Editing
    Replies: 18
    Last Post: 10-14-2008, 05:49 AM
  4. Help with botting, main char played slave botted
    By Mikra in forum World of Warcraft General
    Replies: 6
    Last Post: 08-24-2008, 05:55 PM
  5. [Help] C++ Bot Programming
    By breezy22 in forum Age of Conan Exploits|Hacks
    Replies: 0
    Last Post: 07-24-2008, 04:14 PM
All times are GMT -5. The time now is 11:01 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search