Page 2 of 2 FirstFirst 12
Results 26 to 36 of 36

Thread: Human mouse movement

  1. #26
    Join Date
    Aug 2016
    Posts
    44
    Mentioned
    1 Post(s)
    Quoted
    25 Post(s)

    Default

    now i have error too many parameters for missMouse(698, 208, true); but mouse2 says procedure missMouse(pnt: TPoint; correct: boolean = true);

    Simba Code:
    function TBox.colorExists(color: integer; tolerance: integer = 0): Boolean;
    begin
    result := findColorTolerance(p.x, p.y, color, self.x1, self.y1, self.x2, self.y2, tolerance);
    end;    

    (*  level:
        TBox.setBounds(const 100, 100, 100, 100) // not sure if const is supposed to be there
        if TBox.colorExists(16774337, 0) then
        begin
          PlaySound('C:\Users\User name\Music\.mp3');

          while not isMouseButtonDown(MOUSE_LEFT) do
              Sleep(randomRange(800, 1000));
          goto start;
        end else
          goto finished;
    *)

    can i search for an image or pattern and find the coordinates?
    for ex, if looking for a straight black line 1px by 10px

    i tried doing playsound and the file is not opening. the filepath is correct.
    i searched through all the .simba files i have, and none of them have playsound procedure.
    Last edited by Treestump; 08-30-2016 at 07:10 PM.

  2. #27
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    Quote Originally Posted by Treestump View Post
    changed to:
    snip

    nothing wrong? deleted pREger
    That looks like you fixed it.

    Quote Originally Posted by Treestump View Post
    now i have error too many parameters for missMouse(698, 208, true); but mouse2 says procedure missMouse(pnt: TPoint; correct: boolean = true);
    Well, I count 3 parameters in your code: missMouse(698, 208, true) or (integer, integer, boolean)

    missMouse only takes 2 parameters missMouse(TPoint, Boolean) so you have 1 too many.

    You want to convert your x and y coordinates into a TPoint and use that as the first parameter: Point(698, 208) like I showed in the previous example.

    Quote Originally Posted by Treestump View Post
    Simba Code:
    function TBox.colorExists(color: integer; tolerance: integer = 0): Boolean;
    begin
    result := findColorTolerance(p.x, p.y, color, self.x1, self.y1, self.x2, self.y2, tolerance);
    end;    

    (*  level:
        TBox.setBounds(const 100, 100, 100, 100) // not sure if const is supposed to be there
        if TBox.colorExists(16774337, 0) then
        begin
          PlaySound('C:\Users\User name\Music\.mp3');

          while not isMouseButtonDown(MOUSE_LEFT) do
              Sleep(randomRange(800, 1000));
          goto start;
        end else
          goto finished;
    *)

    can i search for an image or pattern and find the coordinates?
    for ex, if looking for a straight black line 1px by 10px

    i tried doing playsound and the file is not opening. the filepath is correct.
    i searched through all the .simba files i have, and none of them have playsound procedure.
    I really think you should just say what you are writing this script for, or post a screenshot of what these things are. It is was easier to write code for something I can see, and not something I have to imagine But anyway:

    Yes, you can search for an image, or a tiny snippet of an image (like a 10x10 area of an image). These are called bitmaps.

    Yes, you can search for a 1 x 10 black line. Similar idea to finding a color of a single pixel, except now you are finding 10 pixels (10 TPoints). We call this an array of points or a TPointArray. Here is an example of grabbing all the black color, and checking if it is a 10x1 line:

    Simba Code:
    function isLine(): Boolean;
    var
      TPA: TPointArray;
      b: TBox
    begin
      FindColors(TPA, 0, 10, 10, 100, 100);
      b := GetTPABounds(TPA); // Make a box around all the TPoints
       
      if ((b.x2 - b.x1 + 1) = 10) and //Check width/height of the box
         ((b.y2 - b.y1 +1) = 1) then
      result := true;
    end;

    Obviously if you have more black colors than the 10x1 line it will mess up, but there are relatively simple solutions.

  3. #28
    Join Date
    Aug 2016
    Posts
    44
    Mentioned
    1 Post(s)
    Quoted
    25 Post(s)

    Default

    everything except the bitmap check is all related to my current script. turns out botting the battling system of my game is harder than expected, but im almost done. learning a lot through this.

    thoughts on my playsound issue? I use playsound('file location');
    ex: playsound('C:\My Way.mp3');

  4. #29
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    Quote Originally Posted by Treestump View Post
    everything except the bitmap check is all related to my current script. turns out botting the battling system of my game is harder than expected, but im almost done. learning a lot through this.

    thoughts on my playsound issue? I use playsound('file location');
    ex: playsound('C:\My Way.mp3');
    Because only .wav is supported.

  5. #30
    Join Date
    Aug 2016
    Posts
    44
    Mentioned
    1 Post(s)
    Quoted
    25 Post(s)

    Default

    well, just tried running my bot and it failed terribly lol. i'll try learning more on my own for now

  6. #31
    Join Date
    Aug 2016
    Posts
    44
    Mentioned
    1 Post(s)
    Quoted
    25 Post(s)

    Default

    ok. just wrote a new bot. please check it over for me? its hard to read because there's no spacing :c

    Simba Code:
    program new;
    {$i srl-6/lib/core/mouse2.Simba}

    type Timer = record
      Time: Int64;
    end;

    procedure Timer.Start;
    begin
      Time := GetSystemTime;
    end;

    procedure Timer.Reset;
    begin
      Time := 0;
    end;

    function Timer.TimeElapsed: Integer;
    begin
      Result := GetSystemTime - Time;
    end;

    function iscatch(): Boolean;
    var
    bmp: integer
    begin
    Bmp := BitmapFromString(11, 11, 'meJxLrPuaUPc1ETeZ3PA1ufEbkP' +
            'Qq+SZtMpGBR42BgUFCRNzKxCe+ZAdQPLX5W2rTV4usd2I8tkGhyal' +
            'NT4Ei0bVfTaOOR0c2Adnprd+iW78xqM6MDnYFsjNav6GRWe3fXKq+' +
            'KTL4ZJYtBLIz27+hkeEVXyxzvugx+ERU7AOyIyq+oJExLV+ty77IM' +
            'PhEFy0AsqObv6CRCf1fQyZ8ZdCYGRLlAmQnTPiKTNrUfk2Z8zVl9l' +
            'fTyreiDKaBackps58CRaKmfbUoOBeV1WRR9zVj+dfMFd+ApEfvOym' +
            '7JgZ+UDhISYk7ekanztiRsvxr7uZvuZvxkQDF78La');
    result := FindBitmapIn(bmp; var x, y: Integer;  654, 446, 1001, 521);
    end

    function ismap(): Boolean;
    begin
    result := (getcolor(848, 296) = 4301417);
    end

    function isendl(): Boolean;
    begin
    result := (getcolor(403, 460) = 13554637);
    end

    function isendr(): Boolean;
    begin
    result := (getcolor(544, 452) = 13554637);
    end

    function iscaptcha(): Boolean;
    begin
    result := (getcolor(892, 523) = 6323957);
    end

    label
      walkr, walkl, isendr, isendl, release, captcha, retry, catch, start, timer;
    var
    T : Timer;
    x, y, nx, ny : Integer;
    begin
    start:
    if ismap() then
    t.Start();
    wait(randomrange(300, 500));
    goto walkr;
    else
    wait(100);
    goto start;

    timer:
    if t.TimeElapsed >= 10800000 then
    begin
    mouse(193, 162, 40, 4, MOUSE_MOVE);
    fastclick(MOUSE_LEFT);
    wait(600000);
    playsound('C:\Users\User name\Music\dai - Hope.wav');
    while not iskeydown(13) do
    sleep(100);
    t.Reset()
    goto start;
    end else
    goto walkr;

    walkr:
    if not iskeydown(39) then
    keydown(39);
    else
    begin
    if iscaptcha() then
    goto release;
    else
    goto catch;
    end

    isendr:
    if isendr() then
    keyup(39);
    goto walkl;
    else
    goto walkr;

    catch:
    if iscatch() then
    begin
    nx := x - 8
    ny := y - 8
    mouse(nx, ny, 46, 15, MOUSE_MOVE);
    fastclick(MOUSE_LEFT);
    end else
    begin
    if keydown(39) then
    goto isendr;
    else if keydown(37) then
    goto isendl;
    else
    goto walkr;
    end

    walkl:
    if not iskeydown(37) then
    keydown(37);
    else
    begin
    if iscaptcha() then
    goto release;
    else
    goto catch;
    end

    isendl:
    if isendl() then
    keyup(37);
    goto timer;
    else
    goto walkl;

    release:
    if iskeydown(39) then
    begin
    keyup(39);
    keydown(37);
    wait(randomrange(500, 750));
    keyup(37);
    end else if iskeydown(37) then
    begin
    keyup (37);
    end else
    goto captcha;

    captcha:
    playsound('C:\Users\User name\Music\dai - Hope.wav');
    while not iskeydown(13) do
    sleep(300);
    goto retry;

    retry:
    wait(400);
    if isCaptcha() then
    begin
    while not isKeyDown(13) do
    Sleep(300);
    goto retry;
    end else
    goto walkr;
    end.

    Used this to try to test the bitmap feature:
    Simba Code:
    program new;
    var
    bmp : Integer

    begin
    Bmp := BitmapFromString(11, 11, 'meJxLrPuaUPc1ETeZ3PA1ufEbkP' +
            'Qq+SZtMpGBR42BgUFCRNzKxCe+ZAdQPLX5W2rTV4usd2I8tkGhyal' +
            'NT4Ei0bVfTaOOR0c2Adnprd+iW78xqM6MDnYFsjNav6GRWe3fXKq+' +
            'KTL4ZJYtBLIz27+hkeEVXyxzvugx+ERU7AOyIyq+oJExLV+ty77IM' +
            'PhEFy0AsqObv6CRCf1fQyZ8ZdCYGRLlAmQnTPiKTNrUfk2Z8zVl9l' +
            'fTyreiDKaBackps58CRaKmfbUoOBeV1WRR9zVj+dfMFd+ApEfvOym' +
            '7JgZ+UDhISYk7ekanztiRsvxr7uZvuZvxkQDF78La');
    writeln(inttostr(bmp));
    end.
    for some reason i get:
    Compiled successfully in 421 ms.
    0
    Successfully executed.
    The following bitmaps were not freed: [0]

    the bot is supposed to move my character left and right. if a monster appears, it will catch it (thats why i need the bitmap, to find the catch button). and it checks if a captcha appears, playing the music and pausing. i included a timer part in my bot, by using Joopls script. after 3 hours, it logs me off the game and i get a music alert 10 minutes later to log back in. i could bot that too, but idm.
    Last edited by Treestump; 08-31-2016 at 06:57 PM.

  7. #32
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    Quote Originally Posted by Treestump View Post
    ok. just wrote a new bot. please check it over for me? its hard to read because there's no spacing :c
    It's too hard for me to read/understand haha. If you use heaps of gotos the control flow gets really jumbled as you have to look up/down/down/up/down/etc.. to see where everything leads to. We generally organize things into procedures (and functions) and use these with other statements (if..then..) to control flow. Since your script is now getting more complex, it's probably worth organizing it a bit better.

    Also, no need for that timer stuff either: just use GetTimeRunning() to return time since the script started.

  8. #33
    Join Date
    Aug 2016
    Posts
    44
    Mentioned
    1 Post(s)
    Quoted
    25 Post(s)

    Default

    i did it! still have the freeing bitmap problem, but it works. EDIT: It works but im trying to add another feature in my script to make it more human and that feature is making my bot not work. check the catch() procedure. i want to check if the cursor is on the catch button. if it is it will just click.

    i dont understand why its not working. the button is 50 by 19. x and y are the coordinates of the bitmap location. getmousepos(a, b) if x<a<x+50 and y<b<y+19 then fastclick.

    Simba Code:
    program new;
    {$i srl-6/lib/core/mouse2.Simba}
    var
    a, b, nx, ny, x, y, bmp : integer;

    label
    start;

    function iscatch(): Boolean;

    begin
    Bmp := BitmapFromString(51, 20, 'meJzNlk9ME0EUxt/VBJSDtAi0Yq' +
            'SKJhKMFAtKkbCIwFgDFPtnEda0BYrUYAUsBBotksZ/ETDRNnjYeim' +
            'ePVA9KLfGmHiUGyeJJzjtDFdfHSRlVyMn6WTzy+Ttt9/7srszuwP+' +
            'YEmpEXJpYJ6B36lKykmjY7kj8N0xpuzjgRkKDfU8G7LURFz3FHeI5' +
            'gh1xnp+6wT3cs8kFSeUHCHm4cH6pmjvFM0dukbXeTApTG+G6X+gI0' +
            'zhpOzoJP9U8mCeB8xzn2rZNspKquch7wRqig7r66pJ32jqj0qk6z6' +
            'FioTLTv7mtkcNJw/mi1DfDFPRMrSpy6vv7Pb4IutYEaep2Z0WXRGt' +
            'klOcYVAhi93kj2f3ruHkwQZn2cAsy6Y4y8AUF7uaVXXOYlua38aCP' +
            'GipQ80q1uHyys5G1HQKPdekWXa8bQWV+QA1Z82DodQNlJ1KtNmIoS' +
            '4BYDQUgGfgsdY/4/Zr+KNsKMqyKUyyY0D84wlVXcVrYQZH7vbYm3E' +
            'uRRmcTkhOws/6okzfkhYq9UORVZxbfGv+QJxrLCa9bzKFmjL7qiUP' +
            'u6e1zjyYM6Q4Qko2a4eVSiDO0EdVXUto+NjUkHGw4dwk22yE1xtGl' +
            'ELwOP2xbL1KU+tXSrDLsKx15sHEGaXnIc3mhXGlFIgYlFV1Tuvt76' +
            'XmRwfLcBvU4eUtlzMOXQ/xxZa7rpNdDuO7HPai4dzeLuao9Jxm0z6' +
            'HDnG7W1DVkRenaSEI9v6g9GQdK0A+tbdnHBw4PyM7bhCubI7SIvBI' +
            '4Xj2tSpNQ4QagUgRWduFB/MuUu9rqqJ5YqMQzB39Hu/iOlbcL6ll5' +
            'Kt7KGIJ0wo4411YQk3HwgZUzds6Mw7SawpNyy2CjuulRXpAWG4067' +
            'yvvuHcPLbmnY67UVMlu/sJ79L4lB4F4n0qa7tvv/xLbDBJtbzybLP' +
            'YGoFDmQVYXKxvbBV9sZQ3Scs9aSwWHAKhVQBhocO57dD+guVX3so8' +
            'XKvOv7QmJqmh9S0qcVWet5r9sVRvkkJ1ojdAuF6IsTJcYrGEtjsPF' +
            'nhHA+9Y7rA/uf1J6p57f+cTC65s5QgxDw9munR1/MvW2BeWIzScs+' +
            '78kp0QbOKbD8HPPyZXt/bxwAzGGqvqJzZ3Bk/1E06S7u0=');
    result := FindBitmapIn(bmp, x, y, 654, 446, 1001, 521);
    end

    function ismap(): Boolean;
    begin
    result := (getcolor(848, 296) = 4301417);
    end

    function iscaptcha(): Boolean;
    begin
    result := (getcolor(892, 523) = 6323957);
    end

    procedure catch();
    begin
    (*
    getmousepos(a, b);
    if (x < a and a < (x + 50)) and (y < b and b < (y + 19)) then // not sure if i can do x < a < (x + 50)
    fastclick(MOUSE_LEFT);
    goto start;
    *)

    case random(1000) of
    1: begin
    nx := x + 1;
    mouse(nx, y, 48, 0, MOUSE_MOVE);
    fastclick(MOUSE_LEFT);
    end;
    2: begin
    nx := x + 1;
    ny := y + 19;
    mouse(nx, ny, 48, 0, MOUSE_MOVE);
    fastclick(MOUSE_LEFT);
    end;
    3: begin
    ny := y + 1;
    mouse(x, ny, 0, 17, MOUSE_MOVE);
    fastclick(MOUSE_LEFT);
    end;
    4: begin
    nx := x + 50;
    ny := y + 1;
    mouse(nx, ny, 0, 17, MOUSE_MOVE);
    fastclick(MOUSE_LEFT);
    end;
    5..754: begin
    nx := x + 8;
    ny := y + 6;
    mouse(nx, ny, 34, 8, MOUSE_MOVE);
    fastclick(MOUSE_LEFT);
    end;
    755..1000: begin
    nx := x + 1;
    ny := y + 1;
    mouse(nx, ny, 48, 17, MOUSE_MOVE);
    fastclick(MOUSE_LEFT);
    end;
    end;
    goto start;
    end;
    //end;

    procedure walk();
    begin
    if random(50) = 1 then
    begin
    keydown(65);
    wait(randomrange(8, 15));
    keyup(65);
    wait(randomrange(80, 170));
    keydown(65);
    wait(randomrange(8, 15));
    keyup(65);
    wait(randomrange(80, 170));
    end else
    begin
    keydown(65);
    wait(randomrange(8, 15));
    keyup(65);
    wait(randomrange(80, 170));
    keydown(83);
    wait(randomrange(8, 15));
    keyup(83);
    wait(randomrange(80, 170));
    end;

    if random(50) = 1 then
    begin
    keydown(83);
    wait(randomrange(8, 15));
    keyup(83);
    wait(randomrange(80, 170));
    keydown(83);
    wait(randomrange(8, 15));
    keyup(83);
    wait(randomrange(80, 170));
    end else
    begin
    keydown(83);
    wait(randomrange(8, 15));
    keyup(83);
    wait(randomrange(80, 170));
    keydown(65);
    wait(randomrange(8, 15));
    keyup(65);
    wait(randomrange(80, 170));
    end;
    end;

    begin
    start:
    repeat
    wait(100);
    until ismap();

    repeat
    if iscaptcha() then
    break;

    if not ismap() then
    exit;

    walk();
    until iscatch();

    if iscaptcha() then
    begin
    playsound('C:\Users\User name\Music\dai - Hope.wav');
    wait(3000);
    stopsound;
    while not iskeydown(13) do
    sleep(300);
    if gettimerunning >= 10800000 then
    begin
    mouse(193, 162, 40, 4, MOUSE_MOVE);
    fastclick(MOUSE_LEFT);
    wait(600000);
    playsound('C:\Users\User name\Music\dai - Hope.wav');
    wait(3000);
    stopsound;
    keydown(13);
    wait(randomrange(50, 120));
    keyup(13);
    goto start;
    end else
    goto start;
    end else
    catch();

    end.
    Last edited by Treestump; 09-01-2016 at 07:19 PM.

  9. #34
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    Quote Originally Posted by Treestump View Post
    i did it! still have the freeing bitmap problem, but it works. EDIT: It works but im trying to add another feature in my script to make it more human and that feature is making my bot not work. check the catch() procedure. i want to check if the cursor is on the catch button. if it is it will just click.

    i dont understand why its not working. the button is 50 by 19. x and y are the coordinates of the bitmap location. getmousepos(a, b) if x<a<x+50 and y<b<y+19 then fastclick.
    I modified some stuff.

    • Load the bmp into memory on startup only (no need to load every time)
    • Free the bmp when the script terminates
    • Created a loop for pressing keys, as that was a bunch of repeated code
    • Used mouseBox to press the button you were trying to press
    • Put the captcha sound stuff in it's own procedure to keep it organised
    • Reorganised your mainloop to remove the labels.


    Don't have simba to test if this compiles, but it should.

    Simba Code:
    program new;
    {$i srl-6/lib/core/mouse2.Simba}

    var
      bmp: integer;

    procedure loadBMP();
    begin
      Bmp := BitmapFromString(51, 20, 'meJzNlk9ME0EUxt/VBJSDtAi0Yq' +
            'SKJhKMFAtKkbCIwFgDFPtnEda0BYrUYAUsBBotksZ/ETDRNnjYeim' +
            'ePVA9KLfGmHiUGyeJJzjtDFdfHSRlVyMn6WTzy+Ttt9/7srszuwP+' +
            'YEmpEXJpYJ6B36lKykmjY7kj8N0xpuzjgRkKDfU8G7LURFz3FHeI5' +
            'gh1xnp+6wT3cs8kFSeUHCHm4cH6pmjvFM0dukbXeTApTG+G6X+gI0' +
            'zhpOzoJP9U8mCeB8xzn2rZNspKquch7wRqig7r66pJ32jqj0qk6z6' +
            'FioTLTv7mtkcNJw/mi1DfDFPRMrSpy6vv7Pb4IutYEaep2Z0WXRGt' +
            'klOcYVAhi93kj2f3ruHkwQZn2cAsy6Y4y8AUF7uaVXXOYlua38aCP' +
            'GipQ80q1uHyys5G1HQKPdekWXa8bQWV+QA1Z82DodQNlJ1KtNmIoS' +
            '4BYDQUgGfgsdY/4/Zr+KNsKMqyKUyyY0D84wlVXcVrYQZH7vbYm3E' +
            'uRRmcTkhOws/6okzfkhYq9UORVZxbfGv+QJxrLCa9bzKFmjL7qiUP' +
            'u6e1zjyYM6Q4Qko2a4eVSiDO0EdVXUto+NjUkHGw4dwk22yE1xtGl' +
            'ELwOP2xbL1KU+tXSrDLsKx15sHEGaXnIc3mhXGlFIgYlFV1Tuvt76' +
            'XmRwfLcBvU4eUtlzMOXQ/xxZa7rpNdDuO7HPai4dzeLuao9Jxm0z6' +
            'HDnG7W1DVkRenaSEI9v6g9GQdK0A+tbdnHBw4PyM7bhCubI7SIvBI' +
            '4Xj2tSpNQ4QagUgRWduFB/MuUu9rqqJ5YqMQzB39Hu/iOlbcL6ll5' +
            'Kt7KGIJ0wo4411YQk3HwgZUzds6Mw7SawpNyy2CjuulRXpAWG4067' +
            'yvvuHcPLbmnY67UVMlu/sJ79L4lB4F4n0qa7tvv/xLbDBJtbzybLP' +
            'YGoFDmQVYXKxvbBV9sZQ3Scs9aSwWHAKhVQBhocO57dD+guVX3so8' +
            'XKvOv7QmJqmh9S0qcVWet5r9sVRvkkJ1ojdAuF6IsTJcYrGEtjsPF' +
            'nhHA+9Y7rA/uf1J6p57f+cTC65s5QgxDw9munR1/MvW2BeWIzScs+' +
            '78kp0QbOKbD8HPPyZXt/bxwAzGGqvqJzZ3Bk/1E06S7u0=');
    end;

    procedure freeBMPs();
      freeBitmap(bmp);
    end;

    function isCatch(): Boolean;
    var
      x, y: Integer;
    begin
      result := FindBitmapIn(bmp, x, y, 654, 446, 1001, 521);
    end

    function isMap(): Boolean;
    begin
      result := (getcolor(848, 296) = 4301417);
    end

    function isCaptcha(): Boolean;
    begin
      result := (getcolor(892, 523) = 6323957);
    end

    procedure catch();
    var
      x, y: Integer;
      button: TBox;
    begin
      FindBitmapIn(bmp, x, y, 654, 446, 1001, 521);
         
      button := IntToBox(x, y, x+50, y+19); // assuming x,y is top left of button
       
      mouseBox(button, MOUSE_LEFT); // randomly click inside the box
    end;

    procedure pressButtons(keys: TIntegerArray);
    begin
      for i := 0 to 1 do
      begin
        keyDown(keys[i]);
        wait(random(8, 15);
        keyUp(keys[i]);
        wait(random(80, 170);
      end;
    end;

    procedure walk();
    begin
      if random(50) = 1 then
        pressButtons([65, 65])
      else
        pressButtons([65, 83]);
               
      if random(50) = 1 then
        pressButtons([83, 83])
      else
        pressButtons([83, 65]);
    end;

    procedure doCaptcha();
    begin
      playSound('C:\Users\User name\Music\dai - Hope.wav');
      wait(3000);
      stopSound();

      while not isKeyDown(13) do
        sleep(300);
           
      if (getTimeRunning >= 10800000) then // not sure if you want to 'reset' this timer each time
      begin
        mouse(193, 162, 40, 4, MOUSE_MOVE);
        fastClick(MOUSE_LEFT);
        wait(600000);
        playSound('C:\Users\User name\Music\dai - Hope.wav');
        wait(3000);
        stopSound; 
        keydown(13);
        wait(randomrange(50, 120));
        keyup(13);
      end;
    end


    begin
      loadBMP(); // load only at start
      addOnTerminate('freeBMPs'); //and free when script terminates
       
      repeat
       
        repeat
          wait(100);
        until isMap();

        repeat
          walk();
                   
          if isCatch() then
          begin
            catch();
            break;
          end;
                   
          if isCaptcha() then
          begin
            doCaptcha();
            break;
          end;
                               
        until(not isMap());

      until false; // loop forever
       
    end.

  10. #35
    Join Date
    Aug 2016
    Posts
    44
    Mentioned
    1 Post(s)
    Quoted
    25 Post(s)

    Default

    Thanks time and time again! But how can I check if the mouse is already over the button or not?

    this should work based on testing individual pieces of the script by itself. but i cant tell since my cursor isnt moving.
    Simba Code:
    FindBitmapIn(bmp, x, y, 654, 446, 1001, 521);
    getmousepos(a, b);
    if (x < a and a < (x + 50)) and (y < b and b < (y + 19)) then
    wait(random(300, 500));
    fastclick(MOUSE_LEFT);

    also since my actual cursor isnt being controlled, is it possible to make simba script only run on google chrome for example, and i'll be able to do other stuff on firefox?
    Last edited by Treestump; 09-02-2016 at 06:22 AM.

  11. #36
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    Quote Originally Posted by Treestump View Post
    Thanks time and time again! But how can I check if the mouse is already over the button or not?

    this should work based on testing individual pieces of the script by itself. but i cant tell since my cursor isnt moving.
    Simba Code:
    FindBitmapIn(bmp, x, y, 654, 446, 1001, 521);
    getmousepos(a, b);
    if (x < a and a < (x + 50)) and (y < b and b < (y + 19)) then
    wait(random(300, 500));
    fastclick(MOUSE_LEFT);

    also since my actual cursor isnt being controlled, is it possible to make simba script only run on google chrome for example, and i'll be able to do other stuff on firefox?
    You can use PointInBox() to check if a point (current mouse position) is inside a box (bounds of the button).

    Simba will take over your mouse, so you won't be able to do anything while the script is running. You can always setup a VM instance (i.e. VMware etc.) and run it on that.

    Simba Code:
    procedure catch();
    var
      x, y, mouseX, mouseY: Integer;
      button: TBox;
    begin
      FindBitmapIn(bmp, x, y, 654, 446, 1001, 521);  
      button := IntToBox(x, y, x + 50, y + 19); // assuming x,y is top left of button

      GetMousePos(mouseX, mouseY);

      // if already inside the button, left click, else move and click
      if PointInBox(Point(mouseX, mouseY), button) then
        fastClick(MOUSE_LEFT)
      else
        mouseBox(button, MOUSE_LEFT);
    end;

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •