Results 1 to 16 of 16

Thread: Need some advice with getcolor command

  1. #1
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Need some advice with getcolor command

    hi, i'm currently modifing scripts to make them better and i dont like autofighters when they check hp from stats tab in like every 2 secs, it's very detectable... so i got an idea how to stop it...
    something with getcolor...

    procedure blabla;
    begin
    if getcolor(colour of the hp bar, if red color reaches to center, script will look for hp and eat if needed) then begin
    blbla;

    So i need help to get this command working somhow...

    thank you
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  2. #2
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Well you can't use 'If GetColor(whatever) then' because 'GetColor' returns an integer and the 'If ... Then' statement requires a boolean. You'll need to go 'if (GetColor(whatever) = const colour of hp bar) then ....

    For example:
    SCAR Code:
    function HalfHealth: boolean;
    begin
      if (GetColor(123, 456) = 255) then    //255 is probably not the right colour
        Result := True;
    end;

    Then when you want to check it in the main loop do this:
    SCAR Code:
    begin
      if (HalfHealth) then
      begin
        Writeln('We lost half our hp');
        EatFood;
      end;
    end;

  3. #3
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    but the health bar moves up and down when you are on top of someone, so that would screw up this procedure, though i guess, you shouldnt be in a crouded place if ur autoing...so, you could make a function out of this and have 3 options AutoHp(pk,half,safe):string;
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


  4. #4
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Well you could go if FindColor(x, y, 255, a bit above and below the normal hp bar); then go GetColor(x, y); Its a bit tricky so I suppose thats why they checked the stats instead of the health bar.

  5. #5
    Join Date
    Jun 2007
    Location
    I'm not sure...
    Posts
    581
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Couldn't you use FindColorTolerance, because you can search in a box (the up and down movement of the hp bar is solved) and it has tolerance(255 will work )
    ---------------------------------------------------------


    Pm me if you need any math functions made. Me = l0ving t3h mathz

    ---------------------------------------------------------

  6. #6
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    no the box wont work if someone is above youand you arent fighting...i would sugest having it first mmouse the the middle of the screen, and if it detects uptext of a player, then manually do it, and if not then do what u were going to do
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


  7. #7
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Its very rare that you are even standing on another player and both fighting.
    Moveing mouse to center would be more detale than checking HP alone.

    As far as i can see, there are no functions in srl that check XP without using the game tab =(.

  8. #8
    Join Date
    Jun 2007
    Location
    I'm not sure...
    Posts
    581
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You can't check xp without looking at the skills tab... Unless you count every single thing you mine/chop/fish/ect... and multiply it by the xp it gives (this isn't even about xp though, is it? I thought it was about the hp bar?)
    ---------------------------------------------------------


    Pm me if you need any math functions made. Me = l0ving t3h mathz

    ---------------------------------------------------------

  9. #9
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by rotflmfwao View Post
    You can't check xp without looking at the skills tab... Unless you count every single thing you mine/chop/fish/ect... and multiply it by the xp it gives (this isn't even about xp though, is it? I thought it was about the hp bar?)
    We are discussing ways to check the amount of hp you have left not the amount of XP you are getting.

  10. #10
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well, thank you all for posting, tryed out that getcolor command, it missed like halfs of times when hp bar is red(over centere, i was using something like
    x as 665 and y 150)
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  11. #11
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    how can it miss!?! what exactly did u use?
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


  12. #12
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    I think it would be wise to use FindColor instead of GetColor because like what is said above, the bar moves up and down as you fight. If you specify a box taller than the bar, it should compensate for that movement.

  13. #13
    Join Date
    Apr 2007
    Location
    California
    Posts
    259
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Er, unless i'm mistaken FindFight or whatever it's called in SRL checks for the color already, then checks the hp and if its less than 100% runs. The checking can be disabled though, i forget how. One sec, lemme check.

    Edit: From core/antirandoms/antirandoms.scar Checks color, then hp.
    SCAR Code:
    {*******************************************************************************
    function FindFight: Boolean;
    by: Stupid3ooo
    Description: Results True if in Fight
    *******************************************************************************}


    function FindFight: Boolean;
    var
      xf, yf: Integer;
    begin
      if (FindColor(xf, yf, 65280, 217, 129, 297, 209)) then
      begin
        if (CheckHpFirst = True) then
        begin
          GameTab(2);
          Wait(500 + Random(100));
          if (HpPercent < 100) then
          begin
            Result := True;
            WriteLn('******** FOUND FIGHTING RANDOM ********');
            WriteFileString(TheFile, '******** FOUND FIGHTING RANDOM ********' +
              Chr(13))
            TakeScreen('Found Fight');
            Fights := Fights + 1;
          end;
        end
        else
        begin
          WriteLn('******** FOUND FIGHTING RANDOM ********');
          WriteFileString(TheFile, '******** FOUND FIGHTING RANDOM ********' +
            Chr(13))
            Result := True;
          TakeScreen('Found Fight');
          Fights := Fights + 1;
        end;
        GameTab(4);
      end;
    end;

    Edit2: Ah, my bad. Talking about in autofighters, not antirandom stuff. Well you could still look the beginning of it over to get a general idea on the way it checks for the color.

  14. #14
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    FindFight goes to the Stats Tab and checks Hp from there. We are trying to find a way to check HP using the health bar.

  15. #15
    Join Date
    Apr 2007
    Location
    California
    Posts
    259
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, i understand that now. But I was trying to say that using FindColor (like in FindFight) instead of GetColor (heard that earlier) would work better. Like you said, actually

    Edit: And actually, FindFight checks color first. Then health. But yeah, you get what i mean.

  16. #16
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Im working on making an HP procedure for you right now.
    And guys, find fight only searches in a small box for HP, the entire HP box cods move around quite a bit =/.

    EDIT:
    http://www.srl-forums.com/forum/geth...et-t14927.html
    Just for you =)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. GetColor
    By FortAsh in forum OSR Help
    Replies: 5
    Last Post: 01-26-2009, 08:07 PM
  2. GetColor problem
    By rogeruk in forum OSR Help
    Replies: 2
    Last Post: 02-24-2008, 10:35 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
  •