Results 1 to 22 of 22

Thread: How do I use InFight

  1. #1
    Join Date
    Nov 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How do I use InFight

    Ok...I'm not sure how to use infight with an if command...i mean...do I just go

    If Infight Then
    begin


    code here

    end

    any help would be much appreciated.

  2. #2
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, just like that.

    If InFight then OutFight;

    It is just a boolean, if your charachter is in a fight, it returns true. The example above; If you char is in a fight, it waits until the fight is over.

  3. #3
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by EvilChicken View Post
    Yeah, just like that.

    If InFight then OutFight;

    It is just a boolean, if your charachter is in a fight, it returns true. The example above; If you char is in a fight, it waits until the fight is over.
    wrong...-_-

    infight check if your infight or not and outfigth checks if your out fight or not

    SCAR Code:
    if findfight then runawaydirection('N')
    Wait(10000+random(5000));
    RunBack;
    ~Hermen

  4. #4
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by hermpie View Post
    wrong...-_-

    infight check if your infight or not and outfigth checks if your out fight or not

    SCAR Code:
    if findfight then runawaydirection('N')
    Wait(10000+random(5000));
    RunBack;
    What the fuck? Atleast read my whole post before stating its wrong.

    I said the exact same thing you say! Ahh..

  5. #5
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by EvilChicken View Post
    What the fuck? Atleast read my whole post before stating its wrong.

    I said the exact same thing you say! Ahh..
    if you read it again and look in the SRL include, you will see
    ~Hermen

  6. #6
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Stop giving wrong answers, hermpie. If YOU look in the SRL include, you'll see that InFight returns true if you're in a fight and OutFight checks if you're in a fight, and if so, waits until you're not in a fight.

    EvilChicken was right and hermpie needs to stop posting incorrect answers.
    :-)

  7. #7
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Metho D View Post
    Stop giving wrong answers, hermpie. If YOU look in the SRL include, you'll see that InFight returns true if you're in a fight and OutFight checks if you're in a fight, and if so, waits until you're not in a fight.

    EvilChicken was right and hermpie needs to stop posting incorrect answers.
    Thanks so much!

    I was .. Kinda moved by what you wrote, you see; I've had a terrble day. And now, annoying people try to play smart and proove me wrong when all I want is to help, since I've been in the same situation one day, (as we all have) and you just brightenned up my day a little, thanks a huge lot.

  8. #8
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I usually use FindFight, I don't know what difference it makes using FindFight or InFight.

    If you're making a Skill-Script (Woodcutting, Mining, Smithing, etc.) then you should use RunAwayDirection and RunBack, but if you're making an autofighter, then use EvilChickens idea.

    -Knives

  9. #9
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by King of Knives View Post
    I usually use FindFight, I don't know what difference it makes using FindFight or InFight.

    If you're making a Skill-Script (Woodcutting, Mining, Smithing, etc.) then you should use RunAwayDirection and RunBack, but if you're making an autofighter, then use EvilChickens idea.

    -Knives
    I guess the only difference is that Infight is a boolean..
    (If (not(InFight) then AttackThoseMonsters));


    E: Wait - Isnt FindFight a Boolean as well?

  10. #10
    Join Date
    Nov 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok...so they are all booleans and I can use them like so...

    if infight then
    begin
    code...

    end;

    what about repeats?

    repeat

    code

    until(infight=false)

    how would I do that one?

  11. #11
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea it is. Why are you using that many paranthesises?
    SCAR Code:
    (If (not(InFight) then AttackThoseMonsters));
    could be
    SCAR Code:
    if not InFight then AttackThoseMonster

    Much easier to understand.

    and yea, FindFight is a boolean aswell, but what it does is:
    Checks for red and green HP-Bar color above your chars head. Then it checks GameTab(2) (statistics screen), and if your HP is below your Maxhp then it will result true.

    EDIT: To post above: Yea, that would be an idea. It will repeat your code until you aren't in a fight.

    -Knives

  12. #12
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Mistagnerd View Post
    ok...so they are all booleans and I can use them like so...

    if infight then
    begin
    code...

    end;

    what about repeats?

    repeat

    code

    until(infight=false)

    how would I do that one?

    Well - give me an example of what you want to use it for..?

  13. #13
    Join Date
    Nov 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I just want to know all of its capabilities...before I write scripts I want to know everything and their limits.

    For example say i'm fighting....bears...

    I want something like this (Just wrote it off the top of my head btw)...

    *i'm a noob to scripting..so if this script is bad plz dont' make fun of me*
    SCAR Code:
    program bearkiller;

    {.include SRL/SRL.scar}

    Procedure FindBear;
    Begin
      repeat
        wait(1000)
        If FindObj(x, y, 'ear', Bearcolor, 10) then
        begin
             exit;
        end;
      until false
    end;
    Procedure AtkBear;
    Begin
      Mouse(x, y, 0, 0, false);
      ChooseOption('Attack');
    end;

    Begin
      setupsrl;
      repeat
        wait(5000)
        FindBear;
        AtkBear;
        repeat
          wait(1000)
        until(infight=false)
      until(false)
    end.

  14. #14
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Program LeetbearKiller;
    {.include SRL/SRL.scar}
    {.include srl/srl/skill/fighting.scar}


    // THE "FIGHTING.scar" NEEDS TO BE ADDED BECAUSE IT IS A SPECIAL INCLUDE FOR FIGHTING.
    // Or else, the InFight and other fighting commands wouldn't work.

    Var
    X, Y: Integer; // Youorgot to declare variables.

    Const
    Bearcolor = 1000; // The color of the bear stays the same, right?

    Procedure FindBear;
    Begin
    if not LoggedIn then exit; // A couple of failsafes..
      if InFight then exit;
    repeat
     If FindObj(x, y, 'ear', Bearcolor, 5) then // Too high tolerance. 5 should do it. Maybe even less.
    Mouse(x, y, 0, 0, false);
      ChooseOption('Attack');
    Wait(2000) // Waits 2 secons, 2000 milliseconds.
    OutFight; // If, and only if it is in a fight then wait until the fight is over.
      until false;
    end;

    Begin
      setupsrl;
    FindBear;
    end.

    Yours wouldn't work, look at the changes I've made. Yours would just repeat finding bears - Try this, and learn from the changes. And, also, you could try to look at my script for more, its a fighting script, so its based on the same. Althrough it isn't at its greatest now, I'm working on an unreleased version of it. As my sig states.

    Try reading some guides at the tut isnland, they pwn. Thats how I started. And you also need loopbraks, failsafes and antirandoms. But neat start

  15. #15
    Join Date
    Nov 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    wow...thnx...I knew most of the stuff but didn't think it was all necessary...the ones tips that really helped me was the tolerance issue...and the Outfight..It makes sense now.

    Outfight will detect if the user is currently fighting..and if return is true, then will wait until the fight is completed.

    THNX!

  16. #16
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Remember to look at my script, I believe it got some tuff that could turn out to be useful for you there. And remember to rep if you found my help helpful xD!

  17. #17
    Join Date
    Nov 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok...I tried to make a chicken killing script based on what you've shown me...but the Outfight doesn't seem to be working...It just attacks another chicken right after the waits...am I doing something wrong?

    SCAR Code:
    program ChickenMaster;
    {.include srl/srl.scar}
    {.include SRL\SRL\Skill\Fighting.scar}

    Const
         CocksComb=858751;
         Healthbar=65280;
         Feathers=12369093;
    var
       x,y: integer;

    Procedure FindChicken;
    Begin
         FindObj(x,y,'hicken',CocksComb,10);
         Mouse(x, y, 0, 0, false);
         wait(500)
         ChooseOption('Attack');
    end;

    Begin
         SetUpSRL;
         if not LoggedIn then exit;
         Repeat
               Wait(2000)
               FindChicken;
               Wait(3000);
               OutFight;
         Until false
    end.

  18. #18
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Nononono, like this:

    SCAR Code:
    program ChickenMaster;
    {.include srl/srl.scar}
    {.include SRL\SRL\Skill\Fighting.scar}

    Const
         CocksComb=858751; // Chicken color, I suppose?
       //  Healthbar=65280; Why this?
       //  Feathers=12369093; No need, as it doesnt pickup those.
    var
       x,y: integer;

    Procedure FindChicken;
    Begin
         FindObj(x,y,'hicken',CocksComb,10);
         Mouse(x, y, 0, 0, false);
         wait(50 + random (50)); // 50, not 500.
         ChooseOption('Attack');
         Wait(800 + random (200));
         OutFight;
    end;

    Begin
         SetUpSRL;
         if not LoggedIn then exit;
         Repeat
          //   Wait(2000) No need.
               FindChicken;
           //    Wait(3000); NO
           //    OutFight; Need.
         Until false;
    end.

    Glad to see you're learning quick.

  19. #19
    Join Date
    Nov 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hey! Thnx! I just got back. But there are a few problems. After attacking a chicken, it just goes out and attacks another...It doesn't wait for the first chicken to die. Should the Outfight wait until the first fight is over?

    As far as the feathers and healthbar are concerned...I wanted to later make it so it'll pick up feathers. I also wanted to get the users health, but I forgot I could just go to Gametab, so that'll be gone too...lol!

  20. #20
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Mistagnerd View Post
    Hey! Thnx! I just got back. But there are a few problems. After attacking a chicken, it just goes out and attacks another...It doesn't wait for the first chicken to die. Should the Outfight wait until the first fight is over?

    As far as the feathers and healthbar are concerned...I wanted to later make it so it'll pick up feathers. I also wanted to get the users health, but I forgot I could just go to Gametab, so that'll be gone too...lol!
    User-health-thing.. Procedure called GetHP;

    All there is to it.

    (GetHP;
    If GetHP < LogOutHP then LogOut

    Fighting: So it gets to the point where the two health bars show?
    What charachter are you using? Where?


    For the feather pickup part, look at Munk's "Forefeathers". I use that script, it pwns.

  21. #21
    Join Date
    Nov 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by EvilChicken View Post
    User-health-thing.. Procedure called GetHP;

    All there is to it.

    (GetHP;
    If GetHP < LogOutHP then LogOut

    Fighting: So it gets to the point where the two health bars show?
    What charachter are you using? Where?


    For the feather pickup part, look at Munk's "Forefeathers". I use that script, it pwns.
    it gets to where I am fighting the chicken...but before the chicken dies...I start attacking another.


    also..where can I find Munks "forefeathers" script?

    edit: nvrmd i found forefeathers script!

  22. #22
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Mistagnerd View Post
    it gets to where I am fighting the chicken...but before the chicken dies...I start attacking another.


    also..where can I find Munks "forefeathers" script?

    edit: nvrmd i found forefeathers script!
    Good, good. Take a look at it, and tell me what you learn.

    OMFGW00T300THPOST!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. New InFight function (using TPA)
    By marpis in forum Research & Development Lounge
    Replies: 5
    Last Post: 01-09-2009, 12:10 AM
  2. InFight not working
    By SirPa in forum OSR Help
    Replies: 20
    Last Post: 11-16-2008, 04:43 AM

Posting Permissions

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