Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

ITryNotToTroll

ITryNotToTroll Scripter Application

   8 members have voted

  1. 1. Should ITryNotToTroll be a scripter?

    • Yes
      2
    • No
      6

Please sign in or register to vote in this poll.

17 posts in this topic

1) Snipplets:

 

None that aren't in the Dump

2) Tutorials:

 

None that aren't in the Dump


3) Randoms/updates submitted: 

 

None that have a thread

4) Scripts available to the public:

 

Troll Progressive Smelter

Troll Progressive Superheater:

Troll Progressive Thieving


5) Short biography / Coding Experience: 

 

I've been doing some basic coding for a few years now, but only in the past couple of months have I actually bothered to properly learn how to program rather than just basic scripting. I have the logic of programming things down, but I believe there's still much for me to learn about how programming languages work and how to make complicated programs. I do however, believe I am at a level where I am confident in a lot of things.

 

Since it's not listed below, I want to be scripter for a few reasons. Firstly and honestly, free VIP. I'm not making money off of my scripts and I don't bot or make any money from tribot, so it would be nice not to have to pay for it. Secondly, I like more words below my name. One of my main, more serious reasons however is that I would like access to the private scripter forums that I know you guys have so that I can get help or look at things that may teach me how to do new things or give me insight to how things work. The last reason is that I feel users would feel safer using my scripts if I had a scripter rank and so I would hopefully get more feedback


6) Reasons why you feel you deserve Scripter: 

 

I feel I deserve scripter as I dedicate a lot of time to tribot and have made many scripts, either small things that random people have requested or bigger scripts where I feel they are needed as there isn't a good one currently available. I'm not going to put a bunch of made up things here, I feel I have a lot to learn but that I have enough knowledge to be able to create good and hopefully flawless scripts for people to use.


7) What you plan to provide the community with: 

 

More scripts, basic programming tutorials, if there's demand I would like to do basic programming videos or livestreams as well.


8) Do you agree to continue to not only update, but provide more free, open sourced scripts to the community?

Yes, yes I do.
 
 
 
Honestly, I'm looking for feedback more than anything else. Other than my brace style, I know it's not "conventional" for java and I can change it without a problem but I like it.
 
@AlphaDog, added a poll
@Usa I'll remove the last one then, someone helped me and asked me to now make it publicly avaliable
@erickho123 I never knew the boolean API existed, thank you, that seems pretty handy. I've actually started to use multiple classes now because honestly it makes programming a hell of a lot easier, especially when scripts share functionality. How isn't my code neat other than my brace style and lack of classes though? 
@warfront1 Thank you, this is a very thorough analysis of my code, I'll look into each thing and change it tonight :)
@erickho123 I'll try and find the old pastebins in a bit :)
@Everyone else, thanks a lot! I'm actually re-writing my scripts at the moment to try and make them much better, thanks for all the feedback
 
 
Can you please check my new smelter source code and give me feedback on that? Thanks!
Edited by ITryNotToTroll
1 person likes this

Share this post


Link to post
Share on other sites

Just reading the application you've written makes you an ideal candidate for the scripter rank as it shows the kindness you have towards the community. I know the community would benefit from your scripts as it brings something new.  I've also seen you help out in the community so its a yes from me. 

2 people like this

Share this post


Link to post
Share on other sites

I wish you'd make your code neater so I could read it and I hate the way you format your braces. Everything is in one class, I've noticed you're not taking advantage of the api boolean methods.

 

For example

depositsleep

to

if(deposit))sleep

Some of your code do not meet these requirements: https://tribot.org/forums/topic/32245-scripting-knowledge-requirements/

Use Timing#currentTimeMillis() instead and for your "failsafes" you can just use the Timing#waitCondition

You should've definitely made your Bar enum contain the amounts you need to withdraw (check setVariables) for neater code & put it in a seperate class

You could've just done a for loop with enum#values() to return the bar, (Check setBar)

 

 

 

I only took a quick glance at your scripts and noticed that off the bat. I'm going to take a better glance on thursday/friday if it's still open and edit this post. I don't have an answer yet, but you should take upon these tips to improve before I take a look at it again.

 

Community wise: Yes, even though I see you come and go sometimes (long time ago and even now), hopefully that won't happen again for a while.

Code wise: I'd need to evaluate more, but your code isn't that neat.

Edited by erickho123

Share this post


Link to post
Share on other sites

Troll Progressive Thieving Code Analysis:

 

