SRL Archive - OSR Help

Needing help with Powerminer:


Yush Dragon

2010-07-28 07:27:45

hai guys,

my problem is that if the power miner still mines after the inventory is full.

and that it doesn't drop ores at all.

function DropOres: Boolean;
begin
if InvFull then
begin
Writeln('Inventory is full!');
if Players[CurrentPlayer].Booleans[0] then
DropAll
else
DropAllExcept([1]);
end;
Result := True;
Inc(Loads);
end;

function MineRockType: Boolean;
var
PlayerRock: TRock;
T: Integer;
begin

PlayerRock := GetRockType;

x := MSCX;
y := MSCY;

SetAngle(True);
repeat
Amount := InvCount;
if FindColorSpiralTolerance(x, y, PlayerRock.Color, MSX1, MSY1, MSX2, MSY2, 5) then
begin
MMouse(x, y, 2, 2);
if WaitUptext(PlayerRock.Uptext, 200) then
begin
Writeln('Found ' +PlayerRock.Name+ ' rock!');
GetMousePos(x, y);
Wait(500 + Random(150));
Mouse(x, y, 0, 0, True);
MarkTime(T);
while (TimeFromMark(T) < 3000 + Random(500)) do
begin
Wait(500);
if ((InvCount <> Amount) or (InvFull)) then
Break;
end;
if InvCount <> Amount then
begin
AntiBan;
Writeln('Mined a ' +PlayerRock.Name+ ' ore(maybe a gem)!');
Inc(Ore);
Result := True;
end else
begin
Writeln('We did not mine a ' +PlayerRock.Name+ ' ore or gem.');
Writeln('Inventory could be full!');
Result := True;
Exit;
end;
end else
begin
Writeln('Did not found uptext of the: ' +PlayerRock.Name+ ' rock.');
LogOut;
TerminateScript;
end;
end else
begin
Writeln('Did not found: ' +PlayerRock.Name+ ' rock.');
LogOut;
TerminateScript;
end;
until(InvFull) or (Result);
end;

any help?

EvilChicken!

2010-07-28 08:41:14

function DropOres: Boolean;
begin
if (InvFull) then
begin
Writeln('Inventory is full!');
DropAllExcept([Integer(Players[CurrentPlayer].Booleans[0])]); // That SHOULD work.
end;
Result := True;
Inc(Loads);
end;

function ClickRock: Boolean;
var
X, Y: Integer;
begin
Result := False;
X := MSCX; Y := MSCY;
if (FindColorSpiralTolerance(X, Y, PlayerRock.Color, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
MMouse(X, Y, 5, 5);
if (WaitUptext(PlayerRock.Uptext, 200)) then
begin
Writeln(TheTime + ': Found ' + PlayerRock.Name + ' rock!');
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
Result := True;
end;
end;
end;

function MineRockType: Boolean;
var
PlayerRock: TRock;
T: Integer;
begin
Result := False;
if (LoggedIn) or (InvFull) then exit;
PlayerRock := GetRockType;
// SetAngle(True); // Should only need this once, at startup?
repeat
Amount := InvCount;
if (ClickRock) then
begin
MarkTime(T);
while ((TimeFromMark(T) < 3000 + Random(500)) and (not Result)) do
begin
Wait(100 + Random(400));
Result := (InvCount <> Amount);
end;
if (Result) then
begin
AntiBan;
Writeln('Mined a ' +PlayerRock.Name+ ' ore(maybe a gem)!');
Inc(Ore);
DropOres;
end else
begin
Writeln('We did not mine a ' + PlayerRock.Name + ' ore or gem.');
Writeln('Inventory could be full!');
Result := True;
Exit;
end;
end else
begin
Writeln('Did not found: ' +PlayerRock.Name+ ' rock.');
LogOut;
TerminateScript;
end;
until(InvFull) or (Result);
end;

^This should work, I can't compile it as I don't have the record ect.
I often find it helpful to split large procedures into much smaller ones that each preforms their subroutines instead of having a single massive procedure/function.