slazter Posted July 9, 2017 Share Posted July 9, 2017 (edited) Hello guys, so im fairly new to scripting but think im starting to get a hang of it, So anyways i fucking hate questing so i figured i'd make a script for questing so i don't have to do them manually, aswell as have some fun doing them. Anyways when coding the Witch's potion i ran into some trouble, Here's the problem: I want my character to talk to Hetty to start the quest - Because you can't get the Rat's tail before the quest is started. So i figured i'd go to the api and use the, Quests.isStarted. But it didn't work, whenever i tryed to call if(getQuests.isStarted(WITCHS_POTION) so i went to the api, and the description says exactly thesame for both IsComplete, and IsStarted. isComplete public boolean isComplete(Quests.Quest quest) Returns: False if the quest was not complete or there was an issue caching. isStarted public boolean isStarted(Quests.Quest quest) Returns: False if the quest was not complete or there was an issue caching. Therefore i don't really know how to check if the quest is marked yellow so i can go for the rat's tail. So any ideas on how to fix this? My code: import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.model.Item; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import static org.osbot.rs07.api.Quests.Quest.WITCHS_POTION; @ScriptManifest(author = "Slazter", name = "An Example Script", info = "Teamplate", version = 0.1, logo = "") public final class OsBotFråga extends Script { @Override public final int onLoop() throws InterruptedException { if(canWitch()){ questWitchPotion(); } return 150; } public boolean canWitch(){ if (!quests.isComplete(WITCHS_POTION)) { return true; } else return false; } public void questWitchPotion() throws InterruptedException { NPC witch = getNpcs().closest("Hetty"); Platser plat = new Platser(); NPC rat = getNpcs().closest("Rat"); RS2Object range = getObjects().closest("Range"); RS2Object cauldron = getObjects().closest(2024); String[] startitems = {"Onion","Eye of newt"}; String[] allQItems = {"Onion","Eye of newt","Burnt meat","Rat's tail"}; GroundItem tail = getGroundItems().closest("Rat's tail"); Filter<Item> meat = new Filter<Item>() { @Override public boolean match(Item item) { return item.getName().contains("meat"); } }; if(!inventory.contains(startitems)){ if(cauldron!=null && plat.witchs_potion.contains(myPosition())){ if(!dialogues.inDialogue()){ cauldron.interact("Drink From"); sleep(random(1200,1800)); } else if(dialogues.inDialogue()){ dialogueHandling(); } } else if (!getBank().isOpen()) { getWalking().webWalk(Banks.DRAYNOR); getBank().open(); } else { getBank().depositAll(); getBank().withdraw("Onion",1); getBank().withdraw("Eye of newt", 1); getBank().withdraw(meat,1); } } //Start quest else if(inventory.contains(startitems)){ //start quest if(!getQuests().isStarted(WITCHS_POTION) && !witch.isVisible()){ // Won't work getWalking().webWalk(plat.witchs_potion); } else if(witch!=null && !dialogues.inDialogue()){ witch.interact("Talk-to"); sleep(random(1200,1800)); } else if(dialogues.inDialogue()){ dialogueHandling(); } //get Rat's tail else if(!inventory.contains("Rat's tail")){ getWalking().webWalk(new Position(2957,3204,0)); rat.interact("Attack"); Sleep.sleepUntil(()-> rat.getHealthPercent()==0 || tail!=null,5000); if(tail!=null){ tail.interact("Take"); Sleep.sleepUntil(()-> !tail.isVisible(),5000); } // Cook the meat } else if(!inventory.contains("Burnt meat")){ getWalking().webWalk(new Position(2969,3210,0)); getInventory().getItem(meat).interact("Use"); sleep(random(1250,1900)); range.interact("Use"); Sleep.sleepUntil(()-> !myPlayer().isAnimating(),5000); //walk back to witch } else if(getInventory().contains(allQItems) && !witch.isVisible()){ getWalking().webWalk(plat.witchs_potion); //talk to witch } else if(witch!=null && getMap().canReach(witch) && !getDialogues().inDialogue()){ witch.interact("Talk-to"); Sleep.sleepUntil(()-> getDialogues().inDialogue(),5000); } else if(getDialogues().inDialogue()){ dialogueHandling(); } } } public void dialogueHandling() throws InterruptedException { String[] options = {""}; if(dialogues.isPendingContinuation()){ dialogues.clickContinue(); } else if(dialogues.isPendingOption()){ dialogues.completeDialogue(options); } } } Also if anyone have any feedback for me on how to improve my coding, i'd be super happy for any input Edited July 9, 2017 by slazter Quote Link to comment Share on other sites More sharing options...
Eagle Scripts Posted July 9, 2017 Share Posted July 9, 2017 (edited) Look into Configs Using Configs you'll be able to determine stages of the quest, meaning you could also figure out when the quest is started. Edited July 9, 2017 by Eagle Scripts 2 Quote Link to comment Share on other sites More sharing options...
slazter Posted July 9, 2017 Author Share Posted July 9, 2017 30 minutes ago, Eagle Scripts said: Look into Configs Using Configs you'll be able to determine stages of the quest, meaning you could also figure out when the quest is started. Worked like a charm! Many thanks to you! 1 Quote Link to comment Share on other sites More sharing options...
mercylad Posted July 9, 2017 Share Posted July 9, 2017 (edited) 1 hour ago, slazter said: Looking good man keep it up:P Edited July 9, 2017 by mercylad 1 Quote Link to comment Share on other sites More sharing options...