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

Mining по шахтам.

тут можно задать вопрос по скриптингу
Post Reply
burn7
Neophyte
Neophyte
Posts: 22
Joined: 14.12.2011 12:21

Mining по шахтам.

Post by burn7 »

Дорогие дамы и господа! Прошу вашему вниманию скрипт на мининг по шахтам.Проблема данного скрипта в том,что он не реколиться домой при задаммом максимальном весе в 300..Прошу помощи!!!

Code: Select all

program mining;
// ZuluHotel 5
//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 = $5CE089E5; //Sunduk dl9 scroll recall, jarenoy ribi, kirok <Need Setup>
sunduk2 = $5CE089E5; // Sunduk dl9 sbrosa rudi  <Need Setup>
RB = $5AFE8D6B; // Roone book  <Need Setup>
RunaHome = 8; // Nomer runi domoy [1-16] <Need Setup>
Xhome = 4199; // Koordinata X  v dome  <Need Setup>
trash = $5F5DDB49; // pomoyka dl9 sbrosa mapov <Need Setup>
Moving = 1; // esli 1 s hodilkoy, esli drugoe 4islo to bez
MaxWeight = 300;

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] := 9; // Nomera run v RB po shahtam [1-16] <Need Setup>
Runa[2] := 10; //esli netu stolko run prosto povtorit' neskolko odinakovih 
Runa[3] := 12;
Runa[4] := 13;
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('Vragi, suka, ne sp9t!!!');
        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(' ')
    for x := -2 to 2 do
    begin 
        for y := -2 to 2 do
        begin 
        wait(100);
        if (weight > MaxWeight) then
            begin
            wait(300);
            Home;
            exit;
            end;        
        ctime := Now; 
        UseObject(ObjAtLayer(RHandLayer)); 
        WaitForTarget(1000); 
        checksave;
        If TargetPresent then TargetToTile(0, GetX(self)+x, GetY(self)+y, GetZ(self));
            k:=0
            repeat 
            if (CheckEnemy) then
                begin
                uosay('.guards')
                Raw_move(GetDirection(self), true);
                wait(100);
                home;
                exit;
                end;
            checksave;
            wait(100); 
            k:= k+1;
            i := InJournalBetweenTimes('stop|anything', ctime, Now); 
            until (i<>-1) or ( k > 600);
            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('Home, sweet home');
        wait(1000);
        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('KoH4uJIuCb scrool recall');
            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('KoH4uJIuCb Kupku');
                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('y6uJIu!!!');
            home;
            end;
        end;
    end;
wait(100);
end;
END.
Lietman
Novice
Novice
Posts: 74
Joined: 12.12.2010 14:17
Contact:

Re: Mining по шахтам.

Post by Lietman »

Вот исправил. Нельзя называть MaxWeight !

Code: Select all

program mining;
// ZuluHotel 5
//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 = $5CE089E5; //Sunduk dl9 scroll recall, jarenoy ribi, kirok <Need Setup>
sunduk2 = $5CE089E5; // Sunduk dl9 sbrosa rudi  <Need Setup>
RB = $5AFE8D6B; // Roone book  <Need Setup>
RunaHome = 8; // Nomer runi domoy [1-16] <Need Setup>
Xhome = 4199; // Koordinata X  v dome  <Need Setup>
trash = $5F5DDB49; // pomoyka dl9 sbrosa mapov <Need Setup>
Moving = 1; // esli 1 s hodilkoy, esli drugoe 4islo to bez
tonaj = 300;

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] := 9; // Nomera run v RB po shahtam [1-16] <Need Setup>
Runa[2] := 10; //esli netu stolko run prosto povtorit' neskolko odinakovih
Runa[3] := 12;
Runa[4] := 13;
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('Vragi, suka, ne sp9t!!!');
        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(' ')
    for x := -2 to 2 do
    begin
        for y := -2 to 2 do
        begin
        wait(100);
        if (weight > tonaj) then
            begin
            wait(300);
            Home;
            exit;
            end;       
        ctime := Now;
        UseObject(ObjAtLayer(RHandLayer));
        WaitForTarget(1000);
        checksave;
        If TargetPresent then TargetToTile(0, GetX(self)+x, GetY(self)+y, GetZ(self));
            k:=0
            repeat
            if (CheckEnemy) then
                begin
                uosay('.guards')
                Raw_move(GetDirection(self), true);
                wait(100);
                home;
                exit;
                end;
            checksave;
            wait(100);
            k:= k+1;
            i := InJournalBetweenTimes('stop|anything', ctime, Now);
            until (i<>-1) or ( k > 600);
            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('Home, sweet home');
        wait(1000);
        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('KoH4uJIuCb scrool recall');
            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('KoH4uJIuCb Kupku');
                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('y6uJIu!!!');
            home;
            end;
        end;
    end;
wait(100);
end;
END.
Post Reply