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

Thread: Al-Kharid Cooking

  1. #26
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Quote Originally Posted by ardentboy28 View Post
    I am using lobsters, and the script fails to click the button "cook" after it uses my lobster on the range.

    I think line 127

    if productionScreen.isOpen then exit(productionScreen.clickStart);


    is not working. I think the script never enters that line.
    get teamviewer and PM me your info. Is think your graphics settings are off.

  2. #27
    Join Date
    Nov 2011
    Posts
    47
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Fixed the problem but nothing happens after i load up it, I enabled SMART but nothing happens :S

  3. #28
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Quote Originally Posted by MuffinMan View Post
    Fixed the problem but nothing happens after i load up it, I enabled SMART but nothing happens :S
    runescape isn't setup correctly...

  4. #29
    Join Date
    Dec 2011
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Thumbs up

    I followed the graphics setup exactly as written here

    http://villavu.com/forum/showthread.php?t=107365

    and tried the script with both lobster and tuna, but it is not working.

    My SPS and SRL are both updated to the latest version.

    Maybe, it is because I disabled use_directx? I disabled it because when i enable, the screen keeps flickering.
    or do I have to do something about the <rant> thingy?

    but still, thank you for kindly answering my questions.
    Last edited by ardentboy28; 02-05-2014 at 06:33 PM.

  5. #30
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Quote Originally Posted by ardentboy28 View Post
    I followed the graphics setup exactly as written here

    http://villavu.com/forum/showthread.php?t=107365

    and tried the script with both lobster and tuna, but it is not working.

    Maybe, it is because I disabled use_directx? I disabled it because when i enable, the screen keeps flickering.
    or do I have to do something about the <rant> thingy?

    but still, thank you for kindly answering my questions.
    i suggest using directX but if you wwant to you'll need to open runescape in a browser and switch to directX first.

  6. #31
    Join Date
    Dec 2011
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    I just sent you a PM

  7. #32
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Quote Originally Posted by ardentboy28 View Post
    I just sent you a PM
    Glad we got everything straightened out.

    I locked ardentboy's interface layout.
    I reset it to old-school even though it already was.
    I drug the "subscribe" button off of the mainscreen onto the chat box so it'd be out of the way.

    The script is now fully functional. If anyone ever wants teamviewer help don't hesitate to ask.

  8. #33
    Join Date
    Dec 2011
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    WORKING FLAWLESSLY

    footballjds is amazingly kind and actually used teamviewer to help me fix the problem.

    (make sure you lock the interface)

    Thanks!!!

  9. #34
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    the latest version of the script is up. I'm using github now so make sure you always check for the latest!

  10. #35
    Join Date
    May 2012
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    21 Post(s)

    Default

    Okay DirectX didn't work for me, d3d9.dll didn't function correctly. Set it up to use OpenGL instead, runs fine, except... walks to the furnace to cook, right clicks, then waits a moment, neglects to actually select "cook", and then walks to the bank, dumps the raw fish in the bank, and heads back to the furnace with another raw load, and brings them back just the way they came. Not sure how to fix this.

  11. #36
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Quote Originally Posted by Kampf Gewehr View Post
    Okay DirectX didn't work for me, d3d9.dll didn't function correctly. Set it up to use OpenGL instead, runs fine, except... walks to the furnace to cook, right clicks, then waits a moment, neglects to actually select "cook", and then walks to the bank, dumps the raw fish in the bank, and heads back to the furnace with another raw load, and brings them back just the way they came. Not sure how to fix this.
    resolved your setup issues over teamviewer.

  12. #37
    Join Date
    May 2012
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by footballjds View Post
    resolved your setup issues over teamviewer.
    You're the man!

  13. #38
    Join Date
    May 2012
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by ardentboy28 View Post
    I followed the graphics setup exactly as written here

    http://villavu.com/forum/showthread.php?t=107365

    and tried the script with both lobster and tuna, but it is not working.

    My SPS and SRL are both updated to the latest version.

    Maybe, it is because I disabled use_directx? I disabled it because when i enable, the screen keeps flickering.
    or do I have to do something about the <rant> thingy?

    but still, thank you for kindly answering my questions.
    Hey, try the DirectX plugin found here http://villavu.com/forum/showthread....light=d3d9.dll

  14. #39
    Join Date
    Dec 2011
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    This script fails to cook again. I think this happened after the graphics update a few weeks ago.

  15. #40
    Join Date
    May 2012
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by ardentboy28 View Post
    This script fails to cook again. I think this happened after the graphics update a few weeks ago.
    Yeah it's been out of commission for more than a month now. Shame too, there aren't any other F2P cookers out there. Hopefully football gets a chance to update this sometime. I've got 150k fish from 99 fishing that have been stinking up my bank.

  16. #41
    Join Date
    Feb 2014
    Posts
    6
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    After some tweaking I managed to fix the script - the range colour needed an update. I know I played with some timings to make it more human-like; however, I forgot if it is this version.

    Code:
    program cooking;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    {$I sps/lib/sps-rs3.simba}
    
    var
      _totalEXP, food_cooked, food_burnt: integer;
      cook_walk: TSPSArea;
      paths: T2DPointArray;
    
    const
      USE_DirectX = false;
    
    procedure declarePlayers;
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName   := '';
        bankPin     := '';
        password    := '';
        integers[0] := 1;//slot containing food to cook
        extendeds[0]:= 120;//exp per item
        isActive    := true;
        isMember    := false;
        world       := -1;
      end;
      currentPlayer := 0;
    end;
    
    procedure initPaths;
    begin
      cook_walk.setup('cook_spot', '', __DEFAULT_ACCURACY, __DEFAULT_TOLERANCE, 0.7);
      setLength(paths, 3);
      //to bank
      paths[0] := [Point(90, 164), Point(94, 171), Point(102, 178), Point(114, 173), Point(117, 159), Point(119, 141), Point(114, 119), Point(110, 107), Point(95, 104)];
    
      //to the north dock
      paths[1] := [Point(97, 166), Point(97, 173), Point(98, 179), Point(123, 180), Point(126, 152), Point(114, 136), Point(112, 116), Point(98, 106)];
    
      //to the south dock
      paths[2] := [Point(94, 166), Point(118, 162), Point(118, 144), Point(104, 124), Point(97, 109), Point(94, 104)];
    end;
    
    function location: TPoint;
    var
      places: TPointArray;
      bankD, rangeD: integer;
    begin
      result := cook_walk.getPlayerPos;
      players[currentPlayer].location := '';
      if result.equals([-1, -1]) then exit;
    
      rangeD := distance(result, Point(95, 104));
      bankD := distance(result, Point(90, 164));
    
      if (rangeD < 15) then players[currentPlayer].location := 'range' else
        if (bankD < 15) then players[currentPlayer].location := 'bank';
      status(players[currentPlayer].location);
    end;
    
    function walk(bank: boolean): boolean;
    var
      our_path: TPointArray;
      ourPos: TPoint;
      threshold: integer;
      n: integer;
    begin
      ourPos := location;
      if ourPos.equals([-1, -1]) then exit;
    
      our_path := paths[random(length(paths))].copy;
      if bank then invertTPA(our_path);
    
      threshold := getSystemTime + randomRange(45000, 65000);
      repeat
        if cook_walk.walkPath(our_path) then minimap.waitPlayerMoving();
        wait(randomRange(250, 500));
        ourPos := location;
      until ((distance(our_path[high(our_path)], ourPos) < 12)) or (getSystemTime > threshold);
      result := (threshold > getSystemTime);
    end;
    
    //this function returns the closest point in the array to the center of the arra
    function TPointArray.centerPoint(): TPoint;
    var
      tmpArray: TPointArray;
    begin
      if length(self) < 1 then exit;
      tmpArray := self;
      tmpArray.sortFromPoint(self.getMiddle);
      result := tmpArray[0];
    end;
    
    
    //This just ensures that the option window gets closed
    function TRSChooseOption.close2(): boolean;
    var
      t: integer;
    begin
      t := getSystemTime + randomRange(2000,3000);
      while (t > getSystemTime) do if self.isOpen then self.close else exit(true);
    end;
    
    //This function will find all colors close to the range color and split them into
    //TPA's by width and height, a use range function will call this one
    function findRange: T2DPointArray;
    var
      rangeTPA: TPointArray;
    begin
      if findColorsTolerance(rangeTPA, 4146611, mainscreen.getBounds, 4, colorSetting(2, 0.06, 0.53)) then
        result := rangeTPA.toATPA(15, 15);
      sortATPAFromMidPoint(result, mainscreen.playerPoint);
    end;
    
    function useRange: boolean;
    var
      range: T2DPointArray;
      pont: TPoint;
      i, h, timer: integer;
    begin
      range := findRange;
      if (length(range) < 1) then exit;
      h := high(range);
      for i := 0 to h do
      begin
        if productionScreen.isOpen then exit(productionScreen.clickStart);
        if (length(range[i]) < 5) then continue;
        pont := range[i].centerPoint;
        mouse(pont.rand(-3, 3), Mouse_Right, Mouse_Human);
        if chooseOption.select(['-> Range'], randomRange(1000, 4000)) then
        begin
          minimap.waitPlayerMoving();
          timer := getSystemTime + randomRange(3000, 6000);
          repeat
            wait(randomRange(100, 400));
          until (productionScreen.isOpen) or (getSystemTime > timer);
        end;
      end else chooseOption.close2;
    end;
    
    function doneButton: boolean;
    var
      bluePoints: TPointArray;
      blueArea: TBox;
    begin
      blueArea := [244,197, 335, 223];
      findColorsTolerance(bluePoints, 13278759, blueArea, 44);
      result := length(bluePoints) > 145;
    end;
    
    procedure whileCooking;
    var
      blkCount: TPointArray;
      count, threshold: integer;
    begin
      threshold := getSystemTime + randomRange(70000, 80000);
      repeat
        wait(randomRange(255, 555));
        if doneButton then
        begin
          threshold := getSystemTime + randomRange(2500, 3500);
          repeat
            wait(randomRange(255, 555));
            if not(doneButton) then exit;
          until (getSystemTime > threshold);
        end;
      until (getSystemTime > threshold);
    end;
    
    //This function will find all colors close to the banker color and split them into
    //TPA's by width and height, a use bank function will call this one
    function findBankers: T2DPointArray;
    var
      bankerTPA: TPointArray;
    begin
      if findColorsTolerance(bankerTPA, 2450798, mainscreen.getBounds, 14, colorSetting(2, 0.09, 1.31)) then
        result := bankerTPA.toATPA(15, 15);
      sortATPAFromMidPoint(result, mainscreen.playerPoint);
    end;
    
    function useBank: boolean;
    var
      bankers: T2DPointArray;
      pont: TPoint;
      i, h, timer: integer;
    begin
      bankers := findBankers;
      if (length(bankers) < 1) then exit;
      h := high(bankers);
      for i := 0 to h do
      begin
        if (length(bankers[i]) < 5) then continue;
        pont := bankers[i].centerPoint;
        mouse(pont.rand(-3, 3), Mouse_Right, Mouse_Human);
        if chooseOption.select(['Bank Banker', 'Bank Bank', 'nk Banker'], randomRange(1000, 4000)) then
        begin
          minimap.waitPlayerMoving();
          timer := getSystemTime + randomRange(3000, 6000);
          repeat
            wait(randomRange(100, 400));
          until (bankscreen.isOpen) or (pinscreen.isOpen) or (getSystemTime > timer);
          if pinscreen.isOpen then pinScreen.enter(players[currentPlayer].bankPin);
          if bankscreen.isOpen then exit(true);
        end else chooseOption.close2;
      end;
    end;
    
    function cook_count: TPoint
    var
      i, invcount, x, y: integer;
      clrFound: boolean;
    begin
      tabBackpack.open;
      invcount := tabBackpack.count;
      clrFound := findColor(x, y, 65535, tabBackpack.getBounds);
      case invcount of
        0: result := [0, 0];
        1..27: result := [invcount-1, 29-invcount];
        28: if clrFound then result := [27, 1] else result := [28, 0];
      end;
    end;
    
    procedure printProgress;
    var
      secondsElapsed, expPHour, totalEXP: extended;
      food: TPoint;
    begin
      food := cook_count;
    
      food_cooked := food_cooked + food.x;
      food_burnt := food_burnt + food.y;
    
      totalEXP := food_cooked * players[currentPlayer].extendeds[0];
      secondsElapsed := (getTimeRunning/1000);
      expPHour := (totalEXP * 60 * 60) / secondsElapsed;
    
      smartImage.clearArea(intToBox(576, 200, 798, 278));
      smartImage.drawBox(intToBox(576, 200, 798, 278), true, 7890014);
    
      smartImage.DrawText('Run Time: ' + msToTime(GetTimeRunning, TIME_SHORT), Point(618, 224), upchars, false, 1376386);
      smartImage.DrawText('EXP/Hour: ' + toString(round(expPHour)), Point(618, 234), upchars, false, 1376386);
      smartImage.DrawText('Total EXP: ' + toString(totalEXP), Point(618, 244), upchars, false, 1376386);
      smartImage.DrawText('Items cooked: ' + toString(food_cooked), Point(618, 254), upchars, false, 1376386);
      smartImage.DrawText('Items burnt: ' + toString(food_burnt), Point(618, 264), upchars, false, 1376386);
    end;
    
    function handleBanking: boolean;
    begin
      printProgress;
      if waitFunc(@useBank, 100, randomRange(20000,30000)) then
      begin
        bankscreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
        if bankscreen.withdraw(players[currentPlayer].integers[0], WITHDRAW_AMOUNT_ALL_BUT_ONE, ['']) then
          result := bankscreen.close;
      end;
    end;
    
    procedure prepareSelf;
    begin
      wait(random(500, 1500));
      minimap.clickCompass;
      wait(random(500, 1500));
      mainscreen.setAngle(MS_ANGLE_HIGH);
      wait(random(1, 1500));
    end;
    
    procedure mainLoop;
    var
      loc: TPoint;
    begin
    
      if not isLoggedIn then
      begin
        print('We''re not logged in. respawning client.');
        wait(randomRange(5000, 10000));
        smartReloadClient((5 * 60000) + random(15000));
    
        if (waitClientReady()) then
        begin
          print('Client succesfully loaded after reload');
        end else
        begin
          print('Client never reloaded after restart..', TDebug.FATAL);
          terminateScript;
        end;
        if not players[currentPlayer].isActive then players.next(false);
        if players[currentPlayer].login then prepareSelf;
        if not isLoggedIn then
        begin
          writeln('Terminating, not logged in.');
          terminateScript;
        end;
      end;
    
      loc := location;
      if loc.equals([-1, -1]) then exit;
      wait(randomRange(1, 300));
      if walk(true) then
        if handleBanking then
          if walk(false) then
            if tabBackpack.mouseSlot(randomRange(10, 28), mouse_left) then
              if useRange then whileCooking;
    end;
    
    begin
    
      if USE_DirectX then smartPlugins := ['d3d9.dll'];
    
      smartEnableDrawing := true;
      setupsrl;
      declarePlayers;
      initPaths;
    
      if not isLoggedIn then if players[currentPlayer].login then prepareSelf;
    
      while players.getActive > 0 do mainLoop;
    end.
    Last edited by killercrashy; 04-26-2014 at 08:09 PM.

  17. #42
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Thanks @killercrashy; your version is working for me.

  18. #43
    Join Date
    Aug 2008
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Been trying to use this script, though I guess it's no longer being maintained. Seem to be running into the problem of not cooking while at the range, and immediately running back to bank.

  19. #44
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by fridaynitelights View Post
    Been trying to use this script, though I guess it's no longer being maintained. Seem to be running into the problem of not cooking while at the range, and immediately running back to bank.
    That's because of the outdated range color. The version posted above should fix that.

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

    Default

    Quote Originally Posted by Coh3n View Post
    That's because of the outdated range color. The version posted above should fix that.
    So still working now?
    forum says you posted the message at : 07-13-2014
    currently it's 07-08-2014 here
    damn I messed up with the months ...
    here we use day/month/year
    in usa they use month/day/year

  21. #46
    Join Date
    Dec 2011
    Location
    United States
    Posts
    960
    Mentioned
    21 Post(s)
    Quoted
    504 Post(s)

    Default

    Quote Originally Posted by lanadekat View Post
    So still working now?
    forum says you posted the message at : 07-13-2014
    currently it's 07-08-2014 here
    damn I messed up with the months ...
    here we use day/month/year
    in usa they use month/day/year
    I updated the colors of the range and it worked well.

    Use directx, lowest settings, and zoom all the way out.

    Replace the function findRange with this. Its around line 105.
    Code:
    //This function will find all colors close to the range color and split them into
    //TPA's by width and height, a use range function will call this one
    function findRange: T2DPointArray;
    var
      rangeTPA: TPointArray;
    begin
      if findColorsTolerance(rangeTPA, 3162322, mainscreen.getBounds, 10, colorSetting(2, 0.16, 2.42)) then
        result := rangeTPA.toATPA(15, 15);
      sortATPAFromMidPoint(result, mainscreen.playerPoint);
    end;

  22. #47
    Join Date
    Aug 2014
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    After clicking the range, it doesn't actually click the blue cook button so it sits there for second, hits the compass then heads back to the bank to repeat. :/

    I would add the code error but i was messing with it earlier and decided to post my problem after closing rs, if need be ill add it tomorrow.

  23. #48
    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 x3DNipS View Post
    After clicking the range, it doesn't actually click the blue cook button so it sits there for second, hits the compass then heads back to the bank to repeat. :/

    I would add the code error but i was messing with it earlier and decided to post my problem after closing rs, if need be ill add it tomorrow.
    productionScreen wasn't getting recognised. This has a few quick fixes:

    Simba Code:
    program cooking;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    {$I sps/lib/sps-rs3.simba}

    var
      _totalEXP, food_cooked, food_burnt: integer;
      cook_walk: TSPSArea;
      paths: T2DPointArray;

    const
      USE_DirectX = false;

    procedure declarePlayers;
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName   := 'un';
        bankPin     := '';
        password    := 'pw';
        integers[0] := 10;//slot containing food to cook
        extendeds[0]:= 120;//exp per item
        isActive    := true;
        isMember    := false;
        world       := -1;
      end;
      currentPlayer := 0;
    end;

    procedure initPaths;
    begin
      cook_walk.setup('cook_spot', RUNESCAPE_OTHER, __DEFAULT_ACCURACY, __DEFAULT_TOLERANCE, 0.7);
      setLength(paths, 3);
      //to bank
      paths[0] := [Point(90, 164), Point(94, 171), Point(102, 178), Point(114, 173), Point(117, 159), Point(119, 141), Point(114, 119), Point(110, 107), Point(95, 104)];

      //to the north dock
      paths[1] := [Point(97, 166), Point(97, 173), Point(98, 179), Point(123, 180), Point(126, 152), Point(114, 136), Point(112, 116), Point(98, 106)];

      //to the south dock
      paths[2] := [Point(94, 166), Point(118, 162), Point(118, 144), Point(104, 124), Point(97, 109), Point(94, 104)];
    end;

    function location: TPoint;
    var
      places: TPointArray;
      bankD, rangeD: integer;
    begin
      result := cook_walk.getPlayerPos;
      players[currentPlayer].location := '';
      if result.equals([-1, -1]) then exit;

      rangeD := distance(result, Point(95, 104));
      bankD := distance(result, Point(90, 164));

      if (rangeD < 15) then players[currentPlayer].location := 'range' else
        if (bankD < 15) then players[currentPlayer].location := 'bank';
      status(players[currentPlayer].location);
    end;

    function walk(bank: boolean): boolean;
    var
      our_path: TPointArray;
      ourPos: TPoint;
      threshold: integer;
      n: integer;
    begin
      ourPos := location;
      if ourPos.equals([-1, -1]) then exit;

      our_path := paths[random(length(paths))].copy;
      if bank then invertTPA(our_path);

      threshold := getSystemTime + randomRange(45000, 65000);
      repeat
        if cook_walk.walkPath(our_path) then minimap.waitPlayerMoving();
        wait(randomRange(250, 500));
        ourPos := location;
      until ((distance(our_path[high(our_path)], ourPos) < 12)) or (getSystemTime > threshold);
      result := (threshold > getSystemTime);
    end;

    //this function returns the closest point in the array to the center of the arra
    function TPointArray.centerPoint(): TPoint;
    var
      tmpArray: TPointArray;
    begin
      if length(self) < 1 then exit;
      tmpArray := self;
      tmpArray.sortFromPoint(self.getMiddle);
      result := tmpArray[0];
    end;


    //This just ensures that the option window gets closed
    function TRSChooseOption.close2(): boolean;
    var
      t: integer;
    begin
      t := getSystemTime + randomRange(2000,3000);
      while (t > getSystemTime) do if self.isOpen then self.close else exit(true);
    end;

    //This function will find all colors close to the range color and split them into
    //TPA's by width and height, a use range function will call this one
    function findRange: T2DPointArray;
    var
      rangeTPA: TPointArray;
    begin
      if findColorsTolerance(rangeTPA, 4146611, mainscreen.getBounds, 4, colorSetting(2, 0.06, 0.53)) then
        result := rangeTPA.toATPA(15, 15);
      sortATPAFromMidPoint(result, mainscreen.playerPoint);
    end;

    function TRSProductionScreen.isOpen(waitTime: integer = 0): boolean;  override;
    var
      t: UInt64;
    begin
      result := false;
      t := (getTickCount64() + waitTime);

      while (not result) and (t >= getTickCount64()) do
      begin
        result := getColor(point(44, 66)) = 1388125;
        wait(randomRange(20, 50));
      end;
    end;

    function useRange: boolean;
    var
      range: T2DPointArray;
      pont: TPoint;
      i, h, timer: integer;
    begin
      range := findRange;
      if (length(range) < 1) then exit;
      h := high(range);
      for i := 0 to h do
      begin
        if (length(range[i]) < 5) then continue;
        pont := range[i].centerPoint;
        mouse(pont.rand(-3, 3), Mouse_Right, Mouse_Human);
        if chooseOption.select(['-> Range'], randomRange(1000, 4000)) then
        begin
          minimap.waitPlayerMoving();
          writeLn(productionScreen.isOpen(1000) );
          if productionScreen.isOpen(5000) then
          begin
            result := productionScreen.clickStart();
            exit(true);
          end;
        end;
      end else chooseOption.close2;
    end;

    function doneButton: boolean;
    var
      bluePoints: TPointArray;
      blueArea: TBox;
    begin
      blueArea := [244,197, 335, 223];
      findColorsTolerance(bluePoints, 13278759, blueArea, 44);
      result := length(bluePoints) > 145;
    end;

    procedure whileCooking;
    var
      blkCount: TPointArray;
      count, threshold: integer;
    begin
      threshold := getSystemTime + randomRange(70000, 80000);
      repeat
        wait(randomRange(255, 555));
        if doneButton then
        begin
          threshold := getSystemTime + randomRange(2500, 3500);
          repeat
            wait(randomRange(255, 555));
            if not(doneButton) then exit;
          until (getSystemTime > threshold);
        end;
      until (getSystemTime > threshold);
    end;

    //This function will find all colors close to the banker color and split them into
    //TPA's by width and height, a use bank function will call this one
    function findBankers: T2DPointArray;
    var
      bankerTPA: TPointArray;
    begin
      if findColorsTolerance(bankerTPA, 2450798, mainscreen.getBounds, 14, colorSetting(2, 0.09, 1.31)) then
        result := bankerTPA.toATPA(15, 15);
      sortATPAFromMidPoint(result, mainscreen.playerPoint);
    end;

    function useBank: boolean;
    var
      bankers: T2DPointArray;
      pont: TPoint;
      i, h, timer: integer;
    begin
      bankers := findBankers;
      if (length(bankers) < 1) then exit;
      h := high(bankers);
      for i := 0 to h do
      begin
        if (length(bankers[i]) < 5) then continue;
        pont := bankers[i].centerPoint;
        mouse(pont.rand(-3, 3), Mouse_Right, Mouse_Human);
        if chooseOption.select(['Bank Banker', 'Bank Bank', 'nk Banker'], randomRange(1000, 4000)) then
        begin
          minimap.waitPlayerMoving();
          timer := getSystemTime + randomRange(3000, 6000);
          repeat
            wait(randomRange(100, 400));
          until (bankscreen.isOpen) or (pinscreen.isOpen) or (getSystemTime > timer);
          if pinscreen.isOpen then pinScreen.enter(players[currentPlayer].bankPin);
          if bankscreen.isOpen then exit(true);
        end else chooseOption.close2;
      end;
    end;

    function cook_count: TPoint
    var
      i, invcount, x, y: integer;
      clrFound: boolean;
    begin
      tabBackpack.open;
      invcount := tabBackpack.count;
      clrFound := findColor(x, y, 65535, tabBackpack.getBounds);
      case invcount of
        0: result := [0, 0];
        1..27: result := [invcount-1, 29-invcount];
        28: if clrFound then result := [27, 1] else result := [28, 0];
      end;
    end;

    procedure printProgress;
    var
      secondsElapsed, expPHour, totalEXP: extended;
      food: TPoint;
    begin
      food := cook_count;

      food_cooked := food_cooked + food.x;
      food_burnt := food_burnt + food.y;

      totalEXP := food_cooked * players[currentPlayer].extendeds[0];
      secondsElapsed := (getTimeRunning/1000);
      expPHour := (totalEXP * 60 * 60) / secondsElapsed;

      smartImage.clearArea(intToBox(576, 200, 798, 278));
      smartImage.drawBox(intToBox(576, 200, 798, 278), true, 7890014);

      smartImage.DrawText('Run Time: ' + msToTime(GetTimeRunning, TIME_SHORT), Point(618, 224), upchars, false, 1376386);
      smartImage.DrawText('EXP/Hour: ' + toString(round(expPHour)), Point(618, 234), upchars, false, 1376386);
      smartImage.DrawText('Total EXP: ' + toString(totalEXP), Point(618, 244), upchars, false, 1376386);
      smartImage.DrawText('Items cooked: ' + toString(food_cooked), Point(618, 254), upchars, false, 1376386);
      smartImage.DrawText('Items burnt: ' + toString(food_burnt), Point(618, 264), upchars, false, 1376386);
    end;

    function handleBanking: boolean;
    begin
      printProgress;
      if waitFunc(@useBank, 100, randomRange(20000,30000)) then
      begin
        bankscreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
        if bankscreen.withdraw(players[currentPlayer].integers[0], WITHDRAW_AMOUNT_ALL_BUT_ONE, ['']) then
          result := bankscreen.close;
      end;
    end;

    procedure prepareSelf;
    begin
      wait(random(500, 1500));
      minimap.clickCompass;
      wait(random(500, 1500));
      mainscreen.setAngle(MS_ANGLE_HIGH);
      wait(random(1, 1500));
    end;

    procedure mainLoop;
    var
      loc: TPoint;
    begin

      if not isLoggedIn then
      begin
        print('We''re not logged in. respawning client.');
        wait(randomRange(5000, 10000));
        smartReloadClient((5 * 60000) + random(15000));

        if (waitClientReady()) then
        begin
          print('Client succesfully loaded after reload');
        end else
        begin
          print('Client never reloaded after restart..', TDebug.FATAL);
          terminateScript;
        end;
        if not players[currentPlayer].isActive then players.next(false);
        if players[currentPlayer].login then prepareSelf;
        if not isLoggedIn then
        begin
          writeln('Terminating, not logged in.');
          terminateScript;
        end;
      end;

      loc := location;
      if loc.equals([-1, -1]) then exit;
      wait(randomRange(1, 300));
      if walk(true) then
        if handleBanking then
          if walk(false) then
            if tabBackpack.mouseSlot(randomRange(10, 28), mouse_left) then
              if useRange then whileCooking;
    end;

    begin

      if USE_DirectX then smartPlugins := ['d3d9.dll'];

      smartEnableDrawing := true;
      setupsrl;
      declarePlayers;
      initPaths;

      if not isLoggedIn then if players[currentPlayer].login then prepareSelf;

      while players.getActive > 0 do mainLoop;
    end.

    E: Crayfish @ level 1 cooking

    E2: Banker + range colour seem to change frequently. Need to pick a stable colour across multiple worlds.
    Last edited by The Mayor; 10-23-2014 at 08:41 AM.

  24. #49
    Join Date
    Mar 2014
    Location
    East Coast, USA
    Posts
    291
    Mentioned
    10 Post(s)
    Quoted
    148 Post(s)

    Default

    I took what The Mayor gave and I personally had to edit the color for the bank and the range. I think there still needs a little optimization to be done. I am going to see if I can figure it out and I will post my findings. So far it is running though.

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
  •