GetBackToOSRS Posted February 21, 2016 Share Posted February 21, 2016 Original thread Just modified it.. import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import java.util.concurrent.TimeUnit; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "GetBackToOSRS", info = "Harralander tar maker, comptatible with chests ONLY", name = "HarraTar", version = 0, logo = "") public class main extends Script { @Override public void onStart() { } private enum State { BANK, SETTING_UP, WORKING } private State getState() { if (bank.isOpen()) { return State.BANK; } if (!players.inventory.contains("Clean Harralander") || !players.inventory.contains("Swamp Tar") || !players.inventory.contains("Pestle and Mortar")) { return State.SETTING_UP; } if (players.inventory.contains("Clean Harralander") || players.inventory.contains("Swamp Tar") || players.inventory.contains("Pestle and Mortar")) { return State.WORKING; } return null; } @Override public int onLoop() throws InterruptedException { switch(getState()) { case BANK: if (!players.getInventory().isEmpty()){ bank.depositAll(); } bank.withdraw("Clean Harralander", 25); bank.close(); break; case SETTING_UP: Entity bank = objects.closest("Bank Chest"); bank.interact("Use"); break; case WORKING: getInventory().getItem("Clean Harralander").interact("Use"); getInventory().getItem("Swamp Tar").interact("Use"); sleep(random(700, 950)); RS2Widget w = widgets.get(309, 2); if (w != null) w.interact("Make ALL"); sleep(random(10000, 18000)); } return random(500, 800); } @Override public void onExit() { } @Override public void onPaint(Graphics2D g) { } } Quote Link to comment Share on other sites More sharing options...
Eagle Scripts Posted February 21, 2016 Share Posted February 21, 2016 So, what's the problem? (: Quote Link to comment Share on other sites More sharing options...
Explv Posted February 21, 2016 Share Posted February 21, 2016 players.inventory.contains() Is wrong. It should be: getInventory().contains() Quote Link to comment Share on other sites More sharing options...
Chris Posted February 21, 2016 Share Posted February 21, 2016 http://osbot.org/api Quote Link to comment Share on other sites More sharing options...
GetBackToOSRS Posted February 21, 2016 Author Share Posted February 21, 2016 (edited) players.inventory.contains() Is wrong. It should be: getInventory().contains() So if I change: (!players.inventory.contains("Clean Harralander") To: getInventory().contains(Clean Harralander) And changing the rest it will work? Edited February 21, 2016 by GetBackToOSRS Quote Link to comment Share on other sites More sharing options...
Deceiver Posted February 21, 2016 Share Posted February 21, 2016 (edited) So if I change: (!players.inventory.contains("Clean Harralander") To: getInventory().contains(Clean Harralander) And changing the rest it will work? contains("Clean harralander") Edited February 21, 2016 by stress Quote Link to comment Share on other sites More sharing options...
GetBackToOSRS Posted February 21, 2016 Author Share Posted February 21, 2016 contains("Clean harralander") import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import java.util.concurrent.TimeUnit; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "GetBackToOSRS", info = "Harralander tar maker, comptatible with chests ONLY", name = "HarraTar", version = 0, logo = "") public class main extends Script { @Override public void onStart() { } private enum State { BANK, SETTING_UP, WORKING } private State getState() { if (bank.isOpen()) { return State.BANK; } if getInventory().contains("Clean Harralander") || getInventory().contains("Swamp Tar") || getInventory().contains("Pestle and Mortar") { return State.SETTING_UP; } if getInventory().contains("Clean Harralander") || getInventory().contains("Swamp Tar") || getInventory().contains("Pestle and Mortar") { return State.WORKING; } return null; } @Override public int onLoop() throws InterruptedException { switch(getState()) { case BANK: if (!getInventory().isEmpty()){ bank.depositAll(); } bank.withdraw("Clean Harralander", 25); bank.close(); break; case SETTING_UP: Entity bank = objects.closest("Bank Chest"); bank.interact("Use"); break; case WORKING: getInventory().getItem("Clean Harralander").interact("Use"); getInventory().getItem("Swamp Tar").interact("Use"); sleep(random(700, 950)); RS2Widget w = widgets.get(309, 2); if (w != null) w.interact("Make ALL"); sleep(random(10000, 18000)); } return random(500, 800); } @Override public void onExit() { } @Override public void onPaint(Graphics2D g) { } } Quote Link to comment Share on other sites More sharing options...
Deceiver Posted February 21, 2016 Share Posted February 21, 2016 import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import java.util.concurrent.TimeUnit; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "GetBackToOSRS", info = "Harralander tar maker, comptatible with chests ONLY", name = "HarraTar", version = 0, logo = "") public class main extends Script { @Override public void onStart() { } private enum State { BANK, SETTING_UP, WORKING } private State getState() { if (bank.isOpen()) { return State.BANK; } if getInventory().contains("Clean Harralander") || getInventory().contains("Swamp Tar") || getInventory().contains("Pestle and Mortar") { return State.SETTING_UP; } if getInventory().contains("Clean Harralander") || getInventory().contains("Swamp Tar") || getInventory().contains("Pestle and Mortar") { return State.WORKING; } return null; } @Override public int onLoop() throws InterruptedException { switch(getState()) { case BANK: if (!getInventory().isEmpty()){ bank.depositAll(); } bank.withdraw("Clean Harralander", 25); bank.close(); break; case SETTING_UP: Entity bank = objects.closest("Bank Chest"); bank.interact("Use"); break; case WORKING: getInventory().getItem("Clean Harralander").interact("Use"); getInventory().getItem("Swamp Tar").interact("Use"); sleep(random(700, 950)); RS2Widget w = widgets.get(309, 2); if (w != null) w.interact("Make ALL"); sleep(random(10000, 18000)); } return random(500, 800); } @Override public void onExit() { } @Override public void onPaint(Graphics2D g) { } } >Clean harralander >Pestle and mortar etc. item names arent both capitalized Quote Link to comment Share on other sites More sharing options...
GetBackToOSRS Posted February 21, 2016 Author Share Posted February 21, 2016 It still won't compile. import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import java.util.concurrent.TimeUnit; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "GetBackToOSRS", info = "Harralander tar maker, comptatible with chests ONLY", name = "HarraTar", version = 0, logo = "") public class main extends Script { @Override public void onStart() { } private enum State { BANK, SETTING_UP, WORKING } private State getState() { if (bank.isOpen()) { return State.BANK; } if getInventory().contains("Clean harralander") || getInventory().contains("Swamp tar") || getInventory().contains("Pestle and mortar") { return State.SETTING_UP; } if getInventory().contains("Clean harralander") || getInventory().contains("Swamp tar") || getInventory().contains("Pestle and mortar") { return State.WORKING; } return null; } @Override public int onLoop() throws InterruptedException { switch(getState()) { case BANK: if (!getInventory().isEmpty()){ bank.depositAll(); } bank.withdraw("Clean harralander", 25); bank.withdraw("Swamp tar", 390); bank.withdraw("Pestle and mortar"); bank.close(); break; case SETTING_UP: Entity bank = objects.closest("Bank Chest"); bank.interact("Use"); break; case WORKING: getInventory().getItem("Clean harralander").interact("Use"); getInventory().getItem("Swamp tar").interact("Use"); sleep(random(700, 950)); RS2Widget w = widgets.get(309, 2); if (w != null) w.interact("Make ALL"); sleep(random(10000, 18000)); } return random(500, 800); } @Override public void onExit() { } @Override public void onPaint(Graphics2D g) { } } Quote Link to comment Share on other sites More sharing options...
Botre Posted February 21, 2016 Share Posted February 21, 2016 (edited) players.inventory.contains() Is wrong. It should be: getInventory().contains() players.inventory.contains() is not "wrong" at least it's not what's causing the compilation error. players is an instance of Players which is a subclass of MethodProvider. You can use players to access MethodProvider fields. inventory is a MethodProvider field. Therefore players.inventory is valid. @OP: What do you mean with "trouble compiling" ? I copy pasted the code in my IDE and had no trouble compiling it. Please provide a screenshot of your error. Edited February 21, 2016 by Botre Quote Link to comment Share on other sites More sharing options...
GetBackToOSRS Posted February 21, 2016 Author Share Posted February 21, 2016 ^ It's just not showing up on my scripts list lol. Quote Link to comment Share on other sites More sharing options...
Botre Posted February 21, 2016 Share Posted February 21, 2016 ^ It's just not showing up on my scripts list lol. Remove all scripts from the Scripts folder. Recompile. Open OSBot. Refresh scripts. Quote Link to comment Share on other sites More sharing options...
GetBackToOSRS Posted February 22, 2016 Author Share Posted February 22, 2016 Remove all scripts from the Scripts folder. Recompile. Open OSBot. Refresh scripts. Still nothing.. Removed everything. Compiled OSBot. Added script, refreshed scripts. Not there. Quote Link to comment Share on other sites More sharing options...
Deceiver Posted February 22, 2016 Share Posted February 22, 2016 Still nothing.. Removed everything. Compiled OSBot. Added script, refreshed scripts. Not there. are u compilin it right in eclipse? Quote Link to comment Share on other sites More sharing options...
FrostBug Posted February 22, 2016 Share Posted February 22, 2016 Open OSBot through a command prompt and enable debug mode. Should see an error when refreshing the scripts list; post it here Quote Link to comment Share on other sites More sharing options...