quinta-feira, 31 de julho de 2008

Keep aim offscreen

Const
RuneD=3155;// rune id number for key Delete.
RuneE=3174; // rune id number for key End.
RunePD=5321;// rune id number for key Page Down.

var
LockID:integer;

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;

procedure Event_KeyDown(Key: integer);
Begin
Case key of
$22:begin
updateworld;
Creature:=GetCreatureByID(LockID);
if Creature <> nil then
Self.Containers.UseItemWithCreature(RunePD, Creature);
end;
$23:begin
updateworld;
Creature:=GetCreatureByID(LockID);
if Creature <> nil then
Self.Containers.UseItemWithCreature(RuneE, Creature);
end;
$2E:begin
updateworld;
Creature:=GetCreatureByID(LockID);
if Creature <> nil then
Self.Containers.UseItemWithCreature(RuneD, Creature);
end;
end;
end;

begin
updateworld;
while self.attacking=0 do
begin
sleep(200);
updateworld;
end;
LockID:=self.attacking;
while not terminated do
begin
updateworld;
ProcessEvents;
if ((self.attacking)<>(LockID)) and ((self.attacking)<>(0)) then
LockID:=Self.Attacking;
sleep(100);
end;
end;

0 Comments: