Results 1 to 4 of 4

Thread: The Ugliest Loop that Ever Lived

  1. #1
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default The Ugliest Loop that Ever Lived

    Simba Code:
    Function MineRock(WutRock:Integer):Boolean;
    var I,PlusOne,tMine,J:Integer;
        OrePts, RockPts:TPointArray;
        RockPtsBox, BingoBox: T2DPointArray;
        BingoPt: TPoint;
        SearchBox: TBox;
    Begin
      If Not(LoggedIn) Then Exit;
      StatsGuise('Searching For Rock: '+ IntToStr(InvCount));
      If OreInLast Then Exit;

      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.04, 1.27);
      FindColorsSpiralTolerance(MSCX, MSCY, RockPts, 1461093, MSX1, MSY1, MSX2, MSY2, 10);
      SetColorSpeed2Modifiers(0.2,0.2);
      ColorToleranceSpeed(1);

      RockPtsBox:=TPAtoATPAEx(RockPts,35,35);
      {DebugATPABounds(RockPtsBox);
      Writeln('This is RockPtsBox');}



      //Writeln('RockPts ' + IntToStr (GetArrayLength(RockPts) ) );

      For I:=0 To High(RockPtsBox) Do
      Begin
        If Not(LoggedIn) Then Break;
        //Writeln('Searching Box ' +IntToStr (i));
        SearchBox:= GetTPABounds(RockPtsBox[i]);
        //Writeln( IntToStr(SearchBox.x1) + ',' + IntToStr(SearchBox.y1)+ ',' + IntToStr(SearchBox.x2)+ ',' + IntToStr(SearchBox.y2) );
        If (GetArrayLength(RockPtsBox[I]) > 30) Then
        Begin
          If YDebug Then DebugATPA(RockPtsBox,'');
          ColorToleranceSpeed(2);
          SetColorSpeed2Modifiers(1.39,0.11);
          FindColorsSpiralTolerance(MSCX,MSCY,OrePts,2434854,SearchBox.x1,SearchBox.y1,SearchBox.x2,SearchBox.y2,10);
          Writeln('OrePts ' + IntToStr (GetArrayLength(OrePts) ) );
          SetColorSpeed2Modifiers(0.2,0.2);
          ColorToleranceSpeed(1);
          If High(OrePts) > 1 Then
          Begin
            BingoBox:=TPAtoATPAEx(OrePts, 10, 10);
            For I:=0 To High(BingoBox) Do
            Begin
              //DebugTPA(OrePts,'');
              //Writeln('This is BingoBox');
              If GetArrayLength(BingoBox[I])>10 Then
              Begin
                BingoPt:= MiddleTPA(BingoBox[I]);
                If CheckAndClick(BingoPt.x,BingoPt.y) Then
                Begin
                  Result:=True;
                  MarkTime(tMine);
                  StatsGuise('Mining Rock: '+ IntToStr(InvCount));
                  Players[CurrentPlayer].Loc:='Mining';
                  PlusOne:=InvCount+1;
                  Repeat
                    If Not(LoggedIn) Then Break;
                    Wait(200);
                    If Random(2) = 0 Then
                    Begin
                      RT:=GetSystemTime;
                      If FindNormalRandoms Then
                        IncEx(WeMined,GetSystemTime - RT);
                    End;
                    If Random(50)=1 Then SleepAndMoveMouse(500+Random(100));
                    //If (Not(IsMoving)) Then Begin Writeln('a'); Break; End;
                    If InvCount=PlusOne Then
                    Begin
                      Inc(J);
                      TOres:=TOres + J;
                      Inc(Players[CurrentPlayer].Integers[81]);
                    End;
                  Until (InvCount = PlusOne)  Or (TimeFromMark(tMine) > ((Players[CurrentPlayer].Integers[2]*1000) + Random(500)));
                  Exit;
                End;
              End;
            End;
          End Else Continue;
        End;
      Wait(750+Random(250));
      End;
    End;

    TPAs/T2DPointArrays RockPts.
    Then searching within the T2DPoint Array for another TPA/T2DPointArray called OrePts.

    For To Do Loops though all of the T2DPointArrays called RockPts to see if any of the second T2DPointArray OrePts exists within it and has > 10 pixels found within it.

    Messy as mess :/. Halp?
    (Code compiles and works just fine)

    HAVE FUN HAHAHAHAHA
    Last edited by YoHoJo; 12-14-2011 at 06:29 PM.

  2. #2
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    I suggest you make FindOre and MiningWait functions separately. Then Make MineOre that uses them both.
    Quote Originally Posted by DeSnob View Post
    ETA's don't exist in SRL like they did in other communities. Want a faster update? Help out with updating, otherwise just gotta wait it out.

  3. #3
    Join Date
    Oct 2007
    Location
    The deep web
    Posts
    2,496
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    thats a loop?
    Did someone say GDK?

  4. #4
    Join Date
    Oct 2008
    Location
    behind you!
    Posts
    1,688
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by jakeyboy29 View Post
    thats a loop?
    //offtopic
    made me lol.
    Hi

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
  •