Iggsale Posted March 21, 2016 Share Posted March 21, 2016 I write a script and want it to run on osbot. I can find the script in script selector, but it can't be started, who do you know how to run a script on osbot?? Quote Link to comment Share on other sites More sharing options...
Keven Posted March 21, 2016 Share Posted March 21, 2016 do you mind sharing the source? 1 Quote Link to comment Share on other sites More sharing options...
Iggsale Posted March 21, 2016 Author Share Posted March 21, 2016 do you mind sharing the source? I just have a frame, it seems that i can't finish it. I am looking for a auto talker to shout in the RS07 game. The auto talker can shout advertising slogan in different world of RS 07 at the same time. Do you know this kind of script? Can you help me? I also can pay you if it can shout advertising in different world of RS 07 at the same time with osbot. Quote Link to comment Share on other sites More sharing options...
Isolate Posted March 21, 2016 Share Posted March 21, 2016 got one-o these badboys up in that b****? @ScriptManifest(author = "Your Name", name = "Example-Name", version = 0.1, info = "This is an Example Manifest", logo = "") Quote Link to comment Share on other sites More sharing options...
wallnuts5 Posted March 23, 2016 Share Posted March 23, 2016 (edited) I have actually run into the same error as OP (and I have a script manifest in mine). Sorry that my code is so cobbled together but the source is below. Also, if anyone has any tips they would be greatly appreciated. Thanks! EDIT: I found it was something to do with my WebWalkEvent "toCraftAltar". I removed it and simply placed a webWalk and it worked. import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.event.WebWalkEvent; import org.osbot.rs07.api.webwalk.INodeRouteFinder; import org.osbot.rs07.utility.*; import org.osbot.rs07.api.map.constants.*; import java.awt.Color; import java.awt.*; @ScriptManifest(name = "WaterCrafter", author = "WallNuts", version = 1.0, info = "", logo = "") public class Main extends Script { Area altararea = new Area(new Position(3181, 3168, 0), new Position(3183, 3163, 0)); Area bankarea = Banks.DRAYNOR; Area altar2area = null; long crafted = 0; int needThing, equip = 0; public WebWalkEvent toBank = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3092, 3243,0)); public WebWalkEvent toAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3183,3165,0)); public WebWalkEvent toCraftAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), altar2area.getRandomPosition()); @Override public void onStart() { log("Script begins"); //Code here will execute before the loop is started } private enum State { CRAFT, DROPOFF, WAIT, } private State getState() { if (inventory.contains("Rune Essence")) return State.CRAFT; if (inventory.contains("Water Rune") || !inventory.contains("Rune Essence")) return State.DROPOFF; return State.WAIT; } @Override public void onExit() { log("Script ends"); //Code here will execute after the script ends } @Override public int onLoop() throws InterruptedException { switch (getState()) { case CRAFT: if(equip == 1){ while(!getEquipment().contains("Water Tiara")) { bank.close(); getInventory().interact("Wear", "Water Tiara"); sleep(random(500, 1000)); } equip = 0; } toAltar.setBreakCondition(new Condition() { //if true, break the walker. @Override public boolean evaluate() { return altararea.contains(myPosition()); //area.contains(myPos) || pos.distance() <= threshold } }); execute(toAltar); log("to the altar"); Entity altar1 = objects.closest("Mysterious Ruins"); if (altar1 != null) { sleep(random(200, 600)); altar1.interact("Enter"); log("teleported"); sleep(random(2000, 3000)); } Entity altar2 = objects.closest("Altar"); while (!inventory.contains("Water rune")) { if (altar2 != null) { log("Found altar"); if(!altar2.isVisible()){ altar2area = altar2.getArea(2); toCraftAltar.setBreakCondition(new Condition() { //walking to crafting altar b/c always finds it but has problems interacting @Override public boolean evaluate() { return !altar2.isVisible(); } }); execute(toCraftAltar); sleep(1000); if(!altar2.isVisible()){// if the conditional walking over didn't work webwalk on over walking.webWalk(altar2area); } log("couldn't click"); } if(altar2.interact("Craft-rune")){ sleep(random(1000, 2500)); break; } sleep(random(1000, 2500)); } sleep(random(500, 750)); } if(inventory.contains("Water Rune")){ crafted = crafted + inventory.getAmount("Water rune"); } sleep(300); break; case DROPOFF: Entity portal = objects.closest("portal"); if(portal != null){ sleep(random(200, 600)); if(portal.interact("Use")){ while(myPlayer().isMoving()){ sleep(random(2000, 3500)); } } } skills.hoverSkill(Skill.RUNECRAFTING);//in case watching bot get a check on lvl sleep(random(800, 1500)); toBank.setBreakCondition(new Condition() { @Override public boolean evaluate() { return bankarea.contains(myPosition()); } }); execute(toBank); log("To the bank."); if(getEquipment().contains("Water Tiara") || getInventory().contains("Water Talisman")){//if need to take out water talisman or tiara needThing = 0; } else{ needThing = 1; } if(bankarea.contains(myPosition())) { if(random(10)>2){//80% of time use bank booth log("Bank booth"); RS2Object bank = getObjects().closest("Bank booth"); if (bank != null) { if (bank.interact("Bank")) { while(inventory.contains("Water rune")){ getBank().depositAll("Water rune"); sleep(random(500, 2000)); } sleep(random(1000, 2000)); if(needThing ==1 && getBank().contains("Water Tiara") || getBank().contains("Water talisman")){//if need to get talisman or tiara withdraw it if(getBank().contains("Water Tiara")){ getBank().withdraw("Water Tiara", 1); equip = 1; //make note to equip later } else{ getBank().withdraw("Water Talisman", 1); } } if(getBank().contains("Rune essence")){ while(!inventory.contains("Rune essence")){ getBank().withdrawAll("Rune essence"); sleep(random(500, 1500)); }} else{ log("no rune ess"); sleep(1000); if(!getBank().contains("Rune essence")){ stop(); //no rune ess logout } } } } } else{ log("Banker"); NPC banker = npcs.closest("Banker"); if (banker != null) { if (banker.interact("Bank")) { while(inventory.contains("Water rune")){ getBank().depositAll("Water rune"); sleep(random(500, 2000)); } sleep(random(1000, 2000)); if(needThing ==1 && getBank().contains("Water Tiara") || getBank().contains("Water talisman")){ if(getBank().contains("Water Tiara")){ getBank().withdraw("Water Tiara", 1); equip = 1; } else{ getBank().withdraw("Water Talisman", 1); } } if(getBank().contains("Rune essence")){ while(!inventory.contains("Rune essence")){ getBank().withdrawAll("Rune essence"); sleep(random(500, 1500)); }} else{ log("no rune ess"); sleep(1000); if(!getBank().contains("Rune essence")){ stop(); } } } } } } else{ toBank.setBreakCondition(new Condition() { //if true, break the walker. @Override public boolean evaluate() { return bankarea.contains(myPosition()); //area.contains(myPos) || pos.distance() <= threshold } }); execute(toBank); sleep(400); } break; case WAIT: sleep(random(500, 700)); break; } return random(200, 300); } @Override public void onPaint(Graphics2D g) { //This is where you will put your code for paint(s) g.setColor(Color.yellow); g.drawString("Water runes crafted: " + String.valueOf(crafted), 10, 20); Point mP = getMouse().getPosition(); g.drawLine(mP.x - 5, mP.y + 5, mP.x + 5, mP.y - 5); g.drawLine(mP.x + 5, mP.y + 5, mP.x - 5, mP.y - 5); } } Edited March 24, 2016 by wallnuts5 Quote Link to comment Share on other sites More sharing options...
Psvxe Posted March 24, 2016 Share Posted March 24, 2016 I have actually run into the same error as OP (and I have a script manifest in mine). Sorry that my code is so cobbled together but the source is below. Also, if anyone has any tips they would be greatly appreciated. Thanks! EDIT: I found it was something to do with my WebWalkEvent "toCraftAltar". I removed it and simply placed a webWalk and it worked. import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.event.WebWalkEvent; import org.osbot.rs07.api.webwalk.INodeRouteFinder; import org.osbot.rs07.utility.*; import org.osbot.rs07.api.map.constants.*; import java.awt.Color; import java.awt.*; @ScriptManifest(name = "WaterCrafter", author = "WallNuts", version = 1.0, info = "", logo = "") public class Main extends Script { Area altararea = new Area(new Position(3181, 3168, 0), new Position(3183, 3163, 0)); Area bankarea = Banks.DRAYNOR; Area altar2area = null; long crafted = 0; int needThing, equip = 0; public WebWalkEvent toBank = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3092, 3243,0)); public WebWalkEvent toAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3183,3165,0)); public WebWalkEvent toCraftAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), altar2area.getRandomPosition()); @Override public void onStart() { log("Script begins"); //Code here will execute before the loop is started } private enum State { CRAFT, DROPOFF, WAIT, } private State getState() { if (inventory.contains("Rune Essence")) return State.CRAFT; if (inventory.contains("Water Rune") || !inventory.contains("Rune Essence")) return State.DROPOFF; return State.WAIT; } @Override public void onExit() { log("Script ends"); //Code here will execute after the script ends } @Override public int onLoop() throws InterruptedException { switch (getState()) { case CRAFT: if(equip == 1){ while(!getEquipment().contains("Water Tiara")) { bank.close(); getInventory().interact("Wear", "Water Tiara"); sleep(random(500, 1000)); } equip = 0; } toAltar.setBreakCondition(new Condition() { //if true, break the walker. @Override public boolean evaluate() { return altararea.contains(myPosition()); //area.contains(myPos) || pos.distance() <= threshold } }); execute(toAltar); log("to the altar"); Entity altar1 = objects.closest("Mysterious Ruins"); if (altar1 != null) { sleep(random(200, 600)); altar1.interact("Enter"); log("teleported"); sleep(random(2000, 3000)); } Entity altar2 = objects.closest("Altar"); while (!inventory.contains("Water rune")) { if (altar2 != null) { log("Found altar"); if(!altar2.isVisible()){ altar2area = altar2.getArea(2); toCraftAltar.setBreakCondition(new Condition() { //walking to crafting altar b/c always finds it but has problems interacting @Override public boolean evaluate() { return !altar2.isVisible(); } }); execute(toCraftAltar); sleep(1000); if(!altar2.isVisible()){// if the conditional walking over didn't work webwalk on over walking.webWalk(altar2area); } log("couldn't click"); } if(altar2.interact("Craft-rune")){ sleep(random(1000, 2500)); break; } sleep(random(1000, 2500)); } sleep(random(500, 750)); } if(inventory.contains("Water Rune")){ crafted = crafted + inventory.getAmount("Water rune"); } sleep(300); break; case DROPOFF: Entity portal = objects.closest("portal"); if(portal != null){ sleep(random(200, 600)); if(portal.interact("Use")){ while(myPlayer().isMoving()){ sleep(random(2000, 3500)); } } } skills.hoverSkill(Skill.RUNECRAFTING);//in case watching bot get a check on lvl sleep(random(800, 1500)); toBank.setBreakCondition(new Condition() { @Override public boolean evaluate() { return bankarea.contains(myPosition()); } }); execute(toBank); log("To the bank."); if(getEquipment().contains("Water Tiara") || getInventory().contains("Water Talisman")){//if need to take out water talisman or tiara needThing = 0; } else{ needThing = 1; } if(bankarea.contains(myPosition())) { if(random(10)>2){//80% of time use bank booth log("Bank booth"); RS2Object bank = getObjects().closest("Bank booth"); if (bank != null) { if (bank.interact("Bank")) { while(inventory.contains("Water rune")){ getBank().depositAll("Water rune"); sleep(random(500, 2000)); } sleep(random(1000, 2000)); if(needThing ==1 && getBank().contains("Water Tiara") || getBank().contains("Water talisman")){//if need to get talisman or tiara withdraw it if(getBank().contains("Water Tiara")){ getBank().withdraw("Water Tiara", 1); equip = 1; //make note to equip later } else{ getBank().withdraw("Water Talisman", 1); } } if(getBank().contains("Rune essence")){ while(!inventory.contains("Rune essence")){ getBank().withdrawAll("Rune essence"); sleep(random(500, 1500)); }} else{ log("no rune ess"); sleep(1000); if(!getBank().contains("Rune essence")){ stop(); //no rune ess logout } } } } } else{ log("Banker"); NPC banker = npcs.closest("Banker"); if (banker != null) { if (banker.interact("Bank")) { while(inventory.contains("Water rune")){ getBank().depositAll("Water rune"); sleep(random(500, 2000)); } sleep(random(1000, 2000)); if(needThing ==1 && getBank().contains("Water Tiara") || getBank().contains("Water talisman")){ if(getBank().contains("Water Tiara")){ getBank().withdraw("Water Tiara", 1); equip = 1; } else{ getBank().withdraw("Water Talisman", 1); } } if(getBank().contains("Rune essence")){ while(!inventory.contains("Rune essence")){ getBank().withdrawAll("Rune essence"); sleep(random(500, 1500)); }} else{ log("no rune ess"); sleep(1000); if(!getBank().contains("Rune essence")){ stop(); } } } } } } else{ toBank.setBreakCondition(new Condition() { //if true, break the walker. @Override public boolean evaluate() { return bankarea.contains(myPosition()); //area.contains(myPos) || pos.distance() <= threshold } }); execute(toBank); sleep(400); } break; case WAIT: sleep(random(500, 700)); break; } return random(200, 300); } @Override public void onPaint(Graphics2D g) { //This is where you will put your code for paint(s) g.setColor(Color.yellow); g.drawString("Water runes crafted: " + String.valueOf(crafted), 10, 20); Point mP = getMouse().getPosition(); g.drawLine(mP.x - 5, mP.y + 5, mP.x + 5, mP.y - 5); g.drawLine(mP.x + 5, mP.y + 5, mP.x - 5, mP.y - 5); } } Just a tip for the WebWalking (didn't check the whole script) INodeRouteFinder routeFinder; in your onStart() method routeFinder = INodeRouteFinder.createAdvanced(); then you can simply do public WebWalkEvent toBank = new WebWalkEvent(routeFinder, new Position(3092, 3243,0)); This will save allot of resources. Quote Link to comment Share on other sites More sharing options...
wallnuts5 Posted March 24, 2016 Share Posted March 24, 2016 Just a tip for the WebWalking (didn't check the whole script) INodeRouteFinder routeFinder; in your onStart() method routeFinder = INodeRouteFinder.createAdvanced(); then you can simply do public WebWalkEvent toBank = new WebWalkEvent(routeFinder, new Position(3092, 3243,0)); This will save allot of resources. Thanks for the help! Would you suggest I define my WebWalkEvents at the top of my script as public (where i have them in the above source) or should i define them right before I call them? Quote Link to comment Share on other sites More sharing options...
Acerd Posted March 24, 2016 Share Posted March 24, 2016 Thanks for the help! Would you suggest I define my WebWalkEvents at the top of my script as public (where i have them in the above source) or should i define them right before I call them? public WebWalkEvent toBank = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3092, 3243,0)); public WebWalkEvent toAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3183,3165,0)); public WebWalkEvent toCraftAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), altar2area.getRandomPosition()); to public WebWalkEvent toBank; public WebWalkEvent toAltar; public WebWalkEvent toCraftAltar; @Override public void onStart() { toBank = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3092, 3243,0)); toAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3183,3165,0)); toCraftAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), altar2area.getRandomPosition()); } this will most likely fix your problem Quote Link to comment Share on other sites More sharing options...
Psvxe Posted March 25, 2016 Share Posted March 25, 2016 Thanks for the help! Would you suggest I define my WebWalkEvents at the top of my script as public (where i have them in the above source) or should i define them right before I call them? You should define it before you call them, yes. I have my own framework so I did it different. However, don't do it like the guy above me said. That sucks. Send me a pm if you need help. Quote Link to comment Share on other sites More sharing options...