Results 1 to 14 of 14

Thread: CTS2 help

  1. #1
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default CTS2 help

    Hey guys, yesterday, brandon made me an awesome CTS2 function to find my bank, but it doesent actually find the bank... It moves the mouse about 5 pixels below the bank onto the floor, and eventually times out. Seeing how I have no knowledge of CTS2, I cant really fix it myself, even though i tried to update the colors in the function to no avail. If someone could show me what values have to be updated, and what I'd change them to, it would be great! Here is the function:
    Simba Code:
    Function OpenBankCustom: Boolean;      //Credit to Brandon for fixing and beefing up this function.
    var
      B: TBox;
      Location: TPoint;
      CTS, I, L: Integer;
      ATPA: T2DPointArray;
      TPA, TPA2: TPointArray;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.02, 2.40);
      FindColorsTolerance(TPA, 8434655, MSX1, MSY1, MSX2, MSY2, 15);
      If (Length(TPA) < 1) then Exit;

      SortTPAFrom(TPA, Point(MSCX, MSCY));

      ATPA:= TPAToATPAEx(TPA, 31, 190);
      L := Length(ATPA);
      If (L < 1) then Exit;

      SetColorSpeed2Modifiers(0.11, 0.20);
      SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));

      For I := 0 To L Do
      begin
        B := GetTPABounds(ATPA[I]);
        with B do
        begin
          If (FindColorsTolerance(TPA2, 4937053, MSX1, MSY1, MSX2, MSY2, 20)) then
          begin
            Location := MiddleTPA(TPA2);
            MMouse(Location.X, Location.Y, 0, 0);
            If (WaitUptextMulti(['ank', 'Bank', 'ooth', 'booth', 'ank boo'], 600)) then
            begin
              ClickMouse2(MOUSE_LEFT);
              Result := True;
              ColorToleranceSpeed(CTS);
              SetColorSpeed2Modifiers(0.2, 0.2);
              Exit;
            end;
          end;
        end;
      end;
      ColorToleranceSpeed(CTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    end;

    This is my screen on ACA, I got it to highlight the bankers perfectly, there really isnt anything else on the bank booth to highlight, since the golden stuff highlights the walls and floors, and the brown highlights doors and abunch of whacky stuff. Note: This is the angle that the camera will always be turned, if it makes a difference.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  2. #2
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Simba Code:
    SetColorSpeed2Modifiers(0.02, 2.40);
      FindColorsTolerance(TPA, 8434655, MSX1, MSY1, MSX2, MSY2, 15);
    Should be:
    Simba Code:
    SetColorSpeed2Modifiers(3.17, 0.73);
      FindColorsTolerance(TPA, 8684913, MSX1, MSY1, MSX2, MSY2, 11);

  3. #3
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ahh, those are hue and sat mods then! Thanks NKN! Ill try this, and ill let you know what happens!
    E: It moves the mouse to the floor, clicks, then just sits there, not executing, not doing anything. I think its this line.
    Simba Code:
    If (FindColorsTolerance(TPA2, 4937053, MSX1, MSY1, MSX2, MSY2, 20)) then
    Now I dont wanna go editing this and screwing it up, but if I change the color in there to the color in my ACA, should it work?
    Last edited by Footy; 08-13-2012 at 01:26 PM.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  4. #4
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Simba Code:
    SetColorSpeed2Modifiers(0.11, 0.20);
      SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));

      For I := 0 To L Do
      begin
        B := GetTPABounds(ATPA[I]);
        with B do
        begin
          If (FindColorsTolerance(TPA2, 4937053, MSX1, MSY1, MSX2, MSY2, 20)) then

    I think it should be this part. Not sure what's the first part for.

  5. #5
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ^ Would I change those modifiders to my sat and hue mods, and update the color in the last line?
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  6. #6
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    It's the same thing as above, just checks again.
    Same things apply as to what I did above.

  7. #7
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hue and sat to modifiers. Color and tolerance in FindColorsTolerance. As what I understand, it will move your mouse in the middle of this TPA, regardless of size.

    EDIT: I would make ATPA for more accuracy.

  8. #8
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I cant even make a TPA! Ill try you guy's suggestions, and let you know what happens.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  9. #9
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    LOL? What?! It does not just check again lol..

    First it finds the creamish-brown looking colour. This is almost the entire area.. It grabs a box surrounding it.
    Then it searches for the dark colour inside of the previously found area.

    That's how it finds the bank booth. If your angle is too low, it's not going to be the same because the brown isn't going to be inside the previous colour.


    Replace previous colour with "Cream" I didn't wanna say that because it sounds so wrong! Brown in cream -__-
    I am Ggzz..
    Hackintosher

  10. #10
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ^ Now the first part makes sense

  11. #11
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    1: Thats an interesting method of finding the bank!
    2: I dont want the angle too high, because then finding the tanner will be hard. Is there an SRL function to make the camera angle in the middle? I've seen SRL_ANGLE_HIGH and SRL_ANGLE_LOW but no SRL_ANGLE_MID...
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  12. #12
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Footy View Post
    1: Thats an interesting method of finding the bank!
    2: I dont want the angle too high, because then finding the tanner will be hard. Is there an SRL function to make the camera angle in the middle? I've seen SRL_ANGLE_HIGH and SRL_ANGLE_LOW but no SRL_ANGLE_MID...
    Because there is no way to detect the angle w/o using injection. You could create your own function by setting it to high/low first then hold the up/down arrow key for a certain period of time.

  13. #13
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    You really should learn how it works before using it.. This one will grab the blackish colours and look for the grey colour of the window within the black.

    Simba Code:
    Function OpenBankCustom: Boolean;      //Credit to Brandon for fixing and beefing up this function.
    var
      B: TBox;
      Location: TPoint;
      CTS, I, L: Integer;
      ATPA: T2DPointArray;
      TPA, TPA2: TPointArray;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(3.79, 0.91);
      FindColorsTolerance(TPA, 4210740, MSX1, MSY1, MSX2, MSY2, 11);
      If (Length(TPA) < 1) then Exit;

      SortTPAFrom(TPA, Point(MSCX, MSCY));

      ATPA:= TPAToATPAEx(TPA, 61, 67);         //The size of each booth.. The dark part at the lowest angle.
      L := Length(ATPA);
      If (L < 1) then Exit;

      SetColorSpeed2Modifiers(0.25, 0.41);
      SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));

      For I := 0 To L Do
      begin
        B := GetTPABounds(ATPA[I]);
        with B do
        begin
          If (FindColorsTolerance(TPA2, 9212318, MSX1, MSY1, MSX2, MSY2, 19)) then
          begin
            Location := MiddleTPA(TPA2);
            MMouse(Location.X, Location.Y, 0, 0);
            If (WaitUptextMulti(['ank', 'Bank', 'ooth', 'booth', 'ank boo'], 600)) then
            begin
              ClickMouse2(MOUSE_LEFT);
              Result := True;
              ColorToleranceSpeed(CTS);
              SetColorSpeed2Modifiers(0.2, 0.2);
              Exit;
            end;
          end;
        end;
      end;
      ColorToleranceSpeed(CTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    end;
    I am Ggzz..
    Hackintosher

  14. #14
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I understand bits of it, but CTS2 is a bit out of my league at the moment... Ill try this and let you know how it goes.
    Works brilliantly, and I know how to adjust the colors and some other stuff if it breaks again. Thanks!
    Last edited by Footy; 08-13-2012 at 02:08 PM.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

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
  •