quinta-feira, 31 de julho de 2008

Wear Stone Skin Amulet when key pressed

var
AmuletID: integer;

function GetItemFromOpenBackpack(ID: integer): TItem;
var
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;

procedure Event_KeyDown(Key: integer);
var
Amulet: TItem;
begin
UpdateWorld;
if Key = 9 then //Change number to hotkey of your likeing currently TAB
begin
if Self.Amulet.ID <> AmuletId then
begin
Amulet := GetItemFromOpenBackpack(AmuletID);
if Amulet <> nil then Amulet.MoveToBody(Self.Amulet, 0);
end
end;
end;

begin
AmuletID := 3081; //item id for your Amulet
while not Terminated do
begin
ProcessEvents;
Sleep(100);
end;
end;

0 Comments: