Results 1 to 13 of 13

Thread: My plugin! More functions coming!

  1. #1
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default My plugin! More functions coming!

    Well since no one really cared, i will post it here:

    Hello,

    After i made some TPointArray functions i saw they were pretty slow. This is why i made my first plugin! I'll stop talking, here are the Functions:

    Function MostCommonColorBox(x1, y1, x2, y2:integer;Window:Hwnd):integer;

    Function InArray(TheNumber,l:integer;var i:integer;TheArray:TIntegerArray):Boolean;

    Function BubbleTPointArray(ThePoints:TPointArray; SortX,SmallToLarge:boolean):TPointArray;

    Function GetTPointArrayPeaks(ThePoints:TPointArray; Maximum:boolean): TPoint;

    Procedure TPointArrayToIntegerArray(ThePoints:TPointArray;va r XArray,YArray:TIntegerArray);

    Function FindCommonPointsRange(GoodPoints,BadPoints:TPointA rrayArray;Range:integer; Closest:Boolean;var ThePoint:TPoint): Boolean;
    More of this one below!


    For window fill in GetClientWindowHandle,
    InArray returns True if the given Number is in the Array, it also returns the position of the found number in the var I and for L you need to fill in the length of the array, Length(TheArray).
    I think they are pretty easy to understand :-). Please test the MostCommonColorBox at runescape:
    SCAR Code:
    program New;
    var
      TempTime:Integer;

    begin
      TempTime:=GetSystemTime;
      Writeln('');
      WriteLn('The most common color of the Runescape Screen = '+inttostr(MostCommonColorBox(0,0,762, 501, GetClientWindowHandle)));
      Writeln('It took us '+inttostr(GetSystemTime-TempTime)+' ms to find out!');
      Writeln('');
    end.

    Also i need some ideas for functions i could make in a plugin .

    Update:
    Ok someone asked me today if i could help him on his Autofighter, i said yes and started thinking. A good way to make sure the beast you are looking for is, the beasts that turns out of your Colour searching! So i thought, if i make a function that checks if all the colours you are looking for is in a 'box'. I made a scar version, and found its kinda slow. So i made a Delphi function:
    Function FindCommonPointsRange(GoodPoints,BadPoints:TPointA rrayArray;Range:integer; Closest:Boolean;var ThePoint:TPoint): Boolean;
    ThePoints is a array of TPointArray . Every TPointArray must contain x's and y's of the found color. Then we got 'range'. This is basicly how big you want to make the box where you are going to check. Its created this way and made of the FIRST TPointArray!: Bla[I].x1 - Range, Bla[I].y1 - range, Bla[I].x2 + range, Bla[I].y2 + range.
    Then got 'ThePoint', if the colors of the other TPointArrays are found in the box, it will create a point in the 'middle' of the found points, created this way: Round((Bla[0].x + bla[1].x div 2)) etc..
    Boolean ofcourse if it IS found . IF YOU USE IT BE SURE THE POINTS YOU ARE LOOKING FOR ARE CLOSE TO EACHOTHER! AND MAKE SURE THE FIRST TPOINTARRAY IS KINDA THE MIDDLE . *cough* this is like a DTM but then different *cough*
    Here i made a sample script:
    SCAR Code:
    Updated one below! + Explanation new parameters!

    Update:2
    Yea, another update! This time I Updated FindCommonPointsRange! I added some posibilities, you can now choose, whether to start searching from closest to furthest, or furthest to closest AND you can now put in badpoints, points which should NOT be in the range of the good points!
    Good luck, here an updated script! I added some array check functions too, here we go:
    SCAR Code:
    program New;
    var
      ThePoint:TPoint;
      TempTime:Integer;

    Function FindBySameColors( GoodColors,BadColors : TIntegerArray; Range,Tol:integer;Closest:Boolean; var Point:TPoint):Boolean;
    var
      I,II,L,LL,LLL,LLLL:integer;
      GoodClorsTemp,Good, Duplicate : TIntegerArray;
      Clean : Boolean;
      GoodPoints,BadPoints: TPointArrayArray;
    begin;
      L:= Length(GoodColors);
      LL:= Length(BadColors);
      GoodClorsTemp := GoodColors;
      For I:= 0 to L-1 do
      if not (GoodClorsTemp[I] = -1)then
      begin;
        Clean := true;
        For II := 0 to LL-1 do
          if SimilarColors(GoodClorsTemp[I],BadColors[II],TOL) then
          begin;
            Clean := False;
            break;
          end;
        if clean then
        For II := I+1 to L-1 do
          if (GoodClorsTemp[I] = GoodClorsTemp[II]) then
          begin;
             inc(LLL);
             SetLength(Duplicate,LLL);
             Duplicate[LLL-1] := GoodClorsTemp[I];
             GoodClorsTemp[II] := -1;
          end;
        if clean then
        begin;
          inc(LLLL);
          SetLength(Good,LLLL);
          Good[LLLL-1] := GoodClorsTemp[I];
        end;
      end;
      L:= Length(Good);
      SetLength(GoodPoints,L);
      SetLength(BadPoints,LL);
      LLLL:=L;
      For I:= 0 to L -1 do
        FindColorsSpiralTolerance(MSCX,MSCY,GoodPoints[I],Good[I],MSX1,MSY1,MSX2,MSY2,Tol);
      For I:= 0 to LL-1 do
        FindColorsSpiralTolerance(MSCX,MSCY,BadPoints[I],BadColors[I],MSX1,MSY1,MSX2,MSY2,Tol);
      if LLL > 0 then
      begin;
        for I:= 0 to L-1 do
          for II:= 0 to LLL-1 do
            if (Good[I] = Duplicate[II]) then
            begin;
              inc(LLLL);
              SetLength(GoodPoints,LLLL);
              GoodPoints[LLLL-1] := GoodPoints[I];
            end;
      end;
      if FindCommonPointsRange(GoodPoints,BadPoints,Range,Closest,Point) then Result := True
      else
      begin;
        Result := False;
        Point.x:= -1;
        Point.y:= -1;
      end;
    end;

    begin
      TempTime:= GetSystemTime;
      if (FindBySameColors([1320110,2763308,6842480,4671822],[],20,0,true,ThePoint)) then
      MoveMouse(ThePoint.x,ThePoint.y);
      Writeln(inttostr(GetSystemTime - TempTime));
    end.

    ~Raymond

    I made some on top functions:
    Function OnTopDebugCanvas(OnTop : Boolean): Boolean;
    Function SetOnTop(Handle : Integer; OnTop : Boolean ):Boolean;
    Function SetOnTopTitle(Title : String; OnTop : Boolean):Boolean;
    Function MoveDebugCanvas(x,y : Integer):Boolean ;
    check OnTop.rar.
    Verrekte Koekwous

  2. #2
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Do you have any benchmarks?

    I'd love to see some, if they were good enough, I'd be sure to get it (though I probably will anyway...)
    Interested in C# and Electrical Engineering? This might interest you.

  3. #3
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmmmm, yes. I didn't save them ^^. But i made some sample scripts . The FindCommonPointsRange took 75 ms for finding 3 colours at my destkop, with tolerance 5. My Desktop is 1024 * 1280. Fast enough if you ask me ^^.

    EDIT:
    The MostCommonColorBox thing:
    Whole runescape screen: 6 sec
    Runescape Mainscreen: 3 sec
    Runescape minimap: 200 ms.
    Also this is very depending on the amount of colors on the screen...

    The FindBySameColors thing:
    It took me 156 ms to find it out, i used 4 colors, tolerance 10, range 10. And i used the colors of the sand,sand,rock,rock. Pretty large Arrays since i was standing in Al Kharid. Fast enough for monster finding! I think?
    Verrekte Koekwous

  4. #4
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice functions. My favorite is the MostCommonColorBox function. Ill be using that one..

  5. #5
    Join Date
    May 2007
    Location
    http://www.srl-forums.com
    Posts
    265
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hey thanks for that mastaraymond good work.

  6. #6
    Join Date
    May 2007
    Posts
    468
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if i ever figure out how the hell to work these things, they will be sweet!
    Originally Posted by YoHoJo
    I like hentai.

  7. #7
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    UPDATE! Check first post!

    Function FindCommonPointsRange(GoodPoints,BadPoints:TPointA rrayArray;Range:integer; Closest:Boolean;var ThePoint:TPoint): Boolean;

    Added new parameters! And made a cool scar procedure, with some array checks!

    ~Raymond
    Verrekte Koekwous

  8. #8
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    Looks cool, you mind posting the source?
    I made a new script, check it out!.

  9. #9
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by markus View Post
    Looks cool, you mind posting the source?
    Yeah i do ^^.
    Made a new simple plugin, i needed it for my script on top functions, here a list of the procs:

    Function OnTopDebugCanvas(OnTop : Boolean): Boolean;
    Function SetOnTop(Handle : Integer; OnTop : Boolean ):Boolean;
    Function SetOnTopTitle(Title : String; OnTop : Boolean):Boolean;
    Function MoveDebugCanvas(x,y : Integer):Boolean ;
    Verrekte Koekwous

  10. #10
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    bump!
    nice work..
    ~Hermen

  11. #11
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by hermpie View Post
    bump!
    nice work..
    Thanx .
    Verrekte Koekwous

  12. #12
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    BUMP. Can't you get SCAR to export GetClientWindowHandle? It would make it SCAR only, but it would be easier for newbs.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  13. #13
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by R0b0t1 View Post
    BUMP. Can't you get SCAR to export GetClientWindowHandle? It would make it SCAR only, but it would be easier for newbs.
    Yeah i could ^.^, but back at the time i made this you couldn't export GetClientWindowHandle to this, besides i use total different ways right now :-).
    Verrekte Koekwous

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. New Skill Coming...
    By osmm in forum RS has been updated.
    Replies: 2
    Last Post: 12-01-2007, 04:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •