Results 1 to 2 of 2

Thread: Colour Picking

  1. #1
    Join Date
    Nov 2006
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Colour Picking

    o.k so im making an autocolour and it is going to be multi-player so i decided the user would pick a base colour then i would program the script to find that colour and then check if the monster was already there with danknesses findfightat. then the script would move the mouse to that location and check for uptext 'attack ' + themonstersname this is what i came up with.

    SCAR Code:
    procedure extrasetup;

    var temp : Integer;

    begin
    if(findcolortolerance(x,y,Colours[CurrentPlayer].begincolour,MSX1,MSY1,MSX2,MSY2,6)) then
    begin
     if(not InFightAt(x,y))then
     begin
      writeln('not in fight');
      mmouse(x,y,2,2);
      if(istextat2(9,9,'Attack ' + Colours[CurrentPlayer].monster,100))then
      begin
       writeln('found uptext');
       Colours[CurrentPlayer].colour1 := getcolor(x,y);
       Colours[CurrentPlayer].colour2 := getcolor(x + 5,y + 5);
       temp := Colours[CurrentPlayer].colour1 - Colours[CurrentPlayer].colour2;
      end;
     end;
    end;

    if(not Colours[CurrentPlayer].colour1 = 0)then
    begin
     if(temp <= 2000000)then
     begin
      writeln('Colour 1: ' + inttostr(Colours[CurrentPlayer].colour1));
      writeln('Colour 2: ' + inttostr(Colours[CurrentPlayer].colour2));
      Players[Currentplayer].loc := 'Ready';
     end;
    end;


    wait(random(1000));
    end;

    the InFightAt i refer to is this one by either dankness or fawki:

    SCAR Code:
    Function InFightAt(x, y: Integer):Boolean;
    var
      dx, dy: Integer;
    begin
     if ( FindColor(dx, dy, GreenStatusColor, x - 20, y - 10, x + 20, y + 10) or
        FindColor(dx, dy, RedStatusColor, x - 20, y - 10, x + 20, y + 10)   or
        FindColor(dx, dy, MissedColor, x - 20, y - 10, x + 20, y + 10)   or
        FindColor(dx, dy, HitColor, x - 20, y - 10, x + 20, y + 10) ) then
        Result:=True;

    end;

    with the help of writelns i have managed to debug the program down to this bit
    SCAR Code:
    if(not Colours[CurrentPlayer].colour1 = 0)then
    begin
     if(temp <= 2000000)then
     begin
      writeln('Colour 1: ' + inttostr(Colours[CurrentPlayer].colour1));
      writeln('Colour 2: ' + inttostr(Colours[CurrentPlayer].colour2));
      Players[Currentplayer].loc := 'Ready';
     end;
    end;

    hopefully some of you wise scripting gods can help me.

  2. #2
    Join Date
    Nov 2006
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    o.k ill just remove the temp bit perhaps ill add that at a later date.

    EDIT: just fixed it with this
    Code:
    function SimilarColors(col1, col2, tolerance: integer): Boolean - Function to test weather two colors are within tolerance range. If they are within range, it returns true, if not false.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. RadialWalk colour?
    By StrikerX in forum OSR Help
    Replies: 8
    Last Post: 04-22-2008, 10:47 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
  •