Overall Logic issues:

  • (NPCs.find("Man").length > 0 && NPCs.find("Man")[0].getPosition().distanceTo(Player.getPosition()) < 8)

    • Can pull a null pointer

  • Many lines that return the same case could be simplified by altering if/else statements. Possibly half the code could be eliminated and simplified.

 

I will now go through each method explaining issues/suggestions

 

withdrawFood():

Why not use the boolean return from withdraw before waiting the sleep duration, which by the way is handled by a client method already that does a much more compact, clean, and useful implementation. Look at the Timing library, specifically in this case waitCondition.

 

isBeingAttackedByGaurd():

can be simplified using logical operators

 

inventoryOnlyContainsFood():

  • Why not utilize the for each loop added years ago in java 5, it increases readability.

  • There is no check to see if the definition is null, the API docs claim there is a possibility for a null return.

  • There is no check to see if the name is null pulled from the definition. The Tribot API docs state that this can also return a null value;

 

isAnimating():

  • Timing library would clean this up in a few lines with far superior legibility

 

hasFoodInBank():

  • The null check on the first element of the array is not necessary

  • Can be simplified into one line by just returning Banking.find(foodName).length>0

 

distanceFromFarmer():

  • The null check on the first element isn’t neccissary

  • The feedback from the method is inconsistent with a 50 return most likely enforcing some rigid logic down the line

  • You calculate distance checks throughout the script numerous times within methods, yet have chosen to only abstract the Farmer to another separate method. There seems to be little to no rhyme or reason for this. Further more, if this was to be made into a separate method it should have included an input parameter for other areas of the script to use. This strikes to the core of creating methods, being able to use them elsewhere.

 

pickPocketNPC(String name):

  • Why attempt to fire the dynamicClicking method with no conditional other than a length check. Use an else on the isOnScreen() negation.

 

TeaAvaliable():

  • The null check on the first element isn’t necessary, could be simplified into a one liner, without creating an additional object.

DropAllTea():

  • just defined one object called stalls in which you search for both objects. Use find nearest and eliminate half of the lines of code. You switch been while and for loops for your sleeping conditions, once again the timing library will solve these issues.

 

StealTea():

  • The way you set up the clicking in rare scenarios could cause an infinite loop not clicking on the stall due to feedback from isUpText not always returning expected values.

 

DepositAllExceptFood():

  • Timing library + use return of depositAllExcept

 

DropJunk():

  • What a mess, null checks are missing all over the place. Advanced for loop required for readability. Could possibly be fixed by using a filter and just using the drop method provided in the TRiBot API.

 

walkToFarmerNPC():

  • Null check not necessary on first element in array

 

Share this post


Link to post
Share on other sites

It looks like on your last application, kalaris had suggested some suggestions that you didn't change as well.

https://tribot.org/forums/topic/40349-itrynottotroll-scripter-application/?p=487351

 

I'd wish I had kept a backup of your old application to compare and see what changes were actually done.

Edited by erickho123

Share this post


Link to post
Share on other sites

Community wise I have to say yes. I've seen you are helping out people a lot with certain requests or just overall help.

As @Zainy stated, a Scripter should be active and help out people the way you do, but in my opinion this is not enough to hold the Scripter rank.

Coding decent scripts with a readable structure, not using too much redundant code and a good knowledge of the API and OO programming in general is a must in my opinion. Which you, looking at your code, don't really do at the moment. I'd also really recommend working with multiple classes instead of using one class. It makes it much easier to maintain and read.

 

I think you're at these levels atm:

- Dedication: 50 / 50

- Code wise: 25 / 50

 

I'd start improving by using the feedback given here. When you think you've improved yourself to a higher level and think you're ready for a next application and I can see you have been improved and you really used the feedback here, then it will be a yes from me. But for now it's a no.

Share this post


Link to post
Share on other sites

Code wise its a no from me.

Will give constructive feedback when i have more time

 

Your code looks really un-orginized to me.

 

