в первом скрипте - просто скрипт, без красивостей в системном журнале.
во втором скрипте тоже самое, только в системном журнале вы можете наблюдать текстовую информацию, о том что делает ваш тамагочь в шахте.
1 Скрипт(без оповещений в системный журнал)
Code: Select all
program miningForOzzy;
//Made by Shinma;
{$Include 'all.inc'}
var
ColorOre:array of word;
OreType:array of word;
start_p: TFoundTile;
i,j,h,GH,fd,ty:word;
Xmin,Xmax,Ymin,Ymax : Integer;
kol_mine:word;
sum:word;
arr_sum:word;
rs:word;
tfta:TFoundTilesArray;
k:word;
temp:TFoundTilesArray;
res_arr:TFoundTilesArray;
ctime : TDateTime;
procedure init;
begin
Xmin := getx(self)-12;
Xmax := getx(self)+12;
Ymin := gety(self)-12;
Ymax := gety(self)+12;
ColorOre:=[$0000,$0386,$0482,$0630,$07d1,$0515,$0381,$0400,$0994,$052d,$0455,$00be,$048f];
OreType:=[$19B7,$19BA,$19B8,$19B9];
end;
function sqr(a:LongInt):LongInt;
begin
result:=a*a;
end;
function vector_length(c_1,c_2:TFoundTile):LongInt;
begin
result:=Round(sqrt(sqr(c_1.X-c_2.X)+sqr(c_1.Y-c_2.Y)));
end;
procedure QuickSort(var item:TFoundTilesArray; count:integer; point:TFoundTile);
var
temp_index,temp_value, tempo,i,j:LongInt;
t_c :TFoundTile;
begin
kol_mine:=count;
t_c:=point;
temp_index:=0;
temp_value:=vector_length(t_c,item[temp_index]);
for i:=0 to count-2 do
begin
for j:=i to count-1 do
begin
tempo:=vector_length(t_c,item[j]);
if tempo<temp_value then
begin
temp_index:=j;
temp_value:=tempo;
end;
end;
t_c:=item[temp_index];
item[temp_index]:=item[i];
item[i]:=t_c;
temp_value:=vector_length(item[i],item[i+1]);
end;
i:=0;
end;
procedure cancel;
begin
CloseMenu;
CancelMenu;
If TargetPresent Then CancelTarget;
end;
procedure poisk_ore;
begin
if (Connected) then
begin
checksave;
init;
sum:=0;
arr_sum:=0;
rs:=0;
j:=0 ;
rs:=GetStaticTilesArray(Xmin,Ymin,Xmax,Ymax,1,1339,tfta);
if rs>0 then
for k:=0 to rs-1 do temp[arr_sum+k]:=tfta[k];
arr_sum:=arr_sum+rs;
QuickSort(temp,arr_sum,start_p);
for k:=0 to arr_sum-1 do res_arr[sum+k]:=temp[k];
sum:=sum+arr_sum;
end;
end;
procedure Wait_Target(time_ms:Cardinal);
var
TempTime,SumTime:Cardinal;
begin
SumTime:=0;
h:=0;
repeat
checksave;
wait(500);
TempTime:=Timer;
SumTime:=SumTime+(Timer-TempTime);
h:=h+1;
until ((targetpresent) or (dead) or (not connected) or (SumTime>time_ms))or (h>50);
end;
procedure check_war;
begin
if IsWarMode(self) then
begin
setWarMode(false);
end;
end;
Procedure DoitBaby(f_tile:TFoundTile);
begin
repeat
checksave;
cancel;
UseObject(ObjAtLayer(rhandLayer));
Wait_Target(5000);
TargetToXYZ(f_tile.X,f_tile.Y,GetZ(Self));
h:=0;
ctime := Now;
repeat
wait(500);
checksave;
h:=h+1;
until (InJournalBetweenTimes('Вы переместили|There is nothing|You loosen|no line of sight|You cannot mine so close to yourself|Вы не смогли выкопать|Targeting cancelled.', ctime, Now)>= 0)or dead or (h>20)or (Not connected);
until (InJournalBetweenTimes('There is nothing here to mine|no line of sight|You cannot mine so close to yourself|Targeting cancelled.', ctime, Now)>= 0)or dead or (h>20)or (Not connected);
end;
procedure checkweight;
begin
if (Weight>=(MaxWeight-15))and (connected)then
begin
for ty:=0 to (GetArrayLength(ColorOre)-1) do
begin
for fd:=0 to 3 do
while (FindTypeEx(OreType[fd], ColorOre[ty], backpack, False) <> 0) and (not dead) and (connected)do
begin
if (ColorOre[ty]=$0000) and (connected)
then GH:=$03c1 else GH:=ColorOre[ty];
if (FindTypeEx($14EF, GH, backpack, False)<>0) and (connected) then
begin
checksave;
UseObject(FindItem);
Wait_Target(5000);
checksave;
WaitTargetObject(FindTypeEx(OreType[fd], ColorOre[ty], backpack, False));
end
else
begin
FindTypeEx(OreType[fd], ColorOre[ty], backpack, False)
checksave;
UOSay('.tradedeed');
checksave;
Wait_Target(5000);
checksave;
WaitTargetObject(FindItem);
ctime := Now;
h:=0;
repeat
wait(100);
checksave;
h:=h+1;
until (InJournalBetweenTimes('Вы создали торговый ', ctime, Now)>= 0)or (h>50)or (Not connected);
end;
end;
end;
end;
end;
begin
init;
check_war;
SetPauseScriptOnDisconnectStatus(True);
SetARStatus(True);
while (Not Dead) do
begin
poisk_ore;
while kol_mine <1 do
begin
checksave;
poisk_ore;
while (Not Connected)do
wait(10000*6);
end;
j:=sum-1;
i:=0;
while (i<j)and(Not Dead) and (connected)do
begin;
ClearBadLocationList;
if (i< kol_mine) and (connected) then
begin
checksave;
NewMoveXY(res_arr[i].X,res_arr[i].Y,false,1,false);
checksave;
DoitBaby(res_arr[i]);
checksave;
i:=i+1;
end;
if i>=kol_mine then
begin
i:=0;
checksave;
NewMoveXY(res_arr[i].X,res_arr[i].Y,false,1,false);
checksave;
DoitBaby(res_arr[i]);
checksave;
i:=i+1;
end;
checkweight;
end;
end;
end.
2 Скрипт(с оповещениями в системный журнал)
Code: Select all
program miningForOzzy;
//Made by Shinma;
{$Include 'all.inc'}
var
ColorOre:array of word;
OreType:array of word;
start_p: TFoundTile;
i,j,h,GH,fd,ty:word;
Xmin,Xmax,Ymin,Ymax : Integer;
kol_mine:word;
sum:word;
arr_sum:word;
rs:word;
tfta:TFoundTilesArray;
k:word;
temp:TFoundTilesArray;
res_arr:TFoundTilesArray;
ctime : TDateTime;
procedure init;
begin
Xmin := getx(self)-12;
Xmax := getx(self)+12;
Ymin := gety(self)-12;
Ymax := gety(self)+12;
ColorOre:=[$0000,$0386,$0482,$0630,$07d1,$0515,$0381,$0400,$0994,$052d,$0455,$00be,$048f];
OreType:=[$19B7,$19BA,$19B8,$19B9];
end;
function sqr(a:LongInt):LongInt;
begin
result:=a*a;
end;
function vector_length(c_1,c_2:TFoundTile):LongInt;
begin
result:=Round(sqrt(sqr(c_1.X-c_2.X)+sqr(c_1.Y-c_2.Y)));
end;
procedure QuickSort(var item:TFoundTilesArray; count:integer; point:TFoundTile);
var
temp_index,temp_value, tempo,i,j:LongInt;
t_c :TFoundTile;
begin
kol_mine:=count;
AddToSystemJournal('42 Кол-во рудных жил '+inttostr(kol_mine));
AddToSystemJournal('43 Составляю маршрут копания рудных жил');
t_c:=point;
temp_index:=0;
temp_value:=vector_length(t_c,item[temp_index]);
for i:=0 to count-2 do
begin
for j:=i to count-1 do
begin
tempo:=vector_length(t_c,item[j]);
if tempo<temp_value then
begin
temp_index:=j;
temp_value:=tempo;
end;
end;
t_c:=item[temp_index];
item[temp_index]:=item[i];
item[i]:=t_c;
temp_value:=vector_length(item[i],item[i+1]);
end;
i:=0;
end;
procedure cancel;
begin
CloseMenu;
CancelMenu;
If TargetPresent Then CancelTarget;
end;
procedure poisk_ore;
begin
if (Connected) then
begin
checksave;
init;
sum:=0;
arr_sum:=0;
rs:=0;
j:=0 ;
rs:=GetStaticTilesArray(Xmin,Ymin,Xmax,Ymax,1,1339,tfta);
if rs>0 then
for k:=0 to rs-1 do temp[arr_sum+k]:=tfta[k];
arr_sum:=arr_sum+rs;
AddToSystemJournal('83 Пи-пи-пи.');
AddToSystemJournal('84 Рудные жилы найдены.');
QuickSort(temp,arr_sum,start_p);
for k:=0 to arr_sum-1 do res_arr[sum+k]:=temp[k];
sum:=sum+arr_sum;
end;
end;
procedure Wait_Target(time_ms:Cardinal);
var
TempTime,SumTime:Cardinal;
begin
SumTime:=0;
h:=0;
repeat
AddToSystemJournal('96 Проверка на сохранение мира');
checksave;
wait(500);
TempTime:=Timer;
SumTime:=SumTime+(Timer-TempTime);
h:=h+1;
until ((targetpresent) or (dead) or (not connected) or (SumTime>time_ms))or (h>50);
end;
procedure check_war;
begin
if IsWarMode(self) then
begin
setWarMode(false);
end;
end;
Procedure DoitBaby(f_tile:TFoundTile);
begin
repeat
AddToSystemJournal('114 Начинаем процедуру выкапывания руды');
checksave;
cancel;
UseObject(ObjAtLayer(rhandLayer));
Wait_Target(5000);
AddToSystemJournal('119 Копаю в X='+inttostr(f_tile.X)+'. Y='+inttostr(f_tile.Y));
TargetToXYZ(f_tile.X,f_tile.Y,GetZ(Self));
h:=0;
ctime := Now;
repeat
AddToSystemJournal('124 Копаю пока рудная жила не оскудеет');
wait(2000);
checksave;
h:=h+1;
until (InJournalBetweenTimes('Вы переместили|There is nothing|You loosen|no line of sight|You cannot mine so close to yourself|Вы не смогли выкопать|Targeting cancelled.', ctime, Now)>= 0)or dead or (h>20)or (Not connected);
until (InJournalBetweenTimes('There is nothing here to mine|no line of sight|You cannot mine so close to yourself|Targeting cancelled.', ctime, Now)>= 0)or dead or (h>20)or (Not connected);
end;
procedure checkweight;
begin
if (Weight>=(MaxWeight-15))and (connected)then
begin
for ty:=0 to (GetArrayLength(ColorOre)-1) do
begin
for fd:=0 to 3 do
while (FindTypeEx(OreType[fd], ColorOre[ty], backpack, False) <> 0) and (not dead) and (connected)do
begin
AddToSystemJournal('140 начинаю упаковку руды в Диды');
if (ColorOre[ty]=$0000) and (connected)
then GH:=$03c1 else GH:=ColorOre[ty];
if (FindTypeEx($14EF, GH, backpack, False)<>0) and (connected) then
begin
AddToSystemJournal('145 Дид найден. Упаковываю руду в дид.');
checksave;
UseObject(FindItem);
Wait_Target(5000);
checksave;
WaitTargetObject(FindTypeEx(OreType[fd], ColorOre[ty], backpack, False));
end
else
begin
AddToSystemJournal('154 Дид ненайден. Создаю дид с рудой.');
FindTypeEx(OreType[fd], ColorOre[ty], backpack, False)
checksave;
UOSay('.tradedeed');
checksave;
Wait_Target(5000);
checksave;
WaitTargetObject(FindItem);
ctime := Now;
h:=0;
repeat
AddToSystemJournal('165 Жду появления дида в сумке.');
wait(100);
checksave;
h:=h+1;
until (InJournalBetweenTimes('Вы создали торговый ', ctime, Now)>= 0)or (h>50)or (Not connected);
AddToSystemJournal('170 Дид создан.');
end;
end;
end;
end;
end;
begin
AddToSystemJournal('177 Скрипт запущен '+DateTimeToStr(now));
AddToSystemJournal('178 Запускаю процедуру инициализации информации.');
init;
AddToSystemJournal('180 Если включен режим войны - выключаю.');
check_war;
AddToSystemJournal('182 Включаю автопаузу скрипта при дисконнекте.');
SetPauseScriptOnDisconnectStatus(True);
AddToSystemJournal('184 Включаю автореконнектор.');
SetARStatus(True);
while (Not Dead) do
begin
AddToSystemJournal('188 Начинаю поиск рудных жил.');
poisk_ore;
while kol_mine <1 do
begin
checksave;
poisk_ore;
while (Not Connected)do
wait(10000*6);
end;
AddToSystemJournal('190 Маршрут составлен.');
j:=sum-1;
i:=0;
while (i<j)and(Not Dead) and (connected)do
begin;
ClearBadLocationList;
if (i< kol_mine) and (connected) then
begin
checksave;
AddToSystemJournal('199 Двигаюсь к X='+inttostr(res_arr[i].X)+'. Y='+inttostr(res_arr[i].Y));
NewMoveXY(res_arr[i].X,res_arr[i].Y,false,1,false);
AddToSystemJournal('201 Текущее положение к X='+inttostr(GetX(self))+'. Y='+inttostr(GetY(self)));
checksave;
DoitBaby(res_arr[i]);
checksave;
i:=i+1;
AddToSystemJournal('206 i= '+inttostr(i));
end;
if i>=kol_mine then
begin
i:=0;
checksave;
AddToSystemJournal('212 Двигаюсь к X='+inttostr(res_arr[i].X)+'. Y='+inttostr(res_arr[i].Y));
NewMoveXY(res_arr[i].X,res_arr[i].Y,false,1,false);
AddToSystemJournal('214 Текущее положение к X='+inttostr(GetX(self))+'. Y='+inttostr(GetY(self)));
checksave;
DoitBaby(res_arr[i]);
checksave;
i:=i+1;
AddToSystemJournal('219 i= '+inttostr(i));
end;
AddToSystemJournal('221 i= '+inttostr(i));
checkweight;
end;
end;
end.