September 29, 20169 yr What would the best method to make the script run to bank once everything in the inventory is cooked?
September 29, 20169 yr Depends on the distance to the bank ... If it's close and the bankarea is loaded you can just use localwalking. If its not loaded either use a predefined path of use the webwalker.
September 29, 20169 yr What would the best method to make the script run to bank once everything in the inventory is cooked? hai Parker. Glad you made it to the forums Can't wait to do some scripting together. Step 1. Define your bank area. -Go to Settings->Options->Debug->Entity Hover Bug ON. -Go to the bank area where you would like to bank at. -Find one corner and log it's x and y. (this is x1, and y1) (because they are the x,y of our 1st selection) -Find another corner and log it's x and y. (this is x2, and y2) (because they are the x,y of our 2nd selection) -Write the x and y down where it should be in our code. -REFERENCE PICTURE. Picture 1 shows how to grab x1 and y1, Picture 2 shows how to grab x2 and y2, picture 3 shows the area that is generated by the code once you type it in. Area BankArea = new Area (x1, y1, x2, y2); //First you declare a predetermined area for bank. Area BankArea = new Area (2721, 3493, 2729, 3487); //now we fill it in, we now have a bank area! Now that we have our defined bank area, we move on. Step 2. Set your script up to call for the action. -Add a case in your switch (getState() area called 'DEPOSIT' or whatever you want. -REMEMBER that codes read lines top to botttom, so write what it carefully. case DEPOSIT: log("We need to deposit our inventory!"); //logs in console what we are doing. helpful when starting. if (!bank.isOpen && BankArea.contains(myPlayer()) { objects.closest("Bank booth").interact("Bank"); } if (!bank.isOpen && !BankArea.contains(myPlayer()) { getWalking().webWalk(BankArea); } BREAKDOWN: Remember that ! means the reverse is true. so bank.IsOpen will check if bank is Open, !bank.isOpen will check if the bank is NOT open. if (!bank.isOpen && BankArea.contains(myPlayer()) { //if the bank isn't open & we are in the bank area objects.closest("Bank booth").interact("Bank"); ///find closest booth and open it up. } if (!bank.isOpen && !BankArea.contains(myPlayer()) { //if the bank isnt open & we ARENT in bank area getWalking().webWalk(BankArea); ///we need to walk to the bank. } Step 3. Having the script call for this action 1. find your private State getState() area. 2. This is the part of the code the script uses to figure out WHAT TO DO. 3. Make a if statement that checks if we have an inventory full of cooked/burnt food. A better way to check may be to check if there are no raw food left. if (!inventory.contains("Raw lobster") && inventory.contains("Lobster")){ return State.DEPOSIT; } BREAKDOWN if (!inventory.contains("Raw lobster") && inventory.contains("Lobster")){ Remember ! means the opposite. If we DONT have anymore Raw Lobsters && AND we DO have lobsters in the inventory, we can conclude that, yes, the cooking has stopped. return State.DEPOSIT; We will go to the deposit clause. SO FROM TOP TO BOTTOM. DECLARE THIS AT THE TOP OF THE SCRIPT, AFTER 'public class main extends Script' Area BankArea = new Area (2721, 3493, 2729, 3487); ADD THIS TO YOUR CASES, Be sure to add "DEPOSIT" to your State enum as well (list of cases) case DEPOSIT: log("We need to deposit our inventory!"); if (!bank.isOpen && BankArea.contains(myPlayer()) { objects.closest("Bank booth").interact("Bank"); } if (!bank.isOpen && !BankArea.contains(myPlayer()) { getWalking().webWalk(BankArea); } ADD THIS TO YOUR switch getState() if (!inventory.contains("Raw lobster") && inventory.contains("Lobster")){ return State.DEPOSIT; }
September 29, 20169 yr Author ^ that's literally all I need right there. Doing a cooker for al kharid, so the bank is visible when your at the range, and the range is visible when your at the bank. Appreciate the help guys, and I know the cords for the Alkharid bank I found it on another post that had snippets. AL_KHARID(Banks.AL_KHARID), Couldn't I just use this? Area BankArea = AL_KHARID(Banks.AL_KHARID); Or use Area[] banks = {AL_KHARID(Banks.AL_KHARID)}; getWalking().webWalk(banks);
September 29, 20169 yr ^ that's literally all I need right there. Doing a cooker for al kharid, so the bank is visible when your at the range, and the range is visible when your at the bank. Appreciate the help guys, and I know the cords for the Alkharid bank I found it on another post that had snippets. AL_KHARID(Banks.AL_KHARID), Couldn't I just use this? Area BankArea = AL_KHARID(Banks.AL_KHARID); Or use Area[] banks = {AL_KHARID(Banks.AL_KHARID)}; getWalking().webWalk(banks); none of that. Declare the following as I said before. (Declare meaning just write it down in your script) Area banks = new Area (x1, y1, x2, y2); Make sure you plug in the coordinates . When you declare an area, it makes a square area between the two points listed. then anytime you want to walk back to the area, use getWalking().webWalk(banks); that tells the script to start walking (getWalking()), and to use the webWalking method to get to the predefined area of Banks. I'll literally spell it out for you, which might help. Area banks = new Area (x1, y1, x2, y2); Area - what we type to start declaring a new area. banks - the name of the area. can name it anything, this is what we call to later. = - equals - it means that the new Area called banks will equal whatever follows. new Area = we're defining a new area that is at the following coords (x1, y1, x2, y2) = these are the coordinates to draw the Area. the Area is an imaginary rectangle between the first set of coords and second. getWalking() - tells the script to start walking webWalk(banks) - tells the script to webWalk to the predefined area 'banks'. Edited September 29, 20169 yr by creationx