Page 1 of 1

Помогите пожалуста со скриптом!

Posted: 21.01.2010 20:08
by Waynecold
Скрипт универсальный на прокачку скилов барда. Сам скрипт собственно:

Code: Select all

Program Universal_02;
const                                 NeedSkillName = 'Taste Identification';  {Copy and Paste}
                        {Begging , Taste Identification , Herding , Peacemaking , Enticement ,
                             Provocation , Cartography , Musicianship}

//==== Scripts for the Bard skills [Universal], Crafted by Mary © for -=New Dream World=- shard.
{
 Коротко о скрипте: Скрипт качает все навыки Барда.

+ Возможности.
 - Скрипт качает все скилы Барда.
 - Автоматом определяет левел Барда и значение "to next".
 - Автоматом устанавливает соответствующие уровню задержи.
 - Чтобы прокачать навык, единственное, что Вам необходимо сделать - это ввести его название
   в строке вверху скрипта...  и все. Других настроек скрипта не требуется. Запускаете скрипт и качаетесь.

+ Особенности.
- Begging. Станьте рядом с любым вендором или наемником, в пределах 5 клеток от него и качаетесь.
- Taste Identification. В паке должны находиться любые Продукты, которые можно "лизнуть", в т.ч. и яд.
- Herding. Особенность такова, что Бард ищет все указанные типы животных на расстоянии 18 клеток и,
  если находит, то "пасет" найденное. Посторонних животных на этаже быть не должно: будет пытаться
  пасти и их. Пастуший посох (крюк) не ломается и должен находиться в паке Барда.
- Peacemaking. Станьте в 1-й клетке от ДЕРЕВЯННОГО большого сундука из любого дерева, в котором
  музыкальные инструменты. Других сундуков, рядом (2-е клетки), быть не должно. Они подбираются Бардом,
  если поломается используемый инструмент. Если сундука нет, играет до тех пор, пока в паке есть на
  чем играть.
- Enticement и Provocation. Качаются раздельно и на одном животном.
  Все, что относится к навыку Herding, действительно и для этих скилов. В случае с Provocation,
  животное провоцируется на самого Барда. Подбор музыкальных инструментов такой же, как и при
  прокачке навыка Peacemaking.
- Cartography. Становитесь возле треша, стопка карт не дальше 2-х клеток от чара. Качаете.
- Musicianship. Игра на музыкальных инструментах, которые находятся в паке Барда.
  Чем больше разных инструментов, тем лучше.
- Еда может находиться в паке Барда, либо не далее 2-х клеток от него.  
}
//==============
type Bard = record
name: String;
value: Extended;
world: Integer;
end;
{$Include 'all.inc'}

var
creature_type : array of Word;
creature_name : array of string;
item_type : array of Word;
chest_type : Word;
Creature : Cardinal;
Item,Chest : Cardinal;
ResultCreature: String;
nameCreature : string;
idCreature,idItem : string;
distanceCreature,ActionDistance : Integer;
life_Creature: Integer;
ct,cn : integer;
it : integer;
a,b,i,e,h,l : Integer;
Bard_Level : Integer;
skill : array [1..8] of Bard;
SummSkill,SummSkill2,ToNext : Extended;
names,items,creatures,item_present,creature_present : Boolean;

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 OpenBox(ObjID:Cardinal);
Var
  flag : boolean;
begin
  flag:=false;
  UseObject(ObjID);
  while (LastContainer<>ObjID) do
     wait(10);
  while (FindType($FFFF,ObjID)=0) do
  begin
     if not flag then
     begin
        flag:=true;
     end;
     wait(10);
  end;
  AddToSystemJournal('The Container is opened.');
end;

procedure GetLevel(SummSkillValue:Extended);
begin
if (SummSkillValue<600) then Bard_Level:=0;
if (SummSkillValue>=600) and (SummSkillValue<720) then Bard_Level:=1;
if (SummSkillValue>=720) and (SummSkillValue<840) then Bard_Level:=2;
if (SummSkillValue>=840) and (SummSkillValue<960) then Bard_Level:=3;
if (SummSkillValue>=960) and (SummSkillValue<1080) then Bard_Level:=4;
if (SummSkillValue>=1080) and (SummSkillValue<1200) then Bard_Level:=5;
if (SummSkillValue=1200) then Bard_Level:=6;
ToNext:=0;
if (Bard_Level = 0) then begin
 ToNext:=600-SummSkillValue;
