SRL Archive - Help and Support

FindAxe ?


tylanbo

2007-11-01 18:36:05

I used the FindAxe procedure to make sure that axes were in my inventory during the randoms check. I said:

if not FindAxe then
… statements …

My purpose was that if it did not find axes it would return false and then I would log out my player, well…

it didn't work. I looked over the procedure and saw something odd.


function FindAxe: Boolean;
var
InvAxe, WieldAxe, Ix, Iy, i: Integer;
dtmAxes: array[0..6] of Integer;
begin
if LoggedIn then
begin
GameTab(4);
dtmAxes[1] := DTMFromString('78DA639CCEC4C0F09401051485F1318800694' +
'620FE0F048C4B806AEEA2AA718E4864E082AA0101C6C54035F751' +
'D5D887C6A1AA590A547313558D4B740A8A1A00CFA10E03'); //rune
dtmAxes[2] := DTMFromString('78DA6374606060686440014D497C0C22409A1' +
'188FF0301A337905187AAC6C6D786810BAA0604187D804415AA1A' +
'7B7F7B5435BE40A21C558D73B0338A1A00C1660AA8'); //addy
dtmAxes[3] := DTMFromString('78DA633CC4C4C010C0C8800C5A53F81852803' +
'448F43F10309E05AAF14155636111CCC0055503028CE7816A5C51' +
'D5D839C4A2AA3981A9C6C52D0D450D0061FC0C64'); //mith
dtmAxes[4] := DTMFromString('78DA63CC636260D8C3C8800C5A53F81852803' +
'448F43F10305602D5EC4055939B9ACAC0055503028CD540351B51' +
'D594E5E5A2AA29C154D3545989A20600C3BC0E32'); //steel
dtmAxes[5] := DTMFromString('78DA63BCC9C4C0309191010498182020C6859' +
'34103488344FF0301E353A04C2F230332F0707161E082AA0101C6' +
'0740356DA86A22838351D5BC00AAE94655932ACA89AAE639A6394' +
'1DEDE286A00B1F90F6D'); //iron
dtmAxes[6] := DTMFromString('78DA63EC626060086140016DA97C0C22409A1' +
'188FF0301E33420C307558D97A5220317540D08304E051201A86A' +
'DCCCE451D54C07129EA86AFC6C5450D40000D77E0AA2'); //bronze
GameTab(5);
for WieldAxe := 1 to 7 do
begin
if(WieldAxe = 7)then
Break;
if(FindDtm(dtmAxes[WieldAxe], Ix, Iy, MIX1, MIY1, MIX2, MIY2))then
Break;
end;
GameTab(4);
for InvAxe := 1 to 7 do
begin
if(InvAxe = 7)then
Break;
if(FindDtm(dtmAxes[InvAxe], Ix, Iy, MIX1, MIY1, MIX2, MIY2))then
Break;
end;

if(InvAxe = 7)and(WieldAxe = 7)then
begin
Result := False;
Writeln('No axe was found.');
for i := 0 to 6 do
FreeDtm(dtmAxes[i]);
Exit;
end;
if((InvAxe - WieldAxe) < 0)then
EquipAxe := False
else
EquipAxe := True;
case Min(WieldAxe, InvAxe) of
1: WriteLn('Using Rune axe');
2: WriteLn('Using Addy axe');
3: WriteLn('Using Mith axe');
4: WriteLn('Using Steel axe');
5: WriteLn('Using Iron axe');
6: WriteLn('Using Bronze axe');
end;
Result := True;
for i := 0 to 6 do
FreeDtm(dtmAxes[i]);
end;
end;

If you can see, before the free dtm loop it says "Result:= True;" which I believe means it will ALWAYS return a true. That would explain why my antirandom triggered improperly. If I am wrong please tell me, if I am right please fix this function ASAP.

Method

2007-11-01 19:11:39

    if(InvAxe = 7)and(WieldAxe = 7)then
begin
Result := False;
Writeln('No axe was found.');
for i := 0 to 6 do
FreeDtm(dtmAxes[i]);
Exit;
end;

That means if it doesn't find an axe it will first free the DTMs then Exit the procedure. So it shouldn't always return false.

tylanbo

2007-11-01 19:32:02

From: Metho D
    if(InvAxe = 7)and(WieldAxe = 7)then
begin
Result := False;
Writeln('No axe was found.');
for i := 0 to 6 do
FreeDtm(dtmAxes[i]);
Exit;
end;

That means if it doesn't find an axe it will first free the DTMs then Exit the procedure. So it shouldn't always return false.


Alright, I missed the Exit; I suppose I have some debugging to do on my script since the function is working correctly. Thanks for the help.

rogeruk

2007-11-02 09:06:01

The SRL FindAxe didn't work for me in SRL4. It kept on saying i didn't have an axe when i did.

So i just checked for the broken axe dtm.

Method

2007-11-02 10:08:20

From: n3ss3s
NOOOOO! STOP THE FINDAXES!
(caps was purposely)

JaGeX made the update wcaxe head does not fall off anymore!


I'm glad you actually read the topic and then therefore assumed we were talking about axe heads falling off instead of, oh, finding an axe in your inventory or equipment tab.

Markus

2007-11-02 11:02:22

Well, FindAxe was ment for checking if the axe head was gone…

tylanbo

2007-11-02 17:36:06

From: Markus
Well, FindAxe was ment for checking if the axe head was gone…


Well that would make a lot more sense, I assume I can fix the problem by checking for axe dtm with max col tolerance.

Sorry for the confusion over axe head and finding axe in the inventory.