Auto Sio/Uh Friend

It will first try to sio him and if you dont have mana it will uh him.

Const MiniCreatureHP =90; // if your firned has 50% of his hp it will heal..change it as you like it.
const ITEM_RUNE_UH = 3160;
const Name='Kindred'; //enter here the name of your friend.
var
  Creature: TCreature;
  CreatureName: string;

function IsCreatureVisible(Name: string): boolean;
var
  x: integer;
begin
  Result := False;
  for x := 0 to Creatures.Count - 1 do
  begin
    if x >= Creatures.Count then Break;
    if Creatures.Creature[x].Name = Name then
    begin
      if Creatures.Creature[x].Visible then
      begin
        Result := True;
        Exit;
      end;
    end;
  end;
end;  

function GetCreatureByName(Name: string): TCreature;
var
  x: integer;
begin
  Result := nil;
  for x := 0 to Creatures.Count - 1 do
  begin
    if x >= Creatures.Count then Break;
    if (Creatures.Creature[x].Name = Name) then
    begin
      Result := Creatures.Creature[x];
      Exit;
    end;
  end;
end;

begin
  while not Terminated do
  begin
    UpdateWorld;
       Creature := GetCreatureByName(Name);
       If Creature<> nil then
       If IsCreatureVisible(Name) then
      begin
      if ((Creature.Health) <(MiniCreatureHP)) and ((Self.Mana)>(70)) then
      Self.Say('exura sio "'+Name)
       else 
       if ((Creature.Health) <(MiniCreatureHP)) then Self.Containers.UseItemWithCreature(ITEM_RUNE_UH, Creature);
       end;
      Sleep(500);
   end;

end;
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License