Results 1 to 6 of 6

Thread: Failed to create new thread

  1. #1
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default Failed to create new thread

    Hi there.

    Running Flights Livid Farmer (Removed paint) and I am randomly getting this error message.

    Code:
    Exception in Script: Failed to create new thread, code:8
    The script is then forcefully stopped (not freeing DTMs, Bitmaps)

    The script was working find pre-navbar/pre 7.2 SMART.

    Here is the script.

    Simba Code:
    {/////////////////////////////////////////
                      //             LividFarmer              //
                      //             (by Flight)              //
                      //                                      //
                      //             Version: 1.2             //
                      /////////////////////////////////////////}


    program LividFarmer;
      {$DEFINE SRL5}
    {$DEFINE SMART}
    {$I SRL/SRL.Simba}
      {$i SRL/SRL/misc/reports.simba}

    Const

    //SRL Stats
      SRLStats_Username = '';
      SRLStats_Password = '';

    //General settings
      DebugMode    = True;    //On-screen debugging?
      SwitchWorlds = True;    //Switch worlds after a break?

    //Break settings
      BreakIn      = 135;     //How long before we take a break? (minutes)
      BreakFor     = 15;      //How long will we break for? (minutes)
      Bir          = 13;      //Random minutes to add/subtract from how long until we break
      Bfr          = 7;       //Random minutes to add/subjtract from break duraction

    Var

    //Static
      Version: String;
      SCols,PCols: TIntegerArray;

    //Dynamic
      FarmXP,FarmXP_O,MageXP,
      MageXP_O,AgilXP,AgilXP_O,
      Points,CommitTime,
      ReportTime,PlantCount,
      SoilCount: Integer;
      CheckedPauline: Boolean;

    //Break variables
      w,x,y,z,RealBTime,CurrentBTime,
      BreakRounds,TotalBreaks: Integer;


      Procedure DeclarePlayers;
      begin
        HowManyPlayers := 1;
        NumberOfPlayers(HowManyPlayers);
        CurrentPlayer := 0;
        with Players[0] do
        begin
          Name        := '';
          Pass        := '';
          BoxRewards  := ['XP','xp','lamp'];
          LampSkill   := Skill_Farming;
          Active      := True;
        end;
      end;

      Procedure LoadVars;
      begin
        Version := '1.2';
        MarkTime(ReportTime);
        MarkTime(CommitTime);
        CheckedPauline := False;

        SetupSRLStats(156, SRLStats_Username, SRLStats_Password);

        w := (BreakIn * 60000);
        x := (BreakFor * 60000);
        y := RandomRange(-Bir * 60000, Bir * 60000);
        z := RandomRange(-Bfr * 60000, Bfr * 60000);

        SCols := [5073267, 5204854, 5465452, 5402748];          //Soil colors
        PCols := [4542282, 4674124, 4871760, 5003346, 5135188]; //Healthy livid colors
      end;

      Procedure Report;
      Var
        FXPH,MXPH,AXPH: Integer;
      begin
        FXPH := Round((FarmXP * 3600) / (GetTimeRunning / 1000));
        MXPH := Round((MageXP * 3600) / (GetTimeRunning / 1000));
        AXPH := Round((AgilXP * 3600) / (GetTimeRunning / 1000));

        ClearDebug;
        SRLProgressReport(ResultDebugBox, 'LividFarmer', 'Flight', Version,
          ['Run time', 'Points', 'Plants cured', 'Soil fertilized', 'Farming XP',
            'Farming XP/Hr', 'Magic XP', 'Magic XP/Hr', 'Agility XP', 'Agility XP/Hr','Breaks'],
        [MsToTime(GetTimeRunning, Time_Abbrev), Points, PlantCount, SoilCount, FarmXP,
          FXPH, MageXP, MXPH, AgilXP, AXPH, TotalBreaks]);

        MarkTime(ReportTime);
      end;

      Procedure Commit;
      begin
        stats_IncVariable('Farming EXP (Gained)', FarmXP_O);
        stats_IncVariable('Magic EXP (Gained)', MageXP_O);
        stats_IncVariable('Agility EXP (Gained)', AgilXP_O);
        Stats_Commit;
        FarmXP_O := 0;
        MageXP_O := 0;
        AgilXP_O := 0;
        MarkTime(CommitTime);
      end;

      //By Bandland100, modified to shift mouse speeds after every step
      procedure SuperWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
      var
        veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,step: extended;
        lastX,lastY,MSP,W: integer;
        sqrt2,sqrt3,sqrt5: extended;
      begin
        MSP  := MouseSpeed;
        sqrt2:= sqrt(2);
        sqrt3:= sqrt(3);
        sqrt5:= sqrt(5);
        while hypot(xs - xe, ys - ye) > 1 do
        begin
          dist:= hypot(xs - xe, ys - ye);
          wind:= minE(wind, dist);
          if dist >= targetArea then
          begin
            windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
            windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
          end else
          begin
            windX:= windX / sqrt2;
            windY:= windY / sqrt2;
            if (maxStep < 3) then
            begin
              maxStep:= random(3) + 3.0;
            end else
            begin
              maxStep:= maxStep / sqrt5;
            end;
          end;
          veloX:= veloX + windX;
          veloY:= veloY + windY;
          veloX:= veloX + gravity * (xe - xs) / dist;
          veloY:= veloY + gravity * (ye - ys) / dist;
          if hypot(veloX, veloY) > maxStep then
          begin
            randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
            veloMag:= sqrt(veloX * veloX + veloY * veloY);
            veloX:= (veloX / veloMag) * randomDist;
            veloY:= (veloY / veloMag) * randomDist;
          end;
          lastX:= Round(xs);
          lastY:= Round(ys);
          xs:= xs + veloX;
          ys:= ys + veloY;

          case Random(50) of
            1..25: W := (MSP + (Random((MSP/4))));
            26..50: W := (MSP - (RandomRange((MSP/2), MSP-1)));
          end;
          if (W < 1) then
            W := 1;

          if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
            MoveMouse(Round(xs), Round(ys));

          step:= hypot(xs - lastX, ys - lastY);
          wait(W);
          lastdist:= dist;
        end;

        if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
          MoveMouse(Round(xe), Round(ye));

        MouseSpeed := MSP;
      end;

      Procedure HumanRandomMouse;
      var
        randSpeed: extended;
        x, y, firstSpeed: integer;
      begin
        case(Random(10)) of
          2..8:
          begin
            firstSpeed := mouseSpeed;

            mouseSpeed := RandomRange(5,10);
            randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
            GetMousePos(x, y);
            SuperWindMouse(x, y, RandomRange(x - 75, x + 75), RandomRange(y - 75, y + 75),
                    30, 55, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);

            mouseSpeed := firstSpeed;

          end;
        end;
      end;

      Procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
      var
        randSpeed: extended;
        X,Y,X2,Y2,A,Dist,MP: integer;
      begin
        A := MouseSpeed;
        GetMousePos(X, Y);
        Dist := Distance(X, Y, eX, eY);
        MP := Round(Dist/150);
        if MP < 0 then
          MP := 1;

        randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
        X2 := RandomRange(eX-(A*MP), eX+(A*MP));
        Y2 := RandomRange(eY-(A*MP), eY+(A*MP));
        SuperWindMouse(X, Y, X2, Y2, 9.0, 3.0, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
        GetMousePos(X, Y);
        MMouse(eX, eY, ranX, ranY);
        MouseSpeed := A;
      end;

      Procedure ReturnValues(colors: TIntegerArray; var HueMods, SatMods: Extended; var color, Tolerance: Integer);
      Var
        h, s, t: Extended;
        I,II : integer;
        HSLColor : Array[1..3] of Extended;
        HSL : Array[0..1] of Array[1..3] of Extended;
      begin;
        For I:= 1 to 3 do
        begin;
          HSL[0][i] := 255;
        end;

        For I:= 0 to High(Colors) do
        begin;
          ColortoHSL(Colors[i],HSLColor[1],HSLColor[2],HSLColor[3]);
          For II:= 1 to 3 do
          begin;
            HSL[0][II] := MinE(HSLColor[II],HSL[0][II]);
            HSL[1][II] := MaxE(HSLColor[II],HSL[1][II]);
          end;
        end;

        H := (HSL[1][1] - HSL[0][1]);
        S := (HSL[1][2] - HSL[0][2]);
        T := (HSL[1][3] - HSL[0][3]);

        try
          HueMods := (H/T);
          SatMods := (S/T);
          Tolerance := Round(t);
        except
          HueMods := 0;
          SatMods := 0;
          Tolerance := Round(0.0);
        end;

        Color := HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2);
      end;

      Function FindLivid(Var X,Y: Integer): Boolean;
      var
        B: TBox;
        TPA,PAr: TPointArray;
        i,h,CTS: Integer;
        TBA: TBoxArray;
        MBP: TPoint;
        ATPA: T2DPointArray;
      begin
        Result := False;
        if not LoggedIn then Exit;

        CTS := GetColorToleranceSpeed;
        PAr := TPAFromBox(IntToBox(245, 135, 275, 190));

        ColorToleranceSpeed(2);
        SetColorSpeed2Modifiers(8.34, 0.33);

        FindColorsSpiralTolerance(MSCX, MSCY, TPA, 1907996, MSX1, MSY1, MSX2, MSY2, 6);
        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.2, 0.2);

        if (Length(TPA) < 1) then
          Exit;

        TPA := ClearTPAFromTPA(TPA, PAr);
        ATPA := SplitTPAEx(TPA, 30, 40);
        SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));;

        for i := 0 to High(ATPA) do
        begin
          if (GetArrayLength(ATPA[I]) > 50) then
          begin
            B := GetTPABounds(ATPA[i]);

            SetArrayLength(TBA, Length(TBA)+1);
            TBA[High(TBA)] := B;
          end;
        end;


        for h := 0 to High(TBA) do
        begin
          MBP := MiddleBox(TBA[h]);
          HumanMMouse(MBP.X, MBP.Y, 5, 5);
          if WaitUpTextMulti(['Cure', 'plant', 'Diseased', 'livd'], 500) then
          begin
            Result := True;
            GetMousePos(X, Y);
            Exit;
          end else
            Result := False;
        end;

      end;

      Function FindSoil(Var X,Y: Integer): Boolean;
      var
        B,B2: TBox;
        TPA,TPA2,PAr: TPointArray;
        Hmod,Hmod2,Smod2,Smod: Extended;
        i,h,Tol,Tol2,CTS,Col2,Col: Integer;
        TBA: TBoxArray;
        MBP: TPoint;
        ATPA: T2DPointArray;
      begin
        CTS := GetColorToleranceSpeed;
        PAr := TPAFromBox(IntToBox(245, 155, 270, 190));

        ColorToleranceSpeed(2);
        ReturnValues(SCols, Hmod, Smod, Col, Tol);
        SetColorSpeed2Modifiers(Hmod, SMod);

        FindColorsSpiralTolerance(MSCX, MSCY, TPA, Col, MSX1, MSY1, MSX2, MSY2, Tol);

        if (Length(TPA) < 1) then
        begin
          ColorToleranceSpeed(CTS);
          SetColorSpeed2Modifiers(0.2, 0.2);
          Exit;
        end;

        TPA := ClearTPAFromTPA(TPA, PAr);
        ATPA := SplitTPAEx(TPA, 30, 30);
        SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));

        for i := 0 to High(ATPA) do
        begin
          B := GetTPABounds(ATPA[i]);

          ReturnValues(PCols, Hmod2, Smod2, Col2, Tol2);
          SetColorSpeed2Modifiers(Hmod2, SMod2);

          if not FindColorsSpiralTolerance(MSCX, MSCY, TPA2, Col2, B.X1, B.Y1, B.X2, B.Y2, Tol2) then
          begin
            B2 := GetTPABounds(ATPA[i]);
            SetArrayLength(TBA, Length(TBA)+1);
            TBA[High(TBA)] := B2;
          end;

        end;

        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.2, 0.2);

        for h := 0 to High(TBA) do
        begin
          MBP := MiddleBox(TBA[h]);
          HumanMMouse(MBP.X, MBP.Y, 5, 5);
          if WaitUpTextMulti(['Fertilise', 'Empty', 'patch'], 500) then
          begin
            Result := True;
            GetMousePos(X, Y);
            Exit;
          end else
            Result := False;
        end;

      end;

      Function FindPauline(Var X,Y: Integer): Boolean;
      var
        B: TBox;
        TPA,PArr: TPointArray;
        i,h,CTS: Integer;
        MBP: TPoint;
        ATPA: T2DPointArray;
        Cols,Tols: TIntegerArray;
        HMods,SMods: Array of Extended;
      begin
        Result := False;
        if not LoggedIn then Exit;

        CTS := GetColorToleranceSpeed;
        PArr := TPAFromBox(IntToBox(245, 135, 275, 190));

        Cols := [6319982, 6583413, 6648947];
        Tols  := [19, 22, 19];
        HMods := [0.10, 0.09, 0.09];
        SMods := [0.04, 0.08, 0.08];

        for h := 0 to High(Cols) do
        begin
          ColorToleranceSpeed(2);
          SetColorSpeed2Modifiers(HMods[h], SMods[h]);
          FindColorsSpiralTolerance(370, 30, TPA, Cols[h], 300, 5, 420, 70, Tols[h]);
          TPA := ClearTPAFromTPA(TPA, PArr);
          if (Length(TPA) > 0) then break;
        end;

        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.2, 0.2);

        if (Length(TPA) < 1) then
        begin
          Writeln('No Pauline colors found');
          Exit;
        end;

        TPA := ClearTPAFromTPA(TPA, PArr);
        ATPA := SplitTPAEx(TPA, 15, 25);
        SortATPAFromFirstpoint(ATPA, Point(370, 30));;

        for i := 0 to High(ATPA) do
        begin
          B := GetTPABounds(ATPA[i]);

          MBP := MiddleBox(B);
          HumanMMouse(MBP.X, MBP.Y, 5, 5);
          if WaitUpTextMulti(['alk-t', 'rain', 'auli', 'Paul','olari'], 500) then
          begin
            Result := True;
            GetMousePos(X, Y);
            Exit;
          end;
        end;

      end;

      Function GetLividType(X, Y: Integer): Integer;
      var
        R1C1,R1C2,R1C3,R1C4,R1C5,
        R2C1,R2C2,R2C3,R2C4,R2C5,
        R3C1,R3C2,R3C3,R3C4,R3C5: TBox;
      begin
        Result := 0;
      //Top row
        R1C1 := IntToBox(100, 20, 150, 70);
        R1C2 := IntToBox(165, 20, 220, 70);
        R1C3 := IntToBox(235, 20, 290, 70);
        R1C4 := IntToBox(300, 20, 355, 70);
        R1C5 := IntToBox(370, 20, 440, 70);

      //Middle row
        R2C1 := IntToBox(70, 100, 135, 160);
        R2C2 := IntToBox(155, 100, 220, 160);
        R2C3 := IntToBox(230, 100, 290, 160);
        R2C4 := IntToBox(305, 100, 365, 160);
        R2C5 := IntToBox(380, 100, 440, 160);

      //Bottom row
        R3C1 := IntToBox(60, 210, 125, 270);
        R3C2 := IntToBox(140, 210, 215, 270);
        R3C3 := IntToBox(225, 210, 295, 270);
        R3C4 := IntToBox(305, 210, 375, 270);
        R3C5 := IntToBox(400, 210, 470, 270);

        if (IntInBox(X, Y, R1C1) or IntInBox(X, Y, R1C2) or        //Type 1
          IntInBox(X, Y, R1C3) or IntInBox(X, Y, R1C5)) then
            Result := 1
        else if (IntInBox(X, Y, R1C4) or IntInBox(X, Y, R2C3) or   //Type 2
          IntInBox(X, Y, R2C4) or IntInBox(X, Y, R2C5)) then
            Result := 2
        else if (IntInBox(X, Y, R2C2) or IntInBox(X, Y, R3C1) or   //Type 3
          IntInBox(X, Y, R3C5)) then
            Result := 3
        else if (IntInBox(X, Y, R2C1) or IntInBox(X, Y, R3C2) or   //Type 4
          IntInBox(X, Y, R3C3) or IntInBox(X, Y, R3C4)) then
            Result := 4;

      end;

      Function LividMenu: Boolean;
      var
        X,Y: Integer;
      begin
        Result := FindText(x, y, 'train', SmallChars, MIX1, MIY1, MIX2, MIY2);
      end;

      Function TalkScreen: Boolean;
      begin
        Result := GetColor(216, 360) = 7913190;
      end;

      Procedure QuickLow;
      begin
       { KeyDown(40);
        Wait(850 + Random(100));
        KeyUp(40);}

        SetScreenMouse('',0);
      end;

      Procedure QuickHigh;
      begin
       { Mouse(542, 24, 15, 15, mouse_left);
        KeyDown(38);
        Wait(950 + Random(100));
        KeyUp(38);}

         SetScreenMouse('n',10);
      end;

      Procedure CureLivid(Strain: Integer);
      var
        SPoint: TPoint;
      begin
        if (Strain = 1) then
          SPoint := Point(590, 280)
        else if (Strain = 2) then
          SPoint := Point(680, 280)
        else if (Strain = 3) then
          SPoint := Point(590, 400)
        else if (Strain = 4) then
          SPoint := Point(680, 400);

        HumanMMouse(SPoint.X, SPoint.Y, 10, 10);
        if WaitUpText('Continue', 300) then
        begin
          ClickMouse2(True);
          Inc(PlantCount);
          IncEx(FarmXP_O, 92);
          IncEx(FarmXP, 92);
          IncEx(MageXP_O, 60);
          IncEx(MageXP, 60);
          IncEx(Points, 20);
        end;
      end;

      Function HandleLivids: Boolean;
      var
        X,Y,T: Integer;
      label
        Start;
      begin
        Result := False;

        Start:
        if not LoggedIn then Exit;
        FindNormalRandoms;

        MouseSpeed := RandomRange(12, 16);

        if FindLivid(X, Y) then
        begin
          if (GetLividType(X, Y) = 0) then
            GoTo Start;

          CheckedPauline := False;

          ClickMouse2(False);
          if WaitOptionMulti(['Cure', 're-p', '-pl', 'lant'], 500) then
          begin
            HumanMMouse(635, 310+50, 65, 70);
          end;

          MarkTime(T);
          repeat
            if (TimeFromMark(T) > 3000) then
              Exit;
            if LividMenu then
              break;
          until(false)

          if LividMenu then
          begin
            CureLivid(GetLividType(X, Y));
            Wait(randomRange(1915, 2570));
            GoTo Start;
          end;
        end else
          Result := True;

      end;

      Function HandleSoil: Boolean;
      var
        X,Y: Integer;
      label
        Start;
      begin
        Result := False;

        Start:
        MouseSpeed := RandomRange(12, 16);
        FindNormalRandoms;

        if FindSoil(X, Y) then
        begin
          CheckedPauline := False;

          ClickMouse2(False);
          if WaitOption('Empty', 500) then
          begin
            Inc(SoilCount);
            IncEx(FarmXP_O, 92);
            IncEx(FarmXP, 92);
            IncEx(MageXP_O, 87);
            IncEx(MageXP, 87);
            IncEx(Points, 20);
              Wait(randomRange(1915, 2570));
            GoTo Start;
          end;
        end else
          Result := True;

      end;

      Function HandleThatTiredPaulinePersonWhoNeedsEncouragementBecauseWeAreProLikeABoss: Boolean;
      Var
        X,Y: Integer;
        ExBMP,FanBMP,LukBMP,
        ProBMP,WeBMP,WellBMP: Integer;
      begin
        Result := False;
        if not LoggedIn then Exit;

        if ((not FindLivid(X, Y)) and (not FindSoil(X, Y))) then
        begin
          QuickLow;
          SetScreenMouse('E','');
          Wait(RandomRange(235, 320));

          if FindPauline(X, Y) then
          begin
            if WaitUpTextMulti(['Drai', 'raine'], 500) then
            begin
              ClickMouse2(False);
              if WaitOptionMulti(['Ener', 'ergis', 'gise'], 500) then
              begin
                 wait(randomrange(1200,1800));

                if WaitFunc(@TalkScreen, 10, 3000) then
                begin
                  ExBMP := BitmapFromString(16, 5, 'meJw7cQIFMMAAhI0sAuGiiaDJYop' +
                      'QSz0e92C6H9MjcAAAAUs6mQ==');
                  FanBMP := BitmapFromString(67, 6, 'meJw7cQIKGHCAE0gAUxBZBI96POJ' +
                      '4zCTDGcguwSWI7FQ8gsRrwQXw+AWPFvwBRU+PEBNlpGqhv0eI9Ckx' +
                      'WgY2Rij3CMGoITKXEXQzMSmHkqQFAMDdFvg=');
                  LukBMP := BitmapFromString(18, 7, 'meJw7ceIEAwPDCTCJH8DVnAAD/Lp' +
                      'OIAEidSGLI+siaBEZunC5kKAuXOaQpAWiCwCFcEZR');
                  ProBMP := BitmapFromString(26, 7, 'meJw7cQIBGJAAVkFMWWQFmFw0Bho' +
                      'bqyCyLjzieJxHqmlYPUi5aZS7jYHcWMDvI1wAl0YAdzB8OQ==');
                  WellBMP := BitmapFromString(41, 6, 'meJw7cQIBGLABTFmC6nExcOnFahS' +
                      'mIJo5JFmNSy8uc/C4EI/VmCQDkpcxgxHTHEwHUGg1LvNxWY1LOzFG' +
                      '4WFjDQFMBQQFibEaTS8AGGuowQ==');
                  WeBMP := BitmapFromString(23, 8, 'meJw7ceIEAwycQGKTBE5QwxC4XjQ' +
                      'TTsAAHl3ICjANIeg8TAVYDUEG+A0hxiW4/EJQkAzv4HIe8QELAEER' +
                      'YnE=');

                  if (FindBitmapToleranceIn(ExBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) or
                      FindBitmapToleranceIn(WellBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) or
                      FindBitmapToleranceIn(FanBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) or
                      FindBitmapToleranceIn(LukBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) or
                      FindBitmapToleranceIn(ProBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) or
                      FindBitmapToleranceIn(WeBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15)) then
                  begin
                    HumanMMouse(X, Y+2, 10, 2);
                    ClickMouse2(True);
                    IncEx(AgilXP_O, 168);
                    IncEx(AgilXP, 168);
                    IncEx(MageXP_O, 100);
                    IncEx(MageXP, 100);
                    IncEx(Points, 100);
                  end;

                  FreeBitmap(ExBMP);
                  FreeBitmap(WellBMP);
                  FreeBitmap(FanBMP);
                  FreeBitmap(LukBMP);
                  FreeBitmap(ProBMP);
                  FreeBitmap(WeBMP);
                end;

              end;
            end;

            Result := True;
          end;

          QuickHigh;
          CheckedPauline := True;

        end;

      end;

      Function DoAntiban: Boolean;
      var
        i: Integer;
      begin
        if not LoggedIn then Exit;
        i := Random(900);
        case i of
          1..45:
            begin
              HumanRandomMouse;
              Result := True;
            end;
          46:
            begin
              HoverSkill('Farming', False);
              Result := True;
            end;
          47:
            begin
              HoverSkill('Magic', False);
              Result := True;
            end;
        end;

        Wait(100);

      end;

      Function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
      Var
        h,m,s: integer;
      begin
        if not LoggedIn then Exit;

        if (HowManyPlayers = 1) then
        begin
          if (GetTimeRunning < ((w) + (y) + BreakRounds)) then Exit
          else
            if (GetTimeRunning > ((w) + (y) + BreakRounds)) then
            begin
              RealBTime := ((x+z)/60000);
              Writeln('Taking a break for about ' + IntToStr(RealBTime) + ' minutes.');
              Logout;
              MarkTime(CurrentBTime);
              repeat
                Wait(21000);
                ConvertTime((x+z)-TimeFromMark(CurrentBTime), h, m, s);
                ClearDebug;
                Writeln('Breaktime left: '+IntToStr(h)+':'+IntToStr(m)+':'+IntToStr(s));
              until(TimeFromMark(CurrentBTime)>(x+z));
              Writeln('Logging in.');
              if SwitchWorlds then
                if LoginPlayerToLob then
                  ChangeWorld(RandomWorld(True, False))
              else
                LoginPlayer;
              Wait(4000);
              Result := LoggedIn;
              SetScreenMouse('n',10);
              //ClickNorth(SRL_ANGLE_HIGH);
              IncEx(BreakRounds, (w) + (x));
              Inc(TotalBreaks);
              Writeln('The next break will occur in about ' + IntToStr(BreakIn) + ' minutes.');
              w := (BreakIn * 60000);
              x := (BreakFor * 60000);
              y := RandomRange(-Bir * 60000, Bir * 60000);
              z := RandomRange(-Bfr * 60000, Bfr * 60000);
            end;
        end;
      end;

      Procedure FoundARandom;
      begin
        Writeln('Found a random!');
        PlaySound(ScriptPath+'evilaugh.wav');
        Wait(RandomRange(10000, 20000));
      end;

    begin
      SRL_SixHourFix := True;
      Smart_ForceNew:= False;
      Smart_FixSpeed := True;


      setupSRL();
      DeclarePlayers;

      LoadVars;

      LoginPlayer;

      QuickHigh;
      //SRL_Procs[SRL_OnFindRandom] := @FoundARandom;

      Repeat

        if not LoggedIn then
        begin
          LoginPlayer;
          ClickNorth(SRL_ANGLE_HIGH);
        end;

        BreakHandler(BreakIn,BreakFor,Bir,Bfr);

        if (TimeFromMark(CommitTime)>=30000) then
          Commit;

        if (TimeFromMark(ReportTime)>=30000) then
          Report;

        FindNormalRandoms;
        HandleLivids;
        HandleSoil;

        if not CheckedPauline then
          HandleThatTiredPaulinePersonWhoNeedsEncouragementBecauseWeAreProLikeABoss;

        DoAntiban;
        if (Length(GetMMDotsOnMS('white')) > 0) then
        begin
        if LoginPlayerToLob then
         ChangeWorld(RandomWorld(True, False))
        end;
      Until(AllPlayersInactive)
    end.

    When this error is thrown, it opens a new Simba tab, "Untitled"

    that just displays my default.simba

    I am unsure where the script is up to when the error happens.

    Any help would be good.

    Justin

    Forum account issues? Please send me a PM

  2. #2
    Join Date
    Nov 2011
    Location
    United states
    Posts
    516
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by [J]ustin View Post
    Hi there.

    Running Flights Livid Farmer (Removed paint) and I am randomly getting this error message.

    Code:
    Exception in Script: Failed to create new thread, code:8
    The script is then forcefully stopped (not freeing DTMs, Bitmaps)

    The script was working find pre-navbar/pre 7.2 SMART.

    Here is the script.

    Simba Code:
    {/////////////////////////////////////////
                      //             LividFarmer              //
                      //             (by Flight)              //
                      //                                      //
                      //             Version: 1.2             //
                      /////////////////////////////////////////}


    program LividFarmer;
      {$DEFINE SRL5}
    {$DEFINE SMART}
    {$I SRL/SRL.Simba}
      {$i SRL/SRL/misc/reports.simba}

    Const

    //SRL Stats
      SRLStats_Username = '';
      SRLStats_Password = '';

    //General settings
      DebugMode    = True;    //On-screen debugging?
      SwitchWorlds = True;    //Switch worlds after a break?

    //Break settings
      BreakIn      = 135;     //How long before we take a break? (minutes)
      BreakFor     = 15;      //How long will we break for? (minutes)
      Bir          = 13;      //Random minutes to add/subtract from how long until we break
      Bfr          = 7;       //Random minutes to add/subjtract from break duraction

    Var

    //Static
      Version: String;
      SCols,PCols: TIntegerArray;

    //Dynamic
      FarmXP,FarmXP_O,MageXP,
      MageXP_O,AgilXP,AgilXP_O,
      Points,CommitTime,
      ReportTime,PlantCount,
      SoilCount: Integer;
      CheckedPauline: Boolean;

    //Break variables
      w,x,y,z,RealBTime,CurrentBTime,
      BreakRounds,TotalBreaks: Integer;


      Procedure DeclarePlayers;
      begin
        HowManyPlayers := 1;
        NumberOfPlayers(HowManyPlayers);
        CurrentPlayer := 0;
        with Players[0] do
        begin
          Name        := '';
          Pass        := '';
          BoxRewards  := ['XP','xp','lamp'];
          LampSkill   := Skill_Farming;
          Active      := True;
        end;
      end;

      Procedure LoadVars;
      begin
        Version := '1.2';
        MarkTime(ReportTime);
        MarkTime(CommitTime);
        CheckedPauline := False;

        SetupSRLStats(156, SRLStats_Username, SRLStats_Password);

        w := (BreakIn * 60000);
        x := (BreakFor * 60000);
        y := RandomRange(-Bir * 60000, Bir * 60000);
        z := RandomRange(-Bfr * 60000, Bfr * 60000);

        SCols := [5073267, 5204854, 5465452, 5402748];          //Soil colors
        PCols := [4542282, 4674124, 4871760, 5003346, 5135188]; //Healthy livid colors
      end;

      Procedure Report;
      Var
        FXPH,MXPH,AXPH: Integer;
      begin
        FXPH := Round((FarmXP * 3600) / (GetTimeRunning / 1000));
        MXPH := Round((MageXP * 3600) / (GetTimeRunning / 1000));
        AXPH := Round((AgilXP * 3600) / (GetTimeRunning / 1000));

        ClearDebug;
        SRLProgressReport(ResultDebugBox, 'LividFarmer', 'Flight', Version,
          ['Run time', 'Points', 'Plants cured', 'Soil fertilized', 'Farming XP',
            'Farming XP/Hr', 'Magic XP', 'Magic XP/Hr', 'Agility XP', 'Agility XP/Hr','Breaks'],
        [MsToTime(GetTimeRunning, Time_Abbrev), Points, PlantCount, SoilCount, FarmXP,
          FXPH, MageXP, MXPH, AgilXP, AXPH, TotalBreaks]);

        MarkTime(ReportTime);
      end;

      Procedure Commit;
      begin
        stats_IncVariable('Farming EXP (Gained)', FarmXP_O);
        stats_IncVariable('Magic EXP (Gained)', MageXP_O);
        stats_IncVariable('Agility EXP (Gained)', AgilXP_O);
        Stats_Commit;
        FarmXP_O := 0;
        MageXP_O := 0;
        AgilXP_O := 0;
        MarkTime(CommitTime);
      end;

      //By Bandland100, modified to shift mouse speeds after every step
      procedure SuperWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
      var
        veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,step: extended;
        lastX,lastY,MSP,W: integer;
        sqrt2,sqrt3,sqrt5: extended;
      begin
        MSP  := MouseSpeed;
        sqrt2:= sqrt(2);
        sqrt3:= sqrt(3);
        sqrt5:= sqrt(5);
        while hypot(xs - xe, ys - ye) > 1 do
        begin
          dist:= hypot(xs - xe, ys - ye);
          wind:= minE(wind, dist);
          if dist >= targetArea then
          begin
            windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
            windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
          end else
          begin
            windX:= windX / sqrt2;
            windY:= windY / sqrt2;
            if (maxStep < 3) then
            begin
              maxStep:= random(3) + 3.0;
            end else
            begin
              maxStep:= maxStep / sqrt5;
            end;
          end;
          veloX:= veloX + windX;
          veloY:= veloY + windY;
          veloX:= veloX + gravity * (xe - xs) / dist;
          veloY:= veloY + gravity * (ye - ys) / dist;
          if hypot(veloX, veloY) > maxStep then
          begin
            randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
            veloMag:= sqrt(veloX * veloX + veloY * veloY);
            veloX:= (veloX / veloMag) * randomDist;
            veloY:= (veloY / veloMag) * randomDist;
          end;
          lastX:= Round(xs);
          lastY:= Round(ys);
          xs:= xs + veloX;
          ys:= ys + veloY;

          case Random(50) of
            1..25: W := (MSP + (Random((MSP/4))));
            26..50: W := (MSP - (RandomRange((MSP/2), MSP-1)));
          end;
          if (W < 1) then
            W := 1;

          if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
            MoveMouse(Round(xs), Round(ys));

          step:= hypot(xs - lastX, ys - lastY);
          wait(W);
          lastdist:= dist;
        end;

        if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
          MoveMouse(Round(xe), Round(ye));

        MouseSpeed := MSP;
      end;

      Procedure HumanRandomMouse;
      var
        randSpeed: extended;
        x, y, firstSpeed: integer;
      begin
        case(Random(10)) of
          2..8:
          begin
            firstSpeed := mouseSpeed;

            mouseSpeed := RandomRange(5,10);
            randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
            GetMousePos(x, y);
            SuperWindMouse(x, y, RandomRange(x - 75, x + 75), RandomRange(y - 75, y + 75),
                    30, 55, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);

            mouseSpeed := firstSpeed;

          end;
        end;
      end;

      Procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
      var
        randSpeed: extended;
        X,Y,X2,Y2,A,Dist,MP: integer;
      begin
        A := MouseSpeed;
        GetMousePos(X, Y);
        Dist := Distance(X, Y, eX, eY);
        MP := Round(Dist/150);
        if MP < 0 then
          MP := 1;

        randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
        X2 := RandomRange(eX-(A*MP), eX+(A*MP));
        Y2 := RandomRange(eY-(A*MP), eY+(A*MP));
        SuperWindMouse(X, Y, X2, Y2, 9.0, 3.0, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
        GetMousePos(X, Y);
        MMouse(eX, eY, ranX, ranY);
        MouseSpeed := A;
      end;

      Procedure ReturnValues(colors: TIntegerArray; var HueMods, SatMods: Extended; var color, Tolerance: Integer);
      Var
        h, s, t: Extended;
        I,II : integer;
        HSLColor : Array[1..3] of Extended;
        HSL : Array[0..1] of Array[1..3] of Extended;
      begin;
        For I:= 1 to 3 do
        begin;
          HSL[0][i] := 255;
        end;

        For I:= 0 to High(Colors) do
        begin;
          ColortoHSL(Colors[i],HSLColor[1],HSLColor[2],HSLColor[3]);
          For II:= 1 to 3 do
          begin;
            HSL[0][II] := MinE(HSLColor[II],HSL[0][II]);
            HSL[1][II] := MaxE(HSLColor[II],HSL[1][II]);
          end;
        end;

        H := (HSL[1][1] - HSL[0][1]);
        S := (HSL[1][2] - HSL[0][2]);
        T := (HSL[1][3] - HSL[0][3]);

        try
          HueMods := (H/T);
          SatMods := (S/T);
          Tolerance := Round(t);
        except
          HueMods := 0;
          SatMods := 0;
          Tolerance := Round(0.0);
        end;

        Color := HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2);
      end;

      Function FindLivid(Var X,Y: Integer): Boolean;
      var
        B: TBox;
        TPA,PAr: TPointArray;
        i,h,CTS: Integer;
        TBA: TBoxArray;
        MBP: TPoint;
        ATPA: T2DPointArray;
      begin
        Result := False;
        if not LoggedIn then Exit;

        CTS := GetColorToleranceSpeed;
        PAr := TPAFromBox(IntToBox(245, 135, 275, 190));

        ColorToleranceSpeed(2);
        SetColorSpeed2Modifiers(8.34, 0.33);

        FindColorsSpiralTolerance(MSCX, MSCY, TPA, 1907996, MSX1, MSY1, MSX2, MSY2, 6);
        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.2, 0.2);

        if (Length(TPA) < 1) then
          Exit;

        TPA := ClearTPAFromTPA(TPA, PAr);
        ATPA := SplitTPAEx(TPA, 30, 40);
        SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));;

        for i := 0 to High(ATPA) do
        begin
          if (GetArrayLength(ATPA[I]) > 50) then
          begin
            B := GetTPABounds(ATPA[i]);

            SetArrayLength(TBA, Length(TBA)+1);
            TBA[High(TBA)] := B;
          end;
        end;


        for h := 0 to High(TBA) do
        begin
          MBP := MiddleBox(TBA[h]);
          HumanMMouse(MBP.X, MBP.Y, 5, 5);
          if WaitUpTextMulti(['Cure', 'plant', 'Diseased', 'livd'], 500) then
          begin
            Result := True;
            GetMousePos(X, Y);
            Exit;
          end else
            Result := False;
        end;

      end;

      Function FindSoil(Var X,Y: Integer): Boolean;
      var
        B,B2: TBox;
        TPA,TPA2,PAr: TPointArray;
        Hmod,Hmod2,Smod2,Smod: Extended;
        i,h,Tol,Tol2,CTS,Col2,Col: Integer;
        TBA: TBoxArray;
        MBP: TPoint;
        ATPA: T2DPointArray;
      begin
        CTS := GetColorToleranceSpeed;
        PAr := TPAFromBox(IntToBox(245, 155, 270, 190));

        ColorToleranceSpeed(2);
        ReturnValues(SCols, Hmod, Smod, Col, Tol);
        SetColorSpeed2Modifiers(Hmod, SMod);

        FindColorsSpiralTolerance(MSCX, MSCY, TPA, Col, MSX1, MSY1, MSX2, MSY2, Tol);

        if (Length(TPA) < 1) then
        begin
          ColorToleranceSpeed(CTS);
          SetColorSpeed2Modifiers(0.2, 0.2);
          Exit;
        end;

        TPA := ClearTPAFromTPA(TPA, PAr);
        ATPA := SplitTPAEx(TPA, 30, 30);
        SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));

        for i := 0 to High(ATPA) do
        begin
          B := GetTPABounds(ATPA[i]);

          ReturnValues(PCols, Hmod2, Smod2, Col2, Tol2);
          SetColorSpeed2Modifiers(Hmod2, SMod2);

          if not FindColorsSpiralTolerance(MSCX, MSCY, TPA2, Col2, B.X1, B.Y1, B.X2, B.Y2, Tol2) then
          begin
            B2 := GetTPABounds(ATPA[i]);
            SetArrayLength(TBA, Length(TBA)+1);
            TBA[High(TBA)] := B2;
          end;

        end;

        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.2, 0.2);

        for h := 0 to High(TBA) do
        begin
          MBP := MiddleBox(TBA[h]);
          HumanMMouse(MBP.X, MBP.Y, 5, 5);
          if WaitUpTextMulti(['Fertilise', 'Empty', 'patch'], 500) then
          begin
            Result := True;
            GetMousePos(X, Y);
            Exit;
          end else
            Result := False;
        end;

      end;

      Function FindPauline(Var X,Y: Integer): Boolean;
      var
        B: TBox;
        TPA,PArr: TPointArray;
        i,h,CTS: Integer;
        MBP: TPoint;
        ATPA: T2DPointArray;
        Cols,Tols: TIntegerArray;
        HMods,SMods: Array of Extended;
      begin
        Result := False;
        if not LoggedIn then Exit;

        CTS := GetColorToleranceSpeed;
        PArr := TPAFromBox(IntToBox(245, 135, 275, 190));

        Cols := [6319982, 6583413, 6648947];
        Tols  := [19, 22, 19];
        HMods := [0.10, 0.09, 0.09];
        SMods := [0.04, 0.08, 0.08];

        for h := 0 to High(Cols) do
        begin
          ColorToleranceSpeed(2);
          SetColorSpeed2Modifiers(HMods[h], SMods[h]);
          FindColorsSpiralTolerance(370, 30, TPA, Cols[h], 300, 5, 420, 70, Tols[h]);
          TPA := ClearTPAFromTPA(TPA, PArr);
          if (Length(TPA) > 0) then break;
        end;

        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.2, 0.2);

        if (Length(TPA) < 1) then
        begin
          Writeln('No Pauline colors found');
          Exit;
        end;

        TPA := ClearTPAFromTPA(TPA, PArr);
        ATPA := SplitTPAEx(TPA, 15, 25);
        SortATPAFromFirstpoint(ATPA, Point(370, 30));;

        for i := 0 to High(ATPA) do
        begin
          B := GetTPABounds(ATPA[i]);

          MBP := MiddleBox(B);
          HumanMMouse(MBP.X, MBP.Y, 5, 5);
          if WaitUpTextMulti(['alk-t', 'rain', 'auli', 'Paul','olari'], 500) then
          begin
            Result := True;
            GetMousePos(X, Y);
            Exit;
          end;
        end;

      end;

      Function GetLividType(X, Y: Integer): Integer;
      var
        R1C1,R1C2,R1C3,R1C4,R1C5,
        R2C1,R2C2,R2C3,R2C4,R2C5,
        R3C1,R3C2,R3C3,R3C4,R3C5: TBox;
      begin
        Result := 0;
      //Top row
        R1C1 := IntToBox(100, 20, 150, 70);
        R1C2 := IntToBox(165, 20, 220, 70);
        R1C3 := IntToBox(235, 20, 290, 70);
        R1C4 := IntToBox(300, 20, 355, 70);
        R1C5 := IntToBox(370, 20, 440, 70);

      //Middle row
        R2C1 := IntToBox(70, 100, 135, 160);
        R2C2 := IntToBox(155, 100, 220, 160);
        R2C3 := IntToBox(230, 100, 290, 160);
        R2C4 := IntToBox(305, 100, 365, 160);
        R2C5 := IntToBox(380, 100, 440, 160);

      //Bottom row
        R3C1 := IntToBox(60, 210, 125, 270);
        R3C2 := IntToBox(140, 210, 215, 270);
        R3C3 := IntToBox(225, 210, 295, 270);
        R3C4 := IntToBox(305, 210, 375, 270);
        R3C5 := IntToBox(400, 210, 470, 270);

        if (IntInBox(X, Y, R1C1) or IntInBox(X, Y, R1C2) or        //Type 1
          IntInBox(X, Y, R1C3) or IntInBox(X, Y, R1C5)) then
            Result := 1
        else if (IntInBox(X, Y, R1C4) or IntInBox(X, Y, R2C3) or   //Type 2
          IntInBox(X, Y, R2C4) or IntInBox(X, Y, R2C5)) then
            Result := 2
        else if (IntInBox(X, Y, R2C2) or IntInBox(X, Y, R3C1) or   //Type 3
          IntInBox(X, Y, R3C5)) then
            Result := 3
        else if (IntInBox(X, Y, R2C1) or IntInBox(X, Y, R3C2) or   //Type 4
          IntInBox(X, Y, R3C3) or IntInBox(X, Y, R3C4)) then
            Result := 4;

      end;

      Function LividMenu: Boolean;
      var
        X,Y: Integer;
      begin
        Result := FindText(x, y, 'train', SmallChars, MIX1, MIY1, MIX2, MIY2);
      end;

      Function TalkScreen: Boolean;
      begin
        Result := GetColor(216, 360) = 7913190;
      end;

      Procedure QuickLow;
      begin
       { KeyDown(40);
        Wait(850 + Random(100));
        KeyUp(40);}

        SetScreenMouse('',0);
      end;

      Procedure QuickHigh;
      begin
       { Mouse(542, 24, 15, 15, mouse_left);
        KeyDown(38);
        Wait(950 + Random(100));
        KeyUp(38);}

         SetScreenMouse('n',10);
      end;

      Procedure CureLivid(Strain: Integer);
      var
        SPoint: TPoint;
      begin
        if (Strain = 1) then
          SPoint := Point(590, 280)
        else if (Strain = 2) then
          SPoint := Point(680, 280)
        else if (Strain = 3) then
          SPoint := Point(590, 400)
        else if (Strain = 4) then
          SPoint := Point(680, 400);

        HumanMMouse(SPoint.X, SPoint.Y, 10, 10);
        if WaitUpText('Continue', 300) then
        begin
          ClickMouse2(True);
          Inc(PlantCount);
          IncEx(FarmXP_O, 92);
          IncEx(FarmXP, 92);
          IncEx(MageXP_O, 60);
          IncEx(MageXP, 60);
          IncEx(Points, 20);
        end;
      end;

      Function HandleLivids: Boolean;
      var
        X,Y,T: Integer;
      label
        Start;
      begin
        Result := False;

        Start:
        if not LoggedIn then Exit;
        FindNormalRandoms;

        MouseSpeed := RandomRange(12, 16);

        if FindLivid(X, Y) then
        begin
          if (GetLividType(X, Y) = 0) then
            GoTo Start;

          CheckedPauline := False;

          ClickMouse2(False);
          if WaitOptionMulti(['Cure', 're-p', '-pl', 'lant'], 500) then
          begin
            HumanMMouse(635, 310+50, 65, 70);
          end;

          MarkTime(T);
          repeat
            if (TimeFromMark(T) > 3000) then
              Exit;
            if LividMenu then
              break;
          until(false)

          if LividMenu then
          begin
            CureLivid(GetLividType(X, Y));
            Wait(randomRange(1915, 2570));
            GoTo Start;
          end;
        end else
          Result := True;

      end;

      Function HandleSoil: Boolean;
      var
        X,Y: Integer;
      label
        Start;
      begin
        Result := False;

        Start:
        MouseSpeed := RandomRange(12, 16);
        FindNormalRandoms;

        if FindSoil(X, Y) then
        begin
          CheckedPauline := False;

          ClickMouse2(False);
          if WaitOption('Empty', 500) then
          begin
            Inc(SoilCount);
            IncEx(FarmXP_O, 92);
            IncEx(FarmXP, 92);
            IncEx(MageXP_O, 87);
            IncEx(MageXP, 87);
            IncEx(Points, 20);
              Wait(randomRange(1915, 2570));
            GoTo Start;
          end;
        end else
          Result := True;

      end;

      Function HandleThatTiredPaulinePersonWhoNeedsEncouragementBecauseWeAreProLikeABoss: Boolean;
      Var
        X,Y: Integer;
        ExBMP,FanBMP,LukBMP,
        ProBMP,WeBMP,WellBMP: Integer;
      begin
        Result := False;
        if not LoggedIn then Exit;

        if ((not FindLivid(X, Y)) and (not FindSoil(X, Y))) then
        begin
          QuickLow;
          SetScreenMouse('E','');
          Wait(RandomRange(235, 320));

          if FindPauline(X, Y) then
          begin
            if WaitUpTextMulti(['Drai', 'raine'], 500) then
            begin
              ClickMouse2(False);
              if WaitOptionMulti(['Ener', 'ergis', 'gise'], 500) then
              begin
                 wait(randomrange(1200,1800));

                if WaitFunc(@TalkScreen, 10, 3000) then
                begin
                  ExBMP := BitmapFromString(16, 5, 'meJw7cQIFMMAAhI0sAuGiiaDJYop' +
                      'QSz0e92C6H9MjcAAAAUs6mQ==');
                  FanBMP := BitmapFromString(67, 6, 'meJw7cQIKGHCAE0gAUxBZBI96POJ' +
                      '4zCTDGcguwSWI7FQ8gsRrwQXw+AWPFvwBRU+PEBNlpGqhv0eI9Ckx' +
                      'WgY2Rij3CMGoITKXEXQzMSmHkqQFAMDdFvg=');
                  LukBMP := BitmapFromString(18, 7, 'meJw7ceIEAwPDCTCJH8DVnAAD/Lp' +
                      'OIAEidSGLI+siaBEZunC5kKAuXOaQpAWiCwCFcEZR');
                  ProBMP := BitmapFromString(26, 7, 'meJw7cQIBGJAAVkFMWWQFmFw0Bho' +
                      'bqyCyLjzieJxHqmlYPUi5aZS7jYHcWMDvI1wAl0YAdzB8OQ==');
                  WellBMP := BitmapFromString(41, 6, 'meJw7cQIBGLABTFmC6nExcOnFahS' +
                      'mIJo5JFmNSy8uc/C4EI/VmCQDkpcxgxHTHEwHUGg1LvNxWY1LOzFG' +
                      '4WFjDQFMBQQFibEaTS8AGGuowQ==');
                  WeBMP := BitmapFromString(23, 8, 'meJw7ceIEAwycQGKTBE5QwxC4XjQ' +
                      'TTsAAHl3ICjANIeg8TAVYDUEG+A0hxiW4/EJQkAzv4HIe8QELAEER' +
                      'YnE=');

                  if (FindBitmapToleranceIn(ExBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) or
                      FindBitmapToleranceIn(WellBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) or
                      FindBitmapToleranceIn(FanBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) or
                      FindBitmapToleranceIn(LukBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) or
                      FindBitmapToleranceIn(ProBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15) or
                      FindBitmapToleranceIn(WeBMP, X, Y, MCX1, MCY1, MCX2, MCY2, 15)) then
                  begin
                    HumanMMouse(X, Y+2, 10, 2);
                    ClickMouse2(True);
                    IncEx(AgilXP_O, 168);
                    IncEx(AgilXP, 168);
                    IncEx(MageXP_O, 100);
                    IncEx(MageXP, 100);
                    IncEx(Points, 100);
                  end;

                  FreeBitmap(ExBMP);
                  FreeBitmap(WellBMP);
                  FreeBitmap(FanBMP);
                  FreeBitmap(LukBMP);
                  FreeBitmap(ProBMP);
                  FreeBitmap(WeBMP);
                end;

              end;
            end;

            Result := True;
          end;

          QuickHigh;
          CheckedPauline := True;

        end;

      end;

      Function DoAntiban: Boolean;
      var
        i: Integer;
      begin
        if not LoggedIn then Exit;
        i := Random(900);
        case i of
          1..45:
            begin
              HumanRandomMouse;
              Result := True;
            end;
          46:
            begin
              HoverSkill('Farming', False);
              Result := True;
            end;
          47:
            begin
              HoverSkill('Magic', False);
              Result := True;
            end;
        end;

        Wait(100);

      end;

      Function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
      Var
        h,m,s: integer;
      begin
        if not LoggedIn then Exit;

        if (HowManyPlayers = 1) then
        begin
          if (GetTimeRunning < ((w) + (y) + BreakRounds)) then Exit
          else
            if (GetTimeRunning > ((w) + (y) + BreakRounds)) then
            begin
              RealBTime := ((x+z)/60000);
              Writeln('Taking a break for about ' + IntToStr(RealBTime) + ' minutes.');
              Logout;
              MarkTime(CurrentBTime);
              repeat
                Wait(21000);
                ConvertTime((x+z)-TimeFromMark(CurrentBTime), h, m, s);
                ClearDebug;
                Writeln('Breaktime left: '+IntToStr(h)+':'+IntToStr(m)+':'+IntToStr(s));
              until(TimeFromMark(CurrentBTime)>(x+z));
              Writeln('Logging in.');
              if SwitchWorlds then
                if LoginPlayerToLob then
                  ChangeWorld(RandomWorld(True, False))
              else
                LoginPlayer;
              Wait(4000);
              Result := LoggedIn;
              SetScreenMouse('n',10);
              //ClickNorth(SRL_ANGLE_HIGH);
              IncEx(BreakRounds, (w) + (x));
              Inc(TotalBreaks);
              Writeln('The next break will occur in about ' + IntToStr(BreakIn) + ' minutes.');
              w := (BreakIn * 60000);
              x := (BreakFor * 60000);
              y := RandomRange(-Bir * 60000, Bir * 60000);
              z := RandomRange(-Bfr * 60000, Bfr * 60000);
            end;
        end;
      end;

      Procedure FoundARandom;
      begin
        Writeln('Found a random!');
        PlaySound(ScriptPath+'evilaugh.wav');
        Wait(RandomRange(10000, 20000));
      end;

    begin
      SRL_SixHourFix := True;
      Smart_ForceNew:= False;
      Smart_FixSpeed := True;


      setupSRL();
      DeclarePlayers;

      LoadVars;

      LoginPlayer;

      QuickHigh;
      //SRL_Procs[SRL_OnFindRandom] := @FoundARandom;

      Repeat

        if not LoggedIn then
        begin
          LoginPlayer;
          ClickNorth(SRL_ANGLE_HIGH);
        end;

        BreakHandler(BreakIn,BreakFor,Bir,Bfr);

        if (TimeFromMark(CommitTime)>=30000) then
          Commit;

        if (TimeFromMark(ReportTime)>=30000) then
          Report;

        FindNormalRandoms;
        HandleLivids;
        HandleSoil;

        if not CheckedPauline then
          HandleThatTiredPaulinePersonWhoNeedsEncouragementBecauseWeAreProLikeABoss;

        DoAntiban;
        if (Length(GetMMDotsOnMS('white')) > 0) then
        begin
        if LoginPlayerToLob then
         ChangeWorld(RandomWorld(True, False))
        end;
      Until(AllPlayersInactive)
    end.

    When this error is thrown, it opens a new Simba tab, "Untitled"

    that just displays my default.simba

    I am unsure where the script is up to when the error happens.

    Any help would be good.

    Justin
    hmm... thats weird close all you simba windows and restart does it do the same thing?

  3. #3
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    Quote Originally Posted by getdropped69 View Post
    hmm... thats weird close all you simba windows and restart does it do the same thing?
    Yea, same problem

    Forum account issues? Please send me a PM

  4. #4
    Join Date
    Nov 2011
    Location
    United states
    Posts
    516
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    Try copying the entire script into a new blank simba

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

    Default

    Looks like you made this one just fine?

  6. #6
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Haha +1 YoHoJo ;P

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
  •