King of Knives
2007-11-05 15:35:56
I was about to make a script for something. Incidently the script involved door opening (If the door wasn't open already). The door-DTM I made was found a few other places on the screen, so I got an idea. Screen-Splitting.
So, what I made was a little procedure that divides the Main-screen up into smaller boxes, giving something similar to skipboxes. Along with the Screen-Splitter, there is a DTM finder, which will search all of the boxes for a DTM. If the DTM is found, it will hover over. If the specified uptext is found, it will exit the procedures, and if not, it will simply continue searching in the remaining boxes.
Give me a post. Why you you like it or not, what could be better, bugs, if any (I believe there shouldn't be any, though), and so on.
—-
Code:
Enjoy,
-Knives
So, what I made was a little procedure that divides the Main-screen up into smaller boxes, giving something similar to skipboxes. Along with the Screen-Splitter, there is a DTM finder, which will search all of the boxes for a DTM. If the DTM is found, it will hover over. If the specified uptext is found, it will exit the procedures, and if not, it will simply continue searching in the remaining boxes.
Give me a post. Why you you like it or not, what could be better, bugs, if any (I believe there shouldn't be any, though), and so on.
—-
Code:
Function SplitScreen(Px,Py: Integer): TBoxArray; // Px = Boxes on x-axis
var // Py = Boxes on y-axis
I,O,Dx,Dy,Xx,Xy,T: Integer;
Sx,Sy: TIntegerArray;
begin
SetArrayLength(Sx,Px+1)
SetArrayLength(Sy,Py+1)
SetArrayLength(Result,Px*Py)
Dx:= Round(511 / Px);
Dy:= Round(333 / Py);
Xx:= 511 Mod Dx;
Xy:= 333 Mod Dy;
for I:= 0 to Px-1 do
begin
Sx[I]:= 4+(I*Dx)
end;
Sx[Px]:= Sx[Px-1]+Dx+Xx-4;
for I:= 0 to Py-1 do
begin
Sy[I]:= 4+(I*Dy)
end;
Sy[Py]:= Sy[Py-1]+Dy+Xy-4;
for I:= 0 to Py-1 do
begin
for O:= 0 to Px-1 do
begin
Result[T].x1:= Sx[O];
Result[T].x2:= Sx[O+1];
Result[T].y1:= Sy[I];
Result[T].y2:= Sy[I+1];
T:= T + 1;
end;
end;
end;
Function FindDTMSSUpText(DTM: Integer; var a,b: Integer; UpText: String; SSBox: TBoxArray): Boolean;
var I: Integer;
begin
for I:= 0 to GetArrayLength(SSBox)-1 do
begin
if FindDTM(DTM,a,b,SSBox[I].x1,SSBox[I].y1,SSBox[I].x2,SSBox[I].y2) then
begin
MMouse(a,b,0,0)
Wait(200+random(200))
if IsUpText(UpText) then
begin
GetMousePos(a,b)
Result:= True;
Exit;
end;
end;
end;
end;
var a,b,Door: integer;
begin
ClearDebug;
SetupSRL;
Door := DTMFromString('78DA633465646088644001539A92193480342' +
'394CF68016445A0AAE9AD894555E380A9A6AB3206558D1B116ACC' +
'81AC3854354B27E6A3AAB1C154B3B83F17558D3DA69ABAFC10543' +
'5EE4498E30A6445E3F73B00B3471410');
ScreenBoxes:= SplitScreen(5,10)
if FindDTMSSUpText(Door,a,b,'pen',ScreenBoxes) then
begin
Mouse(a,b,0,0,true)
end;
FreeDTM(Door)
end.Enjoy,
-Knives