Results 1 to 9 of 9

Thread: TPA Help!

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

    Default TPA Help!

    Ok, I am trying to follow Dusk412's TPAs for Dummies tutorial (http://www.villavu.com/forum/showthread.php?t=33111
    ). I understand what is going on, but when I try to run the test code my mouse just stays at the play button in scar and moves slowly away...

    I tried relocating the client and picking new colors, all with no success. Here is the code I am trying to run:

    Code:
    program New;
    {.include SRL/SRL.scar}
    
    var
       MyTPA : TPointArray;
       MyPoint : TPoint;
       x,y,i : Integer;
       
    begin
         x := 284;
         y := 202;
         FindColorsSpiralTolerance(x,y,MyTPA, 2436919, 0, 0, 547, 464, 10);//Insert main screen coordinates and tree color here
         if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x,y,MyTPA, 6515307, 0, 0, 547, 464, 10);//Insert main screen coordinates and second tree color here
         for i:= 0 to High(MyTPA)do
         begin
              MyPoint := MyTPA[i]
              MMouse(MyPoint.x, MyPoint.y,3,3);
              if(IsUpTextMultiCustom(['tair','case']))then
              begin
                   GetMousePos(x,y);
                   Mouse(x,y,0,0,False);
                   ChooseOption('limb');
                   Wait(500+random(250));
                   Exit;
              end;
              Wait(350+random(350));
         end;
    end.
    Does anyone know what is wrong? Why would the mouse just stay in scar and move away very slowly...?

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

    Default

    change
    SCAR Code:
    MyPoint := MyTPA[i]
    To:
    SCAR Code:
    MyPoint := Point(MyTPA[i].x, MyTPA[i].y);

    and it should work.

    Also, keep in mind, it take's time for Scar to declare variables so if they aren't needed you should try and avoid them.
    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    var
       MyTPA : TPointArray;
       x,y,i : Integer;
       
    begin
         FindColorsSpiralTolerance(284,202,MyTPA, 2436919, 0, 0, 547, 464, 10);//Insert main screen coordinates and tree color here
         if Length(MyTPA) = 0 then FindColorsSpiralTolerance(284,202,MyTPA, 6515307, 0, 0, 547, 464, 10);//Insert main screen coordinates and second tree color here
         for i:= 0 to High(MyTPA)do
         begin
              MMouse(MyTPA[i].x, MyTPA[i].y,3,3);
              if(IsUpTextMultiCustom(['tair','case']))then
              begin
                   GetMousePos(x,y);
                   Mouse(x,y,0,0,False);
                   ChooseOption('limb');
                   Wait(500+random(250));
                   Exit;
              end;
              Wait(350+random(350));
         end;
    end.

    ^^Just shortened it a bit.
    Last edited by NCDS; 08-26-2009 at 06:04 AM.

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

    Default

    Thanks for your input,

    I tried changing that line like you said, but it's still doing the same thing. When i click run the mouse stays in SCAR and very slowly moves to the left.

    Any other ideas?

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

    Default

    Post everything your trying to run quick?

    Make sure you have ActiveClient; in your mainloop. Also, don't forget to drag your crosshairs over the client.

  5. #5
    Join Date
    Aug 2009
    Posts
    164
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I was missing SetupSRL; lol
    Now it's working

    On a side note...how do you get your code to be color coded when u post it?
    Last edited by scuz 10; 08-26-2009 at 06:17 AM.

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

    Default

    Scar tags

    put the code between [ scar] and [ /scar] just without the spaces.

  7. #7
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    And dont forget to call "SetupSRL;" at the beginning of your script :3...

    //oh, you already got it :'D...

  8. #8
    Join Date
    Aug 2009
    Posts
    164
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks guys!

    I made a tpa that chops trees, and now I'm trying to make one that will find a fire after it has been lit. The uptext on it is just walk here, which is no different from anywhere else on the map, though. Any ideas how I can pick the TPA points where the fire is?
    Last edited by scuz 10; 08-26-2009 at 07:21 AM.

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

    Default

    You can try counting the colors.

    If the script finds more than a certain amount of the color of fire, then it's probably found the fire.

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
  •