SRL Archive - Help and Support

TBox?


FreakyMonkey

2008-05-05 21:15:39

Hey I've been looking through some scripts lately and have seen variables defined as "TBox". I have used the search feature on SRL to find a tutorial that teaches about TBoxes AND i have looked through the help function of SCAR and the SRL Manual (Neither of which give a good explanation[at least from what i saw]). Could someone plz give me a basic summary of what TBoxes do and how i could apply them?

Method

2008-05-05 22:14:35

As far as I know, a TBox is just two TPoints that form a box. Each of the inventory spots have one in SRL (see Inventory.scar, InvBox for details on how they're constructed). They're nothing too complicated once you understand how TPoints work since they're just two points linked to one variable.

Dan Cardin

2008-05-05 22:18:13

as far as i am aware, a Tbox is used when you are finding something in a specified box(havent scripted rs in a while, so forgot what they're called). Its bascially two tpoints, if i am correct :)

EDIT: for method-it would be 2 tpoints. 4 points on a rectangle = 2 tpoints :)

Method

2008-05-05 22:24:42

That's right. I was thinking you needed to specify four points, but SCAR fills in the other two for you once you give it two points to work with.

mixster

2008-05-06 02:18:25

Easiest way of explaining it I always thought of was a drag - click down that's x1,y1 then drag to wherever and you can see the box's area changing as you change where x2,y2 (the mouse) is. Anyway, you only need 2 points because it's simple enough to work it out the others (top right = x2,y1; bottom left = x1,y2). The FindColor series could very easily have accepted TBox's intsead of x1,y1,x2,y2, but you would have to define extra variables ;)

n3ss3s

2008-05-06 06:42:03

TBox is the same as when you find colors etc, it's just a variable for them.

Box.x1 :=..;
Box.y1 :=..;
Box.x2 :=..;
Box.y2 :=..;

If you use a TBox for the current color finding functions, which do not take TBoxes for input, but ints, you need to still do like
FindColor(X, Y, Z, Box.x1, Box.y1, Box.x2, Box.y2), so it might not always be worth it.

Other box defining methods you can see in the scar manual, which are IntToBox and PointToBox.

the scar noob

2008-05-06 14:48:08

From: n3ss3s
TBox is the same as when you find colors etc, it's just a variable for them.

Box.x1 :=..;
Box.y1 :=..;
Box.x2 :=..;
Box.y2 :=..;

If you use a TBox for the current color finding functions, which do not take TBoxes for input, but ints, you need to still do like
FindColor(X, Y, Z, Box.x1, Box.y1, Box.x2, Box.y2), so it might not always be worth it.

Other box defining methods you can see in the scar manual, which are IntToBox and PointToBox.


It's not a variable, it's a type, no? actually which pretty much holds a record like this:

program New;

type
TTbox = record
x1, y1, x2, y2: integer;
end;

var
MyTTBox: TTbox;

begin
MyTTBox.x1 := 0; // 0,0------------
MyTTbox.y1 := 0; // | | the window on RS
MyTTBox.x2 := 50;// | |
MyTTBox.y2 := 50;// |---------50,50
end.

-Tsn.

EDIT: I caleld it TTBox, because (ofcourse:p) TBox already excists:p

EDIT2:
From: n3ss3s

Other box defining methods you can see in the scar manual, which are IntToBox and PointToBox.

That aren't defining methods:) That are more like convertions like "IntToBox", you convert 4 integer coords to a box:)

Infantry001

2008-05-06 14:52:52

I gots a tutorial in the intermediate section, I think.

Here's the link:

Fun with TPoints, TBoxes, and more!

Bobarkinator

2008-05-06 16:17:56

From: the scar noob
It's not a variable, it's a type, no?


Please give a difference?

mixster

2008-05-06 16:22:11

A variable is an actual name to store a value (through pointers I believe as everything in Scar seems to be pointers according to random people) and a type is an outline for a set of variables that can be set via the types name :)

Bobarkinator

2008-05-06 16:50:59

From: mixster
A variable is an actual name to store a value (through pointers I believe as everything in Scar seems to be pointers according to random people) and a type is an outline for a set of variables that can be set via the types name :)


I guess…I was referring to that you declare them the same way.

FreakyMonkey

2008-05-06 18:24:54

aright thanks guys. and ill look through that tut infintry.