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

Mining с реколом HELP!

тут можно задать вопрос по скриптингу
Post Reply
zarazacher
Posts: 2
Joined: 21.11.2012 9:05

Mining с реколом HELP!

Post by zarazacher »

program mining;
// ZuluHotel 3
//Mining s rekolom domoy
//Rekolits9 pri nahojdenii tipov man,woman,explojen,prichki
//pri previshenii vesa 1000
//dobor kirok, zariajaet RB
//resaets9 cheresz .rescue
//
// crafted by bahoho 1.04
const
pickaxe = $0E85;
sunduk = $66541081; // Sunduk dl9 scroll recall, jarenoy ribi, kirok <Need Setup>
sunduk2 = $66541081; // Sunduk dl9 sbrosa rudi <Need Setup>
RB = $6629C1BA; // Roone book <Need Setup>
RunaHome = 13; // Nomer runi domoy [1-16] <Need Setup>
Xhome = 4408; // Koordinata X v dome <Need Setup>
trash = $67369E76; // pomoyka dl9 sbrosa mapov <Need Setup>
Moving = 1; // esli 1 s hodilkoy, esli drugoe 4islo to bez
MyMaxWeight = 500;

var x,y,i,t,k,p,r:integer;
ctime:TDateTime;
Enemy : array[1..5] of cardinal;
Ruda : array[1..8] of cardinal;
Runa : array[1..4] of integer;

{$Include 'all.inc'}

procedure Recall;
begin
Runa[1] := 11; // Nomera run v RB po shahtam [1-16] <Need Setup>
Runa[2] := 12; //esli netu stolko run prosto povtorit' neskolko odinakovih
Runa[3] := 11;
Runa[4] := 12;
UseObject(RB);
WaitGump(IntToStr(1024 + Runa[r]));
wait(4000);
r:=r+1;
if (r > 4) then r:=1;
end;

procedure Home;
begin
repeat
checksave;
disarm;
wait(200);
UseObject(RB);
WaitGump(IntToStr(1024 + RunaHome));
wait(3000);
if (GetX(self) <> Xhome) then
begin
Raw_move(Random(7), true);
wait(250);
Raw_move(GetDirection(self), true);
wait(500);
end;
until (GetX(self) = Xhome) or dead
end;

function CheckPickaxe : Boolean;
var tmpser : Cardinal;
begin
Result := true;
if (ObjAtLayer(RhandLayer) = 0) then
begin
tmpser := findtype(pickaxe,backpack);
if tmpser = 0 then
begin
Result := false;
exit;
end;
wait(500);
checksave;
end;
end;

function CheckEnemy : Boolean;
begin
Result := false;
for p:=1 to 5 do
begin
findtype(Enemy[p],ground)
if (findcount > 0) then
begin
Result := true;
Addtosystemjournal('ATAKA');
exit;
end;
wait(100)
checksave;
end;
end;

procedure move;
begin
x:=GetX(self);
y:=GetY(self);
t:=1;
if (GetDirection(self) = 0) then k:= 4;
if (GetDirection(self) = 1) then k:= 5;
if (GetDirection(self) = 2) then k:= 6;
if (GetDirection(self) = 3) then k:= 7;
if (GetDirection(self) = 4) then k:= 0;
if (GetDirection(self) = 5) then k:= 1;
if (GetDirection(self) = 6) then k:= 2;
if (GetDirection(self) = 7) then k:= 3;
repeat
if (ObjAtLayer(RHandLayer) = 0) then equipt(RHandLayer,pickaxe);
ctime:=now;
UseObject(ObjAtLayer(RHandLayer));
WaitForTarget(2000);
If TargetPresent then TargetToTile(0,GetX(self),GetY(self), GetZ(self));
wait(2000);
k := InJournalBetweenTimes('start', ctime, Now);
if (k <> -1) then
begin
if (t = 1) then
begin
Raw_move(GetDirection(self), true);
t:= t+1;
end
else
begin
Raw_move(Random(7), true);
t:=1;
end;
end
else
begin
Raw_move(k, true);
end;
wait(1000);
until (GetX(self) <> x) or (GetY(self) <> y) or dead
end;

function timer(var acttimer:integer;actafter:integer):boolean;
begin
result:=false;
acttimer:=acttimer+1;
if acttimer>=actafter then
begin
acttimer:=0;
result:=true;
end;
end;

