to keep it simple as i see you like it like that you can do
Simba Code:
function FightGoblin:Boolean;
var
x, y: Integer;
begin
repeat
if FindObjCustom(x, y, ['att', 'ack'], [3901051, 8365713, 4958626], 4) then
Writeln('We found a goblin.');
MMouse(x, y, 0, 0);
ChooseOption('ttack');
end;
Also it doesn't need to be a function. Functions need to have results. You can just do it like this.
Simba Code:
procedure FightGoblin;
var
x, y: Integer;
begin
repeat
if FindObjCustom(x, y, ['att', 'ack'], [3901051, 8365713, 4958626], 4) then
Writeln('We found a goblin.');
MMouse(x, y, 0, 0); // This Moves the mouse to the goblin.
ChooseOption('ttack'); // This right clicks the goblin and chooses attack.
// In here i would put something to check if goblin is dead or easier just put in a wait.
Wait(5000); // this makes it wait for 5 seconds.
end;