Results 1 to 13 of 13

Thread: [F2P][Ironman]bIronmanRunecrafting

  1. #1
    Join Date
    Dec 2011
    Posts
    39
    Mentioned
    0 Post(s)
    Quoted
    12 Post(s)

    Cool [F2P][Ironman]bIronmanRunecrafting

    Welcome to what I imagine will be the best thread on this board, the introduction of a flawless (Read: Bug Ridden) script aptly name 'bIronmanRunecrafting', the b doesn't represent the fact its of 'b' grade quality, no its the b in my name!

    Firstly, A number of people helped put this together, I used a bunch of their scripts and all the knowledge they were able to part with, in no particular order.

    Markus92, I used his essence mining script for inspiration and in the original version of this script most of the rune essence logic was based on it. He also provided answers to any questions I had.

    Slackyy, he's helped revolutionize essence mining, he may not know it, but without his great idea to track the plank paths around the essence and then click the center (ie relative objects, theres a tutorial somewhere I read on here). I like to think that we were a team on that mission.

    Turpinator, general scripting help.

    Joopi, Fixed many errors and answered a lot of questions

    Olly, The portal magician himself, he designed a way to find portals 100% of the time, pretty cool stuff. If you ever need to know about pixel shifting, this is the script to have, take a look at the sections marked '//Olly'.

    I'm pretty sure I've missed people, but you know who you are.

    I also used Flight's 'AeroAIORunecrafter Lite', I used it to try and mimic his scripting style mainly the FSM setup and also to pick up some better habits when it came to scripting. I'll attach also attach the original script go take a look at how to not setup a script.

    Now to the bugs, I haven't actually tested an entire run of the script because its so damn unstable, it will seemingly change states randomly. For instance:
    • Crafting Runes: When we get inside the Earth Ruins, by the time we get to the crafting altar, it will change its state to try and get us to entire the ruins again.
    • Walker Malfunction: Now, i'm not blaming RSWalker for this, but the script seems to think its at the essence mine unless you start it in a location with a polygon check, which is weird because I thought the base case would cover this, clearly not.
    • Script seems to jump the gun: Changing states before we should, I tried to use FFLag here, and a bunch of wait statements but the problem is probably deeper than that, most likely with the FSM setup
    • Script will think it has red clicked, really hasn't and will just wait. I tried to do some pixel shifting to determine whether we were in fact mining, but sometimes that fails too if you are near portal, funny that.
    • Portal finder will sometimes jump the gun, this is probably also to do with the FSM setup having problems of it own, generally putting a longer wait helps this issue.

    Those are the only ones I've spotted so far, because I haven't been able to run it long enough.

    I do plan on coming back to this script, rewriting it again and actually making sure it functions up to specification. However for the time being, I've had it with rune essence, teleporting, Aubury, portals and general varrock, its time to go on holiday to Al Kharid, some sun to get us over our cavernous blues or should I say whites.

    Heres the original script, don't bother running it, it wont. This is the very bad one, my first SRL color only. Its bad, you've been warned:

    Code:
    program new;
    {$DEFINE SMART}
    {$DEFINE WALKER}
    {$i AeroLib/AeroLib.Simba}
    
    type
      STATE = (STARTING_UP, WALK_TO_ALTAR, WALK_TO_MINE, WALK_TO_SHOP, CRAFTING, MINING, TALK);
    
    var
      EssLoc : Integer;
    
      AuburyShopArea, AltarArea, PathToAubury, PathToAltar,
      Earth_Altar_Area, Earth_Altar_Enterance              : TPointArray;
    
      EssenceMine_AreaOne, EssenceMine_AreaTwo,
      EssenceMine_AreaThree, EssenceMine_AreaFour          : TPointArray;
    
      Earth_Portal, Earth_Altar                            : TPoint;
    
      AreaOne_TopRight_Ess, AreaOne_TopRight_Portal,
      AreaOne_TopRight_Ess2                                : TPoint;
    
      AreaOne_TopLeft_Ess, AreaOne_TopLeft_Portal,
      AreaOne_TopLeft_Ess2                                 : TPoint;
    
      AreaOne_BottomRight_Ess, AreaOne_BottomRight_Portal,
      AreaOne_BottomRight_Ess2                             : TPoint;
    
      AreaOne_BottomLeft_Ess, AreaOne_BottomLeft_Portal,
      AreaOne_BottomLeft_Ess2                              : TPoint;
      //AREA TWO DECLARATIONS
      AreaTwo_TopRight_Ess, AreaTwo_TopRight_Portal,
      AreaTwo_TopRight_Ess2                                : TPoint;
    
      AreaTwo_TopLeft_Ess, AreaTwo_TopLeft_Portal,
      AreaTwo_TopLeft_Ess2                                 : TPoint;
    
      AreaTwo_BottomRight_Ess, AreaTwo_BottomRight_Portal,
      AreaTwo_BottomRight_Ess2                             : TPoint;
    
      AreaTwo_BottomLeft_Ess, AreaTwo_BottomLeft_Portal,
      AreaTwo_BottomLeft_Ess2                              : TPoint;
    
      //AREA THREE DECLARATIONS
      AreaThree_TopRight_Ess, AreaThree_TopRight_Portal,
      AreaThree_TopRight_Ess2                              : TPoint;
    
      AreaThree_TopLeft_Ess, AreaThree_TopLeft_Portal,
      AreaThree_TopLeft_Ess2                               : TPoint;
    
      AreaThree_BottomRight_Ess, AreaThree_BottomRight_Portal,
      AreaThree_BottomRight_Ess2                           : TPoint;
    
      AreaThree_BottomLeft_Ess, AreaThree_BottomLeft_Portal,
      AreaThree_BottomLeft_Ess2                            : TPoint;
    
      //AREA FOUR DECLARATIONS
    
      AreaFour_TopRight_Ess, AreaFour_TopRight_Portal,
      AreaFour_TopRight_Ess2                               : TPoint;
    
      AreaFour_TopLeft_Ess, AreaFour_TopLeft_Portal,
      AreaFour_TopLeft_Ess2                                 : TPoint;
    
      AreaFour_BottomRight_Ess, AreaFour_BottomRight_Portal,
      AreaFour_BottomRight_Ess2                             : TPoint;
    
      AreaFour_BottomLeft_Ess, AreaFour_BottomLeft_Portal,
      AreaFour_BottomLeft_Ess2                              : TPoint;
    
      //CENTER AND POLY DECLARATIONS FOR ALL AREAS
      AreaOne_Center, AreaTwo_Center, AreaThree_Center,
      AreaFour_Center                                      : TPoint;
    
      AreaOne_TopLeft_Poly, AreaOne_TopRight_Poly,
      AreaOne_BottomLeft_Poly, AreaOne_BottomRight_Poly    : TPointArray;
    
      AreaTwo_TopLeft_Poly, AreaTwo_TopRight_Poly,
      AreaTwo_BottomLeft_Poly, AreaTwo_BottomRight_Poly    : TPointArray;
    
      AreaThree_TopLeft_Poly, AreaThree_TopRight_Poly,
      AreaThree_BottomLeft_Poly, AreaThree_BottomRight_Poly: TPointArray;
    
      AreaFour_TopLeft_Poly, AreaFour_TopRight_Poly,
      AreaFour_BottomLeft_Poly, AreaFour_BottomRight_Poly  : TPointArray;
    
      AreaOne_Center_Poly, AreaTwo_Center_Poly,
      AreaThree_Center_Poly, AreaFour_Center_Poly          : TPointArray;
    
      Ruins, Portal, ESSPortal, ESSRock, ESSPortal_White   : TMSObject;
    
      RSW, RuneCraftWalker, EssenceMineWalker : TRSWalker; //RSW tutorial
    
      CURRENT_TASK                                         : STATE;
    
    //  Taken from Markus92's script
    function MiddlesTPA(atpa : TPointArrayArray) : TPointArray;  //Markus92
    var
      i : integer;
    begin
      setlength(result, length(atpa));
      for i := 0 to high(atpa) do
        result[i] := MiddleTPA(atpa[i]);
    end;
    
    function IsPointInPolygon(A : TPoint; APolygon: array of TPoint): Boolean; //Markus92
    var
      xnew, ynew: Cardinal;
      xold,yold: Cardinal;
      x1,y1: Cardinal;
      x2,y2: Cardinal;
      i, npoints: Integer;
      inside: Integer = 0;
    begin
      Result := False;
      npoints := Length(APolygon);
      if (npoints < 3) then Exit;
      xold := APolygon[npoints-1].X;
      yold := APolygon[npoints-1].Y;
      for i := 0 to npoints - 1 do
      begin
        xnew := APolygon[i].X;
        ynew := APolygon[i].Y;
        if (xnew > xold) then
        begin
          x1:=xold;
          x2:=xnew;
          y1:=yold;
          y2:=ynew;
        end
        else
        begin
          x1:=xnew;
          x2:=xold;
          y1:=ynew;
          y2:=yold;
        end;
        if (((xnew < A.X) = (A.X <= xold))         // edge "open" at left end
          and ((A.Y-y1)*(x2-x1) < (y2-y1)*(A.X-x1))) then
        begin
          inside := not inside;
        end;
        xold:=xnew;
        yold:=ynew;
      end;
      Result := inside <> 0;
    end;
    
    Procedure Setup();
    Begin
      RSW.Init('C:\Users\Nenad\Desktop\Simba\Includes\AeroLib\maps\WorldMap.png');
      RuneCraftWalker.Init('C:\Users\Nenad\Desktop\Simba\Includes\AeroLib\maps\RunecraftingAltars.png');
      EssenceMineWalker.Init('C:\Users\Nenad\Desktop\Simba\Includes\AeroLib\maps\EssenceMine.png');
    
      RSW.walkStyle := wsSPS;
      RuneCraftWalker.walkStyle := wsSPS;
      EssenceMineWalker.walkStyle := wsSPS;
    
      RSW.anyAngle := True;
      RuneCraftWalker.anyAngle := True;
      EssenceMineWalker.anyAngle := False;
    
      RSW.skipClose := 40;
      RuneCraftWalker.skipClose := 40;
    
      CURRENT_TASK := STARTING_UP;
    
      Me.Active := True;
      Me.Name := '';
      Me.Pass := '';
      Me.Member := False;
    
      LoginPlayer(false);
    
      //Paths and Area Information
    
      AuburyShopArea := [[4816, 2838], [4816, 2830], [4823, 2830], [4833, 2839], [4831, 2846],
               [4824, 2854], [4816, 2854], [4808, 2846], [4807, 2840]];
    
      AltarArea := [[5020, 2540], [5016, 2576], [5045, 2573], [5045, 2542]]; //Search for ruins here
    
      PathToAltar := [[4837, 2841], [4848, 2805], [4863, 2777], [4872, 2745], [4891, 2739],
                      [4923, 2735], [4948, 2738], [4951, 2696], [4954, 2660], [4953, 2638],
                      [4972, 2615], [4994, 2596], [5010, 2582], [5023, 2567]]; //NOT TESTED, NOT FINAL.  //one of the many paths planned
    
      PathToAubury := [[5013, 2579], [4989, 2601], [4961, 2635], [4959, 2669], [4956, 2705],
                       [4945, 2731], [4902, 2741], [4876, 2755], [4868, 2779], [4845, 2807],
                       [4839, 2828], [4837, 2859], [4819, 2848]]; //NOT TESTED, NOT FINAL. //The last point is inside the shop, MAYBE USE THE MAGE SYMBOL AND CLICK IT?
    
    
      Earth_Portal := Point(777, 249);
      Earth_Altar := Point(790, 212);
      Earth_Altar_Area := [[780, 198], [779, 221], [805, 220], [806, 200]];
      Earth_Altar_Enterance := [[771, 239], [769, 264], [798, 261], [797, 239]];
    
      EssenceMine_AreaOne := [[124, 119], [134, 356], [362, 358], [350, 126]];
      EssenceMine_AreaTwo := [[422, 126], [652, 116], [658, 374], [419, 371]];
      EssenceMine_AreaThree := [[119, 389], [115, 635], [366, 642], [364, 390]];
      EssenceMine_AreaFour := [[408, 389], [420, 634], [658, 635], [657, 399]];
    
      //Essence Mine Area One Values For Portals, Rocks and Center
      AreaOne_TopLeft_Ess := Point(169, 172);
      AreaOne_TopLeft_Portal := Point(148, 173);
      AreaOne_TopLeft_Ess2 := Point(172, 180);
    
      AreaOne_TopRight_Ess := Point(324, 159);
      AreaOne_TopRight_Portal := Point(331, 146);
      AreaOne_TopRight_Ess2 := Point(329, 158);
    
      AreaOne_BottomLeft_Ess := Point(172, 315);
      AreaOne_BottomLeft_Portal := Point(162, 321);
      AreaOne_BottomLeft_Ess2 := Point(172, 330);
    
      AreaOne_BottomRight_Ess := Point(334, 313);
      AreaOne_BottomRight_Portal := Point(334, 313);
      AreaOne_BottomRight_Ess2 := Point(322, 326);
    
      AreaOne_Center := Point(249, 251);
      AreaOne_TopLeft_Poly := [[138, 136], [205, 132], [209, 210], [131, 204]];
      AreaOne_TopRight_Poly := [[269, 129], [268, 215], [366, 218], [362, 130]];
      AreaOne_BottomLeft_Poly := [[157, 267], [217, 268], [214, 354], [128, 352]];
      AreaOne_BottomRight_Poly := [[292, 262], [358, 258], [358, 372], [285, 354]];
      AreaOne_Center_Poly := [[220, 202], [218, 277], [272, 281], [278, 213]];
    
      //Essence Mine Area Two Values For Portals, Rocks and Center
      AreaTwo_TopLeft_Ess := Point(457, 183);
      AreaTwo_TopLeft_Portal := Point(451, 168);
      AreaTwo_TopLeft_Ess2 := Point(471, 173);
    
      AreaTwo_TopRight_Ess := Point(609, 169);
      AreaTwo_TopRight_Portal := Point(627, 178);
      AreaTwo_TopRight_Ess2 := Point(612, 187);
    
      AreaTwo_BottomLeft_Ess := Point(460, 329);
      AreaTwo_BottomLeft_Portal := Point(450, 352);
      AreaTwo_BottomLeft_Ess2 := Point(477, 340);
    
      AreaTwo_BottomRight_Ess := Point(602, 332);
      AreaTwo_BottomRight_Portal := Point(640, 325);
      AreaTwo_BottomRight_Ess2 := Point(620, 319);
    
      AreaTwo_Center := Point(536, 249);
      AreaTwo_TopLeft_Poly := [[417, 132], [422, 225], [486, 243], [509, 132]];
      AreaTwo_TopRight_Poly := [[562, 129], [565, 209], [638, 241], [653, 142]];
      AreaTwo_BottomLeft_Poly := [[423, 283], [428, 365], [514, 361], [504, 289]];
      AreaTwo_BottomRight_Poly := [[570, 281], [571, 374], [653, 370], [643, 273]];
      AreaTwo_Center_Poly := [[509, 202], [505, 284], [572, 289], [569, 209]];
    
    
      //Essence Mine Area Three Values For Portals, Rocks and Center
      AreaThree_TopLeft_Ess := Point(165, 449);
      AreaThree_TopLeft_Portal := Point(171, 429);
      AreaThree_TopLeft_Ess2 := Point(186, 438);
    
      AreaThree_TopRight_Ess := Point(316, 433);
      AreaThree_TopRight_Portal := Point(322, 414);
      AreaThree_TopRight_Ess2 := Point(338, 448);
    
      AreaThree_BottomLeft_Ess := Point(174, 586);
      AreaThree_BottomLeft_Portal := Point(170, 603);
      AreaThree_BottomLeft_Ess2 := Point(186, 605);
    
      AreaThree_BottomRight_Ess := Point(339, 578);
      AreaThree_BottomRight_Portal := Point(342,605);
      AreaThree_BottomRight_Ess2 := Point(327, 599);
    
      AreaThree_Center := Point(246, 519);
      AreaThree_TopLeft_Poly := [[130, 397], [132, 481], [215, 486], [245, 411]];
      AreaThree_TopRight_Poly := [[268, 402], [273, 478], [363, 484], [375, 409]];
      AreaThree_BottomLeft_Poly := [[126, 533], [236, 554], [233, 635], [122, 634]];
      AreaThree_BottomRight_Poly := [[286, 546], [280, 622], [360, 631], [368, 553]];
      AreaThree_Center_Poly := [[203, 474], [212, 565], [284, 563], [298, 488]];
    
      //Essence Mine Area Four Values For Portals, Rocks and Center
      AreaFour_TopLeft_Ess := Point(456, 438);
      AreaFour_TopLeft_Portal := Point(437, 430);
      AreaFour_TopLeft_Ess2 := Point(453, 454);
    
      AreaFour_TopRight_Ess := Point(599, 436);
      AreaFour_TopRight_Portal := Point(619, 433);
      AreaFour_TopRight_Ess2 := Point(620, 441);
    
      AreaFour_BottomLeft_Ess := Point(469, 598);
      AreaFour_BottomLeft_Portal := Point(458, 599);
      AreaFour_BottomLeft_Ess2 := Point(456, 596);
    
      AreaFour_BottomRight_Ess := Point(618, 582);
      AreaFour_BottomRight_Portal := Point(613, 601);
      AreaFour_BottomRight_Ess2 := Point(602, 589);
    
      AreaFour_Center := Point(539, 516);
      AreaFour_TopLeft_Poly := [[417, 397], [418, 482], [495, 488], [500, 405]];
      AreaFour_TopRight_Poly := [[546, 398], [550, 464], [638, 493], [658, 411]];
      AreaFour_BottomLeft_Poly := [[409, 544], [415, 630], [520, 629], [505, 547]];
      AreaFour_BottomRight_Poly := [[551, 551], [562, 621], [648, 624], [642, 547]];
      AreaFour_Center_Poly := [[506, 468], [504, 546], [572, 546], [574, 483]];
    
      //End Essence Info
    
      //Misc Info (Portals, Ruins)
      Portal.create('Earth Portal', ['Use Por','e Po','Portal', 'rtal'], [createCol(8046544, 21, 0.09, 1.37)], 40, 40, 20);
      ESSPortal.create('Essence Exit Portal', ['Use Por','e Po','Portal', 'rtal'], [createCol(10796745, 11, 0.40, 1.59)], 40, 40, 20);
      ESSPortal_White.create('Essence Exit Portal', ['Use Por','e Po','Portal', 'rtal'], [createCol(12961740, 20, 0.24, 0.32)], 40, 40, 20);
    End;
    
    Procedure FindRuinsAndEnter();   //Taken From Markus's Essence Miner
    var
    colorTPA : TPointArray;
    colorTPA2D : T2DPointArray;
    point : TPoint;
    len, i : Integer;
    
    begin
      while not (IsPointInPolygon(RSW.GetMyPos(), AltarArea)) do
        begin
          wait(Random(600, 950));         //Spin Locks in 2017
        end;
      WriteLn('Looking For Ruins');
      Wait(400 + Random(100));
      FindColorsTolerance(colorTPA, 4213320, MSX1, MSY1, MSX2, MSY2, 15);
      if Length(colorTPA) = 0 then FindColorsTolerance(colorTPA, 4212042, MSX1, MSY1, MSX2, MSY2, 15);
    
      colorTPA2D := SplitTPA(colorTPA, 10);
      len := Min(10, High(colorTPA2D));
    
      SortATPASize(colorTPA2D, true);
    
      for i := 0 to len do
        begin
          if (Length(colorTPA2D[i]) < 10) then Continue;
            point := MiddleTPA(colorTPA2D[i]);
            humanMMouse(point, 0, 0);
            wait(450 + Random(100));
            if (isUptextMulti(['Enter Mysterious ruins', 'ter Myster'])) then
            begin
              fastClick(mouse_Left);
              break;
            end;
        end;
    end;
    
    Procedure FindAubury();  //Markus92
    Var
      I, T, cts: Integer;
      P: TPoint;
      PA: TPointArray;
      aPA: T2DPointArray;
      Middles : TPointArray;
    
    Begin
      if not (IsPointInPolygon(RSW.GetMyPos(), AuburyShopArea)) then
        begin
          writeln('Not in shop, walking to pos, then waiting');
          RSW.WalkToPos(Point(4819, 2848), true);
          wait(Random(300, 800));
        end;
    
      for i := 0 to 5 do  //Give It some Tries to catch Aubury!
        begin
          FindColorsTolerance(PA, 1686228, MSX1, MSY1, MSX2, MSY2, 11);
    
          aPA := SplitTPA(PA, 5);
          Middles := MiddlesTPA(aPA);
          SortTPAFrom(Middles, MSCP);
    
          For i := 0 to min(4, High(Middles)) do
            begin
              humanMMouse([Middles[i].x, Middles[i].y], 3, 3);
              if (isUptextMulti(['lk-To Au', 'Talk-To A', 'To Aub', 'o Aubur', 'Aubury'])) then //Joopi gave us this
                begin
                  fastClick(MOUSE_RIGHT);
                  chooseOptionMulti(['elep', 'ort', 'Tel', 'ort Aubury']);
                  WriteLn('Teleporting To The Mines!');
                  wait(Random(2000, 3000));
                  break;
                end;
            end;
              WriteLn('Breaking Aubury Search, We either found him or we have hit a huge error, you decide');
              break;
        end;
    end;
    
    Procedure CraftRunesAndLeave();
    
    var
      colorTPA : TPointArray;
      colorTPA2D : T2DPointArray;
      point : TPoint;
      len, i : Integer;
    begin
      //Not a very good way to do it, but it will have to do, the lag is incredible
      Writeln('Waiting');
      Wait(Random(1000, 1800));
    
      Writeln('Finished Waiting, Checking Our Position');
    
      Writeln(RuneCraftWalker.GetMyPos());
      RuneCraftWalker.WalkToPos(Earth_Altar, true);
    
      wait(Random(500, 1000)); // We need to wait because for some reason it just tries to search for the damn thing
      WriteLn('Looking For Altar to Craft');
      FindColorsTolerance(colorTPA, 5133659, MSX1, MSY1, MSX2, MSY2, 14);
      if Length(colorTPA) = 0 then WriteLn('Couldnt find the Altar');
    
      colorTPA2D := SplitTPA(colorTPA, 4);
      len := Min(10, High(colorTPA2D));
    
      SortATPASize(colorTPA2D, true);
    
      for i := 0 to len do
        begin
          if (Length(colorTPA2D[i]) < 120) then Continue;
            point := MiddleTPA(colorTPA2D[i]);
            humanMMouse(point, 0, 0);
            wait(450 + Random(100));
            if (isUptextMulti(['Craft-rune','ft-ru','ne Al','Altar'])) then
            begin
              fastClick(mouse_Left);
              wait(Random(1000, 2150));
              if not didRedClick() then
                begin
                  writeln('We Didnt See A red click!');
                end;
              writeln('breaking craft and leave');
              break;
            end;
        end; //Maybe I can just use the TMSOBJECT here, Would utilze AERO's fuctions, Will test in next version
    
       //Wait to craft the runes
    
      WriteLn('Looking for portal To Exit');
      RuneCraftWalker.WalkToPos(Earth_Portal, True);
      wait(Random(950, 1050)); //Wait for it to start walking or script terminates before it catches that the player is walking
                               //Really just trying to deal with lag here
      if Portal.find(point) then
        begin
          WriteLn('Found the portal');
          fastClick(mouse_Left);   //As it stands, portal should always be that yellow color
        end;
    end;
    
    Function EssenceMineLocation() : Integer;
    Var
      Loc : TPoint;
     //1 MEANS TOP LEFT, 2 MEANS TOP RIGHT, 3 MEANS BOTTOM LEFT, 4 MEANS BOTTOM RIGHT, 0 MEANS CENTER
    Begin
      WriteLn('We Are Locating Our Position In The Essence Mine');
      wait(Random(2000, 3000)); //Waiting to Make sure We are Actually In the Mine
      Loc := EssenceMineWalker.GetMyPos();
      //START AREA ONE CHECK
      if (IsPointInPolygon(Loc, EssenceMine_AreaOne)) then
        begin
          if (IsPointInPolygon(Loc, AreaOne_TopLeft_Poly)) then
            Begin
              WriteLn('We Are In Area 1, Top Left');
              Result := 11;
            End;
    
          if (IsPointInPolygon(Loc, AreaOne_TopRight_Poly)) then
            Begin
              WriteLn('We Are In Area 1, Top Right');
              Result := 12;
            End;
    
          if (IsPointInPolygon(Loc, AreaOne_BottomLeft_Poly)) then
            Begin
              WriteLn('We Are In Area 1, Bottom Left');
              Result := 13;
            End;
    
          if (IsPointInPolygon(Loc, AreaOne_BottomRight_Poly)) then
            Begin
              WriteLn('We Are in Area 1, Bottom Right');
              Result := 14;
            End;
    
          if (IsPointInPolygon(Loc, AreaOne_Center_Poly)) then
            Begin
              WriteLn('We Are In Area 1, Center');
              Result := 10;
            End;
        end; // END AREA ONE CHECK
    
        //START AREA TWO CHECK
      if (IsPointInPolygon(Loc, EssenceMine_AreaTwo)) then
        begin
    
          if (IsPointInPolygon(Loc, AreaTwo_TopLeft_Poly)) then
            Begin
              WriteLn('We Are In Area 2, Top Left');
              Result := 21;
            End;
    
          if (IsPointInPolygon(Loc, AreaTwo_TopRight_Poly)) then
            Begin
              WriteLn('We Are In Area 2, Top Right');
              Result := 22;
            End;
    
          if (IsPointInPolygon(Loc, AreaTwo_BottomLeft_Poly)) then
            Begin
              WriteLn('We Are In Area 2, Bottom Left');
              Result := 23;
            End;
    
          if (IsPointInPolygon(Loc, AreaTwo_BottomRight_Poly)) then
            Begin
              WriteLn('We Are in Area 2, Bottom Right');
              Result := 24;
            End;
    
          if (IsPointInPolygon(Loc, AreaTwo_Center_Poly)) then
            Begin
              WriteLn('We Are In Area 2, Center');
              Result := 20;
            End;
        end; //END AREA TWO CHECK
    
        //START AREA THREE CHECK
       if (IsPointInPolygon(Loc, EssenceMine_AreaThree)) then
        begin
    
          if (IsPointInPolygon(Loc, AreaThree_TopLeft_Poly)) then
            Begin
              WriteLn('We Are In Area 3, Top Left');
              Result := 31;
            End;
    
          if (IsPointInPolygon(Loc, AreaThree_TopRight_Poly)) then
            Begin
              WriteLn('We Are In Area 3, Top Right');
              Result := 32;
            End;
    
          if (IsPointInPolygon(Loc, AreaThree_BottomLeft_Poly)) then
            Begin
              WriteLn('We Are In Area 3, Bottom Left');
              Result := 33;
            End;
    
          if (IsPointInPolygon(Loc, AreaThree_BottomRight_Poly)) then
            Begin
              WriteLn('We Are in Area 3, Bottom Right');
              Result := 34;
            End;
    
          if (IsPointInPolygon(Loc, AreaThree_Center_Poly)) then
            Begin
              WriteLn('We Are In Area 3, Center');
              Result := 30;
            End;
        end;    //END AREA THREE CHECK
    
        //START AREA FOUR CHECK
       if (IsPointInPolygon(Loc, EssenceMine_AreaFour)) then
        begin
          if (IsPointInPolygon(Loc, AreaFour_TopLeft_Poly)) then
            Begin
              WriteLn('We Are In Area 4, Top Left');
              Result := 41;
            End;
    
          if (IsPointInPolygon(Loc, AreaFour_TopRight_Poly)) then
            Begin
              WriteLn('We Are In Area 4, Top Right');
              Result := 42;
            End;
    
          if (IsPointInPolygon(Loc, AreaFour_BottomLeft_Poly)) then
            Begin
              WriteLn('We Are In Area 4, Bottom Left');
              Result := 43;
            End;
    
          if (IsPointInPolygon(Loc, AreaFour_BottomRight_Poly)) then
            Begin
              WriteLn('We Are in Area 4, Bottom Right');
              Result := 44;
            End;
    
          if (IsPointInPolygon(Loc, AreaFour_Center_Poly)) then
            Begin
              WriteLn('We Are In Area 4, Center');
              Result := 40;
            End;
        end;
    End;
    
    Procedure FindAndMineEssThenLeave(BackupEss, PortalPnt:TPoint)  //Slackyy Came and gave everyone a run for their moeny
    var                                                             //When he decided to tackle the Essence Problem
      point : TPoint;                                               //This works in a simple way, we take the color of the plank road around the essence
      TPA, TPAMess, TPAWoodRoad : TPointArray;                      //and the essence rock itself, we then take the mid point of the plank road (there are two plank roads one at the bottom and one on top)
      ATPA, Clusters : T2DPointArray;                               //We then sort the messyTPA which is our essence color and our essence rock should be in ATPA[0].
      i, len : Integer;
    
    begin
    
      wait(Random(1000, 2000));//make sure we have stopped moving from our walk
      if not (FindColorsTolerance(TPAWoodRoad, 3623763, MSX1, MSY1, MSX2, MSY2, 19)) then
        begin
          WriteLn('Couldnt locate the planks');
          Exit;
        end;
      if not (FindColorsTolerance(TPAMess, 6184808, MSX1, MSY1, MSX2, MSY2, 30)) then
        begin
          WriteLn('This should never happen, because the whole room is the same color');
        end;
    
      ATPA := ClusterTPA(TPAMess, 1);
      point := MiddleTPA(TPAWoodRoad);
      SortATPAFromMidPoint(ATPA, point);
      len := Min(10, High(ATPA));
    
      if (getInvCount() < 28) then //if we have 28 slots filled then we can skip this and move to portal
        begin
          writeln('inv isnt full');                       //That way we dont click the essence, but as it stands we still navigate to the
          for i := 0 to len do      //essence spot, this will be addressed in the re write
          begin
            if (Length(ATPA[i]) > 4900) then Continue;
            point := MiddleTPA(ATPA[i]);
            humanMMouse(point, 3, 3);
            wait(500 + Random(100));
            Writeln('Checking UpText for Essence');
            if (waitUptextMulti(['Mine', 'une Ess', 'ence', 'Mine Ess'], 300)) then
              begin
                fastClick(mouse_Left);
                break;
              end;
          end; // maybe we use our backup essence location if this fails?
        end;
    
      //Check inventory here, if its 28 we go i guess
      while(getInvCount <> 28) do
        begin
          waitex(Random(950, 1050)); //We need to check that we are currently mining
        end;                         //As if we get a level up screen we stop mining
    
      if (getInvCount = 28) then
        begin
          writeln('invent full, lets get out of here -> walk to portal');
          EssenceMineWalker.blindWalk(PortalPnt);
          wait(Random(800, 1000)); //Wait for us to stop moving
          if ESSPortal.find(point) then
            begin
              writeln('Yellow Portal');
              fastClick(mouse_Left);
            end else
              writeln('not yellow');
        end;
    end;
    
    Procedure GetToEss(status:Integer);
    var
      chance : Integer;
      mmPt : TPoint;
    begin
      WriteLn('Getting to the essence spot');
      chance := Random(100);
      case status of
        10: //We Are In AREA ONE CENTER
          begin
            if (chance <= 25) then
              begin
                EssenceMineWalker.blindWalk(AreaOne_TopLeft_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaOne_TopLeft_Ess2, AreaOne_TopLeft_Portal);
              end;
    
            if (chance > 25) and (chance <= 50) then
              begin
                EssenceMineWalker.blindWalk(AreaOne_TopRight_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaOne_TopRight_Ess2, AreaOne_TopRight_Portal);
              end;
    
            if (chance > 50) and (chance < 75) then
              begin
                 EssenceMineWalker.blindWalk(AreaOne_BottomLeft_Ess);
                 FFlag(10);
                 FindAndMineEssThenLeave(AreaOne_BottomLeft_Ess2, AreaOne_BottomLeft_Portal);
              end;
    
            if (chance >= 75) then
              begin
                 EssenceMineWalker.blindWalk(AreaOne_BottomRight_Ess);
                 FFlag(10);
                 FindAndMineEssThenLeave(AreaOne_BottomRight_Ess2, AreaOne_BottomRight_Portal);
              end;
          end;
    
        11: //We Are In AREA ONE TOP LEFT
          begin
             EssenceMineWalker.WalkToPos(AreaOne_TopLeft_Ess, true);
             FindAndMineEssThenLeave(AreaOne_TopLeft_Ess2, AreaOne_TopLeft_Portal);
          end;
    
        12: //We Are In AREA ONE TOP RIGHT
          begin
            EssenceMineWalker.WalkToPos(AreaOne_TopRight_Ess, true);
            FindAndMineEssThenLeave(AreaOne_TopRight_Ess2, AreaOne_TopRight_Portal);
          end;
    
        13: //We are in AREA ONE BOTTOM LEFT
          begin
            EssenceMineWalker.WalkToPos(AreaOne_BottomLeft_Ess, true);
            FindAndMineEssThenLeave(AreaOne_BottomLeft_Ess2, AreaOne_BottomLeft_Portal);
          end;
    
        14: //We Are In AREA ONE BOTTOM RIGHT
          begin
            EssenceMineWalker.WalkToPos(AreaOne_BottomRight_Ess, true);
            FindAndMineEssThenLeave(AreaOne_BottomRight_Ess2, AreaOne_BottomRight_Portal);
          end;
    
      //AREA ONE ENDS
    
        20: //We Are In AREA TWO CENTER
          Begin
            if (chance <= 25) then
              begin
                EssenceMineWalker.blindWalk(AreaTwo_TopLeft_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaTwo_TopLeft_Ess2, AreaTwo_TopLeft_Portal);
              end;
    
            if (chance > 25) and (chance <= 50) then
              begin
                EssenceMineWalker.blindWalk(AreaTwo_TopRight_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaTwo_TopRight_Ess2, AreaTwo_TopRight_Portal);
              end;
    
            if (chance > 50) and (chance < 75) then
              begin
                EssenceMineWalker.blindWalk(AreaTwo_BottomLeft_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaTwo_BottomLeft_Ess2, AreaTwo_BottomLeft_Portal);
              end;
    
            if (chance >= 75) then
              begin
                EssenceMineWalker.blindWalk(AreaTwo_BottomRight_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaTwo_BottomRight_Ess2, AreaTwo_BottomRight_Portal);
              end;
          end;
    
        21: //We Are In AREA TWO TOP LEFT
          Begin
            EssenceMineWalker.WalkToPos(AreaTwo_TopLeft_Ess, true);
            FindAndMineEssThenLeave(AreaTwo_TopLeft_Ess2, AreaTwo_TopLeft_Portal);
          End;
    
        22: //We Are In AREA TWO TOP RIGHT
          Begin
            EssenceMineWalker.WalkToPos(AreaTwo_TopRight_Ess, true);
            FindAndMineEssThenLeave(AreaTwo_TopRight_Ess2, AreaTwo_TopRight_Portal);
          End;
    
        23: //We Are In AREA TWO BOTTOM LEFT
          Begin
            EssenceMineWalker.WalkToPos(AreaTwo_BottomLeft_Ess, true);
            FindAndMineEssThenLeave(AreaTwo_BottomLeft_Ess2, AreaTwo_BottomLeft_Portal);
          End;
    
        24: //We Are In AREA TWO BOTTOM RIGHT
          Begin
            EssenceMineWalker.WalkToPos(AreaTwo_BottomRight_Ess, true);
            FindAndMineEssThenLeave(AreaTwo_BottomRight_Ess2, AreaTwo_BottomRight_Portal);
          End;
    
      //AREA TWO END
    
        30: //We Are In AREA THREE CENTER
          Begin
            if (chance <= 25) then
              begin
                EssenceMineWalker.blindWalk(AreaThree_TopLeft_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaThree_TopLeft_Ess2, AreaThree_TopLeft_Portal);
              end;
    
            if (chance > 25) and (chance <= 50) then
              begin
                EssenceMineWalker.blindWalk(AreaThree_TopRight_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaThree_TopRight_Ess2, AreaThree_TopRight_Portal);
              end;
    
            if (chance > 50) and (chance < 75) then
              begin
                EssenceMineWalker.blindWalk(AreaThree_BottomLeft_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaThree_BottomLeft_Ess2, AreaThree_BottomLeft_Portal);
              end;
    
            if (chance >= 75) then
              begin
                EssenceMineWalker.blindWalk(AreaThree_BottomRight_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaThree_BottomRight_Ess2, AreaThree_BottomRight_Portal);
              end;
          End;
    
        31: //We Are In AREA THREE TOP LEFT
          Begin
            EssenceMineWalker.WalkToPos(AreaThree_TopLeft_Ess, true);
            FindAndMineEssThenLeave(AreaThree_TopLeft_Ess2, AreaThree_TopLeft_Portal);
          End;
    
        32: //We Are In AREA THREE TOP RIGHT
          Begin
            EssenceMineWalker.WalkToPos(AreaThree_TopRight_Ess, true);
            FindAndMineEssThenLeave(AreaThree_TopRight_Ess2, AreaThree_TopRight_Portal);
          End;
    
        33: //We Are In AREA THREE BOTTOM LEFT
          Begin
            EssenceMineWalker.WalkToPos(AreaThree_BottomLeft_Ess, true);
            FindAndMineEssThenLeave(AreaThree_BottomLeft_Ess2, AreaThree_BottomLeft_Portal);
          End;
    
        34: //We Are In AREA THREE BOTTOM RIGHT
          Begin
            EssenceMineWalker.WalkToPos(AreaThree_BottomRight_Ess, true);
            FindAndMineEssThenLeave(AreaThree_BottomRight_Ess2, AreaThree_BottomRight_Portal);
          End;
    
      //END AREA THREE
    
        40: //We Are In AREA FOUR CENTER
          Begin
            if (chance <= 25) then
              begin
                EssenceMineWalker.blindWalk(AreaFour_TopLeft_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaFour_TopLeft_Ess2, AreaFour_TopLeft_Portal);
              end;
    
            if (chance > 25) and (chance <= 50) then
              begin
                EssenceMineWalker.blindWalk(AreaFour_TopRight_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaFour_TopRight_Ess2, AreaFour_TopRight_Portal);
              end;
    
            if (chance > 50) and (chance < 75) then
              begin
                EssenceMineWalker.blindWalk(AreaFour_BottomLeft_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaFour_BottomLeft_Ess2, AreaFour_BottomLeft_Portal);
              end;
    
            if (chance >= 75) then
              begin
                EssenceMineWalker.blindWalk(AreaFour_BottomRight_Ess);
                FFlag(10);
                FindAndMineEssThenLeave(AreaFour_BottomRight_Ess2, AreaFour_BottomRight_Portal);
              end;
          End;
    
        41: //We Are In AREA FOUR TOP LEFT
          Begin
            EssenceMineWalker.WalkToPos(AreaFour_TopLeft_Ess, true);
            FindAndMineEssThenLeave(AreaFour_TopLeft_Ess2, AreaFour_TopLeft_Portal);
          End;
    
        42: //We Are In AREA FOUR TOP RIGHT
          Begin
            EssenceMineWalker.WalkToPos(AreaFour_TopRight_Ess, true);
            FindAndMineEssThenLeave(AreaFour_TopRight_Ess2, AreaFour_TopRight_Portal);
          End;
    
        43: //We Are In AREA FOUR BOTTOM LEFT
          Begin
            EssenceMineWalker.WalkToPos(AreaFour_BottomLeft_Ess, true);
            FindAndMineEssThenLeave(AreaFour_BottomLeft_Ess2, AreaFour_BottomLeft_Portal);
          End;
    
        44: //We Are In AREA FOUR BOTTOM RIGHT
          Begin
            EssenceMineWalker.WalkToPos(AreaFour_BottomRight_Ess, true);
            FindAndMineEssThenLeave(AreaFour_BottomRight_Ess2, AreaFour_BottomRight_Portal);
          End;
    
      //END AREA FOUR
      end; //case end
    End;
    
    
    
    begin
    
      initAL;
      Setup();
      //FROM HERE, WE SHOULD CHECK IF WE HAVE A FULL INVENTORY
      //OR IF WE ARE NEAR THE ALTAR ETC TO SET THE STATE
      //UNTIL THEN START AUBURY EMPTY INV
      //WalkToAubury();
      //FindAubury();
      EssLoc := EssenceMineLocation();
      writeln(EssLoc);
    
    
      //GetToEss(EssLoc);
    
    
      RSW.Free();
      RuneCraftWalker.Free();
      EssenceMineWalker.Free();
    
    end.
    Here is the re written version, better looking and it can even run!

    Code:
    program new;
    {$DEFINE SMART}
    {$DEFINE WALKER}
    {$i AeroLib/AeroLib.Simba}
    
    Const // User Setup
    //Player Info
    
    USERNAME  = '';
    PASSWORD  = '';
    //PIN       = ''; //Shouldn't need this because you're an ultimate!
    MEMBER    = False;
    SEARCH_AREA : TBox = [169, 80, 349, 260];
    type State = (AUBURYWALK,TELEPORTING,LOCATEMINE,MINING,LOCATEPORTAL,ESSPORTAL,RUINSWALK,ENTERRUINS,
                  ALTARWALK,CRAFTING,EXITALTAR,ERROR);
    
    Var
      prevTask                                                 :State;
      quit                                                     :Boolean = False;
    //Location Checks
      aubury_Shop, ruins_Area, altar_Area, portal_Area         :TPointArray;
    //Walkers
      RSW, ESW, ASW                                            :TRSWalker;
    //TMSObjects
      aero_Ruins, aero_Altar, aero_Portal                      :TMSObject;
    //Paths
      path_Ruins, path_Aubury                                  :TPointArray;
    //Individual Tiles, not related to essence mine
      tile_Ruins, tile_Portal, tile_Altar, tile_Safe           :TPoint;
    //Misc Variables
      stateFails                                               :Integer;
    //Essence Mine Information Begins
      EssAreaOne, EssAreaTwo, EssAreaThree, EssAreaFour        :TPointArray;
      Mines                                                    :Array [0..16] of TPoint;
      EssPort                                                  :Array [0..16] of TPoint;
      EssTotalArea                                             :TPointArray;
    
    procedure declarePlayer();
    begin
      Me.Name   := USERNAME;
      Me.Pass   := PASSWORD;
      //Me.Pin  := PIN;
      Me.Member := MEMBER;
      Me.Active := True;
    end;
    
    procedure setupScript();
    begin
    //Location Checks
      aubury_Shop :=  [[4815, 2829], [4823, 2830], [4832, 2840],
                      [4824, 2854], [4816, 2854], [4808, 2847], [4806, 2842],
                      [4815, 2839]];
      ruins_Area  :=  [[5020, 2544], [5019, 2571], [5044, 2570], [5045, 2547]];
      altar_Area  :=  [[776, 198], [774, 218], [809, 222], [808, 200]];
      portal_Area :=  [[769, 241], [769, 258], [789, 258], [791, 238]];
    //Essence Location Checks
      EssAreaOne  :=  [[127, 123], [134, 359], [366, 365], [361, 133]];
      EssAreaTwo  :=  [[419, 127], [419, 370], [656, 374], [654, 128]];
      EssAreaThree:=  [[122, 398], [125, 627], [370, 634], [369, 397]];
      EssAreaFour :=  [[415, 399], [652, 392], [655, 625], [413, 633]];
    
      Mines[0]    :=  Point(172,175); Mines[1]    :=  Point(329,163);
      Mines[2]    :=  Point(174,323); Mines[3]    :=  Point(333,319);
      Mines[4]    :=  Point(444,181); Mines[5]    :=  Point(611,175);
      Mines[6]    :=  Point(460,336); Mines[7]    :=  Point(615,321);
      Mines[8]    :=  Point(607,433); Mines[9]    :=  Point(607,433);
      Mines[10]   :=  Point(619,586); Mines[11]   :=  Point(464,593);
      Mines[12]   :=  Point(341,582); Mines[13]   :=  Point(329,440);
      Mines[14]   :=  Point(176,441); Mines[15]   :=  Point(178,598);
    (*  Wow So Fancy, Nice Declarations Barr, keep up the good work, Love Obama  *)
      EssPort[0]    :=  Point(150,177); EssPort[1]    :=  Point(335,156);
      EssPort[2]    :=  Point(164,318); EssPort[3]    :=  Point(336,322); //AREA ONE
    
      EssPort[4]    :=  Point(441,185); EssPort[5]    :=  Point(630,172);
      EssPort[6]    :=  Point(443,346); EssPort[7]    :=  Point(641,327); //AREA TWO //
    
      EssPort[8]    :=  Point(169,425); EssPort[9]    :=  Point(322,414);
      EssPort[10]   :=  Point(173,613); EssPort[11]   :=  Point(346,612); //AREA THREE //
    
      EssPort[12]   :=  Point(343,601); EssPort[13]   :=  Point(175,596);
      EssPort[14]   :=  Point(165,429); EssPort[15]   :=  Point(318,419); //AREA FOUR
    
      EssTotalArea:= [[126, 123], [125, 641], [657, 635], [670, 130]];
    //Misc
      stateFails  := 0;
    
    //Tiles
      tile_Ruins  :=  [5028, 2556];
      tile_Portal :=  [779, 250];
      tile_Altar  :=  [790, 208];
      tile_Safe   :=  [4820, 2770];
    //Walkers
      RSW.init('WorldMap');
      RSW.minRunEnergy  := 50;
      RSW.walkStyle     := wsSPS;
    
      ESW.init('EssenceMine');
      ESW.minRunEnergy  := 50;
      ESW.walkStyle     := wsSps;
    
      ASW.init('RunecraftingAltars');
      ASW.minRunEnergy  := 50;
      ASW.walkStyle     := wsSps;
    //TMSObjects
      aero_Ruins.create('Ruins', ['Enter','ruins'], [createCol(4411983, 19, 0.88, 0.40)]);
      aero_Altar.create('Altar', ['Craft-rune','ft-ru','ne Al','Altar'], [createCol(4213577, 25, 0.79, 0.22)], 130, 120, 50);
      aero_Portal.create('Portal', ['Use P','e Po','Portal'], [createCol(8046544, 21, 0.09, 1.37)], 40, 40, 20);
    //Paths
      path_Ruins  :=  [[4821, 2859], [4832, 2855], [4838, 2845], [4840, 2832], [4840, 2818],
                       [4846, 2809], [4850, 2798], [4858, 2785], [4866, 2777], [4872, 2763],
                       [4873, 2745], [4880, 2733], [4896, 2731], [4914, 2736],
                       [4926, 2735], [4936, 2732], [4946, 2728], [4955, 2708], [4954, 2692],
                       [4953, 2666], [4960, 2651], [4959, 2636], [4960, 2618], [4976, 2604],
                       [4991, 2601], [5007, 2598], [5013, 2589], [5014, 2576],
                       [5021, 2570], [5023, 2565]];
    
      path_Aubury :=  [[5022, 2567], [5008, 2575], [4997, 2584], [4989, 2599], [4980, 2608],
                       [4962, 2617], [4956, 2629], [4955, 2645], [4954, 2669], [4953, 2686],
                       [4953, 2701], [4950, 2716], [4942, 2731], [4929, 2737],
                       [4915, 2738], [4901, 2737], [4872, 2743], [4870, 2752], [4868, 2762],
                       [4866, 2782], [4857, 2792], [4846, 2804], [4842, 2815], [4840, 2828],
                       [4837, 2846], [4823, 2860], [4818, 2849]];
                       //Could've just copied and inverted the path, but there are plans to have multiple
                       //paths in the future
    end;
    procedure releaseAllItems();
    begin
    //future update will include DTMs may as well have a function now
      RSW.Free();
      ESW.Free();
      ASW.Free();
    end;
    
    function PixelShiftTPA(Poll: Int32): TPointArray; //Olly wrote this to help me find the portals
    var
      bmpBefore, bmpAfter, X, Y, W, H: Int32;
    begin
      bmpBefore := BitmapFromClient(SEARCH_AREA.X1, SEARCH_AREA.Y1, SEARCH_AREA.X2, SEARCH_AREA.Y2);
      Wait(Poll);
      bmpAfter := BitmapFromClient(SEARCH_AREA.X1, SEARCH_AREA.Y1, SEARCH_AREA.X2, SEARCH_AREA.Y2);
      GetBitmapSize(bmpAfter, W, H);
    
      for X := 0 to W - 1 do
        for Y := 0 to H - 1 do
          if (FastGetPixel(bmpBefore, X, Y) <> FastGetPixel(bmpAfter, X, Y)) then
            Result := Result + TPoint([X, Y]);
    
      OffsetTPA(Result, [SEARCH_AREA.X1, SEARCH_AREA.Y1]);
    
      FreeBitmap(bmpBefore);
      FreeBitmap(bmpAfter);
    end;
    
    function IsPointInPolygon(A : TPoint; APolygon: array of TPoint): Boolean; //Markus92
    var
      xnew, ynew: Cardinal;
      xold,yold: Cardinal;
      x1,y1: Cardinal;
      x2,y2: Cardinal;
      i, npoints: Integer;
      inside: Integer = 0;
    begin
      Result := False;
      npoints := Length(APolygon);
      if (npoints < 3) then Exit;
      xold := APolygon[npoints-1].X;
      yold := APolygon[npoints-1].Y;
      for i := 0 to npoints - 1 do
      begin
        xnew := APolygon[i].X;
        ynew := APolygon[i].Y;
        if (xnew > xold) then
        begin
          x1:=xold;
          x2:=xnew;
          y1:=yold;
          y2:=ynew;
        end
        else
        begin
          x1:=xnew;
          x2:=xold;
          y1:=ynew;
          y2:=yold;
        end;
        if (((xnew < A.X) = (A.X <= xold))         // edge "open" at left end
          and ((A.Y-y1)*(x2-x1) < (y2-y1)*(A.X-x1))) then
        begin
          inside := not inside;
        end;
        xold:=xnew;
        yold:=ynew;
      end;
      Result := inside <> 0;
    end;
    
    function MiddlesTPA(atpa : TPointArrayArray) : TPointArray;  //Markus92
    var
      i : integer;
    begin
      setlength(result, length(atpa));
      for i := 0 to high(atpa) do
        result[i] := MiddleTPA(atpa[i]);
    end;
    
    function randomsCheck() : Boolean;  //AeroAIORunecrafter_Lite
    begin
      if not isLoggedIn() then Exit(False);
      if levelUpEx(False) then Exit(True);
      if continueChat(False) then Exit(True);
    
      if getHealthPercent() <= 20 then
      begin
        quit  := True;
        WriteLn('Nearly dead, logged off to protect inventory');
      end;
    
      result  := waitEx(50);
    end;
    
    function walking(Where : String) : Boolean; //Borrowed setup for this from aerolib runecrafter
    var                                         //Very excellent setup
      P, mm : TPoint;                           //I have pretty much taken it from his script
    begin                                       //and put my own information in
      if not isLoggedIn() then Exit();          //Thanks to AeroLib Creator Flight for this
      randomsCheck();                           //great walking setup, hope you dont mind
    
      setCompass('N');
      setAngle(ANGLE_HIGH);
    
      case Where of
        'Aubury':
        begin
          writeln('Walking to Aubury');
          RSW.WalkPath(path_Aubury);
          //RSW.blindWalk(Point(4815, 2839));
          result := RSW.WalkPath(path_Aubury);
          if not result then
          begin
            RSW.blindWalk(tile_Safe); //Takes us to the safespot in the bank and will log out
            quit := True;
            writeLn('Not sure what happened, walking to bank and logging off.');
            Me.Active := False;
            Exit;
          end;
        end;
    
        'Ruins':
        begin
          writeln('Walking to Ruins');
          RSW.WalkPath(path_Ruins);
          FFlag(10);
          result := RSW.WalkPath(path_Ruins);
          if not result then
          begin
            result := RSW.blindWalk(tile_Ruins);
          end;
        end;
        'Altar':
        begin
          P := ASW.GetMyPos();
          if ASW.PointToMM(P, tile_Altar, mm) then
          begin
            writeln('Altar Tile is on minimap, walking there');
            mouse(mm, 3, 3, MOUSE_LEFT);
            FFLag(0);
            result := True;
          end else
            ASW.blindWalk(tile_Altar);
            result := True;
        end;
        'Altar_Portal':
        begin
          P:= ASW.GetMyPos();
          if ASW.PointToMM(P, tile_Portal, mm) then
          begin
            writeln('We see the portal tile on minimap, walking');
            mouse(mm, 3, 3, MOUSE_LEFT);
            result := True;
          end else
            result := ASW.blindWalk(tile_Altar);
        end;
        //Add in Essence Mine Walk handling here
      end;
    
      while isPlayerWalking() do
        waitEx(50);
    end;
    
    function craftRunes() : Boolean;  //Another method I borrowed and swapped information inside
    var                               //Thanks to Flight, AeroAIORunecrafter
      P       : TPoint;
      i, tmp  : Integer;
    begin
      if not isLoggedIn() then Exit();
      while isPlayerWalking() do
        waitEx(50);
      //Don't check for full inventory here, an Ultimates inventory is always full
    
      if not isUptextMulti(['Craft-rune', 'ft-ru', 'ne AL', 'Altar']) then
      begin
        setCompass('N');
        setAngle(ANGLE_HIGH);
        for i := 1 to 3 do
        begin                          //In original verison of this script, I had not used
          if aero_Altar.find(P) then   //Aero's find function because I thought it unreliable
            break;                     //After some testing it seems Aero's function and the
          if (i = 3) then              //original search function preformed the same
            if not aero_Altar.find(P) then
            begin
              walking('Altar'); //Didn't find it in 3 tries, maybe we aren't where we think we are?
              Exit;
            end;
        end;
      end;
    
      if not isUptextMulti(['Craft-rune','ft-ru','ne Al','Altar']) then Exit();
      writeln('Found UpText, Clicking On Altar');
      fastClick(MOUSE_LEFT);
      if not didRedClick() then Exit();
      Result := True;
    
      case randomRange(1, 3) of
      1,2 : mouseBox(AREA_MM, MOUSE_MOVE);
      end;
    
      if RBoolEx(4) then
      begin
        hoverSkill(SKILL_RUNECRAFTING, false);   //We arent only training runecrafting
        waitEx(100);                             //An Ironman would want to check all the skills
        hoverSkill(SKILL_MINING, false);         //being trained
      end else
        waitEx(randomRange(1700, 2100));
    
      writeln('Runes crafted, making our way out');
      walking('Altar_Portal');
    
      waitFunc(@isPlayerWalking, 70, 2000); //Recently due to AeroAIORunecrafter, I learned about
                                            //Pascal and function pointers
      while isPlayerWalking() do
        waitEx(50);
    
    
    end;
    
    function findRuins() : Boolean; //Based On Markus92's, most of the code is my own
    var
      P, pnt, mm         : TPoint;
      TPA                : TPointArray;
      TPA2D              : T2DPointArray;
      i                  : Integer;
    label
      Search;
    
    begin
      if not isLoggedIn() then Exit;
      while isPlayerWalking() do
        waitEx(50);
    
                         //Areo's find function was out preformed by this, I dont know why
      Search:            //Could be because of outdated colors in the AIO script, but not likely
      for i := 0 to 3 do //because I tried both, this gets the ruins on first try.
      begin
        if not (FindColorsTolerance(TPA, 4213320, MSX1, MSY1, MSX2, MSY2, 15)) then
        begin
          writeln('Couldnt find main color for ruins, trying back up');
          if not (FindColorsTolerance(TPA, 4212042, MSX1, MSY1, MSX2, MSY2, 15)) then
          begin
            writeln('Backup color also failed, perhaps not in correct location');
            walking('Ruins');
            waitEx(50);
            GoTo Search;
          end;
        end;
      end;
    
      writeln('Potentially found Ruins');
    
      TPA2D :=  SplitTPA(TPA, 10);
      SortATPASize(TPA2D, True);
    
      for i := 0 to Min(10, High(TPA2D)) do
      begin
        if (Length(TPA2D[i]) < 10) then Continue;
        pnt := MiddleTPA(TPA2D[i]);
        humanMMouse(pnt, 3, 3);
        if (isUptextMulti(['Enter Mysterious ruins', 'ter Myster'])) then
        begin
          fastClick(MOUSE_LEFT);
          Result := True;
          break;
        end;
      end;
    
      if not (IsPointInPolygon(ASW.GetMyPos(), altar_Area)) then WaitEx(randomRange(300, 800));
      writeln('Walking to Earth Altar');
      walking('Altar');
    
    end;
    
    function exitPortal() : Boolean;
    var
      P   : TPoint;
      i   : Integer;
    label
      Search;
    begin
      if not isLoggedIn() then Exit;
      if not pointsInDist(ASW.GetMyPos(), tile_Portal, 15) then
        walking('Altar_Portal');
    
      Search:
      setCompass('N');
      for i := 0 to 3 do
      begin
        if aero_Portal.find(P) then
          break;
    
        if (i = 3) then
          if not aero_Portal.find(P) then
          begin
            walking('Altar_Portal');
            Exit;
          end;
      end;
    
      writeln('found portal');
    
      fastClick(MOUSE_LEFT);
      if not didRedClick() then
      begin
        waitEx(randomRange(100, 350));
        GoTo Search;
      end;
      Result := True;
      waitFunc(@isPlayerWalking, 70, 1000);
      while isPlayerWalking() do
        waitEx(50);
    
      if not IsPointInPolygon(RSW.GetMyPos(), altar_Area) then waitEx(randomRange(100, 350));
    
      walking('Aubury');
    end;
    
    function findAubury() : Boolean;
    var
      I, T, cts: Integer;      //Decided it will search for Aubury until it finds it
      P: TPoint;               //We just to search if we fail, this is because Aubury
      PA: TPointArray;         //must be wearing nikes
      aPA: T2DPointArray;
      Middles : TPointArray;
    label
      Search;
    begin
    
      if not isLoggedIn() then Exit;
      if not (IsPointInPolygon(RSW.GetMyPos(), aubury_Shop)) then walking('Aubury');
    
      Search:
      for i := 0 to 3 do
      begin
        if not (FindColorsTolerance(PA, 1686228, MSX1, MSY1, MSX2, MSY2, 11)) then
        begin
          if not (IsPointInPolygon(RSW.GetMyPos(), aubury_Shop)) then
          begin
            quit := True;
            writeln('We cant find Aubury, and we arent in the shop! Panic! Quitting');
            Me.Active := False;
            Exit;
          end;
        end;
      end;
    
      aPA := SplitTPA(PA, 5);
      Middles := MiddlesTPA(aPA);
      SortTPAFrom(Middles, MSCP);
    
      for i := 0 to min(4, High(Middles)) do
      begin
        humanMMouse(Middles[i], 3, 3);
        if (isUptextMulti(['lk-To Au', 'Talk-To A', 'To Aub', 'o Aubur', 'Aubury'])) then
        begin
          fastClick(MOUSE_RIGHT);
          chooseOptionMulti(['elep', 'ort', 'Tel', 'ort Aubury']);
          if not didRedClick() then GoTo Search;
          result := True;
          writeln('We have teleported with Aubury, We should be in the mines now');
          //if we red clicked, then we should wait to make sure we are in the mines
          wait(randomRange(1000, 1500));
          break;
        end;
      end;
    //we should be in the mine at this point
    end;
    
    function mineLocator()  : Boolean;
    var
      i, mine       : Int32;
      P, MM         : TPoint;
    begin
      if not isLoggedIn() then Exit;
    
      while isPlayerWalking() do
        waitEx(50);
    
      wait(randomRange(850,1500));
    
      P := ESW.GetMyPos();
      mine  := 0;
    
      for i:=1 to 15 do
      begin
        if Distance(P.X, P.Y, Mines[i].X, Mines[i].Y) < Distance(P.X, P.Y, Mines[mine].X, Mines[mine].Y) then
          mine := i;
      end;
    
      if ESW.PointToMM(P, Mines[mine], MM) then
      begin
        waitEx(50);
        writeln('Rock Location on minimap, clicking');
        mouse(MM, 3, 3, MOUSE_LEFT);
        FFLag(0);
        Result := True;
      end else
      begin
        ESW.blindWalk(Mines[mine]);
        writeln('not on minimap, blind walking');
        Result := True;
      end;
    
    end;
    
    function findEssenceRock() : Boolean; //Slackyy came up with an excellent idea to find the essence
    var                                   //using the planks surrounding the essence rock
      point                   : TPoint;   //I've merged my code and his into this function
      TPAPlanks, TPAEssence   : TPointArray;
      ATPA                    : T2DPointArray;
      i                       : Integer;
    label
      Search, Retry
    begin
    
      if not isLoggedIn() then Exit;
      if isInvFull() then Exit;
      while isPlayerWalking() do
        waitEx(50);
    
      Search:
      if not (FindColorsTolerance(TPAPlanks, 3623763, MSX1, MSY1, MSX2, MSY2, 19)) then
      begin
        writeln('couldnt locate the planks color trying again');
        goto Search;
      end;
    
      if not (FindColorsTolerance(TPAEssence, 6184808, MSX1, MSY1, MSX2, MSY2, 30)) then
      begin
        writeln('couldnt locate essence rock color trying again');
        goto Search;
      end;
    
      ATPA := ClusterTPA(TPAEssence, 1);
      point:= MiddleTPA(TPAPlanks);
      SortATPAFromMidPoint(ATPA, point);
    
      for i to Min(10, High(ATPA)) do
      begin
        if (Length(ATPA[i]) > 4900) then Continue;
        Retry:
        point := MiddleTPA(ATPA[i]);
        humanMMouse(point, 3, 3);
        if (isUptextMulti(['Mine', 'une Ess', 'ence', 'Mine Ess'])) then
        begin
          fastClick(MOUSE_LEFT);
          if not didRedClick() then GoTo Search;
          waitEx(randomRange(100,350));
          if not isAnimating(IntToBox(169, 80, 349, 260), 500, 450) then GoTo Retry;
          break;
        end;
      end;
    
      case randomRange(1,5) of
        1,2   : boredHuman();
        3,4   : waitEx(50);
      end;
      MMouseOffClient('Rand');
    
      while not isInvFull() do
      begin
        clickContinueEx(true);
        writeln('waiting to fill invent');
      end;
    
    
      if isInvFull() then Result := True;
    
    end;
    
    function LocatePort() :Boolean;
    var
      i, port       : Int32;
      P, MM         : TPoint;
    begin
      if not isLoggedIn() then Exit;
    
      while isPlayerWalking() do
        waitEx(50);
    
      setCompass('N');
      setAngle(ANGLE_HIGH);
    
      port := 0;
      P := ESW.GetMyPos();
    
      for i:=1 to 15 do
      begin
        if Distance(P.X, P.Y, EssPort[i].X, EssPort[i].Y)
                            < Distance(P.X, P.Y, EssPort[port].X, EssPort[port].Y) then
          port := i;
      end;
    
      if ESW.PointToMM(P, EssPort[port], MM) then
      begin
        waitEx(50);
        writeln('portal Location on minimap, clicking');
        mouse(MM, 3, 3, MOUSE_LEFT);
        FFLag(0);
        Result := True;
      end else
      begin
        ESW.blindWalk(EssPort[port]);
        writeln('not on minimap, blind walking');
        Result := True;
      end;
    end;
    
    function EssenceExit()  : Boolean;//Olly wrote this portal finder
    var                               //all his work
      ATPA: T2DPointArray;
      TPA, PortalPoints: TPointArray;
      Mat: T2DIntegerArray;
      point : TPoint;
      l: Integer;
      b: TBox;
      X, Y, W, H, i, BMP: Int32;
    
    label
      Retry
    begin
    
      wait(randomRange(500,1500));
      if not isLoggedIn() then Exit;
    
      while isPlayerWalking() do
        waitEx(50);
      Retry:
      for 1 to 3 do
        ATPA := ATPA + PixelShiftTPA(100);
      TPA := MergeATPA(ATPA);
    
      // Getting duplicate points
      b := GetTPABounds(TPA);
      SetLength(Mat, (b.Y2 - b.Y1) + 1, (b.X2 - b.X1) + 1);
      for i := 0 to High(TPA) do
        Mat[TPA[i].Y - b.Y1, TPA[i].X - b.X1] += 1;
    
      for Y := 0 to High(Mat) do
        for X := 0 to High(Mat[0]) do
          if (Mat[Y][X] >= 2) then // duplicate point twice.
            PortalPoints := PortalPoints + TPoint([X + b.X1, Y + b.Y1]);
    
      ATPA := ClusterTPA(PortalPoints, 150);
      SortATPASize(ATPA, true);
      debugATPA(ATPA, '');
      for l:=0 to Min(10, High(ATPA)) do
      begin
        if (Length(ATPA[l]) < 150) then Continue;
        point := MiddleTPA(ATPA[l]);
        humanMMouse(point, 3, 3);
        if (isUptextMulti(['Use P','e Po','Portal'])) then
          waitEx(randomRange(100, 250));
          fastClick(MOUSE_LEFT);
          if not didRedClick() then GoTo Retry;
          result := True;
      end;
    
      //GetClientDimensions(W, H);
      //BMP := BitmapFromClient(0, 0, W-1, H-1);
      //DrawTPABitmap(BMP, PortalPoints, 255);
      //DisplayDebugImgWindow(W, H);
      //DrawBitmapDebugImg(BMP);
      //FreeBitmap(BMP);
    end;
    
    function getState() : State;
    var
      pos : TPoint;
    
    begin
      if not isLoggedIn() then Exit();
      result := ERROR;
    
      while isPlayerWalking() do
        waitEx(50);
    
      case isInvFull() of
        True:
        begin
          writeln('getting state with full invent');
          if  (IsPointInPolygon(RSW.GetMyPos(), aubury_Shop)) then
          begin
            writeln('getState() returning: RUINS WALK');
            Exit(RUINSWALK);
          end;
          if  (IsPointInPolygon(RSW.GetMyPos(), ruins_Area)) then
          begin
            writeln('getState() returning: ENTER RUINS');
            Exit(ENTERRUINS);
          end;
          if  (IsPointInPolygon(ASW.GetMyPos(), altar_Area))then
          begin
            writeln9('getState() Returning: CRAFTING');
            Exit(CRAFTING);
          end;
          if  (IsPointInPolygon(ASW.GetMyPos(), portal_Area)) then Exit(ALTARWALK);
          if  (IsPointInPolygon(ESW.GetMyPos(), EssTotalArea)) then Exit(LOCATEPORTAL);
          //If our invent is full and we don't match any of the above, we should
          //Go ahead and walk to the ruins
          writeln('Not in Shop Area, Not Near Ruins, and not in the altar, walking to Ruins');
          Exit(RUINSWALK);
        end;
    
        False:
        begin
          writeln('invent is empty, getstate reporting')
          if  (IsPointInPolygon(RSW.GetMyPos(), aubury_Shop)) then Exit(TELEPORTING);
          if  (IsPointInPolygon(RSW.GetMyPos(), ruins_Area)) then Exit(AUBURYWALK);
          if  (IsPointInPolygon(ASW.GetMyPos(), altar_Area)) then Exit(EXITALTAR);
          if  (IsPointInPolygon(ASW.GetMyPos(), portal_Area)) then Exit(EXITALTAR);
          if  (IsPointInPolygon(ESW.GetMyPos(), EssTotalArea)) then
          begin
            writeln('we think we are in essence area, trying to locate mine');
            Exit(LOCATEMINE);
          end;
          //if our invent isn't full and we dont match any of the above, we should
          //Go ahead and walk to Aubury
          writeln('Not in Shop Area, Not Near Ruins, and not in the altar, walking to Aubury');
          Exit(AUBURYWALK);
        end;
      end
    end;
    
    procedure scriptLoop(); //Taken from AeroAIORunecrafter, great setup for the FSM
    var                     //Thanks to Flight for the script setup and style
      curState    : State;
      P, E, A, mm : TPoint;
      i           : Integer;
    label
      L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11
    begin
      if not isLoggedIn() then Exit;
    
      while isPlayerWalking() do
        waitEx(50);
    
      curState := getState();
    
      if prevTask = curState then
      begin
        inc(stateFails);
      end else
        stateFails := 0;
    
      if stateFails >= 4 then
      begin
        quit := True;
        writeln('script keeps looping the same task, shutting down');
        Exit;
      end;
    
      prevTask := curState;
    
      case getState() of
        AUBURYWALK      : GOTO L1;
        TELEPORTING     : GOTO L2;
        LOCATEMINE      : GOTO L3;
        MINING          : GOTO L4;
        LOCATEPORTAL    : GOTO L5;
        ESSPORTAL       : GOTO L6;
        RUINSWALK       : GOTO L7;
        ENTERRUINS      : GOTO L8;
        ALTARWALK       : GOTO L9;
        CRAFTING        : GOTO L10;
        EXITALTAR       : GOTO L11;
        ERROR           :
        begin
          inc(stateFails);
          if stateFails >= 2 then
          begin
            quit := True;
            writeln('lost, check player then restart');
          end;
          P := RSW.GetMyPos();
          A := ASW.GetMyPos();
          E := ESW.GetMyPos();
    
          if isInvFull() then
          begin
            if (IsPointInPolygon(RSW.GetMyPos(), aubury_Shop)) then
            begin
              writeln('going to ruins full invent');
              //walking('Ruins');
              Exit;
            end;
    
            if (IsPointInPolygon(RSW.GetMyPos(), ruins_Area)) then
            begin
              writeln('enter ruins, full invent');
              findRuins();
              Exit;
            end;
    
            if (IsPointInPolygon(ASW.GetMyPos(), altar_Area)) then
            begin
              writeln('at altar, full invent');
              craftRunes();
              Exit;
            end;
    
            if (IsPointInPolygon(ASW.GetMyPos(), portal_Area)) then
            begin
              writeln('at earth portal, full invent');
              walking('Altar');
              Exit;
            end;
    
            //Add Essence Info
    
          end else //invent isn't full, where are we?
            if (IsPointInPolygon(RSW.GetMyPos(), ruins_Area)) then
            begin
              writeln('empty inv walk aubury');
              walking('Aubury');
              Exit;
            end;
    
            if (IsPointInPolygon(ASW.GetMyPos(), altar_Area)) then
            begin
              writeln('at altar, empty invent, walk portal');
              walking('Altar_Portal');
              Exit;
            end;
    
            if not (IsPointInPolygon(RSW.GetMyPos(), aubury_Shop)) then
              begin
                writeln('LOST -> EMPTY INVENTORY -> AUBURY WALK');
                walking('Aubury');
                Exit;
              end;
          Exit;
        end;
      end;
    
      L1://AUBURY WALK
      for i := 1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        Writeln('Entering AUBURY WALK STATE');
        if walking('Aubury') then break;
        if (i=2) then Exit;
      end;
    
      L2://TELEPORTING
      for i := 1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        writeln('Entering TELEPORTING STATE');
        if findAubury() then
        begin
          stateFails := 0;
          break;
        end;
        if (i=2) then Exit;
      end;
    
      L3://LOCATEMINE
      for i := 1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        Writeln('Entering LOCATEMINE STATE');
        if mineLocator() then break;
        if (i=2) then Exit;
      end;
    
      L4://MINING
      for i:=1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        writeln('Entering MINING STATE');
        if findEssenceRock() then break;
        if (i=2) then Exit;
      end;
    
      L5://LOCATEPORTAL
      for i:=1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        writeln('Entering LOCATE PORTAL STATE');
        if LocatePort() then break;
        if (i=2) then Exit;
      end;
    
      L6://ESSPORTAL
      for i:=1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        writeln('Entering ESSENCE EXIT STATE');
        if EssenceExit() then break;
        if (i=2) then Exit;
      end;
    
    
      L7://RUINS WALK
      for i := 1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        writeln('Entering RUINS WALK STATE');
        if walking('Ruins') then break;
        if (i=2) then Exit;
      end;
    
      L8://ENTER RUINS
      for i := 1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        writeln('Entering ENTER RUINS STATE');
        if findRuins() then
        begin
          stateFails := 0;
        end;
        if (i=2) then Exit;
      end;
    
      L9://ALTAR WALK
      for i := 1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        writeln('Entering ALTAR WALK STATE');
        if walking('Altar') then break;
        if (i=2) then Exit;
      end;
    
      L10://CRAFTING
      for i := 1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        writeln('Entering CRAFTING STATE');
        if craftRunes() then
        begin
          stateFails := 0;
        end;
        if (i=2) then Exit;
      end;
    
      L11://EXIT ALTAR
      for i := 1 to 2 do
      begin
        if not isLoggedIn() then Exit;
        randomsCheck();
        writeln('Entering EXIT ALTAR STATE');
        if exitPortal() then
        begin
          stateFails := 0;
        end;
        if (i=2) then Exit;
      end;
    end;
    
    begin
    //--------------Setup our script----------------\\
      declarePlayer();
      initAL();
      setupScript();
      AddOnTerminate('freeGlobals');
    
      loginPlayer(false);
    
      //fixGraphics();
    
      ClearDebug();
      //writeln(ESW.GetMyPos());
      //writeln(ASW.GetMyPos());
      //writeln(RSW.GetMyPos());
    //(*
    //--------------Loop Starts Here----------------\\
      Repeat
        if not quit then
          if not isLoggedIn then
            if loginPlayer(false) then
              begin
                clickNorth();
                setAngle(ANGLE_HIGH);
              end;
    
        while isLoggedIn() do
        begin
          if quit then break;
          randomsCheck();
    
          scriptLoop();
        end;
      until(quit or (not Me.Active));
      writeln('SCRIPT TERMINATED!');
      logoutPlayer();
      releaseAllItems();
    //*)
    end.
    If you have any criticisms about the script, the style, the bugs, please let me know.

    Thanks
    Last edited by Barr; 03-03-2017 at 10:01 AM.

  2. #2
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Pretty awesome for a first script! IIRC an essence miner was my first 'real' script that I made without copying a tutorial. Yours looks a lot better than mine did for sure. It took me wayyy too long to discover the power of pixelShift.
    Seems like you learned a lot, which is most important thing. Good luck on your next project!

  3. #3
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    This is impressive considering it's all color and being your first script. From the looks of this you put a lot of time into it, that's something to be proud of. Nicely done Barr! If I'm allowed time later next week, after my move, I might be able to assist with some of the issues you're having.

    But good job on this, it's really nice to see some new talent and I myself am quite the Runecrafting fan so it does extra for me.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  4. #4
    Join Date
    Mar 2013
    Posts
    1,010
    Mentioned
    35 Post(s)
    Quoted
    620 Post(s)

    Default

    0/10 for no accountancy
    #slack4admin2016
    <slacky> I will build a wall
    <slacky> I will ban reflection and OGL hooking until we know what the hell is going on

  5. #5
    Join Date
    Dec 2011
    Posts
    39
    Mentioned
    0 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    Pretty awesome for a first script! IIRC an essence miner was my first 'real' script that I made without copying a tutorial. Yours looks a lot better than mine did for sure. It took me wayyy too long to discover the power of pixelShift.
    Seems like you learned a lot, which is most important thing. Good luck on your next project!
    This was my first ever for SRL, it was super tough to do it based on color alone, but I learned a lot of methods to search and i'll be using those in my next scripts

    Quote Originally Posted by Flight View Post
    This is impressive considering it's all color and being your first script. From the looks of this you put a lot of time into it, that's something to be proud of. Nicely done Barr! If I'm allowed time later next week, after my move, I might be able to assist with some of the issues you're having.

    But good job on this, it's really nice to see some new talent and I myself am quite the Runecrafting fan so it does extra for me.
    Thanks Flight, AeroLib is amazing and made this easier than what I imagine it could've been. I'm pretty sure the issues stem from the getState() function.

    Quote Originally Posted by Harrier View Post
    0/10 for no accountancy
    Real ironmen use a notepad and pencil to track their experience.

  6. #6
    Join Date
    Feb 2017
    Location
    The Netherlands
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default

    Not to be a dick or something, but what is the point in botting on an ironman ?
    Isn't the purpose of ironman to get the enjoyment of achieving every single thing in the game solely by yourself ?

  7. #7
    Join Date
    Apr 2013
    Posts
    680
    Mentioned
    13 Post(s)
    Quoted
    341 Post(s)

    Default

    Quote Originally Posted by uvlees View Post
    Not to be a dick or something, but what is the point in botting on an ironman ?
    Isn't the purpose of ironman to get the enjoyment of achieving every single thing in the game solely by yourself ?
    I disagree.. botting an ironman all 99's is still an accomplishment - in all seriousness if my main get banned.. i will look to buy an account where the quests are completed.. i hate doing quests..

    coding and then seeing the end result.. (levels) is the only satisfying thing left for me.

    we play against the ban system not the game.

    <------------------>



  8. #8
    Join Date
    Sep 2014
    Posts
    447
    Mentioned
    10 Post(s)
    Quoted
    203 Post(s)

    Default

    If anything, botting on an ironman would be more rewarding for me. I personally get enjoyment by overcoming the system. People bot for different reasons, but this is definitely a big one for me.

  9. #9
    Join Date
    Feb 2017
    Posts
    30
    Mentioned
    0 Post(s)
    Quoted
    12 Post(s)

    Default

    Does it matter where I start this script or will it find it's way around?

  10. #10
    Join Date
    Dec 2011
    Posts
    39
    Mentioned
    0 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Vaslaw View Post
    Does it matter where I start this script or will it find it's way around?
    this script is hella buggy man, I don't recommend you use it in this state. I'll be eventually re-releasing this.

  11. #11
    Join Date
    Mar 2016
    Location
    Canada
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Nice job on your script, I'll make a random ironman account just to test this out.

  12. #12
    Join Date
    Jul 2017
    Posts
    30
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default

    Are you still around to update?
    Last edited by Grendal; 07-23-2017 at 10:24 AM.

  13. #13
    Join Date
    Dec 2011
    Posts
    39
    Mentioned
    0 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Grendal View Post
    Are you still around to update?
    Still around mate, just won't be updating this, need to rewrite it completely from the ground up.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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