SRL Archive - Help and Support

Java Reflection Botting


Sk1nyNerd

2014-03-01 14:54:24

any guides on how to script bots for runescape in java?? something new i want to learn and googling isnt turning up to much usefulness. is that something that can be done in eclipse?

i used to bot with rsbots.net and their scripts where amazing and i believe they were done in java (i actually found their files on my computer so thats why im bringing up the topic lol. i can upload one if someone wants to take a peak. i believe it gets the code from online so it doesnt work went you run the comand prompt)

i dont know as much about java or reflection as id like so thanks for any help, especilaly with that of reflection and how it works

NKN

2014-03-01 15:07:29

http://powerbot.org

Sk1nyNerd

2014-03-01 15:29:28

oh boy, thats a lot to learn… haha thanks

Flight

2014-03-01 19:17:52

From: NKN
http://powerbot.org


…Or you could go to the place where those people (and everyone else) learned: http://www.moparisthebest.com/

Brandon also wrote a tutorial on getting started with making your own bot, you can read it here:
http://villavu.com/forum/showthread.php?t=103202

NKN

2014-03-01 20:52:27

From: Flight
…Or you could go to the place where those people (and everyone else) learned: http://www.moparisthebest.com/

Brandon also wrote a tutorial on getting started with making your own bot, you can read it here:
http://villavu.com/forum/showthread.php?t=103202



Oh, I thought he simply meant make a script for a java bot, not an actual client.

http://javahacking.org for making your own client.

Flight

2014-03-01 21:24:47

From: NKN
Oh, I thought he simply meant make a script for a java bot, not an actual client.

http://javahacking.org for making your own client.


Could be, perhaps I misunderstood in that case.

Sk1nyNerd

2014-03-01 22:08:26

i want to make a script using java, i think a client (other then loading the runescape page) is out of my league ha thanks for the threads hopefully its easy to pick up on :P

rj

2014-03-01 22:26:39

From: Sk1nyNerd
i want to make a script using java, i think a client (other then loading the runescape page) is out of my league ha thanks for the threads hopefully its easy to pick up on :P


All you need to know is a little basic java and a skeleton script :d

A little example of mining a rock (did this on notepad might not be right)

 public void mineRock(){

SceneObject trock = SceneEntities.getNearest(rockID);
int current = Inventory.getCount();

if(trock != null){
if(!trock.isOnScreen()){
Walking.walk(trock);
if(!trock.isOnScreen())
Camera.turnTo(trock);
}
if(trock.interact("Mine")){
while(Players.getLocal.getAnimation() == 624){
if(Inventory.getCount() > current){
tinMined++;
return true;
}
Task.sleep(50, 250);
}
}
}
} else {
return false;
}
}

As you can see the API does like 99% of the hardwork for you (gets all the objects.. got the closest one, animation checking is easy)
Basic function in Java:

public boolean someResult() {
return ((1 - 1) == 0);
}

Translated to pascalscript:

function someResult():boolean;
begin
result := ((1 - 1) = 0);
end;

Also basic OOP concepts you will have to have, for instance

 public static Area mine = new Area (new Tile(3008, 3371, 0) , new Tile(3008, 3367, 0), new Tile(3018, 3371, 0), new Tile(3018, 3367, 0));

The object 'Area' is an array of the object 'Tile' and has a method that checks if a point is in that area..

public boolean atMine() {
return mine.contains(Players.getLocal().getLocation());
}

In the class 'Area' it has a method called 'contains' that accepts a point as an argument. Then, in the class 'Players' has a method 'getLocal' and then 'getLocation' which gives the point to the argument

Sk1nyNerd

2014-03-01 22:36:25

From: Officer Barbrady
All you need to know is a little basic java and a skeleton script :d

A little example of mining a rock (did this on notepad might not be right)

 public void mineRock(){

SceneObject trock = SceneEntities.getNearest(rockID);
int current = Inventory.getCount();

if(trock != null){
if(!trock.isOnScreen()){
Walking.walk(trock);
if(!trock.isOnScreen())
Camera.turnTo(trock);
}
if(trock.interact("Mine")){
while(Players.getLocal.getAnimation() == 624){
if(Inventory.getCount() > current){
tinMined++;
return true;
}
Task.sleep(50, 250);
}
}
}
} else {
return false;
}
}

As you can see the API does like 99% of the hardwork for you
Basic function in Java:

public boolean someResult() {
return ((1 - 1) == 0);
}

Translated to pascalscript:

function someResult():boolean;
begin
result := ((1 - 1) = 0);
end;


sweet! powerbot had a couple beginer guides and that was basically how they went lol seems pretty idiot proof once you learn the API and some basics :P

@NKN does powerbot have a thing like Simba you download and code off of or do i download something like eclipse?

NKN

2014-03-01 22:38:07

From: Sk1nyNerd
sweet! powerbot had a couple beginer guides and that was basically how they went lol seems pretty idiot proof once you learn the API and some basics :P

@NKN does powerbot have a thing like Simba you download and code off of or do i download something like eclipse?


No, you'll need an IDE like IntelliJ.

I prefer intelliJ over Eclipse.

You really should get IntelliJ.

Here's a link to IntelliJ
http://www.jetbrains.com/idea/