bap 18 Share Posted February 22, 2021 Hey guys, first post here, been working on a trade restrictions unlocker and planning on uploading it to the sdn as my first script soon. Hope you guys like it Github If there are any improvements that I can make please let me know, I'd really like to improve as much as I can purepanic and Pandemic 1 1 Link to comment Share on other sites More sharing options...
AsBakedAsCake 202 Share Posted February 22, 2021 (edited) Looks good! You'll need to be careful when checking if the player is interacted with. If you stop attacking the NPC for some reason, but its still aggressive towards you, your script wont click another NPC until that one dies or loses aggro on you. Just check if the NPC itself is interacted with. For the player you can just use the health bar, or check if it's in combat. Sorry if this doesn't make complete sense, I'm hung over as fuck lol Edited February 22, 2021 by AsBakedAsCake Link to comment Share on other sites More sharing options...
bap 18 Author Share Posted February 22, 2021 (edited) 14 minutes ago, AsBakedAsCake said: Looks good! You'll need to be careful when checking if the player is interacted with. If the NPC gets stuck behind a wall or something, but is still aggressive towards you, your script wont click another NPC until that one dies or loses aggro on you. Just check if the NPC itself is interacted with. For the player you can just use the health bar, or check if it's in combat. Sorry if this doesn't make complete sense, I'm hung over as fuck lol It makes sense! Thanks, just changed it now in intelliJ Edited February 22, 2021 by notsmile AsBakedAsCake 1 Link to comment Share on other sites More sharing options...
purepanic 47 Share Posted February 22, 2021 Very nice bap 1 Link to comment Share on other sites More sharing options...
Pandemic 2675 Share Posted February 22, 2021 Looks nice! Small issue in AttackChickens.java, your accept logic doesn't do what you want it to do. You'll need to wrap all of the skill checks in their own parentheses, otherwise it can be accepted if JUST attack or strength is less than or equal to 19 as the isInCombat check isn't even called. So it'd need to look like: (Skills.getRealLevel(Skill.ATTACK) <= 19 || Skills.getRealLevel(Skill.STRENGTH) <= 19 || Skills.getRealLevel(Skill.DEFENCE) <= 19) && !Players.localPlayer().isInCombat(); Also just a minor formatting thing, but you can combine a lot of your if/else statements, if an else or if branch doesn't do anything other than another condition, you can combine them just to save a few extra lines and brackets. Obviously it has no real effect on the script, it's just a small readability thing. One example from that same file (starting at line 48): } else { if (!CHICKEN_COOP.getArea().contains(Players.localPlayer())) { StatusBar.info("Walking to Chicken coop", false); Walking.walk(CHICKEN_COOP.getArea().getRandomTile()); } } could be reduced to: } else if (!CHICKEN_COOP.getArea().contains(Players.localPlayer())) { StatusBar.info("Walking to Chicken coop", false); Walking.walk(CHICKEN_COOP.getArea().getRandomTile()); } I've noticed quite a few of those around the project, but again it doesn't really matter, so you do you. Also, the TwentyHours task is never used (as far as I can tell), so you should be able to safely remove it. Link to comment Share on other sites More sharing options...
bap 18 Author Share Posted February 22, 2021 27 minutes ago, Pandemic said: Looks nice! Small issue in AttackChickens.java, your accept logic doesn't do what you want it to do. You'll need to wrap all of the skill checks in their own parentheses, otherwise it can be accepted if JUST attack or strength is less than or equal to 19 as the isInCombat check isn't even called. So it'd need to look like: (Skills.getRealLevel(Skill.ATTACK) <= 19 || Skills.getRealLevel(Skill.STRENGTH) <= 19 || Skills.getRealLevel(Skill.DEFENCE) <= 19) && !Players.localPlayer().isInCombat(); Also just a minor formatting thing, but you can combine a lot of your if/else statements, if an else or if branch doesn't do anything other than another condition, you can combine them just to save a few extra lines and brackets. Obviously it has no real effect on the script, it's just a small readability thing. One example from that same file (starting at line 48): } else { if (!CHICKEN_COOP.getArea().contains(Players.localPlayer())) { StatusBar.info("Walking to Chicken coop", false); Walking.walk(CHICKEN_COOP.getArea().getRandomTile()); } } could be reduced to: } else if (!CHICKEN_COOP.getArea().contains(Players.localPlayer())) { StatusBar.info("Walking to Chicken coop", false); Walking.walk(CHICKEN_COOP.getArea().getRandomTile()); } I've noticed quite a few of those around the project, but again it doesn't really matter, so you do you. Also, the TwentyHours task is never used (as far as I can tell), so you should be able to safely remove it. Thanks!, Yeah I just added the TwentyHours and adding the logic into it soon. Thanks for the tips Link to comment Share on other sites More sharing options...
Pseudo 179 Share Posted February 22, 2021 Nice job my man. Link to comment Share on other sites More sharing options...
Markyyr 0 Share Posted July 7, 2022 Bruh how do i use this...... can someone explain to me on how to use this great script. Kind of explain like you're talking to a 3 year old retarded child. Please & Thankyou! Link to comment Share on other sites More sharing options...
420x69x420 69 Share Posted July 8, 2022 5 hours ago, Markyyr said: Bruh how do i use this...... can someone explain to me on how to use this great script. Kind of explain like you're talking to a 3 year old retarded child. Please & Thankyou! Well to be honest, this script could use some improvement / slight expansion. It basically fights chikken & coaw for u and makes sure the att/str/def styles are switched according to lvl. As you can see: package com.smile.tasks.gametime; import org.dreambot.api.script.TaskNode; public class TwentyHours extends TaskNode { @Override public boolean accept() { return false; } @Override public int execute() { return 0; } } There is no gaemtime hours method, or quest method. I took this script and others to make a working Trade Unlocker, instructions on link: https://github.com/Dreambotter420/TradeUnlocker Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now