Jump to content

Search the Community

Showing results for tags 'scripthelp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • OSBot
    • News & Announcements
    • Community Discussion
    • Bot Manager
    • Support Section
    • Mirror Client VIP
    • Script Factory
  • Scripts
    • Official OSBot Scripts
    • Script Factory
    • Unofficial Scripts & Applications
    • Script Requests
  • Market
    • OSBot Official Voucher Shop
    • Currency
    • Accounts
    • Services
    • Other & Membership Codes
    • Disputes
  • Graphics
    • Graphics
  • Archive

Product Groups

  • Premium Scripts
    • Combat & Slayer
    • Money Making
    • Minigames
    • Others
    • Plugins
    • Agility
    • Mining & Smithing
    • Woodcutting & Firemaking
    • Fishing & Cooking
    • Fletching & Crafting
    • Farming & Herblore
    • Magic & Prayer
    • Hunter
    • Thieving
    • Construction
    • Runecrafting
  • Donations
  • OSBot Membership
  • Backup

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location:


Interests

Found 8 results

  1. was just wondering if you kind folks would double check my methods below. i have never coded a day in my life before last week, so this was put together with chatGPT along with trial and error. interested to see if you guys have any pointers, or notice anything I have going on here that might be a no-no. i used intelliJ IDEA community version, and right now I created everything under one class, but I think best practice might be to separate out main/mining/crafting classes. I have tested this just for 20 min or so and it seems to work well enough, but I would like to eventually incorporate the following things if the base methods are sound. -simple paint -additional random pauses or other anti-ban methods -GUI so that I can toggle some options upon selecting the script in my osbot selector -figure out how to get custom cursor and logo to work even though I already added them into a resource directory import org.osbot.rs07.api.model.Item; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "pupupot", info = "Mines Amethyst crystals and crafts dart tips", name = "Amethyst Minecraft", version = 1.2, logo = "") public class AmethystMinecraft extends Script { private final int AMETHYST_X = 3008; private final int[] AMETHYST_Y = {9710, 9711, 9712}; // Y positions of amethyst crystals private final String AMETHYST_CRYSTALS_NAME = "Amethyst crystals"; private final String AMETHYST_NAME = "Amethyst"; private final String CHISEL_NAME = "Chisel"; @Override public void onStart() { log("Script started. Let's get this bag.");} @Override public int onLoop() throws InterruptedException { log("Looking for the purple shit to start mining."); // Check if inventory is full and craft dart tips if needed if (getInventory().isFull() || getEmptySlots() <= 2) { craftDartTips(); return 1000; // Wait for a second before checking again } // Check each Y position for amethyst crystals for (int y : AMETHYST_Y) { RS2Object amethyst = getObjects().closest(obj -> obj != null && obj.getName().equals(AMETHYST_CRYSTALS_NAME) && obj.getX() == AMETHYST_X && obj.getY() == y); if (amethyst != null && amethyst.isVisible()) { log("Found the purple shit at X=" + AMETHYST_X + ", Y=" + y); // Attempt to mine the amethyst if (amethyst.interact("Mine")) { log("Mining amethyst... Getting this money"); // Wait until the amethyst turns into "Empty wall" new ConditionalSleep(240000, 2000) { // 240,000 milliseconds (4 minutes) @Override public boolean condition() throws InterruptedException { return !amethyst.exists() || amethyst.getName().equals("Empty wall"); } }.sleep(); // Check if the amethyst was successfully mined if (!amethyst.exists() || amethyst.getName().equals("Empty wall")) { log("Bag secured at X=" + AMETHYST_X + ", Y=" + y); // Check inventory space and craft dart tips if needed if (getEmptySlots() <= 2) { craftDartTips(); } } else { log("Failed to mine amethyst at X=" + AMETHYST_X + ", Y=" + y); } } else { log("Failed to interact with amethyst at X=" + AMETHYST_X + ", Y=" + y); } // Exit loop once one amethyst is successfully mined break; } } return random(600, 700); // Return a short random delay before the next loop } private int getEmptySlots() { int count = 0; for (Item item : getInventory().getItems()) { if (item == null || item.getId() == -1) { count++; } } return count; } private void craftDartTips() throws InterruptedException { // Check if chisel and amethyst are in inventory if (getInventory().contains(CHISEL_NAME) && getInventory().contains(AMETHYST_NAME)) { log("We got the tools. Let's start the crafting process."); // Use chisel on amethyst if (getInventory().interact("Use", CHISEL_NAME)) { new ConditionalSleep(2000) { @Override public boolean condition() throws InterruptedException { return getInventory().isItemSelected(); } }.sleep(); if (getInventory().interact("Use", AMETHYST_NAME)) { log("Waiting for crafting interface to appear."); // Wait for crafting interface to appear new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getWidgets().isVisible(270, 17); // Interface 270, Component 17 is the dart tip selection } }.sleep(); // Select "Make Amethyst dart tip" option (4th option) if (getWidgets().isVisible(270, 17)) { log("Crafting interface visible. Selecting 'Amethyst dart tips' option."); getWidgets().interact(270, 17, "Make"); } else { log("Crafting interface not visible."); } // Wait for crafting to complete new ConditionalSleep(60000) { @Override public boolean condition() throws InterruptedException { return !getInventory().contains(AMETHYST_NAME); } }.sleep(); log("Crafted amethyst dart tips."); } else { log("Failed to use chisel on amethyst."); } } else { log("Failed to select chisel."); } } else { log("Cannot craft amethyst dart tips. Missing required items."); } } @Override public void onExit() { log("Script stopped. Later Nerd."); } }
  2. I've been messing around with this for hours after i have done all this the script will not open in OSbot client i've had it open before when i was still in the process of making the better now im clueless i did add armour ealier but removed it... i need to readd this is more for testing and learing how to it will shows up in OSbot client scripts its listed in the C:\Users\username\OSBot\ScriptsOSbot/ but im lost atm and need sleep import org.osbot.rs07.api.Inventory; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "DarkScuzz", info = "Green Dragon Killer", name = "GreenDragonKiller", version = 1.0, logo = "") class GreenDragonKiller extends Script { private boolean shouldBank = false; private static final Area GREEN_DRAGON_AREA = new Area(2974, 3618, 3029, 3650); private static final String ANTI_FIRE_POTION = "Anti-fire potion"; // Name of the anti-fire potion private static final String FOOD_NAME = "Lobster"; // Name of the food you want to eat private static int FOOD_AMOUNT = 10; // Change this to the desired amount of food @Override public int onLoop() { if (shouldBank) { // Implement banking logic here // You can use the closest bank or any preferred method bank(); } else { if (getSkills().getDynamic(Skill.HITPOINTS) < 10 || !hasFood()) { shouldBank = true; return 1000; // Delay before heading to the bank } // Activate the Protection from Melee prayer if (!isPrayerActive()) { activatePrayer(); } // Check for and use an anti-fire potion if (inventory.contains(ANTI_FIRE_POTION)) { inventory.interact("Drink", ANTI_FIRE_POTION); } // Equip gear and implement combat logic here // ... Combat logic ... // Eat food if health is low if (getSkills().getDynamic(Skill.HITPOINTS) < 10) { eatFood(); } } return random(1000, 2000); // Delay between loops in milliseconds } private void activatePrayer() { // Implement logic to activate the Protection from Melee prayer // For example, you can open the Prayer tab and click on the prayer you want to activate. // getTabs().open(Tab.PRAYER); // Perform a mouse click on the prayer icon. } private boolean isPrayerActive() { // Implement logic to check if the Protection from Melee prayer is active // You'll need to check the color of the prayer icon or its state on the interface return false; } private void eatFood() { // Implement logic to eat food from your inventory Inventory inventory = getInventory(); if (inventory.contains(FOOD_NAME) && FOOD_AMOUNT > 0) { inventory.interact("Eat", FOOD_NAME); FOOD_AMOUNT--; } } private boolean hasFood() { // Implement logic to check if you have enough food in your inventory Inventory inventory = getInventory(); return inventory.contains(FOOD_NAME) && FOOD_AMOUNT > 0; } private void bank() { // Implement banking logic here // You can use the closest bank or any preferred method } @Override public void onExit() { log("GreenDragonKiller stopped."); } }
  3. The code compiles fine, however when attempting to run via OSBot, the script doesn't run. Any idea? FYI: The script is meant to identify combat details of a player upon typing '!stats' and then type out this information. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Arrays; import org.osbot.Hi; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.net.MalformedURLException; import java.util.ArrayList; @ScriptManifest(name = "Highscores", author = "OsBot", version = 1, logo = " ", info = "Highscores") public class Highscores extends Script { private final ArrayList<String> stats = new ArrayList<String>(); public Highscores(final String player) { getStats(player); } public void onMessage(Message message) throws InterruptedException { String text = message.getMessage().toLowerCase(); String username = message.getUsername().toLowerCase(); Highscores highscores = new Highscores(username); if(text.contains("!stats")) { log("---"); getKeyboard().typeString("Atk:" + highscores.getSkillLevel(Skill.ATTACK) + ",Str:" + highscores.getSkillLevel(Skill.STRENGTH) + ",Def:" + highscores.getSkillLevel(Skill.DEFENCE) + ",Range:" + highscores.getSkillLevel(Skill.RANGED) + ",Mage:" + highscores.getSkillLevel(Skill.MAGIC)); } } @Override public void onStart() { this.getBot().addMessageListener(this); } @Override public int onLoop() throws InterruptedException { return random(400,600); } public int getSkillLevel(final Skill skill) { int index = getSkillIndex(skill); String[] array = stats.get(index).split(","); return Integer.parseInt(array[1]); } public int getSkillExperience(final Skill skill) { int index = getSkillIndex(skill); String[] array = stats.get(index).split(","); return Integer.parseInt(array[2]); } private void getStats(final String player) { try { URL url = new URL("https://secure.runescape.com/m=hiscore_oldschool/index_lite.ws?player=" + player); URLConnection con = url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { stats.add(inputLine); } in.close(); } catch (MalformedURLException e) { // CATCH } catch (IOException e) { // CATCH } } private int getSkillIndex(final Skill skill) { return Arrays.asList(Skill.values()).indexOf(skill) + 1; } }
  4. I have read alot of other scripts and examples of how to loot before attacking again. I cannot understand this concept, could somebody explain me how to do this inside of my own code. This is my code for now: =============================================================================================== NPC npc = getNpcs().closest(o -> o.getName().equals("Cow") && o.getInteracting() == null && !o.isUnderAttack()); if (npc != null && npc.getName().equals("Cow") && npc.getHealthPercent() > 0 && npc.isAttackable() && npc.hasAction("Attack") && map.canReach(npc) && !npc.isUnderAttack()) { if (npc.equals(myPlayer().getInteracting())) { } else { npc.interact("Attack"); if (npc.interact("Attack")) { sleep(random(3500,5000)); } } } else { camera.toEntity(npc); npc = npcs.closest("Cow"); } ==================================================================================================
  5. I am new to scripting having troubles getting my script sent to my OsBot application. IntelliJ is sending the script to C:\Users\Me\OSBot\Scripts but this is not showing up on the OsBot application. Yes I have tried refreshing. Any feedback would be very helpful. ty
  6. This is the code that I'm using. My script is local. (the name is FishNetLooter) This is the path that it's set in CMD prompt gives me this error! So my question is, why cant it find the script and how do I make it load? I tried changing the name in the cmd file with the .jar extention but it still doesn't find the script. Any help would greatly be appreciated, thank you!
  7. if (myArea.contains(myPlayer())) { log("You are in the right area!"); } else { getWalking().walk(myArea); } IntelliJ is giving me and 'unreachable' error when located inside of the onLoop() and a bunch more outside in my Script class.
  8. Hello Guys, Im working on a script that makes tuna potatoes from cooked ingredients in the bank It basically works like this: Inventory contains 9 Bowl, 9 Cooked sweetcorn, 9 Tuna and a Knife Combines items to 9 Corn and tuna Bank to get 9 Pat of butter and 9 Baked potato Combines items to get Potato with butter and after that makes the Tuna potatoes And leaves the inventory with 9 Bowl and 9 Tuna Potatoes But I can’t get the banking to work I’ve tried this: case BANK: if (!getBank().isOpen()) { getBank().open(); } else { // Inventory 9 Tuna and corn, 9 Pat of butter, 9 Baked Potato and 1 knife inventory ready for making Potato with butter and Tuna Potato. if (this.inventory.getAmount(new String[] { "Tuna and corn" }) == 9) { sleep(random(333, 666)); getBank().depositAllExcept(new String[] { "Knife", "Tuna and corn" }); sleep(random(300, 800)); getBank().withdraw("Pat of butter", 9); sleep(random(300, 800)); getBank().withdraw("Baked Potato", 9); sleep(random(300, 800)); if (this.inventory.getAmount(new String[] { "Pat of butter", "Baked Potato" }) == 18){ getBank().close(); sleep(random(300, 800)); return Main.random(300, 800); }} // Inventory 9 Bowl, 9 Tuna, 9 Cooked Sweedcorn and 1 knife start and finish of inventory. if (this.inventory.getAmount(new String[] { "Bowl" }) == 9) { sleep(random(333, 666)); getBank().depositAllExcept(new String[] { "Knife", "Bowl" }); sleep(random(300, 800)); getBank().withdraw("Tuna", 9); sleep(random(300, 800)); getBank().withdraw("Cooked Sweedcorn", 9); sleep(random(300, 800)); if (this.inventory.getAmount(new String[] { "Tuna", "Cooked Sweedcorn" }) == 18){ getBank().close(); sleep(random(300, 800)); return Main.random(300, 800); }} } break; Some help would be appreciated ;)
×
×
  • Create New...