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
  • Comparing skill using getRealLevel doesn't work?


    Bultenen
     Share

    Recommended Posts

    Hello! 😀

    I'm working on  a combat script and i want to switch between Attack, Defense etc..

    I currently have this:

    if(getSkills().getRealLevel(Skill.ATTACK) <= 10) {
    			switchCombat(0, 593, 3, 0, "Attack");
    		}
    		else if(getSkills().getRealLevel(Skill.STRENGTH) <= 10 && getSkills().getRealLevel(Skill.ATTACK) >= 10) {
    			switchCombat(1, 593, 7, 0, "Strength");
    		}
    		else if(getSkills().getRealLevel(Skill.DEFENCE) <= 10 && getSkills().getRealLevel(Skill.ATTACK) >= 10 && getSkills().getRealLevel(Skill.STRENGTH) >= 10) {
    			switchCombat(3, 593, 15, 0, "Defense");
    		}

    But everytime this script always goes into the combat tab widget and chooses "Stab" wich is Attack, even if my attack level is over 10.

    So what am i doing wrong? 😅

    Link to comment
    Share on other sites

    Looks like your widget child ID's are incorrect (this is weapon dependant dont forget) 

    Widget cbtWidget = ctx.getWidgets().getWidget(593);
    if (cbtWidget == null) {
        return 0;
    }
        case ATTACK:
            cbtWidget.getChild(4).interact();
            break;
        case STRENGTH:
            cbtWidget.getChild(8).interact();
            break;
        case DEFENCE:
            cbtWidget.getChild(16).interact();
            break;
    Link to comment
    Share on other sites

    1 hour ago, TheCloakdOne said:

    Looks like your widget child ID's are incorrect (this is weapon dependant dont forget) 

    Widget cbtWidget = ctx.getWidgets().getWidget(593);
    if (cbtWidget == null) {
        return 0;
    }
        case ATTACK:
            cbtWidget.getChild(4).interact();
            break;
        case STRENGTH:
            cbtWidget.getChild(8).interact();
            break;
        case DEFENCE:
            cbtWidget.getChild(16).interact();
            break;

    OH yeah that makes sense! Will try and will most definitely work! Thank you 😊

    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.