![](https://osbot.org/forum/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
![](https://osbot.org/forum/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_default_photo.png)
Paxy
Members-
Posts
4 -
Joined
-
Last visited
-
Feedback
0%
Profile Information
-
Gender
Male
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Paxy's Achievements
![Rank: Newbie (1/10) Newbie](https://osbot.org/forum/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_default_rank.png)
Newbie (1/10)
0
Reputation
-
First question: so basically i want the bot to go from, 20 str to 20 attack to 20 defence for example. I can get the bot to change to agressive attack style but it carries on clicking agressive attack style ive tried 2 or 3 differant ways but cant get it to stop clicking it. Any snippets to help me? second question: I use eclipse and i like to run my scripts usually in debug mode so any minor changes i do are automatically transferred ( unless a restart is require for bigger changes like conditions ) is there a way to save the changes in eclipse and the bot know these changes have been made? Im having to restart the whole client just to change the name of an NPC and its really annoying Thank you. @Override public int onLoop() throws InterruptedException { if (shouldEat()) { currentState = State.EATING; eatFood(); } else if (shouldAttackCow()) { currentState = State.ATTACKING_COW; attackCow(); } else if (shouldChangeAttackStyle()) { currentState = State.CHANGING_ATTACK_STYLE; changeAttackStyle(); } else { currentState = State.IDLE; idleActions(); } return random(200, 500); // Sleep for a short duration before the next loop } private boolean shouldEat() { return getSkills().getDynamic(Skill.HITPOINTS) < 7; // Check if HP is below 15 } private void eatFood() throws InterruptedException { if (!getTabs().isOpen(Tab.INVENTORY)) { getTabs().open(Tab.INVENTORY); } if (getInventory().contains("Trout")) { getInventory().getItem("Trout").interact("Eat"); } } private boolean shouldAttackCow() { return !myPlayer().isAnimating() && COW_AREA.contains(myPosition()); } private void attackCow() throws InterruptedException { NPC cow = npcs.closest(npc -> npc.getName().equals("Cow") && !npc.isUnderAttack() && npc.hasAction("Attack")); if (cow != null && cow.interact("Attack")) { conditionalSleep(() -> myPlayer().isAnimating(), 5000); } } private boolean shouldChangeAttackStyle() { return getSkills().getStatic(Skill.STRENGTH) < 20 || getSkills().getStatic(Skill.ATTACK) < 20 || getSkills().getStatic(Skill.DEFENCE) < 20; } private void changeAttackStyle() throws InterruptedException { switch (getState()) { case CHANGE_TO_AGGRESSIVE: selectAttackStyle(AGGRESSIVE_ATTACK_STYLE_CHILD_ID); break; case CHANGE_TO_ACCURATE: selectAttackStyle(ACCURATE_ATTACK_STYLE_CHILD_ID); break; case CHANGE_TO_DEFENSIVE: selectAttackStyle(DEFENSIVE_ATTACK_STYLE_CHILD_ID); break; case IDLE: log("We have reached 20 in all combat stats!"); this.stop(); break; } } private boolean isAttackStyleSelected(int childId) { // Assuming you have a constant for the parent ID of the combat styles interface return getWidgets().get(593, childId).getSpriteIndex1() == 131; } private void selectAttackStyle(int childId) throws InterruptedException { if (!getTabs().isOpen(Tab.ATTACK)) { getTabs().open(Tab.ATTACK); conditionalSleep(() -> getTabs().isOpen(Tab.ATTACK), 3000); } RS2Widget attackOption = getWidgets().get(COMBAT_OPTIONS_GROUP_ID, childId); if (attackOption != null && attackOption.isVisible() && !isAttackStyleSelected(childId)) { attackOption.interact(); conditionalSleep(() -> isAttackStyleSelected(childId), 3000); } } private State getState() { if (getSkills().getStatic(Skill.STRENGTH) < 20 && !isAttackStyleSelected(AGGRESSIVE_ATTACK_STYLE_CHILD_ID)) { return State.CHANGE_TO_AGGRESSIVE; } else if (getSkills().getStatic(Skill.ATTACK) < 20 && !isAttackStyleSelected(ACCURATE_ATTACK_STYLE_CHILD_ID)) { return State.CHANGE_TO_ACCURATE; } else if (getSkills().getStatic(Skill.DEFENCE) < 20 && !isAttackStyleSelected(DEFENSIVE_ATTACK_STYLE_CHILD_ID)) { return State.CHANGE_TO_DEFENSIVE; } else { return State.IDLE; } } private void idleActions() throws InterruptedException { if (random(1, 100) <= 5) { // 5% chance to rotate the camera getCamera().toEntity(npcs.closest("Cow")); } else if (random(1, 100) <= 3) { // 3% chance to open a random tab getTabs().open(Tab.values()[random(0, Tab.values().length)]); } sleep(random(200, 500)); } private boolean conditionalSleep(java.util.function.BooleanSupplier condition, long timeout) throws InterruptedException { long startTime = System.currentTimeMillis(); while (!condition.getAsBoolean() && (System.currentTimeMillis() - startTime) < timeout) { sleep(100); } return condition.getAsBoolean(); }```
-
Hi guys im new to OSBot i have got a small amount of java knowledge but i only coded in RSPS. I have a few questions. I got a simple chicken killer script going but: I would like to actually see what my house is doing because it at the minute its invisible so its like im sending packets through osrs as i cant see it right click and attack. How do i get my house movements visible and see what its doing.