For example, your getState method:

        //Get current state of script        public State getState()        {                if(Banking.isInBank())                {                        if(needToEquipForging())                        {                                if(Banking.isBankScreenOpen())                                {                                        return State.CLOSE_BANK;                                }                                else                                {                                        return State.EQUIP_FORGING;                                }                        }                        else                        {                                if(needToBank())                                {                                         if(!Banking.isBankScreenOpen())                                        {                                                return State.OPEN_BANK;                                        }                                        else                                        {                                                return State.USE_BANK;                                        }                                }                                else                                {                                        return State.WALK_TO_FURNACE;                                }                        }                }                else                {                        if(isInFurnace())                        {                                if(needToBank())                                {                                        return State.WALK_TO_BANK;                                }                                else                                {                                        if(isFirstInterfaceOpen())                                        {                                                return State.USE_FIRST_INTERFACE;                                        }                                        else                                        {                                                if(isSecondInterfaceOpen() && !isFirstInterfaceOpen())                                                {                                                        return State.USE_SECOND_INTERFACE;                                                }                                                else                                                {                                                        if(bar == Bar.CANNONBALLS)                                                        {                                                                if(Game.isUptext("Use Steel"))                                                                {                                                                        return State.USE_FURNACE;                                                                }                                                                else                                                                {                                                                        if(isAnimating())                                                                        {                                                                                return State.ANIMATING;                                                                        }                                                                        else                                                                        {                                                                                return State.CLICK_BAR;                                                                        }                                                                }                                                        }                                                        else                                                        {                                                                if(isAnimating())                                                                {                                                                        return State.ANIMATING;                                                                }                                                                else                                                                {                                                                        return State.USE_FURNACE;                                                                }                                                        }                                                }                                         }                                }                        }                        else                        {                                return State.WALK_TO_BANK;                        }                }        }

I agree that it comes down to preference, like when you put brackets on a new line, use short if-else statements or not ect.

But in my opinion this looks alot cleaner then your version:

    public State getState() {        if (Banking.isInBank()) {            if (needToEquipForging()) {                if (Banking.isBankScreenOpen())                    return State.CLOSE_BANK;                return State.EQUIP_FORGING;            }            if (needToBank())                return Banking.isBankScreenOpen() ? State.USE_BANK : State.OPEN_BANK;            return State.WALK_TO_FURNACE;        }        if (isInFurnace()) {            if (needToBank())                return State.WALK_TO_BANK;            if (isFirstInterfaceOpen())                return State.USE_FIRST_INTERFACE;            if (isSecondInterfaceOpen() && !isFirstInterfaceOpen())                return State.USE_SECOND_INTERFACE;            if (Game.isUptext("Use Steel"))                return State.USE_FURNACE;            return isAnimating() ? State.ANIMATING : (bar == Bar.CANNONBALLS ? State.CLICK_BAR : State.USE_FURNACE);        }        return State.WALK_TO_BANK;    }
        private Bar setBar(String string)        {                switch(string)                {                case "Bronze Bar":                        return Bar.BRONZE;                case "Iron Bar":                        return Bar.IRON;                case "Steel Bar":                        return Bar.STEEL;                case "Mithril Bar":                        return Bar.MITHRIL;                case "Adamantite Bar":                        return Bar.ADAMANTITE;                case "Runite Bar":                        return Bar.RUNITE;                case "Cannonballs":                        return Bar.CANNONBALLS;                case "Gold Bar":                        return Bar.GOLD;                case "Silver Bar":                        return Bar.SILVER;                }                return Bar.CANNONBALLS;        } 

This is unnecessary.

You could for example override your enum's toString method.

Example:

enum Bar {    BRONZE,    IRON,    STEEL,    MITHRIL,    ADAMANTITE,    RUNITE,    SILVER,    GOLD,    CANNONBALLS;    @Override    public String toString() {        return super.toString().charAt(0) + super.toString().substring(1).toLowerCase() + " bar";    }}

This

private boolean isFirstInterfaceOpen()        {                RSInterface barSmeltInterface;                switch(bar)                {                case BRONZE:                case IRON:                case STEEL:                case MITHRIL:                case ADAMANTITE:                case RUNITE:                case SILVER:                case GOLD:                        barSmeltInterface = Interfaces.get(BAR_SELECT_INTERFACE_ID,BAR_SELECT_INTERFACE_BRONZE_ID);                        return barSmeltInterface != null && !barSmeltInterface.isHidden();                case CANNONBALLS:                        barSmeltInterface = Interfaces.get(CANNONBALL_SELECT_INTERFACE_ID, CANNONBALL_SELECT_INTERFACE_CHILD_ID);                        return barSmeltInterface != null && !barSmeltInterface.isHidden();                }                return false;        }

