Results 1 to 2 of 2

Thread: Finding static colors

  1. #1
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default Finding static colors

    Trying to make a simba program that will check the colors on the screen every 2 seconds, and weed out colors that have changed as to leave you only with the points that are 'static' so you can use them as base point for location ect ect. But I'm getting out of bounds error on line 12. Little help please?


    Simba Code:
    program new;

    {$i srl/srl.simba}
     var
     colourArray: TPointArray;
     width, height,w,h,i: integer;
     procedure checkForPoints;
     begin
        for w := 0 to width do
           for h := 0 to Height do
            begin
                  if((colourArray[w + (h*width)].x = getColor(w,h)) and (not colourArray[w + (h*width)].y = 0)) then
                  begin
                      writeln(inttostr(w) + ',' + inttostr(h));
                  end
                  else
                  begin
                      colourArray[w + (h*width)].y := 0;
                  end;
            end;
       wait(2000);
     end;
    procedure writePoints;
    begin
         for i := 0 to length(colourArray)-1 do
         begin
             writeln(inttostr(colourArray[i].x) + ' ' + inttostr(colourArray[i].y));
         end;
    end;

    begin
    addonTerminate('writePoints');



    repeat


    GetClientDimensions(width,Height);
       //////////////////////////
    setLength(colourArray, width*height + 1);
       for w := 0 to width do
           for h := 0 to Height-1 do
            begin
            colourArray[w + (h*width)].x := getColor(w,h);
            colourArray[w + (h*width)].y := 1;
            end;
       ///////////////////////////
    for i := 0 to 10 do
       begin
          checkForPoints;
       end;






    until(true);
    end.
    Last edited by xdarkshadowx; 01-03-2013 at 09:58 PM.
    Non-RS scripter, if you need a hand with scripting let me know. I have a decent amount of experience scripting for non-RS games.

    How to add text messaging to any script: http://villavu.com/forum/showthread....98#post1151998

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Try Iterating from 1 to High instead? Your code needs better formatting because it's complicated to read atm..
    I am Ggzz..
    Hackintosher

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
  •