end else begin
if (Bard_Level = 1) then begin
 ToNext:=720-SummSkillValue;
end else begin
if (Bard_Level = 2) then begin
 ToNext:=840-SummSkillValue;
end else begin
if (Bard_Level = 3) then begin
 ToNext:=960-SummSkillValue;
end else begin
if (Bard_Level = 4) then begin
 ToNext:=1080-SummSkillValue;
end else begin
if (Bard_Level = 5) then begin
 ToNext:=1200-SummSkillValue;
end else begin
if (Bard_Level = 6) then begin
 ToNext:=0;
end;
end;
end;
end;
end;
end;
end;
end;

procedure SetupSkills;
begin
skill[1].name := 'Begging'; skill[1].world := 1; skill[1].value:= GetSkillValue(skill[1].name);
skill[2].name := 'Taste Identification'; skill[2].world := 2; skill[2].value:= GetSkillValue(skill[2].name);
skill[3].name := 'Herding'; skill[3].world := 3; skill[3].value:= GetSkillValue(skill[3].name);
skill[4].name := 'Peacemaking'; skill[4].world := 4; skill[4].value:= GetSkillValue(skill[4].name);
skill[5].name := 'Enticement'; skill[5].world := 5; skill[5].value:= GetSkillValue(skill[5].name);
skill[6].name := 'Provocation'; skill[6].world := 6; skill[6].value:= GetSkillValue(skill[6].name);
skill[7].name := 'Cartography'; skill[7].world := 7; skill[7].value:= GetSkillValue(skill[7].name);
skill[8].name := 'Musicianship'; skill[8].world := 8; skill[8].value:= GetSkillValue(skill[8].name);
SummSkill:= skill[1].value + skill[2].value + skill[3].value + skill[4].value + skill[5].value + skill[6].value + skill[7].value + skill[8].value;
SummSkill2:= Trunc(skill[1].value) + Trunc(skill[2].value) + Trunc(skill[3].value) + Trunc(skill[4].value) + Trunc(skill[5].value) + Trunc(skill[6].value) + Trunc(skill[7].value) + Trunc(skill[8].value);
GetLevel(SummSkill2);
end;

procedure InitWaiting;
begin
if Bard_Level = 0 then Wait(13000);
if Bard_Level = 1 then Wait(10000);
if Bard_Level = 2 then Wait(8000);
if Bard_Level = 3 then Wait(7000);
if Bard_Level = 4 then Wait(6000);
if Bard_Level = 5 then Wait(5000);
if Bard_Level = 6 then Wait(4000);
end;

procedure ressurrect;
begin
if dead then begin
AddToSystemJournal('Dead. Waiting for the resurrection...');
while dead do begin
WaitConnection(3000);
if (WarMode = false) then SetWarMode(true);
checksave;
Wait(1000);
WaitGump('1');
setwarmode(true);
end;
UOSay('Heal');
if targetpresent then canceltarget;
while CountEx($2006,$FFFF,Ground)>0 do begin
if dead then exit;
useobject(findtype($0f51,backpack));
waittargetground($2006);
wait(2000);
if dead then exit;
end;
if dead then exit;
hungry(1,ground);
Wait(500);
UOSay('Thank you.');
if dead then exit;
AddToSystemJournal('Live. Resurrected.');
end;
end;

procedure get_item;
var GetItem:Cardinal;
begin
if item_present=false then begin
 addtosystemjournal('No items found in your backpack.');
 FindDistance:=1;
 chest_type := $0E42;
 FindType(chest_type, Ground);
 if FindCount >0 then begin
 Chest := finditem;
 OpenBox(Chest);
 end else begin addtosystemjournal('Chest is not found.'); wait(10000); end;
 for it:= 0 to (GetArrayLength(item_type) - 1) do begin
 if FindType(item_type[it], Chest) >0 then begin
  GetItem:=FindItem;
  moveitem(GetItem,1,backpack,0,0,0);
 wait(2000);
 addtosystemjournal('Remaining ' + inttostr(FindCount) + ' items such as $' + inttohex(GetType(GetItem),4) + '.');
 end;
 end;
 addtosystemjournal('Items were taken.');
 FindDistance:=ActionDistance;
