Page 1 of 2 12 LastLast
Results 1 to 25 of 34

Thread: Writing JADReports on request

  1. #1
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Writing JADReports on request

    Whether you're a new scripter, an intermediate scripter, or an advanced scripter, there's always things that could be made more efficient in your script.

    Whether it be 1 to several line code shortenings, logic errors...etc., I'll do my best to read through your script thoroughly and report all of the problems I find.

    Example work:
    Quote Originally Posted by JAD View Post
    SCAR Code:
    procedure TheFormOnClose(Sender : TObject; var Action : TCloseAction);
    begin
      if (not(MainForm.ModalResult = 1)) then
        EndTheForm := True;
    end;

    Could be:
    SCAR Code:
    procedure TheFormOnClose(Sender : TObject; var Action : TCloseAction);
    begin
      EndTheForm := (not(MainForm.ModalResult = 1));
    end;


    In GetScriptData:
    SCAR Code:
    'versiondebug':
      begin
       ScriptLatestVersionL.caption := TheVersion;
        if (Version = TheVersion) then
        begin
          writeln('You have the Latest Version: ' + Version);
          ScriptDescriptionL.Caption := 'Script is up to date!';
          ScriptDescriptionL.Font.Color := clGreen;
          Exit;
        end else
         Writeln('You are OUTDATED, click the update button to get it.');
         ScriptDescriptionL.Caption := 'Script is Outdated!';
         ScriptDescriptionL.Font.Color := clRed;
      end;

    Should have a begin/end after the else?

    SCAR Code:
    'versiondebug':
      begin
       ScriptLatestVersionL.caption := TheVersion;
        if (Version = TheVersion) then
        begin
          writeln('You have the Latest Version: ' + Version);
          ScriptDescriptionL.Caption := 'Script is up to date!';
          ScriptDescriptionL.Font.Color := clGreen;
          Exit;
        end else
        begin //HERE
         Writeln('You are OUTDATED, click the update button to get it.');
         ScriptDescriptionL.Caption := 'Script is Outdated!';
         ScriptDescriptionL.Font.Color := clRed;
        end; //HERE
      end;

    Could be wrong, but I'm pretty sure. It would also make sense based on how the standards were.


    In Write:
    SCAR Code:
    case LowerCase(WhatToWrite) of
      'help':
         begin
         ShowMessage('Help:' + Chr(13) +
          'Declare your players before trying' + Chr(13) +
          'to press the start script button!' + Chr(13) +
          '' + Chr(13) +
          'Hope this helped.' + Chr(13));
         end;
       end;

    Could just be:
    SCAR Code:
    if LowerCase(WhatToWrite) = 'help' then
         begin
         ShowMessage('Help:' + Chr(13) +
          'Declare your players before trying' + Chr(13) +
          'to press the start script button!' + Chr(13) +
          '' + Chr(13) +
          'Hope this helped.' + Chr(13));
         end;

    No case of statements when there's only 1 case.


    Personally, I think with do's with things like:
    SCAR Code:
    with Lines do
        begin
          Add('Progress Reports');
        end;

    Looks more ugly. It would look better to just do:
    SCAR Code:
    Lines.Add('Progress Reports');

    Doesn't look bad to me at least.


    In StatsCheckOutput:
    SCAR Code:
    begin
      sa := Explode(#10, s);
      for i := 0 to High(sa) do
        if (Trim(sa[i]) <> '') then
          if StartsWith('ERROR(1)', sa[i]) then
          begin
            WriteLn('STATS: "' + sa[i] + '"');
            Stats_UserID := '';
            Stats_Password := '';
          end
          else if StartsWith('ERROR(2)', sa[i]) then
          begin
            WriteLn('STATS: "' + sa[i] + '"');
            Stats_ScriptID := '';
          end
          else
            WriteLn('STATS: "' + sa[i] + '"');

    end;

    That could be cleaned up with a case of statement:
    SCAR Code:
    begin
      sa := Explode(#10, s);
      for i := 0 to High(sa) do
      begin
        if not(Trim(sa[i]) <> '') then continue;
        WriteLn('STATS: "' + sa[i] + '"');
        if StartsWith('ERROR(1)', sa[i]) then
        begin
            Stats_UserID := '';
            Stats_Password := '';
        end else
        if StartsWith('ERROR(2)', sa[i]) then
          Stats_ScriptID := '' else
            WriteLn('STATS: "' + sa[i] + '"');
      end;
    end;

    Not that much shorter, but overall looks cleaner to me.


    In StatsSendReport:
    SCAR Code:
    else
      begin
        AddPostVariable (Client, 'sID', '-1');
      end;
    Should just be:
    SCAR Code:
    else
        AddPostVariable (Client, 'sID', '-1');


    ExpGained:
    SCAR Code:
    procedure ExpGained;          //Coh3n
    begin
      SetArrayLength(XpGain, 5)
        XpGain := [25, 37.5, 67.5, 175, 250];
      case Lowercase(Players[CurrentPlayer].Strings[0])of
        'tree' : g := 0;
        'oak' : g := 1;
        'willow' : g := 2;
        'yew' : g := 3;
        'magic' : g := 4;
      end;
    end;

    Could be:
    SCAR Code:
    procedure ExpGained;          //Coh3n
    var S: TStringArray;
        i: Integer;
    begin
      SetArrayLength(XpGain, 5)
      XpGain := [25, 37.5, 67.5, 175, 250];
      S := ['tree', 'oak', 'willow', 'yew', 'magic'];
      for i := 0 to 4 do
        if(S[i] = Lowercase(Players[CurrentPlayer].Strings[0]) then
          g := i;
    end;

    Yay 1 line shorter


    *tries hard to shorten Erik's code*

    Hmm..
    SCAR Code:
    5:  begin
              PickUpMouse;
              Wait(500 + Random(500));
            end;
        6:  begin
              GetClientDimensions(X, Y);
              MMouse(Random(X) + 1, Random(Y) + 1, 0, 0);
              Wait(500 + random(500));
            end;
        7:  begin
              GameTab(RandomRange(tab_Combat, tab_Notes));
              Wait(500 + Random(500));
              GameTab(tab_Inv);
            end;
        8:  begin
              SleepAndMoveMouse(5000 + Random(1000));
            end;

    Could be:
    SCAR Code:
    5: PickUpMouse;
        6:  begin
              GetClientDimensions(X, Y);
              MMouse(Random(X) + 1, Random(Y) + 1, 0, 0);
            end;
     5, 6: wait(500 + Random(500));
        7:  begin
              GameTab(RandomRange(tab_Combat, tab_Notes));
              Wait(500 + Random(500));
              GameTab(tab_Inv);
            end;
        8:  SleepAndMoveMouse(5000 + Random(1000));

    Unless my logic fails



    Here:
    SCAR Code:
    procedure AntiRandoms;
    begin
      FindNormalRandoms;
    end;

    Maybe you should check for an InFight, just to be safe?


    In AtYewTree:
    SCAR Code:
    Case Lowercase(WhichDirection) of
      'bottom': If FindSymbolDirection(P.x, P.y, 'tree', 'top') then
                  Result := True;
      'top': If FindSymbolDirection(P.x, P.y, 'tree', 'bottom') then
               Result := True;
      end;

    Could be:
    SCAR Code:
    Case Lowercase(WhichDirection) of
      'bottom': Result := FindSymbolDirection(P.x, P.y, 'tree', 'top') then
      'top': Result := FindSymbolDirection(P.x, P.y, 'tree', 'bottom') then
      end;


    In SwitchTree:
    SCAR Code:
    if FindSymbolDirection(P.x, P.y, 'tree', 'bottom') then
      begin
        mouse(P.x, P.y - 9, 3, 3, true);
        Result := true;
      end;
      if Not (Result) then
      begin
        if FindSymbolDirection(P.x, P.y, 'tree', 'top') then
        begin
          mouse(P.x, P.y + 9, 3, 3, true);
        end;
      end;

    Could be:

    SCAR Code:
    Result := FindSymbolDirection(P.x, P.y, 'tree', 'bottom');
    if(Result)then
      mouse(P.x, P.y - 9, 3, 3, true) else
        if FindSymbolDirection(P.x, P.y, 'tree', 'top') then
          mouse(P.x, P.y + 9, 3, 3, true);



    In WalkToDWillows:
    SCAR Code:
    if FindDTMRotated(BankDTM, P.x, P.y , 604, 63, 647, 99, -Pi, Pi, 0.3, WalkAngle) then
       begin
        if MFNFEx(P.x+20, P.y -33,5,5) then
          Result := true;
       end else Writeln('Couldnt use BankDTM');

    Could be:

    SCAR Code:
    if FindDTMRotated(BankDTM, P.x, P.y , 604, 63, 647, 99, -Pi, Pi, 0.3, WalkAngle) then
        Result := MFNFEx(P.x+20, P.y -33,5,5) else
          Writeln('Couldnt use BankDTM');

    The same could be done on the next 6 lines below that.


    In WalkToDWillowsBank:
    SCAR Code:
    if FindDTMRotated(BankDTM, P.x, P.y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, 0.3, WalkAngle) then
      begin
      if MFNFEx(P.x-8, P.y,2,6) then
        Result := true;
      end else Writeln('Couldnt find BankDTM');
      If Not (Result) then
       if FindSymbol(P.x, P.y, 'bank') then
       begin
         if MFNFEx(P.x, P.y,2,2) then
           Result := true;

    That's really rough on the eyes
    SCAR Code:
    if FindDTMRotated(BankDTM, P.x, P.y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, 0.3, WalkAngle) then
      Result := MFNFEx(P.x-8, P.y,2,6) else
        Writeln('Couldnt find BankDTM');
      If Not (Result) and FindSymbol(P.x, P.y, 'bank') then
         if MFNFEx(P.x, P.y,2,2) then
           Result := true;


    Then below that you have:
    SCAR Code:
    If Not (Result) then
       if FindSymbol(P.x, P.y, 'bank') then
       begin
         if MFNFEx(P.x, P.y,2,2) then
           Result := true;
       end else Writeln('Couldnt find Bank Symbol');
        if FindSymbol(P.x, P.y, 'fish') then
        begin
        If Not (Result) then
          if MFNFEx(P.x, P.y + 20, 6, 6) then
            if FindDTMRotated(BankDTM, P.x, P.y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, 0.3, WalkAngle) then
            begin
              if MFNFEx(P.x-7, P.y,3,6) then
                Result := true;
            end else Writeln('Couldnt find BankDTM');
        end;

    Change to:
    SCAR Code:
    If Not (Result) and FindSymbol(P.x, P.y, 'bank') and MFNFEx(P.x, P.y,2,2) then
      Result := true else
        Writeln('Couldnt find Bank Symbol');
      if FindSymbol(P.x, P.y, 'fish') then Not (Result) and MFNFEx(P.x, P.y + 20, 6, 6) and
      FindDTMRotated(BankDTM, P.x, P.y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, 0.3, WalkAngle) and
      MFNFEx(P.x-7, P.y,3,6) then
        Result := true else
          Writeln('Couldnt find BankDTM');

    Much shorter.


    Use same concepts for other walking procedures below that.



    In WalkToEdgeYews:
    SCAR Code:
    if not(Length(DirtColourTPA) > 1)then
        Exit
      else
       DirtColourATPA:= SplitTPAEx(DirtColourTPA, 4, 4);
       SortATPASize(DirtColourATPA, True);
       P := MiddleTPA(DirtColourATPA[0]);
       //...etc.

    Shouldn't it be an else begin/end?


    In GEYewWalk:
    SCAR Code:
    Case Random(2) Of
             0: begin
                     if walktotile(point(3168, 3489), 2, 8) then
                     Writeln('Made it to the first step ToYews');
                     if walktotile(point(3181, 3490), 2, 8) then
                     Writeln('Made it to the second step ToYews');
                     if walktotile(point(3195, 3494), 2, 8) then
                     Writeln('Nearly there ToYews');
                     if walktotile(point(3207, 3503), 2, 8) then
                     Writeln('Woop we made it ToYews');
                end;
             1: begin
                     if walktotile(point(3169, 3489), 2, 8) then
                     Writeln('Made it to the first step ToYews');
                     if walktotile(point(3184, 3490), 2, 8) then
                     Writeln('Made it to the second step ToYews');
                     if walktotile(point(3196, 3497), 2, 8) then
                     Writeln('Nearly there ToYews');
                     if walktotile(point(3206, 3502), 2, 8) then
                     Writeln('Woop we made it ToYews');
                end;
             2: begin
                     if walktotile(point(3169, 3491), 2, 8) then
                     Writeln('Made it to the first step ToYews');
                     if walktotile(point(3187, 3489), 2, 8) then
                     Writeln('Made it to the second step ToYews');
                     if walktotile(point(3200, 3502), 2, 8) then
                     Writeln('Nearly there ToYews');
                     if walktotile(point(3207, 3504), 2, 8) then
                     Writeln('Woop we made it ToYews');
                end;
             end;

    That random(2) should be a random(3) if you want it to ever do the last path. Random(2) would only pick 0 or 1, never 2.


    Same for GEYewBank.


    I really think you should take out all of those writeln's after the if(WalkToTile)'s. No point really unless you are going to put in a fail safe.


    In WaitInvCount:
    SCAR Code:
    Result := false;
      T := GetSystemTime + Maxtime;
      while GetSystemTime < T do
      begin
        wait(10);
        if InvCount = Count then
        begin
          Result := true;
          break;
        end;
      end;

    Change to:
    SCAR Code:
    T := GetSystemTime + Maxtime;
      while GetSystemTime < T do
      begin
        wait(10);
        Result := InvCount = Count;
        if(Result)then break;
      end;



    In LoadTree, take out all of the
    SCAR Code:
    Name :=

    In each different case, and just put at the top of the function:

    SCAR Code:
    Result.Name := LowerCase(which);


    On line 2231:
    SCAR Code:
    wait(9000);

    Randomness is probably necessary.



    Sorry, I started to get extremely bored so I just slightly skimmed over the last part of the script but didn't see anything significant.

    Try to get rid of some of the redundancies in your walking by making a function. You repeat a lot of the exact same stuff several times in walking procedures, so making that into 1 function then calling it could really cut down on code + make the script more readable (and easier to add new locations).

    Quote Originally Posted by JAD View Post
    You have the player array at default not working. How many players is 3, but there's only 1 player? Change HowManyPlayers to 1 or add 2 more players.

    Why not make Load (in the constants) a variable in the player array? That way, each player can do a different amount of loads. Add it as an integers variable like:
    SCAR Code:
    with Players[0] do
    begin
      Integers[0] := 10; //Loads Until Next Player
      //...etc.
    end;

    Then to use it later, you would just do like:
    SCAR Code:
    if(Players[CurrentPlayer].Integers[0] > LoadsDone)then


    In DebugText:
    SCAR Code:
    case SpamDebugBox of
        True:
        begin
          Writeln(what);
          Status(what);
          Disguise(what);
        end;
        False: Status(what);
      end;

    Why use a case? You should only use a case (normally) if you are testing more than 2 conditions. Shortened:
    SCAR Code:
    if(SpamDebugBox)then
      begin
        Writeln(what);
        Status(what);
        Disguise(what);
      end else
        Status(what);

    Even shorter would simply be this:
    SCAR Code:
    if(SpamDebugBox)then
      begin
        Writeln(what);
        Disguise(what);
      end;
      Status(what);


    In the progress report, you have a possible infinite loop:
    SCAR Code:
    repeat
        X := GetSkillInfo('Smithing', False);
      until(X > 0);

    What if it is unable to obtain the skill info? Then this will go on forever. You should also have a wait in there to prevent lag as well:

    SCAR Code:
    MarkTime(Timer);
      repeat
        X := GetSkillInfo('Smithing', False);
        wait(100+random(50));
      until(X > 0) or (TimeFromMark(Timer) > 2000+random(500));


    In Prog, this could hardly be more ugly:
    SCAR Code:
    case what of
        'full':
        begin
          WriteLn('----------------------------');
          WriteLn('----------------------------');
          WriteLn('');
          WriteLn('Newbiz Smither East Fally ');
          WriteLn('');
          WriteLn('Ran For '+ TimeRunning);
          If Bars > 0 then
            WriteLn('Bars Made : '+IntToStr(Bars));
          If Loads > 0 then
            WriteLn('Loads done ' + IntToStr(Loads));
          if X > 0 then
          WriteLn('X');
          WriteLn('');
          WriteLn('----------------------------');
          WriteLn('----------------------------');
          Writeln('Player Info:');
          WriteLn('');
          WriteLn('|---------------------------');
          Disguise('-• Loads Done: ' + IntToStr(Loads)+'•––');
          for i := 0 to HowManyPlayers - 1 do
           // WriteLn('|' + Capitalize(Players[i].nick));
            WriteLn('| ' + Players[i].loc);
        //    WriteLn('|'  +booltostr(Players[i].Active));
            WriteLn('|---------------------------');
            WriteLn('|---------------------------');
        end;
        'small':
        begin
          WriteLn('|---------------------------');
          WriteLn('|---------------------------');
          Writeln('Player Info:');
          WriteLn('');
          WriteLn('|---------------------------');
          Disguise('-• Loads Done: ' + IntToStr(Loads)+'•––');
          for i := 0 to HowManyPlayers - 1 do
        //    WriteLn('|' + Capitalize(Players[i].nick));
            WriteLn('| ' + Players[i].loc);
         //   WriteLn('|' + +booltostr(Players[i].Active));
            WriteLn('|---------------------------');
            WriteLn('|---------------------------');
        end;
      end;

    Lets at least take out the comments, move the repetitive stuff down, get rid of the case, and fixed standards a little:

    SCAR Code:
    WriteLn('----------------------------');
    WriteLn('----------------------------');
    if(LowerCase(what) = 'full')then
        begin
          WriteLn('');
          WriteLn('Newbiz Smither East Fally ');
          WriteLn('');
          WriteLn('Ran For '+ TimeRunning);
          If Bars > 0 then
            WriteLn('Bars Made : '+IntToStr(Bars));
          If Loads > 0 then
            WriteLn('Loads done ' + IntToStr(Loads));
          if X > 0 then
          WriteLn('X');
          WriteLn('');
          WriteLn('----------------------------');
          WriteLn('----------------------------');
        end;
        Writeln('Player Info:');
        WriteLn('');
        WriteLn('|---------------------------');
        Disguise('-• Loads Done: ' + IntToStr(Loads)+'•––');
        for i := 0 to HowManyPlayers - 1 do
          WriteLn('| ' + Players[i].loc);
        WriteLn('|---------------------------');
        WriteLn('|---------------------------');

    Everything that was done in small was also done in full, so that was very redundant.


    In FindOre, you have a begin end in the middle of nowhere:
    SCAR Code:
    begin
      begin
        case what of
          'iron':   Color:=2305869;
          'silver': Color:=11971499;
          'coal':   Color:=2702653;
          'gold':   Color:=1815515;
        end;
      end;

    Why? Do:
    SCAR Code:
    begin
      case what of
        'iron':   Color:=2305869;
        'silver': Color:=11971499;
        'coal':   Color:=2702653;
        'gold':   Color:=1815515;
      end;


    Here:
    SCAR Code:
    function FallyRdColor: Integer;
    begin
      if not FindFallyRoadColor then
      begin
        Result := FindFallyRRDColor;
        Exit;
      end else Result:= FindFallyRoadColor;
    end;

    What? That made no sense.. You could simply do Result := FindFallyRoadColor:
    SCAR Code:
    function FallyRdColor: Integer;
    begin
      Result:= FindFallyRoadColor;
    end;


    In Walk, you should check if not logged in then Exit at the beginning of the function? You should move it to the top of the function. Also, you only FFlag on the fail safe, not on the original walk.. So if the script doesn't use the fail safe once, then it won't flag. It will just go onto the next walking.


    In FindPerson:
    SCAR Code:
    for I := 0 To Length(Person) do
      MMouse(Person[i].X , Person[i].Y , 5, 5);
      if IsUpText('alk') then
        Result:= True;

    I think you're missing a begin/end here? You don't want it to move the mouse to all the points, then check the up text. You want to check it after each time. Also, you want to break if it finds the uptext then:
    SCAR Code:
    for I := 0 To Length(Person) do
    begin
      MMouse(Person[i].X , Person[i].Y , 5, 5);
      Result := IsUpText('alk');
      if(Result)then break;
    end;


    In your main loop, you do NextPlayer(true) even if not logged in? You want the players .active to be false if not logged in. So in that loop, do
    SCAR Code:
    if not loggedin then NextPlayer(false);
    Quote Originally Posted by JAD View Post
    In barter,

    SCAR Code:
    rok := BitmapFromString(7, 8, 'beNrzMzfRlHUxU3OzUPe20fK10w5' +
           'y0gOS5jryQEEPK02gYICDboizPpC01FNAVhbpbgQkbQyU4MrCXA1i' +
           'vUyAiu2NlJGVxfuYpgZaAg0EisCVAUWACGggUBCoJdrTGMhNDrAAI' +
           'rhpEG6in3kiABt/KeY=');
      gstorewin := BitmapFromString(7, 10, 'beNqz0dFUFLA2UQ72sYkJ' +
           'dXG2AXGlhFmMdWTyMyIWz+kBoprSVHcHA2UZHqAaiAgQdTYVJUZ5A' +
           'pUBtQDFM5OCgAjIAHKBgkAtRdnREEE4gggCdQER0C6gYh9XU6Ag0C' +
           'JkQaBduASBhsAFgXqBdkFsgQhCDHQGADr4RYE=');
      x := mscx;
      y := mscy;
       if(not(loggedin))then exit;

    You declare the bitmaps before checking if not logged. This is bad because it will exit the procedure without freeing the bitmaps if you weren't logged in. Try checking it before like so:
    SCAR Code:
    if(not(loggedin))then exit;
    rok := BitmapFromString(7, 8, 'beNrzMzfRlHUxU3OzUPe20fK10w5' +
           'y0gOS5jryQEEPK02gYICDboizPpC01FNAVhbpbgQkbQyU4MrCXA1i' +
           'vUyAiu2NlJGVxfuYpgZaAg0EisCVAUWACGggUBCoJdrTGMhNDrAAI' +
           'rhpEG6in3kiABt/KeY=');
      gstorewin := BitmapFromString(7, 10, 'beNqz0dFUFLA2UQ72sYkJ' +
           'dXG2AXGlhFmMdWTyMyIWz+kBoprSVHcHA2UZHqAaiAgQdTYVJUZ5A' +
           'pUBtQDFM5OCgAjIAHKBgkAtRdnREEE4gggCdQER0C6gYh9XU6Ag0C' +
           'JkQaBduASBhsAFgXqBdkFsgQhCDHQGADr4RYE=');
      x := mscx;
      y := mscy;


    Also, you have a begin/end right in the middle of nowhere after if not logged in then Exit. Fixed some stuff:
    SCAR Code:
    makecompass('w');
         setangle(true);
         findcolorsspiraltolerance(x, y, TPA,15393002, msx1, msy1, msx2, msy2, 10);
         if(GetArrayLength(TPA) > 0)then
         begin
           mmouse(tpa[0].x, tpa[0].y, 3, 3);
           if(waituptext('to',300+random(200)))then
            begin
              Getmousepos(x,y);
              mouse(tpa[0].x, tpa[0].y, 3, 3,false);
              wait(500+random(500));
              waitoption('rade', 200 + random(100));
              MarkTime(N);
              repeat
              wait(3000+random(500));
              until(FindBitmapToleranceIn(gstorewin, x, y, MSX1, MSY1, MSX2, MSY2, 20))  or (TimeFromMark(N) >= 20000)
              if(TimeFromMark(N) >= 20000) then exit;
              If(FindBitmapToleranceIn(rok, x, y, MIX1, MIY1, MIX2, MIY2, 20))then
               begin
               repeat
                 mouse(x,y,3,3,false);
                 chooseoption('50');
                 wait(1000+random(500));
               until not(FindBitmapToleranceIn(rok, x, y, MIX1, MIY1, MIX2, MIY2, 20))
                 closewindow;
                 makecompass('s')
                 arrangeinv;
                 wait(1000+random(100))
               end;
            end;
         end;
         freebitmap(rok);
         freebitmap(gstorewin);

    Your semicolons are missing after a lot of functions/procedures, and it's not consistent. It's good practice to put them after all. I also moved your FreeBitmaps down to the bottom of the procedure, because the way you had it, they were only freed under certain conditions (and we want to free them)

    You also forgot to free your gstorewin bitmap, so I added that.


    After moving the mouse and checking the uptext, you have:
    SCAR Code:
    mouse(tpa[0].x, tpa[0].y, 3, 3,false);

    Why would we want to click at a different spot then we moved the mouse to? You did a GetMousePos(x,y) because that's where we found the object at, so you should do:
    SCAR Code:
    Mouse(x,y,0,0,false);


    After clicking the mouse:
    SCAR Code:
    mouse(x,y,0,0,false); //Changed to what I showed above
              wait(500+random(500))
              waitoption('rade', 200 + random(100));

    That random wait is unnecessary. Just add a longer wait period to the WaitOption like so:
    SCAR Code:
    mouse(x,y,0,0,false); //Changed to what I showed above
              waitoption('rade', 700 + random(600));

    That will have the same effect, except it will click the option right when it finds it, which is ideal.


    SCAR Code:
    repeat
              wait(3000+random(500));
              until(FindBitmapToleranceIn(gstorewin, x, y, MSX1, MSY1, MSX2, MSY2, 20))  or (TimeFromMark(N) >= 20000)

    That's a really long wait there in the repeat until. If the gstorewin pops up at a normal rate, the script will go on to wait an additional 2 and a half seconds or more. Try simply doing:

    SCAR Code:
    repeat
              wait(500+random(300));
              until(FindBitmapToleranceIn(gstorewin, x, y, MSX1, MSY1, MSX2, MSY2, 20))  or (TimeFromMark(N) >= 20000+random(5000))

    Also added a randomness to the TimeFromMark check just to be safe.


    Here:
    SCAR Code:
    If(FindBitmapToleranceIn(rok, x, y, MIX1, MIY1, MIX2, MIY2, 20))then
               begin
               repeat
                 mouse(x,y,3,3,false);
                 chooseoption('50');
                 wait(1000+random(500))
               until not(FindBitmapToleranceIn(rok, x, y, MIX1, MIY1, MIX2, MIY2, 20))

    Shouldn't you check some uptext before right clicking? Also a WaitOption would probably be better in case of lag. What if it always finds the bitmap with tolerance rok? Fail safe? Try adding a MarkTime fail safe here so to avoid the infinite loop.


    SCAR Code:
    If(FindBitmapToleranceIn(rok, x, y, MIX1, MIY1, MIX2, MIY2, 20))then

    What if it didn't find that bitmap? We could try searching for a color instead as a fail safe or using a DTM?



    In walktomsym, what if it didn't find the symbol mine? You should also turn this into a function:
    SCAR Code:
    function walktomsym: Boolean;
    begin
      if(not(loggedin))then exit;
      Result := FindSymbol(x,y,'mine');
      if(Result)then
      begin
      mouse(x,y,3,3,true)
      flag;
     end;
    end;

    Now you can later do like
    SCAR Code:
    if(not(walktomsym))then
    begin
      Logout;
      Exit;
    end;
    Or something like that.

    In walktomsym, you could also try a loop and continually decrease the symbol accuracy until the script finds it. You could also try a DDTM to walk there as a fail safe as well. Pretty much, if the symbol is covered/not found, the script will be over with.

    In WalkToMine, you just do coordinates clicking? And with very little randomness.. This would be very detectable. Try using RadialWalking, DDTMs or TPAs to walk instead of coordinates clicking.


    In DropIt:
    SCAR Code:
    repeat
           mouse(x,y,3,3,false)
           wait(100+random(50))
           chooseoption('rop')
           wait(300+random(200))
         until(not(FindBitmapToleranceIn(rok, x, y, MIX1, MIY1, MIX2, MIY2, 20)))

    Another possible infinite loop. I'd also consider checking the uptext.


    In MineIt, things like:
    SCAR Code:
    and (Players[currentplayer].booleans[0]=true) then

    Could simply be:
    SCAR Code:
    and (Players[currentplayer].booleans[0]) then


    Again in MineIt, this:
    SCAR Code:
    mouse(x,y,3,3,false);

    Should have 0,0 as the randomness parameters.


    In WalkIt, you should really use some fail safes with those radial walks. What if it didn't radial walk? Should you use some tolerance? Could you use a DDTM (or other means) back up?


    SCAR Code:
    procedure invcheck;
    begin
      if(not(loggedin))then exit;
      If(invfull) and (Players[currentplayer].booleans[0]=true) then
      begin
         Dropit;
      end  else
        If(invfull) and (Players[currentplayer].booleans[0]=false) then
        begin
          walkit;
        end;
    end;

    That is very ugly. Try:
    SCAR Code:
    procedure invcheck;
    begin
      if(not(loggedin)) or not(InvFull) then exit;
      If(Players[currentplayer].booleans[0]) then
         Dropit else
          walkit;
    end;

    Much cleaner right? And it will do the exact same thing


    In SendEmail:
    SCAR Code:
    if (Email > '') then Result := true
    else
    begin
    Result := false;
    Writeln('Emailing User Failed!');
    end;

    Could just be:
    SCAR Code:
    Result := (Email > '');
    if not(Result)then
      Writeln('Emailing User Failed!');


    In ScriptTerminate:
    SCAR Code:
    case Lowercase(Players[currentplayer].strings[0]) of
          'iron': writeln('|Mined iron!');
          'copper': writeln('|Mined copper!');
          'tin':writeln('|Mined tin!');
      end;
      case (Players[currentplayer].booleans[0]) of
          false: writeln('|Mined and sold');
          true: writeln('|Powermined');
      end;

    Could just be:
    SCAR Code:
    Writeln('|Mined ' + LowerCase(Players[CurrentPlayer].Strings[0]) + '!');
      if(Players[currentplayer].booleans[0])then
        writeln('|Powermined') else
          writeln('|Mined and sold');



    In LogChecker:
    SCAR Code:
    if(not(loggedin))then
        begin
         writeln('randomly logged out,switching');
         nextplayer(false);
         result:=true;
        end else
          if(not(loggedin)) and (allplayersinactive)then
            begin
              writeln('randomly logged out and no more players, done');
              terminatescript;
              result:=true;
            end else
              result:=false;

    That will never execute the second if then check. Because the else indicates that it will only do it if loggedin, and that if then requires it to not be loggedin. Get what I'm saying? I think what you meant was:
    SCAR Code:
    Result := false;
    if(not(loggedin))then
    begin
      writeln('randomly logged out,switching');
      nextplayer(false);
      result:=true;
    end;
    if(allplayersinactive)then
    begin
      writeln('randomly logged out and no more players, done');
      terminatescript;
      Result := true;
    end;

    Something more along those lines.



    In the mainloop:
    SCAR Code:
    repeat
          logchecker;
          findnormalrandoms;
          mineit;
          invcheck;
          findnormalrandoms;
          logchecker;
        until(loads >= Players[CurrentPlayer].Integers[0])

    What if the user got logged out? You should put a:
    SCAR Code:
    if not LoggedIn then NextPlayer(False);

    Here, or a:
    SCAR Code:
    if not LoggedIn then Break;

    Or something. Otherwise, it could be an infinite loop.
    To show a few of my recent works.


    If anybody would like a full critique of their script post here. It would be prefered if you could post the script in SCAR tags.

    Cheers,
    ~JAD
    Last edited by Sir R. M8gic1an; 10-20-2009 at 09:14 AM.

  2. #2
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you should...like....charge cash for your time lol.
    thats how great of an effort your doing with these, rep+ for all of those great script-pull-aparts!

    EDIT; lold @ ur siggy, cause i saw what YoHoJo had changed it to before xD
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  3. #3
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Can you take a look at this? .

    SCAR Code:
    {.Script Info:
    # ScriptName  = Soul Wars!
    # Author      = Sandstorm and NiCbaZ.
    # Description = Walks into Soul Wars game walks to an afk spot,
    # Desc. Cont. = sits and antibans until it's outside. Repeats
    # Version     = 1.3
    # Date        = February 15th, 2009.
    # Comments    = Err... None.
    /Script Info
    Credits:
    05hartor for letting me borrow his account to develop the script on.
    }

    Program New;
    {.Include SRL\SRL\Misc\Smart.Scar}
    {.Include SRL\SRL.Scar}
    {.Include SRL\SRL\Reflection\Reflection.Scar}

    const
      ChanceToAntiban = 3000; //How often to do antiban? The higher, the less often.
      WhichWorld = 0; //Which favorite world do you wish to use? Set to zero to disable.
      SwitchTeams = True; //Switch teams based on who won the last game?
      Switch = True; //Switch players?
      Rest = True; //Use breaks?
      TimeL = 10; //How long to break for? In minutes. Adds a random amount.
    //Random amount = Time to break / 10 rounded down.

    var
      TeamString, Team: string;
      Chances, TeamInteger, GameCount, GamesPlayed, GamesWon, GamesLost : Integer;
      GamesDrawn, Antibanz, Zeal, Iz : Integer;
      Guthix, EndInitForm : Boolean;
      frmDesign, Authorization : TForm;
      PageControl : TPageControl;
      TabPages : array of TTabSheet;
      PlayersZ, GroupBox2 : array of TGroupBox;
      Label2, Label3, Label4, Label5, Label10, Label6, Label7, Label8, Label9, Label15 : array of TLabel;
      Username, Edit2, Edit3, Edit4, Edit5 : array of TEdit;
      Button2, Button1 : array of TButton;
      ComboBox1, ComboBox2, ComboBox3 : array of TComboBox;
      AuthUser, AuthPass : TEdit;
      ButtonStart : TButton;

    procedure ProgressReport;
    begin
      ClearDebug;
      GamesDrawn := GamesPlayed - GamesLost - GamesWon;
      Zeal := (GamesWon * 3) + (GamesDrawn * 2) + (GamesLost * 1);
      WriteLn('[' + Padr('You won: ' + IntToStr(GamesWon) + ' games.', 80) + ']');
      WriteLn('[' + Padr('You lost: ' + IntToStr(GamesLost) + ' games.', 80) + ']');
      WriteLn('[' + Padr('You drawn: ' + IntToStr(GamesDrawn) + ' games.', 80) + ']');
      WriteLn('[' + Padr('You have played: ' + IntToStr(GamesPlayed) + ' games.', 80) + ']');
      WriteLn('[' + Padr('You have gained: ' + IntToStr(Zeal) + ' zeal.', 80) + ']');
      WriteLn('[' + Padr('You have performed: ' + IntToStr(Antibanz) + ' antibans', 80) + ']');
      WriteLn('[' + Padr('The script has been running for: ' + TimeRunning, 80) + ']');
      WriteLn('[' + Padr('Thanks for using the Soul Wars Lite by Sandstorm!', 80) + ']');
    end;

    procedure SetupSmart;
    begin
      SmartSetupEx(144, True, true, false);
      while (not RSReady) and (not (IsFkeyDown(9))) do
        wait(100);
      SetTargetDC(SmartGetDC);
    end;

    function Contain(Stringz, Strings: string): Boolean;
    begin
      Result := Pos(Stringz, Strings) <> 0;
    end;

    function AntiBan(Chance: Integer): Boolean;
    var
      x, y: Integer;
    begin
      if not (LoggedIn) then
        Exit;
      case random(Chance) of
        0:
          begin
            PickUpMouse;
            Result := True;
            Inc(Antibanz);
          end;
        1:
          begin
            Result := True;
            GameTab(1 + Random(12));
            Inc(Antibanz);
          end;
        2:
          begin
            Result := True;
            RandomRclick;
            Inc(Antibanz);
          end;
        3:
          begin
            Result := True;
            randomMovement;
            Inc(Antibanz);
          end;
        4:
          begin
            Result := True;
            MMouse(Random(MSX2), Random(MSY2), Random(MSX2), Random(MSY2));
            Inc(Antibanz);
          end;
        5:
          begin
            HoverSkill('random', false);
            sleepandmovemouse(200 + Random(100));
            gametab(4);
            MMouse(Random(MSY1), Random(MSX1), Random(MSX2), Random(MSY2));
            Inc(Antibanz);
          end;
        6:
          begin
            GameTab(1 + Random(13));
            wait(1000 + Random(600));
            Result := True;
            Inc(Antibanz);
          end;
        7:
          begin
            HoverSkill('random', false);
            sleepandmovemouse(200 + Random(100));
            Result := True;
            Inc(Antibanz);
          end;
        8:
          begin
            Result := True;
            MMouse(x, y, (10 + random(350)), (10 + random(200)));
            Inc(Antibanz);
          end;
        9:
          begin
            Result := True;
            MMouse(Random(MSX2), Random(MSY2), Random(MSX2), Random(MSY2));
            Inc(Antibanz);
          end;
      end;
    end;

    procedure DoAntiBans;
    begin
      if Chances <= 0 then
        Chances := 50;
      if Chances < 50 then
        Chances := 50;
      if Antiban(Chances) then
      begin
        Chances := ChanceToAntiban;
      end
      else
        Chances := Chances - randomrange(1, 5);
    end;

    function DidIDie: Integer;
    begin
      Result := 0;
      if PointInBox(GetMyPos, IntToBox(1816, 3220, 1823, 3230)) then
        Result := 1;
      if PointInBox(GetMyPos, IntToBox(1841, 3217, 1843, 3219)) then
        Result := 2;
      if PointInBox(GetMyPos, IntToBox(1932, 3244, 1934, 3246)) then
        Result := 3;
      if PointInBox(GetMyPos, IntToBox(1951, 3234, 1958, 3244)) then
        Result := 4;
    end;

    function InWaitingRoom(Team: string): Boolean;
    begin
      case Lowercase(Team) of
        'zamorak': Result := PointInBox(GetMyPos, IntToBox(1900, 3157, 1909, 3166));
        'saradomin': Result := PointInBox(GetMyPos, IntToBox(1871, 3159, 1879, 3166));
      end;
    end;

    function InAWaitingRoom: Boolean;
    begin
      Result := InWaitingRoom('saradomin') or InWaitingRoom('zamorak');
    end;

    function OutOfGame: Boolean;
    begin
      Result := TileOnMM(Point(60 - 1899, 77 - 3162)) or TileOnMM(Point(60 - 1880, 77 - 3162));
    end;

    procedure ToPortal(Portal: Integer);
    begin
      if not OutOfGame then
        Exit;
      case Portal of
        1:
          begin
            if not TileOnMM(Point(60 - 1899, 77 - 3162)) then
              WalkToTile(Point(60 - 1890, 77 - 3164), 2, 1);
            WalkToTile(Point(60 - 1899, 77 - 3162), 2, 1);
          end;
        2:
          begin
            if not TileOnMM(Point(60 - 1880, 77 - 3162)) then
              WalkToTile(Point(60 - 1890, 77 - 3164), 2, 1);
            WalkToTile(Point(60 - 1880, 77 - 3162), 2, 1);
          end;
        3: WalkToTile(Point(60 - 1891, 77 - 3163), 2, 1);
      end;
    end;

    Function TimeRemaining(Procedures : String) : Variant;
    Begin
      Case Lowercase(Procedures) of
        'enterportal' : Result := Contain('ou left a', GetInterfaceText(211, 1));
        'waiting' : Result := GetNumbers(GetInterfaceText(211, 1));
      End;
    End;

    Procedure Waiting;
    Var
      C : Integer;
    Begin
      C := StrToInt(TimeRemaining('waiting'))
      Logout;
      Wait(C * 60 * 1000 + random(10000));
      LoginPlayer;
    End;

    procedure HandleChat;
    var
      x, y: Integer;
    begin
      If TimeRemaining('enterportal') Then
        Waiting;
      while FindText(x, y, 'lease wait', npcChars, MCX1, MCY1, MCX2, MCY2) do
        Wait(750);
      if Guthix then
        ClickText('nter portal.', npcChars, MCX1, MCY1, MCX2, MCY2, true)
      else
        ClickText('nter waiting area', npcChars, MCX1, MCY1, MCX2, MCY2, true);
    end;

    procedure EnterPortal(Portal: Integer);
    var
      P: Tpoint;
      X, Y: Integer;
      C: TMe;
    begin
      if InWaitingRoom('saradomin') or InWaitingRoom('zamorak') then
        Exit;
      case Portal of
        1:
          begin
            MakeCompass('e');
            If TimeRemaining('enterportal') Then
              Waiting;
            if ClickToContinue then
              HandleChat;
            if not TileOnMS(Point(60 - 1900, 77 - 3162), 0) then
              ToPortal(1);
            C := GetMe;
            if C.Speed = 0 then
            begin
              P := TileToMSEx(Tile(1900, 77 - 3162.5), 5);
              MMouse(P.x, P.y, 3, 3);
              Wait(500);
              if IsUpText('ed barr') then
              begin
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, true);
              end;
              If TimeRemaining('enterportal') Then
                Waiting;
              if ClickToContinue then
                HandleChat;
              if ClickToContinue then
                HandleChat;
            end;
          end;
        2:
          begin
            MakeCompass('w');
            If TimeRemaining('enterportal') Then
              Waiting;
            if ClickToContinue then
              HandleChat;
            if not TileOnMS(Point(60 - 1879, 3162), 0) then
              ToPortal(2);
            C := GetMe;
            if C.Speed = 0 then
            begin
              P := TileToMSEx(Tile(1879, 3162.5), 5);
              MMouse(P.x, P.y, 3, 3);
              Wait(500);
              if IsUpText('lue barr') then
              begin
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, true);
              end;
              If TimeRemaining('enterportal') Then
                Waiting;
              if ClickToContinue then
                HandleChat;
              if ClickToContinue then
                HandleChat;
            end;
          end;
        3:
          begin
            MakeCompass('s');
            If TimeRemaining('enterportal') Then
              Waiting;
            if ClickToContinue then
              HandleChat;
            if not TileOnMS(Point(60 - 1891, 77 - 3163), 0) then
              ToPortal(3);
            C := GetMe;
            if C.Speed = 0 then
            begin
              P := TileToMSEx(Tile(1891, 77 - 3163), 5);
              MMouse(P.x, P.y, 3, 3);
              Wait(500);
              if IsUpText('eam Ba') then
              begin
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, true);
              end;
              If TimeRemaining('enterportal') Then
                Waiting;
              if ClickToContinue then
                HandleChat;
              if ClickToContinue then
                HandleChat;
            end;
          end;
      end;
    end;

    function ABFlag: Boolean;
    var
      timeout, x, y: Integer;
    begin
      if (FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2)) then
      begin
        Result := True;
        repeat
          Wait(100);
          DoAntiBans;
          if (SRL_Procs[srl_AntiBan] <> nil) then
            SRL_Procs[srl_AntiBan]();
          timeout := timeout + 1;
        until (not FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2)) or (timeout > 300);
      end;
    end;


    function WalkToPath(Path: TPointArray): Boolean;
    var
      I: integer;
      Last, II, Dist: Integer;
      P: TPoint;
      DoTile: Integer;
    begin
      case random(3) of
        1: SetRun(true);
      end;
      P := GetMyPos;
      Last := 1 shl 20;
      for II := 0 to High(Path) - 1 do
      begin
        Dist := Distance(P.x, P.y, Path[II + 1].x, Path[II + 1].y);
        if (Dist > Last) then Continue;
        Last := Dist;
        DoTile := II;
      end;
      if (not(WalkToTile(Path[DoTile + 1], 1, 10))) then
      begin
        Result:= False;
        Exit;
      end else
      for I := DoTile + 1 to High(Path) - 1 do
      begin
        if not (WalkToTile(Path[i + 1], 1, 3)) then
        begin
          Exit;
          Result:= False;
        end else
        begin
          ABFlag;
        end;
      end;
      Result := True;
    End;

    function SoulWalk(WhereTo : Integer): boolean;
    Var
      Paths : Array[0..4] of TPointArray;
    Begin
      Paths[1] := [Point(60 - 1815, 77 - 3225), Point(60 - 1807, 77 - 3232), Point(60 - 1811, 77 - 3244), Point(60 - 1820, 77 - 3246), Point(60 - 1829, 77 - 3244), Point(60 - 1836, 77 - 3247), Point(60 - 1844, 77 - 3247)];
      Paths[2] := [Point(60 - 1842, 77 - 3230), Point(60 - 1842, 77 - 3238), Point(60 - 1844, 77 - 3247)];
      Paths[3] := [Point(60 - 1934, 77 - 3231), Point(60 - 1929, 77 - 3222), Point(60 - 1928, 77 - 3212)];
      Paths[4] :=[Point(60 - 1968, 77 - 3233), Point(60 - 1966, 77 - 3223), Point(60 - 1961, 77 - 3213), Point(60 - 1950, 77 - 3217), Point(60 - 1939, 77 - 3220), Point(60 - 1929, 77 - 3216), Point(60 - 1927, 77 - 3213)];
      Result := WalkToPath(Paths[WhereTo]);
    end;

    Function InGraveYard(WhichOne : Integer) : Boolean;
    Begin
      Case WhichOne Of
        1 : Result := PointInBox(GetMyPos, IntToBox(60 - 1841, 77 - 3217, 60 - 1843, 77 - 3219));
        4 : Result := PointInBox(GetMyPos, IntToBox(60 - 1932, 77 - 3244, 60 - 1934, 77 - 3246));
      End;
    End;

    Function InPyreSpot(WhichOne : Integer) : Boolean;
    Begin
      Case WhichOne Of
        1 : Result := PointInBox(GetMyPos, IntToBox(1837, 3238, 1855, 3255));
        4 : Result := PointInBox(GetMyPos, IntToBox(1922, 3205, 1936, 3220));
      End;
    End;

    Procedure ToPyre(WhichOne : Integer);
    Begin
      While Not InPyreSpot(WhichOne) Do
        SoulWalk(WhichOne);
    End;

    Function InBoolArray(Bool : Boolean; Bools : Array of Boolean) : Boolean;
    Var
      I : Integer;
    Begin
      For I := 0 To High(Bools) Do
      Begin
        Result := Bool = Bools[i];
        If Result Then
          Exit;
      End;
    End;

    Function r_InFight: Boolean;
    Var
      T: Integer;
      Me: TMe;
    Begin
      T := GetSystemTime;
      Repeat
        If Not LoggedIn Then
          Exit;
        Wait(67);
        Me := GetMe;
        Result := Me.Animation > 0;
      Until (Result) or (GetSystemTime - T > 2667);
    End;

    Procedure FightPyres;
    Var
      Pyres : Array of TNpc;
      Idz : TIntegerArray;
      X, Y, I : Integer;
      C : TMe;
    Begin
      C := GetMe;
      If (C.Speed <> 0) Then
        Exit;
      If Random(5) = 2 Then
        MakeCompass(IntToStr(Random(360)));
      Pyres := GetNPCsBy('Pyrefiend');
      SetArrayLength(Idz, High(Pyres) + 1);
      For I := 0 To High(Pyres) Do
        Idz[I] := Pyres[i].index;
      If Not C.InFight Then
      Begin
        For I := 0 To High(Pyres) do
        Begin
          If Not PointInBox(Point(Pyres[i].MS.X, Pyres[i].MS.Y), IntToBox(0, 0, 5, 5)) Then
          Begin
            MMouse(Pyres[i].MS.X, Pyres[i].MS.Y + 20, 3, 3);
            Wait(500 + random(250));
            If IsUpText('yrefiend') Then
            Begin
              GetMousePos(X, Y);
              Mouse(X, Y, 0 ,0, True);
              Break;
            End else
            Begin
              GetMousePos(X, Y);
              Mouse(X, Y, 0 ,0, False);
              Wait(500 + random(250));
              ChooseOption('ck Pyrefiend');
              Break;
            End;
          End;
        End;
      End;
      While R_InFight Do
        DoAntiBans;
    End;

    Function SolveWest : Boolean;
    Var
      P : TPoint;
      X, Y : Integer;
    begin
      WriteLn('Ran SolveWest');
      If Not InGraveYard(1) Then
        Exit;
      Result := True;
      MakeCompass('n');
      While InGraveYard(1) Do
      Begin
        P := TileToMSEx(Tile(60 - 1842.5, 77 - 3220.5), 5);
        MMouse(P.x, P.y, 3, 3);
        Wait(500);
        if IsUpText('ue barr') then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, true);
        end;
        Wait(1000);
      End;
      ToPyre(2);
    end;

    Function SolveEast : Boolean;
    Var
      P : TPoint;
      X, Y : Integer;
    begin
      WriteLn('Ran SolveEast');
      If Not InGraveYard(4) Then
        Exit;
      Result := True;
      MakeCompass('s');
      While InGraveYard(1) Do
      Begin
        P := TileToMSEx(Tile(60 - 1933.5, 77 - 3243.5), 5);
        MMouse(P.x, P.y, 3, 3);
        Wait(500);
        if IsUpText('ed barr') then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, true);
        end;
        Wait(1000);
      End;
      ToPyre(3);
    end;

    procedure HandleRoom(Team2: string);
    var
      P: Tpoint;
      x, y, T: Integer;
      C: Tme;
    begin
      C := GetMe;
      if not C.Speed = 0 then
        Exit;
      T := DidIDie;
      if not InRange(T, 0, 5) then
        Exit;
      if InRange(T, 2, 3) then
      begin
        if not T <> 2 then
          SolveWest
        else if not T <> 3 then
          SolveEast;
      end;
      case lowercase(Team2) of
        'zamorak':
          begin
            if not T <> 4 then
            begin
              MakeCompass('E');
              if not TileOnMS(Point(60 - 1959, 77 - 3239), 1) then
              begin
                if WalkToTile(Point(60 - 1958, 77 - 3239), 0, 0) then
                begin
                  Wait(1500);
                  P := TileToMS(Point(60 - 1959, 77 - 3239), 1);
                  MMouse(P.x, P.y, 3, 3);
                  Wait(250);
                  GetMousePos(x, y);
                  if IsUpText('ass Red') then
                    Mouse(x, y, 0, 0, true);
                  FFlag(0);
                end;
              end
              else
              begin
                Wait(1500);
                P := TileToMS(Point(60 - 1959, 77 - 3239), 1);
                MMouse(P.x, P.y, 3, 3);
                Wait(250);
                GetMousePos(x, y);
                if IsUpText('ass Red') then
                  Mouse(x, y, 0, 0, true);
                FFlag(0);
              end;
            end;
          end;
        'saradomin':
          begin
            if T = 1 then
            begin
              Wait(500);
              MakeCompass('W');
              if not TileOnMS(Point(60 - 1816, 77 - 3224), 1) then
              begin
                if WalkToTile(Point(60 - 1816, 77 - 3224), 0, 0) then
                begin
                  Wait(1500);
                  P := TileToMSEx(Tile(60 - 1815.5, 77 - 3225.5), 1);
                  MMouse(P.x, P.y, 3, 3);
                  Wait(250);
                  GetMousePos(x, y);
                  if IsUpText('ass Blue') then
                    Mouse(x, y, 0, 0, true);
                  FFlag(0);
                end;
              end
              else
              begin
                Wait(1500);
                P := TileToMSEx(Tile(1815.5, 3225.5), 1);
                MMouse(P.x, P.y, 3, 3);
                Wait(250);
                GetMousePos(x, y);
                if IsUpText('ass Blue') then
                  Mouse(x, y, 0, 0, true);
                FFlag(0);
              end;
            end;
          end;
      end;
    end;

    procedure FavWorld(Which: Integer);
    var
      XCo, YCo: Integer;
    begin
      if LoggedIn then
        Exit;
      case Which of
        1:
          begin
            if GetColor(429, 264) = 1648224 then
              XCo := 388
            else
              XCo := 410;
            YCo := 266;
            if GetColor(XCo, YCo) = 1648224 then
              Mouse(XCo + Random(5), YCo, 3, 3, True)
            else
              WriteLn('You don''''t have a world favorited there!');
          end;
        2:
          if GetColor(429, 264) = 1648224 then
            Mouse(435, 264, 3, 3, True)
          else
            WriteLn('You don''''t have a world favorited there!');
      end;
    end;

    function InAfkSpot(Team: Integer): Boolean;
    begin
      case Team of
        4: Result := PointInBox(GetMyPos, IntToBox(1959, 3234, 1959, 3236));
        1: Result := PointInBox(GetMyPos, IntToBox(1815, 3228, 1815, 3230));
      end;
    end;

    procedure SwitchPlayers(Active: Boolean);
    begin
      if Guthix then
        Guthix := False;
      Case Players[currentplayer].Strings[1] Of
        '5-10 - Games' : Players[currentplayer].integers[0] := 5 + random(10);
        '10-20 - Games' : Players[currentplayer].integers[0] := 10 + random(10);
        '20-30 - Games' : Players[currentplayer].integers[0] := 20 + random(10);
      End;
      If Rest Then
      Begin
        Logout;
        Wait(1000 * 60 * TimeL + Random(Floor(1000 * 60 * (TimeL/10))));
      End;
      NextPlayer(active);
      Team := Players[currentplayer].Strings[0];
      GameCount := 0;
    end;

    procedure Mainloop;
    var
      T, P: Boolean;
      X: string;
    begin
      ClearDebug;
      if not LoggedIn then
        LoginPlayer;
      Team := Players[currentplayer].Strings[0];
      T := False;
      X := Lowercase(Team);
      if Lowercase(Players[currentplayer].strings[0]) = 'guthix' then
        Guthix := True;
      repeat
        if Guthix and (DidIDie <> 0) then
        begin
          if DidIDie = 1 then
            TeamString := 'saradomin'
          else
            TeamString := 'zamorak';
          case TeamString of
            'saradomin': TeamInteger := 1;
            'zamorak': TeamInteger := 4;
          end;
        end
        else if Guthix and InAWaitingRoom then
        begin
          if DidIDie = 1 then
            TeamString := 'saradomin'
          else
            TeamString := 'zamorak';
          case TeamString of
            'saradomin': TeamInteger := 1;
            'zamorak': TeamInteger := 4;
          end;
        end
        else if (GameCount = Players[currentplayer].integers[0]) and (Switch) then
          SwitchPlayers(True);
        if not LoggedIn then
        begin
          LoginPlayer;
          if OutOfGame then
            Mainloop
          else
            NextPlayer(False);
        end;
        ProgressReport;
        X := Lowercase(Team);
        TeamString := Lowercase(X);
        if OutOfGame then
        begin
          Disguise('Out of game!');
          FindNormalRandoms;
          TeamString := X;
          if TeamInteger = 0 then
            case TeamString of
              'saradomin': TeamInteger := 1;
              'zamorak': TeamInteger := 4;
            end;
          if OutOfGame and not InAWaitingRoom then
          begin
            Disguise('Entering a Portal!');
            if Guthix then
            begin
              EnterPortal(3);
              Exit;
            end
            else
              case X of
                'zamorak': EnterPortal(1);
                'saradomin': EnterPortal(2);
              end;
          end;
        end;
        if not TeamInteger <> 0 then
          case TeamString of
            'saradomin': TeamInteger := 1;
            'zamorak': TeamInteger := 4;
          end;
        while InAWaitingRoom do
        begin
          if Guthix then
          begin
            if InWaitingRoom('saradomin') then
              TeamString := 'saradomin'
            else
              TeamString := 'zamorak';
            case TeamString of
              'saradomin': TeamInteger := 1;
              'zamorak': TeamInteger := 4;
            end;
          end;
          Disguise('In a Waiting Room!');
          Wait(500);
          DoAntiBans;
        end;
        if not (DidIDie = TeamInteger) = T then
          T := DidIDie = TeamInteger;
        if not OutOfGame and not InAWaitingRoom and T then
        begin
          if Guthix then
          begin
            if DidIDie = 1 then
              TeamString := 'saradomin'
            else
              TeamString := 'zamorak';
            case TeamString of
              'saradomin': TeamInteger := 1;
              'zamorak': TeamInteger := 4;
            end;
          end;
          HandleRoom(TeamString);
          HandleChat;
        end;
        if not (DidIDie = TeamInteger) = T then
          T := DidIDie = TeamInteger;
        if (not Players[currentplayer].booleans[0]) and not OutOfGame and not InAWaitingRoom and not T and not InAfkSpot(TeamInteger) then
        begin
          Disguise('Walking to AFK Spot!');
          case TeamString of
            'saradomin': WalkToTile(Point(60 - 1815, 77 - 3230), 1, 0);
            'zamorak': WalkToTile(Point(60 - 1959, 77 - 3234), 1, 0);
          end;
        end;
        if (Players[currentplayer].booleans[0]) and not OutOfGame and not InAWaitingRoom and not T and not InPyreSpot(TeamInteger) then
        begin
          If InGraveYard(1) Then
            SolveWest;
          If InGraveYard(4) Then
            SolveEast;
          Disguise('Walking to Pyre Spot!');
          case TeamString of
            'saradomin': ToPyre(1);
            'zamorak': ToPyre(4);
          end;
        end;
        while (not Players[currentplayer].booleans[0]) and (not OutOfGame) and (not InAWaitingRoom) and (T = false) and (InAfkSpot(TeamInteger)) do
        begin
          DoAntiBans;
          Disguise('Game ends In: ' + GetInterfaceText(836, 27));
          Wait(500);
          if ValidInterface(836) then
          begin
            if GetInterfaceText(836, 27) = '1 min' then
            begin
              if StrToInt(GetInterfaceText(836, 13)) = StrToInt(GetInterfaceText(836, 9)) then
                Wait(1)
              else
              begin
                P := StrToInt(GetInterfaceText(836, 13)) > StrToInt(GetInterfaceText(836, 9));
                case P of
                  False:
                    begin
                      if TeamString = 'zamorak' then
                      Begin
                        If SwitchTeams Then
                          TeamString := 'saradomin';
                        Inc(GamesWon)
                      End
                      else
                        Inc(GamesLost);
                    end;
                  True:
                    begin
                      if TeamString = 'saradomin' then
                      Begin
                        If SwitchTeams Then
                          TeamString := 'zamorak';
                        Inc(GamesWon)
                      End
                      else
                        Inc(GamesLost);
                    end;
                end;
              end;
              Inc(GamesPlayed);
              Inc(GameCount);
              Wait(Ceil(1000 * 60 * 1.1));
            end;
          end;
          if not (DidIDie = TeamInteger) = T then
            T := (DidIDie = TeamInteger);
        end;
        if not (DidIDie = TeamInteger) = T then
          T := (DidIDie = TeamInteger);
        while (Players[currentplayer].booleans[0]) and (not OutOfGame) and (not InAWaitingRoom) and (T = false) and (InPyreSpot(TeamInteger)) do
        begin
          FightPyres;
          Disguise('Game ends In: ' + GetInterfaceText(836, 27));
          Wait(500);
          if ValidInterface(836) then
          begin
            if GetInterfaceText(836, 27) = '1 min' then
            begin
              if StrToInt(GetInterfaceText(836, 13)) = StrToInt(GetInterfaceText(836, 9)) then
                Wait(1)
              else
              begin
                P := StrToInt(GetInterfaceText(836, 13)) > StrToInt(GetInterfaceText(836, 9));
                case P of
                  False:
                    begin
                      if TeamString = 'zamorak' then
                      Begin
                        If SwitchTeams Then
                          TeamString := 'saradomin';
                        Inc(GamesWon)
                      End
                      else
                        Inc(GamesLost);
                    end;
                  True:
                    begin
                      if TeamString = 'saradomin' then
                      Begin
                        If SwitchTeams Then
                          TeamString := 'zamorak';
                        Inc(GamesWon)
                      End
                      Else
                        Inc(GamesLost);
                    End;
                End;
              end;
              Inc(GamesPlayed);
              Inc(GameCount);
              Wait(Ceil(1000 * 60 * 1.1));
            end;
          end;
          if not (DidIDie = TeamInteger) = T then
            T := (DidIDie = TeamInteger);
          If not T and not InPyreSpot(TeamInteger) Then
            T := True;
        end;
        TeamInteger := 0;
        ProgressReport;
        if not (DidIDie = TeamInteger) = T then
          T := (DidIDie = TeamInteger);
      until (AllPlayersInactive)
    end;

    Function AuthRight(Passw, Usern : String) : Boolean;
    var
      User, Pass : Array of String;
      I : Integer;
    begin
      SetArrayLength(User, 4);
      SetArrayLength(Pass, 4);
      if (Passw <> '') and (Passw <> ' ') and (Usern <> ' ') and (Usern <> '') then
      Begin
        User := ['hi','hello','sup','lol'];
        Pass := ['hi1','hello1','sup101','lol101'];
        begin
          for I:= 0 to High(Pass) do
          Begin
            if (User[I] = Usern) and (Pass[I] = Passw) then
              Result := True;
          End;
        end;
      end;
      If not Result Then
        WriteLn('Invalid Username or Password!');
    end;

    procedure SaveFormSetting; forward;

    procedure LoadSettings(I: integer); forward;

    procedure StartButton(sender: Tobject);
    begin
      SaveFormSetting;
      FrmDesign.modalresult := mrOk;
    end;

    procedure InitFormOnClose1(Sender : TObject; var Action : TCloseAction);
    begin
      If (not(frmDesign.ModalResult = 1)) Then
        EndInitForm := True;
    end;

    procedure InitFormOnClose2(Sender : TObject; var Action : TCloseAction);
    begin
      if (not(Authorization.ModalResult = 1)) then
        EndInitForm := True;
    end;

    procedure AddPlayer(sender: Tobject);
    var
      t: integer;
    begin
      inc(howmanyPlayers);
      SetArraylength(UserName, Howmanyplayers);
      SetArraylength(Edit2, Howmanyplayers);
      SetArraylength(Edit3, Howmanyplayers) SetArraylength(TabPages, Howmanyplayers);
      SetArraylength(Playersz, Howmanyplayers);
      SetArraylength(Label2, Howmanyplayers);
      SetArraylength(Label3, Howmanyplayers);
      SetArraylength(Label4, Howmanyplayers);
      SetArraylength(Label5, Howmanyplayers);
      SetArraylength(Button2, Howmanyplayers);
      SetArraylength(Label10, Howmanyplayers) SetArraylength(Button1, Howmanyplayers);
      SetArraylength(ComboBox2, Howmanyplayers);
      SetArraylength(ComboBox1, Howmanyplayers);
      SetArraylength(ComboBox3, Howmanyplayers);
      SetArraylength(GroupBox2, Howmanyplayers);
      SetArraylength(Edit4, Howmanyplayers);
      SetArraylength(Edit5, Howmanyplayers);
      SetArraylength(Label6, Howmanyplayers);
      SetArraylength(Label7, Howmanyplayers);
      SetArraylength(Label8, Howmanyplayers);
      SetArraylength(Label9, Howmanyplayers);
      SetArraylength(Label15, Howmanyplayers);
      t := howmanyplayers - 1;
      TabPages[t] := TTabSheet.Create(frmDesign);
      TabPages[t].PageControl := PageControl;
      TabPages[t].Caption := 'Player ' + inttostr(howmanyplayers);
      Playersz[t] := TGroupBox.Create(frmDesign);
      Playersz[t] := TGroupBox.Create(FrmDesign);
      with Playersz[t] do
      begin
        Parent := TabPages[t];
        Left := 12;
        Top := 40;
        Width := 161;
        Height := 161;
        Caption := 'Players';
        TabOrder := 0;
      end;
      Label10[t] := TLabel.Create(Playersz[t]);
      with Label10[t] do
      begin
        Parent := Playersz[t];
        Left := 12;
        Top := 140;
        Width := 70;
        Height := 25;
        Caption := 'Player :' + IntToStr(t) + '';
      end;
      Label2[t] := TLabel.Create(Playersz[t]);
      with Label2[t] do
      begin
        Parent := Playersz[t];
        Left := 16;
        Top := 32;
        Width := 22;
        Height := 13;
        Caption := 'User';
      end;
      Label3[t] := TLabel.Create(Playersz[t]);
      with Label3[t] do
      begin
        Parent := Playersz[t];
        Left := 16;
        Top := 32;
        Width := 22;
        Height := 13;
        Caption := 'User';
      end;
      Label4[t] := TLabel.Create(Playersz[t]);
      with Label4[t] do
      begin
        Parent := Playersz[t];
        Left := 16;
        Top := 80;
        Width := 22;
        Height := 13;
        Caption := 'Nick';
      end;
      Label5[t] := TLabel.Create(Playersz[t]);
      with Label5[t] do
      begin
        Parent := Playersz[t];
        Left := 16;
        Top := 56;
        Width := 23;
        Height := 13;
        Caption := 'Pass';
      end;
      Username[t] := TEdit.Create(Playersz[t]);
      with Username[t] do
      begin
        Parent := Playersz[t];
        Left := 48;
        Top := 32;
        Width := 105;
        Height := 21;
        TabOrder := 0;
        Text := 'Username';
      end;
      Edit2[t] := TEdit.Create(Playersz[t]);
      with Edit2[t] do
      begin
        Parent := Playersz[t];
        Left := 48;
        Top := 56;
        Width := 105;
        Height := 21;
        TabOrder := 1;
        Text := 'Password';
        PasswordChar := '*';
      end;
      Edit3[t] := TEdit.Create(Playersz[t]);
      with Edit3[t] do
      begin
        Parent := Playersz[t];
        Left := 48;
        Top := 80;
        Width := 49;
        Height := 21;
        TabOrder := 2;
        Text := 'Nick';
      end;
      Button2[t] := TButton.Create(TabPages[t]);
      with Button2[t] do
      begin
        Parent := TabPages[t];
        Left := 12;
        Top := 13;
        Width := 70;
        Height := 25;
        Caption := 'Add Player';
        TabOrder := 3;
        Onclick := @ AddPlayer
      end;
      Button1[t] := TButton.Create(frmDesign);
      with Button1[t] do
      begin
        Parent := frmDesign;
        Left := 195;
        Top := 400;
        Width := 60;
        Height := 41;
        OnClick := @ StartButton;
        Caption := 'Start Script';
        TabOrder := 0;
      end;
      GroupBox2[t] := TGroupBox.Create(frmDesign);
      with GroupBox2[t] do
      begin
        Parent := TabPages[t];
        Left := 260;
        Top := 40;
        Width := 161;
        Height := 161;
        Caption := 'Setup';
        TabOrder := 1;
      end;
      Label6[t] := TLabel.Create(GroupBox2[t]);
      with Label6[t] do
      begin
        Parent := GroupBox2[t];
        Left := 8;
        Top := 24;
        Width := 17;
        Height := 13;
        Caption := 'Team';
      end;
      Label7[t] := TLabel.Create(GroupBox2[t]);
      with Label7[t] do
      begin
        Parent := GroupBox2[t];
        Left := 8;
        Top := 64;
        Width := 22;
        Height := 13;
        Caption := 'Switch';
      end;
      Label8[t] := TLabel.Create(GroupBox2[t]);
      with Label8[t] do
      begin
        Parent := GroupBox2[t];
        Left := 8;
        Top := 104;
        Width := 35;
        Height := 13;
        Caption := 'SRL ID';
      end;
      Label9[t] := TLabel.Create(GroupBox2[t]);
      with Label9[t] do
      begin
        Parent := GroupBox2[t];
        Left := 80;
        Top := 104;
        Width := 52;
        Height := 13;
        Caption := 'SRL PASS';
      end;
      ComboBox1[t] := TComboBox.Create(GroupBox2[t]);
      with ComboBox1[t] do
      begin
        Parent := GroupBox2[t];
        Left := 44;
        Top := 24;
        Width := 97;
        Height := 21;
        ItemHeight := 13;
        TabOrder := 0;
        Text := 'Team';
        with Items do
        begin
          Add('zamorak');
          Add('saradomin');
          Add('guthixs');
        end;
      end;
      ComboBox2[t] := TComboBox.Create(GroupBox2[t]);
      with ComboBox2[t] do
      begin
        Parent := GroupBox2[t];
        Left := 44;
        Top := 64;
        Width := 97;
        Height := 21;
        ItemHeight := 13;
        TabOrder := 1;
        Text := 'Games Before Switching';
        with Items do
        begin
          Add('5-10 - Games');
          Add('10-20 - Games');
          Add('20-30 - Games');
        end;
      end;
      Label15[t] := TLabel.Create(Playersz[t]);
      with Label15[t] do
      begin
        Parent := Playersz[t];
        Left := 16;
        Top := 104;
        Width := 35;
        Height := 13;
        Caption := 'Mode';
      end;
      ComboBox3[t] := TComboBox.Create(GroupBox2[t]);
      with ComboBox3[t] do
      begin
        Parent := Playersz[t];
        Left := 48;
        Top := 104;
        Width := 97;
        Height := 21;
        ItemHeight := 13;
        TabOrder := 0;
        Text := 'Mode';
        with Items do
        begin
          Add('Fight');
          Add('Antiban');
        end;
      end;
      Edit4[t] := TEdit.Create(GroupBox2[t]);
      with Edit4[t] do
      begin
        Parent := GroupBox2[t];
        Left := 8;
        Top := 120;
        Width := 41;
        Height := 21;
        TabOrder := 2;
        Text := 'ID';
      end;
      Edit5[t] := TEdit.Create(GroupBox2[t]);
      with Edit5[t] do
      begin
        Parent := GroupBox2[t];
        Left := 80;
        Top := 120;
        Width := 41;
        Height := 21;
        TabOrder := 3;
        Text := 'Pass';
      end;
      PageControl.ActivePageIndex := t;
      LoadSettings(T);
      Iz := Iz + 1;
    end;

    procedure InitForm;
    var
      t: Integer;
      Image1: TImage;
      b, w, h, Files: Integer;
      DownloadFrom, Page: string;
      DownloadTo: string;
    begin
      DownLoadFrom := 'http://timer.mgatesphoto.com/uploader/ifile/k.bmp';
      DownLoadTo := AppPath + 'Includes\SoulWars\k.bmp';
      if not FileExists(DownLoadTo) then
      begin
        ClearDeBug;
        WriteLn('Downloading Form Images');
        Page := GetPage(DownLoadFrom);
        Files := RewriteFile(DownLoadTo, True);
        WriteFileString(Files, Page);
        CloseFile(Files);
      end;
      Inc(Howmanyplayers);
      t := Howmanyplayers - 1;
      SetArraylength(UserName, Howmanyplayers);
      SetArraylength(Edit2, Howmanyplayers);
      SetArraylength(Edit3, Howmanyplayers) SetArraylength(TabPages, Howmanyplayers);
      SetArraylength(Playersz, Howmanyplayers);
      SetArraylength(Label2, Howmanyplayers);
      SetArraylength(Label3, Howmanyplayers);
      SetArraylength(Label4, Howmanyplayers);
      SetArraylength(Label5, Howmanyplayers);
      SetArraylength(Button2, Howmanyplayers);
      SetArraylength(Label15, Howmanyplayers);
      SetArraylength(Label10, Howmanyplayers) SetArraylength(Button1, Howmanyplayers);
      SetArraylength(ComboBox2, Howmanyplayers);
      SetArraylength(ComboBox1, Howmanyplayers);
      SetArraylength(ComboBox3, Howmanyplayers);
      SetArraylength(GroupBox2, Howmanyplayers);
      SetArraylength(Edit4, Howmanyplayers);
      SetArraylength(Edit5, Howmanyplayers);
      SetArraylength(Label6, Howmanyplayers);
      SetArraylength(Label7, Howmanyplayers);
      SetArraylength(Label8, Howmanyplayers);
      SetArraylength(Label9, Howmanyplayers);
      frmDesign := CreateForm;
      with frmDesign do
      begin
        OnClose := @InitFormOnClose1;
        BorderIcons := [biMinimize, biSystemMenu];
        Left := 275;
        Top := 114;
        Width := 517;
        Height := 588;
        Caption := 'Soul Wars';
        Color := clwhite;
        Font.Color := clWindowText;
        Font.Height := - 11;
        Font.Name := 'MS Sans Serif';
        Font.Style := [];
        PixelsPerInch := 96;
      end;
      Image1 := TImage.Create(FrmDesign);
      Image1.Parent := FrmDesign;
      Image1.Left := 0;
      Image1.Top := 0;
      Image1.Width := 500;
      Image1.Height := 261;
      b := loadbitmap(AppPath + 'Includes\SoulWars\k.bmp');
      getbitmapsize(b, w, h);
      copycanvas(getbitmapcanvas(b), Image1.canvas, 0, 0, w, h, 0, 0, w, h);
      PageControl := TPageControl.Create(frmDesign);
      PageControl.Parent := frmDesign;
      PageControl.Top := 275;
      PageCOntrol.Width := 501;
      PageControl.Height := 274;
      TabPages[t] := TTabSheet.Create(frmDesign);
      TabPages[t].PageControl := PageControl;
      TabPages[t].Caption := 'Player ' + inttostr(howmanyplayers);
      Playersz[t] := TGroupBox.Create(FrmDesign);
      with Playersz[t] do
      begin
        Parent := TabPages[t];
        Left := 12;
        Top := 40;
        Width := 161;
        Height := 161;
        Caption := 'Players';
        TabOrder := 0;
      end;
      Label10[t] := TLabel.Create(Playersz[t]);
      with Label10[t] do
      begin
        Parent := Playersz[t];
        Left := 12;
        Top := 140;
        Width := 70;
        Height := 25;
        Caption := 'Player :' + IntToStr(t) + '';
      end;
      Label2[t] := TLabel.Create(Playersz[t]);
      with Label2[t] do
      begin
        Parent := Playersz[t];
        Left := 16;
        Top := 32;
        Width := 22;
        Height := 13;
        Caption := 'User';
      end;
      Label3[t] := TLabel.Create(Playersz[t]);
      with Label3[t] do
      begin
        Parent := Playersz[t];
        Left := 16;
        Top := 32;
        Width := 22;
        Height := 13;
        Caption := 'User';
      end;
      Label4[t] := TLabel.Create(Playersz[t]);
      with Label4[t] do
      begin
        Parent := Playersz[t];
        Left := 16;
        Top := 80;
        Width := 22;
        Height := 13;
        Caption := 'Nick';
      end;
      Label5[t] := TLabel.Create(Playersz[t]);
      with Label5[t] do
      begin
        Parent := Playersz[t];
        Left := 16;
        Top := 56;
        Width := 23;
        Height := 13;
        Caption := 'Pass';
      end;
      Username[t] := TEdit.Create(Playersz[t]);
      with Username[t] do
      begin
        Parent := Playersz[t];
        Left := 48;
        Top := 32;
        Width := 105;
        Height := 21;
        TabOrder := 0;
        Text := 'Username';
      end;
      Edit2[t] := TEdit.Create(Playersz[t]);
      with Edit2[t] do
      begin
        Parent := Playersz[t];
        Left := 48;
        Top := 56;
        Width := 105;
        Height := 21;
        TabOrder := 1;
        Text := 'Password';
        PasswordChar := '*';
      end;
      Edit3[t] := TEdit.Create(Playersz[t]);
      with Edit3[t] do
      begin
        Parent := Playersz[t];
        Left := 48;
        Top := 80;
        Width := 49;
        Height := 21;
        TabOrder := 2;
        Text := 'Nick';
      end;
      Button2[t] := TButton.Create(TabPages[t]);
      with Button2[t] do
      begin
        Parent := TabPages[t];
        Left := 12;
        Top := 13;
        Width := 70;
        Height := 25;
        Caption := 'Add Player';
        TabOrder := 3;
        Onclick := @ AddPlayer;
      end;
      Button1[t] := TButton.Create(frmDesign);
      with Button1[t] do
      begin
        Parent := frmDesign;
        Left := 195;
        Top := 400;
        Width := 60;
        Height := 41;
        OnClick := @ StartButton;
        Caption := 'Start Script';
        TabOrder := 0;
      end;
      GroupBox2[t] := TGroupBox.Create(frmDesign);
      with GroupBox2[t] do
      begin
        Parent := TabPages[t];
        Left := 270;
        Top := 40;
        Width := 161;
        Height := 161;
        Caption := 'Setup';
        TabOrder := 1;
      end;
      Label6[t] := TLabel.Create(GroupBox2[t]);
      with Label6[t] do
      begin
        Parent := GroupBox2[t];
        Left := 8;
        Top := 24;
        Width := 17;
        Height := 13;
        Caption := 'Team';
      end;
      Label7[t] := TLabel.Create(GroupBox2[t]);
      with Label7[t] do
      begin
        Parent := GroupBox2[t];
        Left := 8;
        Top := 64;
        Width := 22;
        Height := 13;
        Caption := 'Switch';
      end;
      Label8[t] := TLabel.Create(GroupBox2[t]);
      with Label8[t] do
      begin
        Parent := GroupBox2[t];
        Left := 8;
        Top := 104;
        Width := 35;
        Height := 13;
        Caption := 'SRL ID';
      end;
      Label9[t] := TLabel.Create(GroupBox2[t]);
      with Label9[t] do
      begin
        Parent := GroupBox2[t];
        Left := 80;
        Top := 104;
        Width := 52;
        Height := 13;
        Caption := 'SRL PASS';
      end;
      ComboBox1[t] := TComboBox.Create(GroupBox2[t]);
      with ComboBox1[t] do
      begin
        Parent := GroupBox2[t];
        Left := 44;
        Top := 24;
        Width := 97;
        Height := 21;
        ItemHeight := 13;
        TabOrder := 0;
        Text := 'Team';
        with Items do
        begin
          Add('zamorak');
          Add('saradomin');
          Add('guthix');
        end;
      end;
      ComboBox2[t] := TComboBox.Create(GroupBox2[t]);
      with ComboBox2[t] do
      begin
        Parent := GroupBox2[t];
        Left := 44;
        Top := 64;
        Width := 97;
        Height := 21;
        ItemHeight := 13;
        TabOrder := 1;
        Text := 'Games Before Switching';
        with Items do
        begin
          Add('5-10 - Games');
          Add('10-20 - Games');
          Add('20-30 - Games');
        end;
      end;
      Label15[t] := TLabel.Create(Playersz[t]);
      with Label15[t] do
      begin
        Parent := Playersz[t];
        Left := 16;
        Top := 104;
        Width := 35;
        Height := 13;
        Caption := 'Mode';
      end;
      ComboBox3[t] := TComboBox.Create(GroupBox2[t]);
      with ComboBox3[t] do
      begin
        Parent := Playersz[t];
        Left := 48;
        Top := 104;
        Width := 97;
        Height := 21;
        ItemHeight := 13;
        TabOrder := 0;
        Text := 'Mode';
        with Items do
        begin
          Add('Fight');
          Add('Antiban');
        end;
      end;
      Edit4[t] := TEdit.Create(GroupBox2[t]);
      with Edit4[t] do
      begin
        Parent := GroupBox2[t];
        Left := 8;
        Top := 120;
        Width := 41;
        Height := 21;
        TabOrder := 2;
        Text := 'ID';
      end;
      Edit5[t] := TEdit.Create(GroupBox2[t]);
      with Edit5[t] do
      begin
        Parent := GroupBox2[t];
        Left := 80;
        Top := 120;
        Width := 41;
        Height := 21;
        TabOrder := 3;
        Text := 'Pass';
      end;
      Pagecontrol.Activepageindex := 0;
      LoadSettings(0);
    end;

    procedure SaveFormSetting;
    var
      path: string;
      i: integer;
    begin
      Path := AppPath + 'Includes\SoulWars\Form.ini';
      for i := 0 to (HowManyPlayers - 1) do
      begin
        WriteINI('Player' + inttostr(i), 'User', Username[i].Text, Path);
        WriteINI('Player' + inttostr(i), 'Pass', Edit2[i].Text, Path);
        WriteINI('Player' + inttostr(i), 'Nick', Edit3[i].Text, Path);
        WriteINI('Settings' + inttostr(i), 'Id', Edit4[i].Text, Path);
        WriteINI('Settings' + inttostr(i), 'IdPass', Edit5[i].Text, Path);
        WriteINI('Player' + inttostr(i), 'Loc', ComboBox1[i].Text, Path);
        WriteINI('Player' + inttostr(i), 'Games', ComboBox2[i].Text, Path);
        WriteINI('Player' + inttostr(i), 'Mode', ComboBox3[i].Text, Path);
      end;
    end;

    procedure LoadSettings(I: integer);
    var
      path: string;
    begin
      Path := AppPath + 'Includes\SoulWars\Form.ini';
      if not FileExists(path) then
        Exit;
      UserName[i].Text := ReadINI('Player' + inttostr(i), 'User', path);
      Edit2[i].Text := ReadINI('Player' + inttostr(i), 'Pass', path);
      Edit3[i].Text := ReadINI('Player' + inttostr(i), 'Nick', path);
      eDIT4[i].Text := ReadINI('Settings' + inttostr(i), 'Id', Path);
      Edit5[i].Text := ReadINI('Settings' + inttostr(i), 'IdPass', Path);
      ComboBox1[i].Text := ReadINI('Player' + inttostr(i), 'Loc', Path);
      ComboBox2[i].Text := ReadINI('Player' + inttostr(i), 'Games', Path);
      ComboBox3[i].Text := ReadINI('Player' + inttostr(i), 'Mode', Path);
    end;

    procedure ShowInitFormModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowInitFormModal;
    var
      V: TVariantArray;
    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('ShowInitFormModal', V);
    end;

    procedure MainInitForm;
    var
      V: TVariantArray;
    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('InitForm', V);
      SafeShowInitFormModal;
    end;

    procedure DeclarePlayers;
    var
      p: integer;
    begin
      NumberOfplayers(howmanyplayers);
      Currentplayer := 0;
      for p := 0 to Howmanyplayers - 1 do
      begin
        Players[p].Name := Username[p].text;
        Players[p].Pass := Edit2[p].text;
        Players[p].Nick := Edit3[p].text;
        Players[p].Active := True;
        Players[p].Strings[0] := Combobox1[p].text;
        Players[p].Strings[1] := Combobox2[p].text;
        Players[p].Strings[2] := Combobox3[p].text;

        Case Players[p].Strings[1] Of
          '5-10 - Games' : Players[p].integers[0] := 5 + random(10);
          '10-20 - Games' : Players[p].integers[0] := 10 + random(10);
          '20-30 - Games' : Players[p].integers[0] := 20 + random(10);
        End;
        Case Players[p].Strings[2] Of
          'Fight' : Players[p].booleans[0] := True;
          'Afk' : Players[p].booleans[0] := False;
        End;
      end;
    end;

    Procedure Setup;
    Begin
      SetupSrl;
      MainInitForm;
      if (EndInitForm) then
        TerminateScript
      Else
      Begin
        DeclarePlayers;
        SetupSmart;
        FavWorld(WhichWorld);
        if not LoggedIn then
          LoginPlayer;
        UseFindMod := False;
        LogoutOnMod := False;
        repeat
          MainLoop;
        until (AllPlayersInactive)
      End;
    End;

    procedure AuthCheck(sender: Tobject);
    begin
      If AuthRight(AuthPass.text, AuthUser.text) Then
      Begin
        Authorization.modalresult := mrOk;
      End Else
      Begin
        Authorization.modalresult := mrOk;
        WriteLn('Your auth was typed incorrectly, or it is no longer in use. Please contact me if you think there is a mistake. Remember, it is case sensitive!');
        TerminateScript;
      End;
    end;

    procedure DoForm;
    var
      TimeInitForm : Integer;
    begin
      TimeInitForm := GetSystemTime;
      Authorization := CreateForm;
      with Authorization do
      begin
        OnClose := @InitFormOnClose2;
        Position := poScreenCenter;
        BorderStyle := bsSingle;
        BorderIcons := [biMinimize,biSystemMenu];
        ClientWidth := 150;
        ClientHeight := 150;
        Caption := 'Verify!';
        Color := 5849128;
        Font.Color := 0;
        Font.Height := 15;
        Font.Name := 'MS Sans Serif';
        Font.Style := [];
        PixelsPerInch := 10;
      end;
      AuthUser := TEdit.Create(Authorization);
      with AuthUser do
      begin
        Parent := Authorization;
        Left := 45;
        Top := 16;
        Width := 60;
        Height := 21;
        TabOrder := 1;
        Text := 'Username';
      end;
      AuthPass := TEdit.Create(Authorization);
      with AuthPass do
      begin
        Parent := Authorization;
        Left := 45;
        Top := 56;
        Width := 60;
        Height := 21;
        TabOrder := 2;
        Text := 'Password';
      end;
      ButtonStart := TButton.Create(Authorization);
      with ButtonStart do
      begin
        Parent := Authorization;
        Left := 55;
        Top := 104;
        Width := 40;
        Height := 25;
        OnClick := @AuthCheck;
        Caption := 'Check!';
        TabOrder := 10;
      end;
      WriteLn('InitForm compiled in ' + IntToStr(GetSystemTime - TimeInitForm) + ' milliseconds!');
    end;

    procedure SafenitForm;
    var
      V : TVariantArray;
    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('DoForm', V);
    end;

    procedure ShownitForm;
    begin
      Authorization.ShowModal;
    end;

    procedure afeShowInitForm;
    var
      V : TVariantArray;
    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('ShownitForm', V);
    end;

    procedure nitForm;
    begin
      try
        SafenitForm;
        afeShowInitForm;
      finally
        FreeForm(Authorization);
      except
        WriteLn('An error seems to have occurred in: InitForm');
      end;
    end;

    begin
      ClearDebug;
      GetSelf.WindowState := wsMinimized;
      nitForm;
      GetSelf.WindowState := wsNormal;
      if (EndInitForm) then
        TerminateScript
      Else
        Setup;
    end.

    I might update it if I have time once reflection is fully updated :P.

    ~Sand

  4. #4
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @SandStorm,

    Maybe add a random option for SwitchTeams so you aren't always switching?

    AntiBan could be easily shortened from:
    SCAR Code:
    function AntiBan(Chance: Integer): Boolean;
    var
      x, y: Integer;
    begin
      if not (LoggedIn) then
        Exit;
      case random(Chance) of
        0:
          begin
            PickUpMouse;
            Result := True;
            Inc(Antibanz);
          end;
        1:
          begin
            Result := True;
            GameTab(1 + Random(12));
            Inc(Antibanz);
          end;
        2:
          begin
            Result := True;
            RandomRclick;
            Inc(Antibanz);
          end;
        3:
          begin
            Result := True;
            randomMovement;
            Inc(Antibanz);
          end;
        4:
          begin
            Result := True;
            MMouse(Random(MSX2), Random(MSY2), Random(MSX2), Random(MSY2));
            Inc(Antibanz);
          end;
        5:
          begin
            HoverSkill('random', false);
            sleepandmovemouse(200 + Random(100));
            gametab(4);
            MMouse(Random(MSY1), Random(MSX1), Random(MSX2), Random(MSY2));
            Inc(Antibanz);
          end;
        6:
          begin
            GameTab(1 + Random(13));
            wait(1000 + Random(600));
            Result := True;
            Inc(Antibanz);
          end;
        7:
          begin
            HoverSkill('random', false);
            sleepandmovemouse(200 + Random(100));
            Result := True;
            Inc(Antibanz);
          end;
        8:
          begin
            Result := True;
            MMouse(x, y, (10 + random(350)), (10 + random(200)));
            Inc(Antibanz);
          end;
        9:
          begin
            Result := True;
            MMouse(Random(MSX2), Random(MSY2), Random(MSX2), Random(MSY2));
            Inc(Antibanz);
          end;
      end;
    end;

    To:
    SCAR Code:
    function AntiBan(Chance: Integer): Boolean;
    var
      x, y: Integer;
    begin
      if not (LoggedIn) then
        Exit;
      x := Random(Chance);
      Result := x >= 0 and x < 10;
      case x of
        0: PickupMouse;
        1: GameTab(1 + Random(12));
        2: RandomRClick;
        3: randomMovement;
        4: MMouse(Random(MSX2), Random(MSY2), Random(MSX2), Random(MSY2));
        5:
          begin
            HoverSkill('random', false);
            sleepandmovemouse(200 + Random(100));
            gametab(4);
            MMouse(Random(MSY1), Random(MSX1), Random(MSX2), Random(MSY2));
          end;
        6:
          begin
            GameTab(1 + Random(13));
            wait(1000 + Random(600));
          end;
        7:
          begin
            HoverSkill('random', false);
            sleepandmovemouse(200 + Random(100));
          end;
        8: MMouse(x, y, (10 + random(350)), (10 + random(200)));
        9: MMouse(Random(MSX2), Random(MSY2), Random(MSX2), Random(MSY2));
      end;
    end;

    If that doesn't work using the x as the Random(Chance) then just make a new variable for it.



    In DoAntiBans:
    SCAR Code:
    if Chances <= 0 then
        Chances := 50;
      if Chances < 50 then
        Chances := 50;
      if Antiban(Chances) then
      begin
        Chances := ChanceToAntiban;
      end
      else
        Chances := Chances - randomrange(1, 5);

    Shorter:
    SCAR Code:
    if Chances < 50 then
      Chances := 50;
      if Antiban(Chances) then
        Chances := ChanceToAntiban
      else
        Chances := Chances - randomrange(1, 5);


    SCAR Code:
    function DidIDie: Integer;
    begin
      Result := 0;
      if PointInBox(GetMyPos, IntToBox(1816, 3220, 1823, 3230)) then
        Result := 1;
      if PointInBox(GetMyPos, IntToBox(1841, 3217, 1843, 3219)) then
        Result := 2;
      if PointInBox(GetMyPos, IntToBox(1932, 3244, 1934, 3246)) then
        Result := 3;
      if PointInBox(GetMyPos, IntToBox(1951, 3234, 1958, 3244)) then
        Result := 4;
    end;

    Could be:

    SCAR Code:
    function DidIDie: Integer;
    var i: Integer;
        t: TBooleanArray;
    begin
      T := [PointInBox(GetMyPos, IntToBox(1816, 3220, 1823, 3230),
            PointInBox(GetMyPos, IntToBox(1841, 3217, 1843, 3219),
            PointInBox(GetMyPos, IntToBox(1932, 3244, 1934, 3246),
            PointInBox(GetMyPos, IntToBox(1951, 3234, 1958, 3244)];
      for I := 0 to 3 do
        if(T[i])then
          Result := i;
    end;

    Kind of failed at shortening But I think it looks better. And it would be shorter if I put the array delcaration on only 1 or 2 lines.


    On line 229 you should consider using WaitUpText instead of IsUpText in case of lag.



    In EnterPortal:
    SCAR Code:
    case Portal of
        1:
          begin
            MakeCompass('e');
            If TimeRemaining('enterportal') Then
              Waiting;
            if ClickToContinue then
              HandleChat;
            if not TileOnMS(Point(60 - 1900, 77 - 3162), 0) then
              ToPortal(1);
            C := GetMe;
            if C.Speed = 0 then
            begin
              P := TileToMSEx(Tile(1900, 77 - 3162.5), 5);
              MMouse(P.x, P.y, 3, 3);
              Wait(500);
              if IsUpText('ed barr') then
              begin
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, true);
              end;
              If TimeRemaining('enterportal') Then
                Waiting;
              if ClickToContinue then
                HandleChat;
              if ClickToContinue then
                HandleChat;
            end;
          end;
        2:
          begin
            MakeCompass('w');
            If TimeRemaining('enterportal') Then
              Waiting;
            if ClickToContinue then
              HandleChat;
            if not TileOnMS(Point(60 - 1879, 3162), 0) then
              ToPortal(2);
            C := GetMe;
            if C.Speed = 0 then
            begin
              P := TileToMSEx(Tile(1879, 3162.5), 5);
              MMouse(P.x, P.y, 3, 3);
              Wait(500);
              if IsUpText('lue barr') then
              begin
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, true);
              end;
              If TimeRemaining('enterportal') Then
                Waiting;
              if ClickToContinue then
                HandleChat;
              if ClickToContinue then
                HandleChat;
            end;
          end;
        3:
          begin
            MakeCompass('s');
            If TimeRemaining('enterportal') Then
              Waiting;
            if ClickToContinue then
              HandleChat;
            if not TileOnMS(Point(60 - 1891, 77 - 3163), 0) then
              ToPortal(3);
            C := GetMe;
            if C.Speed = 0 then
            begin
              P := TileToMSEx(Tile(1891, 77 - 3163), 5);
              MMouse(P.x, P.y, 3, 3);
              Wait(500);
              if IsUpText('eam Ba') then
              begin
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, true);
              end;
              If TimeRemaining('enterportal') Then
                Waiting;
              if ClickToContinue then
                HandleChat;
              if ClickToContinue then
                HandleChat;
            end;
          end;
      end;

    Could be shortened to:
    SCAR Code:
    case Portal of
        1: MakeCompass('e');
        2: MakeCompass('w');
        3: MakeCompass('s');
      end;
      If TimeRemaining('enterportal') Then
        Waiting;
      if ClickToContinue then
        HandleChat;
      case Portal of
        1:
          begin
            if not TileOnMS(Point(60 - 1900, 77 - 3162), 0) then
              ToPortal(1);
            C := GetMe;
            if C.Speed = 0 then
            begin
              P := TileToMSEx(Tile(1900, 77 - 3162.5), 5);
              MMouse(P.x, P.y, 3, 3);
              Wait(500);
              if IsUpText('ed barr') then
              begin
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, true);
              end;
            end;
          end;
        2:
          begin
            if not TileOnMS(Point(60 - 1879, 3162), 0) then
              ToPortal(2);
            C := GetMe;
            if C.Speed = 0 then
            begin
              P := TileToMSEx(Tile(1879, 3162.5), 5);
              MMouse(P.x, P.y, 3, 3);
              Wait(500);
              if IsUpText('lue barr') then
              begin
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, true);
              end;
            end;
          end;
        3:
          begin
            if not TileOnMS(Point(60 - 1891, 77 - 3163), 0) then
              ToPortal(3);
            C := GetMe;
            if C.Speed = 0 then
            begin
              P := TileToMSEx(Tile(1891, 77 - 3163), 5);
              MMouse(P.x, P.y, 3, 3);
              Wait(500);
              if IsUpText('eam Ba') then
              begin
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, true);
              end;
            end;
          end;
      end;
      If TimeRemaining('enterportal') Then
        Waiting;
      for x := 0 to 1 do
        if ClickToContinue then
          HandleChat;



    In ABFlag:
    SCAR Code:
    if (FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2)) then
      begin
        Result := True;
        repeat
          Wait(100);
          DoAntiBans;
          if (SRL_Procs[srl_AntiBan] <> nil) then
            SRL_Procs[srl_AntiBan]();
          timeout := timeout + 1;
        until (not FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2)) or (timeout > 300);
      end;

    Could be:
    SCAR Code:
    Result := (FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2));
    if(Result)then
        repeat
          Wait(100);
          DoAntiBans;
          if (SRL_Procs[srl_AntiBan] <> nil) then
            SRL_Procs[srl_AntiBan]();
          timeout := timeout + 1;
        until (not FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2)) or (timeout > 300);


    In WalkToPath:
    SCAR Code:
    case random(3) of
        1: SetRun(true);
      end;

    Things like this could simply be:
    SCAR Code:
    if(Random(3) = 1)then SetRun(true);


    In WalkToPath:
    SCAR Code:
    if (not(WalkToTile(Path[DoTile + 1], 1, 10))) then
      begin
        Result:= False;
        Exit;
      end else
      for I := DoTile + 1 to High(Path) - 1 do
      begin
        if not (WalkToTile(Path[i + 1], 1, 3)) then
        begin
          Exit;
          Result:= False;
        end else
        begin
          ABFlag;
        end;
      end;
      Result := True;

    You set the result to false after Exiting? Also could be shortened:

    SCAR Code:
    Result := (WalkToTile(Path[DoTile + 1], 1, 10));
    if not(Result) then Exit;
      for I := DoTile + 1 to High(Path) - 1 do
        if not (WalkToTile(Path[i + 1], 1, 3)) then
        begin
          Result := False;
          Exit;
        end else
          ABFlag;

    Took out the last Result := true because it would have to be true if it made it to that point already.



    In FightPyres:
    SCAR Code:
    If Not C.InFight Then
      Begin
        For I := 0 To High(Pyres) do
        Begin
          If Not PointInBox(Point(Pyres[i].MS.X, Pyres[i].MS.Y), IntToBox(0, 0, 5, 5)) Then
          Begin
            MMouse(Pyres[i].MS.X, Pyres[i].MS.Y + 20, 3, 3);
            Wait(500 + random(250));
            If IsUpText('yrefiend') Then
            Begin
              GetMousePos(X, Y);
              Mouse(X, Y, 0 ,0, True);
              Break;
            End else
            Begin
              GetMousePos(X, Y);
              Mouse(X, Y, 0 ,0, False);
              Wait(500 + random(250));
              ChooseOption('ck Pyrefiend');
              Break;
            End;
          End;
        End;
      End;

    Could be:
    SCAR Code:
    If Not C.InFight Then
        For I := 0 To High(Pyres) do
          If Not PointInBox(Point(Pyres[i].MS.X, Pyres[i].MS.Y), IntToBox(0, 0, 5, 5)) Then
          Begin
            MMouse(Pyres[i].MS.X, Pyres[i].MS.Y + 20, 3, 3);
            Wait(500 + random(250));
            GetMousePos(X, Y);
            If IsUpText('yrefiend') Then
              Mouse(X, Y, 0 ,0, True) else
            Begin
              Mouse(X, Y, 0 ,0, False);
              Wait(500 + random(250));
              ChooseOption('ck Pyrefiend');
            End;
            Break;
          End;



    These:
    SCAR Code:
    Function SolveWest : Boolean;
    Var
      P : TPoint;
      X, Y : Integer;
    begin
      WriteLn('Ran SolveWest');
      If Not InGraveYard(1) Then
        Exit;
      Result := True;
      MakeCompass('n');
      While InGraveYard(1) Do
      Begin
        P := TileToMSEx(Tile(60 - 1842.5, 77 - 3220.5), 5);
        MMouse(P.x, P.y, 3, 3);
        Wait(500);
        if IsUpText('ue barr') then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, true);
        end;
        Wait(1000);
      End;
      ToPyre(2);
    end;

    Function SolveEast : Boolean;
    Var
      P : TPoint;
      X, Y : Integer;
    begin
      WriteLn('Ran SolveEast');
      If Not InGraveYard(4) Then
        Exit;
      Result := True;
      MakeCompass('s');
      While InGraveYard(1) Do
      Begin
        P := TileToMSEx(Tile(60 - 1933.5, 77 - 3243.5), 5);
        MMouse(P.x, P.y, 3, 3);
        Wait(500);
        if IsUpText('ed barr') then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, true);
        end;
        Wait(1000);
      End;
      ToPyre(3);
    end;

    Could be combined into one fairly easily:
    SCAR Code:
    Function Solve(West: Boolean): Boolean;
    Var
      P : TPoint;
      X, Y : Integer;
    begin
      WriteLn('Ran SolveWest');
      If West and Not InGraveYard(1) Then
        Exit;
      If West = false and Not InGraveYard(4) Then
        Exit;
      Result := True;
      if(West)then
        MakeCompass('n') else
          MakeCompass('s');
      While InGraveYard(1) Do
      Begin
        if(West)then
          P := TileToMSEx(Tile(60 - 1842.5, 77 - 3220.5), 5) else
            P := TileToMSEx(Tile(60 - 1933.5, 77 - 3243.5), 5);
        MMouse(P.x, P.y, 3, 3);
        Wait(500);
        if IsUpText('ue barr') then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, true);
        end;
        Wait(1000);
      End;
      if(West)then
        ToPyre(2) else
          ToPyre(3);
    end;



    In HandleRoom:
    SCAR Code:
    if InRange(T, 2, 3) then
      begin
        if not T <> 2 then
          SolveWest
        else if not T <> 3 then
          SolveEast;
      end;

    That's some double negative logic there. Change to:

    SCAR Code:
    if InRange(T, 2, 3) then
        if T = 2 then
          SolveWest
        else if T = 3 then
          SolveEast;



    That main loop is messy tbh. There's got to be several places where shortening is possible using many of the same methods above, but I don't have time to point all those out.


    In AuthRight:
    SCAR Code:
    begin
          for I:= 0 to High(Pass) do
          Begin
            if (User[I] = Usern) and (Pass[I] = Passw) then
              Result := True;
          End;
        end;

    You have a begin/end in the middle of nowhere. Could be:
    SCAR Code:
    for I:= 0 to High(Pass) do
            if (User[I] = Usern) and (Pass[I] = Passw) then
              Result := True;



    In AuthCheck:
    SCAR Code:
    If AuthRight(AuthPass.text, AuthUser.text) Then
      Begin
        Authorization.modalresult := mrOk;
      End Else
      Begin
        Authorization.modalresult := mrOk;
        WriteLn('Your auth was typed incorrectly, or it is no longer in use. Please contact me if you think there is a mistake. Remember, it is case sensitive!');
        TerminateScript;
      End;

    To:
    SCAR Code:
    Authorization.modalresult := mrOk;
    If not AuthRight(AuthPass.text, AuthUser.text) Then
      Begin
        WriteLn('Your auth was typed incorrectly, or it is no longer in use. Please contact me if you think there is a mistake. Remember, it is case sensitive!');
        TerminateScript;
      End;




    Not many logic errors in there at all, just some small to large code shortenings/efficiencies is all.

    Let me know if you have any questions
    ~JAD

  5. #5
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    You could maybe write a report on my smelter, which I plan on updating pretty soon. So if I have some other tips, I could include those.

    Be prepared to make lots of efficiency checks . The logic should be all there, it could run for 12 hours before.

    SCAR Code:
    program BabyMelterPub;
      {.include srl/srl/misc/smart.scar}
      {.include srl/srl.scar}
      {.include srl/srl/reflection/reflection.scar}
      {.include srl/srl/skill/smithing.scar}
      {.include srl/srl/misc/debug.scar}

    // Remember to copy this from Prv to Pub
    const
      AntiRandomz = 'C';
      // 'R' or 'C' for reflection or colour antirandoms.
      Rest = True;
      // Do you want to rest?
      RestingFor = 30 * 60 * 1000;
      // Just change the first number to change minutes
      RestEvery = 60 * 60 * 1000;
      // Just change the first number to change minutes
      Sleeping = False;
      // Do you want to sleep? Only needed for long runs
      SleepingFor = 3 * 60 * 60 * 1000;
      // Change the first number to change hours
      SleepEvery = 2 * 60 * 60 * 1000;
      // Change the first number to change hours
      Debugging = True;
      // Debug the script?
      FullProggy = True;
      // Have a very informative debug type of proggy?
      MSpeed = 20;
      // Your mouse speed
      AntiBanzor = 90;
      // The percentage that it wont do antiban. Ie for 85, the script will do antiban 15% of the time.
      VersionN = 'V1.0';
      // Don't change!

    procedure SmartSettings;
    begin
      Smart_Server := 37;
      Smart_Signed := True;
      Smart_Members := False;
      Smart_SuperDetail := false;
    end;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 2;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      with Players[0] do
      begin
        Name := '';
        Pass := '';
        Nick := '';
        Active := True;
        Pin := '';
        BoxRewards := ['XP', 'ostume']; // Leave if you don't know what this does
        Strings[0] := 'mith'; // 'bronze' 'iron' 'silver' 'steel' 'gold' 'mith' 'addy' 'rune'
        Integers[0] := 25; // Loads before changing players. If only one player, don't worry about this.
      end;                 // Script adds random(5) to the amount of loads.
      with Players[1] do
      begin
        Name := '';
        Pass := '';
        Nick := '';
        Active := False;
        Pin := '';
        BoxRewards := ['XP', 'ostume'];
        Strings[0] := 'steel';
        Integers[0] := 20;
      end;
    end;

    var
      Debugger: Boolean;
      SmithTop, SmithBottom: TPoint;
      OreOne, OreTwo: string;
      OreOneN, OreTwoN, ColOne, ColTwo, OreSlotO, OreSlotT, BRTime, RTTime, RAmount: Integer;
      Sleeper, Sleeped, SleepT, id, idd, N1, N2: Integer;
      LD, BSmith, Levels, TPAWalks, TileWalks, AntiBans, PriceN, ProfitB, CactC, LDS: Integer;
      XPPer, XPGained: Extended;

    {*******************************************************************************
    function TehTime:string;
    By:RsN (fixed by Ron), edited by Hy71194 for 24-hour clock format. Shown to me by SandStorm
    Description:Returns current time as a string
    *******************************************************************************}


    function TehTime: string;
    var
      Hour, Mins, Sec, MSec: Word;
    begin
      DecodeTime(Now, Hour, Mins, Sec, MSec);
      Result := (Padz(IntToStr(Hour), 2) + ':' + Padz(IntToStr(Mins), 2) + ':' + Padz(IntToStr(Sec), 2));
    end;

    {~~~~~~~~~~~~~~~~~~ Fixed ChooseOption ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    function ChooseOptionMe(Texts: TStringArray; TextType: string; Action: fnct_ActionOptions): Boolean;
    var
      B: TBox;
      TPA, TextTPA: TPointArray;
      aTPA: T2DPointArray;
      I, C, H, HH, ii, L: Integer;
      P: TPoint;
      Occurances: array [0..4] of TPointArray;
      Colors: TIntegerArray;
    begin
      Result := False;
      GetClientDimensions(B.X2, B.Y2);
      B.X1 := 0;
      B.Y1 := 0;
      SetLength(aTPA, 2);
      FindColorsTolerance(aTPA[0], 4409686, B.X1, B.Y1, B.X2, B.Y2, 0);
      FindColorsTolerance(aTPA[1], 4016722, B.X1, B.Y1, B.X2, B.Y2, 0);
      TPA := MergeATPA(aTPA);
      SetLength(aTPA, 0);
      if Length(TPA) < 10 then
        Exit;
      B.X2 := 0;
      B.Y2 := 0;
      P := TPA[0];
      H := High(TPA);
      Dec(H);
      for I := 0 to H do
        if TPA[i].X = TPA[I + 1].X - 1 then
        begin
          if C > 5 then
          begin
            B.X1 := P.X;
            B.Y1 := P.Y;
            Break;
          end
          else
            C := C + 1;
        end
      else
      begin
        P := TPA[I + 1];
        C := 0;
      end;
      if I = Length(TPA) then
      begin
        WriteLn('Choose Option Menu Getting Failed');
        Exit;
      end;
      InvertTPA(TPA);
      C := 0;
      P := TPA[0];
      H := High(TPA);
      Dec(H);
      for I := 0 to H do
        if TPA[i].X = TPA[I + 1].X + 1 then
        begin
          if C > 5 then
          begin
            B.X2 := P.X;
            B.Y2 := P.Y;
            Break;
          end
          else
            C := C + 1;
        end
      else
      begin
        P := TPA[I + 1];
        C := 0;
      end;
      if I = Length(TPA) then
      begin
        WriteLn('Choose Option Menu Getting Failed');
        Exit;
      end;
      TPA := [];
      Colors := [13034990, 4231423, 2070783, 65535, 16776960, 9812166];
      TextType := LowerCase(TextType);
      case TextType of
        'action', 'player':
          begin
            FindColorsTolerance(Occurances[0], Colors[0], B.x1, B.y1, B.x2, B.y2, 3);
            FindColorsTolerance(Occurances[1], Colors[5], B.x1, B.y1, B.x2, B.y2, 3);
          end;
        'item':
          begin
            FindColorsTolerance(Occurances[1], Colors[1], B.x1, B.y1, B.x2, B.y2, 3);
            FindColorsTolerance(Occurances[2], Colors[2], B.x1, B.y1, B.x2, B.y2, 3);
          end;
        'npc': FindColorsTolerance(Occurances[3], Colors[3], B.x1, B.y1, B.x2, B.y2, 3);
        'object': FindColorsTolerance(Occurances[4], Colors[4], B.x1, B.y1, B.x2, B.y2, 3);
        else
        begin
          FindColorsTolerance(Occurances[0], 1845035, B.X1, B.Y1, B.X2, B.Y2, 0);
          FindColorsTolerance(Occurances[1], clBlack, B.X1, B.Y1, B.X2, B.Y2, 0);
          FindColorsTolerance(Occurances[2], 6121839, B.X1, B.Y1, B.X2, B.Y2, 0);
          TPA := MergeATPA(Occurances);
          ClearDoubleTPA(TPA);
          TPA := ReturnPointsNotInTPA(TPA, B);
        end;
      end;
      if High(TPA) < 1 then
        TPA := MergeATPA(Occurances);
      aTPA := SplitTPAEx(TPA, 7, 1);
      SortATPAFromFirstPoint(aTPA, Point(B.x1, B.y1));
      H := High(Texts);
      L := High(aTPA);
      for I := 0 to H do
      begin
        TextTPA := LoadTextTPA(Texts[i], UpChars, HH);
        for ii := 0 to L do
          if FindTextTPAInTPA(HH, TextTPA, aTPA[ii], TPA) then
          begin
            Result := True;
            case Action of
              ClickLeft: MouseBox(B.x1 + 5, TPA[0].Y, B.x2 - 5, TPA[0].Y + 5, 1);
              Move: MouseBox(B.x1 + 5, TPA[0].Y, B.x2 - 5, TPA[0].Y + 5, 3);
              Nothing:
                begin
                end;
              else
                srl_warn('ChooseOptionMe', 'ClickRight not a valid click for RS menus!', warn_AllVersions);
            end;
            Exit;
          end;
      end;
      Wait(200 + Random(100));
    end;

    {---------- Modified Withdraw Method ----------------}

    procedure Withdraw2(col, row, Amount: Integer);
    var
      BBox: TBox;
    begin
      FixBank;
      FixBankTab;
      BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
      if Amount = 1 then
      begin
        MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 1);
        Wait(RandomRange(50, 150));
      end
      else
      begin
        MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
        Wait(RandomRange(300, 500));
        if (Amount = 5) or (Amount = 10) then
          ChooseOptionMe(['Withdraw-' + IntToStr(Amount), 'draw-' + IntToStr(Amount)], 'all', ClickLeft)
        else if not ChooseOptionMe(['Withdraw-' + IntToStr(Amount) + ' ', 'ithdraw-' + IntToStr(Amount) + ' '], 'all', ClickLeft) then
        begin
          if (ChooseOptionMe(['Withdraw-X', 'draw-X'], 'all', ClickLeft)) then
          begin
            Wait(RandomRange(1300, 1700));
            TypeSend(IntToStr(Amount));
          end;
        end;
      end;
    end;

    function GetIDPrice(ItemID: Integer): integer;  // Credits to Camaro and TAD
    var
      s, t: string;
    begin
      s := getpage('http://itemdb-rs.runescape.com/viewitem.ws?obj=' + IntToStr(ItemID)) t := between('Market price:</b>', '</span>', s);
      s := getnumbers(t);
      result := strtoint(s);
    end;

    procedure Debug(Txt: string);
    begin
      if Debugger then
        Writeln('[' + TehTime + '] ' + Txt);
    end;

    function Randomz: Boolean;
    begin
      case Lowercase(AntiRandomz) of
        'c':
            Result := FindNormalRandoms;
        'r':
            Result := R_FindRandoms;
      end;
    end;

    procedure WhichBars;
    begin
      case lowercase(Players[CurrentPlayer].Strings[0]) of
        'bronze':
          begin
            SmithTop := Point(35, 400);
            SmithBottom := Point(65, 430);
            OreOne := 'opper or';
            OreTwo := 'in or';
            OreOneN := 14;
            OreTwoN := 14;
            ColOne := 3636700;
            ColTwo := 8487307;
            PriceN := (GetIDPrice(436) + GetIDPrice(438));
            ProfitB := (GetIDPrice(2349) - PriceN);
            XPPer := 6.2;
            id := 437;
            idd := 439;
            Exit;
          end;
        'iron':
          begin
            SmithTop := Point(140, 400);
            SmithBottom := Point(170, 430);
            OreOne := 'ron or';
            OreOneN := 28;
            ColOne := 2305611;
            PriceN := (GetIDPrice(440));
            ProfitB := (GetIDPrice(2351) - PriceN);
            XPPer := 12.5;
            id := 441;
            Exit;
          end;
        'silver':
          begin
            SmithTop := Point(190, 400);
            SmithBottom := Point(220, 430);
            OreOne := 'ilver or';
            OreOneN := 28;
            ColOne := 11576227;
            PriceN := (GetIDPrice(442));
            ProfitB := (GetIDPrice(2355) - PriceN);
            XPPer := 13.7;
            id := 443;
            Exit;
          end;
        'steel':
          begin
            SmithTop := Point(240, 400);
            SmithBottom := Point(270, 430);
            OreOne := 'ron or';
            OreTwo := 'oal';
            OreOneN := 9;
            OreTwoN := 18;
            ColOne := 2305611;
            ColTwo := 2833982;
            PriceN := (GetIDPrice(440) + (2 * GetIDPrice(453)));
            ProfitB := (GetIDPrice(2353) - PriceN);
            XPPer := 17.5;
            id := 441;
            idd := 454;
            Exit;
          end;
        'gold':
          begin
            SmithTop := Point(290, 400);
            SmithBottom := Point(320, 430);
            OreOne := 'old or';
            OreOneN := 28;
            ColOne := 1747922;
            PriceN := (GetIDPrice(444));
            ProfitB := (GetIDPrice(2357) - PriceN);
            XPPer := 22.5;
            id := 445;
            Exit;
          end;
        'mith':
          begin
            SmithTop := Point(340, 400);
            SmithBottom := Point(370, 430);
            OreOne := 'ithril or';
            OreTwo := 'oal';
            OreOneN := 5;
            OreTwoN := 20;
            ColOne := 7491406;
            ColTwo := 2833982;
            PriceN := (GetIDPrice(447) + (4 * GetIDPrice(453)));
            ProfitB := (GetIDPrice(2359) - PriceN);
            XPPer := 30.0;
            id := 448;
            idd := 454;
            Exit;
          end;
        'addy':
          begin
            SmithTop := Point(390, 400);
            SmithBottom := Point(420, 430);
            OreOne := 'damantite or';
            OreTwo := 'oal';
            OreOneN := 4;
            OreTwoN := 24;
            ColOne := 5136717;
            ColTwo := 2833982;
            PriceN := (GetIDPrice(449) + (6 * GetIDPrice(453)));
            ProfitB := (GetIDPrice(2361) - PriceN);
            XPPer := 37.5;
            id := 450;
            idd := 454;
            Exit;
          end;
        'rune':
          begin
            SmithTop := Point(440, 400);
            SmithBottom := Point(470, 430);
            OreOne := 'unite or';
            OreTwo := 'oal';
            OreOneN := 3;
            OreTwoN := 24;
            ColOne := 7694927;
            ColTwo := 2833982;
            PriceN := (GetIDPrice(451) + (8 * GetIDPrice(453)));
            ProfitB := (GetIDPrice(2363) - PriceN);
            XPPer := 50.0;
            id := 452;
            idd := 454;
            Exit;
          end;
      end;
      Writeln('Bar type unavailable');
      Players[CurrentPlayer].Loc := 'InvalidBar';
      Logout;
    end;

    function BankFindR: Boolean;
    var
      Banker: TNPC;
      iTime: Integer;
    begin
      if not LoggedIn then Exit;
      Players[CurrentPlayer].Loc := 'ReflectionBank';
      Debug('Reflection Bank Open');
      if (DistanceFrom(Point(3270, 3167)) > 5) then
        WalkToTile(Point(3270, 3167), 2, 0);
      if (DistanceFrom(Point(3270, 3167)) > 5) then
      begin
        Players[CurrentPlayer].Loc := 'NotAtBank';
        Logout;
        Exit;
      end;
      if (FindNPC('Banker', Banker)) then
      begin
        Mouse(Banker.MS.X, Banker.MS.Y, 4, 4, False);
        if r_WaitOption('ank B', 300 + Random(100)) then
        begin
          Wait(125 + Random(100));
          Flag;
          iTime := GetSystemTime + 3000 + Random(2000);
          while (iTime > GetSystemTime) do
          begin
            Result := (BankScreen) or (PinScreen);
            if Result then
            begin
              if PinScreen then
                InPin(Players[CurrentPlayer].Pin);
              Players[CurrentPlayer].Loc := 'BankScreen';
              Exit;
            end;
            Wait(RandomRange(100, 400));
          end;
        end;
      end;
    end;

    function FindBanker: Boolean;
    begin
      if not LoggedIn then
        Exit;
      Players[CurrentPlayer].Loc := 'FindBanker';
      Result := BankFindR;
      if not Result then
        Result := OpenBank('akb', False, False);
      if PinScreen then
        InPin(Players[CurrentPlayer].Pin);
      Players[CurrentPlayer].Loc := 'BankScreen';
    end;

    function OpenBanker: Boolean;
    var
      iTime: Integer;
    begin
      Result := False;
      iTime := GetSystemTime + 20000 + Random(5000);
      while (iTime > GetSystemTime) do
      begin
        if not LoggedIn then Break;
        Result := FindBanker;
        if Result then
        begin
          Players[CurrentPlayer].Loc := 'Withdrawing';
          Debug('OpenBanker win');
          Exit;
        end;
        Wait(350 + Random(200));
      end;
      Players[CurrentPlayer].Loc := 'LostOpenBank';
      Debug('OpenBanker fail');
    end;

    function Count(Bars: Boolean): Integer;
    var
      BarDTM, OreDTM: Integer;
    begin
      if Bars then
      begin
        BarDTM := DTMFromString('78DA637463626078CC80027C7C0B18FE03694' + '620FE0F048C0140358F18D000231209A44D816A5E1250E3045473' + '9B801A17A09A0F04D4D802D5DC27A0C613A8E6357E3500B76E0E4' + '1');
        Result := CountItemsIn('inv', 'dtm', BarDTM, []) FreeDtm(BarDTM);
      end
      else
      begin
        OreDTM := DTMFromString('78DA637465626078CE8002FC0C9419FE03694' + '620FE0F048C814035F719D000231209A48D816A5E1150E3448439' + '5E40356F09A87107AAB941408D3D50CD27FC6A005E520DE0');
        Result := CountItemsIn('inv', 'dtm', OreDTM, []) FreeDtm(OreDTM);
      end;
    end;

    procedure Calibrate;
    var
      I, J, IndexSpot: Integer;
      BB: TPoint;
      Ore: TBankSlot;
    begin
      Debug('Calibrating');
      FixBank;
      for J := 0 to 1 do
      begin
        case J of
          0:
            begin
              Ore.Name := OreOne;
              if BankContains(Ore, IndexSpot) then
              begin
                OreSlotO := (IndexSpot + 1);
                Debug('OreSlotO := ' + IntToStr(OreSlotO));
              end;
            end;
          1:
            begin
              if OreTwo = '' then
                break;
              Ore.Name := OreTwo;
              if BankContains(Ore, IndexSpot) then
              begin
                OreSlotT := (IndexSpot + 1);
                Debug('OreSlotT := ' + IntToStr(OreSlotT));
              end;
            end;
        end;
      end;
      if OreSlotO > 0 then // If it has everything it needs, exit
        if OreTwo <> '' then
          if OreSlotT > 0 then
            Exit;
      for J := 0 to 1 do  // If not, use the colour backups.
        for I := 1 to 50 do
        begin
          BB := BankIndexToMSPoint(I);
          case J of
            0:
              begin
                if (OreSlotO > 0) then
                  break;
                begin
                  BB := BankIndexToMSPoint(OreSlotO);
                  MMouse(BB.x + 10, BB.y + 10, 3, 3);
                  Wait(700 + random(200));
                  if IsUpText(OreOne) then
                    Break
                  else
                  begin
                    OreSlotO := 0;
                    BB := BankIndexToMSPoint(OreSlotO);
                  end;
                end;
                MMouse(BB.x + 10, BB.y + 10, 3, 3);
                Wait(500 + random(100));
                Debug('Getting Uptext');
                Debug('Ore One Text := ' + GetUpText);
                if IsUpText(OreOne) then
                begin
                  Debug('Ore Slot 1 := ' + IntToStr(i));
                  OreSlotO := I;
                  Break;
                end;
              end;
            1:
              begin
                if OreTwo = '' then
                  break;
                if (OreSlotT > 0) then
                  Exit;
                MMouse(BB.x + 10, BB.y + 10, 3, 3);
                Wait(400 + random(100));
                Debug('Getting Uptext');
                Debug('Ore Two Text := ' + GetUpText);
                if IsUpText(OreTwo) then
                begin
                  Debug('Ore Slot 2 := ' + IntToStr(i));
                  OreSlotT := I;
                  Break;
                end;
              end;
          end;
        end;
    end;

    procedure Depositing(x: Integer);
    var
      A: Extended;
    begin
      IncEx(BSmith, X);  // Total Bars
      IncEx(Players[CurrentPlayer].Integers[2], X); // Player bars
      Inc(LDS);  // Loads done before switching
      Inc(Players[CurrentPlayer].Integers[1]);  // player loads
      Inc(LD);  // TotalLoads
      A := (X * XPPer);  // XP math
      XPGained := XPGained + A;  // Easy to understand
      IncEx(Players[CurrentPlayer].Integers[3], (ProfitB * X));  // Profit
      DepositAll;
    end;

    function Calibrationer: Boolean;
    var
      I, T: Integer;
    begin
      T := GetSystemTime + 60000;
      while (T > GetSystemTime) do
      begin
        if (OreSlotO = 0) then
          Calibrate
        else
        begin
          Result := True;
          Players[CurrentPlayer].Loc := 'OreFound';
          Debug('Ore Found');
          Exit;
        end;
        Wait(RandomRange(1000, 2500));
        Inc(I);
        if I >= 5 then
          Break;
      end;
      begin
        Players[CurrentPlayer].Loc := 'OreNotFound';
        Debug('Ore Not Found');
        CloseBank;
        Logout;
        Exit;
      end;
    end;

    procedure AddtoArrayX(addthisx: integer; var theArray: array of Integer);
    var
      f: Integer;
    begin
      f := getarraylength(theArray);
      theArray[f + 1] := addthisx;
    end;

    function ICounter(var T: TPoint; var TehSlots: array of Integer; Which: string): Integer;
    var
      Idt, I, Xtra, Inv: Integer;
    begin
      T.x := R_CountItems(id);
      if idd > 0 then
        T.y := R_CountItems(idd);
      Result := T.x + T.y;
      Xtra := R_CountExcept([id, idd]);
      if Xtra > 0 then
      begin
        for I := 0 to 27 do
        begin
          idt := SmartGetFieldArrayInt(Inv, InventoryItemIDs, i);
          if (idt > 0) and (not (InIntArray([id, idd], idt))) then
            AddToArrayX(i, TehSlots);
        end;
        SmartFreeObject(Inv);
        for I := 0 to High(TehSlots) do
          Debug('Slot[' + IntToStr(TehSlots[i]) + '] has a random object in it');
      end;
    end;

    procedure Withdrawing(A: Integer);
    var
      Pointy, bs: Tpoint;
      Number, I, Ratio : Integer;
      LeftSlots: array of Integer;
      Ore: TBankSlot;
    begin
      if A = 0 then
      begin
        Ore := GetBankSlot(OreSlotO-1);
        N1 := Ore.Stack
        If not N1 > 0 Then
        begin
          Players[CurrentPlayer].Loc := 'OreOneNotFound';
          Debug('Ore Not Found');
          CloseBank;
          Logout;
          Exit;
        end;
        Debug('Id is : ' + IntToStr(Ore.id) + ' and should be : ' + IntToStr(id-1));
        if Ore.Id <> (Id-1) Then
        begin
          Players[CurrentPlayer].Loc := 'OreOneGone';
          Debug('Out of ore one');
          CloseBank;
          Logout;
          Exit;
        end;
        if (N1 > OreOneN) then
          N1 := OreOneN; // if its more than needed, keep it at needed
        if OreTwo <> '' Then
        begin
          Ore := GetBankSlot(OreSlotT-1);
          N2 := Ore.Stack
          If not N2 > 0 Then
          begin
            Players[CurrentPlayer].Loc := 'OreTwoNotFound';
            Debug('Ore Not Found');
            CloseBank;
            Logout;
            Exit;
          end;
          Debug('Id is : ' + IntToStr(Ore.id) + ' and should be : ' + IntToStr(idd-1));
          if Ore.ID <> (Idd-1) Then
          begin
            Players[CurrentPlayer].Loc := 'OreTwoGone';
            Debug('Out of ore two');
            CloseBank;
            Logout;
            Exit;
          end;
          if (N1 > OreOneN) then
            N1 := OreOneN; // if its more than needed, keep it at needed
          if (N2 > OreTwoN) then
            N2 := OreTwoN; // same
          if (OreOneN > OreTwoN) then
            Ratio := (OreOneN / OreTwoN)
          else
            Ratio := (OreTwoN / OreOneN); // finding ratio (1:4 etc)
          if ((N1 * Ratio) > N2) then  // If less oretwo than needed for amount of oreone
          begin
            N1 := Trunc(N2 / Ratio);  //ore one is the right amount needed.
            N2 := (N1 * Ratio);
          end;
          Debug('Per one first ore, second ore needs: ' + IntToStr(ratio) + ' ores');
          Debug('First ore withdraw amount := ' + IntToStr(N1));
          Debug('Second ore withdraw amount := ' + IntToStr(N2));
        end;
      end;
      case A of
        0:
          begin
            bs := BankIndexToBankPoint(OreSlotO);
            Withdraw2(bs.x, bs.y, N1);
            Wait(RandomRange(750, 1500));
            Number := ICounter(Pointy, LeftSlots, Players[CurrentPlayer].Strings[0]);
            if (Number <> N1) then // Inventory is wrong #
              if (Pointy.x = N1) then // Right amount of ores
              begin // Get rid of other stuff.
                for I := 0 to High(LeftSlots) do
                  Deposit(LeftSlots[i], LeftSlots[i], True);
              end
            else // Doesnt have the right amount of ores
            if (Pointy.x > N1) then // Has too many ores
            begin
              Deposit(1, 1, ((Number - (Length(LeftSlots))) - N1));
            end
            else // Not enough ores
            begin
              if (Number < N1) then
                Withdraw2(bs.x, bs.y, (N1 - Number));
            end;
          end;
        1:
          begin
            if OreSlotT = 0 then
              Exit;
            bs := BankIndexToBankPoint(OreSlotT);
            Withdraw2(bs.x, bs.y, N2);
            Wait(RandomRange(750, 1500));
            Number := ICounter(Pointy, LeftSlots, Players[CurrentPlayer].Strings[0]);
            if (Pointy.y <> N2) then  // Wrong # of ores
              if (Pointy.y > N2) then  // Has too many ores
                Deposit(1, 1, (Number - N2))
              else  // Not enough ores
              if Number < N2 then
                Withdraw2(bs.x, bs.y, (N2 - Number));
          end;
      end;
    end;

    function Bankinger: Boolean;
    var
      TimeoutT, BA, J, IC: Integer;
      OB, DP: Boolean;
    begin
      if not LoggedIn then Exit;
      Randomz;
      OB := False;
      BA := Count(True);
      DP := (InvCount > 0);
      TimeoutT := GetSystemTime + 15000 + Random(7500);
      Debug('Opening Bank');
      while (TimeoutT > GetSystemTime) do
      begin
        if OpenBanker then
        begin
          Debug('Opened Bank');
          OB := True;
          Break;
        end;
        Wait(250 + Random(150));
      end;
      if not OB then
      begin
        Players[CurrentPlayer].Loc := 'Couldnt open Bank';
        Debug('OpenBank Failed');
        Logout;
        Exit;
      end;
      if DP then
        Depositing(BA);
      if not Calibrationer then
        Exit;
      for J := 0 to 1 do
        Withdrawing(J);
      CloseBank;
      Wait(RandomRange(1500, 2500));
      IC := InvCount;
      Result := (IC >= (OreOneN + OreTwoN));
      Debug('Inv Count := ' + IntToStr(IC));
      if not Result then
      begin
        IC := Count(False);
        Result := (IC >= (OreOneN + OreTwoN));
        Debug('DTM Count := ' + IntToStr(Count(False)));
      end;
      if Result then
      begin
        Players[CurrentPlayer].Loc := 'DoneWithdraw' Debug('Withdraw Success');
      end
      else
      begin
        Players[CurrentPlayer].Loc := 'WithdrawFail';
        Debug('Withdraw Fail');
      end;
      if not Result then
        Logout;
    end;

    function AutoColorCactus: Integer;
    var
      arP: TPointArray;
      arC: array of Integer;
      tmpCTS, i, h, n, arL, col: Integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(1.51, 1.28);
      FindColorsSpiralTolerance(650, 140, arP, 3042671, MMX1, MMY1, MMX2, MMY2, 10);
      if (Length(arP) = 0) then
      begin
        Debug('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
      n := 0;
      h := High(arP);
      i := Length(ArP);
      SetArrayLength(arC, i);
      for i := 0 to H do
        if rs_OnMinimap(arP[i].x, arP[i].y) then
        begin
          col := GetColor(arP[i].x, arP[i].y) if Col > 0 then
          begin
            arC[n] := col;
            Inc(n);
          end;
        end;
      ClearSameIntegers(arC);
      arL := High(arC);
      Debug('Length of autocolor array := ' + IntToStr(Length(arC)));
      for i := 0 to arL do
      begin
        Result := arC[i];
        Writeln('AutoColor = ' + IntToStr(arC[i]));
        Break;
      end;
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
      if (i = arL + 1) then
        Debug('AutoColor failed in finding the color.');
    end;

    function WalkTPA(C1, C2, XM, YM, XR, YR, Tol: Integer; SortPoint: TPoint): Boolean;
    var
      TPA: TPointArray;
      TDPA: T2DPointArray;
      I, CTS, H, X, Y: Integer;
    begin
      if not LoggedIn then
        Exit;
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorspeed2Modifiers(0.10, 25);
      FindColorsSpiralTolerance(MMCX, MMCY, TPA, C1, MMX1, MMY1, MMX2, MMY2, Tol);
      if Length(TPA) = 0 then
      begin
        FindColorsSpiralTolerance(MMCX, MMCY, TPA, C2, MMX1, MMY1, MMX2, MMY2, (Tol + 10));
        Debug('First Colour failed, length of second array = ' + IntToStr(Length(TPA)));
      end
      else
        Debug('Found First Colour, length of array = ' + IntToStr(Length(TPA)));
      if Length(TPA) = 0 then
      begin
        Debug('Didnt find either colour, quitting walktpa');
        Exit;
      end;
      TDPA := TPAToATPA(TPA, 5);
      SortATPAFromFirstPoint(TDPA, SortPoint);
      DebugTPA(TPA, '');
      H := High(TDPA);
      for i := 0 to H do
      begin
        MiddleTPAEx(TDPA[i], x, y);
        if rs_OnMinimap(x, y) then
        begin
          MouseFlag(x + XM, y + YM, XR, YR, 0);
          Result := True;
          Inc(TPAWalks);
          Wait(200 + Random(80));
          ColorToleranceSpeed(cts);
          Exit;
        end;
      end;
      Result := False;
      ColorToleranceSpeed(cts);
    end;

    function PlaceCheck(Tile: TPoint; Dist: Integer): Boolean;
    var
      D: Integer;
    begin
      R_Flag;
      if (DistanceFrom(Tile) > Dist) then
      begin
        Debug('Walking to tile - PlaceCheck');
        WalkToTile(Tile, 0, 0);
        Inc(TileWalks);
      end;
      R_Flag;
      D := DistanceFrom(Tile);
      Debug('Distance from reference tile := ' + IntToStr(D));
      Result := (D <= Dist);
    end;

    function FirstStepN(I: Integer): Boolean;
    begin
      Randomz;
      case I of
        0:
          begin
            Debug('First step to furnace');
            if not WalkTPA(CactC, 3303765, ( - 10), ( - 15), 3, 3, 0, Point(MMX2 - 30, MMCY)) then
            begin
              Debug('TPA Walk failed first furnace step');
              WalkToTile(Point(3277, 3174), 1, 0);
              Inc(TileWalks);
            end;
            Result := PlaceCheck(Point(3277, 3174), 4);
          end;
        1:
          begin
            Debug('First step to bank');
            if not WalkTPA(CactC, 3303765, ( - 10), ( - 15), 3, 3, 0, Point(650, MMY2)) then
            begin
              Debug('TPA Walk failed first bank step');
              WalkToTile(Point(3277, 3174), 1, 0);
              Inc(TileWalks);
            end;
            Result := PlaceCheck(Point(3277, 3174), 4);
          end;
      end;
    end;

    function SecondStepN(Dir: Integer): Boolean;
    var
      x, y: Integer;
    begin
      Randomz;
      case Dir of
        0:
          begin
            Debug('Second step to furnace');
            if FindSymbol(x, y, 'furnace') then
            begin
              Debug('Found furnace symbol');
              MouseFlag(x, y + 2, 1, 1, 0);
            end
            else
            begin
              Debug('Walking with tiles');
              WalkToTile(Point(3276, 3186), 1, 0);
              Inc(TileWalks);
            end;
            Result := PlaceCheck(Point(3276, 3186), 3);
          end;
        1:
          begin
            if not WalkTPA(195836, 2216175, 10, 0, 2, 2, 5, Point(580, 110)) then
              if FindSymbol(x, y, 'bank') then
              begin
                Debug('Found bank symbol');
                MouseFlag(x + 8, y, 1, 1, 0);
              end
            else
            begin
              Debug('Walking with tiles');
              WalkToTile(Point(3270, 3167), 1, 0);
              Inc(TileWalks);
            end;
            Result := PlaceCheck(Point(3270, 3167), 4);
          end;
      end;
    end;

    function Walk(Step: Integer): Boolean;
    var
      Col: string;
    begin
      if not LoggedIn then
        Exit;
      Randomz;
      Players[CurrentPlayer].Loc := 'Walking';
      Debug('Starting Walking');
      if (GetMMLevels('run', Col) = 0) then
        SetRun(True);
      case Step of
        0:
          begin
            Randomz;
            RunEnergy(40);
            Debug('Run Energy:= ' + IntToStr(GetMMLevels('run', Col)));
            if FirstStepN(0) then
              if SecondStepN(0) then
              begin
                Players[CurrentPlayer].Loc := 'Furnace';
                Result := True;
                exit;
              end;
            Players[CurrentPlayer].Loc := 'FurnaceWalkFail';
          end;
        1:
          begin
            Randomz;
            RunEnergy(40);
            Debug('Run Energy:= ' + IntToStr(GetMMLevels('run', Col)));
            if FirstStepN(1) then
              if SecondStepN(1) then
              begin
                Players[CurrentPlayer].Loc := 'Bank';
                Result := True;
                exit;
              end;
            Players[CurrentPlayer].Loc := 'BankWalkFail';
          end;
      end;
    end;

    function FindFurnaceTPA: Boolean;
    var
      TPA: TPointArray;
      TDPA: T2DPointArray;
      I, CTS, H, X, Y: Integer;
    begin
      if not LoggedIn then
        Exit;
      MakeCompass('w');
      SetAngle(False);
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorspeed2Modifiers(0.10, 25);
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2177234, MSX1, MSY1, MSX2, MSY2, 15);
      if Length(TPA) = 0 then
        FindColorsSpiralTolerance(MSCX, MSCY, TPA, 1055616, MSX1, MSY1, MSX2, MSY2, 20);
      TDPA := SplitTPA(TPA, 15);
      SortATPAFromFirstPoint(TDPA, Point(MSCX + 10, MSCY + 20));
      DebugATPABounds(TDPA, '');
      H := High(TDPA);
      for i := 0 to H do
      begin
        Wait(10);
        MiddleTPAEx(TDPA[i], x, y);
        MMouse(x + 5, y, 2, 2);
        Wait(RandomRange(300, 500));
        if IsUpTextMultiCustom(['melt', 'urnace', 'urna', 'Man']) then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, False);
          if WaitOptionMulti(['melt'], 800) then
          begin
            Result := True;
            ColorToleranceSpeed(cts);
            Exit;
          end;
        end;
      end;
      Result := False;
      ColorToleranceSpeed(cts);
    end;

    function FindFurnaceer(var FTile: TPoint): Boolean;
    begin
      Debug('TPA finder');
      FindFurnaceTPA;
      FFlag(0);
      Wait(RandomRange(1000, 1500));
      Result := SmeltingScreen;
      if not Result then
      begin
        MakeCompass(0);
        SetAngle(True);
        Debug('Using Tile Location');
        Result := TileOnMS(Point(3272, 3186), 10);
        if Result then
          FTile := Point(3272, 3186);
        if not Result then
        begin
          Debug('Using FindObject');
          Result := FindObject(FTile, 11666);
        end;
        if not Result then
        begin
          Debug('Using SRL');
          FTile := Point( - 1, - 1);
          Result := OpenFurnace;
        end;
      end;
    end;

    function IsSmeltScreen: Boolean;
    var
      Col: Integer;
    begin
      Result := SmeltingScreen;
      if not Result then
        Result := ValidInterface(311);
      if not Result then
      begin
        Col := GetColor(59, 410);
        Result := SimilarColors(Col, 2704987, 10);
      end;
    end;

    function LevelUp: Boolean;  // Stoled from me, who stole it from Wizzy
    begin
      Result := FindNPCChatText('gratu', Nothing);
      if not Result then
        Result := FindNPCChatText('atio', Nothing);
      if Result then
      begin
        while ClickContinue(True, True) do
          Wait(500);
        Inc(ReportVars[4]);
      end;
    end;

    procedure AB;
    begin
      if (RandomRange(0, 100) > AntiBanzor) then
      begin
        Randomz;
        case Random(10) of
          0, 2:
            begin
              GameTab(1 + Random(17));
              Wait(RandomRange(1000, 2000));
            end;
          1, 3:
            begin
              case Random(2) of
                0: SendArrowSilentWait(0, RandomRange(750, 2000));
                1: SendArrowSilentWait(2, RandomRange(750, 2000));
              end;
              Wait(RandomRange(500, 1800));
            end;
          4, 6:
            begin
              SleepAndMoveMouse(1250);
            end;
          5, 7:
            begin
              PickupMouse;
            end;
          8, 9:
            begin
              RandomMovement;
            end;
        end;
        Inc(AntiBans);
        GameTab(tab_Inv);
        Wait(100 + Random(50));
        Randomz;
      end;
    end;

    function RandCoords(One, Two: Tpoint): Tpoint;
    begin
      Result.x := RandomRange(One.x, Two.x);
      Result.y := RandomRange(One.y, Two.y);
    end;

    function Smelteringer: Boolean;
    var
      FurnT, LocF, Click: TPoint;
      WaitTime, x, y: Integer;
    begin
      Result := False;
      if not LoggedIn then
        Exit;
      Players[CurrentPlayer].Loc := 'Smelting';
      Randomz;
      Debug('FindFurnaceer');
      R_Flag;
      Wait(RandomRange(300, 750));
      if not FindFurnaceer(FurnT) then
      begin
        Players[CurrentPlayer].Loc := 'SmeltingFail';
        Debug('Could not open furnace');
        Logout;
        Exit;
      end;
      Debug('Found Furnace');
      if FurnT.x > 0 then
      begin
        if not TileOnMS(FurnT, 5) then
          WalkToTile(FurnT, 1, 0);
        if not TileOnMS(FurnT, 5) then
        begin
          Debug('FurnT didnt work');
          Players[CurrentPlayer].Loc := 'FinderBroke';
          Logout;
          Exit;
        end;
        if CharacterMoving then
          Wait(RandomRange(500, 1000));
        LocF := TileToMS(FurnT, 5);
        MMouse(LocF.x, LocF.y, 3, 3);
        Wait(500);
        Debug(GetUpText);
        if IsUpText('melt') then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, True);
        end;
      end;
      Wait(250);
      R_Flag;
      WaitTime := GetSystemTime + 4000;
      while (WaitTime > GetSystemTime) do
      begin
        if IsSmeltScreen then
          Break;
        Wait(50 + Random(50));
        Randomz;
      end;
      if not IsSmeltScreen then
      begin
        Debug('Smelting Screen not found');
        Players[CurrentPlayer].Loc := 'SmeltScreen Fail';
        Logout;
        Exit;
      end;
      Players[CurrentPlayer].Loc := 'Smelting Screen';
      Debug('Smelting Screen found');
      Click := RandCoords(SmithTop, SmithBottom);
      Mouse(Click.x, Click.y, 2, 2, False);
      Wait(RandomRange(200, 600));
      if ((OreOneN = 1) or (OreOneN = 5) or (OreOneN = 10)) then
        ChooseOption('melt ' + IntToStr(OreOneN))
      else
      begin
        ChooseOption('melt X');
        Wait(1000 + Random(100));
        TypeSend(IntToStr(OreOneN));
      end;
      Debug('Smelting Bars');
      WaitTime := GetSystemTime + 120000;
      while (WaitTime > GetSystemTime) do
      begin
        AB;
        GameTab(tab_Inv);
        Wait(RandomRange(200, 400));
        Randomz;
        if LevelUp then
        begin
          Inc(Levels);
          Smelteringer;
        end;
        if (GetAnimation < 1) then
        begin
          Wait(RandomRange(500, 1500));
          if (GetAnimation < 1) and (Count(False) = 0) then
            break;
        end;
      end;
      if GetAnimation > 0 then
        Wait(2000 + Random(1500));
      Debug('Animation = ' + IntToStr(GetAnimation));
      Result := True;
      Players[CurrentPlayer].Loc := 'Smelted';
      R_MakeCompass('n');
      SetAngle(True);
    end;

    procedure SetupPlayer;
    begin
      WhichBars;
      OreSlotO := 0;
      OreSlotT := 0;
      BRTime := 0;
      if Rest then
        MarkTime(BRTime);
      SetAngle(true);
      R_MakeCompass('n');
      CactC := AutoColorCactus;
      if CactC = 0 then
        CactC := 4158297;
    end;

    procedure Rester;
    var
      rl, RH, R: Integer;
    begin
      if not LoggedIn then
        Exit;
      if (PlayersActive > 1) then
      begin
        if (LDS >= (Players[CurrentPlayer].Integers[0] + Random(5))) then
        begin
          Debug('Changing players instead of resting');
          LDS := 0;
          NextPlayer(True);
          SetupPlayer;
          Exit;
        end;
      end
      else
      begin
        if (TimeFromMark(Sleeper) >= SleepEvery) then
        begin
          if Sleeping then
          begin
            rl := SleepingFor - ((SleepingFor / 100) * 10);
            RH := SleepingFor + ((SleepingFor / 100) * 10);
            R := RandomRange(rl, RH);
            Debug('Sleeping For : ' + IntToStr(Round(R / 1000 / 60 / 60)) + ' hours');
            Logout;
            Wait(R);
            Inc(Sleeped);
            IncEx(SleepT, R);
            BRTime := 0;
            MarkTime(BRTime);
            MarkTime(Sleeper);
            LoginPlayer;
          end;
        end;
        if not (TimeFromMark(BRTime) >= RestEvery) then
          Exit;
        if not Rest then
          Exit;
        Debug('Player Resting');
        rl := RestingFor - ((RestingFor / 100) * 20);
        RH := RestingFor + ((RestingFor / 100) * 30);
        R := RandomRange(rl, RH);
        Debug('Resting For : ' + IntToStr(Round(R / 1000 / 60)) + ' minutes');
        Logout;
        Wait(R);
        Inc(RAmount);
        IncEx(RTTime, R);
        BRTime := 0;
        MarkTime(BRTime);
        LoginPlayer;
      end;
    end;

    function PerHour(Number: Extended): Extended;
    var
      A, F, T: Extended;
    begin
      T := (GetTimeRunning / 1000); // Into Seconds
      A := (Number / T)  // /Second
      F := (A * 3600)  // 3600s/1h turns into per hour
      Result := F;
    end;

    procedure Proggy;
    var
      I, BPH, XPH, TP, TPP: Integer;
    begin
      BPH := Round(PerHour(BSmith));
      XPH := Round(PerHour(XPGained));
      TP := (ProfitB * BSmith);
      TPP := Round(PerHour(TP));
      ClearReport;
      SRLRandomsReport;
      Changereportwidth(500);
      AddToReport(' ');
      AddToReport('3Garrett3''s Baby Melter ' + VersionN + ' Progress Report');
      AddToReport('*********************************************');
      AddToReport('Ran for: ' + TimeRunning);
      AddToReport('Loads: ' + IntToStr(LD));
      AddToReport('Bars: ' + IntToStr(BSmith));
      AddToReport('Bars per Hour: ' + IntToStr(BPH));
      AddToReport('Profit: ' + IntToStr(TP) + 'gp');
      AddToReport('Profit Per Hour: ' + IntToStr(TPP) + 'gp');
      AddToReport('Leveled: ' + IntToStr(Levels) + ' Times');
      AddToReport('Xp Per hour: ' + IntToStr(XPH));
      if (RAmount > 0) then
      begin
        AddToReport('Rested: ' + IntToStr(RAmount) + ' Times');
        AddToReport('Rested for: ' + MsToTime(RTTime, 0));
      end;
      if (Sleeped > 0) then
      begin
        AddToReport('Slept: ' + IntToStr(Sleeped) + ' Times');
        AddToReport('Slept for: ' + MsToTime(SleepT, 0));
      end;
      if FullProggy then
      begin
        AddToReport('TPA Walks: ' + IntToStr(TPAWalks));
        AddToReport('Reflection Walks: ' + IntToStr(TileWalks));
        AddToReport('Antibans: ' + IntToStr(AntiBans));
      end;
      AddToReport('*********************************************');
      for i := 0 to HowManyPlayers - 1 do
      begin
        AddToReport(IntToStr(i) + ': ' + Players[i].Nick + ' | ' + Left(BoolToStr(Players[i].active), 1) + ' | ' + IntToStr(Players[i].Integers[1]) + ' Loads | ' + IntToStr(Players[i].Integers[2]) + ' Bars | ' + IntToStr(Players[i].Integers[3]) + ' Profit | ' + Players[i].Loc);
      end;
      AddToReport(' ');
    end;

    procedure SetupScript;
    begin
      Debugger := Debugging;
      ClearDebug;
      SmartSettings;
      SetupSRL;
      SetupReflection;
      SymbolAccuracy := 0.45;
      MouseSpeed := MSpeed;
      if Sleeping then
        MarkTime(Sleeper);
      DeclarePlayers;
      LoginPlayer;
    end;

    begin
      SetupScript;
      repeat
        SetupPlayer;
        repeat
          if not Bankinger then
            Logout;
          Proggy;
          if not Walk(0) then
            Logout;
          if not Smelteringer then
            Logout;
          if not Walk(1) then
            Logout;
          Rester;
        until (not LoggedIn) Players[CurrentPlayer].Active := False;
        if AllPlayersInactive then
          TerminateScript;
        NextPlayer(False);
      until (AllPlayersInactive)
    end.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  6. #6
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Looked through mine yet? Save me the embarrassment by PMing me back the results. Thanks
    "SRL is the best SCAR community in the World, with the most talented programmers: adjust your volume."
    -Wizzup?

  7. #7
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by uncfan1119 View Post
    Looked through mine yet? Save me the embarrassment by PMing me back the results. Thanks
    I'm working on yours unc and I'll pm it to you when I'm done.

    You're after unc Garret

  8. #8
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by JAD View Post
    I'm working on yours unc and I'll pm it to you when I'm done.

    You're after unc Garret
    K thanks. I'll read it in the morning

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  9. #9
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Just finished yours Unc. Pm'd you.



    Quote Originally Posted by 3Garrett3 View Post
    K thanks. I'll read it in the morning
    I might not be able to do it until tomorrow, sorry. I have uni tomorrow so I have to get some rest. It depends on how long it takes me to finish my paper though

    ~JAD

  10. #10
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Props to you!

    Why is the script in the original so.. spaced out.

    :S Made it massive.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  11. #11
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Why is the script in the original so.. spaced out.

    :S Made it massive.
    Because it's in code tags. Without the code tags it's not spaced out, but then you have to scroll a lot.

    Is there a tag for just making a scroll bar on a group of text like that? The code tags do make it look aweful.

  12. #12
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Just a few things

    I find

    Result := (not (A = 1));

    ->

    Result := (A <>1);

    easier,

    I've always found long cases to be easier to read in arrays like

    case Lowercase(Players[CurrentPlayer].Strings[0])of 'tree' : g := 0; 'oak' : g := 1; 'willow' : g := 2; 'yew' : g := 3; 'magic' : g := 4; end;end;

    ->

    ['tree', 'oak', 'wilow', 'yew', 'magic']

    then you can use StrInArray/StrInArrayEx or whatever...

    Ex:
    C := [65280, 65535, 255, 16776960]
    St := ['on', 'friends', 'off', 'hide'];


    And, TBH if you're gonna comment on people standards you could atleast be consistant with your bolded words (capitalized/lowercase) preferably all lowercase.

  13. #13
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    preferably all lowercase.
    Nou.

    I usually uppercase all bold words. But I sometimes get lazy and use a program to format my stuff, and it unbolds everything

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  14. #14
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @Garret:

    Looking at your constants, I think it's rather confusing to have the comments on the line below. I think this looks more readable:
    SCAR Code:
    const
      AntiRandomz = 'C'; // 'R' or 'C' for reflection or colour antirandoms.
      Rest = True;// Do you want to rest?
      RestingFor = 30 * 60 * 1000; // Just change the first number to change minutes
      RestEvery = 60 * 60 * 1000; // Just change the first number to change minutes
      Sleeping = False; // Do you want to sleep? Only needed for long runs
      SleepingFor = 3 * 60 * 60 * 1000; // Change the first number to change hours
      SleepEvery = 2 * 60 * 60 * 1000; // Change the first number to change hours
      Debugging = True; // Debug the script?
      FullProggy = True; // Have a very informative debug type of proggy?
      MSpeed = 20; // Your mouse speed
      AntiBanzor = 90; // The percentage that it wont do antiban. Ie for 85, the script will do antiban 15% of the time.
      VersionN = 'V1.0'; // Don't change!

    Saves lines and is less confusing.


    SCAR Code:
    for I := 0 to H do
      begin
        TextTPA := LoadTextTPA(Texts[i], UpChars, HH);
        for ii := 0 to L do
          if FindTextTPAInTPA(HH, TextTPA, aTPA[ii], TPA) then
          begin
            Result := True;
            case Action of
              ClickLeft: MouseBox(B.x1 + 5, TPA[0].Y, B.x2 - 5, TPA[0].Y + 5, 1);
              Move: MouseBox(B.x1 + 5, TPA[0].Y, B.x2 - 5, TPA[0].Y + 5, 3);
              Nothing:
                begin
                end;
              else
                srl_warn('ChooseOptionMe', 'ClickRight not a valid click for RS menus!', warn_AllVersions);
            end;
            Exit;
          end;
      end;

    Could just be:

    SCAR Code:
    for I := 0 to H do
      begin
        TextTPA := LoadTextTPA(Texts[i], UpChars, HH);
        for ii := 0 to L do
        begin
          Result := FindTextTPAInTPA(HH, TextTPA, aTPA[ii], TPA);
          if not(Result)then continue;
          case Action of
            ClickLeft: MouseBox(B.x1 + 5, TPA[0].Y, B.x2 - 5, TPA[0].Y + 5, 1);
            Move: MouseBox(B.x1 + 5, TPA[0].Y, B.x2 - 5, TPA[0].Y + 5, 3);
              else
                srl_warn('ChooseOptionMe', 'ClickRight not a valid click for RS menus!', warn_AllVersions);
          end;
          Exit;
        end;
      end;


    In Withdraw2:
    SCAR Code:
    begin
        MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
        Wait(RandomRange(300, 500));
        if (Amount = 5) or (Amount = 10) then
          ChooseOptionMe(['Withdraw-' + IntToStr(Amount), 'draw-' + IntToStr(Amount)], 'all', ClickLeft)
        else if not ChooseOptionMe(['Withdraw-' + IntToStr(Amount) + ' ', 'ithdraw-' + IntToStr(Amount) + ' '], 'all', ClickLeft) then
        begin
          if (ChooseOptionMe(['Withdraw-X', 'draw-X'], 'all', ClickLeft)) then
          begin
            Wait(RandomRange(1300, 1700));
            TypeSend(IntToStr(Amount));
          end;
        end;
      end;

    Shorten to:
    SCAR Code:
    begin
      MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
      Wait(RandomRange(300, 500));
      if (Amount = 5) or (Amount = 10) then
        ChooseOptionMe(['Withdraw-' + IntToStr(Amount), 'draw-' + IntToStr(Amount)], 'all', ClickLeft)
      else if not ChooseOptionMe(['Withdraw-' + IntToStr(Amount) + ' ', 'ithdraw-' + IntToStr(Amount) + ' '], 'all', ClickLeft)then
                    (ChooseOptionMe(['Withdraw-X', 'draw-X'], 'all', ClickLeft)) then
      begin
        Wait(RandomRange(1300, 1700));
        TypeSend(IntToStr(Amount));
      end;
    end;



    In BankFindR:
    SCAR Code:
    while (iTime > GetSystemTime) do
          begin
            Result := (BankScreen) or (PinScreen);
            if Result then
            begin
              if PinScreen then
                InPin(Players[CurrentPlayer].Pin);
              Players[CurrentPlayer].Loc := 'BankScreen';
              Exit;
            end;
            Wait(RandomRange(100, 400));
          end;

    To:

    SCAR Code:
    while (iTime > GetSystemTime) and not(Players[CurrentPlayer].Loc = 'BankScreen') do
    begin
      if PinScreen then
        InPin(Players[CurrentPlayer].Pin);
      Result := BankScreen;
      if(Result)then
        Players[CurrentPlayer].Loc := 'BankScreen';
      Wait(RandomRange(100, 400));
    end;


    SCAR Code:
    if (OreSlotO > 0) then
                  break;
                begin
                  BB := BankIndexToMSPoint(OreSlotO);
                  MMouse(BB.x + 10, BB.y + 10, 3, 3);
                  Wait(700 + random(200));
                  if IsUpText(OreOne) then
                    Break
                  else
                  begin
                    OreSlotO := 0;
                    BB := BankIndexToMSPoint(OreSlotO);
                  end;
                end;

    You have a begin end for no reason:
    SCAR Code:
    if (OreSlotO > 0) then
                  break;
                  BB := BankIndexToMSPoint(OreSlotO);
                  MMouse(BB.x + 10, BB.y + 10, 3, 3);
                  Wait(700 + random(200));
                  if IsUpText(OreOne) then
                    Break
                  else
                  begin
                    OreSlotO := 0;
                    BB := BankIndexToMSPoint(OreSlotO);
                  end;

    In Calibrationer:
    SCAR Code:
    begin
        Players[CurrentPlayer].Loc := 'OreNotFound';
        Debug('Ore Not Found');
        CloseBank;
        Logout;
        Exit;
      end;

    Another begin/end in the middle of nowhere. Delete it.



    In Withdrawing:
    SCAR Code:
    if (Number <> N1) then // Inventory is wrong #
              if (Pointy.x = N1) then // Right amount of ores
              begin // Get rid of other stuff.
                for I := 0 to High(LeftSlots) do
                  Deposit(LeftSlots[i], LeftSlots[i], True);
              end
            else // Doesnt have the right amount of ores
            if (Pointy.x > N1) then // Has too many ores
            begin
              Deposit(1, 1, ((Number - (Length(LeftSlots))) - N1));
            end
            else // Not enough ores
            begin
              if (Number < N1) then
                Withdraw2(bs.x, bs.y, (N1 - Number));
            end;
          end;

    Change to:

    SCAR Code:
    if (Number <> N1) and (Pointy.x = N1) then // Right amount of ores
                for I := 0 to High(LeftSlots) do
                  Deposit(LeftSlots[i], LeftSlots[i], True)
                  else // Doesnt have the right amount of ores
    if (Pointy.x > N1) then // Has too many ores
              Deposit(1, 1, ((Number - (Length(LeftSlots))) - N1))
            else if (Number < N1) then
                Withdraw2(bs.x, bs.y, (N1 - Number));


    Also in Withdrawing:
    SCAR Code:
    if (Pointy.y <> N2) then  // Wrong # of ores
              if (Pointy.y > N2) then  // Has too many ores
                Deposit(1, 1, (Number - N2))

    To:
    SCAR Code:
    if (Pointy.y <> N2) and (Pointy.y > N2) then  // Has too many ores
      Deposit(1, 1, (Number - N2))


    In Bankinger:

    SCAR Code:
    while (TimeoutT > GetSystemTime) do
      begin
        if OpenBanker then
        begin
          Debug('Opened Bank');
          OB := True;
          Break;
        end;
        Wait(250 + Random(150));
      end;
      if not OB then
      begin
        Players[CurrentPlayer].Loc := 'Couldnt open Bank';
        Debug('OpenBank Failed');
        Logout;
        Exit;
      end;

    Change to:
    SCAR Code:
    repeat
      if OpenBanker then
      begin
        Debug('Opened Bank');
        Break;
      end;
      Wait(250 + Random(150));
      if((TimeoutT > GetSystemTime)then
      begin
        Players[CurrentPlayer].Loc := 'Couldnt open Bank';
        Debug('OpenBank Failed');
        Logout;
        Exit;
      end;
    until(false);

    Also eliminates the need for the OB boolean variable.


    In Bankinger:
    SCAR Code:
    if Result then
      begin
        Players[CurrentPlayer].Loc := 'DoneWithdraw' Debug('Withdraw Success');
      end

    To:

    SCAR Code:
    if Result then
        Players[CurrentPlayer].Loc := 'DoneWithdraw' Debug('Withdraw Success');



    AB:
    SCAR Code:
    4, 6:
            begin
              SleepAndMoveMouse(1250);
            end;
          5, 7:
            begin
              PickupMouse;
            end;
          8, 9:
            begin
              RandomMovement;
            end;

    You don't need begins/ends in cases with only 1 statement.


    In SmelterRinger:
    SCAR Code:
    if (GetAnimation < 1) then
        begin
          Wait(RandomRange(500, 1500));
          if (GetAnimation < 1) and (Count(False) = 0) then
            break;
        end;

    To:
    SCAR Code:
    if (GetAnimation < 1) then
          Wait(RandomRange(500, 1500));
    if (GetAnimation < 1) and (Count(False) = 0) then
            break;


    Proggy:
    SCAR Code:
    for i := 0 to HowManyPlayers - 1 do
      begin
        AddToReport(IntToStr(i) + ': ' + Players[i].Nick + ' | ' + Left(BoolToStr(Players[i].active), 1) + ' | ' + IntToStr(Players[i].Integers[1]) + ' Loads | ' + IntToStr(Players[i].Integers[2]) + ' Bars | ' + IntToStr(Players[i].Integers[3]) + ' Profit | ' + Players[i].Loc);
      end;

    To:
    SCAR Code:
    for i := 0 to HowManyPlayers - 1 do
        AddToReport(IntToStr(i) + ': ' + Players[i].Nick + ' | ' + Left(BoolToStr(Players[i].active), 1) + ' | ' + IntToStr(Players[i].Integers[1]) + ' Loads | ' + IntToStr(Players[i].Integers[2]) + ' Bars | ' + IntToStr(Players[i].Integers[3]) + ' Profit | ' + Players[i].Loc);





    Sorry Garret, couldn't find anything other than code shortenings in there =/ I tried hard to find logic errors, but your script is just too good

    Cheers,
    ~JAD

  15. #15
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    I've noticed a couple spots where my mess ups messed you up though

    SCAR Code:
    if Result then
        Players[CurrentPlayer].Loc := 'DoneWithdraw' Debug('Withdraw Success');

    if you look closely, this should be two lines, I messed up in formatting it.

    Should be

    SCAR Code:
    if Result then
    begin
        Players[CurrentPlayer].Loc := 'DoneWithdraw';
        Debug('Withdraw Success');
    end;

    Like I had, only not messed up XD

    The withdraw and chooseoption were directly from SRL, then modified to my needs by removing things, so srl got pwned by you.

    Ps - Told you that I had some inefficient parts

    Ty for the report <3

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  16. #16
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function Averages(A : array of extended) : integer;
    var
     I : integer;
     B : extended;
    begin
      if GetArrayLength(A) = 0 then
        exit;
     for I := 0 to GetArrayLength(A) - 1 do
          B := A[I] + B;
      Result := Round(B / GetArrayLength(A));
    end;

    ~Sand
    Last edited by Sandstorm; 10-21-2009 at 01:57 AM.

  17. #17
    Join Date
    May 2007
    Location
    Sydney, Australia (Faggot Region)
    Posts
    1,465
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Last edited by Simtoon; 10-21-2009 at 02:04 AM.


  18. #18
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @SandStorm

    SCAR Code:
    function Averages(A : array of extended) : integer;
    var
     I : integer;
     B : extended;
    begin
      if GetArrayLength(A) = 0 then
      begin
        Result := 0;
        Exit;
      end;
      for I := 0 to GetArrayLength(A) - 1 do
        B := A[I] + B;
      Result := Round(B / GetArrayLength(A));
    end;

    Just Return 0 if array length is 0. It's proper practice.
    Last edited by JAD; 10-21-2009 at 02:08 AM.

  19. #19
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I was wondering if you could take a look at my TeleTab script, it has quite a few holes, and isn't very stable.

    SCAR Code:
    {==============================================================================]
    [============================Made by: Bionicle1800=============================]
    [==============================Version: 1.0 Beta===============================]
    [=============================Made for: SCAR 3.22==============================]
    [==============================================================================]
    [=======Details: All color (yay!) and my first official released script!=======]
    [==============================================================================]
    [================================INSTRUCTIONS!=================================]
    [==============================================================================]
    [This script might piss you off a litle at the beginning. You have to start out]
    [outside of your portal to your house, then press play. You will need to pause ]
    [the script, disable smart, go inside your runescape house, find the butler    ]
    [and send him to the bank to fetch the first invitory of soft clay. Then you   ]
    [need to go to the lecturn (either demon or eagle), wait until the butler comes]
    [back, the clay is in your inventory. Walk to the lect with butler, then resume]
    [the script. Come back and check every hour or so, because of randoms, it is   ]
    [next to impossible to get back into the house and back to the lecturn with the]
    [butler, as every time you finish a random, you are put outside your house. If ]
    [you find your character in this situation, please do like i said at the       ]
    [beginning, pause, disable, etc, so the proggys won't be all crappy, horrible  ]
    [1 hour proggys :).                                                            ]
    [                                                                              ]
    [Make sure to have the runes for the spell of the tab you are making, staffs   ]
    [work as well, and one soft clay for each tab. You need the level for the spell]
    [to make the tab for it, as well as 67 construction to make the lectern.       ]
    [                                                                              ]
    [I made this script for house teletabs, if you want another tab, the DTMs are] ]
    [already in the script, just go to line 220 and 227 and replace 'house' with   ]
    [one of the following;                                                         ]
    [                                                                              ]
    [ENCHANTS = 'onyx', 'emerald', 'dragonstone', 'ruby', 'sapphire', 'diamond'    ]
    [                                                                              ]
    [TELEPORTS = 'lumbridge', 'falador', 'varrock', 'watchtower', 'ardougne',      ]
    ['camelot', 'house'                                                            ]
    [                                                                              ]
    [OTHER ='b2p'(Bones to peaches), 'b2b'(Bones to bananas)                       ]
    [                                                                              ]
    [                                                                              ]
    [Have fun money-making,                                                        ]
    [                                                                              ]
    [Bionicle1800                                                                  ]
    [==============================================================================]
    [==============================================================================}


    program TabMaker;
    {.include SRL/srl/Misc/Smart.scar}
    {.include SRL/srl.scar}

    Var //No touchy the Var :)

    x, y, t, M, Sec, tab, onyx, emerald, dragonstone, ruby, sapphire, diamond: Integer;

    lumbridge, falador, varrock, watchtower, ardougne, camelot, house, b2p, b2b: Integer;

    {==============================================================================]
    [*******************************Fill bellow out********************************]
    [==============================================================================}


    Const //Fill this out with the Tab information.
          //==KEEP LOWERCASE!==

    WhichLect = 'eagle';//'eagle' or 'demon'

    WhichButler = 'normal';//'normal' or 'demon'

    AmountOfTabs = 1000; //How many tabs you want made

    procedure DeclarePlayers; //This script is NOT multiplayer, because of the beginning
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      with Players[0] do
      begin
        Name := 'username'; //put your account's username here
        Pass := 'password'; //put your account's password here
        Nick := 'user'; //a nickname for your account, 3-4 letters
        Active := True;
      end;
    end;

    {==============================================================================]
    [*************************************STOP!************************************]
    [==============================================================================}


    procedure AntiBan;
    begin
      case Random(80) of
        0: RandomMovement;
        1: BoredHuman;
        2: HoverSkill('Magic', false);
        3: begin
             MakeCompass('S');
             Wait(1000+random(3000));
             MakeCompass('N');
           end;
        4: ExamineInv;
        5: begin
             case random(18) of
               0: TypeSend('Ahhhhh');
               1: TypeSend('lolio');
               2: TypeSend('ugh too many tabs :P');
               3: TypeSend('talkin to myself is fun ..');
               4: TypeSend('just a few more i think');
               5: TypeSend('ggggguh');
               6: TypeSend('dumdum..');
               7: TypeSend('ehguh');
               8: TypeSend('<3 tabs...bleh');
             end;
           end;
        6: PickUpMouse;
        7: RandomRClick;
      end;
    end;

    procedure ProgressReport;
    begin
      ClearDeBug;
      Writeln('================================================================================');
      Writeln('|  Bionicle1800s Mystical Tab Maker V 1.0');
      Writeln('|  =============================================================================');
      Writeln('|  Ran for ' + TimeRunning + '.');
      Writeln('|  Created ' + IntToStr(t) + ' loads of Teletabs.');
      Writeln('|  Created ' + IntToStr(t * 20) + ' Teletabs.');
      Writeln('|  Ran on account "' + Players[CurrentPlayer].Name + '" nicknamed "' + Players[CurrentPlayer].Nick + '".');
      Writeln('|  Made using a ' + WhichButler + ' butler and a ' + WhichLect + ' lectern.');
      Writeln('|');
      Writeln('|  Post all progress reports on [url]www.villavu.com[/url] under my thread!');
      Writeln('================================================================================');
    end;

    procedure MakeTabs;
    begin
    lumbridge := DTMFromString('78DA63BCCEC0C0F08F01059C7BF3968115483' +
           '302F17F206004A96165C4A90604C06A3809A8B90D243808A8B90A' +
           '24FE30105643C8AE1B44A8B94B580D00BF5B225D');
    watchtower := DTMFromString('78DA8D92DB0980301004733E510BF6896840A' +
           '31667255A83AE22F8A57B0B81210CC9E688E4628CB9D69B75DB4D' +
           'F8EC1E8894A0E0DBB9220528224E054A88538332E2348A735A504' +
           'C9C0E24C4E9413E71AC623E56D17900A5C4710A6754BC7D527476' +
           '8AF92CFFFFE7766690A7B88B743E01798E410C');
    house := DTMFromString('78DA636462626070646440067F3F7D626005D' +
           '220D1FF40C0C80654638B5B0D0830F213A14618BF5D6035BC44A8' +
           '6101AA71425513E0EB8BA9C683801A1E22D4081261972011E6F06' +
           '3AAC11A862E44840F21357C44D8C50554E34A400D1B116A78884C' +
           '1B0EF8D5000041DC3439');
    sapphire := DTMFromString('78DAADD2490AC2401046E12E4417C10111715' +
           'C7A00C133AAA88886280A71BC9367711BFFDA09415E2F6C48F208' +
           '1F4593B4552C84B5AEAFF57E4D42554F7F5B6859A25AFC36BEACA' +
           'E9A836945988E6A09A6A75A81E9AB366006AA2D98A16A0766A44A' +
           'C18C5559C49CE31F8CEFF914F17D72305DD5154C5BF500D3543DC' +
           '12411736AAA1B183FCF1730A63A8329743B80F1DA836994CFF374' +
           '9697FF5706C6E7DCC118CFF90083E94A09');
    falador := DTMFromString('78DA638C616460E806622470EECD5B0656200' +
           'D13654C25424D1C90D54B404D3C90358108BB261061D72422D4CC' +
           '20A02686483584DC9308644DC4AF0600AD49243F');
    ardougne := DTMFromString('78DA63DCC2C8C0D00DC448E0DC9BB70CAC401' +
           'A26CAB81DC8EA27A066379035850835B308A8D905644D23C23D84' +
           'ECDA04644D25A0663D1176AD03B2261350B39188F001D9358308B' +
           'B6611A1663A01355BF1FBFD3F100000697C3B8C');
    varrock := DTMFromString('78DA638C626460B807C448E0DC9BB70CAC401' +
           'A26CA1803643D24A02616C87A42404D1C90F59C809A7820EB1501' +
           '358944A84922C2AE6422DC9C4284DF5381ACFB04D4A41311CE20F' +
           '7BC20C23D4F8970CF23026AD28870730290F50EBF1A00C98A3F5C' +
           '');
    camelot := DTMFromString('78DA63DCC9C8C0701F8891C0B9376F1958813' +
           '44C94712B90F580809ACD4498B3910873361061CE7A22CC590764' +
           '3D24C29C674498F3920873DE10E1F7D74484212173B61361CE4EC' +
           '2E60000A9B33BE7');
    onyx := DTMFromString('78DA639CC5C0C0C0C3C8800CBE5D51616005D' +
           '23051C6B944A85906248408A8590124C408A8590524A408A85909' +
           '246408A8590C245489F0970601355388306722905022A0A60F48C' +
           '81250D30B242409A8E90712A244B8999F809AD940820F554D80AF' +
           '2F667C4911500332478D809A7E22CC9983E97774350097282D98');
    diamond := DTMFromString('78DA63B4636460E0076224F0ED8A0A032B908' +
           '689323A12A1C607C89224A0C60FC89225A0C617C89227A0C619C8' +
           'D222A0C61EC8D226A0C60AC8D224A0C604C85221A0C610C892234' +
           '28D0C0135A6409608116E1624A0C613C85227227CD0CCF9FBE913' +
           'AA1A63CCF8C250638F1986186A7CF09BF31F080023CC31A3');
    emerald := DTMFromString('78DA639CC9C0C010CBC8800CBE5D51616005D' +
           '23051C63944A85904241208A85906245209A8590924B28930A790' +
           '809A8540A28C809AD940A292809A9944A8994C845DFD40A288809' +
           'A3E20914F404D0F90C821424D1611EE4921A06612904824A06606' +
           '908823A066169088475563986784AA663966BC63A80199534E404' +
           'D1F7E73FE030100305A3E01');
    b2b := DTMFromString('78DA637CC4C8C09001C448E0CEE54B0CAC401' +
           'A24FA1F08181F035969B8D58000E333FCE680D5BC20C29C57449A' +
           '9345849A3C22D41413E19E3222CCA920227C0899F384087340F15' +
           '54E84392544A8C923420DA170FE84195FDFAEA8A0AA798D691756' +
           '350504D4BC01B28A08A8F90064951250F31EC8CAC7AD0694E6014' +
           'B4159DF');
    dragonstone := DTMFromString('78DA639CC1C0C0B0819101197CBBA2C2C00AA' +
           '461A28CB38950B304486C23A0660590D84740CD7220718008BB8E' +
           '1150B310489C24C25F6708A89941849A7E20719C809A5E2071988' +
           '09A6E20B19708737612E19EAD04D44C02129B09A8990224361150' +
           '331D486C24A06626A639554295A86A9661A60D0C3520734E1150D' +
           '38BDF9CFF400000BEF14588');
    ruby := DTMFromString('78DA637CC5C0C0B0819101197CBBA2C2C00AA' +
           '441A2FF8180F12D7E3520C0F819486C26A0E61B90D84E40CD0F20' +
           'B19B809A9F40621F116A0E1050F305489C20A0E60D90384340CD1' +
           '3207192809A0740E2280135F781C461026AEE0289FD44A8D94B40' +
           'CD3D22C2F92190D84A84DF09C5FB0B20B191809AD7406213AA9A2' +
           'A2921B81A4158DAD847400DC89C5304D4DCC70C1F74350064DD4E' +
           '93');
    b2p := DTMFromString('78DA637CC4C8C0B00B8891C09DCB971858813' +
           '448F43F10303E01B276E05603028CCFF09B0356F38208735E1169' +
           'CE1E22D41C2242CD7122DC738208734E11113E84CC794284398F8' +
           '834E728116A0885E16B20EB30AA9ABFF5AA70357C3035FB09A879' +
           '0B64ED25A0E61DA67B30D47C2242CD17206B1F01355F8970F3572' +
           '2FCFE19339CB1FA9D909AF798691543CD1BC26E060066286BBD');
    begin
    if not loggedin then exit;
      if FindObjCustom(x, y, ['tudy', 'ectern'], [10264995, 10264995], 4) then
        repeat
          begin
            MoveMouse(x, y);
            ClickMouse(x, y, true);
            Wait(1000+random(1000));
            FindDTM(house, x, y, MSX1, MSY1, MSX2, MSY2);
            MoveMouse(x, y);
            ClickMouse(x, y, true);
            Inc(M);
          end;
        until(M=20);
        Inc(t);
        FreeDTM(house);
      end;
    end;

    procedure SendButlerBanking;
    begin
    if not loggedin then exit;
      if WhichButler = 'normal' then
        if FindObjCustom(x, y, ['alk-to', 'utler'], [857183, 7510731], 4) then
          begin
            MoveMouse(x, y);
            ClickMouse(x, y, false);
            ChooseOption('etch-from-bank');
            Wait(500+random(1000));
            if FindNPCChatText('Click here to continue', Clickleft) then
              begin
              Wait(500+random(1000));
              FindNPCChatText('Pay servant 500 coins.', Clickleft);
              Wait(500+random(1000));
              FindNPCChatText('Click here to continue', Clickleft);
              Wait(500+random(1000));
              if FindObjCustom(x, y, ['alk-to', 'utler'], [857183, 7510731], 4) then
                begin
                  MoveMouse(x, y);
                  ClickMouse(x, y, false);
                  ChooseOption('etch-from-bank');
                  Wait(500+random(1000));
              end else
                begin
                  Status('Couldnt find ' + WhichButler + ' butler? Logging out...');
                  Logout;
                  Terminatescript;
                end;
            end else
              Status('Butler is not asking for payment...');
            FindNPCChatText('ore...', Clickleft);
            Wait(500+random(1000));
            FindNPCChatText('oft clay', Clickleft);
            Wait(500+random(1000));
            TypeSend('20');
        end else
          begin
            Status('Couldnt find a normal butler? Logging out...');
            Logout;
            ProgressReport;
            TerminateScript;
      end else
        Status('Looking for Demon Butler...');
        ProgressReport;
      if WhichButler = 'demon' then
        if FindObjCustom(x, y, ['alk-to', 'emon butler'], [2504059, 12698057], 4) then
          begin
            MoveMouse(x, y);
            ClickMouse(x, y, false);
            ChooseOption('etch-from-bank');
            Wait(500+random(1000));
            if FindNPCChatText('Click here to continue', Clickleft) then
              begin
              Wait(500+random(1000));
              FindNPCChatText('Pay servant 500 coins.', Clickleft);
              Wait(500+random(1000));
              FindNPCChatText('Click here to continue', Clickleft);
              Wait(500+random(1000));
              if FindObjCustom(x, y, ['alk-to', 'utler'], [857183, 7510731], 4) then
                begin
                  MoveMouse(x, y);
                  ClickMouse(x, y, false);
                  ChooseOption('etch-from-bank');
                  Wait(500+random(1000));
              end else
                begin
                  Status('Couldnt find ' + WhichButler + ' butler? Logging out...');
                  Logout;
                  Terminatescript;
                end;
            end else
              Status('Butler is not asking for payment...');
            FindNPCChatText('ore...', Clickleft);
            Wait(500+random(1000));
            FindNPCChatText('oft clay', Clickleft);
            Wait(500+random(1000));
            TypeSend('20');
        end else
          begin
            Status('Couldnt find a demon butler? Logging out...');
            Logout;
            ProgressReport;
            TerminateScript;
      end else
        begin
          Status('Found ' + WhichButler + ' butler and sent to bank!');
          AntiBan;
          ProgressReport;
        end;
    end;

    procedure WaitForClay;
    begin
    if not loggedin then exit;
      if WhichButler = 'normal' then
        begin
          Wait(+random(1000));
          MoveMouse(MSCX, MSCY);
          ClickMouse(x, y, true);
        end;
      if WhichButler = 'demon' then
        begin
          Wait(+random(1000));
          MoveMouse(MSCX, MSCY);
          ClickMouse(x, y, true);
        end;
    end;

    begin
      Disguise('Bionicle1800s Mystical Teletab Crafter');
      ClearDebug;
      SetupSRL;
      DeclarePlayers;
      GraphicsSet := true;
      if not loggedin then loginPlayer;
      Status('Logged in on ' + Players[CurrentPlayer].Nick + 's account.');
      makecompass('n');
      SetAngle(True);
      repeat
        begin
          ClearDebug;
          Status('Follow instructions.')
          Writeln('Pause script, disable smart and follow the instructions at the beginning!');
          Writeln('You have ' + IntToStr(30 - Sec) + ' seconds...');
          Wait(1000);
          Inc(Sec);
        end;
      until(Sec=29);
      ClearDebug;
      Writeln('Pause script, disable smart and follow the instructions at the beginning!');
      Writeln('You have 1 second...');
      Wait(1000);
      ClearDebug;
      Writeln('Pause script, disable smart and follow the instructions at the beginning!');
      Writeln('You have 0 seconds...times up!');
      Wait(1000);
      repeat
        begin
          MakeTabs;
          SendButlerBanking;
          WaitForClay;
          Inc(tab);
        end;
      until(tab=AmountOfTabs);
    end.
    Last edited by Bionicle; 10-28-2009 at 09:27 PM.
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  20. #20
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    He has left and probably won't be able to write any JADReports from now on.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  21. #21
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sex View Post
    He has left and probably won't be able to write any JADReports from now on.
    No, if you look back to his 'my views' thread, it has been resolved(unless there's something I dont know of)
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  22. #22
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Hmm, I was talking to him on MSN last night and he told me he left SRL.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  23. #23
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sex View Post
    Hmm, I was talking to him on MSN last night and he told me he left SRL.
    orly?
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  24. #24
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    You're using ClickMouse...Are you trying to get banned?

    E: Left your pass in, changed and PM'd

    ~Camo
    Last edited by Kyle Undefined; 10-28-2009 at 09:20 PM.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  25. #25
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Camo Developer View Post
    You're using ClickMouse...Are you trying to get banned?
    whats so bad about ClickMouse?
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

Page 1 of 2 12 LastLast

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
  •