Hello, I just started coding with Simba and I would like some help with my script. I am making a rock crab killer for a private server that I play.

This is the current code.
Code:
program RockCrabFarmer;

procedure KillCrab;
var
  x, y:Integer;
begin
  if FindColor(x, y, 3359298, 5, 8, 509, 335) or
     FindColor(x, y, 3161919, 5, 8, 509, 335) then
  begin
    MoveMouse(x, y);
    GetMousePos(x, y);
    ClickMouse(x, y, 1);
    Wait(10000);
  end;
end;

procedure LootCasket;
var
  x, y:Integer;
begin
  if FindColor(x, y, 677238, 5, 8, 509, 335) or
     FindColor(x, y, 609386, 5, 8, 509, 335) then
  begin
      MoveMouse(x, y);
      GetMousePos(x, y);
      ClickMouse(x, y, 1);
      Wait(5000);
  end;
end;

procedure FullInventory;
var
  KillLoot: Integer;
begin
repeat
  KillCrab;
  LootCasket;
  Inc(KillLoot);
  WriteLn(IntToStr(KillLoot));
  until(KillLoot = 27);
end;

begin
FullInventory;
end.
What that code does is it clicks on the color of the rock crab and then waits 10 seconds so that I have time to kill it. Then it will look for a casket on the ground, if it doesnt find it then it will just go back to killing crabs. If it does find a casket, it will click on it and wait 5 seconds giving me time to pick it up. Each time it kills a rock crab and loots, it will increase the number of times I've killed then looted. Once it gets to 27 I would like it to open up all the caskets in my inventory and start over. Currently all it does is just kill, loot, repeat and the counter will rise to 27. Once the counter hits 27, it just starts over.

If anyone can help me add a procedure to my script where I can open the 27 caskets in my inventory that would be highly appreciated.

If you have any questions or don't understand fully, just say so and I will elaborate.