end;
end;

Procedure HerdThis;
var
atime : TDateTime;
CrookType : Word;
Crook : Cardinal;
begin
CrookType := $E81;
FindType(CrookType, BackPack);
Crook := finditem;
 begin
 atime:=Now;
 if TargetPresent then CancelTarget;
 UseObject(Crook);
 CheckSave;
 WaitTargetObject(Creature);
 WaitJournalLine(Now,'You cant seem|Where do you|I am already', 15000);
 a := InJournalBetweenTimes('You cant seem|I am already', atime, Now);
 b := InJournalBetweenTimes('Where do you', atime, Now);
 if (a >=0) then exit;
 if (b >=0) then begin
  WaitTargetObject(Creature);
  CheckSave;
  wait(10000);
 end;
 end;
end;

function PeaceMan:boolean;
var
atime : TDateTime;
begin
get_item;
atime:=Now;
UseSkill('Peacemaking');
wait(1000);
Checksave;
if TargetPresent = true then CancelTarget;
 a := InJournalBetweenTimes('I am already performing another action', atime, Now);
  if (a>=0) then begin
   Result:=PeaceMan;
  end else begin InitWaiting; end;
end;

Procedure EnticeAction;
var etime :TDateTime;
begin
etime:=Now;
 if TargetPresent then CancelTarget;
 Useskill('Enticement');
 Waittargetobject(Creature);
 CheckSave;
 WaitJournalLine(Now,'seems enticed by the music|Your music doesnt seem|Seems already under influence|I am already', 15000);
 CheckSave;
 a := InJournalBetweenTimes('I am already', etime, Now);
 if (a >=0) then begin
  Wait(1000);
  CheckSave;
  exit;
 end;
 InitWaiting;  
end;

Procedure ProvokeAction;
var ptime :TDateTime;
begin
ptime:=Now;
 if TargetPresent then CancelTarget;
 CheckSave;
 UseSkill('Provocation');
 CheckSave;
 WaitTargetObject(Creature);
 WaitJournalLine(Now,'Select a target to provoke this onto|You enrage|You provoke|I am already', 15000);
 a := InJournalBetweenTimes('You enrage|I am already', ptime, Now);
 b := InJournalBetweenTimes('Select a target to provoke this onto', ptime, Now);
 if (a >=0) then begin
 InitWaiting;
 CheckSave;
 end;
 if (b >=0) then begin
 WaitTargetSelf;
 CheckSave;
 InitWaiting;
 end;
end;

procedure MoveMakedMap;
var TrashType : Word;
Trash: Cardinal;
begin
TrashType := $0E77;
FindType(TrashType, Ground);
Trash := finditem;
while CountEx($14EC,$FFFF,backpack)>0 do begin
Checksave;
MoveItems(BackPack,$14EC,$FFFF,Trash, 0, 0, 0, 1000);
if dead then exit;
end;
end;

function MakeMap:boolean;
var ch: string;
MapTime : TDateTime;
begin
MapTime:=Now;
UseSkill('Cartography');
WaitTargetGround($14EB);
if TargetPresent = true then CancelTarget;
   ch:='(1)';
   if (GetSkillValue('Cartography')>=70) and (GetSkillValue('Cartography')<100) then ch:='(2)';
   if (GetSkillValue('Cartography')>=100) and (GetSkillValue('Cartography')<125) then ch:='(3)';
   if (GetSkillValue('Cartography')>=125) then ch:='(4)';
   AutoMenu('create',ch);  
   WaitJournalLine(Now,'You must wait|You successfully|You are not familiar', 3000);
   a := InJournalBetweenTimes('You must wait', MapTime, Now);
   b := InJournalBetweenTimes('You successfully|You are not familiar', MapTime, Now);
if (a>=0) then begin
   Result:=false;
   Wait(2000);
   exit;
end;
if (b>=0) then begin
   Result:=true;
   Wait(10000);
