aerodude30 Posted August 15, 2019 Posted August 15, 2019 Hey everyone, heres my first script. There was no combat script I could find which fought cows and banked their hides so I made one. Lemme know your thoughts I'd like to get this on the SDN https://github.com/cbartram/AeroCows 4
Czar Posted August 15, 2019 Posted August 15, 2019 1 hour ago, aerodude30 said: Hey everyone, heres my first script. There was no combat script I could find which fought cows and banked their hides so I made one. Lemme know your thoughts I'd like to get this on the SDN https://github.com/cbartram/AeroCows Excellent job, love seeing professionalism especially in regard to scripting - open source (check), readme.md file (check) and the license (check) 2
aerodude30 Posted August 18, 2019 Author Posted August 18, 2019 (edited) removed. Edited June 21, 2021 by aerodude30 1
liverare Posted August 18, 2019 Posted August 18, 2019 (edited) Looking good! In your AttackCow code, you're finding a suitable cow on the activate method and on the execute method. Perhaps create a cow variable up top and reuse the same cow? Also, you could filter out any cows that are being attacked by other players: private boolean isCow(NPC npc) { return npc.getName().equals("Cow") && npc.getAnimation() != Cow.DYING.getAnimation() && (ctx.myPlayer().equals(npc.getInteracting()) || npc.getInteracting() == null); // So either we're the dude the cow's focused on OR the cow's not focused on anybody right now } NPC cow = ctx.getNpcs().singleFilter(ctx.getNpcs().getAll(), (Filter<NPC>) this::isCow); Also, you could make your Task a little easier to use by having it extend MethodProvider and then exchanging the context. You can find it under the MethodProvider section here: Edited August 18, 2019 by liverare 1
dreameo Posted August 18, 2019 Posted August 18, 2019 I looked quickly but just 2 quick comments: Your task class could extend methodProvider instead of passing the reference throughout all the sub-classes. Your util to grab the cost of an item is probably costly (guessing a second or so). There's a json api that lets you grab the costs - https://osbot.org/forum/topic/146793-ge-data/
tarxan Posted August 19, 2019 Posted August 19, 2019 good stuff m8 will run this and post a proggy here