SRL Archive - SRL Archives

[Firemaking] 3 new functions


JPHamlett

2009-08-31 23:53:51





{*******************************************************************************
function WheresLogs : boolean;
By: J_pizzle
Description: Looks for logs in the inventory and returns x, y coords
*******************************************************************************}
function WheresLogs : boolean;
var
logsdtm , x, y : integer;
begin
logsDTM := DTMFromString('78DA63CC65626078C28002B2838DC0428C40F' +
'C1F0818CB806A1E30A00146241248A701D57C24A02616A8E62911' +
'E6DC21A0A608A8E6260135E540356FF0AB010024A90F23');
if finddtm(Logsdtm, x, y, MIX1, MIY1, MIX2, MIY2) then
writeln('Logs are located at ' + inttostr(x) + ' ' + inttostr(y))
else
writeln('No logs in the inventory');
end;

{*******************************************************************************
Function Havelogs : boolean;
By: J_pizzle
Description: Tells u if u have logs in the inventory
*******************************************************************************}

Function Havelogs : boolean;
var
logsdtm : integer;
begin
logsDTM := DTMFromString('78DA63CC65626078C28002B2838DC0428C40F' +
'C1F0818CB806A1E30A00146241248A701D57C24A02616A8E62911' +
'E6DC21A0A608A8E6260135E540356FF0AB010024A90F23');
result := finddtm(Logsdtm, x, y, MIX1, MIY1, MIX2, MIY2);
end;

{*******************************************************************************
Function HaveTinderbox : boolean;
By: J_pizzle
Description: Tells u if u have a tinderbox in the inventory
*******************************************************************************}

Function HaveTinderbox : boolean;
var
tinderdtm : integer;
begin
tinderDTM := DTMFromString('78DA63FCCEC0C090C8C8800C1C2D3918FE036' +
'990E87F20606402B2A251D54064612490FE09243209A8798D6917' +
'869ACF402284801A90E302F0AB0100379D0C8F');
result := finddtm(tinderdtm, x, y, MIX1, MIY1, MIX2, MIY2);
end;

i know that hanvetinderbox and have logs are reletivly the same thing but how else would they look lol and on my other thread everyone said that i should make it so that it sees if u have a tinder box so i did

Blumblebee

2009-08-31 23:59:20

bitmaps would be faster I think, but good job none the less. As for "WheresLogs" Why not make it search the inventory and save to an array the slots that have a log in them? Function WheresLogs: TIntegerArray; or something, allowing people to then bank/drop/call on or whatever the slots that hold the logs?

JPHamlett

2009-09-01 00:06:17

From: Blumblebee
bitmaps would be faster I think, but good job none the less. As for "WheresLogs" Why not make it search the inventory and save to an array the slots that have a log in them? Function WheresLogs: TIntegerArray; or something, allowing people to then bank/drop/call on or whatever the slots that hold the logs?



ya the bitmaps are to big though lol and ill try the thing for wheres logs

senrath

2009-09-01 00:06:22

I'd do WheresLogs like this:
{*******************************************************************************
function WheresLogs : array of TBox;
By: J_pizzle, modified by senrath
Description: Looks for logs in the inventory and returns an array of TBox
*******************************************************************************}
function WheresLogs : array of TBox;
var
logsDTM, I, x, y: integer;
Slot: TBox;
begin
logsDTM := DTMFromString('78DA63CC65626078C28002B2838DC0428C40F' +
'C1F0818CB806A1E30A00146241248A701D57C24A02616A8E62911' +
'E6DC21A0A608A8E6260135E540356FF0AB010024A90F23');
for I := 1 to 28 do
begin
Slot := InvBox(I);
if FindDTM(logsDTM, x, y, Slot.x1, Slot.y1, Slot.x2, Slot.y2) then
begin
SetArrayLength(Result, (Length(Result) + 1));
Result[High(Result)] := Slot;
end;
end;
FreeDTM(logsDTM);
end;

Nava2

2009-09-02 08:06:56

I'd do WheresLogs like:

function LogsPos: TIntegerArray;
var
x, y, i, d, l: Integer;
b: TBox;
begin
SetLength(Result, 28);
d := DTMFromString('');
for i := 1 to 28 do
if FindItemEx(x, y, 'dtm', d, InvBox(i)) then
begin
Result[l] := i;
Inc(l);
end;
FreeDTM(d);
SetLength(Result, l);
end;