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

Подкорректируйте

тут можно задать вопрос по скриптингу
Post Reply
Chepka
Neophyte
Neophyte
Posts: 40
Joined: 04.12.2005 23:19
Contact:

Подкорректируйте

Post by Chepka »

Вобщем скрипт на инскрипт нигде ненашол и решил написать сам, естественно нифига не получилось :lol:
выбивает ошибку на том месте где 2 вейттаргета, к томуже собневаюсь что правильно написал проверку на наличие нужного количества маны, возможно гдето не поставил бегин и енд, ну вроди всё.
Буду очень рад если ктото поможет с этими пробшлемами, а если найдёте ещё чтото исправляйте не стесняйтесь:))

Program Inscription;
var t: Integer;
{$Include 'all.inc'}

Begin
finddistance:=2;
Hungry(1,ground);
while not Dead do
begin
waitconnection(3000);


findtype($0F8C,backpack);
if FindQuantity<100 then
begin
grab(findtype($0F8C,ground),100);
wait(1000);
end;
findtype($0F7A,backpack);
if FindQuantity<100 then
begin
grab(findtype($0F7A,ground),100);
wait(1000);
end;
findtype($0F86,backpack);
if FindQuantity<100 then
begin
grab(findtype($0F86,ground),100);
wait(1000);
end;
if weight>370 then begin
DropHere(findtype($1F60,backpack));
end;

if (Mana > 32) then
WaitTargetObject($5F895D03 $5C430329);
AutoMenu('inscribe 7','Gate Travel');
UseSkill('Inscription');
Wait(8000);
if (Mana < MaxMana) and (not Dead) then
begin
UseSkill('Meditation');
Wait(10000);
end;

end;
Hungry(1,backpack);
checksave;
end;
End.
Miralex
Developer
Developer
Posts: 656
Joined: 11.03.2005 19:12
Contact:

Post by Miralex »

Code: Select all

WaitTargetObject($5F895D03 $5C430329); 
2 ловушки на таргет вешать нельзя.
Первую ловушку вешай сразу, а вторую вешай, когда сервер попросит указать таргетом на вторую цель.

Например так:

Code: Select all

stime := Now;
WaitTargetObject(blank);
CheckSave;
UseSkill('Inscription');

repeat 
CheckSave;
a := InJournalBetweenTimes('spellbook', stime, Now); 
b := InJournalBetweenTimes('already|perform|You can''t inscribe', stime, Now); 
c := InJournalBetweenTimes('you do not have all of this spell''s reagents', stime, Now); 
wait(100); 
until (a >= 0) or (b >= 0) or (c >= 0) or (Now > stime + (1.0/1440)); 

if (b >= 0) or (c >= 0) then Exit;

stime := Now;
WaitTargetObject(SB);
repeat 
CheckSave;
InJournalBetweenTimes('create|fail|reach|already|perform', stime, Now); 
wait(100); 
until (LineCount > 0) or (Now > stime + (1.0/1440)); 
Chepka
Neophyte
Neophyte
Posts: 40
Joined: 04.12.2005 23:19
Contact:

Post by Chepka »

