Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • [Open Source] F2P Trade Restrictions Unlocker


    bap
     Share

    Recommended Posts

    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 :)

    Link to comment
    Share on other sites

    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 by AsBakedAsCake
    Link to comment
    Share on other sites

    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 by notsmile
    Link to comment
    Share on other sites

    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

    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

    • 1 year later...

    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! <3

    Link to comment
    Share on other sites

    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! <3

    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

    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 account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.