Results 1 to 3 of 3

Thread: Freezing..?

  1. #1
    Join Date
    Oct 2006
    Location
    Ireland
    Posts
    855
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Freezing..?

    Meehhhhhhh..... Does anybody know why my script freezes after it solves a random? ANy help would be greatly appreciated. I think its findnormalrandoms, as its been freezing after mysterious boxes.

    SCAR Code:
    {=========================================================================]
    [                  Monster Guild Miner                                    ]
    [                                                                         ]
    [           NAME        : Monster Guild Miner                             ]
    [           WRITER      : ~alex~                                          ]
    [           CATEGORY    : Miner                                           ]
    [           DESCRIPTION : Mines from fally mining guild and banks coal    ]
    [           AUTOCOLOR   : Yes                                             ]
    [           NOTES       : No antipickaxe-falling off... SRL one is fucked ]
    [           CONTACT     : [email]gamesjunky1991@gmail.com[/email]                        ]
    [                                                                         ]
    [                                                                         ]
    [=========================================================================]
    [                                                                         ]
    [=========================================================================]
    [                           Instructions.                                 ]
    [=========================================================================]
    [ 1. USE Runescape with Low Detail, Very Bright.                          ]
    [ 2. Set your Screen to 32 bit TRUE color.                                ]
    [ 3. Press run                                                            ]
    [ 4. Fill out form                                                        ]
    [ 5. Start in fally east bank                                             ]
    [=========================================================================}

    program New;
    {.include srl/srl.scar}
    {.include SRL/SRL/Skill/Mining.scar}

    var
      coalrock1,coalrock2,coalrock3,bankbooth1,bankbooth2,bankbooth3,mmorangerock,mmGuildLadder,invCoal,pickaxehandle:integer;
      rockfound,clickedbank:boolean;
      rockColor,attempt:integer;

    //******************** Set These Constants if Needed  *******************//

    const StartPlayer         = 0;     // Determines who will play first

    //**********************RuneScape Constants*******************************//


    //************************************************************************//
    const VersionNumber       = '1.1';      // Compliant with Rev 568+
    //************************************************************************//

    procedure PlayerStats;

    var Active: string;
    var i: Integer;
    begin
    writeln('**********************************************');
    writeln('Name         : '+ Players[CurrentPlayer].Name);
    writeln('Number       : '+ inttostr(CurrentPlayer));
    writeln('Mining Level : '+ inttostr(getskilllevel('Mining')))
    writeln('Mined : ' + inttostr(players[currentplayer].integer2) + ' coal ores')
    writeln('Select Skill : '+ Players[CurrentPlayer].Skill);
    writeln('Script has been running for: ' + (timerunning))
    writeln('Banked : '+ inttostr(Players[CurrentPlayer].Banked) + ' times.');
    if Players[CurrentPlayer].Active=True then Active:='True' else Active:='False';
    writeln('Active       : '+ Active);
    writeln('**********************************************');

    for i := 0 to HowManyPlayers-1 do
       begin
       if Players[i].Active=True then Active:='True' else Active:='False';
          writeln( (inttostr(i))+' : '+Players[i].name+ ' = '+Active+'. - Lvl : '+inttostr(Players[i].Level[15])+
          '. - B :'+inttostr(Players[i].Banked)+' Times.'+
          ' -  : '+IntToStr(Players[i].Worked)+' mins.'+' - Loc: '+Players[i].loc);
        end
       writeln('**********************************************');
    end;

    //************************************************************************//

    procedure ProgressReport;
    begin
      begin
      WriteLn(' ');
      WriteLn('<============== -'+VersionNumber+'- Progress Report ===============>');
      SRLRandomsReport;
      Writeln(' ');
      end;
      PlayerStats;
    end;

    //************************************************************************//
    //-----------------------------------------------------------------//
    //--               Scar Standard Resource Library                --//
    //--               ยป    Player Array Forums                      --//
    //-----------------------------------------------------------------//
    // *
    // *  procedure SetupPlayers;              // *  By: Masquerader   //

    { var frmDesign: TForm;
      Description: Mainform Handle}

    var
      frmDesign: TForm;

    { var Names, Passes, Nicks, Location, Skill: array of TEdit;
      Description: EditBox Handles}


    var
      Names, Passes, Nicks, Skill,Ores: array of TEdit;

    { var Active: array of TCheckBox;
      Description: Checkbox Handle}


    var
      Active: array of TCheckBox;

    { var NewUserButton, Ok: TButton;
      Description: ButtonClicks}


    var
      NewUserButton, Ok: TButton;

    { var cFile : String;
      Description: Filedata Variable}


    var
      cFile: string;

    {*******************************************************************************
    function getNumber: Integer;
    By: RsN
    Description: Gets Number of Users Saved
    *******************************************************************************}


    function getNumber: Integer;
    var
      i: Integer;
    begin
      for i := 0 to i + 1 do
      begin
        if (Pos('name' + IntToStr(i) + '=', cFile) = 0) then
        begin
          Result := i;
          Exit;
        end;
      end;
    end;

    {*******************************************************************************
    function getData(aChar: Integer; dName : String): String;
    By: RsN
    Description: Gets data by dName from aChar number
    *******************************************************************************}


    function getData(aChar: Integer; dName: string): string;
    var
      tString: string;
    begin
      Result := '';
      tString := dName + IntToStr(aChar) + '=';
      if (Pos(tString, cFile) = 0) then
        Exit;
      Result := cFile;
      Delete(Result, 1, Pos(tString, cFile));
      Result := Copy(Result, Length(tString), Pos(Chr(13), Result) -
        Length(tString));
    end;

    {*******************************************************************************
    procedure AddUser;
    By: Masquerader
    Description:  Adds a UserSlot to the Form
    *******************************************************************************}


    procedure AddUser;
    var
      I: Integer;
    begin
      I := GetArrayLength(Names);
      SetArrayLength(Names, I + 1);
      SetArrayLength(Passes, I + 1);
      SetArrayLength(Nicks, I + 1);
      SetArrayLength(Active, I + 1);
      SetArrayLength(Skill, I + 1);
      SetarrayLength(Ores, I + 1);

      Names[I] := TEdit.Create(frmDesign);
      Names[I].Parent := frmDesign;
      Names[I].Left := 13;
      if (I = 0) then
        Names[I].Top := 54
      else
      Names[I].Top := Skill[i - 1].Top + 30;
      Names[I].Width := 121;
      Names[I].Height := 21;
      Names[I].Text := 'Username ' + IntToStr(i);

      Passes[I] := TEdit.Create(frmDesign);
      Passes[I].Parent := frmDesign;
      Passes[I].Left := 13;
      Passes[I].Top := Names[I].Top + 21;
      Passes[I].Width := 121;
      Passes[I].Height := 21;
      Passes[I].Text := 'Password ' + IntToStr(i);
      //Passes[I].PasswordChar := '*';

      Active[I] := TCheckBox.Create(frmDesign);
      Active[I].Parent := frmDesign;
      Active[I].Left := 155;
      Active[I].Top := Passes[I].Top;
      Active[I].Width := 79;
      Active[I].Height := 17;
      Active[I].Caption := 'Active?';

      Nicks[I] := TEdit.Create(frmDesign);
      Nicks[I].Parent := frmDesign;
      Nicks[I].Left := 13;
      Nicks[I].Top := Passes[I].Top + 21;
      Nicks[I].Width := 121;
      Nicks[I].Height := 21;
      Nicks[I].Text := 'Nickname ' + IntToStr(i);

      Ores[I] := TEdit.Create(frmDesign);
      Ores[I].Parent := frmDesign;
      Ores[I].Left := 13;
      Ores[I].Top := Nicks[I].Top + 21;
      Ores[I].Width := 121;
      Ores[I].Height := 21;
      Ores[I].Text := 'Ores to mine ' + IntToStr(i);

      Skill[I] := TEdit.Create(frmDesign);
      Skill[I].Parent := frmDesign;
      Skill[I].Left := 13;
      Skill[I].Top := Ores[I].Top + 21;
      Skill[I].Width := 121;
      Skill[I].Height := 21;
      Skill[I].Text := 'Skill ' + IntToStr(i);

    end;

    {*******************************************************************************
    procedure SaveSettings;
    By: RSN and Masquerader
    Description:  Saves UserData to File
    *******************************************************************************}


    procedure SaveSettings; // taken from users.scar, by RSN
    var // t = names written to file
      afile, i, p, t: Integer; // p = players added to array
    //  temp : string;
    begin
      aFile := RewriteFile(AppPath + 'guildminer' + '.srl', False);
      t := 0;
      p := 0;
      for i := 0 to GetArrayLength(Names) - 1 do
      begin
      //doesnt write unchanged or blank boxes :)
        if (not (Names[I].text = 'Username ' + IntToStr(i)) and
          (Length(Names[I].text) > 2)) then
        begin
          WriteFileString(aFile, 'name' + IntToStr(t) + '=' + Names[I].text +
            Chr(13));
          WriteFileString(aFile, 'pass' + IntToStr(t) + '=' + Passes[I].text +
            Chr(13));
          WriteFileString(aFile, 'nick' + IntToStr(t) + '=' + Nicks[I].text +
            Chr(13));
          WriteFileString(aFile, 'ores' + IntToStr(i) + '=' + ores[I].text +
            Chr(13));
          WriteFileString(aFile, 'skill' + IntToStr(i) + '=' + Skill[I].text +
            Chr(13));

          if (Active[I].state) then
          begin
            WriteFileString(aFile, 'active' + IntToStr(t) + '=true' + Chr(13));
            SetArrayLength(players, p + 1);
            Players[p].Name := Names[I].text;
            Players[p].Pass := Passes[I].text;
            Players[p].Nick := Nicks[I].text;
            Players[p].integer1 := strtoint(Ores[I].text);
            Players[p].Skill := Skill[I].text;
            Players[p].Active := True;

            p := p + 1;
          end;
          t := t + 1;
        end;
      end;
      CloseFile(aFile);
      WriteLn('Wrote ' + IntToStr(t) + ' users to ' + 'guildminer' + '.srl');
      WriteLn('There is ' + IntToStr(p) + ' active users')
    end;

    {*******************************************************************************
    procedure LoadSettings;
    By: RSN and Masquerader
    Description:  Loads UserData from File
    *******************************************************************************}


    procedure LoadSettings; // taken from users.scar, by RSN
    var
      i, t, afile: Integer;
    begin
      afile := OpenFile(AppPath + 'guildminer' + '.srl', False);
      if (aFile < 0) then
        Exit;
      ReadFileString(aFile, cFile, FileSize(aFile));
      CloseFile(aFile);
      t := getNumber;
      for i := 0 to t - 1 do
        AddUser;

      for i := 0 to t - 1 do
      begin
        Names[I].Text := getData(i, 'name');
        Passes[I].Text := getData(i, 'pass');
        Nicks[I].Text := getData(i, 'nick');
        ores[I].Text := getData(i, 'ores');
        Skill[I].Text := getData(i, 'skill');
        Active[I].state := (getData(i, 'active') = 'true');
      end;
      WriteLn('Loaded ' + IntToStr(t) + ' users from ' + 'guildminer' + '.srl');
    end;

    {*******************************************************************************
    procedure buttonclick(sender: TObject);
    By: Masquerader
    Description:  Handles Button Clicks
    *******************************************************************************}


    procedure buttonclick(sender: tobject);
    var
      v: TVariantArray;
    begin
      SetArrayLength(V, 0);
      if (Sender is TButton) then
        case (TButton(Sender).tag) of
          -1: ThreadSafeCall('AddUser', v);
          -2:
            begin
              frmDesign.ModalResult := mrOk;
              ThreadSafeCall('SaveSettings', v);
            end;
        end;
    end;

    {*******************************************************************************
    procedure InitForm;
    By: Masquerader
    Description: Creates Form
    *******************************************************************************}


    procedure InitForm;
    begin
      frmDesign := CreateForm;
      frmDesign.Left := 259;
      frmDesign.Top := 132;
      frmDesign.Width := 440;
      frmDesign.Height := 540;
      frmDesign.Caption := 'Character Manager';
      frmDesign.Color := clInactiveCaption;
      frmDesign.Font.Height := -11;
      frmDesign.Font.Name := 'MS Sans Serif';
      frmDesign.Font.Style := [];
      frmDesign.Visible := False;
      frmDesign.PixelsPerInch := 96;

      NewUserButton := TButton.Create(frmDesign);
      NewUserButton.Parent := frmDesign;
      NewUserButton.Left := 116;
      NewUserButton.Top := 21;
      NewUserButton.Width := 75;
      NewUserButton.Height := 25;
      NewUserButton.Caption := 'New User';
      NewUserButton.OnClick := @buttonclick;
      NewUserButton.Tag := -1;

      Ok := TButton.Create(frmDesign);
      Ok.Parent := frmDesign;
      Ok.Left := 258;
      Ok.Top := 21;
      Ok.Width := 75;
      Ok.Height := 25;
      Ok.Caption := 'Ok';
      Ok.OnClick := @buttonclick;
      Ok.Tag := -2;
    end;

    //-----------------------------------------------------------------//

    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('InitForm', v);
      SetArrayLength(V, 0);
      ThreadSafeCall('LoadSettings', v);
    end;

    //-----------------------------------------------------------------//

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    //-----------------------------------------------------------------//

    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    {*******************************************************************************
    procedure SetupPlayers;
    By: Masquerader
    Description: Open Form, Loads and Saves Data only procedure you need to use
    *******************************************************************************}


    procedure SetupPlayers;
    begin
      if FileName = '' then FileName := 'chars';
      SafeInitForm;
      SafeShowFormModal;
      FreeForm(FrmDesign);

      frmDesign := nil;
      ok := nil;
      NewUserButton := nil;
      SetArrayLength(Names, 0);
      SetArrayLength(Passes, 0);
      SetArrayLength(Nicks, 0);
      SetArrayLength(ores, 0);
      SetArrayLength(Skill, 0);
      SetArrayLength(Active, 0); //should free ALL memory used

      HowManyPlayers := GetArrayLength(players);
      if (howmanyplayers = 0) then
      begin
        WriteLn('You cant run this script without active players');
        TerminateScript;
      end;
    end;
    //Originally by Stipidooo, edited alot by ~alex~
    function FindPickHeadColor2: Boolean;
    var
    fx,fy:integer;
    begin
     pickaxehandle := DTMFromString('78DA6314616060106540017A0A0C0C2780342' +
           '310FF0702465E208393010D302291405A0C48B01350234B841A25' +
           '20C14D408D3A901020A0461848481350C307241408A811041262F' +
           '8D50000C6310694');
      GameTab(4);
      Wait(2000);
      if findDtm(pickaxehandle,x,y,566,191,605,252) or
        (FindBitmapSpiralTolerance(PickAxeSteel, fx, fy, 546, 198, 745, 468, 100))
          then
      begin
         hc1 := GetColor(575, 218);
        hc2 := GetColor(587,217);
        hc3 := GetColor(581,219);
        hc4 := GetColor(594, 222);
        hc5 := GetColor(579,219);
        WriteLn('Pick head colors... ' + IntToStr(hc1) + ' ' + IntToStr(hc2) + ' ' +
          IntToStr(hc3) + ' ' + IntToStr(hc4) + ' ' + IntToStr(hc5));
        EquipPick := False;
        Result := True;
      end;
      if (Result = False) then
      begin
        GameTab(5);
        Wait(200 + Random(200));
        if findDtm(pickaxehandle,x,y,567,285,615,330)  or
          (FindBitmapSpiralTolerance(PickAxeSteel, fx, fy, 546, 198, 745, 468, 100))
            then
        begin
               hc1 := GetColor(586,294);
        hc2 := GetColor(581,295);
        hc3 := GetColor(600,298);
        hc4 := GetColor(594, 293);
        hc5 := GetColor(604,300);
        WriteLn('Pick head colors... ' + IntToStr(hc1) + ' ' + IntToStr(hc2) + ' ' +
          IntToStr(hc3) + ' ' + IntToStr(hc4) + ' ' + IntToStr(hc5));
        EquipPick := true;
        Result := True;
          EquipPick := True;
          Result := True;
        end;
      end;
      if (Result = False) then
      begin
        WriteLn('');
        WriteLn('ERROR! cannot find pick in screen, please put pick in inventory or your equip page and restart the script!');
        WriteLn('');
        Result := False;
      end;
    end;


    //************************************************************************//
      // thanks Wt-Fakawi - Edited by ~Alex~

    function FindFastRandoms: Boolean;
    var
      i: Integer;
    begin
      for I := 1 to 11 do
      begin
        case I of
           1:  if FindDead then
                 Result := True;

           2:  if FindMod then
                 Result := True;

           3:  if FindMime then
                 Result := True;

           4:  if FindMaze then
                 Result := True;

           5:  if FindQuiz then
                 Result := True;

           6:  if FindDemon then
                 Result := True;

           7: begin
                 if NoGameTab then
                 begin
                   Result := True;
                   Players[CurrentPlayer].loc := 'No GameTab';
                   Logout;
                   Exit;
                 end;
               end;

           8 : if RC then
                 Result := True;

           9 : if FindFight then
                  begin
                    Result := True;
                    RunTo('E',True)
                  end;

           10: if FindTalk then
                 Result := True;
                 
           11: if not findpick then
               begin
                 writeln('Lost pickhead')
                 nextplayer(false)
               end;
        end;
        Wait(1);
      end;
    end;

    function bankOpener : boolean;

    var
    tolerance:integer;
    found:boolean;
    begin
    bankBooth1 := BitmapFromString(13, 9, 'z78DAADCD490E8340104' +
             '3D12BF550D8AE65D3C3FD8F14225004A291B260F356D6379D010B' +
             '770B2370D687BB1B2B3338B1D1A0B3320AA598575FB455B14E245' +
             '7D4896245BBD839302E0E0586BB1E9518272665A64308CC17B93D' +
             'DB446DFFCB4497FFECAAC4839C38D4A8BB256AD045288FD72CA8F' +
             '6ED063376C0F4E4BE99D8D02D1D3A86F5478166F52FF77284ACBC' +
             'E50733879C1F');

      bankBooth2 := BitmapFromString(11, 1, 'z78DAB33034B33071B4A' +
             '0800400DD030E45');

      bankBooth3 := BitmapFromString(14, 1, 'z78DA3335333132B2302' +
           '582347204626CA4AB913310229100E65111DD');

      makecompass('N')
      tolerance:=10
      repeat
      repeat
      if (findbitmaptolerancein(bankBooth1,x,y,msx1,msy1,msx2,msy2,tolerance)) or
      (findbitmaptolerancein(bankBooth2,x,y,msx1,msy1,msx2,msy2,tolerance)) or
      (findbitmaptolerancein(bankBooth3,x,y,msx1,msy1,msx2,msy2,tolerance)) then
      begin
        mmouse(x,y,3,3)
        tolerance := tolerance + 1
        if (isuptextmulti('booth','ank','nk bo')) then
        begin
          found := true
        end;
      end;
        if tolerance >=250 then
      begin
        writeln('Could not find booth')
        result:=false
        exit;
      end;
      until((found = true) or not(loggedin))



      if (not (loggedin)) then
      begin
       loginplayer
      end;

      if found then
      begin
        mouse(x,y,4,4,false)
        if clickoption('Use-quickly',1) then
        begin
          result:=true
          clickedbank:=true
          flag;
        end else
        begin
          clickoption('Cancel',1)
          clickedbank:=false
         end;
            end else
      begin
        writeln('Could not find bank')
        result:=false
       end;
       until(clickedbank=true)
        freebitmap(bankbooth1)
        freebitmap(bankbooth2)
        freebitmap(bankbooth3)
    end;


    procedure walkToGuild;
    Var inGuild:boolean;
    begin //1
      makecompass('N')
      setrun(true)
      gametab(4)
      RadialWalkEx(x,y,MMCX,MMCY,7243146,50,100,175,70)
      mouse(x,y,0,0,true)
      findfastrandoms;
      findnormalrandoms;
      wait(10000+random(500))
      flag;
      if FindColorSpiralTolerance(x,y,0,MMX1,MMY1,MMX2,MMY2,0) then
      begin //2
        mouse(x,y,0,0,true)
        flag;
        repeat
          if FindObj3(x,y,'Ladder',3565696,20) then
          begin //3
            mouse(x,y,0,0,false)
            if clickoption('Climb-down',1) then
            begin
              flag;
              inguild:=true
              writeln('In guild')
              players[currentplayer].loc :='mining'
              mouse(697,89,8,8,true)
              flag;
              break;
            end else
            begin
              clickoption('Cancel',1)
            end;
          end else
          begin
            writeln('Could not find ladder.')
            nextplayer(false)
            exit;
          end;
        until(inGuild)

      end; //2
    end;//1

    procedure depositOres;
    var tempores:integer;
    begin
      invCoal := BitmapFromString(8, 7, 'z78DA8D8D410E80300804BF5' +
           '4966DC523B6FEFF4B9AE2A18D361192098101A449930C878BE3BC' +
           '33299540D43D2417362293AE07088ABDFD91CFD6CADF75439958B' +
           '5C262EBE3F2E04CECFD30FFFBF16532177E9823479389091E8CA9' +
           '98586A17A065467A');

      pickaxehandle := DTMFromString('78DA6314616060106540017A0A0C0C2780342' +
           '310FF0702465E208393010D302291405A0C48B01350234B841A25' +
           '20C14D408D3A901020A0461848481350C307241408A811041262F' +
           '8D50000C6310694');

      tempores := countitembmptol(invCoal,20)
      if findDtm(pickaxehandle,x,y,566,191,605,252) then
      begin
        writeln('Pickfound in inv.')
        players[currentplayer].boolean1 := false
        freedtm(pickaxehandle)
      end else
      begin
        gametab(5)
        if findDtm(pickaxehandle,x,y,567,285,615,330) then
        begin
          writeln('Found pickaxe equiped.')
          players[currentplayer].boolean1 :=true
          freedtm(pickaxehandle)
        end else
        begin
          writeln('Cannot find pickaxe')
          nextplayer(false)
        end;
      end;
      if bankopener then
      begin
        if pinscreen then
        begin
          writeln('Found pinscreen, remove pin')
          nextplayer(false)
        end else
        begin
        wait(2000)
          fixbank;
          if players[currentplayer].boolean1 = true then
          begin
            depositall;
            closebank;
            players[currentplayer].banked:= players[currentplayer].banked + 1
            players[currentplayer].integer2:= players[currentplayer].integer2+tempores
            if players[currentplayer].integer2 > players[currentplayer].integer1 then
            begin
              writeln('w00t all ores mined.')
              tempores:=0
              progressreport;
              players[currentplayer].loc := 'going to guild'
              nextplayer(true)
              exit;
            end;
            tempores:=0
            progressreport;
            players[currentplayer].loc := 'going to guild'
          end else
          begin
            deposit(2,28,2)
            closebank;
            players[currentplayer].banked:= players[currentplayer].banked + 1
            players[currentplayer].integer2:= players[currentplayer].integer2+tempores
             if players[currentplayer].integer2 >= players[currentplayer].integer1 then
            begin
              writeln('w00t all ores mined.')
              tempores:=0
              progressreport;
              players[currentplayer].loc := 'going to guild'
              nextplayer(true)
              exit;
            end;
            tempores:=0
            progressreport;
            players[currentplayer].loc := 'going to guild'
          end;
        end;
      end;
    end;


    procedure walkToBank;
    var
    banksymbol:integer;
    bankfound:boolean;
    walkingattempts:integer;
    begin
      if findcolortolerance(x,y,6082797,mmx1,mmy1,mmx2,mmy2,80) then
      begin
      mouse(x,y+10,0,0,true)
      bankfound:=true
      wait(20000+random(500))
      flag;
      wait(1000);
      players[currentplayer].loc := 'in bank'
      exit;
      end else
      begin
        mouse(663,24,4,4,true)
        wait(10000+random(1500))
        flag;
        wait(300)
        walktobank;
      end;
    end;

    procedure leaveMiningGuild;
    var
    wentUp:boolean;
    mmrockcolor,mmrock,orangerock:integer;
    acc:extended;
    begin
      attempt:=0

      mmGuildladder := BitmapFromString(4, 3, 'z78DA3376353436303' +
           '0C6419A3A9BB818A190B854020027610F13');


      mmRock := BitmapFromString(5, 5, 'z78DA33363632357235B1347' +
           '63231839066C6A6A6A62E101297387E59647164596411630C7B91' +
           '490089AA205D');
      mmorangerock := BitmapFromString(4, 1, '433C2159442E7850348' +
           'F644F');
      orangerock := DTMFromString('78DA6364676060606540010556420C72409A1' +
           '188FF0301230B90C18CAAC65A8D01AE06041841E630A1AA69F7D3' +
           '4555C385690E861A90391C04EC02B9971D554DA01E0FAA1A664C7' +
           'FA1AB0100517209C1');

      attempt:=0
      if FindBitmapToleranceIn(mmrock,x,y,mmx1,mmy1,mmx2,mmy2,50) then
      begin
      mmrockcolor:=getcolor(x,y)
      writeln('Rock color:' +inttostr(mmrockcolor))
      freebitmap(mmrock)
        repeat
          attempt:=attempt+1;
          RadialWalkEx(x,y,MMCX,MMCY,MMROCKCOLOR,30,210,295,50)
          mouse(x,y,0,0,true)
          flag;
          wait(2000)
          RadialWalkEx(x,y,MMCX,MMCY,MMROCKCOLOR,30,210,295,50)
          mouse(x,y,1,1,true)
          wait(2000+random(500))
          flag;
          wait(100+random(500))
          mouse(590,66,5,5,true)
          flag;
          break;
          if attempt=10 then begin Logout; exit; end;
        until( FindColor(x,y,669784,MMX1,MMY1,648,123) or(attempt>10) )
       end else
        writeln('Cannot autocolor minimap rocks')
      repeat
        if attempt > 15 then
        begin
          writeln('Could not find ladder inside guild')
          nextplayer(false)
          exit;
        end;
        lowestangle
        makecompass('W')
        wait(2500)
          if FindObj3(x,y,'Ladder',669784,15) then
        begin
          mouse(x,y,0,0,false)
          if clickoption('Climb-up',1) then
          begin
          wentup:=true
          attempts:=0
          writeln('Left the guild')
          flag;
          wait(3000+random(200))
          highestangle;
          makecompass('N')
          players[currentplayer].loc := 'walking to bank'
          exit;
          end else
          begin
            clickoption('Cancel',1)
            attempts:=attempts +1
          end;
        end else
        begin
          writeln('Cant find the damn ladder.')
          Nextplayer(false)
          exit;
        end;
      until(wentup = true)
    end;



    procedure antiBannage;
    begin
      randomchatevery(2+random(10))
      randomrclickevery(2+random(10))
      leavescreenevery(2+random(10))
      hoverevery(2+random(10),'Mining')
      antiban;
      boredevery(2+random(10))
    end;

    procedure loadCoalBmps;
    begin
     coalRock1 := BitmapFromString(1, 8, '2F2F203938273C3C294444' +
           '2F44442F44442F44442F484831');

     coalRock2 := BitmapFromString(1, 6, 'z78DA3376367636B234C64' +
           'B020094EC080B');

     coalRock3 := BitmapFromString(1, 8, '44442F48483144442F4444' +
           '2F41412B41412B3C3C293C3C29');
    end;

    procedure freeCoalBmps;
    begin
      freebitmap(coalRock1)
      freebitmap(coalRock2)
      freebitmap(coalrock3)
    end;

    // By Sumilion and Lorax -- Edited by startblaster
    Function UpdateCoords(Var cx, cy: Integer; ax, ay, TheColor, Tol: Integer): Boolean;
    var
      Counter: Integer;
    Begin
      If (ax < 20) then ax := 20; If (ay < 20) then ay := 20;
      While (FlagPresent) and (FindColorSpiralTolerance(cx, cy, TheColor, ax-20, ay-20, ax+20, ay+20, Tol)) do
      begin
        ax := cx; ay := cy;
        Wait(15);
      end;
      If (ax < 10) then ax := 10; If (ay < 10) then ay := 10;
      While (FindColorSpiralTolerance(cx, cy, TheColor, ax-10, ay-10, ax+10, ay+10, Tol)) and (Counter < 60) do
      begin
        ax := cx; ay := cy;
        Counter := Counter + 1;
        Wait(15);
      end;
      Result := FindColorSpiralTolerance(cx, cy, TheColor, ax-10, ay-10, ax+10, ay+10, Tol);
      if (not Result) then
      else
    end;


    function findrocks:boolean;
    var
    Attempts:integer;
    begin
      if invcount=28 then
      begin
        players[currentplayer].loc := 'leaving guild'
        exit;
      end;
      makecompass('N')
      highestangle;
      rockfound:=false
      repeat
        attempts:=attempts+1
        if attempts >= 10 then
          begin
          writeln('Could Not Find A rock')
          result:=false
          break;
          end;
        if not loggedin then
        begin
          loginplayer;
          findrocks;
        end;
        if (FindBitmapspiralTolerance(coalRock1,x,y,MSX1,MSY1,MSX2,MSY2,10)) or  (FindBitmapspiralTolerance(coalRock2,x,y,MSX1,MSY1,MSX2,MSY2,10)) or (FindBitmapspiralTolerance(coalRock3,x,y,MSX1,MSY1,MSX2,MSY2,10)) then
        begin
        MMouse(x,y,2,2)
          if IsUpText('Mine') then
          begin
            rockcolor:=getcolor(x,y)
            rockfound:=true
            result:=true
          end else
          begin
            rockfound:=false
          end;
        end;
      until(rockfound = true)
    end;



    procedure mineIt;
    var cx,cy,rockcolor2,timer,leftorright:integer;

    begin
      leftorright:=0
      leftorright:= 1+random(9)
      if invcount=28 then
      begin
        players[currentplayer].loc := 'leaving guild'
        exit;
      end;
      if rockfound then
      begin
      if leftorright >=8 then
      begin
        mouse(x,y,3,3,false)
        clickoption('Mine',1)
      end else
      begin
      mouse(x,y,0,0,true)
      end;
         if UpdateCoords(cx,cy,x,y,rockcolor,10) then
       begin
          findfastrandoms
          findnormalrandoms
          rockcolor2:=getcolor(cx,cy)
          marktime(timer)
          repeat
            if findfastrandoms then findrocks exit;
            wait(50)
            if findnormalrandoms then findrocks exit;
            if gascheck(cx,cy) then
            begin
               findrocks;
               exit;
            end;
               if timefrommark(timer) > 12000 then
              begin
                exit;
              end;
            until(not(getcolor(cx,cy) = rockcolor2))
       end else
       begin
        writeln('UpdateCoords didnt work')
       end;
      end else
        begin
          mouse(79+random(320),72+random(250),0,0,false)
          clickoption('Walk here',1)
          findfastrandoms;
          findnormalrandoms
          flag;
          exit;
          end;
    end;

    procedure getChangeLog;
    begin
    writeln('')
    writeln('//------------- Changelog --------------\')
    writeln('')
    writeln('///////////////////////////////////////////')
    writeln('Version 1.00')
    writeln('')
    writeln('Original Release')
    writeln('')
    writeln('')
    Writeln('Version 1.1')
    Writeln('')
    Writeln('Fixed randoms ... maybe')
    Writeln('Axe can be in inv or equipped')
    Writeln('Fixed bank symbol')
    Writeln('Fixed walking before ladder')
    Writeln('You no longer move your mouse over a rock while mining it')
    writeln('///////////////////////////////////////////')
    end;

    procedure checkVersion;
    var
    versionString:string;
    Version:extended;
    begin
    cleardebug;
    writeln('//--------------------------------------\')
    writeln('//     Checking script version          \')
    writeln('//--------------------------------------\')

    versionstring:=(getpage('http://www.freewebs.com/scaralex/ScriptVersions/GuildMiner.txt'))
    version:= strtofloat(versionstring)
    if version > strtofloat(versionnumber) then
    begin
    writeln('//There is an updated version of the script!\')
    writeln('Go to [url]http://www.villavu.com/forum/showthread.php?t=8439[/url] to download update!')
    writeln('//////////////////////////////////////////////')
    terminatescript;
    end else
    writeln('//You have the most recent version      \')
    writeln('//////////////////////////////////////////')
    end;

    begin
      checkversion;
      getChangelog;
      setupsrl;
      MouseSpeed:=9;
      setupplayers;
      activateclient;
      antiBannage;
      if not loggedin then
      begin
        loginplayer;
        findpickheadcolor2;
      end;
    repeat
      if players[currentplayer].loc = '' then
      begin
        players[currentplayer].loc := 'mining'
      end;

      if players[currentplayer].loc = 'in bank' then
      begin
        depositores;
      end;

      if players[currentplayer].loc ='mining' then
      begin
        loadcoalbmps;
        findrocks;
        freecoalbmps;
      end;

      if players[currentplayer].loc ='mining' then
      begin
        mineIt;
      end;

      if players[currentplayer].loc = 'leaving guild' then
      begin
        leaveminingguild;
      end;
      if  players[currentplayer].loc = 'going to guild' then
      begin
        findpickheadcolor2;
        walktoguild;
      end;
      if players[currentplayer].loc = 'walking to bank' then
      begin
        walktobank;
      end;
    until(false)
    end.

  2. #2
    Join Date
    Dec 2006
    Location
    Australia
    Posts
    698
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I remeber their being error that after solving a random the script didnt have a command to complete like findcolor it would sit and cause bans. It could cause the use of excessive use of memory from an uncorrect loop.

  3. #3
    Join Date
    Oct 2006
    Location
    Ireland
    Posts
    855
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I dunno why it would happen to my and not anyone else though.

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
  •