Hey everyone currently working on an oglib pest control script (first time using ogLib).
I've got mostly everything done for it, gets in boat, waits for game to start, walks to portals, etc etc.
I just cant get the combat down correctly.
This is what I have right now for combat.
Simba Code:
var
whereToLook: TPoint = [400,300] ;
function attackPest(model:glModelArray): string;
var
tries: integer = 0;
color: string;
begin
repeat
mouse.click(whereToLook.closest(model)[0].randomizePointEllipse(5));
color := mouse.getClick();
if (color = 'red') then
begin
result := 'Attacking...';
break;
end;
if (color = 'yellow') then
begin
writeLn('Missclicked, retrying...');
tries := tries + 1;
end;
until (tries > 3);
tries := 0;
end;
procedure insidePestControlLoop();
var
didWeStartGame: boolean;
closestPest: TPoint;
resultOfAttack: string;
begin
didWeStartGame := waitForGameToStart();
if (didWeStartGame) then
begin
whereDoWeWalkTo(); //decides where we walk to in a different function
repeat
shifter := ogl.getModels(3915285997);
blackDefiler := ogl.getModels(1731643360);
ravager := ogl.getModels(3489785670);
whiteDefiler := ogl.getModels(3330847942);
splatter := ogl.getModels(547053328);
if (not ravager.isEmpty() and not tCombat.hasTarget()) then //if we found ravager model and we have no target reticule (the red thing when you attack something)
begin
writeLn('Found ravager and were not in combat, attacking');
attackPest(ravager); //sends the model of ravager to attackPest function
repeat
writeLn('In combat');
wait(randomRange(500,700));
until (not tCombat.hasTarget()); //make it repeat a wait procedure until there is no target reticule
end
else if (not splatter.isEmpty() and not tCombat.hasTarget()) then
begin
writeLn('Found splatter and were not in combat, attacking');
attackPest(splatter);
repeat
writeLn('In combat');
wait(randomRange(500,700));
until (not tCombat.hasTarget());
end
else if (not blackDefiler.isEmpty() and not tCombat.hasTarget()) then
begin
writeLn('Found black defiler and were not in combat, attacking');
attackPest(blackDefiler);
repeat
writeLn('In combat');
wait(randomRange(500,700));
until (not tCombat.hasTarget());
end
else if (not whiteDefiler.isEmpty() and not tCombat.hasTarget()) then
begin
writeLn('Found white Defiler and were not in combat, attacking');
attackPest(whiteDefiler);
repeat
writeLn('In combat');
wait(randomRange(500,700));
until (not tCombat.hasTarget());
end;
until (checkForRewardsLady = true);
end
else if (not didWeStartGame) then
begin
writeLn('Did not start game, terminating...');
TerminateScript;
end;
end;
The biggest issue im having is since oglib can detect models outside of camera range/agle, the script will currently try to click spots where it is not available to click.
Is there any way to narrow the search for models down to a certain distance away from a TPoint?
Also the clicking is sometimes wonky, could use some help with that.
But the biggest issue im having is the one stated above, making sure the script only clicks on a monster that it can click on (on the visible screen)
I know i could just make it run to one of the portals, have auto retaliate on and just afk but that seems pretty bot like/too simple. I wanted to try something different since most of my scripts have been sort of simple but I've been trying all day and cant seem to find any good solution.
Thanks, for any help