Ahaw Slime Trainer [New]

I don't know how to use this one. But I do know there is alot of options that would make you slime training more effective.
(Some people said it stops sometimes.//Ahaw)

const Food_Id = 3606; //change this to the desired itemid
      MinManaToEaT = 100;
      StrongWeaponID = 3320 //3318 - k axe
      WeakWeaponID = 3293
      NonWeaponID = 3003
      HealAtHp = 700
      UhAtHp = 300
      KillAtHp = 350
      ITEM_RUNE_UH = 3160
      MaxCreatures = 2 //if there are more creature than that,you would change to strong weapon
      MaxTime = [2,0,0]; //The maximum training time (hours, minutes, seconds)
      UsePercent=0; 
      minMana = 25;        //minimum mana
      minHealth = 350;     //Health to start healing with UH or Exura Vita
      maxHealth = 700;   //Health to start healing with Exura or Exura Gran
      MinHealthPercent =50;
      MaxHealthPercent=70;
      useGran = 0;   //1 if u want to use Exura Vita before start using UH}
      dir='d:\ouch.wav' //patch to your sound file
      DoPause=0 //put 1 if you kill slimes too fast, 0 for standard use (maybe working)
var
   MotherSlime,CreatureID,AttackingID, X1, Y1: integer;
   Finished,Finish: Boolean;
   StartTime: Float;
   MaxSeconds: Integer;
   TempHp:integer;
procedure WalkTo(X, Y, Z: integer);
begin
  Sleep(1000);
  repeat
    Sleep(1000);
    UpdateWorld;
    Self.MoveTo(X, Y, Z);
  until (abs(Self.X - X) < 1) and (abs(Self.Y - Y) < 1)
end;

function IsBesideYou(c: TCreature): boolean;
begin
   UpdateWorld;
   if (abs(c.X-self.X) <= 1) and (abs(c.Y-self.Y) <= 1) then begin
    if c.Z = self.Z then begin
     Result := True;
     Exit;
    end;
   end;
   Result := False;
end;

function GetNumberOfAttackingCreatures: integer;
begin
   UpdateWorld;
   Result := 0;
   for x := 0 to Creatures.Count - 1 do
   begin
      if (Abs(Creatures.Creature[x].X - Self.X) <= 1) and
       (Abs(Creatures.Creature[x].Y - Self.Y) <= 1) and
       (Creatures.Creature[x].Z = Self.Z) and
       (Creatures.Creature[x].NPC) then
         Result := Result + 1;
   end;
end;

Function IsCreatureBeside(Id:integer) :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].Z=Self.Z) then
    if (Creatures.Creature[x].NPC=true) then
    if (ABS(Creatures.Creature[x].X-Self.X)=1) or ((Creatures.Creature[x].X-Self.X)=0) then
    If  (Creatures.Creature[x].Id=Id) then
    Result:=True;
   end;
end;

function GetAttackedCreature: 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].Attacking = True then
    begin
      Result := Creatures.Creature[x];
      Exit;
    end;
  end;
end;

function GetItemFromOpenBackpack(ID: integer): TItem;
var
  x: integer;
  y: integer;
begin
  Result := nil;
  for x := 0 to Self.Containers.Count - 1 do
  begin
    if x >= Self.Containers.Count then Break;
    for y := 0 to Self.Containers.Container[x].Count - 1 do
    begin
      if y >= Self.Containers.Container[x].Count then Break;
      if Self.Containers.Container[x].Item[y].ID = ID then
      begin
        Result := Self.Containers.Container[x].Item[y];
        Exit;
      end;
    end;
  end;
end;

function Attacking: boolean;
begin
   UpdateWorld;
   for x := 0 to Creatures.Count - 1 do
   begin
      UpdateWorld;
      if Creatures.Creature[x].Attacking then
      begin
         Result := True;
         Exit;
      end;
   end;
   Result := False;
   Exit;
end;

function GetCreatureByID(ID: integer): 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].ID = ID then
    begin
      Result := Creatures.Creature[x];
      Exit;
    end;
  end;
end;

function GetFollowedCreatureID: Integer;
begin
   Result := 0;
   UpdateWorld;
   for x := 0 to Creatures.Count - 1 do
   begin
      UpdateWorld;
      if Creatures.Creature[x].Following then
      begin
         Result := Creatures.Creature[x].ID;
         Exit;
      end;
   end;
