SRL Archive - OSR Help

Tbox and TpointArray uses?


Swatarianess

2011-12-29 11:42:15

so i got these points and want to turn them into boxes but how? i used stand how to use them i dont know how to write it tho :(



--Slot 3--
//Buy
360, 130, 400, 170
//Sell
420, 130, 470, 170
//Bar
350, 160, 480, 180

--Slot 4--
//Buy
50, 250, 100, 290
//Sell
110, 250, 160, 290
//Bar
40, 280, 160, 300

--Slot 5--
//Buy
200, 250, 250, 290
//Sell
270, 250, 310, 290
//Bar
200, 280, 320, 300

--Slot 6--
//Buy
360, 250, 400, 290
//Sell
430, 250, 470, 290
//Bar
350, 280, 480, 300

for GE script was wondering how'd u put it into Boxes :/ heres what i came up with and stuck now



program GEboxes;
{$i srl/srl.scar}
var
Slot1, Slot2, Slot3, Slot4, Slot5, Slot6 :TBox;

Slot3pTl, Slot4pTl, Slot5pTl, Slot6pTl,
Slot3Br, Slot4Br, Slot5CBr, Slot6Br :TPoint;

Procedure SetupSlots;
begin

//-------------Buying Box--------------\\
Slot3pTl:=(360,130); //360, 130, 400, 170 < Both Tl and Br
Slot4pTl:=(50,250); //50, 250, 100, 290 ^sme
Slot5pTl:=(200,250); //200, 250, 250, 290 ^sme
Slot6pTl:=(360,250); //360, 250, 400, 290 ^sme
//---------------------------------------\\
Slot3Br:=(400,170);
Slot4Br:=(100,290);
Slot5Br:=(250,290);
Slot6Br:=(400,290);
{\\=======================================//}

Slot3:= PointToBox(Slot3pTL,SLot3Br);
Slot4:= PointToBox(Slot4pTl,Slot4Br);
Slot5:= PointToBox(Slot5pTl,Slot5Br);
Slot6:= PointToBox(Slot6pTl,Slot6Br);

end;

Procedure SetupSlots2;
begin
var
SellingBox1, SellingBox2, SellingBox3, SellingBox4,
SellingBox5, SellingBox6 :TPointArray;

// Or i think you can do it like this

//-------------Selling Box--------------\\
SellingBox1 := [((x,y),(x,y)),((x,y),(x,y))]



end;

begin
SetupSRL;

end.

just wanted to help some1 but no idea how to do it >.< also with this i'll probably make a "Sensor" test so if mouse goes into the box then its like "Your mouse is on the Buy Bag" or w.e :/

RISK

2011-12-29 11:49:28

IntToBox().

Swatarianess

2011-12-29 11:54:20

From: RISK
IntToBox().



:duh: >.<

lawl cheers imma try it out any ideas on the Sensor? maybe like


if(getmouspos(x,y)) then
begin
writeln('We are in!')
end;


would that work for this type of Box? or



for := 0 to BoxCord.y do //?
if(Getmousepos(PointInBox(x,Boxcord))) then
begin
end;
// or something similar :/


RISK

2011-12-29 11:57:55

This is a rough example, but:
procedure Example;
var
X, Y: Integer;
P: TPoint;
B: TBox;
begin
B := IntToBox(100, 150, 100, 200);
GetMousePos(X, Y);
P.X := X;
P.Y := Y;

if (PointInBox(P, B)) then
WriteLn('The point is in the box.');
end;

Swatarianess

2011-12-29 12:09:47

From: RISK
This is a rough example, but:
procedure Example;
var
X, Y: Integer;
P: TPoint;
B: TBox;
begin
B := IntToBox(100, 150, 100, 200);
GetMousePos(X, Y);
P.X := X;
P.Y := Y;

if (PointInBox(P, B)) then
WriteLn('The point is in the box.');
end;



kk thanks love you :D :spot: gonna make some mad ass boxes :p

ps. No homo

~bro433

RISK

2011-12-29 12:11:09

You're welcome. :p I'm always happy to help.

wantonman

2011-12-31 22:28:22

i like your example but it doesn't write the line…


I'M trying to learn how to GetMousePos and search from there out but within a Tbox:

so GetMousePos, Search in Tbox for a color… I believe this is the example i need may i ask you to please Elaborate some more, it would be soo helpful!! Please Thanks :spot:

RISK

2011-12-31 23:01:03

There is probably a better way, but:
procedure Example;
var // These are local variables that are used only in this procedure
X, Y: Integer;
P: TPoint;
B: TBox;
begin
B := IntToBox(100, 200, 300, 400); // Defines the box's corners
GetMousePos(X, Y); // Gets the current mouse position and stores the X and Y values in to the X and Y integers
P.X := X; // Makes our point's X value to be the integer "X" we got from GetMousePos
P.Y := Y; // Makes out point's Y value to the be integer "Y" we got from GetMousePos

if (PointInBox(P, B)) then // If the mouse is in the box do:
if (FindColor(X, Y, COLOR, B.X1, B.Y1, B.X2, B.Y2)) then // If the color is in the box do:
WriteLn('Success.'); // Writes the line "Success" in the debug of Simba
end;

You should just PM me next time. :)

Swatarianess

2012-01-01 03:54:43

also heres what i came up with but gonna change it and instead of listing so many different variables for Buybag,SellBag,ProgressBar i'm just gonna make 1 for each and use;

Case condition of
end;

Should work nicely? heres what i have atm make a thread but got no posts -.- just 24views

heres what i got so far >.<


program GEBoxCheck;
{$i srl/srl.scar}

{*******************************************************************************
Procedure WBPointAt;
by: Inf3cti0us with help from RISK
Description:BB# = BuyBag(Slot #) SB# = SellBag(slot #) S#B = Slot(numb #)Bar
it identifies which Slot you are in and what icon you are on as a test ;)
*******************************************************************************}
procedure WBPointAt;
var
{// Some Variables which dont need to be touched either \\}
X, Y: Integer;
P: TPoint;
BB1, BB2, BB3, BB4, BB5, BB6,
SB1, SB2, SB3, SB4, SB5, SB6,
S1B, S2B, S3B, S4B, S5B, S6B: TBox;

begin
{// No Need to change anything to do with these settings they are good \\ }
BB1 := IntToBox(49, 125, 95, 170); SB1 := IntToBox(110, 125, 157, 172);
BB2 := InttoBox(203, 127, 250, 171); SB2 := IntToBox(266, 127, 313, 171);
BB3 := IntToBox(360, 130, 400, 170); SB3 := IntToBox(420, 130, 470, 170);
BB4 := IntToBox(50, 250, 100, 290); SB4 := IntToBox(110, 250, 160, 290);
BB5 := IntToBox(200, 250, 250, 290); SB5 := IntToBox(270, 250, 310, 290);
BB6 := IntTobox(360, 250, 400, 290); SB6 := IntToBox(430, 250, 470, 290);

S1B := IntToBox(41, 163, 166, 177);
S2B := IntToBox(197, 163, 322, 177);
S3B := IntToBox(350, 160, 480, 180);
S4B := IntToBox(40, 280, 160, 300);
S5B := IntToBox(200, 280, 320, 300);
S6B := IntToBox(350, 280, 480, 300);

GetMousePos(X, Y);
P.X := X;
P.Y := Y;

if (PointInBox(P,BB1)) then // If you change BB1 to any BB#/SB#/S#B then should change what it does
begin;
WriteLn('The point is in the Buying Bag Slot1'); // If you are hovering the Buying bag or w.e it will say this
// WriteLn('');
wait(randomrange(500,700))
end else
// WriteLn('');
writeln('The point is not in the Buying Bag in Slot 1!');// If you arent hovering the Buying bag or w.e it will say this

if(PointInBox(P,SB1)) then
begin;
WriteLn('The point is in the Selling Bag Slot 1'); // If you hover the Selling bag or w.e it will say this
wait(randomrange(500,700))
end else

writeln('The point is not in the Selling Bag in Slot 1!')
end;

begin
SetupSRL;
ClearDebug;
wait(randomrange(3000,5000))
WBPointAt;
end.

fre

2012-02-08 13:25:41

This definetly is very usefull.
The GE box coord should be implemented in SRL as const imo.

Good Job