PDA

View Full Version : Request:Help. Differing between full inventory of item #1 or #2



acezfate
09-03-2014, 04:26 AM
Basically i am trying to get a script to determine if it has Blue Dragon hide in inventory or Blue dragon Leather.
Then, for it to determine either to bank or go to bank.
Basically a fail safe, Because sometimes if you disconnect with inventory of Leather it will sometimes attempt to run to tanner and tan then it just sits there for 40 seconds before logging off. or at times it will just run back to bank even though it has the hides, wasting time.
trying to push for efficiency.

the current method is.

function isLeatherInPack(): boolean;
var
i, x, y: integer;
begin
if result := not findColorTolerance(x, y, HideColor, tabBackpack.getBounds(), 1) then
writeln('Leather found in pack!');
end;

Before anyone asks.
This part of script thats originally Therossity's and with his permission,
I'm reworking the script, again to gain efficiency and increase Pp/h.

(Also not because lack of effort, for i have looked)
If anyone can point me in the direction of a Anti ban implementation guide would be much appreciated.
i have found anti bans but i cant seem figure out how to get them to work at the right times or make them work at all.

Another thing, does anyone that uses Click Preset 1 Function; Ever have it input the number "1" into chat once in a while after clicking Preset 1?

Ian
09-03-2014, 04:32 AM
Use DTMs or bitmaps to identify the items.

Brandon
09-03-2014, 05:40 AM
https://github.com/SRL/SRL-6/blob/2e655abf2b93b490c38c98e5b0b86cdd58f14d26/lib/interfaces/gametabs/backpack.simba#L806


Use that to count a specific item.. The inv is full usually if that item count is >= 28.. This is bad though because if you didn't withdraw 28, then checking for 28 would be a nightmare.. You should compare to how many you were able to withdraw.

What you could do is get the count for dhides and get the count for leather and also get the sum of both..

Ex (pseudo code):


start:

leather_count := backpack.countDTM(leatherDTM);
hide_count := backpack.countDTM(hideDTM);

if (leather_count >= amount_withdrawn) then
begin
//do something..
end else if (hide_count >= amount_withdrawn) then
begin
//do something else..
end else if (leather_count + hide_count >= amount_withdrawn) then
begin
//some leather & some hide.. keep doing w/e until the inv is full of only one.
goto start; //jmp/goto or use a loop.. but I'm too lazy to write one in this code.
end else
raise_exception(...); //unexpected error. terminate or handle..

Incurable
09-04-2014, 01:07 PM
I haven't done tanning in many years, is the item in the last slot always going to be an untanned hide? Because if so, could you do something like this?


if (backpack.isFull and dtmInSlot(dtmHide, 28)) then
doStuff;


I have no idea if that's even possible, but it's the first thing I thought of.

EDIT: Or even better, is it necessary to actually count the hides/etc at all? Why not just go straight to the bank, deposit everything, and start over? Eg:


// not tabBackpack.isEmpty() means you'll go to the bank no matter the item count
if (isLoggedIn() and not tabBackpack.isEmpty()) then
begin
WalkToBank();
Etc(); // Continue with the script
end;

sipfer3
09-04-2014, 01:15 PM
if u want to wait or check if the hides turned into leather u just could use
tabBackpack.waitSlotPixelChange(28,10000)

Lipcot
09-04-2014, 06:05 PM
if u want to wait or check if the hides turned into leather u just could use
tabBackpack.waitSlotPixelChange(28,10000)

i believe this one would be the best and easiest! if not, what incurable says is also a good idea