syberium
02-09-2009, 08:12 AM
Hey I'm working on a very fast fighting script for rock crabs. I have it currently running faster than most humans, But there is one huge problem. The script consistently returns null pointers when there is no other players around, and sometimes but rarely when players are around. I don't quite understand the main functions of rsbot such as " return new RSPlayer(Bot.getClient().getPlayerArray()[index]);"
not sure what that really means, have a basic idea but not enough to do anything with. So I would like somebody to turn these functions from something that returns a null value, to a boolean. I find when they return booleans i dont get those errors because they are not returning null values..
public RSCharacter getInteracting() {
int interact = c.getInteracting();
if (interact == -1) {
return null;
}
if (interact < 32767) {
return new RSNPC(Bot.getClient().getNPCArray()[interact]);
} else if (interact >= 32767) {
int index = (interact - 32767);
if (index == Bot.getClient().getSelfInteracting()) {
index = 2047;
}
return new RSPlayer(Bot.getClient().getPlayerArray()[index]);
}
return null;
}
public boolean isInteractingWithLocalPlayer(){
return (c.getInteracting() - 32768) == Bot.getClient().getSelfInteracting();
}
not sure what that really means, have a basic idea but not enough to do anything with. So I would like somebody to turn these functions from something that returns a null value, to a boolean. I find when they return booleans i dont get those errors because they are not returning null values..
public RSCharacter getInteracting() {
int interact = c.getInteracting();
if (interact == -1) {
return null;
}
if (interact < 32767) {
return new RSNPC(Bot.getClient().getNPCArray()[interact]);
} else if (interact >= 32767) {
int index = (interact - 32767);
if (index == Bot.getClient().getSelfInteracting()) {
index = 2047;
}
return new RSPlayer(Bot.getClient().getPlayerArray()[index]);
}
return null;
}
public boolean isInteractingWithLocalPlayer(){
return (c.getInteracting() - 32768) == Bot.getClient().getSelfInteracting();
}