Results 1 to 8 of 8

Thread: infight(extra)

  1. #1
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default infight(extra)

    i don't know how the in fight mode now works, but sometimes it thinks it is in fight but it actually isn't
    so, this script looks if the bar above the head, is +/- equal to its actual health, so when there is an other bar from someone else, he won't see it as yours.
    SCAR Code:
    // this script will see if you are really in fight.
    program infight;
    {.include srl/srl.scar}

    Function barfight  :Boolean;

    var
      main: TDTMPointDef;
      sub: Array of TDTMPointDef;
      bar: TDTM;
      x,y,bl,bar2:Integer;
      pro,red,green,x1,x2,y1,y2: integer;
    begin
      green := 65280;
      red   := 255;
      x1    := 225;
      x2    := 290;
      y1    := 135;
      y2    := 177;

      pro := ((GetSkillInfo('hitpoints',true)*100)/(GetSkillInfo('hitpoints',false)))*29/100;
      bl := red;
      if(pro = 29)then
      bl:=green;
      SetArrayLength(sub, 3);

      main.x      :=  10;
      main.y      :=  10;
      main.areasize  :=  1;
      main.areashape  :=  0;
      main.color  :=  green;
      main.tolerance  :=  3;

      sub[0].x      :=  10+pro-1;
      sub[0].y      :=  10;
      sub[0].areasize  :=  1;
      sub[0].areashape  :=  0;
      sub[0].color  :=  green;
      sub[0].tolerance  :=  3;
     
      sub[1].x      :=  10+pro;
      sub[1].y      :=  10;
      sub[1].areasize  :=  1;
      sub[1].areashape  :=  0;
      sub[1].color  :=  bl;
      sub[1].tolerance  :=  3;

      sub[2].x      :=  10+29-1;
      sub[2].y      :=  10;
      sub[2].areasize  :=  1;
      sub[2].areashape  :=  0;
      sub[2].color  :=  bl;
      sub[2].tolerance  :=  3;

      bar.MainPoint  :=  main;
      bar.SubPoints  :=  sub;
      bar2  :=  AddDTM(bar);

      if(FindDTM(bar2, x, y, x1,y1,x2,y2)) Then
        begin
        writeln('in fight');
        Result:= True;
        end else
        writeln('not in fight');
        Result:= False
        end;

     begin
    repeat
    wait(200);
    barfight;
    until(false);
     end.
    one function now.
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

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

    Default

    Your standards were all messed up at the bottom, other then that, if it works, then nice job!

    SCAR Code:
    // this script will see if you are really in fight.
    program infight;
    {.include srl/srl.scar}
    const
    green = 65280;
    red   = 255;
    x1    = 225;
    x2    = 278;
    y1    = 135;
    y2    = 177;
    var
    x,y,bl:Integer;
    pro: integer;
     
     
     
    Function tet  :Integer;
    var
      main: TDTMPointDef;
      sub: Array of TDTMPointDef;
      bar: TDTM;
    begin
     
      pro := ((GetSkillInfo('hitpoints',true)*100)/(GetSkillInfo('hitpoints',false)))*29/100;
      bl := red;
      if(pro = 29)then
      bl:=green;
      SetArrayLength(sub, 2);
     
      main.x      :=  10;
      main.y      :=  10;
      main.areasize  :=  1;
      main.areashape  :=  0;
      main.color  :=  green;
      main.tolerance  :=  3;
     
      sub[0].x      :=  10+pro-1;
      sub[0].y      :=  10;
      sub[0].areasize  :=  1;
      sub[0].areashape  :=  0;
      sub[0].color  :=  green;
      sub[0].tolerance  :=  3;
     
      sub[1].x      :=  10+29-1;
      sub[1].y      :=  10;
      sub[1].areasize  :=  1;
      sub[1].areashape  :=  0;
      sub[1].color  :=  bl;
      sub[1].tolerance  :=  3;
     
     
      bar.MainPoint  :=  main;
      bar.SubPoints  :=  sub;
      Result  :=  AddDTM(bar);
    end;
     
    procedure findbar;
    begin
      if(FindDTM(tet, x, y, x1,y1,x2,y2)) Then
      begin
        writeln('in fight');
      end else
      writeln('not in fight');
    end;
     
    begin
      repeat
       writeln('');
       wait(200);
       findbar;
      until(false);
    end.

  3. #3
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    make it one function?

  4. #4
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok, doing it now
    //done
    if you are with poeple that have the same health% it doen't work.
    i jus saw some little thing that must be fixed
    now fixing it.
    //done
    the bug was:
    when your healt is low it searches for a lower green level but somoene with more health is also in that green levl, but it now also looks to the red level, if you know what i mean:P

    it only needs to be in the stat tab:S how to take the health from the map?
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

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

    Default

    This one is made by EvilChicken:
    SCAR Code:
    //InCloseCombat by EvilChicken
    function InCloseCombat: Boolean;
    var
      G, R: TPointArray;
    begin
      FindColorsTolerance(G, 65280, 233, 134, 282, 172, 0);
      FindColorsTolerance(R, 255, 233, 134, 282, 172, 0);
      Result := High(CombineTPA(G, R)) > 10;
    end;

    Your function shows that u arnt a noob at all, but if you already don't know about TPAs (TPointArray) i suggest you to read This tutorial. TPAs are all you need if you want to find wheter your in fight or not.
    I made one function too to find if your in fight, haha, it was like 40 lines long but had exactly same idea than chickens InCloseCombat

    EDIT: Btw, if this helps at all, in my Guardkiller i check if orange or yellow color is found from the box which shows your current hp in numbers (the heart next to the map)

  6. #6
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Here's one should do same thing:

    SCAR Code:
    function InFight2: Boolean;
    var
      Hp: Integer;
      G: TPointArray;
    begin
      FindColorsTolerance(G, 65280, 233, 134, 282, 172, 0);
      Hp := Length(G)/150*100;
      Result := InRange(HPPercent, Hp-7, Hp+7);
    end;
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  7. #7
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Narcle shortened it surely .

  8. #8
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hppercent didn't work for me:s
    well.. thats alot shorter
    //edit
    @marpis
    i read the tut... kinda easy, but very usefull
    hmm, i just don't know where to use it in this script
    @narcle
    i may be wrong, but with your function it only looks for the green so if it finds anough green it returns true, with mine it also watches the red.
    so when there are 2 bars of live under eachother, the one can expand the green of the above, so it thinks to see anoug green.(i think)
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Make some extra money here.
    By georgemartin in forum NOTA
    Replies: 0
    Last Post: 02-21-2009, 10:46 AM
  2. Extra Extra!
    By lakerzz8 in forum Blogs and Writing
    Replies: 0
    Last Post: 04-25-2008, 10:46 PM
  3. Extra Accounts
    By muna580 in forum RuneScape News and General
    Replies: 2
    Last Post: 11-26-2006, 12:11 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
  •