Jump to content

Why does it always click the Attack style?


Dab in a Lab

Recommended Posts

Every time it attacks a seagull and its leveling Attack, it clicks on Attack exp style. Doesn't do it for Strength or Defense. Can't seem to notice why

When training Attack, the logger will read :

Training Attack #

Can attack seagull

Attacking seagull

 

Spoiler

private void fightingSeagulls() throws InterruptedException {

        if (!portSarim.contains(myPlayer())) {
            getWalking().webWalk(seagulls);
        }

            switchSword();
            seagullEXP();

            if (!myPlayer().isUnderAttack() && myPlayer().isAttackable()) {
                log("Can attack seagull");

                NPC seagull = getNpcs().closest("Seagull");

                if (seagull != null && !seagull.isUnderAttack() && seagull.isAttackable() && !seagull.isHitBarVisible())
                    seagull.interact("Attack");
                log("Attacking seagull");

                switch (getConfigs().get(173)) {
                    case 0:
                        getWidgets().interact(160, 22, "Toggle Run");

                        break;
                }
                if (getCombat().isFighting()) {

                    new ConditionalSleep(300000, 10000) {
                        @Override
                        public boolean condition() throws InterruptedException {
                            return !getCombat().isFighting();
                        }
                    }.sleep();
                }
            }
        }

 private void seagullEXP() {

        switch (getConfigs().get(43)) {

            case 0:

                if (getSkills().getDynamic(Skill.STRENGTH) < 5) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 8, 4, "Slash");
                    log("Training strength 1");

                } else if (((getSkills().getDynamic(Skill.ATTACK) >= 5) && getSkills().getDynamic(Skill.ATTACK) < 10) &&
                        getSkills().getDynamic(Skill.STRENGTH) < 10) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 8, 4, "Slash");
                    log("Training strength 2");

                } else if (((getSkills().getDynamic(Skill.ATTACK) >= 10) && getSkills().getDynamic(Skill.ATTACK) < 15) &&
                        getSkills().getDynamic(Skill.STRENGTH) < 15) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 8, 4, "Slash");
                    log("Training strength 3");

                } else if (((getSkills().getDynamic(Skill.ATTACK) >= 15) && getSkills().getDynamic(Skill.ATTACK) < 20) &&
                        getSkills().getDynamic(Skill.STRENGTH) < 20) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 8, 4, "Slash");
                    log("Training strength 4");

                } else if (((getSkills().getDynamic(Skill.ATTACK) >= 20) && getSkills().getDynamic(Skill.ATTACK) < 25) &&
                        getSkills().getDynamic(Skill.STRENGTH) < 25) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 8, 4, "Slash");
                    log("Training strength 5");

                } else if (((getSkills().getDynamic(Skill.ATTACK) >= 25) && getSkills().getDynamic(Skill.ATTACK) < 30) &&
                        getSkills().getDynamic(Skill.STRENGTH) < 30) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 8, 4, "Slash");
                    log("Training strength 6");

                } else if (((getSkills().getDynamic(Skill.ATTACK) >= 30) && getSkills().getDynamic(Skill.ATTACK) < 35) &&
                        getSkills().getDynamic(Skill.STRENGTH) < 35) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 8, 4, "Slash");
                    log("Training strength 7");

                } else if (((getSkills().getDynamic(Skill.ATTACK) >= 35) && getSkills().getDynamic(Skill.ATTACK) < 40) &&
                        getSkills().getDynamic(Skill.STRENGTH) < 40) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 8, 4, "Slash");
                    log("Training strength 8");

                } else if ((getSkills().getDynamic(Skill.ATTACK) >= 40) && (getSkills().getDynamic(Skill.STRENGTH) >= 40)) {

                    getWidgets().interact(593, 16, 4, "Block");
                    log("Training defence");

                }

            case 1:

                 if ((getSkills().getDynamic(Skill.STRENGTH) >= 5) && (getSkills().getDynamic(Skill.ATTACK) < 5)) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 4, 4, "Chop");
                    log("Training Attack 1");

                } else if ((getSkills().getDynamic(Skill.STRENGTH) >= 10) && (getSkills().getDynamic(Skill.ATTACK) < 10)) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 4, 4, "Chop");
                    log("Training Attack 2");

                } else if ((getSkills().getDynamic(Skill.STRENGTH) >= 15) && (getSkills().getDynamic(Skill.ATTACK) < 15)) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 4, 4, "Chop");
                    log("Training Attack 3");

                } else if ((getSkills().getDynamic(Skill.STRENGTH) >= 20) && (getSkills().getDynamic(Skill.ATTACK) < 20)) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 4, 4, "Chop");
                    log("Training Attack 4");

                } else if ((getSkills().getDynamic(Skill.STRENGTH) >= 25) && (getSkills().getDynamic(Skill.ATTACK) < 25)) {
                    getTabs().open(Tab.ATTACK);

                    getWidgets().interact(593, 4, 4, "Chop");
                    log("Training Attack 5");

                } else if ((getSkills().getDynamic(Skill.STRENGTH) >= 30) && (getSkills().getDynamic(Skill.ATTACK) < 30)) {
                     getTabs().open(Tab.ATTACK);

                     getWidgets().interact(593, 4, 4, "Chop");
                     log("Training Attack 6");

                 } else if ((getSkills().getDynamic(Skill.STRENGTH) >= 35) && (getSkills().getDynamic(Skill.ATTACK) < 35)) {
                     getTabs().open(Tab.ATTACK);

                     getWidgets().interact(593, 4, 4, "Chop");
                     log("Training Attack 7");

                 } else if ((getSkills().getDynamic(Skill.STRENGTH) >= 40) && (getSkills().getDynamic(Skill.ATTACK) < 40)) {
                     getTabs().open(Tab.ATTACK);

                     getWidgets().interact(593, 4, 4, "Chop");
                     log("Training Attack 6");


                } else if ((getSkills().getDynamic(Skill.ATTACK) >= 40) && (getSkills().getDynamic(Skill.STRENGTH) >= 40)) {

                    getWidgets().interact(593, 16, 4, "Block");
                    log("Training defence ");
                }

        }
    }

 

 

Link to comment
Share on other sites

Don't use hard coded widgets.

16 minutes ago, Apaec said:

I'm sure you can find the reason by putting log statements around the code and seeing where it gets to. However this problem could easily be avoided and debugged a lot quicker by making your code more general.

 

Edited by HunterRS
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...