I'm assuming you mean to ask how you would do that? In this case, it's actually quite simple. All you would do is set a constant, check the HP level, and if it is below whatever the constant is set to, eat some food.
Simba Code:
program new;
{$i srl/srl.simba}
const
MINIMUM_HP = 300;
procedure eatFood();
var
col: string;
begin
if (getMMLevels('hp', col) <= MINIMUM_HP) then
begin
writeln('health is too low, we need to eat!');
// here is where you would put your code of eating the food
end;
end;
begin
end.
I'm not going to do the whole problem for you, but that's how you would use the constant.
Hopefully that helps.