Jump to content

A really really bad PC Script.


7331337

Recommended Posts

  • 2 weeks later...
  • 2 months later...

Hey all, this is my second post ever. Just trying to give back to the community.

I assumed that since the source was posted and it isn't being updated that I was allowed to get it working again, and to update it. However if this is not the case, please go easy on me.

 

I just got into scripting so it's still a bad script but I did add a little functionality, it will now:

- prioritize spinners over everything

- prioritize portals over everything but spinners

- break off of attacking something else to attack spinners

 

Download link:

http://s000.tinyupload.com/?file_id=20381650488508831145

 

(again let me know if link doesn't work, it's my first go at all this)

 

 

And here is the source: Happy botting!

import org.osbot.rs07.api.LocalWalker;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.Message;
import org.osbot.rs07.api.ui.Message.MessageType;
import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 


import java.awt.*;
import java.util.concurrent.TimeUnit;
 
@ScriptManifest(
		author = "54b3ew5vw *modified by Abhorrent*", 
		info = "PestControl", 
		name = "Simple PestControl Afker", 
		version = 0, 
		logo = "")

public class main extends Script {
	// Npc names
	String[] pestControlMonsters = {"Brawler","Defiler","Ravager","Shifter","Spinner","Torcher"};
	boolean areWeInBoat, didWeArrive, didWeFinish = false;
	boolean attackingSpinner = false;
	boolean attackingPortal = false;
	int okset = 0;
	String status = "Nothing";
	long startTime = System.currentTimeMillis();
	long timeElapsed = 0;
	//int[] pestControlStarter = {1,2,3,4};
	//int[] pestControlMiddle = {10339,1630};
	//int[] pestControlBoat1 = {2260,2643,2263,2638};
	//int[] pestControlBoat2 = {2637,2647,2641,2642};
	//int[] pestControlBoat3 = {2632,2654,2635,2649};
	
    @Override
    public void onStart() {
        log("=============================");
        log("= Starting pest control bot =");
        log("=============================");
        getBot().addMessageListener(this);
    }
    
    private enum State {
		BOATING, WAITING, MOVING, FINDINGTARGET, KILLING;
	};
    	
	private State getState() {
		NPC findEnemy = npcs.closest(pestControlMonsters);
		RS2Object findCauldron = objects.closest("Cauldron");
		RS2Object findPlank = objects.closest("Gangplank");
		//RS2Object findPlank = objects.closest(9999).getX;
		if(areWeInBoat == true && findCauldron != null && findPlank != null){
			status = "Waiting";
			return State.WAITING;
		}
		if(findCauldron == null && findPlank == null) {
			areWeInBoat = false;
			okset = objects.closest("Lander boat").getY() - myPlayer().getY();
			if(objects.closest("Lander boat").getY() - myPlayer().getY() < 10){
				status = "Moving";
				return State.MOVING;
			}
		}
		if (areWeInBoat == false && myPlayer().getY() < 3000 && findPlank != null){
			status = "Entering boat";
			return State.BOATING;
		}
		if (findEnemy != null && !myPlayer().isAnimating() && !myPlayer().isMoving() && !myPlayer().isUnderAttack() && myPlayer().getInteracting() == null){
			status = "Finding Target";
			return State.FINDINGTARGET;
		}
		if (myPlayer().isAnimating() || myPlayer().isUnderAttack() || myPlayer().isMoving() || myPlayer().getInteracting() != null){
			status = "Killing";
			return State.KILLING;
		}
		status = "Moving";
		return State.MOVING;
	}
	
    //@Override
    //public int onLoop() throws InterruptedException {
    //	NPC findEnemy = npcs.closest(pestControlMonsters);
    //	if (findEnemy != null){
    //		if (!myPlayer().isAnimating() && !myPlayer().isMoving() && !myPlayer().isUnderAttack() && myPlayer().getInteracting() == null){
    //				findEnemy.interact("Attack");
    //				sleep(random(1000, 5000));
    //		}
    //	}
    //   return random(100, 1000);
    //}
    
