Results 1 to 12 of 12

Thread: Autofighter help

  1. #1
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Autofighter help

    Im tweeking my autofighter so it can wait till the fight is over. I found the Infight; Command but i want it to keep fighting if it returns true and stop fighting if it returns false. But i cant get it to recognize if its true or false. And i need a eating procedure, i didn't find it in the manual,maybe i didn't look hard. Any help or tips would be great.

    Script=
    Code:
    program LRK;
    {.include srl/srl.scar}
    
    
    Var
    x,y :integer;
    const
    mousecolor= 4013378;
    
    
    Procedure clickkiller;
    begin
    if FindObj(x, y, 'ttack', mousecolor, 35) then
    mouse(x,y,3,3,false);
    Chooseoption('ttack')
    boredhuman;
    randommovement;
    wait(7000);
    if(infight=true)then
    repeat
    boredhuman;
    randommovement;
    wait(7000);
    until(infight=false)
    end;
    
    procedure foodeat;
    begin
    end;
    
    procedure proggy;
    begin
    end;
    
    begin;
    setupsrl;
    cleardebug;
    activateclient;
    repeat
    clickkiller;
    until(false)
    end.
    Its not finished and i don't intend it to be anytime soon, but this is sorta like a alpha-ish type of work, im testing it right now one by one.

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

    Default

    I don't think there is an eating procedure, but I can make one for you if you want, just tell me which foods to do, and for the fighting, change it from:

    Code:
    Procedure clickkiller;
    begin
    if FindObj(x, y, 'ttack', mousecolor, 35) then
    mouse(x,y,3,3,false);
    Chooseoption('ttack')
    boredhuman;
    randommovement;
    wait(7000);
    if(infight=true)then
    repeat
    boredhuman;
    randommovement;
    wait(7000);
    until(infight=false)
    end;
    to:

    Code:
    Procedure clickkiller;
    begin
      if FindObj(x, y, 'ttack', mousecolor, 35) then
      begin
        mouse(x,y,3,3,false);
        Chooseoption('ttack')
        boredhuman;
        randommovement;
        wait(7000);
        if(infight=true)then
        begin
          repeat
            boredhuman;
            randommovement;
            wait(7000);
          until(infight=false)
        end;
      end;
    end;
    that should fix it, after a if then statement, you need to put a being and end if you want it to do more then one code

    so it'd be

    Code:
    if(condition) then
    begin
      code;
      code;
      code;
    end;
    or

    Code:
    if(condition) then
      code;
    code;
    code;
    I hope you can understand that, if not PM me for more help, also, let me know bout that eating. Or if you want help making an eating function/procedure.
    Last edited by Baked0420; 08-14-2009 at 11:16 AM.

  3. #3
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    is that gonna compile? I just put the =true to see if it worked and it didnt.I wanted to know how would the procedure know if it is true or false and use it to keep waiting. thanks

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

    Default

    I don't know if it'd compile, I just fixed the standards and added begins/ends where they needed to go, thinking you had it pretty much right, because if(infight=true)then should work. It should see if you're in a fight that way.


    EDIT: duh, I'm stupid, don't do if(infight=true)then, just do if(infight)then, sorry, I wasn't thinking 100%

  5. #5
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    if(This)then

    That's the same as..

    SCAR Code:
    if(This = True)then

    Because that's how SCAR does things.

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

    Default

    yea, but usually people just do if(this)then, the =true isn't needed, and he said it's not working with =true, so if it isn't, then just take it out, it's not needed.

  7. #7
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Baked0420 View Post
    yea, but usually people just do if(this)then, the =true isn't needed, and he said it's not working with =true, so if it isn't, then just take it out, it's not needed.
    That won't break it.

  8. #8
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Eat Food
    1. Have food in your inventory
    2. Take a screenshot (Print screen, Prt Scr)
    3. In SCAR top menu, go to Tools -> Picture to String
    4. Hit the 'Paste' button. Search your food there, and select the area you want to be searched. Take only a small area to save memory and prevent lag
    5. Hit OK
    6. Look at SCAR debug box. Its full of strange code. It is the bitmap we just took in a text format. Now we have the bitmap to look for, lets do the procedure!


    SCAR Code:
    procedure EatFood;
    var
      FoodBMP: integer; // Declare a variable for the food. Must be integer!
      x, y: integer; // We need these too
    begin
      // Copy this from Debug box
      FoodBMP := BitmapFromString(12, 10, 'beNoBaAGX/jg0e2lbeWNWf' +
           '2pZeWRTfGlabl5OY1hGWVE+ZFlHZVpIXFBAUEQ0eGhZemdZd2RTcF' +
           'tKaVhIdGRUbmFQbGFPbWJQZltJW1A+UEQ0d2FWf2NYgmRZjG5jdVt' +
           'KfmlWc2dRdGlVaVxLc2ZWZVhIVUg4eWJUknZqfWBQhmtagmhZgWxb' +
           'ZFQ9Z1tFYVZAHxcEMicVRzstzKadv5SNjmZcd1FGf11TdVdMalVCb' +
           'FtJZllIXVFBXU9CW01ArIZ9vpOMzKCXzaKZvJaLclJFdlxLb1xLYV' +
           'FCYVNGXU9EWEo/tIeCr356w5CMk2JdkmdgtpGIeFpPYko+aFdNXU9' +
           'GZ1lQV0lArYJ8vo2JqXhzu4qFjF9ZkWtiqYl+d1xRY1FDZlVLUUU5' +
           'XlFJrIeBoXVyrIB9q398tI2IsZCJrpOMlYF6WklBWElCXE9HSz42r' +
           'ISCrYGAq3+ApHh5qoF/soyLooWBZ05KWUdDV0hDTEE9Q/bVkzs=');
      GameTab(tab_Inv); // Obviously go to inventory tab
      wait(100+random(20)); // Wait, just in case of a lagspike
      // It will search FoodBMP in area [MIX1, MIY1, MIX2, MIY2] with bitmaptolerance of 20.
      // If found, it will save the cords to x, y. Tolerance 20 is ok, don't care about that. :)
      if FindBitmapTolerance(FoodBMP, x, y, MIX1, MIY1, MIX2, MIY2, 20) then
      begin
        Mouse(x, y, 2, 2, true); // leftclick food
        writeln('Ate food successfully!');
        wait(1500+random(200));
      end;
    end;

    EDIT: Hah, this came out so good I think I post this to tutorial island ^^
    Last edited by marpis; 08-14-2009 at 06:04 PM.

  9. #9
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks alot Marpis, Ian and baked. This will help me alot.

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

    Default

    no problem, and you said "Its not finished and i don't intend it to be anytime soon..." lol then you send it in as an app, but Marpis, you never told him about freeing the bitmap.

  11. #11
    Join Date
    May 2008
    Location
    Oregon, USA
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Its ok for a first script... don't test that on your main else you will get banned... For the waiting you can make it do wait(until not InFight);-think that works or you can go and put this in there:

    repeat
    wait(1000+random(999));
    Until(not infight);

  12. #12
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Im a smart scripter and i made my own accounts for scripting. I test on those, i run it on my scripting acount and it doesn't look detectable.

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
  •