Code: Select all
Program Trap;
var
i:Integer;
a: Integer;
b: Integer;
cyndyk: cardinal;
stime:TDatetime;
{$Include 'all.inc'}
procedure FullDisconnect;
begin
SetARStatus(false);
Disconnect;
Exit;
end;
procedure tpan;
begin
If TargetPresent then CancelTarget;
CheckSave;
If GetQuantity(FindType($1BFB,backpack))>0 then
begin
Finddistance:=2;
CheckSave;
WaitGump('4402');
checktargeterror(3,10000);
waittargetobject(findtype($1BF2,ground));
waitconnection(3000);
If (FindCount=0) and Connected then
begin
FullDisconnect;
end
useobject(findtype($1EB9,ground));
stime := Now;
repeat
waitconnection(3000);
CheckSave;
a := InJournalBetweenTimes('select the', stime, Now);
b := InJournalBetweenTimes('I am already|You must wait|canceled|You can"t', stime, Now);
wait(100);
until (a >= 0) or (b >= 0) or (Now > stime + (1.0/1440));
if (b > 0) then
begin
CheckSave;
wait(1020);
tpan;
end;
CheckSave;
CheckTargetError(3, 10000);
waittargetobject(findtype(cyndyk,ground));
stime := Now;
repeat
waitconnection(3000);
CheckSave;
a := InJournalBetweenTimes('The carefully|That chest', stime, Now);
b := InJournalBetweenTimes('I am already|You must wait|canceled|You can"t', stime, Now);
wait(100);
until (a >= 0) or (b >= 0) or (Now > stime + (1.0/1440));
if (b > 0) then
begin
CheckSave;
wait(1020);
tpan;
end;
end
else
begin
findtype($1BFB,ground);
If (FindCount=0) and Connected then
begin
FullDisconnect;
end;
grab(finditem,1000);
end
end;
Begin
{==========================}
cyndyk:=$0E42; {wooden chest}
{==========================}
SetARStatus(true);
waitconnection(3000);
Finddistance:=2;
ClearJournal;
Hungry(1,ground);
UOSay ('Trap!');
while not dead do
begin
for i:=1 to 8 do
begin
If Connected then
begin
tpan;
CheckSave;
UOSay ('Trap!');
stime:=Now;
repeat
waitconnection(3000);
CheckSave;
InJournalBetweenTimes('Untrap!', stime, Now);
wait(500);
until (LineCount >= 1) or (Now > stime + (0.5/1440));
end;
end;
If Connected then
Hungry(1,ground);
end;
End.
Edred: посмотри, как я отредактировал твой пост (code) и впредь делай так.