end;

Procedure Heal
begin
if usepercent=0 then 
 begin
  UpdateWorld;
  if (Self.Health <= minHealth) then
  begin
    if (Self.Mana >= minMana) and useGran then
    begin
      Self.Say('Exura Vita');
      Sleep(100);
    end;
    else
    begin
      Self.Containers.UseItemWithSelf(3160);
      Sleep(100);
    end;
  end;
  else
  begin
    if (Self.Health <= maxHealth) and (Self.Mana >= minMana ) then
    begin
      Self.Say('Exura Gran');  //change this to Exura or Exura Gran as u wish
      Sleep(1000);
    end;
  end;
  Sleep(100);
 end
else
begin
  UpdateWorld;
  Health:=Self.Health*100/Self.MaximumHealth
  if (Health <= minHealthpercent) then
  begin
    if (Self.Mana >= minMana) and useGran then
    begin
      Self.Say('Exura vita');
      Sleep(100);
    end;
    else
    begin
      Self.Containers.UseItemWithSelf(3160);
      Sleep(100);
    end;
  end;
  else
  begin
    if (Health  <= maxHealthPercent) and (Self.Mana >= minMana ) then
    begin
      Self.Say('Exura Gran');  //change this to Exura or Exura Gran as u wish
      Sleep(1000);
    end;
  end;
  Sleep(100);
 end
If Self.Mana>Self.MaximumMana-5 then Self.Say('exura') 
end; 

Procedure EatFood
if Self.Mana < MinManaToEat then
   begin
      UpdateWorld;
      for container := 0 to Self.Containers.Count - 1 do
      begin
         UpdateWorld;
         for item := 0 to Self.Containers.Container[container].Count - 1 do
         begin
            UpdateWorld;
            if Self.Containers.Container[container].Item[item].ID = Food_Id then
               Self.Containers.Container[container].Item[item].Use;
         end;
      end;
   end;

Procedure PutWeaponInHand(ID:Integer);
var
Weapon:TItem;
begin
  Updateworld;
  Weapon:= GetItemFromOpenBackpack(Id);
  if Weapon <> nil then
  begin
    Weapon.MoveToBody(self.RightHand, 0);
    sleep(1000);
  end;
end;

Procedure KillMother
begin
           If Self.Health < KillAtHp then
             Begin
              UpdateWorld;
              Self.Balanced 
              for x := 0 to Creatures.Count - 1 do
                  begin
                  UpdateWorld;
                  if Creatures.Creature[x].ID = MotherSlime then
                     begin
                      if (Creatures.Creature[x].Name <> Self.Name) and Creatures.Creature[x].NPC then
                         Begin
                         Creatures.Creature[x].Attacking := true;
                         PutWeaponInHand(StrongWeaponID);
                         end;
                      end;
                  end;
             end;
           end;

Procedure AOS
begin
  Result := nil;
   updateworld
   for x := 0 to Creatures.Count - 1 do
    begin
     if x >= Creatures.Count then Break;
     if  (Creatures.Creature[x].Name<>'Slime') and (Creatures.Creature[x].Name <> Self.Name) and (Creatures.Creature[x].Z= Self.Z)then
      begin
        PlaySound('d:\ouch.wav');
        {If Creatures.Creature[x].X>Self.X then
        begin
          If (Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].ID=3503) or (Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].ID=3504)then
          Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].MoveToBody(Self.Arrow,0)
        end
        else
         If (Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].ID<>3503) and (Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].ID<>3504)then
          Self.Arrow.MoveToGround(Self.X, Self.Y+1, Self.Z, 0);}
      end
  end;
end;

Procedure ChangeWeapon
var id:integer;
Begin
Updateworld;
Id:=Self.Attacking;
begin
for x := 0 to Creatures.Count - 1 do
  begin
    if x >= Creatures.Count then Break;
    if (Creatures.Creature[x].Z=Self.Z) then
    if (Creatures.Creature[x].NPC=true) then
    if  (Creatures.Creature[x].Name<>'Slime') then
    If  (Creatures.Creature[x].Id=Id) then PutWeaponInHand(StrongWeaponID);
   end;
