EternusDraco Posted October 9, 2014 Share Posted October 9, 2014 Hey all, I've been writing a very simple script (my first one) to basically smelt bronze bars in Falador. Withdraws ore and banks and all that fun stuff. But the issue I'm having is just an annoyance. It slows the script down and is probably a simple fix. When I'm at the furnace and smelting the ore. It constantly clicks the furnace twice to do anything. I have it set to smelt, and click bronze bar on the menu. It clicks the furnace, clicks bronze bar, then clicks it again, then clicks bronze bar again. Then it waits for a while before doing it again. Here is my code: case Smelt: Entity furnace = objects.closest("Furnace"); outerIf: if (!myPlayer().isAnimating()) { sleep(1500); if(!inventory.contains("Copper ore")){ sleep(500); break outerIf; } } while(!myPlayer().isAnimating()){ sleep(50); mouse.click(new EntityDestination(bot, furnace)); sleep(1500); mouse.move(51,415); mouse.click(false); } Link to comment Share on other sites More sharing options...
Pug Posted October 9, 2014 Share Posted October 9, 2014 (edited) putting sleeps all over the place and at the start of a IF statement probably isnt helping, you should also use randomized sleeps to avoid insta bans e.g sleep(200 + random(14,54); also use the code tags when showing us code, its next to the miny picture, looks like this : < > also instead of mouse.click(); you can use the name of your entity, E.G: furnace.interact("Smelt"); an example of me interacting with a funace would be: RS2Object furnace = objects.closest("Furnace"); if(furnace != null) { if(furnace.isVisible) { furnace.interact("Smelt"); sleep(345 + random(100,205); while(myPlayer().isMoving || myPlayer.isAnimating() { sleep(200 + random(1,10); } } } Edited October 9, 2014 by Pug Link to comment Share on other sites More sharing options...
EternusDraco Posted October 9, 2014 Author Share Posted October 9, 2014 Yeah I know I should be randomizing the sleeps. I started doing it halfway into it, so some of them are random and some aren't, so I'll get on changing those. I'll switch the mouse click to interact and see how it goes. I swear I looked for the code tag for like 2 minutes and completely missed it Link to comment Share on other sites More sharing options...
Pug Posted October 9, 2014 Share Posted October 9, 2014 added a little extra above for you to look at pm me if you need more help Link to comment Share on other sites More sharing options...
EternusDraco Posted October 9, 2014 Author Share Posted October 9, 2014 (edited) Thanks a bunch, gonna try the interaction, removed a lot of the useless sleeps and tried to streamline it. Gotta mine more ore then test it again. Used it all up during trials haha. EDIT: Don't want to double post, but adding the while code that you had in your example is what fixed it. Thanks a ton! Much smoother now. EDIT 2: Or not. It worked great for most of one inventory. Then at the end it clicked smelt, then bronze, constantly haha. EDIT 3: Ok the while needed to be moved around is all. So that part is squared away now. Next question ends up being, adding a gui (which I saw the tutorial for so I'll be reading that and working on it). Then, how to add in different ores. To be able to select which ore to smelt etc. Edited October 9, 2014 by EternusDraco Link to comment Share on other sites More sharing options...
Joseph Posted October 9, 2014 Share Posted October 9, 2014 why dont you use a condition sleep? http://osbot.org/forum/topic/55688-how-to-use-conditional-sleep/ Link to comment Share on other sites More sharing options...
EternusDraco Posted October 9, 2014 Author Share Posted October 9, 2014 why dont you use a condition sleep? http://osbot.org/forum/topic/55688-how-to-use-conditional-sleep/ That looks really good I'm gonna try and get that implemented instead. Thanks for the tip! Link to comment Share on other sites More sharing options...
Pug Posted October 9, 2014 Share Posted October 9, 2014 basics of a gui for your needs is to make a comboBox (drop down box) which has the ores to smelt in it. You then have an action listener for that combo box that sets the name or id of the ore you want to smelt when selected from the drop down box. then a start button to dispose of the gui. thats it really. There is lots of tutorials on GUI's here Make sure you pick a null layout for most flexibility, that way you can position your drop down box and start button exactly where you need them Link to comment Share on other sites More sharing options...