Jeune Padawan Posted March 9, 2017 Share Posted March 9, 2017 Yo. Basically, I'm trying to make a simple woodcutting script where when he's under level 21, he cuts trees with his iron axe and banks them. When he'd hit 21, he'd go at the bank and deposit everything and then, pickup a mithril axe to go back cut trees. At 31, he would go to bank, deposit all, withdraw an adamant axe and go cutting willows. However, I don't really know how to "say" it. It's like I would have needed a "when" statement for when I hit x level... This is what it looks like right now. I know it is wrong. Also, anyone knows why line 64 is underlined? It's pissing me off >_> Thanks for the help Quote Link to comment Share on other sites More sharing options...
Magarac Posted March 9, 2017 Share Posted March 9, 2017 (edited) Just put another If statement in the OnLoop that checks for your level and what axe to use for that level, ie: // for pre-mith axe, if you're using just iron if (getSkills.getStatic(Skill.WOODCUTTING) < 21) { // PUT REGULAR CODE HERE FOR CHOPPING W/ LESSER AXE } // example for mith axe else if (getSkills.getStatic(Skill.WOODCUTTING) >= 21) { if (!getInventory.contains("Mithril axe") { getWalking.webWalk(bank); if bank.contains(myPlayer) { if !getBank.isOpen() { getBank.Open(); } if getBank.contains("Mithril axe") { // not checking if it is in inventory or not because we checked that prior to walking to bank getBank.withdraw("Mithril axe") } if getInventory.contains("Mithril axe") { getBank.close(); } } } else { if !tree.contains(myPlayer) { getWalking.webWalk(tree) } else { // CHOPPING CODE HERE } } } // onwards for the rest of the axes else if (... >= 31) {} ...and so on. EDITED IN A SAMPLE FOR WITHDRAWING THE AXE, MISREAD OP. **don't copy my code directly, I wrote it here and I'm sure it has formatting and incorrect API use since I did it from memory, but use it as a basis if needed. Edited March 9, 2017 by Magarac Quote Link to comment Share on other sites More sharing options...
IHB Posted March 9, 2017 Share Posted March 9, 2017 Add a log to see if it throws anything at all for your first if statement, because it could just be a problem with the webwalk Try making the line getSkills().getStatic(Skill.wc) > 20 rather than >= 21 Also change "Mithril Axe" to "Mithril axe" as java is case sensitive Edit: change "logs" to "Logs" aswell and "Chop Down" to "Chop down" 1 Quote Link to comment Share on other sites More sharing options...
Jeune Padawan Posted March 9, 2017 Author Share Posted March 9, 2017 16 minutes ago, IHB said: Add a log to see if it throws anything at all for your first if statement, because it could just be a problem with the webwalk Try making the line getSkills().getStatic(Skill.wc) > 20 rather than >= 21 Also change "Mithril Axe" to "Mithril axe" as java is case sensitive Edit: change "logs" to "Logs" aswell and "Chop Down" to "Chop down" Logs is toLowerCase(). As for the rest, the Chop Down still works actually Quote Link to comment Share on other sites More sharing options...
Magarac Posted March 9, 2017 Share Posted March 9, 2017 2 minutes ago, Jeune Padawan said: Logs is toLowerCase(). As for the rest, the Chop Down still works actually For that maybe just do: getDepositBox().depositAllExcept(Item -> item.getName.contains("axe")); Quote Link to comment Share on other sites More sharing options...
Polymorphism Posted March 9, 2017 Share Posted March 9, 2017 (edited) 8 hours ago, Jeune Padawan said: Yo. Basically, I'm trying to make a simple woodcutting script where when he's under level 21, he cuts trees with his iron axe and banks them. When he'd hit 21, he'd go at the bank and deposit everything and then, pickup a mithril axe to go back cut trees. At 31, he would go to bank, deposit all, withdraw an adamant axe and go cutting willows. However, I don't really know how to "say" it. It's like I would have needed a "when" statement for when I hit x level... This is what it looks like right now. I know it is wrong. Also, anyone knows why line 64 is underlined? It's pissing me off >_> Thanks for the help Start by utilizing the boolean return on those method calls, this will make your script run smoother. if(!bankArea.contains(myPlayer()) webwalk(bankArea) if(!bank.isOpen())bank.open(); Even using dynamic sleeps is useful too if(bank.isOpen()){ if(inventory.contains("logs")){ if(bank.depositAll(item -> item.getName().contains("logs"))){ new ConditionalSleep(4500, 500){ //timeout, recheck so 4500ms is max sleep, check condition every 500ms //condition method goes here. Returns boolean, if return true the sleeping will stop, if false it will continue to sleep until timeout }.sleep(); } } Line 64, Item-> Item.getName()... Change the lambda variable to something like depositAll(it->i.getName().toLowerCase().contains("logs"). You're using a type as a variable name, but shouldn't be the issue. Read this http://stackoverflow.com/questions/1445233/is-it-possible-to-solve-the-a-generic-array-of-t-is-created-for-a-varargs-param Edited March 9, 2017 by Polymorphism Quote Link to comment Share on other sites More sharing options...