Вроде зделал как ты написал, но дело втом что скрипт через некоторое время слетает:( толи после вордсейва, толи в то время как реги берёт:(
гляньте ктонибуть

Code: Select all

Program Inscription; 
var t: Integer;  
var i : integer; 
var a : integer; 
var b : integer; 
var c : integer; 

stime : TDateTime; 

{$Include 'all.inc'} 

Begin 
finddistance:=2; 
Hungry(1,ground); 
while not Dead do 
 begin 
  waitconnection(3000);
 

findtype($0F8C,backpack); 
if FindQuantity<100 then 
begin 
grab(findtype($0F8C,ground),100); 
wait(1000); 
end; 
findtype($0F7A,backpack); 
if FindQuantity<100 then 
begin 
grab(findtype($0F7A,ground),100); 
wait(1000); 
end; 
findtype($0F86,backpack); 
if FindQuantity<100 then 
begin 
grab(findtype($0F86,ground),100); 
wait(1000); 
end; 
if weight>370 then begin
 DropHere(findtype($1F60,backpack));
end;

if (Mana > 32) then 

stime := Now; 
WaitTargetObject($5F895D03); 
CheckSave; 
UseSkill('Inscription'); 

repeat 
CheckSave; 
a := InJournalBetweenTimes('spellbook', stime, Now); 
b := InJournalBetweenTimes('already|perform|You can''t inscribe', stime, Now); 
c := InJournalBetweenTimes('you do not have all of this spell''s reagents', stime, Now); 
wait(100); 
until (a >= 0) or (b >= 0) or (c >= 0) or (Now > stime + (1.0/1440)); 

if (b >= 0) or (c >= 0) then Exit; 

stime := Now; 
WaitTargetObject($78FF55E1); 
repeat 
CheckSave; 
InJournalBetweenTimes('create|fail|reach|already|perform', stime, Now); 
wait(100); 
until (LineCount > 0) or (Now > stime + (1.0/1440)); 

if (Mana < 32) and (not Dead) then 
    begin 
   UseSkill('Meditation');
  Wait(10000); 
    end; 
 
end; 
Hungry(1,backpack); 
checksave; 
End. 
Miralex
Developer
Developer
Posts: 656
Joined: 11.03.2005 19:12
Contact:

Post by Miralex »

Взяв реагенты ты не дожидаешься момента, когда они дейсвительно окажутся у тебя в бекпаке.
В этом похоже у тебя и проблема.

Подбирать надо примерно так:

Code: Select all

var lastcount : Integer;
      stime : TDateTime;

...................................

lastcount := Count($0F8C);
if (lastcount  < 100) then
begin
if (findtype($0F8C, ground) <> 0) then
    begin
    stime := Now;
    grab(FindItem, 100);    
    repeat 
       wait(500); 
    until (Now > stime + (1.0/1440)) or (Count($0F8C) > lastcount);
    end
else AddToSystemJournal('None regs at ground');
end;
if (Count($0F8C) < 100) then
    begin
    AddToSystemJournal('Low regs!');
    end;
ДяДя Red'я
Posts: 2
Joined: 25.01.2006 22:38

Post by ДяДя Red'я »

Люди выложите полностью скрипт :)
Chepka
Neophyte
Neophyte
Posts: 40
Joined: 04.12.2005 23:19
Contact:

Post by Chepka »

И всёже дело не в этом
после сейв ворда скрипт опятьтаки слетает:(

Program Inscription;
var t: Integer;
var i : integer;
var a : integer;
var b : integer;
var c : integer;
var lastcount : Integer;

stime : TDateTime;

{$Include 'all.inc'}

Begin
finddistance:=2;
Hungry(1,ground);
while not Dead do
begin
waitconnection(3000);


lastcount := Count($0F8C);
if (lastcount < 100) then
begin
if (findtype($0F8C, ground) <> 0) then
begin
stime := Now;
grab(FindItem, 100);
repeat
wait(500);
until (Now > stime + (1.0/1440)) or (Count($0F8C) > lastcount);
end
else AddToSystemJournal('None regs at ground');
end;
if (Count($0F8C) < 100) then
begin
AddToSystemJournal('Low regs!');
end;

lastcount := Count($0F7A);
if (lastcount < 100) then
begin
if (findtype($0F7A, ground) <> 0) then
begin
stime := Now;
grab(FindItem, 100);
repeat
wait(500);
until (Now > stime + (1.0/1440)) or (Count($0F7A) > lastcount);
end
else AddToSystemJournal('None regs at ground');
end;
if (Count($0F7A) < 100) then
begin
AddToSystemJournal('Low regs!');
end;

lastcount := Count($0F86);
if (lastcount < 100) then
begin
if (findtype($0F86, ground) <> 0) then
begin
stime := Now;
grab(FindItem, 100);
repeat
wait(500);
until (Now > stime + (1.0/1440)) or (Count($0F86) > lastcount);
end
else AddToSystemJournal('None regs at ground');
end;
if (Count($0F86) < 100) then
begin
AddToSystemJournal('Low regs!');
end;


if weight>370 then begin
DropHere(findtype($1F60,backpack));
end;

if (Mana > 32) then

stime := Now;
WaitTargetObject($5F895D03);
CheckSave;
UseSkill('Inscription');

repeat
CheckSave;
a := InJournalBetweenTimes('spellbook', stime, Now);
b := InJournalBetweenTimes('already|perform|You can''t inscribe', stime, Now);
c := InJournalBetweenTimes('you do not have all of this spell''s reagents', stime, Now);
wait(100);
until (a >= 0) or (b >= 0) or (c >= 0) or (Now > stime + (1.0/1440));

if (b >= 0) or (c >= 0) then Exit;

stime := Now;
WaitTargetObject($78FF55E1);
repeat
CheckSave;
InJournalBetweenTimes('create|fail|reach|already|perform', stime, Now);
wait(100);
until (LineCount > 0) or (Now > stime + (1.0/1440));

if (Mana < 32) and (not Dead) then
begin
UseSkill('Meditation');
Wait(10000);
end;

end;
Hungry(1,backpack);
checksave;
End.
Miralex
Developer
Developer
Posts: 656
Joined: 11.03.2005 19:12
Contact:

Post by Miralex »

В каком плане "слетает" ?
Пиши подробнее.
Spirit
Neophyte
Neophyte
Posts: 13
Joined: 05.02.2006 19:50
Contact:

Post by Spirit »

Не кидает второй таргет
Miralex
Developer
Developer
Posts: 656
Joined: 11.03.2005 19:12
Contact:

Post by Miralex »

Ф-ции MakeScroll и Meditation не мешало бы сделать отдельными ф-циями.
В ф-ции MakeScroll не помешало бы также сделать "отмену таргета, если он есть".

А дальше смотри на каком участке происходит збой.
Spirit
Neophyte
Neophyte
Posts: 13
Joined: 05.02.2006 19:50
Contact:

Post by Spirit »

Program Inscription;
var
i: Integer;
t: Integer;
a: Integer;
b: Integer;
c: Integer;
blanku: cardinal;
knura: cardinal;
regs : Array[1..3] of word;
stime :TDateTime;

{$Include 'all.inc'}

procedure checkregs;
begin
If Connected then begin
for i:= 1 to 3 do
begin
FindDistance:=1;
Findtype (regs,backpack);
If (FindCount=0) then begin
Findtype(regs,ground);
If (FindCount>0) then begin Grab(finditem,30);end
else AddToSystemJournal('Dai Regov!!!');
end
end
end
end;
{30}
procedure pucovka;
begin
{==================================}
blanku:=$617092B5;
knura:=$61C5FF14;
{==================================}
If (Mana>=50) then begin
stime := Now;
WaitTargetObject(blanku);
AutoMenu('inscribe 8','Resurrection');
CheckSave;
UseSkill('Inscription');
repeat
CheckSave;
a := InJournalBetweenTimes('spellbook', stime, Now);
b := InJournalBetweenTimes('already|perform|You can''t inscribe', stime, Now);
c := InJournalBetweenTimes('you do not have all of this spell''s reagents', stime, Now);
wait(100);
until (a >= 0) or (b >= 0) or (c >= 0) or (Now > stime + (1.0/1440));
if (b >= 0) or (c >= 0) then Exit;
stime := Now;
WaitTargetObject(knura);
repeat
CheckSave;
InJournalBetweenTimes('create|fail|reach|already|perform', stime, Now);
wait(100);
until (LineCount > 0) or (Now > stime + (1.0/1440));
end
end;

Begin
ClearJournal;
SetARStatus(true);
regs[1]:=$0F7B;
regs[2]:=$0F85;
regs[3]:=$0F84;
FindDistance:=1;
While not Dead do
begin
//waitconnection(3000);
If Connected then begin
For t:= 1 to 5 do begin
checkregs;
wait(200);
stime:=Now;
pucovka;
begin
If (Mana<=50) then begin
wait(1000);
While (Mana<Int) do begin
Useskill('Meditation');
repeat
InJournalBetweenTimes('Your mana is full|You lose|You cant focus', stime, Now);
wait(500);
until (LineCount >= 1) or (Now > stime + (1.0/1440));
Hungry(1,ground);
stack($1F67,$0000); {ckudblBaeM rotoBae ckpoJ|bl}
end
If (InJournalBetweenTimes('Your mana is full',stime,now)>=0) then
pucovka; end
else
begin
pucovka;
end
end
end
Hungry(1,ground);
t:=1;
end
wait(2000);
end
End.


Вот переделанный мною скрипт(с Miralex-а примером на два таргета), со скрипта на мэйджери...
Дело идёт так :)...
Юзаеться скил инскрипт, первый таргет кидается на скролы, а потом ничего...
вот что в журнале пишется:
System: What would you like to inscribe?
System: Select a spellbook from which to inscribe.

после этого
already постоянно(скрол делаеться в течении 10 сек, а выйт стоит "...stime + (1.0/...")...

Возможно проблема вот в этом --->> AutoMenu('inscribe 8','Resurrection');
Я уже перепробовал много способов с таргетом... Скорее всего, всё таки с авто меню трабла, но я немогу понять в чём именно, вроде всё так и должно быть...
Miralex
Developer
Developer
Posts: 656
Joined: 11.03.2005 19:12
Contact:

Post by Miralex »

А у тебя 1 менюшка в инскрипте или 2?

Если 2, то сначала, насколько я помню, там указываеться круг, а потом само заклинание. И поэтому будет 2 AutoMenu.
Примерно так:

Code: Select all

AutoMenu('circle','8'); 
AutoMenu('spell','Resurrection'); 
Spirit
Neophyte
Neophyte
Posts: 13
Joined: 05.02.2006 19:50
Contact:

Post by Spirit »

Спасибо Miralex всё заработало :)

