Hi, this is my first script and It's fletching maple logs to maple longbows.
My question is: is this script safe to use?
Here is the code:
UPDATE: 2/03/2014
Fixed:
- Typing 28 when bank is still open
- Added more antiban
- Fixed bank error where script stopped
TODO:
- Adding more logs & options
- GUI
import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.ui.Tab;
import org.osbot.script.rs2.utility.Area;
import org.osbot.script.mouse.*;
@ScriptManifest(author = "Jowo", info = "FletchingScript!", name = "Basic Fletcher", version = 1.1)
public class FletchingWillows extends Script {
private static final int[] Knife_ID = { 946};
private int irandomx;
private int irandomy;
private int irandomx2;
private int irandomy2;
private int Antibanx;
private int Antibany;
private int MouseRandomx;
private int MouseRandomy;
final int[] WBOW_ID = {62};
final int[] WILLOW_ID = {1517};
private static final Area Fletching_AREA = new Area(2586,3422, 2586,3418);
private static final Area BANK_AREA = new Area(2586,3422, 2586,3418);
private enum State {
FLETCH, BANK
};
public void start(){
log("Starting script");
}
private State getState(){
if (client.getInventory().contains(66)&&(!myPlayer().isAnimating())){
return State.BANK;
}
else {
return State.FLETCH;
}
}
public int onLoop() throws InterruptedException {
switch (getState()) {
case FLETCH:
if (!myPlayer().isAnimating()) {
client.getInventory().interactWithId(946, "Use");
sleep(random(400, 500));
client.getInventory().interactWithId(1515, "Use");
sleep(random(600,2000));
irandomx=random(191,315);
irandomy=random(373,403);
client.moveMouseTo(new RectangleDestination(irandomx, irandomy, 10,10), false, true, true);
sleep(random(500,600));
irandomx2=random(irandomx-45,irandomx+49);
irandomy2=random(irandomy+67,irandomy+73);
client.moveMouseTo(new RectangleDestination(irandomx2, irandomy2, 10,10), false, true, false);
sleep(random(750,2000));
if (!myPlayer().isAnimating()&&(!client.getBank().isOpen())) {
type("28");
}
sleep(random(500,3000));
log("executing fletching");
if (myPlayer().isAnimating()) {
log("Entering Antiban system");
switch(random(1,5)){
//Antibanx=3;
//switch (Antibanx) {
case 1:
log("Case 1");
moveMouseOutsideScreen();
sleep(random(4000,60000));
log("Leaving antiban system");
break;
case 2:
log("Case 2");
client.rotateCameraPitch(random(1,120));
sleep(random(6000,8000));
log("Leaving antiban system");
break;
case 3:
log("Case 3");
openTab(Tab.SKILLS);
Antibanx=random(611,668);
Antibany=random(361,389);
client.moveMouseTo(new RectangleDestination(Antibanx,Antibany, 10,10), false, false, false);
sleep(random(7000,30000));
openTab(Tab.INVENTORY);
log("Leaving antiban system");
break;
case 4:
log("Case 4");
MouseRandomx=random(10,725);
MouseRandomy=random(5,490);
client.moveMouseTo(new RectangleDestination(MouseRandomx,MouseRandomy, 10,10), false, false, false);
sleep(random(5000,16000));
log("Leaving antiban system");
break;
case 5:
log("Case 5:");
sleep(random(35000,78000));
log("Leaving antiban system");
break;
}
}
}
break;
case BANK:
log("Banking");
RS2Object bank = closestObjectForName("Bank booth");
if (bank != null) {
if (bank.interact("Bank")) {
while (!client.getBank().isOpen())
sleep(random(250,350));
if (!client.getBank().isOpen()){
bank.interact("Bank");
}
client.getBank().depositAll(66);
sleep(random(200,450));
client.getBank().withdrawAll(1515);
sleep(random(500,850));
client.getBank().close();
sleep(random(250,400));
if (client.getBank().isOpen()){
client.getBank().close();
log("Client bugged! Hersluiten van bank nu");
}
switch(random(1,5)){
case 1:
log("Coming into antiban of bank!");
client.moveMouseTo(new RectangleDestination(MouseRandomx,MouseRandomy, 10,10), false, false, false);
sleep(random(350,700));
log("Leaving banking antiban");
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
}
log("Executing bank");
}
}
}
return random(250,1000);
}
public void onExit(){
log("Thx for using this");
}
}