end;
if timer(e,10) then Addtosystemjournal('Maps: ' + intToStr(CountEx($14EB,$FFFF,Ground)) + '!');
end;

function UseActionToItem:boolean;
var ItTime : TDateTime;
begin
ItTime:=Now;
 UseSkill(NeedSkillName);
 WaitTargetObject(Item);
 wait(1000);
if TargetPresent = true then CancelTarget;
   a := InJournalBetweenTimes('You must wait to perform another action|I am already performing another action', ItTime, Now);
if (a>=0) then begin
   Result:=UseActionToItem;
   Wait(500);
   exit;
end else begin wait(7000); end;
end;

function UseActionToCreature:boolean;
var CrTime : TDateTime;
begin
CrTime:=Now;
 UseSkill(NeedSkillName);
 WaitTargetObject(Creature);
 wait(1000);
if TargetPresent = true then CancelTarget;
   a := InJournalBetweenTimes('You must wait to perform another action|I am already performing another action', CrTime, Now);
if (a>=0) then begin
   Result:=UseActionToCreature;
   Wait(500);
   exit;
end else begin wait(7000); end;
end;

procedure SkillAction(sa:Integer);
Begin
if (sa = 1) then begin
 UseActionToCreature;
 if dead then exit;
end else begin
if (sa = 2) then begin
 UseActionToItem;
 if dead then exit;
end else begin
if (sa = 3) then begin
 HerdThis;
 if dead then exit;
end else begin
if (sa = 4) then begin
 PeaceMan;
 if dead then exit;
end else begin
if (sa = 5) then begin
 EnticeAction;
 if dead then exit;
end else begin
if (sa = 6) then begin
 ProvokeAction;
 if dead then exit;
end else begin
if (sa = 7) then begin
 MakeMap;
 MoveMakedMap;
end else begin
if (sa = 8) then begin
 UseObject(Item);
 wait(1800);
end else begin
 AddToSystemJournal('Script Error.');
 wait(10000);
end;
end;
end;
end;
end;
end;
end;
end;
end;

procedure get_info_from_creatures_with_name;
begin
for cn:= 0 to (GetArrayLength(creature_name) - 1) do begin
if (pos(creature_name[cn], GetName(Creature)) <> 0) then begin
CheckSave;
idCreature :=inttohex(Creature,8);
nameCreature :=GetName(Creature);
distanceCreature :=GetDistance(Creature);
life_Creature := 100 * GetHP(Creature) / GetMaxHP(Creature);
ResultCreature:=inttostr(life_Creature);
addtosystemjournal( + nameCreature + ', $'  + idCreature  + ', Distance: ' + inttostr(distanceCreature) + ', Life: ' +  ResultCreature  +  '%');
wait(100);
Ignore(self);
if dead then exit;
SkillAction(i);
end;
end;
end;

procedure get_info_from_creatures_without_name;
begin
CheckSave;
idCreature :=inttohex(Creature,8);
nameCreature :=GetName(Creature);
distanceCreature :=GetDistance(Creature);
life_Creature := 100 * GetHP(Creature) / GetMaxHP(Creature);
ResultCreature:=inttostr(life_Creature);
addtosystemjournal( + nameCreature + ', $'  + idCreature  + ', Distance: ' + inttostr(distanceCreature) + ', Life: ' +  ResultCreature  +  '%');
wait(100);
Ignore(self);
if dead then exit;
SkillAction(i);
end;

procedure get_info_from_creatures;
begin
creature_present:=false;
for ct:= 0 to (GetArrayLength(creature_type) - 1) do begin
repeat
while FindType(creature_type[ct], ground) <> 0 do begin
if isNPC(FindItem) then begin
creature_present:=true;
Creature:=FindItem;
if (names=true) then get_info_from_creatures_with_name;
if (names=false) then get_info_from_creatures_without_name;
end;
Ignore(Creature);
end;
while not Connected do wait(2000);
until true;
IgnoreReset;
end;
if creature_present=false then begin
addtosystemjournal('No Creature found. Waiting...');
wait(10000);
end;

end;

