Results 1 to 7 of 7

Thread: Help With Gilded Altar Script

  1. #1
    Join Date
    Apr 2012
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help With Gilded Altar Script

    I'm trying to tweak EvlinsGildedAltar Script so i would fix the following error,
    "Did not Find The Altar, Terminating Script.
    Successfully executed.
    The following DTMs were not freed: [2]"

    DTMs were not freed,

    Can't seem to find it as i initially thought it was in Teleport to bank procedure but im not sure anymore

    Code:
    program EvlinsGildedAltarReMade;
    {$i srl/srl/misc/smart.simba}
    {$i SRL\SRL.simba}
    {$i sps/sps.simba}
    
    
    
    {______________ONLY HAVE ONE KIND OF BONES IN THE TAB YOU ARE USING____________}
    const
    {______________________________Script Setup____________________________________}
    
    //Player Setup
    UserLogin = '';         //RuneScape Username
    UserPassword = '';      //Runescape Password
    Pin = '';               //Bank Pin, Leave blank if none.
    
    //Summoning
    UseSummoning = 'No';      //Leave at No Please(still in dev)
    
    //BoneType
    TypeOfBones = '0';  { Type in one of the Following:
                               * 0 = Dragon Bones
                               * 1 = BabyDragonBones
                               * 2 = FrostDragon Bones
                               * 3 = Big Bones}
    
    {____________________________END OF SCRIPT SETUP_______________________________}
    
    var
    Herb, BoneDTM, BonesForRun, XpForRun, BoneSacraficed, ExpGained, TripNumber: integer;
    BoneName : String;
    
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := UserLogin;
      Players[0].Pass := UserPassword;
      Players[0].Active := True;
      Players[0].Pin := Pin;
    end;
    
    
    Procedure BoneValues;
    begin
        Case Lowercase(TypeOfBones) of
        '0' :
             begin
                BoneDTM := DTMFromString('m1gAAAHic42JgYBBkYmCQA2IFIBYDYmkg5gFiNiCWBWIBIJYH4jVAtduBeD0QbwHinUC8EYg3Q8U2APEKIG5saweSTASxJJAkBjMSiREAAPKtCos=');
                BoneName:= 'DragonBones';
                XpForRun:= 6300;
                BonesForRun:= 25;
             end;
       '1':
             begin
                BoneDTM := DTMFromString('mlwAAAHicY2dgYDjMxMBwCogPAfEZIN4DxMeB+BgQ1wPlO4G4BYgbgLgViJuBuAOI1y9fDiSZsGIRIIkLM+LBUAAAORYLsg==');
                BoneName:='BabyDragonBones';
                XpForRun:= 2625;
                BonesForRun:= 25;
             end;
       '2':
             begin
                BoneDTM := DTMFromString('m1gAAAHic42JgYBBkYmCQA2IFIBYDYmkg5gFiNiCWBWIBIJYH4jVAtduBeD0QbwHinUC8EYg3Q8U2APEKIG5saweSTASxJJAkBjMSiREAAPKtCos=');
                BoneName:='FrostDragonBones';
                XpForRun:= 15750;
                BonesForRun:= 25;
             end;
       '3':
             begin
                BoneDTM := DTMFromString('mwQAAAHic42RgYDjExMBwHIjPAvExID4DxPuAeBuUvR2IG4DqWoC4A4g7GSD8ViBuBOIaIG4D4llTJgNJJrxYEkgSwoxEYDgAAD4XDlM=');
                BoneName:='BigBones';
                XpForRun:= 1300;
                BonesForRun:= 25;
             end;
        end;
    end;
    
    
    Procedure ProgressReport;
    begin
      WriteLn('_______Evlins Gilded Altar______');
      WriteLn('Time Ran For ' + TimeRunning + '');
      WriteLn('You Have Gained ' + IntToStr(ExpGained) + ' Prayer xp');
      WriteLn('You Have Sacraficed ' + IntToStr(BoneSacraficed) + ' ' + (BoneName));
      WriteLn('You Have Done ' + IntToStr(TripNumber) + ' Trips');
      WriteLn('________________________________');
    end;
    
    
    procedure WalkToBank;
    var
    x, y: integer;
    begin
      SymbolAccuracy := 0.5;
      if FindSymbol(x, y, 'bank') then
      MMouse(x, y, 2, 2);
      ClickMouse2(True);
      SymbolAccuracy := 0.8;
    end;
    
    
    function UseBankNPC: Boolean;
    var
      bx, by, Speed, ColFace, ColGrey, ColBlue, ColHair, t: Integer;
    begin
      Result := (LoggedIn) and (BankScreen or PinScreen);
      if (Result) then exit;
      Speed := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      ColFace := 4468276;
      ColGrey := 4995649;
      ColBlue := 4468276;
      ColHair := 5125177;
      if (FindObjThroughMM(bx, by, 'npc', [ColFace, ColBlue, ColGrey, ColHair], [5, 5, 5, 5],
        ['ounter', 'se Co', 'anke', 'to B', 'Banker', 'nker'], 2, 2)) then
      begin
        Mouse(bx, by, 0, 0, False);
        if (WaitOptionMulti(['kly Co', 'se-qu', 'ank B', 'Bank Banker', 'ank', 'nker'], 750)) then
        begin
          t := (GetSystemTime + 5000);
          repeat
            if (BankScreen) or (PinScreen) then
            begin
              Result := true;
              Break;
            end;
            Wait(50);
          until(GetSystemTime > t);
          if (Length(Players) > 0) then
            if ((PinScreen) and (Players[CurrentPlayer].Pin <> '')) then
              InPin(Players[CurrentPlayer].Pin);
          Result := (BankScreen) or (PinScreen);
        end;
      end;
      ColorToleranceSpeed(Speed);
    end;
    
    
    procedure Bank;
    var
    x, y: integer;
    aFound: extended;
    begin
       Herb := DTMFromString('mggAAAHicY2NgYNgJxPuAeD8QbwPiw0B8HIinAfFUIJ4HxHOBeA4QTwZibl8eIMmEgSWBJDbMiANDAACM8Akc');
      repeat
        UseBankNPC;
      until(BankScreen) or (PinScreen);
      if (PinScreen) then
        begin
          InPin(Pin);
        end;
          If (BankScreen) then
          Wait(1300+random(50));
           begin
              if FindDTM(Herb, x, y, 26, 84, 480, 292) then
                begin
                  Writeln('Found The Marrentill');
                  MMouse(x, y, 7, 7);
                  ClickMouse2(True);
                  Wait(375+random(50));
                  ClickMouse2(true);
                  Wait(375+random(50));
                end else
                begin
                  Writeln('You Have No Marrentill!');
                  TerminateScript;
                end;
              if FindDTMRotated(BoneDTM, x, y, 26, 84, 480, 292, -Pi/4, Pi/4, Pi/60, aFound) then
                  begin
                    Writeln('Found the ' + BoneName);
                    MMouse(x, y, 7, 7);
                    ClickMouse2(False);
                    Wait(450+random(25));
                    ChooseOption('All');
                    Wait(450+random(25));
                  end else
                  begin
                    WriteLn('You Have No ' + BoneName + '!');
                    TerminateScript;
                  end;
            end;
            CloseBank;
            FreeDTM(Herb);
    end;
    
    
    procedure TeleToHouse;
    begin
     if (BankScreen) then
     begin
       CloseBank;
       Wait(500+random(100));
     end;
      begin
        InvMouse(1, 1);
        Wait(6750+random(1000));
      end;
    end;
    
    
    function DoorColour: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.25, 0.72);
    
      FindColorsSpiralTolerance(MSCX, MSCY, arP, 5333873, MSX1, MSY1, MSX2, MSY2, 5);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);
    
        if (X >= 9.53) and (X <= 16.52) and (Y >= 9.94) and (Y <= 16.61) and (Z >= 7.88) and (Z <= 11.37) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
          Break;
        end;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    
    
    procedure OpenDoor;
    var
    x, y: integer;
    Begin
      ClickNorth(SRL_ANGLE_HIGH);
      begin
        if FindObjTPA(x, y, DoorColour , 3, 1, 70, 80, 200, ['oor']) then
        begin
          MMouse(x, y, 0, 0);
          ClickMouse2(True);
          Flag;
          Wait(700+random(75));
          MouseBox(250, 40, 268, 73, 1);
          Flag;
          Wait(1500+random(75));
        end;
      end;
    end;
    
    
    procedure RightBurner;
    var
    x, y: integer;
    begin
      if FindColorTolerance(x, y, 2409718, 313, 48, 413, 180, 5) then
      begin
        WriteLn('Found Right Burner, Lighting.');
        MMouse(x, y, 0, 0);
        Wait(200+random(50));
        ClickMouse2(True);
        Flag;
        Wait(3000+random(120));
      end else
      begin
        WriteLn('Did not Find Right Burner, Terminating Script.');
        TerminateScript;
      end;
    end;
    
    
    procedure LeftBurner;
    var
    x, y: integer;
    begin
      if FindColorTolerance(x, y, 2409718, 33, 89, 104, 158, 5) then
      begin
        WriteLn('Found Left Burner, Lighting.');
        MMouse(x, y, 0, 0);
        Wait(200+random(50));
        ClickMouse2(True);
        Flag;
        Wait(3000+random(120));
      end else
      begin
        WriteLn('Did not Find Left Burner, Terminating Script.');
        TerminateScript;
      end;
    end;
    
    
    function Book: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.35, 0.25);
    
      FindColorsSpiralTolerance(MSCX, MSCY, arP, 10985631, MSX1, MSY1, MSX2, MSY2, 6);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);
    
        if (X >= 28.19) and (X <= 40.02) and (Y >= 29.35) and (Y <= 41.59) and (Z >= 34.29) and (Z <= 49.10) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
          Break;
        end;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    
    
    procedure Altar;
    var
    x, y: integer;
    begin
      if FindObjTPA(x, y, Book , 6, 1, 5, 10, 30, ['tar']) then
      begin
        WriteLn('Found Altar, Sacraficing.');
        MMouse(x, y, 7, 7);
        ClickMouse2(true);
      end else
      begin
        WriteLn('Did not Find The Altar, Terminating Script.');
        TerminateScript;
      end;
    end;
    
    
    Procedure Sacrafice;
    begin
      InvMouse(9, MOUSE_RIGHT);
      Wait(300+random(120));
      ChooseOption('Use');
      Altar;
      Flag;
      Wait(1700+random(200));
      MouseBox(234, 404, 284, 453, MOUSE_LEFT);
    end;
    
    
    procedure Using;
    begin
     WriteLn('Sacraficing...');
     repeat
       Wait(500);
     until(InvCount = 1);
     WriteLn('Finished Sacraficing, Banking.');
     BoneSacraficed := BoneSacraficed + BonesForRun;
     ExpGained := ExpGained + XpForRun;
     TripNumber := TripNumber + 1;
    end;
    
    
    procedure TeleToBank;
    var
    x, y: integer;
    begin
      if FindColorTolerance(x, y, 7114144, 49, 23, 92, 50, 10) then
      begin
      MMouse(x, y, 0, 0);
      Wait(280+random(250));
      ClickMouse2(true);
      Flag;
      Wait(2300+random(200));
      MouseBox(223, 381, 301, 387, 1);
      Wait(7000+random(250));
      end else
    end;
    
    
    begin
      ClearDebug;
      Smart_Server := 87;
      Smart_Members := True;
      Smart_Signed := True;
      Smart_SuperDetail := False;
      SetUpSRL;
      DeclarePlayers;
      LogInPlayer;
      BoneValues;
     repeat
       Bank;
       TeleToHouse;
       OpenDoor;
       RightBurner;
       LeftBurner;
       Sacrafice;
       Using;
       ProgressReport;
       TeleToBank;
       WalkToBank;
     until(not LoggedIn);
    end.
    Last edited by infamousnightmar; 04-06-2012 at 02:10 PM.

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

    Default

    If it cant find the altar its either because the altar colours need updating, or because its not walking to the altar so it isn't in sight.

  3. #3
    Join Date
    Apr 2012
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It does function correctly but I need to implement an free function somewhere else it would cause a memory leak causing the script to fail eventually thus saying "DTMs Were not freed"
    Last edited by infamousnightmar; 04-06-2012 at 06:04 PM.

  4. #4
    Join Date
    Apr 2012
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    My question is where to put this in and how

  5. #5
    Join Date
    Jul 2010
    Posts
    1,115
    Mentioned
    1 Post(s)
    Quoted
    10 Post(s)

    Default

    you never free your bone dtms, but simba frees them when it ends. the reason the script fails is because it doesnt find the altar. you need that fixed. you could also at the end of the script put in a freedtm(bonedtm) or whatever so it would free them when its done if it doesnt use terminate script i think theres something like addonterminate or something that you could have it free the bone dtms on terminate so whenever it ends it would free them. but that isn not a leak because you dont keep calling the procedure that assigns the bone dtms.

  6. #6
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    If it's not finding the altar - tell Evlin, stop trying to tweak the code because you don't seem to know what you're doing

  7. #7
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    If it's not finding the altar - tell Evlin, stop trying to tweak the code because you don't seem to know what you're doing
    Ure very wrong, please try to fix it urself its the first step on making ur own script!!

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
  •