August 30, 20178 yr Hello Made a little script for farming the tokens at the warriors guild for getting my dragon defender. It's currently hardcoded to lobster and mithril armour but you can edit source...:) Setup: Have lobster in inventory Have mithril platelegs, body and full helm in inventory Jar file here import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import javax.swing.*; import java.awt.*; @ScriptManifest(name = "Animator by RickyD", author = "RickyD", version = 1.0, info = "Animates your armour to farm warrior guild tokens", logo = "") public class Animated extends Script { String[] foodName = {"Lobster"}; NPC anim; GroundItem lootables; String [] lootNames = {"Mithril platebody", "Warrior guild token", "Mithril full helm", "Mithril platelegs"}; @Override public void onStart() {} @Override public void onExit() {} public boolean hasArmour(){ if(getInventory().contains("Mithril platebody")){ if(getInventory().contains("Mithril platelegs")){ if(getInventory().contains("Mithril full helm")){ return true; }else{ return false; } }else{ return false; } }else{ return false; } } @Override public int onLoop() throws InterruptedException{ anim = getNpcs().closest(2454); lootables = getGroundItems().closest(lootNames); if(getInventory().contains(foodName) && getInventory().getAmount("Warrior guild token") < 1000){ if(anim != null && anim.isInteracting(myPlayer())){ if(myPlayer().getHealthPercent() < 50){ getInventory().interact("Eat", foodName); //DTiming.waitCondition(() -> myPlayer().getAnimation() == 829, 2000); new ConditionalSleep(2000){ @ Override public boolean condition() throws InterruptedException { return myPlayer().getAnimation() == 829; } }.sleep(); }else{ if(myPlayer().getInteracting() == null){ anim.interact("Attack"); } } }else{ if(lootables != null){ lootables.interact("Take"); }else{ if(hasArmour()){ getObjects().closest("Magical Animator").interact("Animate armour"); } } } }else{ JOptionPane.showMessageDialog(null, "NO FOOD or 1k Tokens", "Alert", JOptionPane.WARNING_MESSAGE); stop(false); } return 100; //The amount of time in milliseconds before the loop starts over } @Override public void onPaint(Graphics2D g) {} } Edited August 30, 20178 yr by RickyD
August 30, 20178 yr good stuff. just in case you didn't know, you don't need so many if statements public boolean hasArmour(){ if(getInventory().contains("Mithril platebody")){ if(getInventory().contains("Mithril platelegs")){ if(getInventory().contains("Mithril full helm")){ return true; }else{ return false; } }else{ return false; } }else{ return false; } } public boolean hasArmour(){ if(getInventory().contains("Mithril platebody") && getInventory().contains("Mithril platelegs") && getInventory().contains("Mithril full helm")) return true; } the client sees these as the same
August 30, 20178 yr Author 11 minutes ago, superuser said: good stuff. just in case you didn't know, you don't need so many if statements the client sees these as the same For sure, I agree
September 12, 20178 yr On 8/30/2017 at 11:59 PM, superuser said: good stuff. just in case you didn't know, you don't need so many if statements public boolean hasArmour(){ if(getInventory().contains("Mithril platebody")){ if(getInventory().contains("Mithril platelegs")){ if(getInventory().contains("Mithril full helm")){ return true; }else{ return false; } }else{ return false; } }else{ return false; } } public boolean hasArmour(){ if(getInventory().contains("Mithril platebody") && getInventory().contains("Mithril platelegs") && getInventory().contains("Mithril full helm")) return true; } the client sees these as the same Also redundant code, though. It comes down to preference really. Thanks for contribution, OP. public boolean hasArmour() { return getInventory().contains("x"); } Edited September 12, 20178 yr by Pseudo
September 12, 20178 yr 46 minutes ago, Pseudo said: Also redundant code, though. It comes down to preference really. Thanks for contribution, OP. public boolean hasArmour() { return getInventory().contains("x"); }
October 1, 20178 yr You shouldn't have return 100; at the end. That's a really low return time (1/10th of a second) that speed will get you banned quickly. You should do return random(400, 700); Or something similar, but those return times have always worked for me. It's good to see you're learning though. Good luck Edited October 1, 20178 yr by TTScripts
October 2, 20178 yr how do I get this onto my sdn? I've been waiting for something like this Can't open the Jar file says premium users only would deffff like to try and test / use this script
October 2, 20178 yr The free hosting period for this file has now expired, only premium users can download it.
October 2, 20178 yr 8 hours ago, TTScripts said: You shouldn't have return 100; at the end. That's a really low return time (1/10th of a second) that speed will get you banned quickly. You should do return random(400, 700); Or something similar, but those return times have always worked for me. It's good to see you're learning though. Good luck so what part would you change? or do
October 7, 20178 yr On 10/1/2017 at 9:29 PM, iroll said: so what part would you change? or do import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import javax.swing.*; import java.awt.*; @ScriptManifest(name = "Animator by RickyD", author = "RickyD", version = 1.0, info = "Animates your armour to farm warrior guild tokens", logo = "") public class Animated extends Script { String[] foodName = {"Lobster"}; NPC anim; GroundItem lootables; private String armorType = "Mithril" String[] lootNames; @Override public void onStart() { startTime = System.currentTimeMillis(); lootNames = {armortType & "platebody", "Warrior guild token", armorType & " full helm", armorType & " platelegs"}; } @Override public void onExit() { log("Script has exited successfully"); } private long startTime; public boolean hasArmour(){ if(getInventory().contains(armorType & " platebody") && getInventory().contains(armortType & " platelegs") && getInventory().contains(armorType & " full helm")){ return true; } return false; } @Override public int onLoop() throws InterruptedException{ anim = getNpcs().closest(2454);//you should change this to a static method that gets the animated armor npc id //maybe anim = getNpcs().closest("Animated " & armorType & " armour"); //or something like that lootables = getGroundItems().closest(lootNames); if(getInventory().contains(foodName) && getInventory().getAmount("Warrior guild token") < 1000){ if(anim != null && anim.isInteracting(myPlayer())){ if(myPlayer().getHealthPercent() < 50){ getInventory().interact("Eat", foodName); //DTiming.waitCondition(() -> myPlayer().getAnimation() == 829, 2000); new ConditionalSleep(2000){ @ Override public boolean condition() throws InterruptedException { return myPlayer().getAnimation() == 829; } }.sleep(); sleep(random(400, 650); }else{ if(myPlayer().getInteracting() == null){ anim.interact("Attack"); sleep(random(800, 1100); } } }else{ if(lootables != null){ if (lootables.interact("Take")) { sleep(random(1200, 1500); } }else{ if(hasArmour()){ if (getObjects().closest("Magical Animator").interact("Animate armour")) { sleep(random(1200, 2000); } } } } }else{ stop(false); JOptionPane.showMessageDialog(null, "NO FOOD or 1k Tokens", "Alert", JOptionPane.WARNING_MESSAGE); } return random(400, 700); //The amount of time in milliseconds before the loop starts over } @Override public void onPaint(Graphics2D g) { long millis = System.currentTimeMillis() - startTime; String timeStr = String.format("%02d min, %02d sec", TimeUnit.MILLISECONDS.toMinutes(millis), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis)) ); g.setFont(new Font("Trebuchet MS", Font.PLAIN, 14); g.setColor(Color.WHITE); g.drawString("Time running: " + timeStr, 10, 250); } }
October 7, 20178 yr why not public boolean hasArmour(){ return getInventory().contains(armorType + " platebody") && getInventory().contains(armorType + " platelegs") && getInventory().contains(armorType + " full helm"); } @TTScripts
October 7, 20178 yr 55 minutes ago, 3qTQlBnsOsyfetvA said: why not public boolean hasArmour(){ return getInventory().contains(armorType + " platebody") && getInventory().contains(armorType + " platelegs") && getInventory().contains(armorType + " full helm"); } @TTScripts you caught me. lol
Create an account or sign in to comment