Can be shortened to this:

    private boolean isFirstInterfaceOpen() {        return Interfaces.isInterfaceValid(bar == Bar.CANNONBALLS ? CANNONBALL_SELECT_INTERFACE_ID : BAR_SELECT_INTERFACE_ID);    }

These 3 methods have alot of unneeded duplicated code

This method has duplicate code:

 private boolean needToBank()        {                switch(bar)                {                case BRONZE:                        return Inventory.getCount("Tin ore") == 0 || Inventory.getCount("Copper ore") == 0;                case IRON:                        return Inventory.getCount("Iron ore") == 0;                case STEEL:                        return Inventory.getCount("Iron ore") == 0 || Inventory.getCount("Coal") < 2;                case MITHRIL:                        return Inventory.getCount("Mithril ore") == 0 || Inventory.getCount("Coal") < 4;                case ADAMANTITE:                        return Inventory.getCount("Adamantite ore") == 0 || Inventory.getCount("Coal") < 6;                case RUNITE:                        return Inventory.getCount("Runite ore") == 0 || Inventory.getCount("Coal") < 8;                case SILVER:                        return Inventory.getCount("Silver ore") == 0;                case GOLD:                        return Inventory.getCount("Gold ore") == 0;                case CANNONBALLS:                        return Inventory.getCount("Steel bar") ==0 || Inventory.getCount("Ammo mould") == 0;                }                return true;        }

