I want to use this OSBot script but I am not sure if it is outdated. It won't show up in my "local scripts" selection page even though it is in the folder.
Thanks,
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Polygon;
import java.util.List;
import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.mouse.RectangleDestination;
import org.osbot.script.rs2.map.Position;
import org.osbot.script.rs2.model.Character;
import org.osbot.script.rs2.model.GroundItem;
import org.osbot.script.rs2.model.NPC;
import org.osbot.script.rs2.model.RS2Object;
import org.osbot.script.rs2.skill.Skill;
import org.osbot.script.rs2.ui.EquipmentSlot;
import org.osbot.script.rs2.ui.RS2Interface;
import org.osbot.script.rs2.ui.RS2InterfaceChild;
import org.osbot.script.rs2.ui.Tab;
@ScriptManifest(author = "Corrupt", info = "Nightmare Zone script for Control members\nMade by Corrupt\nVersion: 6", name = "Diclonius Nightmare Zone", version = 0)
public class NightmareZone extends Script {
private enum Mode {Melee,Magic};
private Mode mode;
long startTime;
long lastOverload;
long lastMage;
int startXP;
int startXPHP;
Position campPos = null;
Position ddTile,waterTile,deathTile,bloodTile;
NZGUI gui = null;
Polygon tile = null;
public boolean run = false;
public boolean barrage = true;
public int onLoop() throws InterruptedException {
//checkInterface();
NPC dominic = closestNPCForName("Dominic Onion");
if(dominic != null) stop();
if(ddTile == null) return 200;
checkAttackStyle();
if(client.getSkills().getCurrentLevel(Skill.PRAYER) < 25) {
drinkPray();
}
if(!myPosition().equals(ddTile) && random(10) == 5 || distance (ddTile) > 4) {
walk(ddTile);
sleep(500+random(250));
} else {
if(mode.equals(Mode.Melee)) {
if(client.getSkills().getCurrentLevel(Skill.ATTACK) == client.getSkills().getLevel(Skill.ATTACK)) {
drinkOverload();
}
if(client.getSkills().getCurrentLevel(Skill.RANGED) -13 < client.getSkills().getLevel(Skill.RANGED)) {
drinkRange();
}
if(client.getInventory().contains("Dwarven rock cake")){
if (client.getSkills().getCurrentLevel(Skill.HITPOINTS) >3) {
client.getInventory().interactWithName("Dwarven rock cake", "Eat");
}
}
} else if(mode.equals(Mode.Magic)) {
attackBestNPC();
barrage = gui.comboBox.getSelectedItem().equals("Barrage");
if(barrage) {
if(client.getSkills().getCurrentLevel(Skill.MAGIC) < client.getSkills().getLevel(Skill.MAGIC) +4 || client.getSkills().getCurrentLevel(Skill.MAGIC)<96) {
drinkMagic();
}
} else {
if(client.getSkills().getCurrentLevel(Skill.MAGIC) < client.getSkills().getLevel(Skill.MAGIC) +4 || client.getSkills().getCurrentLevel(Skill.MAGIC)<73) {
drinkMagic();
}
}
if(ddTile != null && waterTile != null && bloodTile != null && deathTile != null)
pickupRunes();
}
}
return 800 + random(500);
}
private void checkInterface() throws InterruptedException {
if(client.getInterface(548) != null) {
log("interface detected, stopping script!");
stop();
}
}
private void checkAttackStyle() throws InterruptedException {
/*if(client.getConfig(43) == 2 && !equipmentTab.isWieldingWeaponThatContains("oktz")) { //on defence
while(client.getConfig(172) == 0) {//turn auto retaliate off
openTab(Tab.ATTACK);
sleep(700 + random(500));
RectangleDestination dest = new RectangleDestination(600,365,40,40);
while(!dest.getBoundingBox().contains(client.getMousePosition())) {
client.moveMouse(dest, false);
sleep(50);
}
client.clickMouse(false);
sleep(700);
}
walkMiniMap(new Position (myPosition().getX(),myPosition().getY()+5,0));
stop();
}*/
if(mode == Mode.Magic) {
if(client.getConfig(43) != 3) {//if not barraging
openTab(Tab.ATTACK);
sleep(700 + random(500));
RectangleDestination dest = new RectangleDestination(650,320,10,10);
while(!dest.getBoundingBox().contains(client.getMousePosition())) {
client.moveMouse(dest, false);
}
this.selectOption(null, dest, "Spell");
sleep(700 + random(500));
barrage = gui.comboBox.getSelectedItem().equals("Barrage");
if(barrage) {
dest = new RectangleDestination(691,350,15,7);
client.moveMouse(dest, false);
sleep(700 + random(500));
if(!client.getMenu().get(0).action.equals("Spell"))
client.clickMouse(false);
sleep(700 + random(500));
}
if(client.getConfig(172) == 0) {//turn auto retaliate off
openTab(Tab.ATTACK);
sleep(700 + random(500));
dest = new RectangleDestination(600,365,40,40);
while(!dest.getBoundingBox().contains(client.getMousePosition())) {
client.moveMouse(dest, false);
sleep(50);
}
client.clickMouse(false);
}
}
} else {//melle
if(client.getConfig(172) == 1) {//turn auto retaliate on
openTab(Tab.ATTACK);
sleep(700 + random(500));
RectangleDestination dest = new RectangleDestination(600,365,40,40);
while(!dest.getBoundingBox().contains(client.getMousePosition())) {
client.moveMouse(dest, false);
sleep(50);
}
client.clickMouse(false);
}
}
}
private void drinkOverload() throws InterruptedException {
if(currentTab() != null) {
openTab(Tab.INVENTORY);
}
for(int a = 1;a<5; a++) {
if( client.getInventory().contains("Overload ("+a+")") ) {
client.getInventory().interactWithName("Overload ("+a+")", "Drink");
sleep(random(50,1000));
return;
}
}
}
public void onPaint(Graphics g) {
long millis = System.currentTimeMillis() - startTime;
long hours = millis / (1000 * 60 * 60);
millis -= hours * (1000 * 60 * 60);
long minutes = millis / (1000 * 60);
millis -= minutes * (1000*60);
long seconds = millis / 1000;
int xpGained = client.getSkills().getExperience(Skill.STRENGTH)
+ client.getSkills().getExperience(Skill.ATTACK)
+ client.getSkills().getExperience(Skill.RANGED)
+ client.getSkills().getExperience(Skill.DEFENCE)
+ client.getSkills().getExperience(Skill.MAGIC)- startXP;
int xpPerHour = (int)(((double)xpGained * 3600000D) / (double)(System.currentTimeMillis() - startTime));
int hpxpGained = client.getSkills().getExperience(Skill.HITPOINTS) - startXPHP;
int hpxpPerHour = (int)(((double)hpxpGained * 3600000D) / (double)(System.currentTimeMillis() - startTime));
g.drawString("Time ran: " + hours + ":" + minutes + ":" + seconds, 100, 80);
g.drawString("Mode: " + mode,100,100);
g.drawString("XP gained: " + xpGained,100,120);
g.drawString("XP per hour: " + xpPerHour,100,140);
g.drawString("HP XP gained: " + hpxpGained,100,160);
g.drawString("HP XP per hour: " + hpxpPerHour,100,180);
g.drawString("yaw: " + client.getCameraYawAngle(),100,200);
if(ddTile != null) {
Polygon campTilePolygon = ddTile.getPolygon(bot);
g.drawPolygon(campTilePolygon);
}
g.setColor(Color.blue);
if(waterTile != null) {
Polygon campTilePolygon = waterTile.getPolygon(bot);
g.drawPolygon(campTilePolygon);
}
g.setColor(Color.red);
if(bloodTile != null) {
Polygon campTilePolygon = bloodTile.getPolygon(bot);
g.drawPolygon(campTilePolygon);
}
g.setColor(Color.white);
if(deathTile != null) {
Polygon campTilePolygon = deathTile.getPolygon(bot);
g.drawPolygon(campTilePolygon);
}
}
private void drinkMagic() throws InterruptedException {
if(currentTab() != null) {
openTab(Tab.INVENTORY);
}
for(int a = 1;a<5; a++) {
if( client.getInventory().contains("Super magic potion ("+a+")") ) {
if(client.getInventory().interactWithName("Super magic potion ("+a+")", "Drink")) {
sleep(random(50,1000));
return;
}
}
}
}
private void pickupRunes() throws InterruptedException {
//ground items are actually objects!
//blood rune item:11714
//death rune item:11713
//water rune item:11716
boolean collectedRunes = false;
if(barrage) {
if(client.getInventory().getAmount("Blood rune (nz)") < 101) {
while(client.getInventory().getAmount("Blood rune (nz)")<2001) {
collectedRunes = true;
sleep(300);
if(client.getSkills().getCurrentLevel(Skill.PRAYER) < 25) {
drinkPray();
}
Position pos = bloodTile;
if((pos.isVisible(bot))) {
if((client.getInventory().getAmount("Blood rune (nz)") >200) && distance(pos) <2) {
client.getInventory().interactWithName("Blood rune (nz)", "Discard");
} else {
if(distance(pos) <1){
if(client.getCameraPitch() <320)
client.rotateCameraPitch(320+random(1,60));
Polygon polygon = pos.getPolygon(bot);
int x = 0;
int y = 0;
for(int a = 0; a < polygon.xpoints.length; a++) {
x = x + polygon.xpoints[a];
}
for(int a = 0; a < polygon.ypoints.length; a++) {
y = y + polygon.ypoints[a];
}
x = x/polygon.xpoints.length;
y = y/polygon.ypoints.length;
RectangleDestination dest = new RectangleDestination(x-3,y-3,6,6);
this.selectOption(null, dest, "Pick-up");
} else {
pos.walkHere(bot);
}
}
} else walkMiniMap(pos);
GroundItem runesGI = closestGroundItemForName("Blood rune (nz)");
if(runesGI != null) {
if(runesGI.getAmount() >1999) {
runesGI.interact("Take");
sleep(500+random(500));
}
}
}
}
} else if(client.getInventory().getAmount("Chaos rune (nz)") < 101) {
while(client.getInventory().getAmount("Chaos rune (nz)")<4001) {
collectedRunes = true;
sleep(300);
if(client.getSkills().getCurrentLevel(Skill.PRAYER) < 25) {
drinkPray();
}
Position pos = bloodTile;
if((pos.isVisible(bot))) {
if((client.getInventory().getAmount("Chaos rune (nz)") >200) && distance(pos) <2) {
client.getInventory().interactWithName("Chaos rune (nz)", "Discard");
} else {
if(distance(pos) <1){
if(client.getCameraPitch() <320)
client.rotateCameraPitch(320+random(1,60));
Polygon polygon = pos.getPolygon(bot);
int x = 0;
int y = 0;
for(int a = 0; a < polygon.xpoints.length; a++) {
x = x + polygon.xpoints[a];
}
for(int a = 0; a < polygon.ypoints.length; a++) {
y = y + polygon.ypoints[a];
}
x = x/polygon.xpoints.length;
y = y/polygon.ypoints.length;
RectangleDestination dest = new RectangleDestination(x-3,y-3,6,6);
this.selectOption(null, dest, "Pick-up");
} else {
pos.walkHere(bot);
}
}
} else walkMiniMap(pos);
GroundItem runesGI = closestGroundItemForName("Chaos rune (nz)");
if(runesGI != null) {
if(runesGI.getAmount() >3999) {
runesGI.interact("Take");
sleep(500+random(500));
}
}
}
}
if(client.getInventory().getAmount("Water rune (nz)") < 101 || collectedRunes) {
while(client.getInventory().getAmount("Water rune (nz)")<6001) {
collectedRunes = true;
sleep(300);
if(client.getSkills().getCurrentLevel(Skill.PRAYER) < 25) {
drinkPray();
}
Position pos = waterTile;
if((pos.isVisible(bot))) {
if(client.getInventory().getAmount("Water rune (nz)") >200 && distance(pos) <2) {
client.getInventory().interactWithName("Water rune (nz)", "Discard");
} else {
if(distance(pos) <1){
if(client.getCameraPitch() <320)
client.rotateCameraPitch(320+random(1,60));
Polygon polygon = pos.getPolygon(bot);
int x = 0;
int y = 0;
for(int a = 0; a < polygon.xpoints.length; a++) {
x = x + polygon.xpoints[a];
}
for(int a = 0; a < polygon.ypoints.length; a++) {
y = y + polygon.ypoints[a];
}
x = x/polygon.xpoints.length;
y = y/polygon.ypoints.length;
RectangleDestination dest = new RectangleDestination(x-3,y-3,6,6);
this.selectOption(null, dest, "Pick-up");
} else {
pos.walkHere(bot);
}
}
} else walkMiniMap(pos);
GroundItem runesGI = closestGroundItemForName("Water rune (nz)");
if(runesGI != null) {
if(runesGI.getAmount() >5999) {
runesGI.interact("Take");
sleep(500+random(500));
}
}
}
}
if(client.getInventory().getAmount("Death rune (nz)") < 101 || collectedRunes) {
while(client.getInventory().getAmount("Death rune (nz)")<4001) {
collectedRunes = true;
sleep(300);
if(client.getSkills().getCurrentLevel(Skill.PRAYER) < 25) {
drinkPray();
}
Position pos = deathTile;
if((pos.isVisible(bot))) {
if(client.getInventory().getAmount("Death rune (nz)") >200 && distance(pos) <2) {
log("Number of runes" + client.getInventory().getAmount("Water rune (nz)"));
log("discarding");
client.getInventory().interactWithName("Death rune (nz)", "Discard");
} else {
if(distance(pos) <1){
if(client.getCameraPitch() <320)
client.rotateCameraPitch(320+random(1,60));
Polygon polygon = pos.getPolygon(bot);
int x = 0;
int y = 0;
for(int a = 0; a < polygon.xpoints.length; a++) {
x = x + polygon.xpoints[a];
}
for(int a = 0; a < polygon.ypoints.length; a++) {
y = y + polygon.ypoints[a];
}
x = x/polygon.xpoints.length;
y = y/polygon.ypoints.length;
RectangleDestination dest = new RectangleDestination(x-3,y-3,6,6);
this.selectOption(null, dest, "Pick-up");
} else {
pos.walkHere(bot);
}
}
} else walkMiniMap(pos);
GroundItem runesGI = closestGroundItemForName("Death rune (nz)");
if(runesGI != null) {
if(runesGI.getAmount() >3999) {
runesGI.interact("Take");
sleep(500+random(500));
}
}
}
}
if(collectedRunes) {
log("Collecting runes ending");
}
}
private int getNearbyCount(NPC npc) {
List<NPC> npcs = client.getLocalNPCs();
int nearbyNPCs = 0;
for(int b = 0; b < npcs.size(); b++) {
NPC npc2 = npcs.get(b);
int dist = distance(npc.getX(), npc.getY(), npc2.getX(), npc2.getY());
if((dist == 1 || dist ==0) && !npc.equals(npc2)) {
nearbyNPCs ++;
}
}
return nearbyNPCs;
}
@Override
public void onExit() {
gui.dispose();
}
private void attackBestNPC() throws InterruptedException {
if(client.getConfig(43) == 3){//has spell selected
List<NPC> npcs = client.getLocalNPCs();
NPC bestNPC = null;
int bestNumber = -1;
for(int a = 0; a < npcs.size(); a++) {
NPC npc = npcs.get(a);
int nearbyNPCs = getNearbyCount(npc);
if(nearbyNPCs > bestNumber && distance(npc) < 6) {
bestNumber = nearbyNPCs;
bestNPC = npc;
}
}
Character<?> facing = myPlayer().getFacing();
if((facing == null || !facing.equals(bestNPC) || !facing.exists()) && bestNPC != null) {
if(facing != null && getNearbyCount((NPC) facing) == bestNumber && facing.exists()) {
return;
}
log("Attacking NPC: " + bestNPC.getName() + " with " +(bestNumber+1) + " NPCs in barrage range");
selectOption(null, bestNPC.getMouseDestination(), "Fight");
}
}
}
public void onStart() {
run = false;
gui = new NZGUI(this);
gui.setTitle("V6 <3");
gui.setVisible(true);
campPos = myPosition();
lastMage = System.currentTimeMillis();
if(equipmentTab.isWearingItem(EquipmentSlot.WEAPON, "Ancient staff") || equipmentTab.isWearingItem(EquipmentSlot.WEAPON, "Staff of th dead")) {
mode = Mode.Magic;
} else {
mode = Mode.Melee;
}
startTime = System.currentTimeMillis();
startXPHP = client.getSkills().getExperience(Skill.HITPOINTS);
startXP = client.getSkills().getExperience(Skill.STRENGTH);
startXP = startXP + client.getSkills().getExperience(Skill.ATTACK);
startXP = startXP + client.getSkills().getExperience(Skill.MAGIC);
startXP = startXP + client.getSkills().getExperience(Skill.RANGED);
startXP = startXP + client.getSkills().getExperience(Skill.DEFENCE);
}
private void drinkPray() throws InterruptedException {
if(currentTab() != null) {
openTab(Tab.INVENTORY);
}
for(int a = 1;a<5; a++) {
if( client.getInventory().contains("Prayer potion("+a+")") ) {
client.getInventory().interactWithName("Prayer potion("+a+")", "Drink");
sleep(random(50,1000));
return;
}
}
}
private void drinkRange() throws InterruptedException {
if(currentTab() != null) {
openTab(Tab.INVENTORY);
}
for(int a = 1;a<5; a++) {
if( client.getInventory().contains("Super ranging ("+a+")") ) {
client.getInventory().interactWithName("Super ranging ("+a+")", "Drink");
sleep(random(50,1000));
return;
}
}
}
}