Results 1 to 8 of 8

Thread: TPA Scripting Help Needed!

  1. #1
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default TPA Scripting Help Needed!

    Hey i just started to learn TPA scripting yesterday but im not quite sure if i formatted this correctly. could someone look to see if i did this correctly?

    SCAR Code:
    function FindColorObjectInvTPA(color:integer);

    var
    OC: array of Tpoint;
    Set,I,C,AR,B: integer;

    begin
      SetArrayLength(Oc,4);
      AR:=getarraylength(oc[i])
      C:=10;
      Set:=High(Oc);
      FindColorsSPiralTolerance(x,y,OC,COLOR,MIX1,MIY1,MIX2,MIY2,C);
      fo i:=0 to Set do
      begin
        if AR>=2 then
        begin
          repeat
            B:=B+1;
            C:=C-1;
            FindColorsSPiralTolerance(x,y,OC,COLOR,MIX1,MIY1,MIX2,MIY2,C);
          until(AR=1)or (b=5)and(Ar>=2);
        end;
       if AR=1 then
       begin
         Mouse(x,y,1,1,true);//clicks on object
       end;
       if B=5 and AR>=2 then
       begin
         MiddleTPAEx(Oc[i],x,y); //haha this is my idea of randomly XD
         Writeln('There are More than 1 Objects with the same color!');
         Writeln('Choosing one Randomly!');
         Mouse(x,y,1,1,true);
       end;
      end;
    end;

    alright wat it simply should do is taht it finds the color of an object and tries to single it out by lowering the tolerance so that the array length goes down to 1. if not then it would pick the "middle?"( if i used middleTPAEx function in the right cirumstances)of the points. As i said i kinda just learned the formalities of TPA scripting not too long ago. =( BUT the problem is taht this would only find POINTS not objects with the colors. how would i make it that it would find OBJECTS with those colors rather than just points?

  2. #2
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    getarraylength(oc[i])
    ?
    oc doesnt have a definied length.


  3. #3
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    ok i set it. but im not sure about the appropriate numbers? wat exactly am i setting lol if the number of objects that could have the color could vary?

  4. #4
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by freakymonkey View Post
    ok i set it. but im not sure about the appropriate numbers? wat exactly am i setting lol if the number of objects that could have the color could vary?
    SCAR Code:
    SetLength(oc, 0);
    in loops:
    SCAR Code:
    SetLength(oc, Length(oc) + 1);


  5. #5
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    oh so ok every time i find that color in the function i would add this?
    SetLength(oc, Length(oc) + 1);?
    that makes sense?

    oh ya and do u know how i could format the function to find objects instead of points?

  6. #6
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Try this:
    SCAR Code:
    function FindColorObjectInvTPA(color:integer var Text:String;);
     
    var
    OC: array of Tpoint;
    Set,I,C,AR,B: integer;
     
    begin
      SetArrayLength(Oc,4);
      AR:=getarraylength(oc[i])
      C:=10;
      Set:=High(Oc);
      FindColorsSPiralTolerance(x,y,OC,COLOR,MIX1,MIY1,MIX2,MIY2,C);
      fo i:=0 to Set do
      begin
        if AR>=2 then
        begin
          repeat
            B:=B+1;
            C:=C-1;
            FindColorsSPiralTolerance(x,y,OC,COLOR,MIX1,MIY1,MIX2,MIY2,C);
          until(AR=1)or (b=5)and(Ar>=2);
        end;
       if AR=1 then
       begin
         MMouse(x,y,1,1,true);//moves mouse on object
         If IsUpText(Text) then
           Result := True;
       end else
       if B=5 and AR>=2 then
       begin
         MiddleTPAEx(Oc[i],x,y); //haha this is my idea of randomly XD
         Writeln('There are More than 1 Objects with the same color!');
         Result := False;
       end;
      end;
    end;

    Drummed it up in a sec

  7. #7
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    haha wow thanks didnt think of uptexts =) thanks a bunch guys. btw nauman i love ur srl members tut.

  8. #8
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    No Problem Glad I Could Help

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Scripting Help Needed!
    By mormonman in forum OSR Help
    Replies: 15
    Last Post: 10-30-2008, 08:15 AM
  2. eek. A little help needed:
    By malotthouse in forum OSR Help
    Replies: 4
    Last Post: 02-18-2008, 06:01 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
  •