Здраствуйте,сразу скажу ,что не соображаю абсолютно ничего в скриптах на стелсе и вообще в скриптах , кроме как понять айдишники ... копаю вашим скриптом,которые переделан категорически на кочки ... хотелось бы что бы копал по скалам .. что нужно в нем изменить ?? вот собссно сам скрипт
Code: Select all
program Mining;
const
IngotsStorage=$411891B6;
IngotsType=$1BF2;
HomeRuneBook=$400AE09A;
HomeRuneIndex=0;
RuneBookShift=5;
MiningType=$0F39;
TinkerType=$1EB8;
TKNumFirst=8;
TKNumSecond=23;
TKMinerNumFirst=8;
TKMinerNumSecond=72;
IronColor=$0000;
IronCount=40;
WaitTime=500;
RecalTime=2000;
WaitCycles=7;
LagWait=10000;
var
CurrentRune:Byte;
CurrentBook,MiningTool,TinkerTool:Integer;
GemTypes,OreTypes,Killers:array of Word;
RuneBooks:array of Cardinal;
cTime,cTime2:TDateTime;
procedure EventMinerGump(Serial, GumpID, X, Y: Cardinal);
begin
if NumGumpButton(GetGumpsCount-1, TKMinerNumSecond) then Exit;
if NumGumpButton(GetGumpsCount-1, TKMinerNumFirst) then Exit;
CloseSimpleGump(GetGumpsCount-1);
end;
procedure EventTinkerGump(Serial, GumpID, X, Y: Cardinal);
begin
if NumGumpButton(GetGumpsCount-1, TKNumSecond) then Exit;
if NumGumpButton(GetGumpsCount-1, TKNumFirst) then Exit;
CloseSimpleGump(GetGumpsCount-1);
end;
function CheckMiningTool: Boolean;
begin
CheckLag(LagWait);
FindType(MiningType, Backpack);
if GetType(MiningTool) <> MiningType then MiningTool := FindItem;
Result := FindCount > 0;
end;
function CheckTinkerTool: Boolean;
begin
CheckLag(LagWait);
FindType(TinkerType, Backpack);
if GetType(TinkerTool) <> TinkerType then TinkerTool := FindItem;
Result := FindCount > 1;
end;
procedure CreateTKTools;
var
Counter: Cardinal;
begin
SetEventProc(evIncomingGump, 'EventTinkerGump');
UseObject(TinkerTool);
Counter := 0;
while True do begin
if (Dead)
or (not Connected)
or (CheckTinkerTool) then begin
SetEventProc(evIncomingGump, '');
Break;
end
else Wait(1000);
Inc(Counter);
if Counter > WaitCycles then begin
SetEventProc(evIncomingGump, '');
Break;
end;
end;
end;
function CreateMiningTools: Boolean;
var
Counter: Cardinal;
begin
SetEventProc(evIncomingGump, 'EventMinerGump');
if not CheckTinkerTool then begin
CreateTKTools;
end;
UseObject(TinkerTool);
Counter := 0;
while True do begin
if (Dead)
or (not Connected)
or (CheckMiningTool) then Break;
Inc(Counter);
if Counter > WaitCycles then Break;
Wait(1000);
end;
SetEventProc(evIncomingGump, '');
CloseSimpleGump(GetGumpsCount-1);
Result := CheckMiningTool;
end;
procedure Move(Item:Array of Word);
var
j:Byte;
begin
CheckLag(LagWait);
CheckLag(LagWait);
for j := 0 to Length(Item)-1 do begin
if Dead or not Connected then Exit;
CheckLag(LagWait);
While (FindType(Item[j], Backpack)>1) do begin
if Dead or not Connected then Exit;
CheckLag(LagWait);
Wait(WaitTime);
MoveItem(Finditem, GetQuantity(Finditem), IngotsStorage, 0, 0, 0);
end;
end;
end;
procedure TakeIngots;
var
Count,CountBox:Word;
begin
FindTypeEx(IngotsType,IronColor,Backpack,false);
Count:=FindQuantity;
if Count<IronCount then begin
CheckLag(LagWait);
Wait(WaitTime);
UseObject(IngotsStorage);
Wait(WaitTime*4);
CheckLag(LagWait);
CountBox:=GetQuantity(FindTypeEx(IngotsType,IronColor,IngotsStorage,false));
if CountBox < IronCount then begin
Disconnect;
Halt;
end;
Grab(finditem,(IronCount-Count));
end;
end;
function RecallRune(RuneBook: Cardinal; Rune: Byte):Boolean;
var
X,Y:Word;
begin
While IsGump do CloseSimpleGump(GetGumpsCount-1);
Result:=False;
X:=GetX(Self);
Y:=GetY(Self);
CheckLag(LagWait);
Wait(WaitTime);
if Dead or not Connected then Exit;
cTime2:=Now;
while (cTime2 < cTime)do begin
cTime2:=Now;
wait(100);
end;
UseObject(RuneBook);
CheckLag(LagWait);
cTime:=Now+0.00008;
if IsGump then begin
if NumGumpButton(GetGumpsCount-1, RuneBookShift + 6*Rune) then begin
CheckLag(LagWait);
Wait(RecalTime);
CheckLag(LagWait);
Result := (X <> GetX(Self)) or (Y <> GetY(Self));
end else Result := False;
end else Result := False;
end;
function GoBase: Boolean;
begin
Result:=RecallRune(HomeRuneBook, HomeRuneIndex);
end;
function NextRune: Boolean;
var
Counter:Cardinal;
begin
if CurrentRune > 15 then begin
CurrentRune := 0
Inc(CurrentBook);
if CurrentBook >= Length(RuneBooks) then CurrentBook := 0;
end;
for Counter := 0 to WaitCycles do begin
if Dead or not Connected then Exit;
Result := RecallRune(RuneBooks[CurrentBook], CurrentRune);
if Result then Break;
Result := RecallRune(RuneBooks[CurrentBook], CurrentRune);
if Result then Break;
GoBase;
Wait(10000);
end;
end;
procedure CheckState;
begin
if MaxWeight < Weight + 60 then begin
while True do begin
if Dead or not Connected then Exit;
if GoBase() then Break;
if not RecallRune(RuneBooks[CurrentBook], CurrentRune) then Wait(10000);
end;
Move(OreTypes);
Move(GemTypes);
TakeIngots;
while True do begin
if Dead or not Connected then Exit;
if RecallRune(RuneBooks[CurrentBook], CurrentRune) then Break;
if GoBase() then Continue;
if not NextRune then Wait(10000);
end;
end;
end;
function CheckPK: boolean;
var
i,q:integer;
begin
FindDistance:=25;
for q:=0 to high(Killers) do
for i:=3 to 6 do
if FindNotoriety(Killers[q],i)>0 then begin
Result:=True;
AddToSystemJournal('Пришел плохой дядя - ' + GetName(FindItem));
AddToSystemJournal('Runebook # '+IntToStr(CurrentBook+1));
AddToSystemJournal('Rune # '+IntToStr(CurrentRune+1));
FindDistance:=2;
Exit;
end;
FindDistance:=2;
end;
procedure Heal();
begin
if Poisoned then
begin
WaitTargetSelf;
Cast('Cure');
Wait(2500);
end;
if GetHP(Self) < GetMaxHP(self) then
begin
Waittargetself();
Cast('Greater Heal');
Wait(2500);
end;
end;
function GetFoundItems(var Items: Array Of Cardinal): Integer;
var List: TStringList; i: Integer;
begin
List := TStringList.Create;
if GetFindedList(List) = False then Result := 0
else begin
SetLength(Items, List.Count);
for i := 0 to Length(Items)-1 do Items[i] := StrToInt('$'+List.Strings[i]);
Result := Length(Items);
end;
List.Free;
end;
procedure CombineOre;
var
CombineTypes : Array of Word;
i,k : Integer;
fItems : Array of Cardinal;
//fItem : Cardinal;
begin
CombineTypes := [$19B9, $19BA, $19B8];
for i := 0 to Length(CombineTypes)-1 do
begin
FindType(CombineTypes[i], Backpack);
if GetFoundItems(fItems) > 0 then
for k := 0 to Length(fItems)-1 do
begin
UseObject(fItems[k]);
if WaitForTarget(60000) then
TargetToObject(FindTypeEx($19B7, GetColor(fItems[k]), Backpack, True));
Wait(500);
end;
end;
end;
procedure Mine(X, Y: Integer);
var
//Tile:Word;
Z:ShortInt;
Counter:Byte;
StartTime:TDateTime;
begin
CheckState;
While IsGump do CloseSimpleGump(GetGumpsCount-1);
while True do begin
if Dead or not Connected then Exit;
if TargetPresent then CancelTarget;
CheckLag(LagWait);
Wait(WaitTime);
while not CheckMiningTool do begin
if Dead or not Connected then Exit;
CreateMiningTools;
While IsGump do CloseSimpleGump(GetGumpsCount-1);
end;
//Heal;
if Weight > (MaxWeight - 100) then CombineOre;
UseObject(MiningTool);
CheckLag(LagWait);
WaitForTarget(LagWait);
if TargetPresent then begin
StartTime := Now;
Z:=GetZ(self);
TargetToXYZ(X, Y, Z);
Counter:=WaitCycles;
CheckLag(LagWait);
if InJournalBetweenTimes('t mine there|is too far away|cannot be seen|is no metal here to mine|attacking', StartTime, Now) > 0 then
Exit;
Wait(200);
Dec(Counter);
CheckState;
if (CheckPK) or (Hp < (MaxHp-10)) then begin
cTime:=Now-0.00008;
GoBase;
Inc(CurrentRune);
Wait(WaitTime*100);
RecallRune(RuneBooks[CurrentBook], CurrentRune);
CheckLag(LagWait);
Heal();
Wait(WaitTime);
end;
end;
end;
end;
procedure MinePoint;
var
X, Y: Word;
begin
X:=GetX(Self);
Y:=GetY(Self);
Mine(X,Y);
Inc(CurrentRune);
end;
procedure OnSpeech(Text, SenderName : String; SenderID : Cardinal);
begin
if Text = 'attacking you' then
begin
GoBase;
Inc(CurrentRune);
Wait(WaitTime*100);
RecallRune(RuneBooks[CurrentBook], CurrentRune);
CheckLag(LagWait);
Wait(WaitTime);
end;
end;
begin
AddGumpIgnoreByID($F22EE4C6);
SetEventProc(evUnicodeSpeech, 'OnSpeech');
SetEventProc(evIncomingGump, '');
if not Connected() then begin
Connect();
Wait(10000);
end;
While IsGump do CloseSimpleGump(GetGumpsCount-1);
cTime:=Now;
RuneBooks:=[$40A43658,$4017DD46]; //,$40746136
OreTypes:=[$19B7,$19B8,$19B9,$19BA];
GemTypes:=[$3192,$3193,$3194,$3195,$3197,$3198,
$0F26,$0F13,$0F10,$0F19,$0F21,$0F16,$0F15,$0F25,$0F2D];
Killers:=[$0190,$0191,$025E,$025D,$0011];
CurrentBook:=0;
CurrentRune:=0;
while True do begin
if Dead then begin
AddToSystemJournal('You Dead.');
AddToSystemJournal('Runebook # '+IntToStr(CurrentBook+1));
AddToSystemJournal('Rune # '+IntToStr(CurrentRune+1));
Halt;
end;
if not Connected then begin
Connect;
Wait(10000);
Continue;
end;
NextRune;
MinePoint;
end;
end.