Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

Provocation

тут можно задать вопрос по скриптингу
Post Reply
diGriZzZ
Posts: 4
Joined: 14.04.2005 11:07

Provocation

Post by diGriZzZ »

Code: Select all

Program UseProvocation;
Var i : Integer;
    TestItemID : Cardinal;

procedure Hungry(NeededLevel : Integer);
var HArray : array [0..10] of String;
    CurrentLevel : Integer;
    HasError : Boolean;
    TimeSayHungry : TDateTime;
    FoodID : Cardinal;
    i,c,difference : Integer;
begin
if (NeededLevel < 0) or (NeededLevel > 10) then Exit;
   HArray[0] := 'You are absolutely stuffed!';
   HArray[1] := 'You are stuffed';
   HArray[2] := 'hungry at all';
   HArray[3] := 'You are a little hungry';
   HArray[4] := 'You are somewhat hungry';
   HArray[5] := 'You are REALLY hungry';
   HArray[6] := 'Your stomash hurts';
   HArray[7] := 'Your stomash hurts and you feel dizzy';
   HArray[8] := 'You are starving';
   HArray[9] := 'You are almost dying of hunger';
   HArray[10] := 'You are DYING of hunger...';
HasError := true;
TimeSayHungry := Now;
UOSay('.hungry');
wait(100);
i:=0;
while i < 100 do
   begin
   for c := 0 to 10 do
   if InJournalBetweenTimes(HArray[c],TimeSayHungry,Now) >= 0 then
   begin
   CurrentLevel := c;
   HasError := false;
   i := 100;
   end;
   wait(100);
   i := i + 1;
   end;
if HasError then
   begin
   AddToSystemJournal('Error with Hungry: Lag? Conection error? Something else?');
   Exit;
   end;
difference := CurrentLevel - NeededLevel;
if difference > 0 then for i := 1 to difference do
   begin
   FoodID := FindType($097B,BackPack);
   if FoodID <> $00 then UseObject(FoodID)
   else AddToSystemJournal('No Food');
   wait(200);
   end;
end;


Begin
{You must Set TestItemID to use Arms Lore}
while Life > 0 do
begin

i:=0;
while i < 100 do
   begin
   UseSkill('Provocation');
   WaitForTarget(10000);
   if TargetPresent then TargetToObject(0113DC1E);
   WaitForTarget(10000);
   if TargetPresent then TargetToObject(0113DD97);
   wait(1000);
   i := i + 1;
   end;

Hungry(2);

end; {end while}

End. 
выдаёт ошибку: "Compiler: [Error] (68:45): comma (',') expected"
Miralex
Developer
Developer
Posts: 656
Joined: 11.03.2005 19:12
Contact:

Post by Miralex »

1.
TargetToObject(0113DC1E);
$ в начале кто напишет? Двумя строками ниже - тоже самое.

2.
while Life > 0 do
Для вечного зацикливания советую использовать:

Code: Select all

while true do
В 0.51 ты еще может быть не выйдешь из цикла.
В новых версиях- все параметры при дисконнекте будут обнулятся. Поэтому вылет из цикла тебе будет обеспечен. :!:
Post Reply