Вот весь скрипт, рабочий...
Program Inscription;
var
i: Integer;
t: Integer;
a: Integer;
b: Integer;
c: Integer;
blanku: cardinal;
knura: cardinal;
regs : Array[1..3] of word;
stime :TDateTime;

{$Include 'all.inc'}

procedure checkregs;
begin
If Connected then begin
for i:= 1 to 3 do
begin
FindDistance:=1;
Findtype (regs,backpack);
If (FindCount=0) then begin
Findtype(regs,ground);
If (FindCount>0) then begin Grab(finditem,30);end
else AddToSystemJournal('Dai Regov!!!');
end
end
end
end;

procedure pucovka;
begin
{==================================}
blanku:=$617092B5;
knura:=$61C5FF14;
{==================================}
If (Mana>=50) then begin
stime := Now;
CheckTargetError(2, 2);
WaitTargetObject(blanku);
AutoMenu('circle','8');
AutoMenu('spell','Resurrection');
CheckSave;
UseSkill('Inscription');
repeat
CheckSave;
a := InJournalBetweenTimes('spellbook', stime, Now);
b := InJournalBetweenTimes('already|perform|You can''t inscribe', stime, Now);
c := InJournalBetweenTimes('you do not have all of this spell''s reagents', stime, Now);
wait(100);
until (a >= 0) or (b >= 0) or (c >= 0) or (Now > stime + (1.0/1440));
if (b >= 0) or (c >= 0) then Exit;
stime := Now;
CheckTargetError(2, 2);
WaitTargetObject(knura);
repeat
CheckSave;
InJournalBetweenTimes('create|fail|reach|already|perform', stime, Now);
wait(100);
until (LineCount > 0) or (Now > stime + (1.0/1440));
end
end;

