Results 1 to 7 of 7

Thread: Brand new, first script help needed

  1. #1
    Join Date
    Nov 2018
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Question Brand new, first script help needed

    Hello everyone, I have absolutely no experience with script writing (also never posted on any forum before so the format might be terrible) but Simba intrigues me so I am trying to learn, i got a basic script set up and went through a bunch of tutorials, and am now trying to write an extremely basic script to left click and attack stationary monsters. My problem is the script is having a terrible time finding the correct color tolerance.

    Code:
    {$I SRL/OSR.simba}
    
      Const
      STOP_KEY = 113; //F2 to exit
    
    
    Procedure AttackAgg;
    var
      x,y:Integer;
    begin
    if FindColorTolerance(x, y, 1451962, 80, 73, 342, 180, 5) then
      begin
        movemouse(x, y);
        wait(250);
        ClickMouse(x, y, Mouse_Left);
        Wait(5000);
      end;
    end;
    
    begin
      AttackAgg;
    
    end.
    All the code is doing is looking at a box for the color and clicking on it, the monsters are bright red and everything else is brown, but instead of clicking the red it just clicks the mouse randomly inside the box I made.


    AgressiveDemonBox.png

    The moust just clicks randomly within that area.
    I honestly don't know what I am doing wrong and I tend not to ask for help, but I have come to realize that mentality wont get me very far with this.
    Any help or tips would be greatly appreciated.

  2. #2
    Join Date
    Nov 2018
    Location
    System32
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Have you tried using a different color/tolerance, or perhaps a different function for finding the color?

  3. #3
    Join Date
    Nov 2018
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Ive tried 6 or 7 different color tolerances, I wasent aware there were other functions to find color, do you mean like the spiral and such or another method entirely?

  4. #4
    Join Date
    Nov 2018
    Location
    System32
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by Petrichorr View Post
    Ive tried 6 or 7 different color tolerances, I wasent aware there were other functions to find color, do you mean like the spiral and such or another method entirely?
    Yessir! Since you are new, I would recommend taking a look at the color finding section in the villavu docs. It contains all your basic functions that you can use to search for colors. You might also like a handy little tool floating around here, known as ACA. It allows you to select multiple points of different colors and calculates the best single color/tolerance combination that will accept all of those points.

    Personally, I'm a fan of what's known as a DTM (deformable template model) when it comes to finding objects. Mainly because you can specify shapes, distance, tolerance, rotations, etc. They are slightly more advanced and you should probably get a feel for pin-point color finding first so you can understand the concepts a little more in depth.

    If you'd like, feel free to add me on Discord and I'll give you a personal tour of color finding.
    Zombie#4597

  5. #5
    Join Date
    Nov 2018
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Zombified View Post
    Yessir! Since you are new, I would recommend taking a look at the color finding section in the villavu docs. It contains all your basic functions that you can use to search for colors. You might also like a handy little tool floating around here, known as ACA. It allows you to select multiple points of different colors and calculates the best single color/tolerance combination that will accept all of those points.

    Personally, I'm a fan of what's known as a DTM (deformable template model) when it comes to finding objects. Mainly because you can specify shapes, distance, tolerance, rotations, etc. They are slightly more advanced and you should probably get a feel for pin-point color finding first so you can understand the concepts a little more in depth.

    If you'd like, feel free to add me on Discord and I'll give you a personal tour of color finding.
    Zombie#4597

    Sure, I might just have to take you up on that offer, this is all extremely interesting to me, but most of the videos and such were quite a bit out of date, ill through you an add on discord thanks.

  6. #6
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by Petrichorr View Post
    Instead of clicking the red it just clicks the mouse randomly inside the box I made.
    The moust just clicks randomly within that area.
    I honestly don't know what I am doing wrong and I tend not to ask for help, but I have come to realize that mentality wont get me very far with this.
    Any help or tips would be greatly appreciated.
    Hi there,
    I tested a slightly modified version of your code on the picture you attached and it appeared to work fine. Are you selecting the game as a target properly? Are the dimensions of the search box correct? Does this private server have some kind of color related anticheat requiring higher tolerance?



    As you can see the mouse is choosing random points to click correctly here. Without the modification it worked too, only it just clicked one point (top-left) as that’s all you coded. This was my modification for testing:
    Simba Code:
    procedure attackAgg;
    var
      foundPoints: tPointArray;
      clickPoint: tPoint;
    begin
    if findColorsTolerance(foundPoints, 1451962, 210, 269, 512, 399, 5) then
      begin
        clickPoint := foundPoints[random(0, high(foundPoints))]; //Select random point of the found red demon points
        moveMouse(clickPoint.x, clickPoint.y);
        wait(250);
        clickMouse(clickPoint.x, clickPoint.y, MOUSE_LEFT);
        wait(500);
      end;
    end;

    var
      i: integer;

    begin
      for i := 0 to 9 do
        attackAgg;
    end.

    That said, there are of course lots of things you can do to make a better, more accurate object finding function, but I wanted you to know that your original code (with the color and tolerance you used) appears to work (on the picture at least) so the problem may be something you overlooked like window target selection.
    Last edited by Clarity; 11-22-2018 at 02:59 AM.

  7. #7
    Join Date
    Nov 2018
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Thanks for all the help guys, turns out it was a hardware problem on my end, it runs perfeclty fine on a vm, so i suppose ill be continuing from a vm from now on

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
  •