Can be reduced to:

        private boolean needToBank() {              for (Ore ore : bar.getRequirements().keys()) {  //Using a HashMap for example                  if (Inventory.getCount(ore.getId()) < bar.getRequirements().get(ore);                      return true;              }                           return false;        } 

Or you could use a wrapper class

class OreRequirement {    private final Ore ore;    private final int amount;    public OreRequirement(Ore ore, int amount) {        this.ore = ore;        this.amount = amount;    }    //getters...}private boolean needToBank() {    for (OreRequirement req : bar.getRequirements()) {         if (Inventory.getCount(req.getOre().getId()) < req.getAmount();           return true;    }     return false;} 

The following 2 methods have the same problem as the one above, alot of duplicate code:

 

        private void useBank()        {                long timeout;                switch(bar)                {                case BRONZE:                        Banking.depositAll();                        Banking.withdraw(14, "Tin ore");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Tin ore") == 0)                        {                                sleep(20, 70);                        }                        Banking.withdraw(14, "Copper ore");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Copper ore") == 0)                        {                                sleep(20, 70);                        }                        break;                case IRON:                        Banking.depositAll();                        if(usingForging && Inventory.getCount("Ring of forging") == 0 && !Equipment.isEquipped("Ring of forging"))                        {                                Banking.withdraw(1, "Ring of forging");                                timeout = System.currentTimeMillis();                                while(timeout + 2000 > System.currentTimeMillis()                                                && Inventory.getCount("Ring of forging") == 0)                                {                                        sleep(20, 70);                                }                        }                        else                        {                                Banking.withdraw(0, "Iron ore");                                timeout = System.currentTimeMillis();                                while(timeout + 2000 > System.currentTimeMillis()                                                && Inventory.getCount("Iron ore") == 0)                                {                                        sleep(20, 70);                                }                        }                        break;                case STEEL:                        Banking.depositAll();                        Banking.withdraw(9, "Iron ore");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Iron ore") == 0)                        {                                sleep(20, 70);                        }                        Banking.withdraw(0, "Coal");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Coal") == 0)                        {                                sleep(20, 70);                        }                        break;                case MITHRIL:                        Banking.depositAll();                        Banking.withdraw(5, "Mithril ore");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Mithril ore") == 0)                        {                                sleep(20, 70);                        }                        Banking.withdraw(0, "Coal");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Coal") == 0)                        {                                sleep(20, 70);                        }                        break;                case ADAMANTITE:                        Banking.depositAll();                        Banking.withdraw(4, "Admantite ore");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Adamantite ore") == 0)                        {                                sleep(20, 70);                        }                        Banking.withdraw(0, "Coal");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Coal") == 0)                        {                                sleep(20, 70);                        }                        break;                case RUNITE:                        Banking.depositAll();                        Banking.withdraw(3, "Runite ore");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Runite ore") == 0)                        {                                sleep(20, 70);                        }                        Banking.withdraw(0, "Coal");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Coal") == 0)                        {                                sleep(20, 70);                        }                        break;                case SILVER:                        Banking.depositAll();                        Banking.withdraw(0, "Silver ore");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Silver ore") == 0)                        {                                sleep(20, 70);                        }                        break;                case GOLD:                        Banking.depositAll();                        Banking.withdraw(0, "Gold ore");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Gold ore") == 0)                        {                                sleep(20, 70);                        }                        break;                case CANNONBALLS:                        Banking.depositAllExcept("Ammo mould");                        if(Inventory.getCount("Ammo mould") == 0)                        {                                Banking.withdraw(1, "Ammo mould");                                timeout = System.currentTimeMillis();                                while(timeout + 2000 > System.currentTimeMillis()                                                && Inventory.getCount("Ammo mould") == 0)                                {                                        sleep(20, 70);                                }                        }                        Banking.withdraw(0, "Steel bar");                        timeout = System.currentTimeMillis();                        while(timeout + 2000 > System.currentTimeMillis()                                        && Inventory.getCount("Steel bar") == 0)                        {                                sleep(20, 70);                        }                        break;                }        } 

 

     private void useFirstInterface()        {                RSInterface smeltInterface;                switch(bar)                {                case BRONZE:                        smeltInterface = Interfaces.get(BAR_SELECT_INTERFACE_ID, BAR_SELECT_INTERFACE_BRONZE_ID);                        if(smeltInterface != null)                        {                                if(Game.getUptext().contains("Smelt 1 Bronze"))                                {                                        Mouse.click(3);                                        chooseOption("Smelt X Bronze");                                }                                else                                {                                        smeltInterface.click("Smelt X Bronze");                                }                        }                        hoverBox = smeltInterface.getAbsoluteBounds();                        break;                case IRON:                        smeltInterface = Interfaces.get(BAR_SELECT_INTERFACE_ID, BAR_SELECT_INTERFACE_IRON_ID);                        if(smeltInterface != null)                        {                                if(Game.getUptext().contains("Smelt 1 Iron"))                                {                                        Mouse.click(3);                                        chooseOption("Smelt X Iron");                                }                                else                                {                                        smeltInterface.click("Smelt X Iron");                                }                        }                        hoverBox = smeltInterface.getAbsoluteBounds();                        break;                case STEEL:                        smeltInterface = Interfaces.get(BAR_SELECT_INTERFACE_ID, BAR_SELECT_INTERFACE_STEEL_ID);                        if(smeltInterface != null)                        {                                if(Game.getUptext().contains("Smelt 1 Steel"))                                {                                        Mouse.click(3);                                        chooseOption("Smelt 10 Steel");                                }                                else                                {                                        smeltInterface.click("Smelt 10 Steel");                                }                        }                        hoverBox = smeltInterface.getAbsoluteBounds();                        break;                case MITHRIL:                        smeltInterface = Interfaces.get(BAR_SELECT_INTERFACE_ID, BAR_SELECT_INTERFACE_MITHRIL_ID);                        if(smeltInterface != null)                        {                                if(Game.getUptext().contains("Smelt 1 Mithril"))                                {                                        Mouse.click(3);                                        chooseOption("Smelt 10 Mithril");                                }                                else                                {                                        smeltInterface.click("Smelt 10 Mithril");                                }                        }                        hoverBox = smeltInterface.getAbsoluteBounds();                        break;                case ADAMANTITE:                        smeltInterface = Interfaces.get(BAR_SELECT_INTERFACE_ID, BAR_SELECT_INTERFACE_ADAMANTITE_ID);                        if(smeltInterface != null)                        {                                if(Game.getUptext().contains("Smelt 1 Adamant"))                                {                                        Mouse.click(3);                                        chooseOption("Smelt 5 Adamant");                                }                                else                                {                                        smeltInterface.click("Smelt 5 Adamant");                                }                        }                        hoverBox = smeltInterface.getAbsoluteBounds();                        break;                case RUNITE:                        smeltInterface = Interfaces.get(BAR_SELECT_INTERFACE_ID, BAR_SELECT_INTERFACE_RUNITE_ID);                        if(smeltInterface != null)                        {                                if(Game.getUptext().contains("Smelt 1 Rune"))                                {                                        Mouse.click(3);                                        chooseOption("Smelt 5 Rune");                                }                                else                                {                                        smeltInterface.click("Smelt 5 Rune");                                }                        }                        hoverBox = smeltInterface.getAbsoluteBounds();                        break;                case SILVER:                        smeltInterface = Interfaces.get(BAR_SELECT_INTERFACE_ID, BAR_SELECT_INTERFACE_SILVER_ID);                        if(smeltInterface != null)                        {                                if(Game.getUptext().contains("Smelt 1 Silver"))                                {                                        Mouse.click(3);                                        chooseOption("Smelt X Silver");                                }                                else                                {                                        smeltInterface.click("Smelt X Silver");                                }                        }                        hoverBox = smeltInterface.getAbsoluteBounds();                        break;                case GOLD:                        smeltInterface = Interfaces.get(BAR_SELECT_INTERFACE_ID, BAR_SELECT_INTERFACE_GOLD_ID);                        if(smeltInterface != null)                        {                                if(Game.getUptext().contains("Smelt 1 Gold"))                                {                                        Mouse.click(3);                                        chooseOption("Smelt X Gold");                                }                                else                                {                                        smeltInterface.click("Smelt X Gold");                                }                        }                        hoverBox = smeltInterface.getAbsoluteBounds();                        break;                case CANNONBALLS:                        smeltInterface = Interfaces.get(CANNONBALL_SELECT_INTERFACE_ID, CANNONBALL_SELECT_INTERFACE_CHILD_ID);                        if(smeltInterface != null)                        {                                smeltInterface.click();                        }                        hoverBox = smeltInterface.getAbsoluteBounds();                        break;                }                long timeout = System.currentTimeMillis();                while(timeout + 2000 > System.currentTimeMillis()                                && isFirstInterfaceOpen())                {                        sleep(20, 70);                }        } 

 

 

