SRL Archive - RS3 Help

TBox Question


Clutch

2015-03-08 21:58:41

Quick question this may be very simple.
createaccButton := intToBox(269,527,532,547); // Is this just creating a variable for the TBox which it is using below? Ex. Now that it's declared if I need to use it again I use what is below?
mouseBox(createaccButton, MOUSE_LEFT);
wait(3000);

random code doing whatever go back to process
mouseBox(createaccButton, MOUSE_LEFT); // this probably makes no sense but basically to the left would be code to do whatever in the script and then instead of doing what I did above I can just call on the mousebox again for that TBox variable correct?

riwu

2015-03-08 22:04:47

not really sure what u are asking, but ur code seems right.
u could also call MouseBox(IntToBox(…), MOUSE_LEFT) directly unless the box is used multiple times

KeepBotting

2015-03-08 22:06:30

From: OzoneClutch
Quick question this may be very simple.
createaccButton := intToBox(269,527,532,547); // Is this just creating a variable for the TBox which it is using below? Ex. Now that it's declared if I need to use it again I use what is below?
mouseBox(createAccButton, MOUSE_LEFT);
wait(3000);

random code doing whatever go back to process
mouseBox(createaccButton, MOUSE_LEFT); // this probably makes no sense but basically to the left would be code to do whatever in the script and then instead of doing what I did above I can just call on the mousebox again for that TBox variable correct?


Depends on the scope of the variable.

createaccButton := intToBox(269,527,532,547); 
Does not create the variable,
var
createAccButton:TBox;
does.

intToBox() accepts xs, ys, xe, ye parameters and spits out a TBox (which is the practical usage of xs, ye, xe, ye)

Now for a quick explanation about scope … read though the first part of this post: https://villavu.com/forum/showthread.php?t=109916&p=1305181#post1305181

If createAccButton is a global TBox, it can be accessed anywhere without having to declare it again or even assign it a value.

If it's local, it can only be accessed by the routine in which it was declared.

e.g.


program new;

procedure someProcedure();
var
someLocalVariable:integer;
begin
writeln(someLocalVariable); //works
end;

procedure someOtherProcedure();
begin
writeln(someLocalVariable); //does not work
end;

begin
end.

and…


program new;

var
someGlobalVariable:integer;

procedure someProcedure();
begin
writeln(someGlobalVariable); //works
end;

procedure someOtherProcedure();
begin
writeln(someGlobalVariable); //also works
end.

begin
end.

Clutch

2015-03-08 22:11:38

@KeepBotting;

That's not what I said but what I meant, used the wrong terminology it wasn't a variable but depicting what the value was for that TBox. Thanks for the clarification.

@riwu;
From: riwu
not really sure what u are asking, but ur code seems right.
u could also call MouseBox(IntToBox(…), MOUSE_LEFT) directly unless the box is used multiple times


Yes that is what I had done on my script, I just started out with the above and as I am learning am trying to put 2 and 2 together so that it = 4 not some other number :P