NCDS
2010-02-10 17:40:27
To me boolean function should always be included when they can be. It just provides more options for failsafes.
Previous procedure:
My version:
Anyone else find this to be a good idea?
Previous procedure:
{*******************************************************************************
procedure TakeOff(I: Integer);
By: RsN
Description: UnEquips Item specified in i.
*******************************************************************************}
procedure TakeOff(I: Integer);
var
TP: TPoint;
begin
TP := EquipmentCoords(I);
if (WearingItem(I)) then
begin
Mouse(TP.x, TP.y, 5, 5, True);
Wait(200 + Random(350));
end;
end;
My version:
{*******************************************************************************
function TakeOff(I: Integer): Boolean;
By: RsN
Description: UnEquips Item specified in i. Returns True if successful.
*******************************************************************************}
function TakeOff(I: Integer): Boolean;
var
TP: TPoint; x, y, ii: Integer;
begin
if not WearingItem(i) then Exit;
TP := EquipmentCoords(I);
for ii := 0 to 4 do
begin
Mouse(TP.x, TP.y, 5, 5, True);
Wait(75 + Random(50));
Result := WaitColorGone(srl_outline_black, Point(tp.x - 8, tp.y - 8), Point(tp.x + 8, tp.y + 8), 0, 3000);
if Result then Exit;
end;
end;
Anyone else find this to be a good idea?