Results 1 to 11 of 11

Thread: Timer not working

  1. #1
    Join Date
    Jul 2014
    Posts
    204
    Mentioned
    4 Post(s)
    Quoted
    125 Post(s)

    Default Timer not working

    this is the procedure:

    Simba Code:
    var
    bankTimer: TTimeMarker;

    begin
    banktimer.start();
    repeat
    bankscreen.open(BANK_NPC_GREY)
    until bankscreen.isopen()
    if (bankTimer.getTime() > 60000) then
    TeleportToBank();
    end;

    It doesn't go to TeleportToBank();

    Oh and also if I use this for another thing I don't want to share It will always click the same pixel, is there a way to let it click other pixels?
    Simba Code:
    findColorsSpiralTolerance(x, y, TPA, BANKER_COLOR, mainScreen.getBounds(), 20, colorSetting(BANKER_TOL, BANKER_SAT, BANKER_HUE));

      if (Length(TPA) < 1) then
      writeLn('no banker"s found!');


      ATPA := TPA.toATPA(30, 30);
      ATPA.filterBetween(8, 10);
      ATPA.sortFromMidPoint(mainscreen.playerPoint);
      smartImage.debugATPA(ATPA);


      begin
      mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
      if isMouseOverText(['Bank','ank','Banker','anker'], 500) then
      fastClick(MOUSE_LEFT);

  2. #2
    Join Date
    Aug 2008
    Location
    Oklahoma, USA
    Posts
    173
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Simba Code:
    bankscreen.open(BANK_NPC_GREY)
    until bankscreen.isopen()

    if this is a direct copy paste both lines need a semicolon and .isOpen()should be capitalized.

  3. #3
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    You probably wanted it in the loop?

    Simba Code:
    var
      bankTimer: TTimeMarker;

    begin
      banktimer.start();
      repeat
        bankscreen.open(BANK_NPC_GREY)
        if (bankTimer.getTime() > 60000) then
          TeleportToBank();
      until(bankscreen.isopen());
    end;
    Working on: Tithe Farmer

  4. #4
    Join Date
    Jul 2014
    Posts
    204
    Mentioned
    4 Post(s)
    Quoted
    125 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    You probably wanted it in the loop?

    Simba Code:
    var
      bankTimer: TTimeMarker;

    begin
      banktimer.start();
      repeat
        bankscreen.open(BANK_NPC_GREY)
        if (bankTimer.getTime() > 60000) then
          TeleportToBank();
      until(bankscreen.isopen());
    end;
    Simba Code:
    procedure Bank();
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
      bankTimer: TTimeMarker;
      InBank : Tbox;
    begin
      banktimer.start();
      InBank := IntToBox(346,170,362,186);
      repeat
      if (bankTimer.getTime() > 60000) then TeleportToBank();
      findColorsSpiralTolerance(x, y, TPA, BANKER_COLOR, mainScreen.getBounds(), 20, colorSetting(BANKER_TOL, BANKER_SAT, BANKER_HUE));

      if (Length(TPA) < 1) then
      writeLn('no banker"s found!');


      ATPA := TPA.toATPA(30, 30);
      ATPA.filterBetween(8, 10);
      ATPA.sortFromMidPoint(mainscreen.playerPoint);
      smartImage.debugATPA(ATPA);


      for i := 0 to high(ATPA) do
      begin
      mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
      if isMouseOverText(['Bank','ank','Banker','anker'], 500) then
      fastClick(MOUSE_LEFT);
      end;
      smartImage.clear;
        until bankScreen.isOpen();
        wait(randomRange(500, 1000));
        bankScreen.deposit([2..28]);
        wait(randomRange(500, 1000));
        BankScreen.close();
        wait(randomRange(500, 2000));
    end;

    That's the full code

  5. #5
    Join Date
    Jun 2014
    Location
    Lithuania
    Posts
    475
    Mentioned
    27 Post(s)
    Quoted
    200 Post(s)

    Default

    begin
    banktimer.start();
    repeat
    bankscreen.open(BANK_NPC_GREY)
    until bankscreen.isopen()
    if (bankTimer.getTime() > 60000) then
    TeleportToBank();
    end;
    Ok now ur script looks like: start timer, wait untill bankscreen is open, if at the time the bank screen is open is 60+secs passed then teleport. but whats if its open faster? you dont teleport, thats whats happening, fix logic.






    mouse(middleTPA(ATPA[i]), MOUSE_MOVE);

    For the second one issue is you can do something like:
    Simba Code:
    mouse(middleTPA(ATPA[i]).x+random(-5,5),middleTPA(ATPA[i]).y+random(-5,5), MOUSE_MOVE);

  6. #6
    Join Date
    Jul 2014
    Posts
    204
    Mentioned
    4 Post(s)
    Quoted
    125 Post(s)

    Default

    Quote Originally Posted by cosmasjdz View Post
    Ok now ur script looks like: start timer, wait untill bankscreen is open, if at the time the bank screen is open is 60+secs passed then teleport. but whats if its open faster? you dont teleport, thats whats happening, fix logic.









    For the second one issue is you can do something like:
    Simba Code:
    mouse(middleTPA(ATPA[i]).x+random(-5,5),middleTPA(ATPA[i]).y+random(-5,5), MOUSE_MOVE);
    It takes 10 sec to open the bank so that won't happen and for some reason it works now.

    And thanks for your code I'm going to try it out tomorrow, gotta go to sleep now school tomorrow
    the 5 = amount of pixels?

  7. #7
    Join Date
    Jun 2014
    Location
    Lithuania
    Posts
    475
    Mentioned
    27 Post(s)
    Quoted
    200 Post(s)

    Default

    yep, it is +-5 pixels box around the center actually, may be little toobig, i usually use +-3

  8. #8
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    You should exit your procedure if you didn't find any colours (if length(TPA) < 1). If you try and split an empty TPA into an ATPA it will most likely throw an error (see below for simple fix).

    When you go: ATPA.filterBetween(8, 10); you are removing any TPAs with between 8 and 10 pixels. Do you want to retain the TPAs with only 3 matching TPoints?

    Also if you:
    Simba Code:
    mouseBox(ATPA[i].getBounds(), MOUSE_MOVE);
    it won't click the midpoint of the TPA, but somewhere inside it's bounds, with a higher change of clicking closer to the middle. If you want a completely random point, you can:
    Simba Code:
    mouse(ATPA[i].getBounds().getRandomPoint(), MOUSE_MOVE);

    Simba Code:
    procedure Bank();
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
      bankTimer: TTimeMarker;
      InBank : Tbox;
    begin
      banktimer.start();

      InBank := IntToBox(346,170,362,186); //what is this used for?

      repeat
        if (bankTimer.getTime() > 60000) then
          TeleportToBank();

        findColorsSpiralTolerance(x, y, TPA, BANKER_COLOR, mainScreen.getBounds(), 20, colorSetting(BANKER_TOL, BANKER_SAT, BANKER_HUE));

        if (Length(TPA) < 1) then
        begin
         writeLn('no banker"s found!');
         exit;
        end;

        ATPA := TPA.toATPA(30, 30);
        ATPA.filterBetween(8, 10);
        ATPA.sortFromMidPoint(mainscreen.playerPoint);
        smartImage.debugATPA(ATPA);

        for i := 0 to high(ATPA) do
        begin
          mouseBox(ATPA[i].getBounds(), MOUSE_MOVE);
          if isMouseOverText(['Bank','ank','Banker','anker'], 500) then
            fastClick(MOUSE_LEFT);
        end;

        smartImage.clear;

      until bankScreen.isOpen();

      wait(randomRange(500, 1000));
      bankScreen.deposit([2..28]);
      wait(randomRange(500, 1000));
      BankScreen.close();
      wait(randomRange(500, 2000));
    end;

  9. #9
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    When you go: ATPA.filterBetween(8, 10); you are removing any TPAs with between 8 and 10 pixels. Do you want to retain the TPAs with only 3 matching TPoints?
    Interesting, i just keep learning from all your posts, this means that any TPA between 8 and 10 pixels WONT be taken into account in the ATPA??

    BTW gratz on senior member (just saw you got it )

  10. #10
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by undorak7 View Post
    Interesting, i just keep learning from all your posts, this means that any TPA between 8 and 10 pixels WONT be taken into account in the ATPA??

    BTW gratz on senior member (just saw you got it )
    They will be deleted from the array. Lets say you found a whole bunch of colours and all the matching TPoints were put into a TPA:



    Then you wanted to split that into an ATPA:



    And then you filterBetween(1, 10), it will remove the TPAs will between 1 and 10 points:


  11. #11
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    They will be deleted from the array. Lets say you found a whole bunch of colours and all the matching TPoints were put into a TPA:



    Then you wanted to split that into an ATPA:



    And then you filterBetween(1, 10), it will remove the TPAs will between 1 and 10 points:

    awesome explanation, totally understood, thanks!

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
  •