Hi
How can I make a box around x, y anywhere on the main screen?
So I would move the mouse to x, y and check for a colour in that box.
Thanks
Printable View
Hi
How can I make a box around x, y anywhere on the main screen?
So I would move the mouse to x, y and check for a colour in that box.
Thanks
you can doand alter the amount added and subtracted from x and y to increase/decrease the size of your box. Hope I helpedSimba Code:MMouse(x, y, 3, 3);
findcolor(a, b, color, x - 10, y - 10, x + 10, y + 10)
You can set the xs,ys,xe,ye with relation to the mouses x and y co-ords. Something like below:
Simba Code:MMouse(x,y,0,0);
if FindColorTolerance(x,y,color,x-50,y-50,x+50,y+50,tol) then
Mouse(x,y,0,0,mouse_Left);
:ninja:'d
I'll give them a go. Thanks
Ok so I gave that box a go and it didn't seem to work for me. What I'm trying to do is make a function to search for health bars. Maybe I could find an NPC then check for a DTM mask of the health bar? Would that work? I've read a lot about TPA's but I really don't understand then or how I would use it to find the health bar.
What would be better and what should I work towards?
Thanks
I think there is already a function in the SRL include that finds HP bars... 1 sec
Edit:
Try running this:
Simba Code:program new;
{$DEFINE SMART}
{.include SRL/SRL.simba}
{.include SPS/SPS.simba}
{.include SRL/SRL/skill/magic.simba}
{$IFDEF SIMBAMAJOR980}
{.include SRL\SRL\MISC\Paintsmart.simba}
{$ELSE}
{.include SRL\SRL\Misc\SmartGraphics.simba}
{$ENDIF}
Var
Points : array of TPoint;
begin
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
Smart_Server := 72;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
{$ELSE}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
{$ENDIF}
Points := GetFightBarTPA(MSBox);
SMART_DrawDotsEx(True, Points, clAqua);
end.
Thanks for the quick reply but my issue is because it's for a rsps that won't work. This is why I'm trying to write a function
Ok, do you want to post a screenshot of what the bar looks like, then I can help better
Yeah what type of bar is it... the new style bar or the old style?
Ive attached a screenshot for you.
My knowledge on this is a 'tad rusty, but I think I can help you.
Simba Code:procedure Example();
var
x, y: Integer;
b: TBox;
begin
b := (IntToBox(x + 25, y + 25, x - 25, y - 25));
if ... then
begin
end;
end;
Let me explain what we're doing here. We first define x and y as integers and we also define b as a TBox (that's just 4 values to make a box).
Once we define those variables, we make b's values (x1, y1, x2, y2) to be dependant on x and y's values. So we take x and increase it by 25, y by 25 and then decrease the next x and y values.
This makes a box of 25 pixels above and lower than the x and y values. This will allow us to search within the box. That's where the if ... then comes in and you replace it with what you want.
E: Just for a little 'bit more insight: If you know TPAs & 2D TPAs well enough, you can get the boundaries of a 2D TPA and make a box around it with the size you desire. This will allow you to accurately enough tell where the HP bar is and judge what you want to do based on that.
I'm very rusty at this so I can't explain it very well, but I hoped that help a little.
Thanks everyone for the help. I'll see how it goes and post if I get stuck again
Hi again,
After having a play around i keep getting errors
Warning! You passed a wrong xs to a finder function: -25. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -25. That is below 0, thus out of bounds. Setting the value to 0 for now.
i get this when i do
Simba Code:x - 25, y - 25, x + 25, y + 25
any ideas how to stop this?
i can make and search a box at any point on the screen just not around the the mouse x, y
Hi bambe,
That warning means that you are searching outside the bounds of the client. Remember, a client is essentially a box, starting at (0, 0) and ending at (whateverX, whateverY). Now, what you are essentially doing is searching before that region (before (0, 0)) - you are searching from (-25, -25) to (whereverX, whereverY). Obviously, that is impossible, since nothing of the client exists before that initial (0, 0) starting point :p What Simba is telling you by warning you, is that it has corrected this and put the top-left corner of your box to (0, 0). :)
Regards,
~ Daniel.
hmm in that case how do i make a box which is following x,y?
I need to be able to search a box at x,y and just cant seem to do it
If you want your box in the far top left corner, then this is correct. Otherwise you will need to use mmouse, then getmousepos(x, y).
You will need to use MMouse, but GetMousePos is not necessary as your mouse's co-ordinates will already be stored in the variables x and y, thus no need for GetMousePos..
In addition to that, GetMousePos is actually not working so, best if you don't use it.
Im looking to make a box at x,y anywhere on the mainscreen where ever the colour im searching for is found.
FindColor
MMouse
Then search for a color in a box at x,y
I keep trying to use IntToBox but cant seem to get it to work.
If there is a tutorial on making boxes and how to use them ill be more then happy to take a look if someone can point me in the right direction.
I read a tut on this last week, give me a minute.
I learned Tboxes in this tutorial, its on pixelshift, but at the beggining, it gives a brief overlook on how to use a TBox. If you need help on tboxes, dont ask me, I only know what i learned in this tutorial. :P
Am I missing something? Why aren't you just using something like
Simba Code:if FindColoredArea(x, y, YourColor, LeftX, TopY, RightX, BottomY, SmallestSize) then
begin
MMouse(x, y, RandomRange(5, 10), RandomRange(5, 10));
Writeln('Color found at: x: ' + IntToStr(x) + ' y: ' IntToStr(y));
end;
if find the colour on the mainscreen, then make a box relative to the x and y co-ordinates that you found the colour. I don't know what else you want to do so I didn't expand the procedure any further, but in it's most basic form that is what I believe you are asking for?
Simba Code:procedure MakeBox;
var
x, y: Integer;
Box: TBox;
begin
if FindColor(x, y, WhateverColor, MSx1, MSy1, MSx2, MSy2) then
Box := IntToBox(x - 20, y - 20, x + 20, y + 20);
end;
ah i understand now! So im finding the colour then making a box at them coords to check for my next colour.
i thought then box would be made then follow x,y checking for a colour.
thanks