Spaceblow
2014-08-05 21:15:01
I'm making a simple script but I really don't know what I'm doing wrong here. So far I made a procedure that probably isn't even finished yet. This is what I have so far:
Its purpose is to open the bank, deposit an inventory full of redberries, close the bank and check if the backpack is empty. Everything runs very well when I test it out with a bunch of logs until it meets 'tabBackpack.isEmpty()'. Instead of checking if my backpack is empty it just clicks on the gear tab (this window pops up). Sometimes it moves the mouse over this for a second and then clicks on the gear tab. I really don't know why. I literally ran it like maybe 50 times and only once it did everything it had to do.
Maybe the debug could tell you more about my problem:
I hope you guys could help me because stuff like this discourages me to make my first script, it's very frustrating… Thanks in advance!
procedure bankRedberries();
var
bankTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
bankScreen.open(BANK_NPC_BLUE);
wait(randomRange(750, 1250));
if bankScreen.isOpen() then
begin
bankTimer.start();
writeLn('Succesfully opened the bank');
repeat
begin
wait(randomRange(600, 900));
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(randomRange(600, 900));
bankScreen.close();
writeLn('Succesfully closed the bank');
end;
until(tabBackpack.isEmpty()) or (not isLoggedIn()) or (bankTimer.getTime() > 7000);
if tabBackpack.isEmpty() then
writeLn('Succesfully banked Redberries');
end;
end; Its purpose is to open the bank, deposit an inventory full of redberries, close the bank and check if the backpack is empty. Everything runs very well when I test it out with a bunch of logs until it meets 'tabBackpack.isEmpty()'. Instead of checking if my backpack is empty it just clicks on the gear tab (this window pops up). Sometimes it moves the mouse over this for a second and then clicks on the gear tab. I really don't know why. I literally ran it like maybe 50 times and only once it did everything it had to do.
Maybe the debug could tell you more about my problem:
-- setupSRL()
---- Setting up SRL...
---- initSmart():
------ Attempting to pair to a previously spawned client
------ smartPairToExistingClient():
-------- Found 1 free client(s), attempting to pair to one...
---------- smartSetAsTarget(): Succesfully set SMART[4660] as Simba's target
-------- Succesfully paired to a existing client, SMART[4660]
------ smartPairToExistingClient(): result = true
------ Succesfully initialized via pairing to a previously spawned client
---- initSmart()
------ smartSetupDrawing(): Succesfully setup SMART drawing
---- Waiting up to 5 minutes for RS to load...
------ TRSActionBar.__findButton(): Found the actionbar button @ {X = 566, Y = 397}
------ TRSActionBar.__find(): result = true (height = 75)
------ Dynamic interfaces have been set.
---- Client is ready.
---- Setup SRL in 202ms.
-- setupSRL(): True
-- TRSBankscreen.__openNPC()
---- TRSMinimap.getDots()
------ Found 13 minimap dots (ID: 4369)
---- TRSMinimap.getDots(): [{X = 676, Y = 48}, {X = 659, Y = 94}, {X = 664, Y = 109}, {X = 702, Y = 115}, {X = 663, Y = 118}, {X = 700, Y = 119}, {X = 758, Y = 119}, {X = 697, Y = 122}, {X = 694, Y = 126}, {X = 692, Y = 129}, {X = 744, Y = 130}, {X = 609, Y = 133}, {X = 689, Y = 133}]
---- isMouseOverText()
------ Current mouse-over text: ""
------ Current mouse-over text: "Bank Banker"
------ Found "Bank" in mouse-over string: "Bank Banker"
---- isMouseOverText(): True
---- We found correct mouse-over text
---- Bankscreen or pinscreen is open
-- TRSBankscreen.__openNPC(): result = True
Succesfully opened the bank
---- bankScreen.quickDeposit(): Clicked quick deposit id 0
Succesfully closed the bank
---- TRSGameTab.__initTabs(): Setup gametab properties
-- TRSGameTabs.openTab(2)
---- Opening tab via gametab navigation bar
-- TRSGameTabs.openTab(2): result = False
-- TRSGameTabs.openTab(2)
---- Opening tab via gametab navigation bar
-- TRSGameTabs.openTab(2): result = False
-- Succesfully freed SMART[4660]
-- Freeing gametabs bitmaps...
Successfully executed.
I hope you guys could help me because stuff like this discourages me to make my first script, it's very frustrating… Thanks in advance!