Hey everyone,
I've been botting with OSBot for a while, decided to try my hand at making my own bot. Specifically a few bots all connected, a wood cutter and a fletching/alcher.
I haven't added in the trading or wood cutting section yet, just wanted to work on the actual fletching/alchings steps first.
It's supposed to sit at the GE and pull out the items from the bank, combine them, then alch the results, the issue i'm seeing is that occasionally it'll click on the banker by accident and they script will close from there. Also, after using it for less than a week while i was sitting here testing it, my account got banned. I've spoken to a few people and was advised that it doesn't seem to be moving the moues at all, rather just teleport clicking on the options, however i was under the impression that the item().interact() functions moved the mouse automatically to the item in question.
Anyone have any thoughts on this? i've included the snippet of the fletching alcher below, any suggestions would be appreciated.
EDIT: Mainly look for help with making the mouse more closely emulate human movement and also click on the items properly, rather than what it's currently doing.
import java.awt.Graphics2D;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Spells;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.input.mouse.MouseDestination;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;
import org.osbot.rs07.api.Mouse;
@ScriptManifest(author = "ME", info = "Bracelets", name = "AlchBot-1.1", version = 1, logo = "")
public class main extends Script {
@Override
public void onStart() {
log("Let's get started!");
}
@Override
public int onLoop() throws InterruptedException {
MouesDestination ==
getMouse().move((MouseDestination)
getObjects().closest("Grand Exchange booth");
getBank().open();
new ConditionalSleep(5000) { public boolean condition() {return getBank().isOpen();}}.sleep();
getBank().depositAllExcept("Nature rune");
if (getBank().contains("Yew longbow") || getBank().contains("Yew longbow (u)")) {
getBank().depositAllExcept("Nature rune");
if (getBank().contains("Yew longbow")) {
getBank().withdrawAll("Yew longbow");
getBank().close();
new ConditionalSleep(5000) {
public boolean condition() {
return getBank().isOpen();}
}.sleep();
new ConditionalSleep(3000) { public boolean condition() {return !getBank().isOpen();}}.sleep();
}
else if (getBank().contains("Bow string") && getBank().contains("Yew longbow (u)")) {
getBank().withdraw("Bow string", 1);
getBank().withdrawAll("Yew longbow (u)");
getBank().close();
new ConditionalSleep(3000) {
public boolean condition() {
return !getBank().isOpen();}
}.sleep();;
}
}
else {
getBot().getScriptExecutor().stop(false);}
// }
// add string
while (getInventory().contains("Nature rune") && getInventory().contains("Yew longbow (u)")) {
int bracelets = (int) getInventory().getAmount("Yew longbow (u)");
if (getInventory().contains("Bow string")) {
inventory.interact("Use", "Bow string");
new ConditionalSleep(1000) {
public boolean condition() {
return getInventory().isItemSelected(); }
}.sleep();
inventory.interact("Use", "Yew longbow (u)");
new ConditionalSleep(1000) {
@Override
public boolean condition() throws InterruptedException {
long braceletsNew = getInventory().getAmount("Yew longbow (u)");
if (bracelets != braceletsNew) {
return true;
}
return false;
}
}.sleep();
}
else if (!getInventory().contains("Bow string")) {
getBank().open();
new ConditionalSleep(5000) {
public boolean condition() {
return getBank().isOpen();}
}.sleep();
if (!getInventory().isFull()) {
if (getBank().contains("Bow string")) {
getBank().withdraw("Bow string", 1);
getBank().close();
new ConditionalSleep(5000) {
public boolean condition() {
return !getBank().isOpen();}
}.sleep();
}
else {
getBot().getScriptExecutor().stop(false);
;
}
}
else {
getBank().depositAll();
if (getBank().contains("Bow string")) {
getBank().withdrawAll("Nature rune");
getBank().withdraw("Bow string", 1);
getBank().withdrawAll("Yew longbow (u)");
getBank().close();
new ConditionalSleep(3000) {
public boolean condition() {
return !getBank().isOpen();}
}.sleep();
}
else {
getBot().getScriptExecutor().stop(false);
}
}
}
}
// alch
RS2Widget alchWarn = getWidgets().getWidgetContainingText("Click here to continue");
getTabs().open(Tab.MAGIC);
while (getInventory().contains("Nature rune") && getInventory().contains("Yew longbow")) {
skills.getExperience(Skill.MAGIC);
if (getTabs().getOpen().equals(Tab.MAGIC)) {
magic.castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY);
sleep(random(250,750));
}
inventory.interact("Cast", "Yew longbow");
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
long magicNew = skills.getExperience(Skill.MAGIC);
long magicOld = 0;
if ((magicNew != magicOld) || (alchWarn != null && alchWarn.isVisible()) && getTabs().getOpen().equals(Tab.MAGIC)) {
return true;
}
return false;
}
}.sleep();
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
if (getTabs().getOpen().equals(Tab.MAGIC)) {
return true;
}
return false;
}
}.sleep();
if (alchWarn != null && alchWarn.isVisible()) {
break;
}
if(getInventory().contains("Yew longbow") && getInventory().contains("Nature rune")) {
sleep(random(250,750));
magic.castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY);
}
else {
break;
}
}
return 0;
} // EoL
@Override
public void onExit() {
}
@Override
public void onPaint(Graphics2D g) {
}
}