Jams Posted May 16, 2015 Share Posted May 16, 2015 Tyvm! WHAT PARTY? WHERE? WHEN? I need to be there. Thanks party in my pants invite only sry Link to comment Share on other sites More sharing options...
Appelflapjes Posted May 16, 2015 Author Share Posted May 16, 2015 Hi welcome and good luck! Your first script looks promising Alright, I briefly checked your script First of all when you script it's important to use an IDE such as eclipse or IntelliJ IDEA. Using IntelliJ you can jump to the (decompiled) implementation of an API method, so you can actually see what it does. There's this line in your script: while (bank.isOpen()){ bank.close(); ... if we check the implementation, bank.close() already checks if the bank is open. I use this very often, perhaps it's useful for you as well to understand what exactly the api methods do. Arrays.asList(stairs.getDefinition().getActions()).contains("Climb-down") could be simplified into stairs.hasAction("Climb-down") You could also check out the doorHandler api, it most likely support gates. You specify what position you want to walk to and the doorhandler opens any doors/gates between the player and the target position. There are a lot of nested if statements I remember I did the same thing when I first started scripting. It's very difficult to debug, so you might want to avoid it Thanks . I use Eclipse, so thats okay i assume . • @ the Close bank if it's still open. Yeah sounds logical actually . But I'm going to stay at the low level for a while. Going too deep will make me kill myself and quit this • Yeah I got that from someone... (Thank god for copy-paste). It indeed saw a bit overcomplicated to me, but it does the job. Will change it. • Will look into that the next basic script if it would require it ! Thanks for the tip • Is there a way to make it cleaner? I mean having like 7 If statements to shear a sheep is indeed messy. Welcome! Thanks buddy party in my pants invite only sry What beverages are available there ^^? Buying invite 1M OSRS GP. Link to comment Share on other sites More sharing options...
Khaleesi Posted May 16, 2015 Share Posted May 16, 2015 Welcome and goodluck! Link to comment Share on other sites More sharing options...
Appelflapjes Posted May 16, 2015 Author Share Posted May 16, 2015 Welcome and goodluck! The godess herself has spoken. I only got one script of you, and... Damn ;) Thanks! 1 Link to comment Share on other sites More sharing options...
Flamezzz Posted May 16, 2015 Share Posted May 16, 2015 You could use a filter, some info: http://osbot.org/forum/topic/71713-objectsgetint-int-and-grounditemsgetint-int-not-working/What you're doing right now is get the closest sheep and then check if it meets a few requirements.You could do this using a filter like this (not tested): public boolean Shear() { if (myPlayer().isAnimating()) return true; Area SHEEP_PEN = new Area(3193, 3257, 3211, 3276); NPC sheep = getNpcs().closest( npc -> npc.getName().equals("Sheep") && SHEEP_PEN.contains(npc) && npc.hasAction("Shear")); return sheep != null && sheep.interact("Shear"); } You basically say give me the closest npc which: has the name "Sheep", is located in the SHEEP_PEN area and has an action "Shear". interact should then turn the camera if needed. Link to comment Share on other sites More sharing options...
yellow123 Posted May 16, 2015 Share Posted May 16, 2015 Welcome to OSBot! If you need anyone to test out your scripts, I'll be happy to. -happy bottting& scripting Link to comment Share on other sites More sharing options...
Appelflapjes Posted May 16, 2015 Author Share Posted May 16, 2015 You could use a filter, some info: http://osbot.org/forum/topic/71713-objectsgetint-int-and-grounditemsgetint-int-not-working/ What you're doing right now is get the closest sheep and then check if it meets a few requirements. You could do this using a filter like this (not tested): public boolean Shear() { if (myPlayer().isAnimating()) return true; Area SHEEP_PEN = new Area(3193, 3257, 3211, 3276); NPC sheep = getNpcs().closest( npc -> npc.getName().equals("Sheep") && SHEEP_PEN.contains(npc) && npc.hasAction("Shear")); return sheep != null && sheep.interact("Shear"); } You basically say give me the closest npc which: has the name "Sheep", is located in the SHEEP_PEN area and has an action "Shear". interact should then turn the camera if needed. Thanks for the tip. But one quick question, why especially is your way better? (You forgot the WHY part of tips ;) ) It looks neater, but would it be faster or something? Is it better to return a Boolean instead of repeating a void? Or do you mean I should do something with 'Shear = true' in the rest of the code ;)? Welcome to OSBot! If you need anyone to test out your scripts, I'll be happy to. -happy bottting& scripting Do you know how to turn code => OSBot Script? I'll PM you my Skype if I'm realeasing some stuff. (First few scripts will be low level focused, so level 3's all the way!) Link to comment Share on other sites More sharing options...
Eagle Scripts Posted May 16, 2015 Share Posted May 16, 2015 Welcome and zoals wij nederlanders zeggen; Welkom ! 1 Link to comment Share on other sites More sharing options...
Suit Posted May 16, 2015 Share Posted May 16, 2015 Welcome and zoals wij nederlanders zeggen; Welkom ! This is in Dutch: Zoals we in Brabant zeggen: Ge zijt hier heulemaal Welkom! Link to comment Share on other sites More sharing options...
Appelflapjes Posted May 16, 2015 Author Share Posted May 16, 2015 Welcome and zoals wij nederlanders zeggen; Welkom ! This is in Dutch: Zoals we in Brabant zeggen: Ge zijt hier heulemaal Welkom! Thanks! And I'd start talking English from now on in this topic, don't want to have haters or mods hate ;) 1 Link to comment Share on other sites More sharing options...
yellow123 Posted May 16, 2015 Share Posted May 16, 2015 Do you know how to turn code => OSBot Script? I'll PM you my Skype if I'm realeasing some stuff. (First few scripts will be low level focused, so level 3's all the way!) No I don't know how, but plenty of other people around here do. Link to comment Share on other sites More sharing options...
Flamezzz Posted May 16, 2015 Share Posted May 16, 2015 Thanks for the tip. But one quick question, why especially is your way better? (You forgot the WHY part of tips ) It looks neater, but would it be faster or something? Is it better to return a Boolean instead of repeating a void? Or do you mean I should do something with 'Shear = true' in the rest of the code ? Do you know how to turn code => OSBot Script? I'll PM you my Skype if I'm realeasing some stuff. (First few scripts will be low level focused, so level 3's all the way!) Well if it is any faster the speed improvement is negligible. The main advantage is that it's clean, and you can't really do anything wrong in this method as long as your filter is defined correctly (and of course interact works). In this case it doesn't really matter if you return a void or boolean, just did that because interact returns a boolean ^^ Link to comment Share on other sites More sharing options...
Appelflapjes Posted May 16, 2015 Author Share Posted May 16, 2015 Well if it is any faster the speed improvement is negligible. The main advantage is that it's clean, and you can't really do anything wrong in this method as long as your filter is defined correctly (and of course interact works). In this case it doesn't really matter if you return a void or boolean, just did that because interact returns a boolean ^^ It indeed does look neater (but seems more difficult with filters (which i've never used before))! Will try to figure that out ;). Link to comment Share on other sites More sharing options...
LeBron Posted May 16, 2015 Share Posted May 16, 2015 Welcome :P Link to comment Share on other sites More sharing options...
boyjohn22 Posted May 17, 2015 Share Posted May 17, 2015 too smart for me but welcome!!! Link to comment Share on other sites More sharing options...