SRL Archive - RS3 Help

Need help detecting item in inventory.


Greytor

2015-01-17 01:33:04

Hi guys, I need some help with my script, I need it to detect that if an item is not in my backpack, it will open the bank and withdraw it.
I have to part for the withdrawing working,but if my item is in my inventory it will still open the bank which is not what I want it to do.

Here is the code:
if not findDTM(SticksDTM, x, y, tabBackPack.getBounds()) then // If there is no stick in inventory open bank.
begin
bankScreen.open(BANK_BOOTH); // Open then bank
wait(randomRange(1000, 3000));
findDTM(SticksDTM, x, y, bankScreen.getBounds());
mouse(x, y, 3, 3, MOUSE_MOVE);
wait(randomRange(500, 700));
if isMouseOverText(['Withdraw']) then
begin
fastClick(MOUSE_RIGHT);
wait(RandomRange(500, 1000));
chooseOption.select(['All Tra']);
end;
bankScreen.close(); // Close the bank
end else
FreeDTM(SticksDTM);
end;

Im pretty sure it has to do with the tabBackPack.getBoundds that I use,but I am not sure about it,hopefully you guys can help me.

The Mayor

2015-01-17 01:51:30

This is a bit cleaner. You can use the withdraw overload which takes a DTM as the first parameter:


procedure checkStick();
var
x, y: Integer;
sticksDTM: Integer := DTMFromString('abcdefg');
begin
if findDTM(sticksDTM, x, y, tabBackPack.getBounds()) then
begin
writeLn('Found the stick, better exit!');
exit();
end;

if bankScreen.open(BANK_BOOTH) then
if bankScreen.withdraw(sticksDTM, WITHDRAW_AMOUNT_ALL) then
begin
writeLn('Withdrew the sticks');
bankScreen.close();
end;

freeDTM(sticksDTM);
end;

If that doesn't work, then you have a bad DTM, and you should make a new one.

Greytor

2015-01-17 02:20:35

Thanks that worked perfectly,had to redo my DTM, but now it is working perfectly, thanks again.