trainux Posted May 5, 2018 Posted May 5, 2018 (edited) I understand that to obtain the current option is like this: getConfigs().get(43) Knowing that the ways to use are the following: 0 - Attack 1 - Strength 3 - Defense How do I order the change of this configuration? Many thanks to anyone who can help me. Edited May 5, 2018 by trainux
d0zza Posted May 5, 2018 Posted May 5, 2018 So it seems like you've figured out that if that config is a certain value, you're currently using that attack style. Now we check if we're currently using the attack style you want, and then we use widgets to change the attack style, for example: if (needAttackStyle() && getConfigs().get(43) != 0) { open settings tab and interact with the required widget }
trainux Posted May 5, 2018 Author Posted May 5, 2018 22 minutes ago, d0zza said: So it seems like you've figured out that if that config is a certain value, you're currently using that attack style. Now we check if we're currently using the attack style you want, and then we use widgets to change the attack style, for example: if (needAttackStyle() && getConfigs().get(43) != 0) { open settings tab and interact with the required widget } Ok, I understand that changing the tab is simple: getTabs().open(Tab.ATTACK); The part that I do not understand is the "widget", so far I do not know how they are used for more than I look for examples, I do not know what I'm confusing.
d0zza Posted May 5, 2018 Posted May 5, 2018 1 minute ago, trainux said: Ok, I understand that changing the tab is simple: getTabs().open(Tab.ATTACK); The part that I do not understand is the "widget", so far I do not know how they are used for more than I look for examples, I do not know what I'm confusing. Go to the settings in osbot and tick widgets, you should get a good idea of what they are from experimenting with that.
trainux Posted May 5, 2018 Author Posted May 5, 2018 14 minutes ago, d0zza said: Go to the settings in osbot and tick widgets, you should get a good idea of what they are from experimenting with that. Now what do I do with that information? I really apologize for my ignorance.
d0zza Posted May 5, 2018 Posted May 5, 2018 5 minutes ago, trainux said: Now what do I do with that information? I really apologize for my ignorance. Get the widget you want and interact with it using the widget api. https://osbot.org/api/org/osbot/rs07/api/Widgets.html
trainux Posted May 5, 2018 Author Posted May 5, 2018 18 minutes ago, d0zza said: Get the widget you want and interact with it using the widget api. https://osbot.org/api/org/osbot/rs07/api/Widgets.html Thanks. int str = getSkills().getDynamic(Skill.STRENGTH); RS2Widget modeStr = getWidgets().get(593,7); int atk = getSkills().getDynamic(Skill.ATTACK); RS2Widget modeAtk = getWidgets().get(593,3); int def = getSkills().getDynamic(Skill.DEFENCE); RS2Widget modeDef = getWidgets().get(593,15); int config = getConfigs().get(43); if(str < 13) { getTabs().open(Tab.ATTACK); sleep(1000); if(config!=1) { modeStr.interact("Slash"); sleep(random(3000,7000)); } getTabs().open(Tab.INVENTORY); }else if(atk < 13) { getTabs().open(Tab.ATTACK); sleep(1000); if(config!=0) { modeAtk.interact("Chop"); sleep(random(3000,7000)); } getTabs().open(Tab.INVENTORY); }else if(def < 13) { getTabs().open(Tab.ATTACK); sleep(1000); if(config!=3) { modeDef.interact("Block"); sleep(random(3000,7000)); } getTabs().open(Tab.INVENTORY); }else { getTabs().open(Tab.ATTACK); sleep(1000); if(config!=1) { modeStr.interact("Slash"); sleep(random(3000,7000)); } getTabs().open(Tab.INVENTORY); } Declare widgets and interact with them. 1
Team Cape Posted May 5, 2018 Posted May 5, 2018 7 hours ago, trainux said: Thanks. int str = getSkills().getDynamic(Skill.STRENGTH); RS2Widget modeStr = getWidgets().get(593,7); int atk = getSkills().getDynamic(Skill.ATTACK); RS2Widget modeAtk = getWidgets().get(593,3); int def = getSkills().getDynamic(Skill.DEFENCE); RS2Widget modeDef = getWidgets().get(593,15); int config = getConfigs().get(43); if(str < 13) { getTabs().open(Tab.ATTACK); sleep(1000); if(config!=1) { modeStr.interact("Slash"); sleep(random(3000,7000)); } getTabs().open(Tab.INVENTORY); }else if(atk < 13) { getTabs().open(Tab.ATTACK); sleep(1000); if(config!=0) { modeAtk.interact("Chop"); sleep(random(3000,7000)); } getTabs().open(Tab.INVENTORY); }else if(def < 13) { getTabs().open(Tab.ATTACK); sleep(1000); if(config!=3) { modeDef.interact("Block"); sleep(random(3000,7000)); } getTabs().open(Tab.INVENTORY); }else { getTabs().open(Tab.ATTACK); sleep(1000); if(config!=1) { modeStr.interact("Slash"); sleep(random(3000,7000)); } getTabs().open(Tab.INVENTORY); } Declare widgets and interact with them. null checks