Begin
ClearJournal;
SetARStatus(true);
regs[1]:=$0F7B;
regs[2]:=$0F85;
regs[3]:=$0F84;
FindDistance:=1;
While not Dead do
begin
//waitconnection(3000);
If Connected then begin
For t:= 1 to 5 do begin
checkregs;
wait(200);
stime:=Now;
pucovka;
begin
If (Mana<=50) then begin
wait(1000);
While (Mana<Int) do begin
Useskill('Meditation');
repeat
InJournalBetweenTimes('Your mana is full|You lose|You cant focus', stime, Now);
wait(500);
until (LineCount >= 1) or (Now > stime + (1.0/1440));
Hungry(1,ground);
stack($1F67,$0000);
end
If (InJournalBetweenTimes('Your mana is full',stime,now)>=0) then
pucovka; end
else
begin
pucovka;
end
end
end
Hungry(1,ground);
t:=1;
end
wait(2000);
end
End.

Выставляем ID книги и бланков.
Бланки, книгу, реги, еду рядом с собой и го.
Acronym
Novice
Novice
Posts: 114
Joined: 10.05.2005 18:42
Location: Odessa, NDW
Contact:

Post by Acronym »

Пытался пойти дальше
Диагноз тот же
System: What would you like to inscribe?
System: Select a spellbook from which to inscribe.
Разница в том что не делает даже одного скрола,
I am already performing another action.
тут же перебирает (отметки через AddToSystemJournal) несколько спеллов и виснет дальше с
I am already performing another action.
0:10:21: Select a circle to inscribe: 1
0:10:21: Select a spell to inscribe: Clumsy
0:11:22: Select a circle to inscribe: 1
0:11:22: Select a spell to inscribe: Create Food
0:11:22: Select a circle to inscribe: 1
0:11:22: Select a spell to inscribe: Feeblemind
0:11:23: Select a circle to inscribe: 1
0:11:23: Select a spell to inscribe: Heal
0:11:23: Error with target. Disconnected