Function GetItemName(ItemId: Cardinal): string;
var ss: string;
chk: boolean;
ind: integer;
startime: TDateTime;
begin
WaitConnection (3000);
chk:=false;
ind:=0;
while connected and not chk do
begin
if dead then exit;
startime := Now;
ClickOnObject(Item);
repeat
wait(50);
ind:=ind + 1;
if dead then exit;
until (InJournalBetweenTimes('You see:', startime, Now)<>-1) or (ind>=200);
if ind>=200 then ind:=0 else chk:=true;
if chk=true then ind:=LineIndex;
checksave;
end;
ss:=Journal(ind);
result:=Copy(ss, 9, length(ss));
end;

procedure get_info_from_items;
begin
item_present:=false;
for it:= 0 to (GetArrayLength(item_type) - 1) do begin
repeat
if dead then exit;
while FindType(item_type[it], backpack) > 0 do begin
item_present:=true;
if creatures=true then exit;
Item:=FindItem;
CheckSave;
idItem :=inttohex(Item,8);
addtosystemjournal(GetItemName(Item) + ', $'  + idItem  + ', Quantity:' + inttostr(Count(GetType(Item))));
if dead then exit;
SkillAction(i);
wait(100);
Ignore(Item);
end;
until true;
IgnoreReset;
end;
if item_present=false then get_item;
end;

Begin
{--------SET UP WORLD BEGIN------------------------------}
addtosystemjournal('Scripts for the Bard skills [Universal], Crafted by Mary © for -=New Dream World=- shard.');
Setarstatus(true);
OpenBox(BackPack);
SetupSkills;
for i := 1 to 8 do begin
if (skill[i].name = NeedSkillName) then begin
 addtosystemjournal('Uploading the outside world for the skill ' + skill[i].name + ', him value: ' + FloatToStrF(skill[i].value, ffGeneral, 4,1) + '.');
 addtosystemjournal('Summ Skill: ' + FloatToStrF(SummSkill, ffGeneral, 4,1));
 addtosystemjournal('Bard ' + inttostr(Bard_Level) + ' level');
 addtosystemjournal(FloatToStrF(ToNext, ffGeneral, 4,0) + ' to next');
if (skill[i].world  = 1) then begin
 creatures:=true; names:=true; ActionDistance:=5; FindDistance:=ActionDistance;
 creature_type:=[$0191, $0190, $0018, $0032, $0011, $0021, $0055, $002D, $0029, $002A];
 creature_name:=['peacemaker', 'paladin','beggar', 'warrior', 'mage', 'Alchemist', 'Provisioner', 'Bowyer', 'Blacksmith', 'Tinker', 'Carpentner', 'Fisherman', 'butcher', 'Farmer', 'baker', 'LeatherWorker', 'Scribe', 'jeweler', 'Armorer', 'Innkeeper', 'barkeep', 'Plaster Architect', 'Thief', 'LeatherWorker', 'Cartographer', 'Shipwright'];
end else begin
if (skill[i].world  = 2) then begin
 items:=true; ActionDistance:=1; FindDistance:=ActionDistance;
 item_type:=[$0F0A, $1040, $097B, $09E9, $09B7, $0C77, $09EA, $1608];
end else begin
if (skill[i].world  = 3) then begin
 creatures:=true; names:=false; ActionDistance:=18; FindDistance:=ActionDistance;
 creature_type:=[$00D0, $0005, $0006, $00D7, $00CF, $00C8, $00CC, $00E4, $00E2, $00E1, $0034, $00D5, $00CE, $00DC, $00D6,$00DB, $00D2, $0015, $001C, $00EA, $00D8, $00E9, $003E, $003B, $000C, $00DA, $007A, $00E4];
end else begin
if (skill[i].world  = 4) or (skill[i].world  = 8) then begin
 items:=true; ActionDistance:=1; FindDistance:=ActionDistance;
 item_type:=[$0EB4, $0EB3, $0EB2, $0EB1, $0E9D, $0E9C];