	public void onMessage(Message message) {
		if (message.getType() == MessageType.GAME) {
			try {
				if (message.getMessage().contains("You board the lander") || message.getMessage().contains("can't reach that!")) {
					areWeInBoat = true;
				} else {
					// Do nothing
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
    
	@Override
    public int onLoop() throws InterruptedException {
		switch (getState()) {
		case WAITING:
			sleep(random(300, 750));
			//log ("Waiting");
			break;
		case BOATING:
			objects.closest("Gangplank").interact("Cross");
			sleep(random(750, 1250));
			//log ("Entering boat");
			break;
		case MOVING:
			int newX = myPlayer().getX() + random(4, 8) - 4;
			int newY = myPlayer().getY() - random(5, 10) - 5;
			
			//Position baseObject = objects.closest(9999).getPosition();
			//Position towerLeft = new Position((baseObject.getX() - 14), (baseObject.getY() + 14), 0);
			//Position towerRight = new Position((baseObject.getX() + 11), (baseObject.getY() + 14), 0);
			//Position towerTopLeft = new Position((baseObject.getX() - 11), (baseObject.getY() + 29), 0);
			//Position towerTopRight = new Position((baseObject.getX() + 8), (baseObject.getY() + 29), 0);
	
			//Position[] newLocation = {new Position(newX, newY, 0)};
			if (map.canReach(new Position(newX, newY, 0)) && myPlayer().isMoving() == false){
				log("Location; " + newX +"," + newY + ",0");
				localWalker.walk(newX, newY);
				log("attempt click");
				sleep(random(1000, 1750));
			} else {
				sleep(random(100, 1000));
			}
			break;
		case FINDINGTARGET:
			NPC findEnemy = npcs.closest(pestControlMonsters);
			NPC findPortal = npcs.closest("Portal");
			NPC findSpinner = npcs.closest("Spinner");
			NPC portal1 = npcs.closest(1747);
			NPC portal2 = npcs.closest(1748);
			NPC portal3 = npcs.closest(1749);
			NPC portal4 = npcs.closest(1750);
			
			if (findSpinner != null && findSpinner.isAttackable() && !attackingSpinner)
			{
				findSpinner.interact("Attack");
				sleep(random(300,800));
				attackingSpinner = true;
				attackingPortal = false;
				break;
			}
			if (findPortal != null && findPortal.isAttackable() && !attackingPortal)
			{
				if (portal1 != null || portal2 != null || portal3 != null || portal4 != null)
				{
					findPortal.interact("Attack");
					sleep(random(300, 800));
					attackingSpinner = false;
					attackingPortal = true;
					break;
				}
			}
			
			if (findEnemy != null && findEnemy.isAttackable())
			{
				findEnemy.interact("Attack");
				sleep(random(300, 1350));
				attackingSpinner = false;
				attackingPortal = false;
			} 
			else {
				attackingSpinner = false;
				attackingPortal = false;
				sleep(random(350, 585));
			}
			//log("Finding target");
			break;
		case KILLING:
			NPC spinnerCheck = npcs.closest("Spinner");
			portal1 = npcs.closest(1747);
			portal2 = npcs.closest(1748);
			portal3 = npcs.closest(1749);
			portal4 = npcs.closest(1750);
			if (spinnerCheck != null && !attackingSpinner && spinnerCheck.isAttackable())
			{
				spinnerCheck.interact("Attack");
				attackingSpinner = true;
				attackingPortal = false;
				sleep(random(720,925));
				break;
			}
			NPC portalCheck = npcs.closest("Portal");
			if (portalCheck != null && portalCheck.isAttackable() && !attackingPortal && !attackingSpinner)
			{
				if (portal1 != null || portal2 != null || portal3 != null || portal4 != null)
				{
					portalCheck.interact("Attack");
					sleep(random(565, 1200));
					attackingSpinner = false;
					attackingPortal = true;
					break;
				}
			}
			NPC enemyCheck = npcs.closest(pestControlMonsters);
			if (enemyCheck != null && !attackingSpinner && enemyCheck.isAttackable() && !attackingPortal)
			{
				enemyCheck.interact("Attack");
				attackingSpinner = false;
				attackingPortal = false;
				sleep(random(625,1100));
				break;
			}
			
			sleep(random(200,450));
			break;
		}
		
		return random(200, 800);
	}
 
    @Override
    public void onExit() {
        log("YoloSwagAFk");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
		long currentTime = System.currentTimeMillis();
		timeElapsed = currentTime - startTime;
		long hours = TimeUnit.MILLISECONDS.toHours(timeElapsed);
		timeElapsed -= TimeUnit.HOURS.toMillis(hours);
		long minutes = TimeUnit.MILLISECONDS.toMinutes(timeElapsed);
		timeElapsed -= TimeUnit.MINUTES.toMillis(minutes);
		long seconds = TimeUnit.MILLISECONDS.toSeconds(timeElapsed);
    	g.drawString("Status: " + status, 200, 328);
    	g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds, 200, 300);
    }
 
} 

 

Also if i'm allowed to, I would like to add a few things:

- ability to handle brawlers being their obnoxious brawler selves

- some sort of paint   * I don't know how to do this yet * 

- maybe some sort of buying options?

 

I don't know how much free time I will have, just finishing up my last semester of college so lots of big projects, but we will see. If I have the time, and there is any sort of demand, then i'll give it my best newbie shot wink.png

 

10/25/15:

- added run time

- added redundancy (should be more stable)

Edited by abhorrent
  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hey all, this is my second post ever. Just trying to give back to the community.

I assumed that since the source was posted and it isn't being updated that I was allowed to get it working again, and to update it. However if this is not the case, please go easy on me.

 

I just got into scripting so it's still a bad script but I did add a little functionality, it will now:

- prioritize spinners over everything

- prioritize portals over everything but spinners

- break off of attacking something else to attack spinners

 

Download link:

http://s000.tinyupload.com/?file_id=20381650488508831145

 

(again let me know if link doesn't work, it's my first go at all this)

 

 

And here is the source: Happy botting!

import org.osbot.rs07.api.LocalWalker;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.Message;
import org.osbot.rs07.api.ui.Message.MessageType;
import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 


import java.awt.*;
import java.util.concurrent.TimeUnit;
 
@ScriptManifest(
		author = "54b3ew5vw *modified by Abhorrent*", 
		info = "PestControl", 
		name = "Simple PestControl Afker", 
		version = 0, 
		logo = "")

public class main extends Script {
	// Npc names
	String[] pestControlMonsters = {"Brawler","Defiler","Ravager","Shifter","Spinner","Torcher"};
	boolean areWeInBoat, didWeArrive, didWeFinish = false;
	boolean attackingSpinner = false;
	boolean attackingPortal = false;
	int okset = 0;
	String status = "Nothing";
	long startTime = System.currentTimeMillis();
	long timeElapsed = 0;
	//int[] pestControlStarter = {1,2,3,4};
	//int[] pestControlMiddle = {10339,1630};
	//int[] pestControlBoat1 = {2260,2643,2263,2638};
	//int[] pestControlBoat2 = {2637,2647,2641,2642};
	//int[] pestControlBoat3 = {2632,2654,2635,2649};
	
    @Override
    public void onStart() {
        log("=============================");
        log("= Starting pest control bot =");
        log("=============================");
        getBot().addMessageListener(this);
    }
    
    private enum State {
		BOATING, WAITING, MOVING, FINDINGTARGET, KILLING;
	};
    	
	private State getState() {
		NPC findEnemy = npcs.closest(pestControlMonsters);
		RS2Object findCauldron = objects.closest("Cauldron");
		RS2Object findPlank = objects.closest("Gangplank");
		//RS2Object findPlank = objects.closest(9999).getX;
		if(areWeInBoat == true && findCauldron != null && findPlank != null){
			status = "Waiting";
			return State.WAITING;
		}
		if(findCauldron == null && findPlank == null) {
			areWeInBoat = false;
			okset = objects.closest("Lander boat").getY() - myPlayer().getY();
			if(objects.closest("Lander boat").getY() - myPlayer().getY() < 10){
				status = "Moving";
				return State.MOVING;
			}
		}
		if (areWeInBoat == false && myPlayer().getY() < 3000 && findPlank != null){
			status = "Entering boat";
			return State.BOATING;
		}
		if (findEnemy != null && !myPlayer().isAnimating() && !myPlayer().isMoving() && !myPlayer().isUnderAttack() && myPlayer().getInteracting() == null){
			status = "Finding Target";
			return State.FINDINGTARGET;
		}
		if (myPlayer().isAnimating() || myPlayer().isUnderAttack() || myPlayer().isMoving() || myPlayer().getInteracting() != null){
			status = "Killing";
			return State.KILLING;
		}
		status = "Moving";
		return State.MOVING;
	}
	
    //@Override
    //public int onLoop() throws InterruptedException {
    //	NPC findEnemy = npcs.closest(pestControlMonsters);
    //	if (findEnemy != null){
    //		if (!myPlayer().isAnimating() && !myPlayer().isMoving() && !myPlayer().isUnderAttack() && myPlayer().getInteracting() == null){
    //				findEnemy.interact("Attack");
    //				sleep(random(1000, 5000));
    //		}
    //	}
    //   return random(100, 1000);
    //}
    
	public void onMessage(Message message) {
		if (message.getType() == MessageType.GAME) {
			try {
				if (message.getMessage().contains("You board the lander") || message.getMessage().contains("can't reach that!")) {
					areWeInBoat = true;
				} else {
					// Do nothing
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
    
	@Override
    public int onLoop() throws InterruptedException {
		switch (getState()) {
		case WAITING:
			sleep(random(300, 750));
			//log ("Waiting");
			break;
		case BOATING:
			objects.closest("Gangplank").interact("Cross");
			sleep(random(750, 1250));
			//log ("Entering boat");
			break;
		case MOVING:
			int newX = myPlayer().getX() + random(4, 8) - 4;
			int newY = myPlayer().getY() - random(5, 10) - 5;
			
			//Position baseObject = objects.closest(9999).getPosition();
			//Position towerLeft = new Position((baseObject.getX() - 14), (baseObject.getY() + 14), 0);
			//Position towerRight = new Position((baseObject.getX() + 11), (baseObject.getY() + 14), 0);
			//Position towerTopLeft = new Position((baseObject.getX() - 11), (baseObject.getY() + 29), 0);
			//Position towerTopRight = new Position((baseObject.getX() + 8), (baseObject.getY() + 29), 0);
	
			//Position[] newLocation = {new Position(newX, newY, 0)};
			if (map.canReach(new Position(newX, newY, 0)) && myPlayer().isMoving() == false){
				log("Location; " + newX +"," + newY + ",0");
				localWalker.walk(newX, newY);
				log("attempt click");
				sleep(random(1000, 1750));
			} else {
				sleep(random(100, 1000));
			}
			break;
		case FINDINGTARGET:
			NPC findEnemy = npcs.closest(pestControlMonsters);
			NPC findPortal = npcs.closest("Portal");
			NPC findSpinner = npcs.closest("Spinner");
			NPC portal1 = npcs.closest(1747);
			NPC portal2 = npcs.closest(1748);
			NPC portal3 = npcs.closest(1749);
			NPC portal4 = npcs.closest(1750);
			
			if (findSpinner != null && findSpinner.isAttackable() && !attackingSpinner)
			{
				findSpinner.interact("Attack");
				sleep(random(300,800));
				attackingSpinner = true;
				attackingPortal = false;
				break;
			}
			if (findPortal != null && findPortal.isAttackable() && !attackingPortal)
			{
				if (portal1 != null || portal2 != null || portal3 != null || portal4 != null)
				{
					findPortal.interact("Attack");
					sleep(random(300, 800));
					attackingSpinner = false;
					attackingPortal = true;
					break;
				}
			}
			
			if (findEnemy != null && findEnemy.isAttackable())
			{
				findEnemy.interact("Attack");
				sleep(random(300, 1350));
				attackingSpinner = false;
				attackingPortal = false;
			} 
			else {
				attackingSpinner = false;
				attackingPortal = false;
				sleep(random(350, 585));
			}
			//log("Finding target");
			break;
		case KILLING:
			NPC spinnerCheck = npcs.closest("Spinner");
			portal1 = npcs.closest(1747);
			portal2 = npcs.closest(1748);
			portal3 = npcs.closest(1749);
			portal4 = npcs.closest(1750);
			if (spinnerCheck != null && !attackingSpinner && spinnerCheck.isAttackable())
			{
				spinnerCheck.interact("Attack");
				attackingSpinner = true;
				attackingPortal = false;
				sleep(random(720,925));
				break;
			}
			NPC portalCheck = npcs.closest("Portal");
			if (portalCheck != null && portalCheck.isAttackable() && !attackingPortal && !attackingSpinner)
			{
				if (portal1 != null || portal2 != null || portal3 != null || portal4 != null)
				{
					portalCheck.interact("Attack");
					sleep(random(565, 1200));
					attackingSpinner = false;
					attackingPortal = true;
					break;
				}
			}
			NPC enemyCheck = npcs.closest(pestControlMonsters);
			if (enemyCheck != null && !attackingSpinner && enemyCheck.isAttackable() && !attackingPortal)
			{
				enemyCheck.interact("Attack");
				attackingSpinner = false;
				attackingPortal = false;
				sleep(random(625,1100));
				break;
			}
			
			sleep(random(200,450));
			break;
		}
		
		return random(200, 800);
	}
 
    @Override
    public void onExit() {
        log("YoloSwagAFk");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
		long currentTime = System.currentTimeMillis();
		timeElapsed = currentTime - startTime;
		long hours = TimeUnit.MILLISECONDS.toHours(timeElapsed);
		timeElapsed -= TimeUnit.HOURS.toMillis(hours);
		long minutes = TimeUnit.MILLISECONDS.toMinutes(timeElapsed);
		timeElapsed -= TimeUnit.MINUTES.toMillis(minutes);
		long seconds = TimeUnit.MILLISECONDS.toSeconds(timeElapsed);
    	g.drawString("Status: " + status, 200, 328);
    	g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds, 200, 300);
    }
 
} 

 

Also if i'm allowed to, I would like to add a few things:

- ability to handle brawlers being their obnoxious brawler selves

- some sort of paint   * I don't know how to do this yet * 

- maybe some sort of buying options?

 

I don't know how much free time I will have, just finishing up my last semester of college so lots of big projects, but we will see. If I have the time, and there is any sort of demand, then i'll give it my best newbie shot wink.png

 

10/25/15:

- added run time

- added redundancy (should be more stable)

 

 

2qtwwtx.png

 

Bough void bottom and still had 70 pts left. Cheers.

Link to comment
Share on other sites

  • 2 weeks later...

I accidentally copied over my screen shot but it ran for 7.5 hours while i slept and still kept going. It is a well running script but it is extremely Bot-like haha. I would only recommend using this on an account you don't care about and only after you have transferred all of your gp off of it just to be safe. I did have to run it 2 times when i first loaded it up it did one game and then got stuck outside of the boat the script said it was moving and it never entered the boat. Once i reloaded the script it ran flawlessly all night. Good job thanks for the script! 

Link to comment
Share on other sites

  • 2 months later...

Got 2 full voids with this, no ban. Thank you so much.

 

Edit: It worked flawlessly on the first account, which was about 3 months ago. The second one, which I did 2 days ago, would get stuck outside of the boat every 6-7 games, but I used the break manager to get it to restart every 20 mins and that worked well. 

Edited by sanane
Link to comment
Share on other sites

  • 1 month later...

Got 2 full voids with this, no ban. Thank you so much.

 

Edit: It worked flawlessly on the first account, which was about 3 months ago. The second one, which I did 2 days ago, would get stuck outside of the boat every 6-7 games, but I used the break manager to get it to restart every 20 mins and that worked well. 

 

Was this with abhorrent's edited script or the Original script?

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...