Adblock breaks this site

More humane mouse in C++

Discussion in 'Programming General' started by call me flip, Aug 20, 2008.

  1. call me flip

    call me flip Guest

    Referrals:
    0
    More humane mouse in C++

    hi sythe people

    Right now im trying to make a bot for some wcin, in C of course
    so far my bot can find trees, click on them,
    and drop an inventory when its full :)

    but im wondering how i could have a more human like mouse movement
    (like an arc or something as long as it isnt a straight line from A to B)

    and btw after about 2 loads of cutting & dropping my program just, stops working
    any ideas how this comes? its in an infinite loop of looking for trees and
    looking if the inventory is full but ive got no idea why it stops (???)

    ty in advance
    (and if you really want it bad ill post the source :p)
     
  2. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    More humane mouse in C++

    Well, your source code would probably help for the bug you're having.

    Basically, you need to work out an angle to arc your mouse at. Generate a random angle using the rand() function in math.h (I think that's the header) and use an algorithm to generate your trajectory. I'm on Linux at the moment, so I can't write one for you.
     
  3. rorofo

    rorofo Active Member
    Banned

    Joined:
    Aug 3, 2008
    Posts:
    108
    Referrals:
    0
    Sythe Gold:
    0
    More humane mouse in C++

    u could get banned for using bots on runescAPE
     
  4. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    More humane mouse in C++

    The entire original point of this site was to make and/or use bots on RuneScape pretty much. Sythe made his own auto's a while back.
     
  5. call me flip

    call me flip Guest

    Referrals:
    0
    More humane mouse in C++

    Well, ill try doing some math stuffs
    (it probably gets detected after some time, because if it can do 2 loads flawless then why not more? everythings the same as the first 2 loads :-s)

    anyway thanks for your help

    edit:

    mean this?

    anyway, if anyone knows a way for a more human mouse than a straight like from a to b please let me know
     
  6. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    More humane mouse in C++

    Maybe there's a memory leak in your program thus causing it to crash. Try going through your program line by line thinking about what each one does and whether that's the "right" way of doing what it should be doing and not just that it's working (sometimes something may work even though it's coded somewhat incorrectly).
     
  7. call me flip

    call me flip Guest

    Referrals:
    0
    More humane mouse in C++

    :O youre probably right, i just let it scan a part of the screen 5000 times, with a message after every 500 times.

    it took some time for the first 500 times to be done, then the next 500 times message came almost straight after it and it used nearly no cpu (instead of the 99% for letting it scan so fast and much :p)

    i made this function for scanning the screen
    Code:
    bool ScanScreen(COLORREF color, int left, int top, int right, int bottom)
    {
        sc.x = 0;//sc is a global POINT variable
        sc.y = 0;
        HDC screen = GetDC(HWND_DESKTOP);
        HDC dest = CreateCompatibleDC(screen);
        RECT rect;
        GetWindowRect(HWND_DESKTOP, &rect);
        HBITMAP  bmp = CreateCompatibleBitmap(screen, rect.right, rect.bottom);
        SelectObject(dest, bmp);
        BitBlt(dest, 0, 0, rect.right, rect.bottom, screen, 0, 0, SRCCOPY);
        for(int y = top; y < bottom; y++)
        {
            for(int x = left; x < right; x++)
            {
                if(color == GetPixel(dest, x, y))
                {
                    sc.x = x;
                    sc.y = y;
                    DeleteDC(screen);
                    return true;
                }
            }
        }
        DeleteDC(screen);
        return false;
    }
    
     
  8. rs-powerlvling

    rs-powerlvling Member

    Joined:
    Aug 17, 2008
    Posts:
    38
    Referrals:
    0
    Sythe Gold:
    0
    More humane mouse in C++

    Good luck with it !! :)
     
  9. enjoi888

    enjoi888 Forum Addict
    Banned

    Joined:
    Feb 28, 2007
    Posts:
    323
    Referrals:
    1
    Sythe Gold:
    0
    More humane mouse in C++

    thats only a part of ur source? post the whole thing pls
    ill look over it
     
  10. call me flip

    call me flip Guest

    Referrals:
    0
    More humane mouse in C++

    What im saying is that this function doesnt work anymore after being called alot of times >.<
     
  11. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    More humane mouse in C++

    When using GetDC() to generate a device context you should remove it from memory to avoid memory leaks by calling ReleaseDC() and not DeleteDC() as you have done.

    Should get things going for you.
     
  12. tofurocks

    tofurocks Iloveroy

    Joined:
    Nov 8, 2008
    Posts:
    2,344
    Referrals:
    2
    Sythe Gold:
    0
    More humane mouse in C++

    Yeah I had issues with human movement too... I was thinking compare GetCursorPos() to the mouse's target and then add to the getcursorpos variables.
     
< Omg Please Just Help Real Quick~~~ | Runescape Barbian Village AutoMiner made in C++ >


 
 
Adblock breaks this site