Code: Select all

Program Inscription; 
var 
a: Integer; 
b: Integer; 
c: Integer; 
blankscrolls: cardinal; 
spellbook: cardinal; 
CNames : Array[1..8] of String;
CirN : String;
k, j: Integer;
stime :TDateTime; 

{$Include 'all.inc'} 


procedure scribe(CirName, CastName : String); 
begin 
{==================================} 
blankscrolls:=$63E46CDF; 
spellbook:=$551F28B5; 
{==================================} 
If (Mana>=50) then 
	begin 
		stime := Now; 
		CheckTargetError(2, 2); 
		WaitTargetObject(blankscrolls);
		WaitMenu('Select a circle to inscribe','Circle '+CirName+' spells');
		AddToSystemJournal('Select a circle to inscribe: '+CirName);
		WaitMenu('Select a spell to inscribe',CastName);
		AddToSystemJournal('Select a spell to inscribe: '+CastName);
		CheckSave; 
		UseSkill('Inscription'); 
			repeat 
		CheckSave; 
		a := InJournalBetweenTimes('spellbook', stime, Now); 
		b := InJournalBetweenTimes('already|perform|You can''t inscribe', stime, Now); 
		c := InJournalBetweenTimes('you do not have all of this spell''s reagents', stime, Now); 
		wait(100); 
			until (a >= 0) or (b >= 0) or (c >= 0) or (Now > stime + (1.0/1440)); 
		if (b >= 0) or (c >= 0) then 
			Exit; 
		stime := Now; 
		CheckTargetError(2, 2); 
		WaitTargetObject(spellbook); 
			repeat 
		CheckSave; 
		InJournalBetweenTimes('create|fail|reach|already|perform', stime, Now); 
		wait(100); 
			until (LineCount > 0) or (Now > stime + (1.0/1440)); 
	end 
end;

Begin
CNames[1]:='Clumsy';
CNames[2]:='Create Food';
CNames[3]:='Feeblemind';
CNames[4]:='Heal';
CNames[5]:='Magic Arrow';
CNames[6]:='Night Sight';
CNames[7]:='Reactive Armor';
CNames[8]:='Weaken';
ClearJournal; 
SetARStatus(true); 
while not Dead do
		begin
		 for k:= 1 to 8 do
			begin
			CirN:=inttostr(k);
			for j:= 1 to 8 do
				begin
						wait(200);					
						scribe(CirN,CNames[j]); 
						{meditation;}
				 end
			end 
		end 
End. 
Я и так пробовал:

Code: Select all

WaitMenu('Select a circle to inscribe',CirName);
Не могу разобраться где ошибка
Miralex
Developer
Developer
Posts: 656
Joined: 11.03.2005 19:12
Contact:

Post by Miralex »

1. CheckTargetError(2, 2); - ненужен. Он будет только тебе мешать.

2. В "procedure scribe" в самом начале советовал бы отменять существующие таргеты:

Code: Select all

if TargetPresent then CancelTarget;
Здесь же сразу и выставляй нужные ловушки на меню:

Code: Select all

//SpellCircle : Integer;
//SpellName : String;
AutoMenu('circle', IntToStr(SpellCircle));
AutoMenu('spell', SpellName);
Post Reply