sampla Posted May 13, 2016 Share Posted May 13, 2016 (edited) None of this is happening. Why? Edited: @Override public int onLoop() throws InterruptedException { if (ClanWarsChest.contains(myPlayer())) { log("At banking area"); if (!getInventory().onlyContains("Jug of wine")) { if (bank.isOpen()) { bank.depositAll(); sleep(random(250, 350)); bank.withdrawAll("Jug of wine"); sleep(random(300, 500)); bank.close(); } else { bank.open(); } } else if (portalArea.contains(myPlayer())) { log("At portal area"); if (objects.closest("Free-for-all portal") != null) { camera.toEntity(objects.closest("Free-for-all portal")); objects.closest("Free-for-all portal").interact("Enter"); } } else if(portalSpawnArea.contains(myPlayer())){ walking.walk(combatArea); } else { walking.walk(portalArea); } } else if (combatArea.contains(myPlayer())) { log("At combat area"); if (getInventory().contains("Jug of wine")) { if (getSkills().getStatic(Skill.HITPOINTS) - getSkills().getDynamic(Skill.HITPOINTS) > 11) { getInventory().getItem("Jug of wine").interact("Drink"); log("Healing"); } } } return random(100, 200); //The amount of time in milliseconds before the loop starts over } Drinking works. Edited May 13, 2016 by sampla Quote Link to comment Share on other sites More sharing options...
Explv Posted May 13, 2016 Share Posted May 13, 2016 None of this is happening. Why? @Override public int onLoop() throws InterruptedException { Player player = myPlayer(); if (area1.contains(player)) { log("At area1"); if (!getInventory().onlyContains("item")) { if (bank.isOpen()) { bank.depositAll(); sleep(random(250, 350)); bank.withdrawAll("item"); sleep(random(300, 500)); bank.close(); } else { bank.open(); } } else if (area2.contains(player)) { log("At area2"); if (objects.closest("object") != null) { camera.toEntity(objects.closest("object")); objects.closest("object").interact("action"); } } else if(area3.contains(player)){ walking.walk(area3); } else { walking.walk(area2); } } else if (area3.contains(player)) { log("At area3"); the part after this is working. In the future, when posting to the scripting help section, please use the code tags. It is the blue button that looks like: < > Are you sure your player is in one of those areas? What is the code after, that does work? Quote Link to comment Share on other sites More sharing options...
The Hero of Time Posted May 13, 2016 Share Posted May 13, 2016 (edited) don't make an instance of myplayer :p area.contains(myPlayer()) does it do anything else , or just that onloop ? Edited May 13, 2016 by The Hero of Time Quote Link to comment Share on other sites More sharing options...
Explv Posted May 13, 2016 Share Posted May 13, 2016 don't make an instance of myplayer :p area.contains(myPlayer()) does it do anything else , or just that onloop ? He didn't make an instance of Player, he just stored it. That's not the issue Quote Link to comment Share on other sites More sharing options...
The Hero of Time Posted May 13, 2016 Share Posted May 13, 2016 He didn't make an instance of Player, he just stored it. That's not the issue just a suggestion, not a fix. what purpose does it have in myplayer's case? Quote Link to comment Share on other sites More sharing options...
sampla Posted May 13, 2016 Author Share Posted May 13, 2016 (edited) don't make an instance of myplayer :p area.contains(myPlayer()) does it do anything else , or just that onloop ? Edited to show the whole thing. In the future, when posting to the scripting help section, please use the code tags. It is the blue button that looks like: < > Are you sure your player is in one of those areas? What is the code after, that does work? Edited it to show the whole thing, I don't care. I got the banking area from the snippets here. Edited May 13, 2016 by sampla Quote Link to comment Share on other sites More sharing options...
The Hero of Time Posted May 13, 2016 Share Posted May 13, 2016 None of this is happening. Why? Edited: @Override public int onLoop() throws InterruptedException { if (ClanWarsChest.contains(myPlayer())) { log("At banking area"); if (!getInventory().onlyContains("Jug of wine")) { if (bank.isOpen()) { bank.depositAll(); sleep(random(250, 350)); bank.withdrawAll("Jug of wine"); sleep(random(300, 500)); bank.close(); } else { bank.open(); } } else if (portalArea.contains(myPlayer())) { log("At portal area"); if (objects.closest("Free-for-all portal") != null) { camera.toEntity(objects.closest("Free-for-all portal")); objects.closest("Free-for-all portal").interact("Enter"); } } else if(portalSpawnArea.contains(myPlayer())){ walking.walk(combatArea); } else { walking.walk(portalArea); } } else if (combatArea.contains(myPlayer())) { log("At combat area"); if (getInventory().contains("Jug of wine")) { if (getSkills().getStatic(Skill.HITPOINTS) - getSkills().getDynamic(Skill.HITPOINTS) > 11) { getInventory().getItem("Jug of wine").interact("Drink"); log("Healing"); } } } return random(100, 200); //The amount of time in milliseconds before the loop starts over } Drinking works. and it doesn't do log("At banking area"); ? Quote Link to comment Share on other sites More sharing options...
sampla Posted May 13, 2016 Author Share Posted May 13, 2016 and it doesn't do log("At banking area");? Nope. I guess it doesn't find the player then. Quote Link to comment Share on other sites More sharing options...
The Hero of Time Posted May 13, 2016 Share Posted May 13, 2016 Nope. I guess it doesn't find the player then. then you're either not in the area or the area is wrong? o.O Quote Link to comment Share on other sites More sharing options...
Explv Posted May 13, 2016 Share Posted May 13, 2016 Nope. I guess it doesn't find the player then. Try and use a different area, it might be that the one you took from the snippet is incorrect. You can use my map to help you: http://explv.github.io/ Quote Link to comment Share on other sites More sharing options...
sampla Posted May 13, 2016 Author Share Posted May 13, 2016 Mapped two areas using Explv's map. No change. Quote Link to comment Share on other sites More sharing options...
Explv Posted May 13, 2016 Share Posted May 13, 2016 Mapped two areas using Explv's map. No change. Well the only reason that log statement wouldn't work is if your player is not in the area. Feel free to pm me in the chatbox and I can take a look over teamviewer 1 Quote Link to comment Share on other sites More sharing options...
sampla Posted May 13, 2016 Author Share Posted May 13, 2016 Well the only reason that log statement wouldn't work is if your player is not in the area. Feel free to pm me in the chatbox and I can take a look over teamviewer I made a new script that only logs the area. Banking, portal and spawn areas were fine. Quote Link to comment Share on other sites More sharing options...
Explv Posted May 13, 2016 Share Posted May 13, 2016 None of this is happening. Why? Edited: @Override public int onLoop() throws InterruptedException { if (ClanWarsChest.contains(myPlayer())) { log("At banking area"); if (!getInventory().onlyContains("Jug of wine")) { if (bank.isOpen()) { bank.depositAll(); sleep(random(250, 350)); bank.withdrawAll("Jug of wine"); sleep(random(300, 500)); bank.close(); } else { bank.open(); } } else if (portalArea.contains(myPlayer())) { log("At portal area"); if (objects.closest("Free-for-all portal") != null) { camera.toEntity(objects.closest("Free-for-all portal")); objects.closest("Free-for-all portal").interact("Enter"); } } else if(portalSpawnArea.contains(myPlayer())){ walking.walk(combatArea); } else { walking.walk(portalArea); } } else if (combatArea.contains(myPlayer())) { log("At combat area"); if (getInventory().contains("Jug of wine")) { if (getSkills().getStatic(Skill.HITPOINTS) - getSkills().getDynamic(Skill.HITPOINTS) > 11) { getInventory().getItem("Jug of wine").interact("Drink"); log("Healing"); } } } return random(100, 200); //The amount of time in milliseconds before the loop starts over } Drinking works. I think that your portal area checks should not be inside the bank area check. Perhaps if you cleaned up the script a bit, you could more easily identify the issues: import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "Explv", name = "Wine Drinker", info = "Drinks Wine", logo = "", version = 0.1) public class WineDrinker extends Script { private enum State { BANKING, DRINKING, WALKING_TO_BANK, WALKING_TO_PORTAL, WALKING_TO_COMBAT, TELEPORTING } private final Area portalArea = new Area(0, 0, 0, 0), bankArea = new Area(0, 0, 0, 0), spawnArea = new Area(0, 0, 0, 0), combatArea = new Area(0, 0, 0, 0); @Override public int onLoop() throws InterruptedException { switch (getState()){ case BANKING: bank(); break; case DRINKING: drink(); break; case WALKING_TO_BANK: getWalking().webWalk(bankArea); break; case WALKING_TO_PORTAL: getWalking().webWalk(portalArea); break; case WALKING_TO_COMBAT: getWalking().webWalk(combatArea); break; case TELEPORTING: teleport(); break; } return random(200, 300); } private State getState() { if(!getInventory().contains("Jug of wine")){ return bankArea.contains(myPosition()) ? State.BANKING : State.WALKING_TO_BANK; } if(spawnArea.contains(myPosition())) return State.WALKING_TO_COMBAT; if(combatArea.contains(myPosition())) return State.DRINKING; return portalArea.contains(myPosition()) ? State.TELEPORTING : State.WALKING_TO_PORTAL; } private void teleport(){ if(getObjects().closest("Free-for-all portal").interact("Enter")){ new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return !portalArea.contains(myPosition()); } }.sleep(); } } private void bank() throws InterruptedException { if(!getBank().isOpen()) { openBank(); } else if(!getInventory().isEmptyExcept("Jug of wine")) { getBank().depositAllExcept("Jug of wine"); } else if(!getInventory().contains("Jug of wine")){ if(getBank().contains("Jug of wine")) getBank().withdrawAll("Jug of wine"); else stop(); } } private void openBank() throws InterruptedException { if(getBank().open()){ new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } } private void drink() { if (getSkills().getStatic(Skill.HITPOINTS) - getSkills().getDynamic(Skill.HITPOINTS) > 11) { getInventory().getItem("Jug of wine").interact("Drink"); } } } Quote Link to comment Share on other sites More sharing options...