Results 1 to 9 of 9

Thread: Trying to make a really simple script. Need help please

  1. #1
    Join Date
    Feb 2014
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default Trying to make a really simple script. Need help please

    I'm trying to make my first script for a private server called fatality, I couldn't find a better place to post this, its probably in the wrong section, but anyways.

    Since its for a server that can't use UpText and if LoggedOut, I need to go about using colors and such to check these things im assuming.

    So theres a color I Need to click on, so im using
    FindColorTolerance(var x,y: integer; color x1,y1,x2,y2 tol:integer): boolean

    Will this find the color and set my x,y variables so that I can click on their cords?
    I understand how to use the color picker, but I just get a large number, what is x1,y1,x2,y2 for, I don't even know what to enter for these,
    I tried FindColorTolerance(X,Y,8777431,1); But it gave me a crappy error, all of the documentation for this is gone, so I cant really find anything out about it.
    Can you guys help me get started? Thanks - Andy

  2. #2
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Yes, if it finds the color it will set the x and y to the coords of the color.
    You can then move the mouse to it and left click it with
    Simba Code:
    mouse(point(x, y), MOUSE_LEFT, MOUSE_HUMAN);

    x1,y1,x2,y2 are the coords that mark the area where Simba will look for your color.

    Think about it as two points like this forming a box:
    Code:
    1----|
    |    |
    |    |
    |----2
    1 is X1, Y1
    2 is X2, Y2

    Good luck! Also, the beginner's tutorial section is a great place to find scripting resources

  3. #3
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by yamahablasta View Post
    I'm trying to make my first script for a private server called fatality, I couldn't find a better place to post this, its probably in the wrong section, but anyways.

    Since its for a server that can't use UpText and if LoggedOut, I need to go about using colors and such to check these things im assuming.

    So theres a color I Need to click on, so im using
    FindColorTolerance(var x,y: integer; color x1,y1,x2,y2 tol:integer): boolean

    Will this find the color and set my x,y variables so that I can click on their cords?
    I understand how to use the color picker, but I just get a large number, what is x1,y1,x2,y2 for, I don't even know what to enter for these,
    I tried FindColorTolerance(X,Y,8777431,1); But it gave me a crappy error, all of the documentation for this is gone, so I cant really find anything out about it.
    Can you guys help me get started? Thanks - Andy
    As for the first question: Yes, the x and y will contain the x and y coordinate if the color is found.
    Second Question: You should take a look at The Mayors tutorial here. You will want to look at the section called variable types.
    Currently lurking while messing around with dll injection. Will continue contributing after I finish my quest.

  4. #4
    Join Date
    Feb 2014
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Ok, So here's where I'm at, It activates the client(pulls it to front) then does nothing. I've tried many colors and nothing changes. I tried it with the color tolerance function as well with the same result, So I feel like there must be a problem with my code, can someone take a look please,

    Code:
    program ThievesStuff;
    
    Const
    Mart = 9170145;
    
    Procedure Thieve;
    var X,Y : Integer;
    begin
    
    if (FindColor(X,Y,2642530,0,0,520,340)) then
      begin
      MoveMouse(X,Y);
      Sleep(1000);
      ClickMouse(X,Y,0);
      end;
    end;
    
    begin
    Sleep(250);
    ActivateClient;
    repeat
    Sleep(3000);
    Thieve;
    until(Random(3) = 4);
    end.

  5. #5
    Join Date
    Feb 2014
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Now I got it to click using almost the exact same code.. but now its clicking at 0,0 no matter what. The X,Y is always 0,0 for some reason
    The part I really don't understand is that im getting the output 'no' but im never getting 'inloop' eventhough its moving the mouse to 0,0... how is that even possbile
    Code:
    program ThievesStuff;
    
    Const
    Mart = 9170145;
    
    Procedure Thieve;
    var X,Y : Integer;
    begin
    Writeln('no')
    if (FindColor(X,Y,2642786,0,0,750,500)) then
      Writeln('in loop');
      MoveMouse(X,Y);
      Sleep(1000);
      ClickMouse(X,Y,0);
      end;
    
    
    begin
    Sleep(250);
    ActivateClient;
    repeat
    Sleep(3000);
    Thieve;
    until(Random(3) = 4);
    end.

  6. #6
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Quote Originally Posted by yamahablasta View Post
    Now I got it to click using almost the exact same code.. but now its clicking at 0,0 no matter what. The X,Y is always 0,0 for some reason
    The part I really don't understand is that im getting the output 'no' but im never getting 'inloop' eventhough its moving the mouse to 0,0... how is that even possbile
    Code:
    program ThievesStuff;
    
    Const
    Mart = 9170145;
    
    Procedure Thieve;
    var X,Y : Integer;
    begin
    Writeln('no')
    if (FindColor(X,Y,2642786,0,0,750,500)) then
      Writeln('in loop');
      MoveMouse(X,Y);
      Sleep(1000);
      ClickMouse(X,Y,0);
      end;
    
    
    begin
    Sleep(250);
    ActivateClient;
    repeat
    Sleep(3000);
    Thieve;
    until(Random(3) = 4);
    end.
    It goes to 0,0 because that's the default x and y and because FindColor never finds the color that never gets changed. Try using FindColorTolerance and playing around with the tolerance (start @ 5 or so, raise if needed. 255 is max)

  7. #7
    Join Date
    Feb 2014
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Ok, ill mess with it, you guys are great btw

    Edit- While you guys are here, how can I use the KeyDown method, to move camera to top, how can I send Arrow key up, or any key. I've tried KeyDown('a'); just to get started somewhere, but I get this exception "Exception in Script: Expected variable of type "UInt16", got "AnsiChar"" I need to be able to use enter, and arrow keys

    edit2(lol) - The problem is the if loops, they are never getting triggered. I cant even get it to trigger with a simple black color like 283 on a black screen...
    this is what my if loop looks like, is there something im doing wrong?

    Code:
    Procedure LowHp;
    begin
    if FindColorTolerance(junk1,junk2,283,700,20,700,40,5) then
      begin
      SendKeys('::master enter',100,100);
      end;
    end;
    Last edited by yamahablasta; 02-26-2014 at 05:04 AM.

  8. #8
    Join Date
    Feb 2014
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    The problem is the colors, its not detecting them correctly. I have to make the tolerance so high that it cant tell the difference between black and red..

    And how do I get the ability to use precoded methods like TypeSend(''); that's awesome, I saw it in another script and he didn't include it.
    Last edited by yamahablasta; 02-26-2014 at 05:23 AM.

  9. #9
    Join Date
    Feb 2014
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    All problems resolved.. Private server ran OpenGL graphics by default, I was able to switch to DirectX

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
  •