Lahney Posted July 20, 2015 Share Posted July 20, 2015 (edited) Okay well totally new to this scripting stuff. I have been botting for a long time but i wanted to figure out how to script on my own and make my own scripts. So basically I went through and found a base script. Credits definitely go to Acinate, link to his post http://osbot.org/forum/topic/69989-al-kharid-moltenglassmaker-ironsmelter/So now that I got that out of the way i basically tried to modify his script to fix my needs. I wanted to turn his molten glass maker/iron bar maker into a gold amulet u maker. I tried switching around the ids and I managed to make it withdraw my amulet mould and gold bars. The problem I am have is for the script being able to right click on the gold amulet and his "Make-x gold amulets". The script hovers over make gold amulet but wont right click or enter 27. Need some help! Once again thank you for anyone who is willing to help me! import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.Item; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.Area; @ScriptManifest( name="GoldAmmys", author="Lahney", version=0.1, info="", logo="" ) public class Main extends Script{ Area BANK = new Area(3266,3171,3272,3164); Area FURNACE = new Area(3279,3188,3272,3184); private State state = State.IDLE; private final String goldbar = "Gold Bar"; private final String amuletmould = "Amulet Mould"; private final String bank = "Bank"; private final String bbooth = "Bank booth"; public void onStart() {this.log("Script has begun!");} public int onLoop() throws InterruptedException { switch (state = getState()) { case CONTINUE: continueDia(); break; case IDLE: this.log("case IDLE:"); offTrack(); break; case SMELT: this.log("case SMELT:"); cameraFix(); Entity furnace = this.objects.closest(FURNACE,24009); Item bucket = this.inventory.getItem(goldbar); RS2Widget smeltSelect = widgets.get(446,32); RS2Widget enterAmount = widgets.get(548,120); if (!getInventory().contains(goldbar)) { getLocalWalker().walk(BANK, true); } else if (!myPlayer().isAnimating()) { if (smeltSelect == null) { this.log("Gold Bar > Use"); bucket.interact("Use"); sleep(random.nextInt(100) * 20); furnace.interact("Use"); sleep(random.nextInt(100) * 50); this.log("Crafting Amulets"); } sleep(random.nextInt(1000) * 100); if (smeltSelect != null){ smeltSelect.interact("Make X Gold Amulet"); } else furnace.interact("Smelt"); if (enterAmount.isVisible()) { getKeyboard().typeString("28"); } sleep(random.nextInt(100) * 100); } break; case BANK: this.log("case BANK:"); continueDia(); Entity booth = getObjects().closest(11744); if (!getInventory().contains(goldbar) || !getInventory().contains(amuletmould)) { if (getBank().isOpen()) { if (getInventory().isFull()) { getBank().depositAll(); } if (!getInventory().contains(amuletmould)) { getBank().withdraw(amuletmould, 1); sleep(random.nextInt(50) + 500); } if (!getInventory().contains(goldbar)) { getBank().withdraw(goldbar,27); sleep(random.nextInt(50) + 500); } if (getInventory().isFull() && getInventory().contains("Amulet Mould","Gold Bar")) { getBank().close(); } } else booth.interact(bank); sleep(random.nextInt(50) + 500); } else getLocalWalker().walk(FURNACE, true); break; } return 500; } private void cameraFix() { this.log("cameraFix()"); if (FURNACE.contains(myPlayer())) { if (getCamera().getYawAngle() != 45) { getCamera().moveYaw(45); } if (getCamera().getPitchAngle() != 50) { getCamera().movePitch(50); } } if (BANK.contains(myPlayer())) { if (getCamera().getYawAngle() != 90) { getCamera().moveYaw(90); } if (getCamera().getPitchAngle() != 67) { getCamera().movePitch(67); } } } private void offTrack() { this.log("offTrack()"); if (getInventory().contains(amuletmould,goldbar) && !FURNACE.contains(myPlayer())) { getLocalWalker().walk(FURNACE,true); } if (getInventory().onlyContains("Gold Amulet (u)")) { getLocalWalker().walk(BANK,true); } } private void continueDia() { if (getDialogues().isPendingContinuation()) { getDialogues().clickContinue(); } } private State getState() { if (FURNACE.contains(myPlayer())) return State.SMELT; if (BANK.contains(myPlayer())) return State.BANK; if (getDialogues().isPendingContinuation()) return State.CONTINUE; return State.IDLE; } public enum State{IDLE,SMELT,BANK,CONTINUE} public void onExit() { } } Edited July 21, 2015 by Lahney Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted July 20, 2015 Share Posted July 20, 2015 In OSBot settings, look for "Widget debug". Tick that and hover over the widget you want to check for. RS2Widget smeltSelect = widgets.get(309,2); Widget (309, 2) is the widget of molten glass, so you want to get the one for gold amulet (u). Hover over the gold amulet (u) in the smelt widget and record all 3 numbers (look at the coloured borders) Good luck! 1 Quote Link to comment Share on other sites More sharing options...
Lahney Posted July 21, 2015 Author Share Posted July 21, 2015 In OSBot settings, look for "Widget debug". Tick that and hover over the widget you want to check for. RS2Widget smeltSelect = widgets.get(309,2); Widget (309, 2) is the widget of molten glass, so you want to get the one for gold amulet (u). Hover over the gold amulet (u) in the smelt widget and record all 3 numbers (look at the coloured borders) Good luck! Hey Bobrocket Im not sure if youre still willing to help, but I made the changes and now I compiled it and ran it. My character withdraws the amulet mould and gold bars then proceeds to run to the furnace and uses the gold bar on the furnace. Once he uses the bar on the furnace he wont right click to select make x and then all. I think that my script isnt set up for that. if (smeltSelect != null){ smeltSelect.interact("Make All"); sleep(random.nextInt(100) * 100); Is what i have in my script. How would i go about to modify this to make my script right click and hit make x and then type in 27 or whatever random number. Thanks again if you can help! Quote Link to comment Share on other sites More sharing options...
Lahney Posted July 21, 2015 Author Share Posted July 21, 2015 i recently tried to update my script but i still cant get it to right click to make the gold amulets and type in 27 any help would be greatly appreciated! Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted July 21, 2015 Share Posted July 21, 2015 There is no "make all", only " Make-X". From there you need to use the keyboard to type a random number (look at the Keyboard class in the API) Quote Link to comment Share on other sites More sharing options...
Lahney Posted July 21, 2015 Author Share Posted July 21, 2015 I still cant figure out the make x option Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted July 21, 2015 Share Posted July 21, 2015 I still cant figure out the make x option RS2Widget goldAmulet = getWidgets().get(x, y, z); goldAmulet.interact("Make-X"); getKeyboard().typeString("420", true); Quote Link to comment Share on other sites More sharing options...