the1btcuser Posted August 31 Share Posted August 31 (edited) Spoiler import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.*; import org.osbot.rs07.api.ui.*; import org.osbot.rs07.event.WalkingEvent; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(author = "the1btcuser", name = "1rubygrabber", info = "Free <3", version = 1, logo = "") public final class Main extends Script { public String activity = "None"; public String status = "None"; @Override public void onExit() { log("Thank you for using 1rubygrabber."); } /* Converts ms to d:hr:s for paint */ public final String formatTime(final long ms) { long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24; s %= 60; m %= 60; h %= 24; return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) : h > 0 ? String.format("%02d:%02d:%02d", h, m, s) : String.format("%02d:%02d", m, s); } @Override public void onPaint(final Graphics2D g) { g.setColor(Color.BLACK); g.setColor(Color.WHITE); // Calculate the runtime final long runTime = System.currentTimeMillis() - startTime; g.drawString("Runtime: " + formatTime(runTime), 20, 295); g.drawString("Activity: " + activity, 20, 313); g.drawString("Status: " + status, 20, 331); } long startTime; @Override public final void onStart() { startTime = System.currentTimeMillis(); } private void hopToRandomWorld() throws InterruptedException { // Array of F2P world IDs int[] f2pWorlds = { 308, 326, 335, 371, 379, 380, 382, 383, 384, 394, 397, 398, 399, 417, 418, 430, 431, 433, 434, 435, 436, 437, 451, 452, 453, 454, 455, 456, 475, 476, 483, 497, 498, 499, 500, 501, 544, 545, 546, 547, 552, 553, 554, 555, 575 }; int randomWorld = f2pWorlds[(int) (Math.random() * f2pWorlds.length)]; getWorlds().hop(randomWorld); log("-----HOPPED-----------------------------"); sleep(random(0)); } @Override public final int onLoop() throws InterruptedException { activity="Ruby"; Position grabb = new Position(3195, 9822, 0); Position rubypos = new Position(3196, 9822, 0); Position door1 = new Position(3192, 9824, 0); Position door2 = new Position(3191, 9825, 0); Position bank = new Position(3182, 3438, 0); Area room = new Area( new int[][]{ { 3186, 9825 }, { 3186, 9818 }, { 3197, 9818 }, { 3197, 9825 }, { 3192, 9824 } } ); int[] emoteClickOrder = {18, 1, 8, 9, 6, 16, 14, 0, 4, 12, 17, 5, 2, 18, 15, 10, 3}; if (!getInventory().isFull()) { if (room.contains(myPlayer())){ status="Grabbing ruby rings"; getWalking().webWalk(grabb); GroundItem ruby = getGroundItems().closest(b -> b.getPosition().equals(rubypos) && b.getName().equalsIgnoreCase("Ruby ring")); if (ruby != null && ruby.exists()) { if (ruby.interact("Take")) { log("Picked up ruby at position: " + rubypos); new ConditionalSleep(100) { @Override public boolean condition() throws InterruptedException { return !ruby.exists(); } }.sleep(); } } else { log("No ruby found at position: " + rubypos); hopToRandomWorld(); } } else { status="Going to ruby room"; getWalking().webWalk(door2); WalkingEvent walkToRock2 = new WalkingEvent(door2); walkToRock2.setMinDistanceThreshold(0); execute(walkToRock2); getTabs().open(Tab.EMOTES); sleep(500); for (int index : emoteClickOrder) { getWidgets().get(216, 2, index).hover(); getMouse().click(false); sleep(50); } sleep(1000); } } else { if (room.contains(myPlayer())){ status="Leaving ruby rings"; getWalking().webWalk(door1); WalkingEvent walkToRock = new WalkingEvent(door1); walkToRock.setMinDistanceThreshold(0); execute(walkToRock); getTabs().open(Tab.EMOTES); sleep(500); for (int index : emoteClickOrder) { getWidgets().get(216, 2, index).hover(); getMouse().click(false); sleep(50); } sleep(1000); } else { status="Banking"; getWalking().webWalk(bank); if (getBank().isOpen() || getBank().open()) { getBank().depositAll(); sleep(500); getBank().close(); } } } return random(50, 500); } } Grabs ruby rings at West Varrock bank. Requires completing this: https://oldschool.runescape.wiki/w/Robes_of_Ruin Download: https://www.mediafire.com/file/uuy2uo6hjdfd34r/1rubygrabber.jar/file https://mega.nz/file/YAMigLyI#DzkXfM1F9UrZQx0zFA7SBDlUg-8ijIUNai1Jo39g9As https://file.io/L5I83VshATNe https://filebin.net/j4r28o6fbkogf73c https://safenote.co/r/66d36af4a63bd7@22746948 Made it in a rush with chatgpt. Edited September 1 by the1btcuser 1 Quote Link to comment Share on other sites More sharing options...
yfoo Posted September 2 Share Posted September 2 Wow, I didn't even know this was a thing in the game. Quote Link to comment Share on other sites More sharing options...
Fanny Posted September 2 Share Posted September 2 Nice work! If you are looking for potential improvements, I'd consider adding some logic to check that the emote succeeded by checking the players animation state continuously, if you can be bothered, you could even check the animation IDs to ensure that they did play in the right order too Also conditional sleeping until the emote is finished or varying the time between emotes Quote Link to comment Share on other sites More sharing options...
Buttons Posted September 2 Share Posted September 2 haha wow had no clue this was a thing, thanks for sharing. Quote Link to comment Share on other sites More sharing options...
viktory6743 Posted October 21 Share Posted October 21 Wow, I didn't even know this was a thing in the game. Quote Link to comment Share on other sites More sharing options...