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

Please help me with the script

Ask for help
Post Reply
SMILE
Posts: 4
Joined: 02.10.2012 18:46

Please help me with the script

Post by SMILE »

Translated from Russian by google
Script on buying a car at the moment under the Regi. I can not deal with it please help
const
kolvo = 300; (what's this???)
s_reag = $46DBDC89; (guess it's a chest in which to throw off reagents)
r_home = $45DE7697; (I realized that there is a home rune)
rmax = 3;
b=0;
run=$1F14;
br_bag = $4797F5A2; (I assume that these two ID this backpack and bag with reagents)
r_bag = $476E2E98;

and still produces this error on startup
18:40:45:538 [castme]: Character MaPraPuH Connected.
18:40:51:619 [castme]: Error Include: File Not Exist
18:40:51:620 [castme]: C:\Users\Геннадий\Downloads\Stealth_v4.0.0\Scripts\Include\checkflow.inc (where to find this Fail)
18:40:51:627 [castme]: Compiling
18:40:51:650 [castme]: Compiler: [Error] (7777777777.sc at 60:8): Unknown identifier 'GetAutoBuyMode'
18:40:51:652 [castme]: Compiling failed
18:40:51:654 [castme]: Script 7777777777.sc stopped successfuly

Code: Select all

program autobuy;
{$Include 'all.inc'}
{$Include 'checkflow.inc'}
{$Include 'move.inc'}

const
   kolvo = 300;
   s_reag = $46DBDC89;
   r_home = $45DE7697; 
   rmax = 3;
   b=0;
   run=$1F14;
   br_bag = $4797F5A2;
   r_bag = $476E2E98;

type
buy_rail = array[1..rmax] of Integer;
rune_rail = array[1..30] of Integer;
regs_rail = array[1..3] of Integer;
ven_rail = array[1..2] of Integer;


var
buy : buy_rail;
rune : rune_rail;
rumax, r, oldx, oldy, mark_key : Integer;
r_homes : Cardinal;
Times : TDateTime;

procedure IntRune;
var r : integer;
begin
AddToSystemJournal('Инициализация рун');
UseObject(r_bag);
wait(1000);
 findtype(run,r_bag);
 rumax:=FindCount;
 for r:=1 to rumax do
  begin
     checksave;
  findtype(run,r_bag);
  rune[r]:=FindItem;
  Ignore(FindItem);
 end;
AddToSystemJournal('Инициализированно '+IntToStr(rumax)+' рун');
IgnoreReset;
end;

procedure Intbuy;
begin
AddToSystemJournal('Инициализация покупок');
//buy[1] := $0F7A; //BP
buy[2] := $0F88; //NS
buy[3] := $0E34; //BLS
//buy[4] := $0F7B; //BM
//buy[5] := $0F84; //GA
//buy[6] := $0F85; //GI
//buy[7] := $0F86; //MR
buy[1] := $0F87; //NW
if not GetAutoBuyMode then SetAutoBuyMode(true);
SetAutoBuyDelay(2);
end;

procedure Reags;
var Reg : regs_rail;
i : Integer;
begin
 Reg[1]:=$0F7B;
 Reg[2]:=$0F7A; 
 Reg[3]:=$0F86;
 AddToSystemJournal('Берем реги');
 Useobject(s_reag);
 wait(1000);
 for i:=1 to 3 do
  begin
  findtype(Reg[i],backpack)
  if (FindCount = 0) or (Count(Reg[i]) < 20) then
  begin
  findtype(Reg[i],s_reag);
  if findcount > 0 then
   begin
     checksave;
   MoveItem(FindItem,50,Backpack,0,0,0);
   wait(800);
  end;
 end;
 end;
end;
 
procedure check_mana;
begin
AddToSystemJournal('Проверка маны');
 if Mana < 30 then
  begin
  repeat
   useskill('Meditation');
     checksave;
   wait(5000);
  until Mana = Int;
 end;
end;

procedure vendor_buy;
var ven : ven_rail;
vx,vy,i,z,bs : Integer;
vn : string;
begin
AddToSystemJournal('Ищем вендоров и покупаем');
 ven[1]:=$0190;
 ven[2]:=$0191;
 FindDistance:=5;
 ignore(Self);
 for i:=1 to 2 do
 begin
  findtype(ven[i],ground)
  if FindCount > 0 then
  begin
   for z:=1 to FindCount do
   begin
    FindType(ven[i],ground);
    ClickOnObject(FindItem);
    vx:=GetX(FindItem);
    vy:=GetY(FindItem);
    vn:=GetName(FindItem);
    if (GetDistance(FindItem) > 3) then
    begin
     checksave;
     move(vx, vy, 2);
    end;
    for bs:=1 to rmax do
    begin
     checksave;
     AutoBuy(buy[i],$0000,kolvo);
     UOSay(vn+' buy');
     AutoBuy(buy[i],$0000,0);
     wait(2000);
    end;
   UOSay(vn+' bye');
   Ignore(FindItem);
   wait(1000);
   end;
  end;
 end;
IgnoreReset;
end;

procedure razgruz;
var i,cnt : Integer;
begin
AddToSystemJournal('Разгрузка');
 for i:=1 to rmax do
 begin
  findtype(buy[i],backpack);
  if FindCount > 0 then
  begin
   cnt:=GetQuantity(FindItem);
     checksave;
   moveitem(FindItem,cnt,s_reag,0,0,0);
   wait(800);
  end;
 end;
end;

begin
 AddToSystemJournal('Запуск скрипта');
 Intbuy;
 IntRune;
 r_homes:=r_home;
useobject(r_bag);
wait(1000);
useobject(br_bag);
wait(1000);
 repeat
  Reags;

  findtype(run,r_bag);
  rumax:=FindCount;
  for r:=1 to rumax do
  begin
   oldx:=GetX(Self);
   oldy:=GetY(Self);
   AddToSystemJournal('Прыгаем по руне №'+IntToStr(r));
   repeat
     checksave;
    check_mana;
    cast('Recall');
    WaitForTarget(1500);
    TargetToObject(Rune[r]);
    wait(6000);
   until (oldx <> GetX(Self)) AND (oldy <> GetY(Self));

   ClearJournal;
   wait(500);
   Times:=Now;
   ClickOnObject(Rune[r]);
   wait(4000);
   if (inJournalBetweenTimes('(2 charges)', Times, Now) <> -1) or (inJournalBetweenTimes('(1 charges)', Times, Now) <> -1) then
    begin
    AddToSystemJournal('Ремарк руны №'+IntToStr(r));
    UseObject(br_bag)
    wait(1000);
    findtype(run,br_bag)
    wait(1000);
    moveitem(FindItem,1,Backpack,0,0,0);
    wait(1000);
    repeat
     checksave;
     check_mana;
     FindType(run,backpack);
     cast('Mark');
     WaitForTarget(1500);
     TargetToObject(FindItem);
     wait(10000);
     Times:=Now;
     mark_key:=1;
     if (inJournalBetweenTimes('spell', Times, Now) <> -1) then
     begin
      mark_key:=0;
     end;
    until mark_key=1;
   mark_key:=0;
   DropHere(Rune[r]);
   Rune[r]:=FindItem;
   moveitem(FindItem,1,r_bag,0,0,0);
   wait(800);
   end;
   vendor_buy;
  end;

   oldx:=GetX(Self);
   oldy:=GetY(Self);
   AddToSystemJournal('Летим домой');
   repeat
     checksave;
    check_mana;
    cast('Recall');
    WaitForTarget(1500);
    TargetToObject(r_homes);
    wait(6000);
   until (oldx <> GetX(Self)) AND (oldy <> GetY(Self));
   ClearJournal;
   wait(500);
   Times:=Now;
   ClickOnObject(r_homes);
   wait(2000);
   if (inJournalBetweenTimes('(2 charges)', Times, Now) <> -1) or (inJournalBetweenTimes('(1 charges)', Times, Now) <> -1) then
    begin
    AddToSystemJournal('Ремарк руны домой');
    UseObject(br_bag)
    wait(1000);
    findtype(run,br_bag)
    wait(1000);
    moveitem(FindItem,1,Backpack,0,0,0);
    wait(1000);
    repeat
     checksave;
     check_mana;
     FindType(run,backpack);
     cast('Mark');
     WaitForTarget(1500);
     TargetToObject(FindItem);
     wait(8000);
     Times:=Now;
     mark_key:=1;
     if (inJournalBetweenTimes('spell', Times, Now)  <> -1) then
     begin
      mark_key:=0;
     end;
    until mark_key=1;
   mark_key:=0;
   DropHere(r_homes);
   r_homes:=FindItem;
   wait(800);
   end;
  razgruz;
  wait(1000);
  repeat
   useskill('Hiding');
     checksave;
   wait(5000);
  until Hidden;
  wait(350000);
 until Dead;
End.
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: Please help me with the script

Post by Vizit0r »

Code: Select all

if not GetAutoBuyMode then SetAutoBuyMode(true);
kill this
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
SMILE
Posts: 4
Joined: 02.10.2012 18:46

Re: Please help me with the script

Post by SMILE »

Vizit0r wrote:

Code: Select all

if not GetAutoBuyMode then SetAutoBuyMode(true);
kill this
in the sense of simply erase
Post Reply