jiggerjaw Posted March 4, 2017 Posted March 4, 2017 Entity bank = objects.closest("Bank booth"); bank.interact("Bank"); sleep(random(100)); getBank().depositAll(); I've imported bank, this doesnt work?
Essaint Posted March 4, 2017 Posted March 4, 2017 5 minutes ago, jiggerjaw said: Entity bank = objects.closest("Bank booth"); bank.interact("Bank"); sleep(random(100)); getBank().depositAll(); I've imported bank, this doesnt work? Not every location has a bank booth.
Hel Posted March 4, 2017 Posted March 4, 2017 (edited) Bank booths are an RS2Object, not an Entity, also you might want to do a != null check. Edited March 4, 2017 by Hydra
Explv Posted March 4, 2017 Posted March 4, 2017 16 minutes ago, jiggerjaw said: Entity bank = objects.closest("Bank booth"); bank.interact("Bank"); sleep(random(100)); getBank().depositAll(); I've imported bank, this doesnt work? Use getBank().open() 1
Team Cape Posted March 4, 2017 Posted March 4, 2017 if(getBank().isOpen()) { getBank().depositAll(); return random(300, 500); } getBank().open();
jiggerjaw Posted March 4, 2017 Author Posted March 4, 2017 (edited) Ha, shoulda been more specific... the bank opens perfectly fine, it doesn't deposit. Guess it could be that it's trying to deposit before the bank is open, I'll try that. Thanks Jugs *How do I give +Rep? I clicked the check mark and nothing happened Edited March 4, 2017 by jiggerjaw
Explv Posted March 5, 2017 Posted March 5, 2017 20 minutes ago, jiggerjaw said: Ha, shoulda been more specific... the bank opens perfectly fine, it doesn't deposit. Guess it could be that it's trying to deposit before the bank is open, I'll try that. Thanks Jugs *How do I give +Rep? I clicked the check mark and nothing happened Yes, in your snippet you are sleeping for 0-100ms, not exactly long enough for the bank to open, especially if your player has to walk there first. If you use getBank().open() it will sleep until the bank is open, so something like this should work: if (!getBank().isOpen()) { getBank().open(); } else { getBank().depositAll(); } 1 hour ago, Hydra said: Bank booths are an RS2Object, not an Entity, also you might want to do a != null check. RS2Object is a subinterface of Entity, so what he wrote is fine: 3