Results 1 to 7 of 7

Thread: TPA help

  1. #1
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default TPA help

    hey i donno what im doing wrong =[

    SCAR Code:
    function CutYew : Boolean;
    var
      Color : TIntegerArray;
      TPA : TPointArray;
      Poi : TPoint;
      x, y, i, H, count : Integer;
      Switch : Boolean;

    begin
      Color := [4820866, 2648669, 3240805, 4359803, 1987656, 3109735, 5544845, 2907218, 2583903, 5412233, 3439984, 4950398, 3440241];
      for i := 0 to 12 do
      begin
        //x := MSCX;
        //y := MSCY;
        if FindColorsTolerance(TPA, Color[i], MSX1, MSY1, MSX2, MSY2, 15) then
        //if(FindColorsSpiralTolerance(x, y, TPA, Color[i], MSX1, MSY1, MSX2, MSY2, 15))then
        begin
          Poi := TPA[i];
          x := Poi.x; // [Runtime Error] : Out Of Range in line 470 in script (this line)
          y := Poi.y;

    i didnt show it all cause this is the only part that isnt working.. but neither findcolorsspiraltolerance or findcolorstolerance seem to work for me.. am i doing this wrong? and id rather use spiral but i can never seem to get it working. are there any tutorials for that one? :]
    Lance. Da. Pants.

  2. #2
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Change:
    SCAR Code:
    for i := 0 to 12 do

    to:
    SCAR Code:
    for i := 0 to High(Color) do

    Then try it.

  3. #3
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Edit: at first i thought it fixed it and then realized i was looking at the wrong function
    so its still not working =/
    Last edited by Lance; 05-25-2009 at 04:08 PM.
    Lance. Da. Pants.

  4. #4
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    This part is wrong:

    SCAR Code:
    Poi := TPA[i];

    The script will loop through all 13 colours with i being between 0 and 12. But the length of TPA might be less than 12 so you get a runtime error. I can help you more if you elaborate on what you're trying to do.

  5. #5
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    haha im just trying to write a simple TPA to find Yew trees. i decided FindObjTPA just wasnt cutting it for me anymore. would you like me to post my script? how exactly do i extract a (x, y) Tpoint from the TPA then? =S
    Last edited by Lance; 05-25-2009 at 04:12 PM.
    Lance. Da. Pants.

  6. #6
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes do that please .

  7. #7
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    erm yes ok here you go xP (this time i remembered to take the user and pass out)

    Edit: its CutYew that isnt working. CutYew2 is the old function that used FindObjTPA, (and sorry CutYew2 is in the main loop, i forgot to exchange it with CutYew before i uploaded it)

    Edit: never mind i belive i figured out my problem :] thanks anyway
    Last edited by Lance; 05-26-2009 at 04:44 AM.
    Lance. Da. Pants.

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
  •