Log in

View Full Version : Crafting help



Footy
07-20-2012, 04:21 PM
Can someone quickly help me? I need to know how many ms are inbetween clicking on the make all Green D'hide bodies button, and whtn the inv is done crafting. I'd do it myself, but I dont have the req'd crafting level.

Runaway
07-20-2012, 04:42 PM
If you use something that will wait for a pixel change in your inventory, you don't need a static wait time. For example, I made a function that makes this fairly easy:


function WaitPixelShift(Time, Min, Tol: Integer; Box: TBox): Integer;
var
Color: array[0..1] of TIntegerArray;
hColor, Res, t, i: Integer;
begin
Result := 0;
Color[0] := GetColorsBox(Box.x1, Box.y1, Box.x2, Box.y2, False);
hColor := High(Color[0]);
MarkTime(t);
while (TimeFromMark(t) < Time) do
begin
Wait(100);
Color[1] := GetColorsBox(Box.x1, Box.y1, Box.x2, Box.y2, False);
Res := 0;
for i := 0 to hColor do
begin
if SimilarColors(Color[0][i], Color[1][i], Tol) then
Continue;
Inc(Res);
end;
if (Res > Min) then
begin
Result := Res;
Exit;
end;
end;
end;

function WaitPixelShiftEx(var Pixels: TIntegerArray; Time, Min, Tol: Integer; Box: TBox): Integer;
var
Color: array[0..1] of TIntegerArray;
hColor, Res, t, i: Integer;
begin
Result := 0;
if (Length(Pixels) = 0) then
begin
Color[0] := GetColorsBox(Box.x1, Box.y1, Box.x2, Box.y2, False);
Pixels := Color[0];
end else
Color[0] := Pixels;
hColor := High(Color[0]);
MarkTime(t);
while (TimeFromMark(t) < Time) do
begin
Wait(100);
Color[1] := GetColorsBox(Box.x1, Box.y1, Box.x2, Box.y2, False);
Res := 0;
for i := 0 to hColor do
begin
if SimilarColors(Color[0][i], Color[1][i], Tol) then
Continue;
Inc(Res);
end;
if (Res > Min) then
begin
Result := Res;
Exit;
end;
end;
end;


After clicking the craft-all option, you can do something like:


CraftAll;
if (WaitPixelShift(10 * 1000, 20, 1, InvBox(2)) <> 0) then
begin
while (WaitPixelShiftEx(Pixels, 1000, 20, 1, InvBox(28) = 0) do
begin
Wait(Random(500));
//Antiban;
//Whatever;
end;
Wait(500+Random(1000));
end else
//Failsafe;


It will wait for more than 25 of the pixels in the second inventory slot to change, and if they do then it will wait until the pixels in the last inventory slot change. Just a suggestion, hope it helps :)

litoris
07-20-2012, 05:54 PM
A simpler way would be to wait for the XP counter to change, I utilize that multiple times in my lumbridge script if you're interested.