Jump to content

Wanting to create Scripts - Bots


Kenn

Recommended Posts

So would that actually work by decompiling somebody jar into the class ?

You can't compile a jar to a class ...

A jar just holds multiple classes and resources.

A jar can be opened by winrar ;)

So you can just copy classes out of it and then you can decompile those classes ^^

 

Only do this for educational end btw.

grtz

H0ppy

Link to comment
Share on other sites

erm dude. i read your posts and i must say . i can see your motivated and stuff.

but everyone can see you have no clue where to start with..

search it up at youtube : elcipse. thats the program you need :D

try to find someone coding a script and learn from it. after you get a clue on what to do, try something out and if you cant find it at that moment, ask it here again. its better for yourself =]

Link to comment
Share on other sites

Lol i obv do know where to start with i use Eclipse to code RSPS i aren't completely new to Java but this is all wierd to me i've never done much with Bots, Although some codes do look alot familiar but im pretty sure 07 codes are different from coding 317-742 servers.

 

This is my code so far im working on some more like a all around woodcutt where you have a option to choose what you want to cut and such.

 

Would anybody care to help?

package Woodcutter;
/*
 * Create by Kenn
 * Project Created 07/07/2013
 * Base/Skeleton from OsBot.org
 */


import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;

import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.model.Entity;
import org.osbot.script.rs2.model.Player;
import org.osbot.script.rs2.skill.Skill;
import org.osbot.script.rs2.skill.Skills;
import org.osbot.script.rs2.ui.Bank;
import org.osbot.script.rs2.ui.Inventory;
import org.osbot.script.rs2.utility.Area;

@ScriptManifest(author = "Kenn", info = "Chops all logs everwhere.", name = "Woodcutter", version = 0.2)
public class Other extends Script {
	
	static Timer runTime;

	final String WILLOW_NAME = "Willow";
	final String YEW_NAME = "Yew";
	final String OAK_NAME = "Oak";

	final Area BANK_AREA = new Area(3092, 3240, 3097, 3246);
	final Area WILLOW_AREA = new Area(3081, 3223, 3092, 3239);
	final Area YEW_AREA = new Area();
	final Area OAK_AREA = new Area();
	
	final int BANK_BOOTH_ID = 23961;
	
	int startExp;
	int startLvl;
	
	int logsChopped = 0;

	// code used at start
	public void onStart() {

		runTime = new Timer (0);
		startExp = client.getSkills().getExperience(Skill.WOODCUTTING);
		startLvl = client.getSkills().getLevel(Skill.WOODCUTTING);
		
		log("Draynor Willow Cutter has started.");
	}

	// code to be executted at the end
	public void onExit() {

		log("Thanks for choosing Draynor Willow Cutter.");
	}

	// code in loop
	public int onLoop() throws InterruptedException {

		Inventory inven = client.getInventory();
		Player player = client.getMyPlayer();
		Bank bank = client.getBank();
				// Antiban
				if (random(50) == 0) {
					this.client.rotateCameraPitch(random(60, 360));
				}

		if (!inven.isFull()) {
			// chop

			if(WILLOW_AREA.contains(player)){
			Entity willow = closestObjectForName(WILLOW_NAME);

			if (willow != null) {
				if (willow.isVisible()) {
					if (!player.isAnimating()) {
						if (!player.isMoving()) {
							willow.interact("Chop down");
							sleep(random(700, 800));
						}
					}
				} else {
					client.moveCameraToEntity(willow);
				}
			}
			}else{
				walk(WILLOW_AREA);
			}
		} else {
			// bank
			if (BANK_AREA.contains(player)) {
				Entity bankbooth = closestObject(BANK_BOOTH_ID);

				if (bank.isOpen()) {
					bank.depositAll();
				} else {
					if (bankbooth != null) {
						if (bankbooth.isVisible()) {
							bankbooth.interact("Bank");
							sleep(random(700, 800));
						}else{
							client.moveCameraToEntity(bankbooth);
						}
					}
				}

			} else {
				walk(BANK_AREA);
			}
		}

		return 50;
	}
	
	public void onMessage(String message){
	
		if(message.contains("You get some willow logs.")){
			logsChopped++;
		if(message.contains("You get some oak logs.")){
			logsChopped++;
		}
	}
}

	// paint
	public void onPaint(Graphics g) {

		Graphics2D gr = (Graphics2D)g;
		
		gr.setColor(Color.CYAN);
		gr.setFont(new Font("Arial",Font.BOLD,12));
		
		Skills skills = client.getSkills();
		
		gr.drawString("Logs chopped: " + logsChopped, 25, 50);
		gr.drawString("Logs chopped/hr: " + getPerHour(logsChopped), 25, 65);
		
		gr.drawString("Exp gained: " + (skills.getExperience(Skill.WOODCUTTING)-startExp), 25, 80);
		gr.drawString("Exp gained Per Hour: " + getPerHour(skills.getExperience(Skill.WOODCUTTING)-startExp), 25, 95);
		
		gr.drawString("Woodcutting Level: " + (skills.getLevel(Skill.WOODCUTTING) + " + (" +(client.getSkills().getLevel(Skill.WOODCUTTING) -startLvl) + ")"), 25, 110);
	}

	public static int getPerHour(int Value) {
		if (runTime != null && runTime.getElapsed() > 0){
			return (int) (Value = (int) (36000000d / runTime.getElapsed()));
		} else {
			return 0;
		}
	}
	
	public static long getPerHour(long value) {
		if (runTime != null && runTime.getElapsed() > 0) {
			return (long) (value = (long) (36000000d / runTime.getElapsed()));
		} else {
			return 0;
		}
		
	}
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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