Incurable
2014-10-24 13:57:57
Hi,
Working on my competition script (else I'd post the whole thing) and for some reason bankScreen.isOpen is failing. I've commented where I think the issue is, but I don't think that what I've tried to do has had any success. The script will do 20+ trips back and forth, and randomly fail eventually. I've debugged with screenshots and the bank is always open when it fails.
Here's the appropriate debug, I stopped the script manually at that point. Note that the bankScreen is open the entire time this happens.
As far as I can tell the script clicks on the bank to open it, returns true, waits while the player is moving, then looks for the bank again, but can't find it because the bankScreen is open. Why is it not successfully checking that it's open every time? Bah!
Sorry if I repeated myself, I'm very tired. :p
Thanks.
EDIT: The exact same thing occurrs with this simplified function:
Working on my competition script (else I'd post the whole thing) and for some reason bankScreen.isOpen is failing. I've commented where I think the issue is, but I don't think that what I've tried to do has had any success. The script will do 20+ trips back and forth, and randomly fail eventually. I've debugged with screenshots and the bank is always open when it fails.
function useBank(): boolean;
var
waitTimer: TTimeMarker;
begin
writeLn('DEBUG: useBank()');
if (not isLoggedIn()) then exit();
waitTimer.start();
while (waitTimer.getTime() < randomRange(20000, 30000) and (not result)) do
begin
bankScreen.open(BANK_CHEST_LUMBRIDGE);
minimap.waitPlayerMoving(); // I think that the script isn't waiting long enough while moving
wait(gaussRangeInt(1200, 1500)); // which is why I added this line here... different times (2-3kms+), same issue
result := bankScreen.isOpen(gaussRangeInt(8000, 12000)); // Added waitTime here just to see wtf would happen, no idea
// if I shouldn't do it or not
if (result) then
begin
writeLn('DEBUG: useBank result = true, clicking preset');
wait(gaussRangeInt(150, 350));
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
wait(gaussRangeInt(150, 350));
end;
end;
end; Here's the appropriate debug, I stopped the script manually at that point. Note that the bankScreen is open the entire time this happens.
DEBUG: useBank()
-- TRSBankscreen.__openChest()
---- isMouseOverText()
------ Current mouse-over text: "Use Bank chest"
------ Found "Use Bank" in mouse-over string: "Use Bank chest"
---- isMouseOverText(): True
---- Succesfully opened the bank
-- TRSBankscreen.__openChest() result = true
---- Waiting while the player is moving...
-- TRSBankscreen.__openChest()
---- ERROR: Failed to find enough chest colors [1 4, 2 10 ]
-- TRSBankscreen.__openChest(): result = false
---- Waiting while the player is moving...
As far as I can tell the script clicks on the bank to open it, returns true, waits while the player is moving, then looks for the bank again, but can't find it because the bankScreen is open. Why is it not successfully checking that it's open every time? Bah!
Sorry if I repeated myself, I'm very tired. :p
Thanks.
EDIT: The exact same thing occurrs with this simplified function:
function useBank(): boolean;
begin
if (not isLoggedIn()) then exit();
bankScreen.open(BANK_CHEST_LUMBRIDGE);
minimap.waitPlayerMoving();
result := bankScreen.isOpen(gaussRangeInt(8000, 12000));
if (result) then
begin
wait(gaussRangeInt(150, 350));
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
wait(gaussRangeInt(150, 350));
end;
end;