Results 1 to 7 of 7

Thread: Why isn't the next function being called?

  1. #1
    Join Date
    Dec 2010
    Posts
    808
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Why isn't the next function being called?

    Here is my Ess Miner:

    Simba Code:
    program EssMiner;
    {$define SMART}
    {$i srl/srl.scar}
    {$i Reflection/Reflection.simba}
    {$i SRL\SRL\Misc\stats.simba}


    Const // Fill out below:
    SRLStats_UserID = '';  // Your SRL Stats username.
    SRLStats_Password = '';   // Your SRL Stats Password.
    DependClick = 5; // 1 in how many clicks is a right click option. (Mining)
    DoDebug = True; // Do you want the script to debug?

    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

        with players[0] do
      begin
        Name := '';
        Pass := '';
        Active := True;
        Pin := ''; //Leave blank if no pin
        Loc := 'done aubury'; //Read the thread to see valid arguments.
        Integers[4]:= 100; //Amount of loads you want to do.
        Strings[1] := 'Mining'; // Lamp Skill
      end;
    end;

    type
      TTilesArray = array of TTile;
    var
      EssCountStart, Price : integer;
    const
      RUNEESS_ID = 1436;
      PUREESS_ID   = 7936;
      Colour = 0;
      Hue = 1;
      Sat = 2;
      Tol = 3;

    function ConvertPrice(input: string): Integer;     // Credit to BlumbleBee for these two functions <3
    var
      f: Extended;
    begin
      input := Replace(Lowercase(Trim(input)), ',', '');
      if (Pos('m', input) > 0) then
        f := StrToFloatDef(Copy(input, 1, Pos('m', input) - 1), 0) * 1000000
      else if (Pos('k', input) > 0) then
        f := StrToFloatDef(Copy(input, 1, Pos('k', input) - 1), 0) * 1000
      else
        f := StrToFloatDef(Input, 0);
      Result := Round(f);
    end;

    procedure SetPrice(runeEss: Boolean);
    var
      S: string;
      I: Integer;
    begin
      if runeEss = true then
        I := RUNEESS_ID
      else
        I := PUREESS_ID;

      s := getPage('http://services.runescape.com/m=itemdb_rs/Rune_essence/viewitem.ws?obj='+IntToStr(I));
      Price := ConvertPrice(Between('<b>Market price:</b> ', #10 + '</span>', s));
    end;

    Procedure Debug(s:string);
    Begin
      if DoDebug then
        Writeln(s);
    end;

    Procedure AxeWielded;
    var
    Equipped : integer;
    TheIDs: TIntegerArray;
    Pickaxe : TInvItemArray;
    Begin
      If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
        exit;
      TheIDs := [1265, 1271, 15259, 1267, 1273, 1275, 1269];
      GameTab(tab_Inv);
      Wait(500 + Random(200));
      if(R_ItemIDExistsEx(TheIDs, Pickaxe))then
        begin
          Players[CurrentPlayer].Booleans[0] := False;
          Debug('Pickaxe is in inventory.');
          Exit;
        end else
          GameTab(tab_Equip);
          Wait(500 + Random(200));
          Equipped := GetEquippedIDAt(3);
          if(InIntArray(TheIDs, Equipped))then
            begin
              Players[CurrentPlayer].Booleans[0] := True;
              Debug('Hatchet is equipped.');
              Exit;
            end;
    End;

    Procedure LevelTalking;
    Begin
         If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
              exit;
         If LevelUp Then
              Begin
                   Inc(Players[CurrentPlayer].Integers[2]);
                   stats_IncVariable('Total Levels Gained', 1);
                   Writeln('Woooot we have now gained '+IntToStr(Players[CurrentPlayer].Integers[2])+' levels!');
                   Begin
                        Case Random(50) Of
                             0: TypeSend('Guess what... I levelled!');
                             1: TypeSend('w00t lvld');
                             2: TypeSend('lvld again...');
                             3: TypeSend('grats me! I lvld!');
                             4: TypeSend('gay lag, didnt realise i lvld');
                             5: TypeSend('woopdewoop');
                             6: TypeSend('this levelling stuff is getting boring...');
                             7: TypeSend('dangdarnit, I jooost lavallled');
                             8: TypeSend('can we have a party cause i just lvld');
                             9: TypeSend('house party at mine! jokes...');
                        End;
                   End;
              End;
    End;

    procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
    var
     mx, my, Pic, I, B, H, TPH, Numb: Integer;
     TTP: TPointArray;
     Canvas: TCanvas;
    begin
      SmartSetDebug(True);
      GetClientDimensions(mx,my);
      Pic := BitmapFromString(mx,my,'');
      TPH := High(TP);
      for I := 0 to TPH do
      begin
        TTP := LoadTextTPA(TP[i], SmallChars, H);
        for B := 0 to High(TTP) do
        begin
          Numb := ((I + 1) * 13);
          FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
          FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
        end;
      end;
      Canvas := TCANVAS.Create;
      Canvas.Handle := SmartGetDebugDC;
      DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
      FreeBitmap(Pic);
    end;

    Procedure ProgressReport;
    var
      EssMined, TotalLoads, TotalLevels, TotalAntiban, I, ActivePlayers: Integer;
    Begin
        LevelTalking;
        for I := 0 to HowManyPlayers-1 do
          begin
            with Players[I] do
            begin
              if Active then
                Inc(ActivePlayers);
              EssMined := EssMined + Integers[0];
              TotalLoads := TotalLoads + Integers[1];
              TotalLevels := TotalLevels + Integers[2];
              TotalAntiban := TotalAntiban + Integers[3];
            end;
          end;
          PrintOnSmart(['  Essence Miner [BOOM]'],Point(22, 30), 62207, 131072);
          PrintOnSmart(
          ['',
          '',
          '',
          '            Global Stats ',
          '           --------------',
           '          Time Running: '+ TimeRunning,
           '          Mined: '+IntToStr(EssMined)+' Essence',
           '          Loads Done: : '+IntToStr(TotalLoads),
           '          Gained: '+IntToStr(Price*EssMined)+' gp',
           '          Gained: '+IntToStr(TotalLevels)+' levels',
           '          Players Active: '+IntToStr(ActivePlayers),
           '          ',
           '            Player Stats ',
           '           --------------',
            '          Player: '+Capitalize(Players[CurrentPlayer].Name),
            '          Essence: ' + IntToStr(Players[CurrentPlayer].Integers[0]),
            '          Gained: '+IntToStr(Price*Players[CurrentPlayer].Integers[0])+' gp'
         ], Point(30, 60), 1959605, 131072);

        cleardebug;
        Writeln('[-----------------------------]');
        Writeln('[         Essence Miner       ]');
        Writeln('[-----------------------------]');
        Writeln(' We worked for ' + TimeRunning);
        Writeln(' Mined ' + IntToStr(EssMined)+' Essence');
        Writeln(' Loads Done: ' + IntToStr(TotalLoads));
        writeLn(' Gained: '+IntToStr(Price*EssMined)+' gp');
        Writeln(' Gained: ' + IntToStr(TotalLevels)+' levels');
        Writeln(' Antibanned ' + IntToStr(TotalAntiBan));
        Writeln('[-----------------------------]');
        Stats_Commit;
    End;

    procedure AntiBan;
    begin
      case (Random(400)) of
        0: RandomRClick;
        1: MouseSpeed := 15 + Random(5);
        2: PickUpMouse;
        3: BoredHuman;
        4..400: begin
          Wait(100 + Random(50));
          Exit;
        end;
      end;
      Inc(Players[CurrentPlayer].Integers[3]);
    end;

    Procedure AntiRandoms;
    Begin
        If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
            NextPlayer(false);
            LevelTalking;
        FindNormalRandoms;
        Wait(300+Random(200));
        FindLamp(Players[CurrentPlayer].Strings[1]);
    End;

    Function WalkToAubury: Boolean;
    Begin
      If Not LoggedIn Then
        Exit;
      EssCountStart := R_InvCount;
      If WalkToTile(Point(3257, 3409), 2, 1) Then
        If not WalkToTile(Point(3253, 3401), 1, 0) Then
          Exit;
      Result := True;
    End;

    Function FindEss(Var X, Y : Integer; W, H, X1, Y1, X2, Y2 : Integer): Boolean;
    Var
      TPA : TPointArray;
      ATPA : T2DPointArray;
      T: TPoint;
      K, G, Z: Extended;
      Colors: array [0..1] of tIntegerArray;
      I, J, xX, yY, Blah: Integer;
      TPAStoof: array [0..1] of TVariantArray;
      DoubleTPA: array [0..1] of TPointArray;
      Which: array [0..1] of Integer;
    begin
      if not LoggedIn then Exit;
      TPAStoof[0] := [12961230, 0.93, 0.90];
      TPAStoof[1] := [10790060, 0.00, 0.16];
      ColorToleranceSpeed(2);
      for I := 0 to 1 do
      begin
        SetColorSpeed2Modifiers(TPAStoof[I][Hue], TPAStoof[I][Sat]);
        FindColorsTolerance(DoubleTPA[I], TPAStoof[I][Colour], MSx1, MSy1, MSx2, MSy2, 5);
        Debug('Length of TPA = '+IntToStr(Length(DoubleTPA[I])));
        if Length(DoubleTPA[I]) = 0 then
          Exit;
        Colors[I] := GetColors(DoubleTPA[I]);
         Debug('Length of Colors = '+IntToStr(Length(Colors[I])));
        for J := 0 to high(Colors[I]) do
        begin
          ColorToXYZ(Colors[I][J], K, G, Z);
          if InRange(Round(K), 35, 49) then
            if InRange(Round(G), 36, 50) then
              if InRange(Round(Z), 38, 54) then
          begin
            Which[I] := J;
            Debug('Which['+IntToStr(I)+'] = '+IntToStr(J));
            Break;
          end;
        end;
      end;
      ColorToleranceSpeed(1);
      SetColorSpeed2Modifiers(0.20, 0.20);

      Repeat
        SetArrayLength(TPA, 0);
        FindColorsTolerance(TPA, Colors[J][Which[J]], MSX1, MSY1, MSX2, MSY2, 3);
        if Length(TPA) <= 0 then
          Exit;
        ATPA := TPAToATPAEx(TPA, 25, 25);
        SortATPASize(ATPA, true);
        for I := 0 to high(ATPA) do
        begin
          if I = 3 then
            Break;
          T := MiddleTPA(ATPA[I]);
          MMouse(T.x, T.y, 5, 5);
          Wait(400 + Random(200));
          if WaitUpTextMulti(['ssen', 'une'], 350) then
           begin
            getMousePos(xX, yY);
            Blah := RandomRange(0, DependClick);
            if Blah = 0 then begin
              Mouse(xX, yY, 0, 0, False);
              WaitOption('ine', 500)
            end else Mouse(xX, yY, 0, 0, True);
            Result := True;
            Blah := 0;
            Exit;
          end;
            Inc(J);
          end;
      until J > 1;
        Debug('Found the essence!');
    End;

    Function FoundEss(Var X, Y : Integer): Boolean;
    Begin
      Debug('Beginning FoundEss');
      Result := FindEss(X, Y, 20, 50, MSX1, MSY1, MSX2, MSY2);
    End;

    Function FoundEss2:Boolean;
    var
      EPoint : TPoint;
      xX, yY : integer;
      CurrentObject : TRSObject;
    begin
            Debug('FoundEss2');
            CurrentObject := GetObjectById(2491, 0, 10);
            if not (TileOnMs(CurrentObject.Tile, 0) ) then
              Exit;
            EPoint := TileToMS(CurrentObject.Tile, 0);
            MMouse(EPoint.x, EPoint.y, 0, 0);
            GetMousePos(xX, yY);
            if WaitUpText('ine', 600) then
            Mouse(xX, yY, 0, 0, True);
            if DidRedClick then
              Result := True
            else Result := False;
    end;


    Function MiningCheck:Boolean;
    Begin
      if not LoggedIn then Exit;
      if not CharacterAnimating then
        Wait(2500);
          if CharacterAnimating then
      Result := True else Result := False;
    End;

    Function DoPortal:boolean;
    var
      NWPortalTile, SWPortalTile, SEPortalTile, NEPortalTile : TTile;
      P : TPoint;
      xX, yY, Blah, I, Which, LengthA, LengthB : integer;
      TPA : TPointArray;
      ATPA : T2DPointArray;
      WhichTPA: array [0..1] of TPointArray;
      TPAStoof: array [0..1] of TVariantArray;
    Begin
      NWPortalTile := (tile(2885, 4850)); //NW
      SWPortalTile := (tile(2889, 4813)); //SW
      SEPortalTile := (tile(2933, 4815)); //SE
      NEPortalTile := (tile(2932, 4854)); //NE
      TPAStoof[0] := [11652296, 0.49, 2.59, 3];
      TPAStoof[1] := [12898508, 2.78, 4.37, 1];

      case Players[CurrentPlayer].Loc of
      'NW' : Begin
              if not WalkToTile((NWPortalTile), 1, 1) then begin
              NextPlayer(False);
              Exit;
             end;
             end;
      'SW' :  Begin
              if not WalkToTile((SWPortalTile), 1, 1) then begin
              NextPlayer(False);
              Exit;
             end;
             end;
      'SE' :  Begin
              if not WalkToTile((SEPortalTile), 1, 1) then begin
              NextPlayer(False);
              Exit;
             end;
             end;
      'NE' :  Begin
              if not WalkToTile((NEPortalTile), 1, 1) then begin
              NextPlayer(False);
              Exit;
             end;
             end;
      End;
      Repeat
        Wait(250);
      Until not CharacterMoving;
      Wait(3000);
      repeat
        for I := 0 to 1 do
        begin
          ColorToleranceSpeed(2);
          SetColorSpeed2Modifiers(TPAStoof[I][Hue], TPAStoof[I][Sat]);
          FindColorsTolerance(WhichTPA[I], TPAStoof[I][Colour], MSX1, MSY1, MSX2, MSY2, TPAStoof[I][Tol]);
          ColorToleranceSpeed(1);
          SetColorSpeed2Modifiers(0.20, 0.20);
        end;
        if Length(WhichTPA[0]) or Length(WhichTPA[1]) > 0 then
          Break;
      until False;
      LengthA := Length(WhichTPA[0]);
      LengthB := Length(WhichTPA[1]);
      Debug('LengthA = '+IntToStr(LengthA));
      Debug('LengthB = '+IntToStr(LengthB));
      if LengthA > LengthB then
        Which := 0
      else
        Which := 1;
      Debug('Which = '+IntToStr(Which));
      TPA := WhichTPA[Which];
      ATPA := SplitTPAEx(TPA, 10, 10);
      SortATPASize(ATPA, true);
      for I := 0 to high(ATPA) do
      begin
        if I > 2 then
          Exit;
        P := MiddleTPA(ATPA[I]);
        Wait(1000 + Random(500));
        MMouse(P.x, P.y, 5, 5);
        Wait(1000);
        //if WaitUpText('ortal', 400) then
        begin
          GetMousePos(xX, yY);
          Blah := RandomRange(0, DependClick);
            if Blah = 0 then begin
              Mouse(xX, yY, 0, 0, False);
              WaitOption('nte', 500)
            end else Mouse(xX, yY, 0, 0, True);
          Result := true;
          Exit;
        end;
      end;
    end;

    Function BoomEss: Boolean;
    Var
      X, Y, Tried : Integer;
    Begin
      if Not LoggedIn then
        Exit;
      Debug('BoomEss');
      Repeat
        if Tried = 10 then
        begin
          Debug('Cant find ess... Exiting');
          Exit;
        end;
        if not FoundEss(X, Y) then
          if not FoundEss2 then
        Begin
          Inc(Tried);
          Debug(IntToStr(Tried));
          Wait(2000 + Random(500));
          Continue;
        End;
        //Mouse(X, Y, 0, 0, True);
        Wait(1500 + Random(500));
        Repeat
          LevelTalking;
          if MiningCheck then
            begin
            Antiban
            AntiRandoms
            end;
          if InvFull then
            Break;
        Until not (MiningCheck);
      Until InvFull;
      Result := True;
    End;

    Function DoAubury:Boolean;
    var
    Aubury:TNPC;
    APoint : TPoint;
    x, y :integer;
    Tracks :TRSObject;
    Begin
      if not LoggedIn then Exit;
      Tracks := GetObjectByID(454, OBJECT_TYPE_FLOORDECOR, 50);
      if FindNPC(553, Aubury) then
        APoint := TileToMSEx(Aubury.Tile, 0.5, 0.5, Aubury.Height);
        MMouse(APoint.x, APoint.y, 1, 1);
        if WaitUpText('-to', 600) then
          Mouse(APoint.x, APoint.y, 1, 1, False);
        if not R_ChooseOption('elep') then
            Exit;
        Wait(3000);
        Result := True;
        Debug('Done aubury');
    End;

    function DistanceFromArray(TheTiles: TTilesArray): integer;
    var
      MyPos: TTile;
      I: integer;
    begin
      MyPos := GetMyPos;
      Result := High(Result);
      for I := 0 to High(TheTiles) do
        Result := Min(Result, Distance(MyPos.x, MyPos.y, TheTiles[I].X, TheTiles[I].Y));
    end;

    Function AtEssPlace:Boolean;
    var
      NW, NE, SE, SW : TTile;
      Tower, Tracks : TRSObject;
    Begin
      if not LoggedIn then Exit;
      NW := Point(2892, 4848);  //NW
      NE := Point(2926, 4849);  //NE
      SE := Point(2929, 4816);  //SE
      SW := Point(2895, 4814);  //SW

      Tower := GetObjectByID(506, OBJECT_TYPE_FLOORDECOR, 30);
      Tracks := GetObjectByID(454, OBJECT_TYPE_FLOORDECOR, 20);
      if (DistanceFrom(NW) < 20) or (DistanceFrom(NE) <10) or (DistanceFrom(SE) <30) or (DistanceFrom(SW) <20) then
          Result := True
          else begin
              NextPlayer(False);
              Debug('AtEssPlace False');
              Result := False;
              Exit
         end;
    End;

    Function WhichEssPlace:boolean;   // I know I can do case, will do later.
    Begin
      if DistanceFrom(tile(2892, 4848)) < 16 then begin
        Players[CurrentPlayer].Loc := 'NW';
        Debug('At NW');
        if BoomEss then
          if DoPortal then
        Result := True;
        Exit;
        End;
      if DistanceFrom(tile(2926, 4849)) < 16 then begin
          Players[CurrentPlayer].Loc := 'NE';
          Debug('At NE');
          if BoomEss then
            if DoPortal then
          Result := True;
          Exit;
        End;
      if DistanceFrom(tile(2929, 4816)) < 16 then begin
          Players[CurrentPlayer].Loc := 'SE';
          Debug('At SE');
          if BoomEss then
            if DoPortal then
          Result := True;
          Exit;
        End;
      if DistanceFrom(tile(2895, 4814)) < 16 then begin
          Players[CurrentPlayer].Loc := 'SW';
          Debug('At SW');
          if BoomEss then
            if DoPortal then
          Result := True;
          Exit;
        End;
    End;

    Function AtMiddle:boolean;
    var
      Rope : TRSObject;
      MiddleTile:array [0..26] of TTile;
      MainTile, done:TTile;
      I:integer;
    Begin
      if not LoggedIn then Exit;
      MainTile := Tile(2909, 4834);
      MiddleTile[0] := Tile(MainTile.x, MainTile.y);
      MiddleTile[1] := Tile(MainTile.x+1, MainTile.y);
      MiddleTile[2] := Tile(MainTile.x+2, MainTile.y);
      MiddleTile[3] := Tile(MainTile.x+3, MainTile.y);
      MiddleTile[4] := Tile(MainTile.x, MainTile.y-1);
      MiddleTile[5] := Tile(MainTile.x+1, MainTile.y-1);
      MiddleTile[6] := Tile(MainTile.x+2, MainTile.y-1);
      MiddleTile[7] := Tile(MainTile.x+3, MainTile.y-1);
      MiddleTile[8] := Tile(MainTile.x, MainTile.y-2);
      MiddleTile[9] := Tile(MainTile.x+1, MainTile.y-2);
      MiddleTile[10] := Tile(MainTile.x+2, MainTile.y-2);
      MiddleTile[11] := Tile(MainTile.x+3, MainTile.y-2);
      MiddleTile[12] := Tile(MainTile.x, MainTile.y-3);
      MiddleTile[13] := Tile(MainTile.x+1, MainTile.y-3);
      MiddleTile[14] := Tile(MainTile.x+2, MainTile.y-3);
      MiddleTile[15] := Tile(MainTile.x+3, MainTile.y-3);
      MiddleTile[16] := Tile(MainTile.x, MainTile.y-4);
      MiddleTile[17] := Tile(MainTile.x+1, MainTile.y-4);
      MiddleTile[18] := Tile(MainTile.x+2, MainTile.y-4);
      MiddleTile[19] := Tile(MainTile.x+3, MainTile.y-4);
      MiddleTile[20] := Tile(2909, 4829);
      MiddleTile[21] := Tile(2909, 4828);
      MiddleTile[22] := Tile(2909, 4827);
      MiddleTile[23] := Tile(2908, 4826);
      MiddleTile[24] := Tile(2907, 4826);
      MiddleTile[25] := Tile(2906, 4826);
      MiddleTile[26] := Tile(2905, 4826);
      Rope := GetObjectByID(496, OBJECT_TYPE_FLOORDECOR, 9);
      done := GetMyPos;
      For I:= 0 to 26 do
      //if ((done.x = MiddleTile[I].x) and (done.y = MiddleTile[I].y)) then begin
      if TileOnMS(MiddleTile[I].x, MiddleTile[I].y, 0) then begin
          Writeln('AtMiddle');
          Result := True;
          Break;
        end;
      Result := false;
    End;

    Function WalkFromMiddle:boolean;
    Begin
      if not LoggedIn then Exit;
        Writeln('Starting WalkFromMiddle');
        WalkToTile(Point(2906, 4826), 1, 1);
        If WalkToTile(Point(2898, 4815), 1, 1) then
          Begin
            Wait(1500 + Random(500));
            Debug('Walked from middle');
            Result := True
          End else Result := False;
    End;


    Function WalkToBank: Boolean;
    Begin
      If Not LoggedIn Then
        Exit;
      Wait(750 + Random(300));
      If WalkToTile(Point(3259, 3411), 1, 1) Then
        if WalkToTile(Point(3253, 3420), 1, 1) then
          Result := True;
    End;

    Function Bank: Boolean;
    Var
    i, EssCountEnd, EssCountFinal, ID : integer;
    B : boolean;
    Begin
      If Not LoggedIn Then
        Exit;
        Wait(1000+ Random(1000));
        EssCountEnd := R_InvCount;
        ID := getItemIDAt(2);
      If Not OpenBankFast(Bank_VE) Then
        If Not OpenBankQuiet(Bank_VE) Then
          If Not R_OpenBankBooth('veb') then
          Exit;
         for i := 1 + Integer(not Players[CurrentPlayer].Booleans[0]) to 28 do
          begin
            Deposit(i, 28, True);
          end;
      CloseBank;
      Inc(Players[CurrentPlayer].Integers[1]);
      stats_IncVariable('Loads Done', 1);
      EssCountFinal := (EssCountEnd - EssCountStart);
      begin
            B := ID = RUNEESS_ID;
            SetPrice(B);
            if B then
              stats_IncVariable('Rune Essence (Mined)', EssCountFinal)
            else stats_IncVariable('Pure Essence (Mined)', EssCountFinal);
      end;
      IncEx(Players[CurrentPlayer].Integers[0], EssCountFinal);
      ProgressReport;
      Result := True;
    End;

    Procedure MainLoop;
    Begin
      repeat
      Case Lowercase(Players[CurrentPlayer].Loc) of
        'banked':
        if WalkToAubury then
          Players[CurrentPlayer].Loc := 'at aubury';
        'at aubury':
        if DoAubury then
          Players[CurrentPlayer].Loc := 'done aubury';
        'done aubury': begin
        if AtMiddle then
          Players[CurrentPlayer].Loc := 'at middle'
        else Players[CurrentPlayer].Loc := 'nearly ess';
          end;
        'at middle':
        if WalkFromMiddle then
          Players[CurrentPlayer].Loc := 'nearly ess';
        'nearly ess':
        if AtEssPlace then
          Players[CurrentPlayer].Loc := 'at ess';
        'at ess':
        if WhichEssPlace then
          Players[CurrentPlayer].Loc := 'teleported';
        'teleported':
        if WalkToBank then
          Players[CurrentPlayer].Loc := 'at bank';
        'at bank':
        if Bank then
          Players[CurrentPlayer].Loc := 'banked';
      end;
      until(Players[CurrentPlayer].Integers[1] >= Players[CurrentPlayer].Integers[4]);
    End;



    begin
        ClearDebug;
        ClearReport;
        SetupSRLStats(22, SRLStats_UserID, SRLStats_Password);
        Smart_Server := 17;
        Smart_Members := false;
        Smart_Signed := true;
        Smart_SuperDetail := false;
        SetupSRL;
        AddOnTerminate('ProgressReport');
        begin
            DeclarePlayers;
            LoginPlayer;
            ProgressReport;
            AxeWielded;
            MakeCompass('North');
            SetAngle(True);
            Gametab(tab_Inv);
      repeat
        MainLoop
      until AllPlayersInactive();
        end;
    end.

    It detects that it is AtMiddle.
    and debugs it, so it does this bit:
    Simba Code:
    if TileOnMS(MiddleTile[I].x, MiddleTile[I].y, 0) then begin
          Writeln('AtMiddle');
          Result := True;
          Break;
        end;

    What am I doing wrong?
    I think it could be to do with the loop?

    -Boom

  2. #2
    Join Date
    Dec 2010
    Posts
    431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What is the next function?
    edit: nvm.

    You Break;, not Exit;, causing it to result false;

    e: ninja'd.

  3. #3
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    you are setting the result to false at the end. put an else statement and u should be fine

  4. #4
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Break will get you out of the for loop, leaving you with
    Result := false;
    End;

    Either set false before the for loop, or change the break to exit.

  5. #5
    Join Date
    Dec 2010
    Posts
    808
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That is what i thought but i swear i had that and it still didnt continue.. hmm thanksguys.

  6. #6
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    And you tried my way?
    Simba Code:
    For I:= 0 to 26 do
      //if ((done.x = MiddleTile[I].x) and (done.y = MiddleTile[I].y)) then begin
      if TileOnMS(MiddleTile[I].x, MiddleTile[I].y, 0) then
        begin
          Writeln('AtMiddle');
          Result := True;
          Break;
        end else
          Result := false;

    if that doesn't work then replace your tile(Maintile.x, maintile.y) with actual numbers.

  7. #7
    Join Date
    Dec 2010
    Posts
    808
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Fixed.
    Thanks gaize.

    -Boom

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
  •