Sorry in advance for my horrible code, I haven't done anything like this for many years!
I'm creating a basic Barbarian fishing spot script using oglib and am trying to detect when the fishing spot has moved. An easy way would be just have it click the nearest fishing spot every x seconds but that's boring.
My problem is with the isVisible(); function and I think I'm using it incorrectly. When I load a model into a model array and output the index of the model array that I want (i.e. one fishing spot) then it outputs: {ID = 111111, TID = 222222, X = 123123, Y = 456456}. I assumed if I used isVisible() on this exact index of the model array it would return false if the model wasn't present at the above coordinates just outputted. It would appear I've got that wrong though, as it will return true as long as there is a model with the same ID in the area, is there a way to do this or another function to use?
code so far:
Simba Code:
var
fishingSpot: glModelArray;
closestTemp : glModelArray;
clientCenter := ogl.getClientMidPoint();
begin
fishingSpot := ogl.getModels(2252653705); //load all fishing spots in area to array
closestTemp := clientCenter.closest(fishingSpot); //array to temporarily store the last closest fishing spot this stays out of the loop
repeat
fishingSpot := ogl.getModels(2252653705); //reload fishing spots again in the loop to get current locations
if closestTemp[0].isVisible() then //the line that's causing issues. I want it to give a false value if the spot has moved, this always continues to return true though. Wrong function?
begin
//this chunk works, clientCenter.closest updates when the closest spot changes. ClosestTemp[0] continues to return the old closest
writeln(clientCenter.closest(fishingSpot)[0], 'closest spot output');
writeln(closestTemp[0], 'closest temp output');
wait(5000);
end
else
begin
writeln('Spot moved');
writeln(clientCenter.closest(fishingSpot)[0], 'closest spot output');
writeln(closestTemp[0], 'closest temp output');
mouse.move(clientCenter.closest(fishingSpot)[0].randomizePointEllipse(16));
exit;
wait(20000);
end
until false;
I hope I haven't explained that as horribly as I think I have, any help is much appreciated!