I dont like the leechfags on RSBot, but ill release how to do model clicking here. Only SpeedWing at RSBot and I know how to do it, (I still think all my methods > Speed's methods), and I made some methods that can do model clicking for any type of object anywere, with randomized clicking.
Heres a preview of the developed points (yellow dots) for a Magic Tree.
Pretty with all those points eh?
Anyways, lets get down to buissness.
So, theres 2 different types of RSObjects that RSBot has. Once is the accessor, and one is the wrapper. The wrapper has most of the developed methods, but its not what we want, we want the barebone methods and typecasting ability. So lets say we have a tile of an object that we want to click, well, you need to get the proper RSObject. Luckily, I created an easy method to get that appropriate object class.
Code:
It works for interactable objects (trees, ore rocks, ect...), ground decorations (flowers, bushes), fences/walls, ect...
But wait, how do we gets screen points to work with?
Well, love me baby, love me more. I coded another method to easily do this.
Code:
Still wondering what to do now?
Once again, love me baby, love me.
Heres an example for displaying the points (e.g. in the example picture at the top of the post).
Code:
Now, how to click a random point?
Theres a few problems, theres sooooo many, if you just keep doing random index's, it may take a few seconds before getting a working screen location if lets say half of the model isnt on the screen. Of course, I already think ahead, and I fixed that. So, I check a few, and if I dont get one within lets say 5 tries, then I check each point until I find one that does work, and because theres sooooo many points, itll be near to impossible to create a pattern that any bot detection could find.
So, heres what I do.
Code:
If you used any part of this tutorial in your code, please credit me.
Also, do not redistribute any part of this tutorial anywere. It is created by me, Marneus901/Circadian
Tutorial written by : Marneus901/Circadian
Heres a preview of the developed points (yellow dots) for a Magic Tree.
Pretty with all those points eh?
Anyways, lets get down to buissness.
So, theres 2 different types of RSObjects that RSBot has. Once is the accessor, and one is the wrapper. The wrapper has most of the developed methods, but its not what we want, we want the barebone methods and typecasting ability. So lets say we have a tile of an object that we want to click, well, you need to get the proper RSObject. Luckily, I created an easy method to get that appropriate object class.
Code:
- Code:
public org.rsbot.accessors.RSObject getModelObjectAt(RSTile t){
return getModelObjectAt(t.getX(), t.getY());
}
public org.rsbot.accessors.RSObject getModelObjectAt(int x, int y) {
org.rsbot.accessors.Client client = Bot.getClient();
if (client.getRSGroundArray() == null)
return null;
try {
org.rsbot.accessors.RSGround rsGround = client.getRSGroundArray()[client.getPlane()][x - client.getBaseX()][y - client.getBaseY()];
if (rsGround != null) {
org.rsbot.accessors.RSObject rsObj;
org.rsbot.accessors.RSInteractable obj;
// Interactable objects like trees
for (RSAnimableNode node = rsGround.getRSAnimableList(); node != null; node = node.getNext()) {
obj = node.getRSAnimable();
if (obj != null) {
rsObj = (org.rsbot.accessors.RSObject) obj;
if (rsObj.getID() != -1)
return rsObj;
}
}
// Ground Decorations
obj = rsGround.getRSObject1();
if (obj != null) {
rsObj = (org.rsbot.accessors.RSObject) obj;
if (rsObj.getID() != -1)
return rsObj;
}
// Fences / Walls
{
obj = rsGround.getRSObject2_0();
if (obj != null) {
rsObj = (org.rsbot.accessors.RSObject) obj;
if (rsObj.getID() != -1)
return rsObj;
}
obj = rsGround.getRSObject2_1();
if (obj != null) {
rsObj = (org.rsbot.accessors.RSObject) obj;
if (rsObj.getID() != -1)
return rsObj;
}
}
{
obj = rsGround.getRSObject3_0();
if (obj != null) {
rsObj = (org.rsbot.accessors.RSObject) obj;
if (rsObj.getID() != -1)
return rsObj;
}
obj = rsGround.getRSObject3_1();
if (obj != null) {
rsObj = (org.rsbot.accessors.RSObject) obj;
if (rsObj.getID() != -1)
return rsObj;
}
}
obj = rsGround.getRSObject4();
if (obj != null) {
rsObj = (org.rsbot.accessors.RSObject) obj;
if (rsObj.getID() != -1)
return rsObj;
}
}
} catch (Exception ignored) {
}
return null;
}
It works for interactable objects (trees, ore rocks, ect...), ground decorations (flowers, bushes), fences/walls, ect...
But wait, how do we gets screen points to work with?
Well, love me baby, love me more. I coded another method to easily do this.
Code:
- Code:
public Point[] getModelPoints(RSObject rsObj){
if(rsObj==null)
return new Point[]{};
RSObject object = rsObj;
RSAnimable animable = (RSAnimable) object;
Model model = object.getModel();
//Calculate screen coords of the model
Point[] screenCoords = new Point[model.getXPoints().length];
for(int i = 0; i < screenCoords.length; i++)
{
int x = model.getXPoints()[i] + animable.getX();
int z = model.getZPoints()[i] + animable.getY();
int y = model.getYPoints()[i] + Calculations.tileHeight(animable.getX(), animable.getY());
screenCoords[i] = Calculations.w2s(x, y, z);
}
int[] xPoints = new int[4];
int[] yPoints = new int[4];
int length = ((LDModel) model).getIndices3().length;
for (int i = 0; i < length; i++) {
int index1 = ((LDModel) model).getIndices1()[i];
if(screenCoords[index1].x == -1 || screenCoords[index1].y == -1)
continue;
xPoints[0] = screenCoords[index1].x;
yPoints[0] = screenCoords[index1].y;
xPoints[3] = screenCoords[index1].x;
yPoints[3] = screenCoords[index1].y;
int index2 = ((LDModel) model).getIndices2()[i];
if(screenCoords[index2].x == -1 || screenCoords[index2].y == -1)
continue;
xPoints[1] = screenCoords[index2].x;
yPoints[1] = screenCoords[index2].y;
int index3 = ((LDModel) model).getIndices3()[i];
if(screenCoords[index3].x == -1 || screenCoords[index3].y == -1)
continue;
xPoints[2] = screenCoords[index3].x;
yPoints[2] = screenCoords[index3].y;
}
return screenCoords;
}
Still wondering what to do now?
Once again, love me baby, love me.
Heres an example for displaying the points (e.g. in the example picture at the top of the post).
Code:
- Code:
if(/*Object is up/spawned*/){
paint.setColor(Color.YELLOW);
for(Point p : getModelPoints(getModelObjectAt(tiles[0].getX(), tiles[0].getY())))
paint.drawRect(p.x, p.y, 1, 1);
}
Now, how to click a random point?
Theres a few problems, theres sooooo many, if you just keep doing random index's, it may take a few seconds before getting a working screen location if lets say half of the model isnt on the screen. Of course, I already think ahead, and I fixed that. So, I check a few, and if I dont get one within lets say 5 tries, then I check each point until I find one that does work, and because theres sooooo many points, itll be near to impossible to create a pattern that any bot detection could find.
So, heres what I do.
Code:
- Code:
Point pts[] = getModelPoints(getModelObjectAt(tile1.getX(), tile1.getY()));
while(modelIsVisible() && /*other conditions*/){
int idx = random(0, pts.length);
if(!pts[idx].equals(new Point(-1,-1))){
moveMouse(pts[idx]);
}
if(idx>5){
for(Point p:pts)
if(!p.equals(new Point(-1,-1)))
moveMouse(p);
break;
}
}
clickMouse(true);
If you used any part of this tutorial in your code, please credit me.
Also, do not redistribute any part of this tutorial anywere. It is created by me, Marneus901/Circadian
Tutorial written by : Marneus901/Circadian