I would make a little bit 'bigger' tasks. So tasks like 'OPEN_BANK' and 'CLOSE_BANK' are unnecessary in my opinion.

Too many little tasks or only a few big tasks will both have a negative result on the efficiency of looking over your code.

 

Example what I would do:

    enum State {        BANK,        WALK_TO_FURNACE,        WALK_TO_BANK,        INTERACT_WITH_FURNACE,        INTERACT_WITH_INTERFACE    }    public State getState() {        if (bar.hasRequirements()) {            if (!furnaceArea.contains(Player.getPosition())) {                return State.WALK_TO_FURNACE;            }                        if (Interfaces.isInterfaceValid(x) || Interfaces.isInterfaceValid(x)) {                return State.INTERACT_WITH_INTERFACE;            }                        return State.INTERACT_WITH_FURNACE;        }                if (!bank.getArea().contains(Player.getPosition())) {            return State.WALK_TO_BANK;        }                return State.BANK;    }

I only looked at your smither script so far.

 

I would like to see the following changes code wise and it will be a yes from me:

  • Remove the duplicate code (in the methods i mentioned above)
  • Use id's instead of names for items (better performance since you don't have to load the name from the item definition this way)
  • Use Interfaces.isInterfaceValid(int id), better performance (the game client has a boolean[] field that contains whether the interfaces are loaded or not)
  • Null check where you have to

Tip: Look into the use of enums, you can neatly store your static data in an enum

Edited by AlphaDog
2 people like this

Share this post


Link to post
Share on other sites

He cant visit the scripters forums..

He should be able to view that thread as far as i know.

 

My vote is no as well, I think most of the script writer touched on what you should improve on before attempting another application. Community wise, it's a yes, code wise not quite yet though users have gotten through with worse code. The final decision is up to USA though.

Edited by erickho123

Share this post


Link to post
Share on other sites

He cant visit the scripters forums..

 

He should be able to view that thread as far as i know.

 Erick is right, he can view that thread. Wouldn't make sense if he couldn't view it since he wouldn't be able to see what he needs to have in his script :P

 

I see you have posted your new source for your smelter script. Pretty quick i think. Assuming you will be doing the same with your other scripts too? 

1 person likes this

Share this post


Link to post
Share on other sites

He cant visit the scripters forums..

yes he can, it's in the application section. Why would a knowledge requirement thread exist if the people applying couldn't see it?

Share this post


Link to post
Share on other sites

 Erick is right, he can view that thread. Wouldn't make sense if he couldn't view it since he wouldn't be able to see what he needs to have in his script :P

 

I see you have posted your new source for your smelter script. Pretty quick i think. Assuming you will be doing the same with your other scripts too? 

 

 

yes he can, it's in the application section. Why would a knowledge requirement thread exist if the people applying couldn't see it?

 

Yes, makes sense.

Nvm what i said, i thought you were reffering too https://tribot.org/forums/topic/38966-efficient-scripting/  :s

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.