Results 1 to 8 of 8

Thread: Crap is what I have created.

  1. #1
    Join Date
    Mar 2008
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Crap is what I have created.

    Trying to make a fighting script, just for fun, like you do.
    Anyways, got to the fighting part...and it didn't go so well. The FightNPC command works, but not how I want it to. It only attacks mobs that are within about a 1 cell distance. My pathetic attempt at creating a Find+Attack procedure failed, kinda. It works in a manner of speaking...just not well...and would be detectable I'm sure. So its really just the finding and attacking mobs thats screwing me up.

    The timer stuff works well, as does the fightmode stuff. I'm not too sure how well the random detection is, as I would never use a fight script for more than a few minutes on each character. The antiban...I don't think it does anything...ever...its just for looks. While you guys take a gander at the fighting situation I'll work on getting food implemented.

    SCAR Code:
    {------------------------------Script Info-------------------------------------|
    | ScriptName   = BubFighter                                                    |
    | Author       = Bubbinator                                                    |
    | Description  = Fights Stuff                                                  |
    | Version      = 1                                                             |
    | SRL Version  = 4.0 Rev 17                                                    |
    | SCAR Version = 3.15                                                          |
    | Date         = 7/11/08                                                       |
    |------------------------------------------------------------------------------}


    {.include SRL/SRL.scar}
    {.include SRL/SRL/Skill/Fighting.scar}

    const

         TimeToFight =5;//Minutes for each player to fight.

    var

         PlayerStart, BeginTime: Integer;
         MobColors: Array of integer;

    procedure DeclarePlayers;
    Begin

        NumberOfPlayers(2);//Change to reflect number of players.
        CurrentPlayer := 0;

        Players[0].Name :='';
        Players[0].Pass :='';
        Players[0].Nick :='';
        Players[0].Active :=True;
        Players[0].Integers[0] := ;//First Mob Color
        Players[0].Integers[1] := ;//Second Mob Color
        Players[0].Skill := 'strength'; //Stat to train
        Players[0].Strings[0] := '';//Name of mob

        Players[1].Name :='';
        Players[1].Pass :='';
        Players[1].Nick :='';
        Players[1].Active :=True;
        Players[1].Integers[0] := 0;//
        Players[1].Integers[1] := 0;//
        Players[1].Skill := 'attack'; //Stat to train
        Players[1].Strings[0] := '';//Name of mob

        {Players[2].Name :='';
        Players[2].Pass :='';
        Players[2].Nick :='';
        Players[2].Active :=True;
        Players[2].Integers[0] := 0;//
        Players[2].Integers[1] := 0;//
        Players[2].Skill := 'strength'; //Stat to train
        Players[2].Strings[0] := '';//Name of mob

        Players[3].Name :='';
        Players[3].Pass :='';
        Players[3].Nick :='';
        Players[3].Active :=True;
        Players[3].Integers[0] := 0;//
        Players[3].Integers[1] := 0;//
        Players[3].Skill := 'strength'; //Stat to train
        Players[3].Strings[0] := '';//Name of mob

        Players[4].Name :='';
        Players[4].Pass :='';
        Players[4].Nick :='';
        Players[4].Active :=True;
        Players[4].Integers[0] := 0;//
        Players[4].Integers[1] := 0;//
        Players[4].Skill := 'strength'; //Stat to train
        Players[4].Strings[0] := '';//Name of mob}


    end;

    procedure Food;

    var
      i: Integer;
     
    begin
      if(not(loggedin))then exit;
      if(HPPercent > 60) then exit;
        begin
          gametab(4);
          if (not(InvEmpty)) then
            begin
              repeat
                for i := 0 to (InvCount) do
                MouseItem(i, False);
                If IsUpText('Eat') then
                ChooseOption('Eat');
                Wait(250 + Random(300));
              until (HPPercent > 60)
            end;
        end;
    end;
             

    procedure Antiban;
    begin
      if(not(loggedin))then exit;
      begin
        case Random(4) of
          0: HoverSkill('random', false);
          1: Wait2(Random(1000), true);
          2: PickUpMouse;
          3: RandomRClick;
        end;
      end;
    end;

    procedure FightMonster;
    var
       x, y, i: Integer;
    begin
      if(not(loggedin))then exit;
      For i := 1 to 5 Do
        If FightNPC(MobColors, 5, (500 + Random(500))) then
          Break;
      {repeat
        FindObjCustom(x, y, [Players[CurrentPlayer].Strings[0]], MobColors, 5);
        MMouse(x, y, 0, 0)
        If IsUpText('ttack') then
          begin
            case Random(2) of
              0: Mouse(x, y, 3, 3, True);
              1: begin
                   Mouse(x, y, 3, 3, False);
                   ChooseOption('ttack');
                 end;
              end;
          end;
        Wait(200 + Random(300))
      until InFight}

      If InFight then
        repeat
          Wait((50) + Random(200))
          FindNormalRandoms;
          Antiban;
        until not(InFight);
        Food;
    end;

    procedure FMode;
    begin
      if(Players[CurrentPlayer].Skill='attack') then SetFightMode(1);
      if(Players[CurrentPlayer].Skill='strength') then SetFightMode(2);
      if(Players[CurrentPlayer].Skill='defence') then SetFightMode(4);
    end;

    procedure SetPlay;
    begin
      if(not(loggedin))then exit;
      SetAngle(true);
      MakeCompass('n');
      FMode;
      SetRun(True);
      MobColors := [Players[CurrentPlayer].Integers[0], Players[CurrentPlayer].Integers[1]];
      MarkTime(PlayerStart);
    end;

    procedure FLoop;
    begin
      if(not(loggedin))then LoginPlayer;
        repeat
          SetPlay;
          repeat
            FightMonster;
          until (TimeFromMark(PlayerStart)) > (TimeToFight * 60000);
          Wait((5000) + Random(1000));
          Antiban;
          FindNormalRandoms;
          If(loggedin)then Logout;
          NextPlayer(True);
          if(not(loggedin))then LoginPlayer;
        until False;
    end;

    procedure Setup;
    begin
      SetupSRL;
      DeclarePlayers;
      MarkTime(BeginTime);
      ActivateClient;
      Wait(Random(1000));
      if(not(loggedin))then LoginPlayer;
    end;


    begin
      Setup;
      repeat
        FLoop;
      until False;
    end.

    Update: The food thing, which should work...I think... Used santa's suggestion about the FightNPC as a boolean, worked wonders, thanks much. Still have the problem of little to no discrimination of mobs outside of a one cell distance, would the tolerance have any effect on that?

  2. #2
    Join Date
    Mar 2008
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you have {} around a lot of your procedure 0_o

  3. #3
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    FightNPC(MobColors, 5, (500 + Random(500)));

    FightNPC is a function that returns a boolean, no? I recommend you use it in a way that will help you to detect when it has clicked on something. Look at this:

    SCAR Code:
    For I := 1 To 5 Do
      If FightNPC(MobColors, 5, 500 + Random(500)) Then
        Break;

    That will try to click on a monster 5 times. If it clicks, then it will break from the loop and go onto the next piece of code, so it won't end up clicking on the monster 5 times before it continues.
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  4. #4
    Join Date
    Mar 2008
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by sirlaughsalot View Post
    you have {} around a lot of your procedure 0_o
    That was the crappy part that I made. The idea was to attack any mob on the screen, rather than just the closer mobs that FightNPC does. It sort of works, but its too crazy, I'll try to figure something out.

  5. #5
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Did you read anything I said?
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  6. #6
    Join Date
    Mar 2008
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Santa_Clause View Post
    Did you read anything I said?
    Yes...implemented it. I updated the first post rather than making a new one.

  7. #7
    Join Date
    Apr 2007
    Posts
    994
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I don't know if this will help you or not, but here's a procedure from my old hillgiant script. Should work in theory; tested it with barbarians.

    SCAR Code:
    function FightNPCFindMob(Color:TintegerArray; tol: integer;Uptext:TStringArray): integer;

    var
      x,y,fcolx,fcoly,ftd:integer;
      bebs:integer;
      npccolortpa,npccolortpa2:Tpointarray;

    begin
      if (not (LoggedIn)) or (FindDead) or (InFight) then Exit;
      for ftd:=0 to high(color) do
      begin
        x:=MSCX;
        y:=MSCY;
        if FindObjTPA(x, y, color[ftd], tol, -1, 15, 15, 25,Uptext)and
        not(FindColor(fcolx, fcoly, 65280, x - 20, y, x + 20, y + 80)) then
        begin
          Mouse(x,y,2,2,true);
          flag;
          wait(500 + random(200));
          if infight then
          begin
            Result:=1;
            Wait(1000+random(500));
            Exit;
          end;
        end;
      end;
      begin
        FindColorsSpiralTolerance(MMCX, MMCY,npccolorTPA, 195836, MMX1, MMY1, MMX2, MMY2,3);
        npccolortpa2:=ReArrangeandShortenArray(npccolorTPA,2);
        for bebs:=0 to high(npccolorTPA2) do
        begin
          if not(FindColorTolerance(x, y, 16711422, npccolorTPA2[bebs].x - 2, npccolorTPA2[bebs].y - 2, npccolorTPA2[bebs].x + 2,npccolorTPA2[bebs].y + 2, 5)) then
          begin
            Mouse(npccolorTPA2[bebs].x,npccolortpa2[bebs].y,3,3,true);
            Result:=2;
            FFlag(3);
            exit;
          end;
        end;
      end;
      begin
        Findcolorspie(npccolorTPA, 195836, 3, 0, 360, 0, 60, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY);
        npccolortpa2:=ReArrangeandShortenArray(npccolorTPA,2);
        if (npccolorTPA[0].x <> 0 )then
        begin
          try
            for bebs:=random(2) to high(npccolorTPA2) do
            begin
              Mouse(npccolorTPA2[bebs].x,npccolortpa2[bebs].y,3,3,true);
              Result:=3;
              FFlag(3+random(2));
              Exit;
            end;
          except
            Writeln('Wow, we must be lost or something, there are less than 1 npc dots on the minimap!');
            result:=5;
            exit;
          finally
          end;
        end else
        result:=4;
      end;
    end;

    Well, if that helps, great.
    [QUOTE]<GoF`> oh no its Raymooond
    <Raymooond> Heya
    <GoF`> is it ray or some other ray?
    <LeeLokHin> No idea
    <LeeLokHin> Raymond, what's the game you like the most?
    <Raymooond> Runescape
    <-- LeeLokHin has kicked Raymooond from #srl (Faker.)[/QUOTE]

  8. #8
    Join Date
    Mar 2008
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you for that function, it seems like it should work like a charm. Only one problem, it won't work with a TStringArray for some reason. I've used a literal string array ['att','ack'] , and declared the string from the player input and tried to use that, but everything so far comes up as a type mismatch. I'm pretty sure I have the TStringArray situation correct, but I'm not positive. Ideas?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Not quite sure if there is one created for this...
    By XxsomethingxX in forum RS3 Outdated / Broken Scripts
    Replies: 0
    Last Post: 07-17-2008, 07:52 AM
  2. Replies: 12
    Last Post: 05-28-2008, 08:52 PM
  3. Yet Another Graphical Bug Created By Home Teleport
    By Opal Tasty in forum Semi Stupid Pictures
    Replies: 5
    Last Post: 08-14-2007, 11:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •