if this is what you want… here it is;
i took what you wanted and i made it more universal,
function EatMeFood(DTMOfFood, HealthValue: integer): boolean;
var
x, y, x1, y1: integer;
begin
GameTab(2);
if(Damage<HealthValue-1)then
begin
GameTab(4);
if(FindDTM(DTMOfFood, x, y, MIX1, MIY1, MIX2, MIY2)then
begin
x1 := x-2;
y1 := y-2;
Mouse(x1, y1, 4, 4, True);
Result := True;
end else Writeln('No more food');
end;
end;
DTMOfFood = the DTM of the food
HealthValue = the amount the above food item heals
it will return true if it ate false is not
if you like it rep me pl0x, also credit
edit: my 200th post