RSPS FullInv+Drop Procedure Help
Hey guys, I'm struggling to create a procedure which will stop woodcutting when my inventory is full, then drop all the logs and continue to Woodcut again.
At the minute I've created a script which clicks the willow tree, waits 15 seconds and clicks the same, or another tree. (I did this so if the tree has been cut down, it'll click another when 15 seconds has passed, but it will click the same tree again if it hasn't been cut down. If anyone knows a better system to see if a tree has been cut, please share).
You can also see from the script that I attempted to create a procedure that when a log is placed in the last slot of my inventory, it will move the mouse to it. Unfortunately this isn't working. I tried with both DTM and a Bitmap of the Willow Log, but it doesn't work.
So if anyone has any suggestions of how I can create a procedure to stop when my Inventory is full, and then drop the logs, it would be appreciated.
Note - This script is for a private server.
Code:
program AutoColor;
{$i SRL\SRL.simba}
var
x, y, ChopDown, WillowLog, WillowBit:Integer;
function TreeColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.09, 0.15);
if not (FindColorsTolerance(arP, 4023404, MSX1, MSY1, MSX2, MSY2, 6)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
procedure WillowColor;
begin
WriteLn('Test.');
If FindColorTolerance(x, y, TreeColor, MSX1, MSY1, MSX2, MSY2, 5) then
begin
Case random (2) Of
0: begin
MMouse(x, y, 3, 3);
ClickMouse(x, y, 1);
Wait(15000+random(2000));
end;
1: begin
Mouse(x, y, 3, 3, false);
If FindBitmapToleranceIn(ChopDown, x, y, MSX1, MSY1, MSX2, MSY2, 5) then
begin
Wait(500+random(200));
Mouse(x, y, 3, 4, true)
end;
end;
end;
end;
end;
Procedure LastWillow;
begin
WriteLn('Test2');
If FindBitmapToleranceIn(WillowBit, x, y, 696, 434, 729, 460, 15) then
//If FindDTM(WillowLog, x, y, 695, 433, 736, 460) then
begin
Mouse(x, y, 5, 5, False);
WriteLn('Cut the last Willow.');
end;
end;
begin
ChopDown := BitmapFromString(115, 6, 'meJzNk1EKwCAIhr1dF9hr9z/GBg' +
'oif2pGBRMf1G3+9tna09vTXzYiapyqR/VTfrs/SxArkFuROKrvD5a' +
'DVYseVepJZ9V1v03SZLwRozIEaEQOTHhHUrsFWMqYFsHyYHgiGalS' +
'j+Ss7rTnmEbjJWBtULyxGtvtRPCBYQ7WHhYgFOMjPYVbvgtPbg52M' +
'3Z/hCLYzXi/J9iK3F2w4NF5bfA3sHotl+RcAmKnwOqyLNgPQNL5Cg==');
WillowLog := DTMFromString('mAAEAAHic42FgYPBiYmAIAuJwKA3CIDFHILYFYksgtgJiZyD2BuJnQD1vgPg5ED8E4ltAfBuI7wDxAyB+CpX/CMTvgNjTSQpIMpKASQOkmIxuOgA6PQ78');
WillowBit := BitmapFromString(14, 8, 'meJyT9w2TR0aB0fJoImAk4xkEkoI' +
'jbGqwqMStDIjE7VyR1YiYWItbOoKQnSsESTl5gpCrHxBBpXArANoL' +
'QVBBZARWgKwG5EiwUwkiiNvs0grgTsWjDIgAMq9QJw==');
SetupSRL;
ClearDebug;
repeat
WillowColor;
LastWillow;
until(false);
FreeBitmap(ChopDown);
FreeDTM(WillowLog);
FreeBitmap(WillowBit);
end.