flewis Posted August 1, 2017 Posted August 1, 2017 Dear all, When learning the OSBOT API/Java I made a simple feather collector script. I just wanted to put the script out there for everyone to use, it's efficient but it could easily be made more efficient if someone wanted to edit the timings just I didn't want to get banned so I made the times quite long and random. Please remember I wrote this about a week ago in my first 1-2 hours of learning Java and I have got a lot better since then Anyway have fun with the script, if you want anything added to it please let me know and I'll see what I can do!! Download - FeatherCollector.jar Pastebin - https://pastebin.com/nwhamZZF Thank you for downloading!! -Flewis 1
Juggles Posted August 1, 2017 Posted August 1, 2017 I see a lot of @Lewis in you. Could be the next big scripter 1
Apaec Posted August 1, 2017 Posted August 1, 2017 Nice work (: Just a few things, firstly, there's no need to store Player myPlayer() in a variable since you're only using it once. Secondly, I would highly recommend using a conditional sleep after interacting with feathers instead of a static one. This conditional sleep could factor in distance to the feathers to determine the threshold, and look for an inventory gain/amount rise for the condition boolean. This means the script will only sleep for as long as it needs to, and time out and try again if for whatever reason the interaction fails (Also I would recommend making use of the interact methods boolean return). You can define a conditional sleep anonymously, or by extending the abstract class with your own class and overriding the method that way. Check out the API: https://osbot.org/api/org/osbot/rs07/utility/ConditionalSleep.html -Apa 1
HeyImJamie Posted August 2, 2017 Posted August 2, 2017 I don't think there's an animation for feathers so your if check is useless. I assume you've learned that since then though as this was your first script? :P
flewis Posted August 2, 2017 Author Posted August 2, 2017 2 hours ago, Juggles said: I see a lot of @Lewis in you. Could be the next big scripter I hope so, I have big plans for the dungeoneering and summoning skills when they when they release 2 hours ago, Apaec said: Nice work (: Just a few things, firstly, there's no need to store Player myPlayer() in a variable since you're only using it once. Secondly, I would highly recommend using a conditional sleep after interacting with feathers instead of a static one. This conditional sleep could factor in distance to the feathers to determine the threshold, and look for an inventory gain/amount rise for the condition boolean. This means the script will only sleep for as long as it needs to, and time out and try again if for whatever reason the interaction fails (Also I would recommend making use of the interact methods boolean return). You can define a conditional sleep anonymously, or by extending the abstract class with your own class and overriding the method that way. Check out the API: https://osbot.org/api/org/osbot/rs07/utility/ConditionalSleep.html -Apa Wow thank you for the advice this is actually game changing, thank you!! This will come in handy when making things like dungeoneering and summoning scripts when the two skills finally release!! Again thank you so much!! 27 minutes ago, Mumble said: Congratulations on release! Thank you
dreameo Posted August 2, 2017 Posted August 2, 2017 6 minutes ago, HeyImJamie said: I don't think there's an animation for feathers so your if check is useless. I assume you've learned that since then though as this was your first script? :P I thought of this too. Can check that current tile to see if it no longer has a grounditem called feather. ;) 1
flewis Posted August 2, 2017 Author Posted August 2, 2017 (edited) 19 minutes ago, HeyImJamie said: I don't think there's an animation for feathers so your if check is useless. I assume you've learned that since then though as this was your first script? :P Oh no it's testing if they player is animating (moving) not the feather. Just look over the pastebin again, dw though I definitely knew that even from the beginning!! Thanks for the advice anyway though Edited August 2, 2017 by flewis
flewis Posted August 2, 2017 Author Posted August 2, 2017 12 minutes ago, dreameo said: I thought of this too. Can check that current tile to see if it no longer has a grounditem called feather. ;) It's testing if the player is doing an animation (moving) not the feather!!
dreameo Posted August 2, 2017 Posted August 2, 2017 Yes, however there is a case when you click, and are moving, a feather either disappears or is already taken. Yet the bot continues towards the feather that is no longer there.
HeyImJamie Posted August 2, 2017 Posted August 2, 2017 Movement isn't considered an animation. Your Animation ID is still -1 (I think). You could do what Dreameo says which is viable, or what I'd do is: if (feathers exist) { grab inv feather count if (interact w/ feathers){ conditional sleep until inv contains > feathercount; } } else { // no feathers }
Satire Posted August 2, 2017 Posted August 2, 2017 3 hours ago, flewis said: I hope so, I have big plans for the dungeoneering and summoning skills when they when they release Wow thank you for the advice this is actually game changing, thank you!! This will come in handy when making things like dungeoneering and summoning scripts when the two skills finally release!! Again thank you so much!! Thank you It's called raids.