Results 1 to 2 of 2

Thread: how to use functions? need help

  1. #1
    Join Date
    Feb 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default how to use functions? need help

    how do you use functions such as the one that im showing?
    please help thank you for your time


    {************************************************* ******************************
    function FindObjMulti(Text: String; color1, color2, color3, tolerance: Integer): Boolean;
    By:
    Description: FindsObject using three colors
    ************************************************** *****************************}

    function FindObjMulti(Text: string; color1, color2, color3, tolerance: Integer):
    Boolean;
    var
    x, y, a, c, i, x1, y1, x2, y2: Integer;
    begin
    if (FindMSColorTol(x, y, color1, tolerance)) or
    (FindMSColorTol(x, y, color2, tolerance)) or
    (FindMSColorTol(x, y, color3, tolerance)) then
    begin
    x1 := 245;
    y1 := 165;
    x2 := 277;
    y2 := 185;
    repeat
    if (not (LoggedIn)) then
    break;
    a := a + 1;
    if (a = 1) then
    c := c + 1;
    if (a = 3) then
    c := c + 1;
    for i := 1 to c do
    begin
    if (a = 1) then
    begin
    x1 := x1 + 30;
    x2 := x2 + 30;
    end;
    if (a = 2) then
    begin
    y1 := y1 - 20;
    y2 := y2 - 20;
    end;
    if (a = 3) then
    begin
    x1 := x1 - 30;
    x2 := x2 - 30;
    end;
    if (a = 4) then
    begin
    y1 := y1 + 20;
    y2 := y2 + 20;
    end;
    if (x1 = 485) and (x2 = 517) then
    x2 := x2 - 2;
    if (y1 = 325) and (y2 = 345) then
    y2 := y2 - 7;
    if (x2 > 515) then
    Break;
    if (FindColorTolerance(x, y, color1, x1, y1, x2, y2, tolerance)) or
    (FindColorTolerance(x, y, color2, x1, y1, x2, y2, tolerance)) or
    (FindColorTolerance(x, y, color3, x1, y1, x2, y2, tolerance)) then
    begin
    MMouse(x, y, 0, 0);
    if (IsUpText(Text)) then
    begin
    Result := True;
    Break;
    end;
    end;
    end;
    if (a = 4) then
    a := 0;
    until (x2 > 515) or (Result = True);
    end;
    end;

  2. #2
    Join Date
    Jun 2006
    Location
    New Zealand
    Posts
    285
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program FindAnObject;
    {.include SRL\srl.scar}

    procedure FindAnObject;
    begin
      SetupSRL;
      If(FindObjMulti('TheObjectsName', 32768, 32768, 32768, 2)) Then
      Begin
        Writeln('Found an Object');
      end;
    end;

    begin
      FindAnObject;
    end.

    The first part asks for the name of the object that shows on the top left corner, the next 3 are the colors of the object and the last is the tolerance.

    I suck at explaining...
    Huehuehuehuehue

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Functions
    By lordsaturn in forum OSR Help
    Replies: 1
    Last Post: 08-13-2007, 10:12 PM
  2. Help with some functions
    By Pinqvin in forum OSR Help
    Replies: 6
    Last Post: 03-06-2007, 01:34 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
  •