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

More humane mouse in C++

  • Thread starter Thread starter call me flip
  • Start date Start date
C

call me flip

Guest
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)
 
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.
 
More humane mouse in C++
u could get banned for using bots on runescAPE
 
More humane mouse in C++
u could get banned for using bots on runescAPE
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.
 
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
 
More humane mouse in C++
(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)
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).
 
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;
}
 
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;
}

thats only a part of ur source? post the whole thing pls
ill look over it
 
More humane mouse in C++
What im saying is that this function doesnt work anymore after being called alot of times >.<
 
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.

Microsoft MSDN Library said:
An application must not delete a device context whose handle was obtained by calling GetDC. Instead, it must call ReleaseDC to free the device context.

Should get things going for you.
 
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.
 
Runescape Gamblingrunescape gambling
Back
Top