Jump to content

JS3

Members
  • Posts

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

JS3's Achievements

Bronze Poster

Bronze Poster (2/10)

5

Reputation

  1. Nice job on the first script! Keep it up!!
  2. This is easily the best advice. ?
  3. Ain't that the truth! OP stay at it! Good luck with completion, looking forward to it.
  4. Last comment was only a couple weeks old, I'm sure if you try to run it will work..
  5. Hi Guys, I have been expanding on using Enum for storing multiple points of data, but I am unsure how to call upon certain aspects of them to use. Also @Explv, I see you commonly recommend this when others post, so thank you for explaining in other peoples threads. public enum BoatOptions { NOVICE("Novice", 40, new Area(1, 2, 3, 4), 3), INTERMEDIATE("Intermediate", 70, new Area(2, 3, 4, 5), 4), VETERAN("Veteran", 100, new Area(3,4,5,6), 5); String name; int levelRequired; Area area; int pointBonus; BoatOptions(final String name, final int levelRequired, final Area area, final int pointBonus){ this.name = name; this.levelRequired = levelRequired; this.area = area; this.pointBonus = pointBonus; } @Override public boolean toString(){ return name; } public int getLevelRequired() { return levelRequired; } public int getPointBonus() { return pointBonus; } } I want to set up a few methods based on the BoatOptions. Obvious examples are, area for walking to, pointBonus to display the number of PC points and I was planning to make the bot choose the best boat based on combat level. I'm sure it's simple but I am confused. Any help is appreciated!
  6. JS3

    Simple Alcher

    import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(name = "HiAlch", version = 1, author = "J$", logo = "", info = "") public class Main extends Script { @Override public void onStart() throws InterruptedException { getExperienceTracker().start(Skill.MAGIC); } @Override public int onLoop() throws InterruptedException { if (canAlch()) { clickAlch(); } else { stop(); log("Out of supplies or dead"); } return 700; } public boolean canAlch() { return getEquipment().isWieldingWeaponThatContains("staff") && getInventory().contains("Nature rune", "Yew longbow (u)"); } public void clickAlch() { RS2Widget[] alchPic = getWidgets().getWidgets(218, 35); int rX = random(705, 717); int rY = random(331, 338); if (getTabs().magic.open()) { getMouse().click(rX, rY, false); getMouse().click(rX, rY, false); new ConditionalSleep(2000, 500) { @Override public boolean condition() throws InterruptedException { return alchPic != null; } }.sleep(); } } @Override public void onPaint(Graphics2D paint) { int mXp = getExperienceTracker().getGainedXP(Skill.MAGIC); super.onPaint(paint); paint.drawString("Magic XP: " + mXp, 387, 328); } } I was working on an Agility Alcher and decided to make this while bank standing. If you can use it, sweet, if it's bad, sorry.
  7. Feedback on scripts he is developing seems to be what's in it for him. Nonetheless, this is great and something I've also considered as I have been learning recently. Great Idea OP!
  8. No Worries! Thanks for response, the null check fixed the error. Thank you
  9. Updated OP and made changes to script based on previous recommendations and also attempting to improve overall!
  10. Is that something I can add to the conditional sleep? Can I do if and else statements within there? One thing I was also considering was breaking up the Smithing case into 2 parts. First being interaction with the furnace and opening the widget. Then once that completes, have it complete the action and sleep until cannonball amount was met or pendingcontinuation or player is not animating. I've noticed with any changes I apply, I have a problem on the initial widget interaction, it will click furnace, see the widget, loop then click furnace again and finally interact. Other problem is, if I have cannonballs and steel bars in my inv, and it hits the Idle state, it will not come out of Idle to re-engage with the furnace/widget. Also, @progamerz I hit you up on discord if you can help. Thank you!
  11. I've run into some interesting problems. See below: case SMITH_CBALLS: log("BEGIN BALLS"); RS2Object furnace = objects.closest("Furnace"); RS2Widget smithFace = getWidgets().get(270, 14, 38); if (furnace != null) { if (!myPlayer().isAnimating()) { if (smithFace != null && smithFace.isVisible()) { if (smithFace.interact("Make sets:")) { getMouse().moveOutsideScreen(); new ConditionalSleep(30000, 5000) { @Override public boolean condition() throws InterruptedException { return getDialogues().isPendingContinuation() || !getInventory().contains("Steel bar"); } }.sleep(); } else { sleep(800); if (!myPlayer().isAnimating()) { furnace.interact(); } } } } } break; When adding if(smithFace.interact("Make sets:"), it cannot locate the action to select unless I remove the if statement. On the contrary, when looking for the widget dynamically, it cannot locate the widget when doing RS2Widget smithFace = getWidgets().getWidgetContainingText(240, "How many bars would you like to smith?"); when I run it, I keep getting stuck on BEGIN BALLS and Starting to Make Cannonballs in the logger for either option. For the script to keep running, I default back to original setup. Update: I have updated OP but since then have improved the smithing state. See Below case SMITH_CBALLS: log("BEGIN BALLS"); boolean cBallTotal = getInventory().getAmount("Cannonball") == 108; RS2Object furnace = objects.closest("Furnace"); RS2Widget smithFace = getWidgets().getWidgetContainingText(270, "How many"); if (furnace != null && furnace.interact("Smelt")) { sleep(3000); if (smithFace != null) { getKeyboard().pressKey(32); } new ConditionalSleep(25000, 5000){ @Override public boolean condition(){ getMouse().moveOutsideScreen(); return cBallTotal || getDialogues().isPendingContinuation(); } }.sleep(); } break; I have not had any issues with clicking timing or getting stuck.
  12. Great feedback and thank you for the suggestions! My goal is to create bigger and more complex scripts but to also put forth my efforts back to the community. I have tried to go back to not using States and enums as I am fairly new to Java and don't understand fully why to use enums over not using them. I think I need to go back and do some basic Java to better understand everything. I used the tutorials @Chris made and scanned through a lot of snippets and other forum posts. As for the widget, I was thinking about that this morning, I am gonna do some separate tests off script to practice.
  13. I've run into some interesting problems. See below: case SMITH_CBALLS: log("BEGIN BALLS"); RS2Object furnace = objects.closest("Furnace"); RS2Widget smithFace = getWidgets().get(270, 14, 38); if (furnace != null) { if (!myPlayer().isAnimating()) { if (smithFace != null && smithFace.isVisible()) { if (smithFace.interact("Make sets:")) { getMouse().moveOutsideScreen(); new ConditionalSleep(30000, 5000) { @Override public boolean condition() throws InterruptedException { return getDialogues().isPendingContinuation() || !getInventory().contains("Steel bar"); } }.sleep(); } else { sleep(800); if (!myPlayer().isAnimating()) { furnace.interact(); } } } } } break; When adding if(smithFace.interact("Make sets:"), it cannot locate the action to select unless I remove the if statement. On the contrary, when looking for the widget dynamically, it cannot locate the widget when doing RS2Widget smithFace = getWidgets().getWidgetContainingText(240, "How many bars would you like to smith?"); when I run it, I keep getting stuck on BEGIN BALLS and Starting to Make Cannonballs in the logger for either option. For the script to keep running, I default back to original setup.
  14. Awesome! I will work on that. Thanks again for your feedback!
×
×
  • Create New...