procedure Min;
begin
while (connected) do
begin
if (ObjAtLayer(RHandLayer) = 0) then equipt(RHandLayer,pickaxe);
UOSay(' stop')
for x := -2 to 2 do
begin
for y := -2 to 2 do
begin
wait(100);
if weight > (MyMaxWeight) then
begin
wait(1000);
home;
exit;
end;
ctime := Now;
UseObject(ObjAtLayer(RHandLayer));
WaitForTarget(5000);
checksave;
If TargetPresent then TargetToTile(0, GetX(self)+x, GetY(self)+y, GetZ(self));
k:=0
repeat
if (CheckEnemy) then
begin
//uosay('Пора сьебаться')
Raw_move(GetDirection(self), true);
wait(1000);
home;
exit;
end;
checksave;
wait(100);
k:= k+1;
i := InJournalBetweenTimes('stop|anything', ctime, Now);
until (i<>-1) or ( k > 200);
wait(100);
if (ObjAtLayer(RHandLayer) = 0) then
begin
if (not CheckPickaxe) then exit;
equipt(RHandLayer,pickaxe);
end;
end;
end;
if (Moving = 1) then move;
end;
end;

BEGIN
r:=1;
Ruda[1] := $19B9;
Ruda[2] := $0F30;
Ruda[3] := $0F2D;
Ruda[4] := $0F25;
Ruda[5] := $0EED;
Ruda[6] := $0F21;
Ruda[7] := $0F25;
Ruda[8] := $1BE9;
Enemy[1] := $0191;
Enemy[2] := $0190;
Enemy[3] := $0F0D;
Enemy[4] := $0005;
Enemy[5] := $0006;
ignore(self);
finddistance := 20;
if (not dead) then home;
SetARStatus(true);

while true do
begin
while Connected do
begin
if (GetX(self) = Xhome) and not dead then
begin
Addtosystemjournal('DOM');
wait(1000);
uosay('Разгрузка')
MoveItems(backpack, $14ED, $FFFF, trash, 0, 0, 0, 50)
wait(1000);
useobject(sunduk2);
wait(1000);
for k := 1 to 8 do
begin
repeat
findtype(Ruda[k],BackPack);
if (findcount > 0) then MoveItems(backpack, Ruda[k], $FFFF, sunduk2, 0, 0, 0, 50);
wait(100);
checksave;
until findcount = 0;
end;
wait(1000);
useobject(sunduk);
wait(1000);
Hungry(1,sunduk);
wait(1000);
checksave;
findtype($1F4C,sunduk);
if (findcount > 0) then MoveItems(sunduk, $1F4C, $FFFF, RB, 0, 0, 0, 500)
else
begin
Addtosystemjournal('HET RECALLOV');
exit;
end;
wait(1000);
checksave;
MoveItems(Backpack, $1F4C, $FFFF, sunduk, 0, 0, 0, 500);
wait(1000);
checksave;
wait(1000);
if (not CheckPickaxe) then
begin
findtype($0E85,sunduk);
if findcount > 0 then
MoveItem(FindItem, 1, BackPack, 0, 0, 0)
else
Addtosystemjournal('HET KIROK');
checksave;
end;
begin
findtype($0E85,sunduk);
if findcount > 0 then
MoveItem(FindItem, 1, BackPack, 0, 0, 0)
else
Addtosystemjournal('HET KIROK');
checksave;
end;
begin
findtype($0E85,sunduk);
if findcount > 0 then
MoveItem(FindItem, 1, BackPack, 0, 0, 0)
else
Addtosystemjournal('HET KIROK');
checksave;
end;
begin
findtype($0E85,sunduk);
if findcount > 0 then
MoveItem(FindItem, 1, BackPack, 0, 0, 0)
else
Addtosystemjournal('HET KIROK');
checksave;
end;
wait(1000);
disarm;
recall;
end;

if CheckPickaxe and (not dead) then Min
else
begin
if dead then
begin
wait(1000);
uosay('.rescue');
wait(3000);
Addtosystemjournal('IS_DEAD');
home;
end;
end;
end;
wait(100);
end;
END.
нужно переделать, чтоб кирки брал только тогда, когда у него в паке их меньше заданного числа, и реколился домой когда их будет 0.

Скрипт рабочий, тестился на zuluhotel.net
Post Reply