Results 1 to 5 of 5

Thread: How to do this?

  1. #1
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How to do this?

    Well im trying to make a function that will find a cow and then call a function called KillCow and if that works call a function called PickUpCow
    so it would be like
    SCAR Code:
    Function FindCow:Boolean;
    Begin
      SetColour;
        If Not (FindColorSpiralTolerance(x,y,Cow1,msx1,msy1,msx2,msy2,25)) Then
    //4 more colours 1 though 5
        Else If KillCow Then PickUpCow;
    But how would i get that to work with all 5 colours?

    So far i have
    SCAR Code:
    Function FindCow:Boolean;
    Begin
      SetColour;
        If Not (FindColorSpiralTolerance(x,y,Cow1,msx1,msy1,msx2,msy2,25)) Then
          If Not (FindColorSpiralTolerance(x,y,Cow2,msx1,msy1,msx2,msy2,25)) Then
            If Not (FindColorSpiralTolerance(x,y,Cow3,msx1,msy1,msx2,msy2,25)) Then
              If Not (FindColorSpiralTolerance(x,y,Cow4,msx1,msy1,msx2,msy2,25)) Then
                If Not (FindColorSpiralTolerance(x,y,Cow5,msx1,msy1,msx2,msy2,25)) Then
                  Result := False
                Else KillCow
              Else KillCow
            Else KillCow
          Else KillCow
        Else KillCow
    End;
    Thanks
    ~Rya
    I see Now, says the blind man

  2. #2
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If I understand what your asking you could do
    SCAR Code:
    function findCow: boolean;
    var
      x, y, i: integer;
      cowColor := TIntegerArray;

    begin
      cowColor := [cow1, cow2, cow3, cow4, cow5];
      for i := 0 to high(cowColor) do
        if(findColorSprialTolerance(x, y, cowColor[i], MSx1, MSy1, MSx2, MSy2, 25))then
        begin
          result := true;
          killCow;
          break;  
        end;
    end;

    Or if you want to go a step further and throw it all into one function
    SCAR Code:
    function findAndKillCow: boolean;
    var
      x, y, i: integer;
      cowColor := TIntegerArray;

    begin
      cowColor := [cow1, cow2, cow3, cow4, cow5];
      for i := 0 to high(cowColor) do
        if(findColorSprialTolerance(x, y, cowColor[i], MSx1, MSy1, MSx2, MSy2, 25))then
        begin
          MMouse(x, y, 3, 3);
          if(IsUpText('ow'))then
          begin
            GetMousePos(x, y);
            Mouse(x, y, 0, 0, false);
            if(ChooseOption('ill'))then
            begin
              result := true;
              break;
            end;
          end;
        end else Exit;
    end;

    EDIT: Those should work haven't used SCAR in a while :/
    Last edited by All that is man; 12-19-2009 at 07:06 PM.

  3. #3
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by All that is man View Post
    If I understand what your asking you could do
    SCAR Code:
    function findCow: boolean;
    var
      x, y, i: integer;
      cowColor := TIntegerArray;

    begin
      cowColor := [cow1, cow2, cow3, cow4, cow5];
      for i := 0 to high(cowColor) do
        if(findColorSprialTolerance(x, y, cowColor[i], MSx1, MSy1, MSx2, MSy2, 25))then
        begin
          result := true;
          killCow;
          break;  
        end;
    end;

    Or if you want to go a step further and throw it all into one function
    SCAR Code:
    function findAndKillCow: boolean;
    var
      x, y, i: integer;
      cowColor := TIntegerArray;

    begin
      cowColor := [cow1, cow2, cow3, cow4, cow5];
      for i := 0 to high(cowColor) do
        if(findColorSprialTolerance(x, y, cowColor[i], MSx1, MSy1, MSx2, MSy2, 25))then
        begin
          MMouse(x, y, 3, 3);
          if(IsUpText('ow'))then
          begin
            GetMousePos(x, y);
            Mouse(x, y, 0, 0, false);
            if(ChooseOption('ill'))then
            begin
              result := true;
              break;
            end;
          end;
        end else Exit;
    end;

    EDIT: Those should work haven't used SCAR in a while :/
    Thanks
    I see Now, says the blind man

  4. #4
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I suggest you read a tutorial on arrays, as they are very useful ive got one for TPointArrays in my sig, Coh3n's gigantic tutorial has a lot on advanced arrays (TIntegerArray is there, as was used here)
    http://www.villavu.com/forum/showthread.php?t=49089 (coh3ns)
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  5. #5
    Join Date
    Mar 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    idk i wish i could help

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
  •