Results 1 to 18 of 18

Thread: MTA Enchanter script blog

  1. #1
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default MTA Enchanter script blog

    So, to maybe help push myself to actually finish a script(and to get help/ ideas along the way) I've decided to make a blog, to track my progress. I'll be making a fairly simple script, which is an MTA Enchanter. I've made one before(Although it was shitty, but whats new? ), as well as my AIO MTA script(But it was reflection). This time I plan on using the best techniques i can, and try not to be lazy with anything

    Aside from my basic script skeleton, I already basicly know how it's going to be set up.

    Simba Code:
    program Untitled;
    {$DEFINE SMART}
    {$I SRL/SRL.scar}

    procedure DeclarePlayers;
    begin
      //Disguise('Windows Live Messenger');

      HowManyPlayers:= 1;
      CurrentPlayer:= 0;
      NumberOfPlayers(HowManyPlayers);

      Smart_Server := 132;
      Smart_Members := false;
      Smart_Signed := true;
      Smart_SuperDetail := False;

               writeln('calling names');
      Players[0].Name := ''; // Username.
      Players[0].Pass := ''; // Password.
      Players[0].Nick := '';    // 2-4 letters of Username (that are not capital letters or numbers).
      Players[0].Pin  := '';
      Players[0].Active := True;
      end;

    procedure A_Debug(text: string);
    begin
        writeln('[' + thetime + '] ' + players[currentplayer].nick + ' ' + text);
    end;

    function NumPerHour(i : extended) : extended;
    begin
      result := (3600 * i) / (1 + ((GetTimeRunning) / 1000));
    end;

    begin
      SetupSRL;
    end.

    Script flow:
    Code:
    o Check if in arena, if not then enter
    o Find pizzaz points
    o Find Location
    o Find current bonus item
    o Check if dragonstones are out
     - If dragonstones, collect and start timer for next respawn
    o Collect certain amount of shape, determined on bonus item
    o Enchant shapes, and try to enchant the bonus items first
    o Find center
    o Deposit orbs
    o Repeat
    Ofcourse, any help/ suggestions would always be awesome

    March 13, 2012:
    To start the script off, I decided to make the location finding first.

    First I made a DDTM of the center area(I'll get pics later), without adding any autocolor or tolerance just yet:
    Simba Code:
    function CenterDDTM: Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..4] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      dtmMainPoint.x := 841;
      dtmMainPoint.y := 195;
      dtmMainPoint.AreaSize := 4;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := 262913;
      dtmMainPoint.Tolerance := 5;

      dtmSubPoints[0].x := 841;
      dtmSubPoints[0].y := 195;
      dtmSubPoints[0].AreaSize := 4;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := 262913;
      dtmSubPoints[0].Tolerance := 5;

      dtmSubPoints[1].x := 850;
      dtmSubPoints[1].y := 206;
      dtmSubPoints[1].AreaSize := 6;
      dtmSubPoints[1].AreaShape := 0;
      dtmSubPoints[1].Color := 15922409;
      dtmSubPoints[1].Tolerance := 0;

      dtmSubPoints[2].x := 824;
      dtmSubPoints[2].y := 177;
      dtmSubPoints[2].AreaSize := 6;
      dtmSubPoints[2].AreaShape := 0;
      dtmSubPoints[2].Color := 262913;
      dtmSubPoints[2].Tolerance := 0;

      dtmSubPoints[3].x := 831;
      dtmSubPoints[3].y := 204;
      dtmSubPoints[3].AreaSize := 5;
      dtmSubPoints[3].AreaShape := 0;
      dtmSubPoints[3].Color := 15922409;
      dtmSubPoints[3].Tolerance := 0;

      dtmSubPoints[4].x := 851;
      dtmSubPoints[4].y := 190;
      dtmSubPoints[4].AreaSize := 5;
      dtmSubPoints[4].AreaShape := 0;
      dtmSubPoints[4].Color := 15922409;
      dtmSubPoints[4].Tolerance := 0;

      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;

    Then I made a simple grid-finding function
    Simba Code:
    (*
    MMToGrid
    ~~~~~~~~

    .. code-block:: pascal

        function MMToGrid(TP : TPoint) : Integer;

    Converts a point on the minimap to a cartesian quadrant

    .. note::

        by Awkwardsaw
        Last modified: 3/13/2012

    Example:

    .. code-block:: pascal

        case MMToGrid(DTMPos) of
          1 : loc := writeln('QI');
          2 : loc := writeln('QII');
          3 : loc := writeln('QIII');
          4 : loc := writeln('QIV');
        end;
    *)

    function MMToGrid(TP : TPoint) : Integer;
    var
      TBA : TBoxArray;
      i : Integer;
    begin
      result := -1;

      TBA := [PointToBox(point(mmcx, mmy1), point(mmx2, mmcy)),  //QI
              PointToBox(point(mmx1, mmy1), point(mmcx, mmcy)),  //QII
              PointToBox(point(mmx1, mmcy), point(mmcx, mmy2)),  //QIII
              PointToBox(point(mmcx, mmcy), point(mmx2, mmy2))]  //QIV

      if not rs_OnMinimap(tp.x, tp.y) then
      begin
        a_debug('MMToGrid - point not on map');
        exit;
      end;

      if Distance(tp.x, tp.y, mmcx, mmcy) < 15 then //if center is on ms, exit
      begin
        result := 5;
        exit;
      end;

      for i := 0 to 3 do
        if PointInBox(TP, TBA[i]) then
        begin
          result := i + 1;
          break;
        end;
    end;

    I need to go do some arrands now, so I'll probably be done for the day
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  2. #2
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    3/14/12
    Today I replaced the DDTM with a TPA in order to find the center of the arena. I also made the bonus shape detector

    current functions:
    Simba Code:
    function GetBonusTPA : integer; //returns ID of bonus shape
    var
      ColArr : TIntegerArray;
      i : integer;
      tpa : TPointArray;
    begin
      setlength(ColArr, 4);
      result := -1;
      ColArr[CylinderID] := 1342481;  //Chose to do it longways for better reading
      ColArr[PentID] := 1714108;
      ColArr[CubeID] := 2012884;
      ColArr[IcoID] := 12802134;
      for i := 0 to 3 do
        if FindColors(tpa, Colarr[i], 453, 274, 500, 323) then
        begin
          result := i;
          writeln('Bonus Shape Result: ' + inttostr(result));
          break;
        end;
    end;


    function InArena : Boolean; //returns true if in arena
    var
      tpa : TPointArray;
    begin
      result := GetBonusTPA >= 0;
      if not result then writeln('Not in arena');
    end;


    function FindCenterTPA : TPoint; //finds TPoint of the center arena(gray area)
    var
      i : integer;
      TPA : TPointArray;
      atpa : T2dPointArray;
    begin
      SetColorToleranceSpeed(3);
      if not FindColorsTolerance(TPA, 9342865, mmx1, mmy1, mmx2, mmy2, 4) then
       begin
         result := point(-100, -100);
         exit;
       end;
      atpa := TPAtoATPAEx(TPA, 18, 19);
      if length(atpa) < 0 then
      begin
        writeln('Cannot find center tpa');
        result := point(-100, -100);
        exit;
      end;
      SortATPASize(atpa, true);
      result := MiddleTPA(atpa[0]);
    end;

    function MMToGrid(TP : TPoint) : Integer; //converts TPoint to grid quadrant
    var
      TBA : TBoxArray;
      i : Integer;
    begin
      result := -1;

      TBA := [PointToBox(point(mmcx, mmy1), point(mmx2, mmcy)),  //QI
              PointToBox(point(mmx1, mmy1), point(mmcx, mmcy)),  //QII
              PointToBox(point(mmx1, mmcy), point(mmcx, mmy2)),  //QIII
              PointToBox(point(mmcx, mmcy), point(mmx2, mmy2))]  //QIV

      if not rs_OnMinimap(tp.x, tp.y) then
      begin
        a_debug('MMToGrid - point not on map');
        exit;
      end;

      if Distance(tp.x, tp.y, mmcx, mmcy) < 9 then //if center is on ms, exit
      begin
        result := 5;
        exit;
      end;

      for i := 0 to 3 do
        if PointInBox(TP, TBA[i]) then
        begin
          result := i + 1;
          break;
        end;
    end;

    It's not much, or not even very fancy, but I'm starting to get the hang of things again

    Next step is to find my pizazz points, I'll have to use bitmap masks for those, since I don't think it's a normal font
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  3. #3
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    3/19/12

    Today I found out that the pizzaz points uses SkillsChars, so that saved a lot of hassle

    Also, I made an SPS map of the arena, to replace the grid system, also saving a lot of pain lol. Next, I'm going to finish the navigating, then I'll probably work on dragonstone collecting
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  4. #4
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Awesome, Awkwardsaw. I enjoy reading this and seeing your script coming together.
    Keep at it!
    Simba Code:
    (* Main *)

    repeat
      WriteLn('I am an idiot!');
    until(False);

  5. #5
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Thanks, any type of feed back would be awesome,

    And here's my relocating system. I took my old reflection path walker and changed it for SPS

    Simba Code:
    function A_WalkPath(point : TPoint) : Boolean;
    var
      i, c : Integer;
      tp, ntp : TPoint;
      Path : TPointArray;
    begin
      path := R_GetWindPath(point);
      for i := 0 to high(path) do
      begin
        tp := SPS_PosToMM(path[i]);
        if i < high(path) then
        begin
          ntp := SPS_PosToMM(path[i + 1]);
          if rs_OnMinimap(ntp.x, ntp.y) then
            continue;
        end;
        if not rs_OnMinimap(tp.x, tp.y) then
        begin
          a_debug('tile not on map: ' + inttostr(i));
          continue;
        end;
        mouse(tp.x, tp.y, 5, 5, true);
        if i < high(path) then
        begin
          ntp := SPS_PosToMM(path[i + 1]);
          while not rs_OnMinimap(ntp.x, ntp.y) do
          begin
            ntp := SPS_PosToMM(path[i + 1]);
            wait(100 + random(50));
            findnormalrandoms;
            inc(c);
            if c > 300 then
            begin
              result := false;
              exit;
            end;
            if not ismoving then continue;
          end;
        end else
          flag;
        end;
      result := true;
      WaitFunc(@flag, 50, 6000);
    end;

    Function Relocate(Whereto : TPoint) : Boolean;
    var
      CurrPos, center : TPoint;
    begin
      result := false;
      CurrPos := SPS_GetMyPos;

      if DistPoint(CurrPos, Whereto) < 5 then
      begin
        result := true;
        exit;
      end;

      if SPS_PosOnMM(Whereto) then
        if not SPS_WalkToPos(Whereto) then
        begin
          a_debug('Failed to walk to position: ' + tostr(Whereto));
          exit;
        end;

      if not A_WalkPath(WhereTo) then
      begin
        A_Debug('Failed to wind walk, attempting to walk to center and retry');

        center := FindCenterTPA;
        if not center.x > -1 then
        begin
          a_debug('Cannot find center');
          exit;
        end;

        mouse(center.x, center.y, 3, 3, true);
        flag;
        wait(200 + random(200));

        if not A_WalkPath(Whereto) then
        begin
          a_debug('Cannot get to position');
          exit;
        end;
      end;

      result := true;
    end;

    Function RandomPointInBox(box : TBox) : TPoint;
    begin
      Result.X := RandomRange(box.X1, box.X2);
      Result.Y := RandomRange(box.Y1, box.Y2);
    end;

    Function WalkToBonus : Boolean;
    var
      BonusItem : integer;
      TempSPSCoord, MyPos : TPoint;
    begin
      BonusItem := GetBonusTPA;

      TempSPSCoord := RandomPointInBox(SPSAreas[BonusItem])

      if not Relocate(TempSPSCoord) then
      begin
        a_debug('Failed to walk to bonus item: ' + inttostr(BonusItem));
        exit;
      end;

      MyPos := SPS_GetMyPos;
      result := PointInBox(MyPos, SPSAreas[BonusItem]);

      if not result then
        a_debug('Failed to walk to bonus item, result false');
    end;
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  6. #6
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I notice where you changed it over, I think. Your functions after A_WalkPath are spaced better within them, if that makes sense.

    Simba Code:
    if not ismoving then continue;

    Where you have that in A_WalkPath, wouldn't you think that it could cause problems later on? You should have something like this to help prevent any possible 'Stucks':
    Simba Code:
    procedure Example();
    var
      T, maxT: Integer;
    begin
      maxT := (RandomRange(5000, 7000));

      MarkTime(T);
      repeat
        if (TimeFromMark(T) >= maxT) then
        begin
          // Time-out stuff here
        end;

        Wait(RandomRange(750, 1000));
      until(False);
    end;

    That way you could have it time-out after X amount of seconds if it doesn't detect that it is moving. If it is moving before it times out, it simply breaks out of the repeat .. until. You could also do a time-out fail-safe type thing of where it will check if it is close to the desired destination or not to assume it walked and the script simply didn't pick up on the movement.

    Or do you already do that? My bad if you do, haha. It looks like you do but I just wanted to make sure, is all. Great update though! Any ETA on when you'd have a working version?
    Last edited by RISK; 03-22-2012 at 05:12 AM.
    Simba Code:
    (* Main *)

    repeat
      WriteLn('I am an idiot!');
    until(False);

  7. #7
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Honestly, I don't know why I even have that part in there at the end of the loop anyways

    So for today, all I did was use my object finder to enter the arena from the main building, and to sort of setup the player

    Simba Code:
    function A_FindObj(color, tol, count : integer; uptext : string; left : boolean): Boolean;
    var
      X, Y, A, M, curCTS: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;

    begin
      Result := False;
      if not LoggedIn then exit;
      curCTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        if not FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, MSX1, MSY1, MSX2, MSY2, tol) then
        begin
          ColorToleranceSpeed(1);
          a_debug('Cannot find object', Priority_High);
          exit;
        end;
        ColorToleranceSpeed(1);
        ATPA := TPAtoATPAEx(TPA, 10, 10);
        M := High(ATPA);
        for A := 0 to M do
        begin
          if Length(ATPA[A]) < count then
            continue;
          if MiddleTPAEx(ATPA[A], X, Y) then
          begin
            MMouse(X, Y, 6, 6);
            Wait(100 + Random(50));
            if WaitUptext(uptext, 100) then
            begin
              GetMousePos(X, Y);
              Mouse(X, Y, 0, 0, left);
              Result := True;
              ColorToleranceSpeed(curCTS);
              Exit;
            end;
          end;
        end;
      ColorToleranceSpeed(curCTS);
    end;

    Function EnterArena : boolean;
    var
      x, y : integer;
    begin
      if InArena then
      begin
        result := true;
        exit;
      end;

      if not A_FindObj(10068126, 5, 15, 'anters Tele', true) then
      begin
        if not FindSymbol(x, y, 'minigame') then
        begin
          A_Debug('Cannot enter arena. failed to find minigame symbol', Priority_High);
          exit;
        end;
        mouse(x, y, 4, 4, true);
        flag;
        wait(300 + random(500));
        if not A_FindObj(10068126, 5, 15, 'anters Tele', true) then
        begin
          A_Debug('Cannot enter arena. failed to find teleporter', Priority_High);
          exit;
        end;
      end;


      result := WaitFunc(@InArena, 50, 25000);

      if not result then
        A_Debug('Cannot enter arena. Timed out', Priority_High);
    end;

    Function SetUpPlayer : boolean;
    var
      hat, x, y: integer;
    begin
      Hat := DTMFromString('78DA632C676660B0646440058C482490AE02A' +
           'A3127A0A61BA8C68E809A7EA01A37026ADA816AFC09A8A901AAF1' +
           '22A0A611A8C69508F710B00B00EA720678');
      if not InArena then
      begin
        GameTab(tab_Equip);
        if not FindDTM(Hat, x, y, mix1, miy1, mix2, miy2) then
        begin
          GameTab(tab_Inv);
          if not FindDTM(Hat, x, y, mix1, miy1, mix2, miy2) then
          begin
            A_Debug('Cannot find pizzaz hat', Priority_High);
            FreeDTM(Hat);
            exit;
          end else
            Mouse(x, y, 6, 6, true);
        end;
      end;
      FreeDTM(Hat);

      totalCosmics := RuneAmount('inv','cosmic');

      gametab(tab_Magic);

      SetSpellMode(false, true, true, true);

      if not SpellAvailable(SpellCoords, 'lvl-' + players[0].strings[0] + ' enchant') then
      begin
        A_Debug('Spell is not available, make sure you are wielding correct staff', Priority_High);
        A_Debug('Or  have correct/ enough runes', Priority_High);
      end;
    end;
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  8. #8
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Good luck, How do you plan on doing the telekinetic? one the one when you have to use telegrab to move the statues.

  9. #9
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by akonowns View Post
    Good luck, How do you plan on doing the telekinetic? one the one when you have to use telegrab to move the statues.
    That one is the easiest Now with SPS, finding out which maze your in is super super easy
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  10. #10
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    April 6th.

    Deciding to update this now that I've done some substantial scripting.

    I'm mostly done now, the Collecting, enchanting, and dragonstone functions are done, and are just being tested now. I got rid of collecting shapes based on the bonus item, because it's just not worth it since by time the script gets there(and me doing it legit) the bonus item changes. So now the script goes to a random shape and fills up the inventory.

    here are the three major functions:
    Simba Code:
    ////////////////////////////////////////////////////////////////////////////////
    //function GetItemsMM : TPointArray;
    //Variation of GetMMDots, this one actually works!
    ////////////////////////////////////////////////////////////////////////////////
    function GetItemsMM : TPointArray;
    var
      atpa : T2DPointArray;
      i : integer;
    begin
      if not FindColorsTolerance(result, 2815, mmx1, mmy1, mmx2, mmy2, 25) then
      begin
        A_Debug('No items on minimap', Priority_Low);
        exit;
      end;
      atpa := SplitTPAEx(result, 4, 4);
      setlength(result, length(atpa));
      SMART_DebugATPA(true, ATPA);
      if length(atpa) < 1 then exit;
      for i := 0 to high(atpa) do
        result[i] := atpa[i][0];
      debugatpabounds(atpa);
    end;

    ////////////////////////////////////////////////////////////////////////////////
    //function CollectDragonstone : boolean;
    //Collects dragonstones
    ////////////////////////////////////////////////////////////////////////////////

    function CollectDragonstone : boolean;
    var
      itemtpa : TPointArray;
      i : integer;
      anyleft : boolean;
      center : TPoint;
    begin
      result := true;
      repeat
        itemtpa := GetItemsMM;
        FilterPointsPie(itemtpa, 0, 360, 0, 72, mmcx, mmcy);
        if Length(itemtpa) <= 0 then exit;
        for i := 0 to high(itemtpa) do
        begin
          if not rs_OnMinimap(itemtpa[i].x, itemtpa[i].y) then continue;
          Mouseflag(itemtpa[i].x, itemtpa[i].y, 5, 5, 0);
          wait(2500 + random(1500));
          itemtpa := GetItemsMM;
          if A_FindObj(9058907, 30, 2, 'ake Dra', AMouse_Left) then
          begin
            A_Debug('clicked dragonstone', Priority_Low);
            if not WaitUntilInvChange then
            begin
              A_Debug('failed to pick up dragonstone, moving to next', Priority_High);
              itemtpa := GetItemsMM;
              continue;
            end;
            A_Debug('Got dragonstone', Priority_Low);
            itemtpa := GetItemsMM;
          end;
        end;
        a_debug('Number of dots found: ' + ToStr(i), Priority_Low);
        if anyleft then exit;
        if i < 6 then
        begin
          anyleft := true;
          center := FindCenterTPA;
          if not center.x > -1 then
          begin
            a_debug('Cannot find center', Priority_High);
            exit;
          end;

          mouse(center.x, center.y, 3, 3, true);
          flag;
          wait(200 + random(200));
          if length(GetItemsMM) > 0 then
          begin
            anyleft := false;
            itemtpa := GetItemsMM;
          end;
        end;
      until anyleft;
    end;

    ////////////////////////////////////////////////////////////////////////////////
    //function CollectShape : boolean;
    //Goes to random shape, and fills the inventory
    ////////////////////////////////////////////////////////////////////////////////
    function CollectShape : boolean;
    var
      colarr : TIntegerArray;
      StrArr : TStringArray;
      shape, x, y, i : integer;
    begin
      shape := randomrange(CylinderID, IcoID);
      if not WalkToShape(shape) then
        exit;
      colarr := [1542676, 2241002, 2146527, 15100262];
      StrArr := ['rom Cyl', 'rom Pen', 'rom Cub', 'rom Ico'];

      a_debug('getting shape', Priority_Low)
      if A_FindObj(ColArr[shape], 10, 7, StrArr[shape], AMouse_Left) then
      begin
        if WaitUntilInvChange then
          a_debug('got shape', Priority_Low)
        else
          a_debug('didn''t get shape', 1);
        Flag;


        if waitfunc(@IsStopped, 1500 + random(500), 5000) then
          a_debug('stopped moving', Priority_Low)
        else
          a_debug('failde to stop moving', 1);
      end else
      begin
        a_debug('Failed to find shape: ' + tostr(shape), Priority_High);
        exit;
      end;
      writeln(0);
      if A_FindObj(ColArr[shape], 10, 7, StrArr[shape], AMouse_Left) then
      begin
        getmousepos(x, y);
        writeln(1);
        repeat
          mouse(x, y, 0, 0, true);
          wait(100 + random(300));
          inc(i);
          if i = 28 then
          begin
            A_Debug('Failed to collect shapes', Priority_High);
            break;
          end;
        until InvFull;
      end;

      result := InvFull;
    end;

    ////////////////////////////////////////////////////////////////////////////////
    //function Enchant : boolean;
    //Loads shape DTMs, and attempts to enchant everything in inventory
    ////////////////////////////////////////////////////////////////////////////////
    function Enchant : boolean;
    var
      i, a, x, y, rx, ry, t : integer;
      DTMArr : TIntegerArray;
    begin
      if not gametab(tab_magic) then
        exit;

      setlength(DTMArr, 5);
      DTMArr[CylinderID] := DTMFromString('mbQAAAHicY2VgYOBnZmBgA2JRIBYAYk4gLmNkYCgA4hogTgfiJiDmzxIEqmZCwSJAEh0DlTKwoGEwAAAHGgOv');
      DTMArr[CubeID] := DTMFromString('mWAAAAHicY2FgYMhnYmDIgeIEINZjZGBQBGILRgh7TqMBUBUTHIsASWQMVMLAgoRBAAD/uwQd');
      DTMArr[PentID] := DTMFromString('mWAAAAHicY2FgYMhgZmDIAuISII4D4lZGBoZpQNwOxL0gtoIYUBUTHEsCSWTMgoZBAABEfwUu');
      DTMArr[IcoID] := DTMFromString('mbQAAAHicY2VgYNjPxMCwD4g3A/ExIN4IxDMYGRh6gHgBEM8C4slAbGpWDlTNBMYGCgpgWgRIomOgUgYWNAwGAKy5CHo=');
      DTMArr[DragonstoneID] := DTMFromString('mWAAAAHicY2FgYMhkYmAoBeJUIM4BYj5GBgY2IGYFYgYgDubPAzKY4FgOSCJjdjQMAgDIwQND');

      repeat
        inc(i);
        a_debug('trying to cast', Priority_Low);
        if not Cast('lvl-' + tostr(players[0].integers[0]) + ' enchant', false) then
        begin
          A_Debug('Cannot cast spell. exiting', priority_high);
          //logout;
          for a := 0 to 4 do
            freedtm(DTMArr[a]);
          terminatescript;
        end;
        getmousepos(rx, ry);
        if finddtm(DTMArr[4], x, y, mix1, miy1, mix2, miy2) then
        a_debug('found dtm', Priority_Low);
        for a := 0 to high(DTMArr) do
          if FindDTM(DTMArr[a], x, y, mix1, miy1, mix2, miy2) then
          begin
            a_debug('clicking shape', Priority_Low);
            Mouse(x, y, 4, 4, true);
            mmouse(rx, ry, 3, 3);
            while not GetCurrentTab = tab_Magic do
            begin
              wait(100);
              inc(t);
              if t > 25 then
                if not GameTab(tab_Magic) then
                begin
                  a_debug('Cannot open magic tab', Priority_High);
                  for a := 0 to 4 do
                    freedtm(DTMArr[a]);
                  exit;
                end;
            end;
            a_debug('mage tab open', Priority_Low);
            WaitUptext('Cast', 15000);
          inc(Casts);
          break;
          end else
          begin
            if a = 4 then
            begin
              result := true;
                for a := 0 to 4 do
                  freedtm(DTMArr[a]);
              a_debug('cant find dtm, probably done enchanting', Priority_High);
              exit;
            end;
          end;
       until i >= 40;
       if i >= 40 then
         result := false;
       for a := 0 to 4 do
         freedtm(DTMArr[a]);
       a_debug('done enchanting', Priority_Low);
    end;

    as always, feedback please
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  11. #11
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Good progress :P

  12. #12
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    Quote Originally Posted by Ollybest View Post
    Good progress :P
    Jealous of your King Black Dragon rank Need to post more I guess lol.
    As said before, good progress and I learned some stuff by reading through the progress. Not completely sure why you put an "A_" before some stuff, explain? On another note, I have a development blog aswell but I put it at a different section, you can find it in my signature. If you have any tips, let me know

    Script source code available here: Github

  13. #13
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by J J View Post
    Jealous of your King Black Dragon rank Need to post more I guess lol.
    As said before, good progress and I learned some stuff by reading through the progress. Not completely sure why you put an "A_" before some stuff, explain? On another note, I have a development blog aswell but I put it at a different section, you can find it in my signature. If you have any tips, let me know
    I put an A_ before stuff because it's my personal functions that I use in all of my scripts, like A_Debug, A_WalkPath, and A_FindObj, just like how all the reflection functions have R_, and sps functions have sps_
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  14. #14
    Join Date
    Apr 2007
    Location
    Los Angeles
    Posts
    622
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    I'm planning on making a full MTA after I'm done adding smithing, fletching and cooking to my AIO hybrid. Your welcome to join the project if you like :P

  15. #15
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by punkd View Post
    I'm planning on making a full MTA after I'm done adding smithing, fletching and cooking to my AIO hybrid. Your welcome to join the project if you like :P
    Good luck.

    I already got 99 mage, so working on this script pretty much seems useless now, maybe i'll work on it later If anyone else wants to try to finish it, please be my guest
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  16. #16
    Join Date
    Apr 2007
    Location
    Los Angeles
    Posts
    622
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    =P Im fully maxed and still working on a scripts lol, I do it cuz I enjoy it not for my personal use

  17. #17
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by punkd View Post
    =P Im fully maxed and still working on a scripts lol, I do it cuz I enjoy it not for my personal use
    I do too, but tbh I'd rather work on something more interesting, when before I did this just so I could get the last few 100k exp
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  18. #18
    Join Date
    Apr 2007
    Location
    Los Angeles
    Posts
    622
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Send me what you have when u have time, I'd like to take a look to get an idea on getting started.

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
  •