SRL Archive - OSR Help

T-Box help.


Stanger

2013-03-29 10:13:59

Hello,

I am writing an 07script and I need help with T box. I couldn't find any information about them on this forum so I decided to start a thread. I want to know how can I get the coordinates of a T box for finding a object in it. Also I would like to know how to make the box visible on the screen with a colour. I am sure that there are tut's about it but I can't find them and I don't know the general word to find it.

Ian

2013-03-29 10:20:08

Try searching in google "site:villavu.com tbox" (without the quotes)

that should give you many results, all of them from this Site :D

Also for drawing the tbox on the screen, use this: http://docs.villavu.com/srl-5/paintsmart.html#smart-drawboxex

Le Jingle

2013-03-29 11:01:32

Well, as BMWxi allotted you information on the drawing of a TBox with SMART defined (and including SMART graphics), I'll try to add in some (additional) information.


A TBox is a type, in which you define 4 Integer values. These Integer values are the same as a making a rectangle/square, and require the following format;
X-Start and Y-Start these values can be determined by you, they're the starting coordinates, based from +/- distance from your selected client's 0,0 coordinates. 0,0 coordinates are often based from the upper left corner of the screen and expand out (increase in both x and y) as you near the lower right corner of your screen.
the X-End and Y-End values must both me greater than the X-Start and Y-Start values. These ending values compose the second point, creating a square or rectangle.

Defining a TBox in pascal script, you'd make a TBox as such:

var
b: TBox;
begin
b := IntToBox(5, 5, 10, 10);
end.

And if you wanted to find the box/bounds of an Object, in order to use SMART to draw it on the screen, one way to accomplish this would be:

{$DEFINE SMART8}
{$include_once srl/srl.simba}
{$include_once srl/srl/misc/smartgraphics.simba}
var
b: TBox;
TPA: TPointArray;
begin
// 1. Setup the box to the entire RS Chat box
b := IntToBox(MCX1, MCY1, MCX2, MCY2);
// 2. Find all Points in the chat box where the color clMessage (black) is present
FindColorsTolerance(TPA, clMessage, b.X1, b.Y1, b.X2, b.Y2, 5);
// 3. Get the bounds (smallest x, y and largest x, y) of the TPA
b := GetTPABounds(TPA);
// 4. Draw the box.
SMART_DrawBox(b);
end.

Cheers,
Le Jingle

Stanger

2013-03-29 18:24:57

From: BMWxi
Try searching in google "site:villavu.com tbox" (without the quotes)

that should give you many results, all of them from this Site :D

Also for drawing the tbox on the screen, use this: http://docs.villavu.com/srl-5/paintsmart.html#smart-drawboxex


I did check but didn't find any usefull threads.. But your link is exactly wat I was searching for but couldn't find it so thanks alot!!




From: Le Jingle

And if you wanted to find the box/bounds of an Object, in order to use SMART to draw it on the screen, one way to accomplish this would be:

{$DEFINE SMART8}
{$include_once srl/srl.simba}
{$include_once srl/srl/misc/smartgraphics.simba}
var
b: TBox;
TPA: TPointArray;
begin
// 1. Setup the box to the entire RS Chat box
b := IntToBox(MCX1, MCY1, MCX2, MCY2);
// 2. Find all Points in the chat box where the color clMessage (black) is present
FindColorsTolerance(TPA, clMessage, b.X1, b.Y1, b.X2, b.Y2, 5);
// 3. Get the bounds (smallest x, y and largest x, y) of the TPA
b := GetTPABounds(TPA);
// 4. Draw the box.
SMART_DrawBox(b);
end.

Cheers,
Le Jingle


So I assume that


2= TPA = array of Tpoint(the thing that we want from this function)
clMessage = Collor to search for
b.X1, b.Y1, b.X2, b.Y2 = The T box to search in?
5 = Coller tolerance?

3= With the smallest and largest point you create a box around all the Tpoints

Conclusion:
You estimate the coordinates of the box(1), you searched the object you want to have in the box(2) and concentrate the box to the minimun size around the object with the bound function(3)?:D

Please correct me:D

Le Jingle

2013-03-29 18:38:31

Well, targeting your conclusion;

1 = Defined Constants, for example, MCX1 represents a number (Integer) value in the SRL includes. So this isn't estimated, it's more defining the 4 values for the box to be that of the RS Chat box. (MCX1 = Main Chat X1, so the Actual rs screen would be along the pattern of, MSX1 = Main Screen X1)

2 = For the most part, the idea is correct. Specifically, however, we're looking for the color, clMessage (which refers to a black text color), and giving it a tolerance of 5. Each pixel that fits this info to search for, will be another addition into the TPA, or the array of TPoint. So again, yes you've pretty much found this step out.

3 = Again pretty much correct. GetTPABounds will look through the TPA collected (or array of TPoint collect) and find the lowest and highest that will give us a Box that encapsulates the entire TPA (even if we didn't get some points, the box is just to encase the entirety of all our TPoints)

Stanger

2013-03-30 07:31:10

Thanks alot Le Jingle I get it now:)