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


    Bultenen

    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

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.