end;
end

function GMDetected: boolean;
begin
  Result := False;
  UpdateWorld;
  for x := 0 to Creatures.Count - 1 do
  begin
    if Creatures.Creature[x].GM then
      begin
        PlaySound(dir);
        Result := True;
      end;
  end;
end; 

Procedure LureCheck
Begin
UpdateWorld;
If GetNumberOfAttackingCreatures > MaxCreatures then
   Begin
   UpdateWorld;
   for x := 0 to Creatures.Count - 1 do
   begin
      UpdateWorld;
      if (Creatures.Creature[x].Id <> AttackingID) and (Creatures.Creature[x].Id<>MotherSlime)  then
         Begin
         PutWeaponInHand(StrongWeaponID);
         Sleep(1000);
         Creatures.Creature[x].Attacking:=True
         Sleep(5000);
         While GetNumberOfAttackingCreatures > MaxCreatures do Sleep(1000);
          PutWeaponInHand(WeakWeaponID)
         End;
   end;
   end;
End 
begin
   MotherSlime := GetFollowedCreatureID;
   Finished := False;
   TempHP:=0;
   if (MotherSlime = 0) or(Self.Arrow.Id<>0) then
   begin
      Self.DisplayText('Mother Slime not found and/or arrow slot is not empty');
      Finished := True;
   end;
   StartTime := Time;
   MaxSeconds := (MaxTime[0] * 3600) + (MaxTime[1] * 60) + MaxTime[2];
   Self.Defensive
  while (not Terminated) and (not Finished) do
   begin
      UpdateWorld;
      if self.LogoutBlock=false then
                                begin
                                 If (Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].ID=3503) or (Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].ID=3504)then
                                    Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].MoveToBody(Self.Arrow,0)
                                    Sleep(1000);
                                Self.Logout(False)
                                end;

      if StartTime + (MaxSeconds / 100000) <= FloatToStr(Time) then
                                                               begin
                                                                for x := 0 to Creatures.Count - 1 do
                                                                    begin
                                                                    UpdateWorld;
                                                                    If (Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].ID=3503) or (Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].ID=3504)then
                                                                     Screen.Tile[7, 6].Item[Screen.Tile[7, 6].Count - 1].MoveToBody(Self.Arrow,0)
                                                                    Sleep(500)
                                                                    if Creatures.Creature[x].ID = MotherSlime then PutWeaponInHand(StrongWeaponID);
                                                                    end;
                                                               end;
      if (not Attacking) and (not GMDetected) then
         begin
         UpdateWorld;
         for x := 0 to Creatures.Count - 1 do
             begin
             UpdateWorld;
             if Creatures.Creature[x].ID <> MotherSlime then
             begin
               if (Creatures.Creature[x].Name <> Self.Name) and Creatures.Creature[x].NPC then
               begin
                  UpdateWorld;
                  X1 := Creatures.Creature[x].X;
                  Y1 := Creatures.Creature[x].Y;
                  if (X1 - Self.X = 1) or (X1 - Self.X = 0) or (X1 - Self.X = -1) then
                  begin
                     UpdateWorld;
                     if (Y1 - Self.Y = 1) or (Y1 - Self.Y = 0) or (Y1 - Self.Y = -1) then
                     begin
                           Begin
                           Creatures.Creature[x].Attacking := true;
                           Creature:=GetCreatureById(Creatures.Creature[x].Id);
                           Begin
                           Updateworld;
                           TempHp:=Creature.Health
                           I:= 0
                           //LureCheck
                           If attacking then
                           While (TempHp=Creature.Health) and (not GMDetected) do
                                 Begin
                                 Updateworld;
                                 AttackingID:=Self.Attacking
                                 If (TempHp=0) or (I>=15)  then break;
                                 I:=i+1
                                 Sleep(1000);
                                 Heal
                                 KillMother
                                 Aos
                                 //LureCheck
                                 EatFood
                                 End;
                           Sleep(500);
                           If DoPause then Creature.Attacking:=False
                           Sleep(500);
                           Heal
                           KillMother
                           Aos
                           EatFood
                           Sleep(10000);
                           End
                           Break;
                           end;
                     end;
                  end;
               end;
            end;
         end;
      end;
      AoS
   end;
end;
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License