Results 1 to 12 of 12

Thread: How To Make Script Calculate Center Or Colors ?

  1. #1
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    How To Make Script Calculate Center Or Colors ?

    So what i need to do :/ is like


    HERE IS ONE COLOR





    000000000000000000000 THE CENTER 0000000000000000000000000000000000000 SECOND COLOR






    000000000000000000000000000THIRD COLOR


    How i can make script to get The Center :/ ?


    Thanks,

    ~Home

  2. #2
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    What you mean Centre?
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  3. #3
    Join Date
    Mar 2007
    Posts
    3,681
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    you mean ddtms?

  4. #4
    Join Date
    Mar 2007
    Location
    Netherlands->Amersfoort.
    Posts
    1,615
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i think he mean. is there is a big spot of 1 color. it will click in the middel of it:

    function FindColorSpiral2(var x,y: Integer; color, xs, ys, xe, ye: Integer): Boolean; - find color just like FindColorSpiral, and if there is a big spot of that color then it finds the center of it.
    //From the help file from scar.

    if not then he mean DTM and DDTM.

    Edit: DTMs

  5. #5
    Join Date
    Jun 2007
    Location
    I'm not sure...
    Posts
    581
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    U know he could use DDTM's, it would be more effective, but a lot harder than FindColorSpiral2.

    Ur choice, speed or accuracy (FindColorSpiral2 is accurate nonetheless)
    ---------------------------------------------------------


    Pm me if you need any math functions made. Me = l0ving t3h mathz

    ---------------------------------------------------------

  6. #6
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    It's very simple, really.
    Count up all the x and y's into a var.
    Divide it by the amount of points you just counted.

    Like this:

    SCAR Code:
    Function WeirdMiddle(TPA: TpointArray): TPoint;

    Var
      L, I: Integer;
    Begin
      If GetArrayLength(TPA) = 0 Then
        Exit;
      L := GetArrayLength(TPA) - 1;
      For I := 0 To L Do
      Begin
        Result.X := Result.X + TPA[I].X;
        Result.Y := Result.Y + TPA[I].Y;
      End;
      Result.X := Round(Result.X Div GetArrayLength(TPA));
      Result.Y := Round(Result.Y Div GetArrayLength(TPA));
    End;

  7. #7
    Join Date
    Oct 2006
    Posts
    1,071
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I was wondering about this too, but I really don't understand arrays..

  8. #8
    Join Date
    Jun 2007
    Location
    I'm not sure...
    Posts
    581
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Arrays are just a bunch of varriables stuffed into one name.
    SCAR Code:
    Var
      i:Array 0..2 of Integer;
    can hold the same ammount of information as
    SCAR Code:
    Var
      i:Integer;
      q:Integer;
      w:Integer;
    and they are easier to use.
    ---------------------------------------------------------


    Pm me if you need any math functions made. Me = l0ving t3h mathz

    ---------------------------------------------------------

  9. #9
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    It's very simple, really.
    Count up all the x and y's into a var.
    Divide it by the amount of points you just counted.

    Like this:

    SCAR Code:
    Function WeirdMiddle(TPA: TpointArray): TPoint;

    Var
      L, I: Integer;
    Begin
      If GetArrayLength(TPA) = 0 Then
        Exit;
      L := GetArrayLength(TPA) - 1;
      For I := 0 To L Do
      Begin
        Result.X := Result.X + TPA[I].X;
        Result.Y := Result.Y + TPA[I].Y;
      End;
      Result.X := Round(Result.X Div GetArrayLength(TPA));
      Result.Y := Round(Result.Y Div GetArrayLength(TPA));
    End;

    What i mean is like in Wt Fawkis Godlin Scheduler,


    Look This Pic :/ And You Get IDea what DO I MEAN

    http://img230.imageshack.us/my.php?image=nimetnme5.jpg

    ~Home

  10. #10
    Join Date
    Mar 2007
    Location
    Netherlands->Amersfoort.
    Posts
    1,615
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    that ar (d)dtms

    but for the minimap DDTM ar much better. johoyo have a imo great tut on them.

    edit link:
    http://www.villavu.com/forum/showthr...4?goto=newpost

  11. #11
    Join Date
    May 2006
    Posts
    1,230
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i think this is what you need

    FindColorTriangleTolerance(x, y, colorinthecenter, xofcolor1, yofcolor1, xofcolor2, yofcolor2, xofcolor3, yofcolor3, tolerance);

  12. #12
    Join Date
    Dec 2006
    Location
    utah
    Posts
    1,427
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default

    You Can Use Wizzup? Method but it wont always work.. because if you get one pixel in there from a diffrent spot (you dont want) it will screw the hole thing up.

    Try These....

    SCAR Code:
    function AMaxPoint(P : TPointArray) : TPoint;
    var
       i : integer;
    begin
      if (GetArrayLength(P)=0) then exit;
      Result := P[0];
       for i := 1 to GetArrayLength(P)-1 do
         if (P[i].x >= Result.x) and (P[i].y >= Result.y) then
          Result := P[i];
    end;


    function AMinPoint(P : TPointArray) : TPoint;
    var
       i : integer;
    begin
      if (GetArrayLength(P)=0) then exit;
      Result := P[0];
       for i := 1 to GetArrayLength(P)-1 do
        if (P[i].x <= Result.x) and (P[i].y <= Result.y) then
           Result := P[i];
    end;


    function AMidPoint(P : TPointArray) : TPoint;
    var
       I, N, L, Index : Integer;
    begin
     L := Length(P);
     if (L = 0) then Exit;
     for N := 0 to L / 2 do
     begin
       Result := P[0];
       for i := 1 to L-1 do
         if (P[i].x >= Result.x) and (P[i].y >= Result.y) then
         begin
           Result := P[i];
           Index := i;
         end;
       P[Index] := Point(-1, -1);
     end;
    end;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Calculate Rate?
    By pianoman933 in forum OSR Help
    Replies: 3
    Last Post: 11-30-2008, 09:38 PM
  2. make it search for 2 colors near another
    By RaptorBlaze in forum OSR Help
    Replies: 12
    Last Post: 08-26-2008, 02:50 PM
  3. Replies: 2
    Last Post: 10-07-2007, 04:20 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
  •