Bobrocket Posted May 25, 2015 Share Posted May 25, 2015 (Hopefully) simple. What I want to do is use my Gold bar on a furnace. getInventory().interact("Use", "Gold bar"); furnace.interact("Smelt"); log("Smelting"); The Smelt option only works when I don't interact with a Gold bar first. Help? Quote Link to comment Share on other sites More sharing options...
Rudie Posted May 25, 2015 Share Posted May 25, 2015 if(inventory.isItemSelected()) { furnace.interact("Smelt"); } Quote Link to comment Share on other sites More sharing options...
Fruity Posted May 25, 2015 Share Posted May 25, 2015 Interact with item 'use' Check if item is selected See if ent is not null & visible Interact with ent API is ur friend for the code :P Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted May 25, 2015 Author Share Posted May 25, 2015 (edited) Interact with item 'use' Check if item is selected See if ent is not null & visible Interact with ent API is ur friend for the code Thanks dude, but the API isn't very useful to me.. Anyway, so now I am trying to simulate a "press enter" in the Make-X section. I currently have this: sleep(125 + rand.getRandom(99)); getKeyboard().typeKey(Character.forDigit(rand.getRandom(3, 9), 10)); sleep(11 + rand.getRandom(200, 482)); getKeyboard().typeKey(Character.forDigit(rand.getRandom(0, 9), 10)); sleep(14 + rand.getRandom(50, 122)); getKeyboard().typeKey((char)13); Character 13 is your standard carriage return, and is used a lot for detection with JS normally. Is RS checking for a standard CLRF? (\r\n - 13 10) or just 13 or just 10? EDIT: Sorted this myself. OSRS expects the standard CLRF, which is character 13 followed by character 10. (Do not put a delay between these as when you press enter, your keyboard sends both characters simultaneously) getKeyboard().typeKey((char)13); getKeyboard().typeKey((char)10); Edited May 25, 2015 by Bobrocket Quote Link to comment Share on other sites More sharing options...
Fruity Posted May 25, 2015 Share Posted May 25, 2015 (edited) Thanks dude, but the API isn't very useful to me.. Anyway, so now I am trying to simulate a "press enter" in the Make-X section. I currently have this: sleep(125 + rand.getRandom(99)); getKeyboard().typeKey(Character.forDigit(rand.getRandom(3, 9), 10)); sleep(11 + rand.getRandom(200, 482)); getKeyboard().typeKey(Character.forDigit(rand.getRandom(0, 9), 10)); sleep(14 + rand.getRandom(50, 122)); getKeyboard().typeKey((char)13); Character 13 is your standard carriage return, and is used a lot for detection with JS normally. Is RS checking for a standard CLRF? (\r\n - 13 10) or just 13 or just 10? API Is very useful when you understand it For the typing and pressing enter use this keyboard.typeString(String.valueOf(random(50,100)), true); Or something similar, the true means press enter after the string has been typed i believe Edited May 25, 2015 by Fruity Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted May 25, 2015 Author Share Posted May 25, 2015 API Is very useful when you understand it For the typing and pressing enter use this keyboard.typeString(String.valueOf(random(50,100)), true); Or something similar, the true means press enter after the strign has been typed i believe I see. I wanted to type each character individually as then it feels more like a human click. I seem to be reinventing the wheel every time :p Thank you though. My script seems to be working well so far so all is good. Is there a way to find out when my character has crafted a gold item? Usually you would use Onmessage (right?) but there is no message when you create a gold item. Quote Link to comment Share on other sites More sharing options...
Fruity Posted May 25, 2015 Share Posted May 25, 2015 I see. I wanted to type each character individually as then it feels more like a human click. I seem to be reinventing the wheel every time Thank you though. My script seems to be working well so far so all is good. Is there a way to find out when my character has crafted a gold item? Usually you would use Onmessage (right?) but there is no message when you create a gold item. Maybe on animation? is there an animation that the player does when it crafts the gold item? Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted May 25, 2015 Author Share Posted May 25, 2015 Maybe on animation? is there an animation that the player does when it crafts the gold item? Yeah, but I'm not sure how I would do that. Can I check by animation ID maybe? Quote Link to comment Share on other sites More sharing options...
Fruity Posted May 25, 2015 Share Posted May 25, 2015 Aye im sure there is a certain animation for smithing. do player debug thingy Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted May 25, 2015 Author Share Posted May 25, 2015 Aye im sure there is a certain animation for smithing. do player debug thingy Will do, and will update with results. Thank you. Quote Link to comment Share on other sites More sharing options...
Fruity Posted May 25, 2015 Share Posted May 25, 2015 Will do, and will update with results. Thank you. YW Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted May 25, 2015 Author Share Posted May 25, 2015 YW Alright, so I really cannot figure this out. When smithing an item, the animation ID is 899. So it will smith the item, go back to no animation, and then smith another. How would I detect this and add another item to my counter? Quote Link to comment Share on other sites More sharing options...
FrostBug Posted May 25, 2015 Share Posted May 25, 2015 Alright, so I really cannot figure this out. When smithing an item, the animation ID is 899. So it will smith the item, go back to no animation, and then smith another. How would I detect this and add another item to my counter? If there is a chat message, you can listen for that. if there is XP gain, you can calculate it from that. Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted May 25, 2015 Author Share Posted May 25, 2015 If there is a chat message, you can listen for that. if there is XP gain, you can calculate it from that. I ended up just making a Thread and checking the animation from that (and then doing a conditonalsleep until the animation was finished). Not the best, but it works. Thanks everyone! Quote Link to comment Share on other sites More sharing options...