Results 1 to 4 of 4

Thread: Help with script once again

  1. #1
    Join Date
    Oct 2007
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help with script once again

    Ok i am almost done my remake of Minotaur Exterminator, what it does now:
    Logs in, puts on the training skill, checks exp and then for some reason it loggs out. I haven't got much more time for scripting so if someone can fix it up for me a little that would be great, thanks again.

    Problem is somewhere in main loop area...
    SCAR Code:
    program Minotaurminator;
    {.Include SRL/SRL.Scar}
    {.Include SRL/SRL/Skill/Fighting.Scar}

    {This script was made by Ultra} {Version 1.0}
                                                                                   {
    (*Features*)
    - Anti-ban with displaying of how strongly you are protected by the script.
    - Anti-randoms.
    - Quick and effective eating.
    - Script tries to find a non-attacked minotaur, if none found,
    it will attack one that has already been attacked (human-like)!
    - Quick Minotaur finding!
    - Failsafes.
    - Picks up all arrows and coins!
    - Brake taking to avoid random events and bans.
    - Trains only melee at the moment.
    - Does not support fully working multi-player (use single-player
    for best results). Some things in the progress reports might get messed up if
    you use multiplayer.
                                                                                   }

    {START OF SETUP}
    const
    {Non-combat related}
    GatherArrows = True; //Would you like the script to pick up arrows?
    GatherCoins = False; //Would you like the script to pick up coins?
                         //Make sure you have space in your inventory to put these
                         //items in. Pickup slows down exp gaining rate.

    {Combat related}
    //Training.
    SkillToTrain = 'str';     //Which skill to train and monitor? //'str','def','att'\\
    AttackingDelayMin = 800;  //Minumum amount of miliseconds to wait after attacking.
    AttackingDelayMax = 1500; //Maximum amount of miliseconds to wait after attacking.
    CheckExpEvery = 30;       //Check your exp every how many seconds? A reasonable
                              //random amount is added.

    //Healing.
    DangerPercent = 50;   //At which % of the hp should the script eat food?

    {Anti-ban related}
    SmallBreaks = True;  //Would you like the script to take small brakes?
    RegularHuman = True; //Would you like the script to perform anti-ban to keep
                         //you from getting banned?
    MSpeed = 'random during auto';   //The speed at which the cursor will move.
                         //Increases performance but raises ban factor the faster
                         //it is. 'random during auto' is suited the best, it
                         //switches mouse speeds everynow and then.
                         //'lazy','normal','fast','very fast','random during auto'.

    procedure DeclarePlayers;
    begin
     HowManyPlayers := 1;//How many players are going to auto in total?
     CurrentPlayer := 0;//Which player goes first? Best to leave this as it is.
     NumberOfPlayers(HowManyPlayers);//No Touching.

      Players[0].Name :='';//Username.
      Players[0].Pass :='';//Password.
      Players[0].Nick :='';//Nickname.
      Players[0].Active := True;//Is this player going to auto?

    end;


    {END OF SETUP - DO NOT TOUCH BELOW THIS LINE IF YOU DONT KNOW WHAT YOU ARE DOING}

    var
    BanFactor, F, X, Y : Integer;
    BreakTime, BreakMark, BreakFor : Integer;
    Breaking, FoundM : Boolean;
    ExpEarned, ExpMark, ArrowsPicked, CoinsPicked : Integer;
    WasExp, NowExp : Integer;

    function NoActivePlayers : Boolean;
    var
    I : Integer;
    begin
      for I := 0 to (HowManyPlayers - 1) do
       if Players[I].Active then
         Exit;
      Result := True;
    end;

    procedure ErrorInScript(TheMessage : String; TerminateTheScript, ClearIt : Boolean);
    begin
     if ClearIt then ClearDebug;
     WriteLn(TheMessage);
     if TerminateTheScript then TerminateScript;
    end;


    function GetNowExp : Integer;
    begin
     if (TimeFromMark(ExpMark)>(CheckExpEvery*1000)+Random(CheckExpEvery*1000))and(LoggedIn)then
     begin
     case SkillToTrain of
     'str': NowExp := GetXP('strength');
     'att': NowExp := GetXP('attack');
     'def': NowExp := GetXP('defence');
     end;
     Result:=NowExp;
    end;
    end;

    procedure Report;
    begin
     WriteLn('##########################################################');
     WriteLn('Script antiban protection is at ' + IntToStr(BanFactor) + '% capacity.');
     WriteLn('Script has been running for ' + TimeRunning + '.');
     WriteLn('Exp earned total is ' + IntToStr(GetNowExp-WasExp) + '.');
     WriteLn('##########################################################');
    end;

    function MyEatFood : Boolean;
    var
      i,x,y:integer;
    begin
      Gametab(4);
      for i := 28 to 1 do
      if ExistsItem(I) then
      begin
        MMouseItem(I);
        GetMousePos(x, y);
        Wait(100+random(50));
        if (pos('Eat', rs_GetUpText) > 0) then
        begin
          Mouse(x,y,0,0,false);
          Wait(50+random(50));
          if ChooseOption('Eat') then
          begin
            Wait(350+random(150));
            Result := true;
            Exit;
          end else Result:=False;
        end;
      end;
    end;

    procedure HealThyself;
    begin
     if HPPercent<=DangerPercent then
      begin
       if not MyEatFood then
        begin
        Players[CurrentPlayer].Active:=False;
        Breaking := False;
        while LoggedIn do
         begin
         LogOut;
         Wait(500);
         FindNormalRandoms;
         Wait(500);
         end;
        end;
      end;
    end;

    procedure AntiBan_RegularHuman;
    var
    MT, RT : Integer;
    begin
    MT := 0;
    RT := RandomRange(2000, 15000);
     case RandomRange(1, 100) of
     1..10: Wait(100+random(500));
     11..19: HoverSkill('random', False);
     20..22:
     begin
       MarkTime(MT);
       while TimeFromMark(MT)<RT do
       begin
        FindNormalRandoms;
        Wait(200);
       end;
     end;
     23..29: RandomMovement;
     30..32: BoredHuman;
     33..37: ExamineInv;
     34..42: LevelUp;
     43..70: Wait(RandomRange(100, 5000));
     71..100: Wait(1);
      end;
    end;

    procedure DeclareMSpeed;
    var
    Error : Boolean;
    begin
    Error := True;
     case MSpeed of
     'lazy': begin MouseSpeed := 10; Error:=False; end;
     'normal': begin MouseSpeed := 15; Error:=False; end;
     'fast': begin MouseSpeed := 20; Error:=False; end;
     'very fast': begin MouseSpeed := 25; Error:=False; end;
     'random during auto': begin Error:=False;
      case RandomRange(1, 4) of
      1: MouseSpeed := 10;
      2: MouseSpeed := 15;
      3: MouseSpeed := 20;
      4: MouseSpeed := 25;
     end;
     end;
     end;
       if Error then ErrorInScript('MSpeed const was declared improperly!', True, True);
    end;


    procedure DeclareBanFactor;
    begin
    BanFactor := 0;
     if SmallBreaks=True then BanFactor := BanFactor + 20;
     if RegularHuman=True then BanFactor := BanFactor + 60;
     case MSpeed of
     'lazy': BanFactor := BanFactor + 15;
     'normal': BanFactor := BanFactor + 16;
     'fast': BanFactor := BanFactor + 15;
     'very fast': BanFactor := BanFactor + 14;
     'random during auto': BanFactor := BanFactor + 20;
     end;
    end;

    function FindNonAttackedMinotaur : Boolean;
    var
     TX, TY, I : Integer;
     Points : TPointArray;
     Minotaur2D : T2DPointArray;
     MinotaurPoint : TPoint;
    begin
     X := MSCX;
     Y := MSCY;
     FindColorsSpiralTolerance(X, Y, Points, 10923694, MSX1, MSY1, MSX2, MSY2, 5);
     if Length(Points)=0 then begin Result:=False; Exit; end;
     Minotaur2D := TPAToATPAEx(Points, 10, 10);
     for I := 0 to Length(Minotaur2D)-1 do
     begin
      if not LoggedIn then begin Result:=True; Exit; end;
      MinotaurPoint := MiddleTPA(Minotaur2D[i]);
      TX := MinotaurPoint.X;
      TY := MinotaurPoint.Y;
       if not FindColorTolerance(X, Y, 49236, MinotaurPoint.X-50, MinotaurPoint.Y-50, MinotaurPoint.X+50, MinotaurPoint.Y+50, 15) then
       {if not FindColorTolerance(X, Y, 655809, MinotaurPoint.X-50, MinotaurPoint.Y-50, MinotaurPoint.X+50, MinotaurPoint.Y+50, 15) then}
      begin
      MMouse(TX, TY, 0, 0);
      Wait(100+random(50));
       if IsUpText('inot') then
        begin
        GetMousePos(X, Y);
        case RandomRange(1, 10) of

        1..9:
        begin
        Wait(250+random(75));
        if IsUpText('inot') then
        begin
        Mouse(X, Y, 0, 0, False);
        Wait(100+random(50));
        if ChooseOption('ttac') then
        begin
        Result:=True;
        F := 0;
        Exit;
        end;
        end;
        end;

        10: Wait(RandomRange(100, 3000));

     end;
    end;
    end;
    end;
    Result:=False;
    end;


    function FindAttackedMinotaur : Boolean;
    var
     TX, TY, I : Integer;
     Points : TPointArray;
     Minotaur2D : T2DPointArray;
     MinotaurPoint : TPoint;
    begin
     X := MSCX;
     Y := MSCY;
     FindColorsSpiralTolerance(X, Y, Points, 10923694, MSX1, MSY1, MSX2, MSY2, 5);
     if Length(Points)=0 then begin Result:=False; Exit; end;
     Minotaur2D := TPAToATPAEx(Points, 10, 10);
     for I := 0 to Length(Minotaur2D)-1 do
     begin
     if not LoggedIn then begin Result:=True; Exit; end;
      MinotaurPoint := MiddleTPA(Minotaur2D[i]);
      TX := MinotaurPoint.X;
      TY := MinotaurPoint.Y;
      begin
      MMouse(TX, TY, 0, 0);
      Wait(100+random(50));
       if IsUpText('inot') then
        begin
        GetMousePos(X, Y);
        case RandomRange(1, 10) of

        1..9:
        begin
        Wait(250+random(75));
        if IsUpText('inot') then
        begin
        Mouse(X, Y, 0, 0, False);
        Wait(100+random(50));
        if ChooseOption('ttac') then
        begin
        Result:=True;
        F := 0;
        Exit;
        end;
        end;
        end;

        10: Wait(RandomRange(100, 2000));

     end;
    end;
    end;
    end;
    Result:=False;
    end;

    procedure TakeTheBreak;
    begin
    BreakFor := 0;
    if SmallBreaks then
     if(TimeFromMark(BreakTime)>BreakTime)and(Players[CurrentPlayer].Active=True)and(LoggedIn)then
      begin
      while InFight do
      begin
      HealThySelf;
      Wait(300);
      FindNormalRandoms;
      Wait(300);
      end;
       while LoggedIn do
        begin
        LogOut;
        Wait(500);
        FindNormalRandoms;
        Wait(500);
        end;
        Breaking := True;
        BreakFor := RandomRange(60*1000*1, 60*1000*7);
        while not LoggedIn do begin
         LogInPlayer;
         Wait(5000+random(5000));
         end;
         Breaking := False;
        if SmallBreaks and LoggedIn then
    begin
    BreakTime := RandomRange(60*1000*9, 60*1000*18);
    MarkTime(BreakMark);
    end;
    end;
    end;

    procedure SetupFighting;
    begin
    Retaliate(True);
     case SkillToTrain of
     'str': SetFightMode(2);
     'att': SetFightMode(1);
     'def': SetFightMode(4);
     end;
     case SkillToTrain of
     'str': WasExp := GetXP('strength');
     'att': WasExp := GetXP('attack');
     'def': WasExp := GetXP('defence');
     end;
     MarkTime(ExpMark);
    end;


    begin
     Wait(4000+random(2000));
        ClearDebug;
        SetUpSRL;
        DeclarePlayers;
        DeclareBanFactor;
        DeclareMSpeed;
        if not LoggedIn then LogInPlayer;
        if SmallBreaks and LoggedIn then
        begin
          BreakTime := RandomRange(60*1000*9, 60*1000*18);
          MarkTime(BreakMark);
        end;
        SetupFighting;
        repeat
          repeat
            TakeTheBreak;
            HealThyself;
            if FindNonAttackedMinotaur then
            begin
              Wait(RandomRange(AttackingDelayMin, AttackingDelayMax))
            end else
            if FindNonAttackedMinotaur then
            begin
              Wait(RandomRange(AttackingDelayMin, AttackingDelayMax))
            end else
            repeat
              if not FindAttackedMinotaur then
              begin
                KeyDown(VK_Right);
                Wait(500+Random(270));
                KeyUp(VK_Right);
                Wait(400+random(300));
                F := F + 1;
                if F>10 then
                begin
                  LogOut;
                  Players[CurrentPlayer].Active:=False;
                end;
                end else Exit;
                until(F>10)or(Players[CurrentPlayer].Active=False);
                F := 0;
              AntiBan_RegularHuman;
              case RandomRange(1, 5) of
                1..4: Wait(1);
                   5: DeclareMSpeed;
              end;
              Report;
              FindNormalRandoms;
            until(Players[CurrentPlayer].Active=False);
            LogOut;
            NextPlayer(False);
            SetupFighting;
        until(NoActivePlayers);
    end.
    Woot woot.

  2. #2
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    I didn't really look at the script, but SRL has trouble reading RS texts sometimes now so if your script depends on either a set level or exp or hp then that's probably what is messing up.

  3. #3
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    I didn't really look at the script, but SRL has trouble reading RS texts sometimes now so if your script depends on either a set level or exp or hp then that's probably what is messing up.
    Yes, I've heard of this many times. I took this part out of my scripts. If you're looking for a way to determine how much exp a player has gained, I would suggested multiplying the exp gained from one Minotaur by how many you've killed.

  4. #4
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    add writeln's throughout the script to find out where it's logging out, it'll take 2 minutes at most to add it all throughout the script, it can be as simple as writeln('1'); writeln('2'); and so on, so you know where it's logging out, then you can determine what caused it to logout, by narrowing it down by a lot, depending on how spaced the writeln's are.

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
  •