end else begin
if (skill[i].world  = 5) or (skill[i].world  = 6) then begin
 creatures:=true; items:=true; names:=false; ActionDistance:=18; FindDistance:=ActionDistance;
 creature_type:=[$00D0, $0005, $0006, $00D7, $00CF, $00C8, $00CC, $00E4, $00E2, $00E1, $0034, $00D5, $00CE, $00DC, $00D6,$00DB, $00D2, $0015, $001C, $00EA, $00D8, $00E9, $003E, $003B, $000C, $00DA, $007A, $00E4];
 item_type:=[$0EB4, $0EB3, $0EB2, $0EB1, $0E9D, $0E9C];
end else begin
if (skill[i].world  = 7) then begin
 items:=false; creatures:=false; ActionDistance:=2; FindDistance:=ActionDistance;
end;
end;
end;
end;
end;
addtosystemjournal('Done.');
end;
{-------SET UP WORLD END-------------------------------}
hungry(1,-1);
while true do begin
ressurrect;
if (WarMode = true) then SetWarMode(false);
WaitConnection(2000);
if timer(h,20) then begin
 FindDistance:=2;
 hungry(1,-1);
 FindDistance:=ActionDistance;
end;
if timer(l,100) then begin
 SetupSkills;
 addtosystemjournal('Skill ' + skill[i].name + ' value now: ' + FloatToStrF(skill[i].value, ffGeneral, 4,1) + '.');
 addtosystemjournal('Bard ' + inttostr(Bard_Level) + ' level');
 addtosystemjournal(FloatToStrF(ToNext, ffGeneral, 4,0) + ' to next');
end;
if (items = true) then get_info_from_items;
if (creatures = true) then get_info_from_creatures;
CheckSave;
if (skill[i].world  = 7) then begin
 SkillAction(7);
end;
end;
end;
end;
End.
При старте выдаёт ошибку:

Code: Select all

19:41:13 [Numb]: Compiling
19:41:13 [Numb]: Compiler: [Error] (Bard Universal.txt at 537:102):  Unknown identifier 'FloatToStrF'
19:41:13 [Numb]: Compiling failed
19:41:13 [Numb]: Script Bard Universal.txt stopped successfuly
Вот эта строчка:

Code: Select all

 addtosystemjournal('Uploading the outside world for the skill ' + skill[i].name + ', him value: ' + FloatToStrF(skill[i].value, ffGeneral, 4,1) + '.');
Удаляя 'FloatToStrF' везде, скрипт начинает работать криво!
Помогите пожалуста! Может проблема в инклюдах??

Posted: 21.01.2010 20:13
by Vizit0r
я бы сказал, что проблема в непоследней версии стелса

Posted: 21.01.2010 20:26
by Waynecold
Действительно проблема была в версии стелса! =) Спасибо за подсказку!
Только вот теперь немогу зайти в окно скилов персонажа... стелс виснет! Что это может быть???

Posted: 21.01.2010 20:37
by Vizit0r
это то, что исправлено в текущей версии, которая дета в феврале будет в релизе.

а пока что:
http://stealth.od.ua/forum/viewtopic.php?t=1271

дрв, да?

Posted: 21.01.2010 20:46
by Waynecold
Vizit0r wrote:дрв, да?
Нет. Astra Telcom. тоже самое что и старый DW!!! ))
Спасибо за помощь Vizit0r!!! Вот только последний вопросец... куда их всовывать?? =))

Posted: 21.01.2010 20:56
by MeLFiS
ваин и как скрипт пашет на том сервере норм ??а фаил кидать в папку со стелсом

Posted: 21.01.2010 21:02
by Waynecold
MeLFiS wrote:ваин и как скрипт пашет на том сервере норм ??а фаил кидать в папку со стелсом
Благодаря Vizit0r скрипт работает теперь нормально!
Спасибо! Файлы кинул в папку со стелсом, но зараза виснет всеравно! Что делать?

Posted: 21.01.2010 21:04
by MeLFiS
перед тем как законектить чара зайди в закладку стелс и поставь галочку Show only nonzero skill

Posted: 21.01.2010 21:06
by Vizit0r
тоже вариант.

либо файлами - подменять оригинальные в папке УО.

Posted: 21.01.2010 21:07
by Waynecold
MeLFiS wrote:перед тем как законектить чара зайди в закладку стелс и поставь галочку Show only nonzero skill
Спасибо большое! Действительно помогло! Теперь растём как бамбук! =)))