OPEX 5 Posted August 30, 2018 I've tried several ways, but can't seem to get the bank to open. When I tried creating a Bank GameObject, I just got an error over and over once it reached the interact. With the code below the log just looks like the image below, but the bank is never opened. The cursor never moves or does anything. if(BANK_AREA.contains(c.getLocalPlayer())){ c.log("Trying"); c.getBank().openClosest(); c.sleepUntil((bankOpen),5000); c.log("Tried"); }
sadgonzer 46 Posted August 30, 2018 42 minutes ago, OPEX said: I've tried several ways, but can't seem to get the bank to open. When I tried creating a Bank GameObject, I just got an error over and over once it reached the interact. With the code below the log just looks like the image below, but the bank is never opened. The cursor never moves or does anything. if(BANK_AREA.contains(c.getLocalPlayer())){ c.log("Trying"); c.getBank().openClosest(); c.sleepUntil((bankOpen),5000); c.log("Tried"); } if(BANK_AREA.contains(getLocalPlayer().getTile())&&!getBank().isOpen()){ /* here is how you check if you are already in the area by checking if the wanted Area (BANK_AREA) contains the actuall Tile of your local player... and checking if the bank is not open already . */ c.log("Trying"); c.getBank().openClosest(); sleepUntil(() ->getBank().isOpen(), (5000)); c.log("Tried"); } hope i helped
Nuclear Nezz 2108 Posted August 30, 2018 What is c, and what do you mean you tried *creating* a bank object
OPEX 5 Author Posted August 30, 2018 52 minutes ago, Nuclear Nezz said: What is c, and what do you mean you tried *creating* a bank object c is the main class. The code in question is in a "Banking" node. I'm at work now, so I'll have to wait til I'm back home to see exactly how I had it... but it was something like below. GameObject bank = getGameObjects().closest(c -> c != null && c.getName().equals("Bank booth") && c.hasAction("Bank")); bank.interact("Bank");
OPEX 5 Author Posted August 30, 2018 1 hour ago, sadgonzer said: if(BANK_AREA.contains(getLocalPlayer().getTile())&&!getBank().isOpen()){ /* here is how you check if you are already in the area by checking if the wanted Area (BANK_AREA) contains the actuall Tile of your local player... and checking if the bank is not open already . */ c.log("Trying"); c.getBank().openClosest(); sleepUntil(() ->getBank().isOpen(), (5000)); c.log("Tried"); } hope i helped Is adding the ".getTile()" better? I've used the ".contains(getLocalPlayer())" without issue until this point.
Miami 369 7 Posted August 30, 2018 1 hour ago, OPEX said: Is adding the ".getTile()" better? I've used the ".contains(getLocalPlayer())" without issue until this point. its the same thing. also in the first post. Maybe you didn't null check the gameobject so you got an npe error
sadgonzer 46 Posted August 30, 2018 51 minutes ago, Miami 369 said: its the same thing. also in the first post. Maybe you didn't null check the gameobject so you got an npe error i dont think you need to null check bank ?
Nuclear Nezz 2108 Posted August 30, 2018 Where are you running the script? Try running it through command prompt (quickstart will still launch clients for regular members, just won't auto start the script), it might give you more errors than the debug log will.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.