Phran6
2009-06-17 00:07:01
sorry if i havnt posted in good section, ill change it if neened
There my script under construction:
note: the settup for smart is at the end of the script
allway when i press play, i get :Smart_Server was undefined, loading: 27(the number change everytime.) then close smart and reopen, with that i cant test single function.
There my script under construction:
note: the settup for smart is at the end of the script
program ArmoredZombiePWONER;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}
Type
ItemInfo = record
Col1 : Integer;
Col2 : Integer;
Tol : Integer;
name : String;
Stack : Boolean;
StackSize : Integer;
ID : TIntegerArray;
Slot : TIntegerArray;
Amount : Integer;
end;
Type
SlotNumb = record
Stack : boolean;
StackSize : integer;
Name : string;
ID : integer;
end;
{-------------GLOBAL VAR---------------}
Var
Slot: array[1..28] of SlotNumb;
IFood, IFalyTaB,IGameNeck: ItemInfo;
WhereWeAre : String;
P_Fally, P_CWToCA, P_Don: TpointArray;
{--------------------------------------}
//=============================SETUP==========================================\\
{}Procedure DeclarePlayers; {}
{}Begin {}
{} HowManyPlayers := 1 ; {}
{} NumberOfPlayers(HowManyPlayers) ; {}
{} CurrentPlayer := 0 ; {}
{} {}
{} Players[0].Name :='' ; {}
{} Players[0].Pass :='' ; {}
{} Players[0].Nick :='' ; {}
{} Players[0].Active:=True ; {}
{} {}
{ Food Information }
{} IFood.Name :='Monkfish' ; //put exact name with capital!!. {}
{} IFood.Col1 := 7369648 ; {}
{} IFood.Col2 := 3754842 ; {}
{} IFood.Tol := 4 ; {}
{} IFood.ID := [7947] ; {}
{} IFood.Stack := False ; {}
{}end; {}
{} {}
{}const {}
{} World = 157 ; {}
{} Signed = false; {}
{} Debug = True; //If Want use debug MASSIVE DEBUG !! WAWA !! {}
{} tab = 9; // Tab of the bank you use thing // {}
//============================================================================\\
Procedure SetInfo;
begin
IFalyTaB.Name := 'Falador teleport' ;
IFalyTaB.Col1 := 11908240 ;
IFalyTaB.Tol := 15 ;
IFalyTaB.ID := [8010] ;
IFalyTaB.Stack := true ;
IGameNeck.Name := 'Games necklace' ;
IGameNeck.Col1 := 11934742 ;
IGameNeck.Tol := 75 ;
IGameNeck.ID := [3868,3866,3864,3862,3860,3858,3856,3854] ; { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
IGameNeck.Stack := false ;
{ Bank Between bank & fally center Fally center }
P_Fally:= [point(2946,3369), point(2950,3376), point(2958,3381), point(2965,3379)]
{ Altar }
P_CWtoCA:= [point(3240,3607), point(3240,3613), point(3237,3623), point(3237,3633),
point(3242,3641), point(3248,3652), point(3254,3658), point(3263,3664),
point(3268,3671), point(3267,3658), point(3251,3662), point(3238,3652),
point(3259,3643), point(3270,3680)];
{ladder }
P_Don:= [point(3241,9991), point(3241,10000), point(3228,10010)];
end;
//////////////////////////////////////////////////////
/// DONT TOUCH UNDER THIS /////
//////////////////////////////////////////////////////
Procedure FHDebug(Texts : string);
begin
If Debug = true then writeln(texts);
end;
Function BoolToString(Bool : Boolean) : String;
begin
if Bool then result := 'True' else result := 'False'
end;
procedure Terminate(Text: String);
begin
WriteLn(Text);
LogOut;
TerminateScript;
end;
Function FH_WalkToTiles(x, y, Randomtile, FFlag : Integer) : Boolean;
var
N : TPoint;
begin
N:=point(x,y);
if TileOnMS(N, 0) then
Result := WalkToTileMs(N, Randomtile, FFlag)
else Result := WalkToTile(N, Randomtile, FFlag);
end;
{function MouseE(x, y, randx, randy: integer ; Uptext, Option: string): Boolean;
begin
if random(3) = 2 then
begin
mmouse(x, y, randx, randy);
wait(10+random(5));
if isuptext(Uptext) then
begin
mouse(x, y, randx, randy, false)
result:=chooseoption(Option);
exit;
end;
end else
begin too lazy to finish it...
end;}
{Function FH_TileBetween(xs, ys, xe, ye:integer; P:Tpointarray): Array Of TPoint;
var
I:integer;
MaxX, MinX, MaxY, MinY:Integer;
begin
MaxX:=Max(xs,xe);
MinX:=Min(xs,xe);
MaxY:=Max(Ys,Ye);
MinY:=Min(Ys,Ye);
For I := 0 to High(P) do
begin
if InRange(p[I].x, minX, maxX) and InRange(p[I].y, minY,MinX ) then
begin
SetLength(result, Length(result) + 1);
result[High(result)] := p[I];
end;
end;
if length(result)=0 then writeln('No Tile Between');
end;}
{*******************************************************************************
function FH_NearestTileFrom(Path: TPointArray; xe,ye: integer): TPoint;
By: originaly,lordsaturn now by me but changed nearesttile to nearesttilefrom
Description: Gets the closest tile in the array from a point.
*******************************************************************************}
function FH_NearestTileFrom(Path: TPointArray; xe,ye: integer): TPoint;
var
i, Hi, dist, mn, index: integer;
begin
Hi := High(Path);
if Hi < 0 then Exit;
mn := Distance(path[0].x, path[0].y, xe, ye)
index := 0;
for i := 1 to Hi do
begin
dist := Distance(Path[I].x, Path[I].y, xe,ye);
if (dist < mn) then
begin
mn := dist;
index := i;
end;
end;
Result := Path[index];
end;
Function FH_FindBestTileToWalk(xe,ye:integer; P:Tpointarray): Tpoint;
var
Gp : tpoint;
Omm : Tpointarray;
I : Integer;
begin
Gp:=GetMyPos;
for I:=0 to High(P) do
begin
if TileOnMM(P[I]) then
begin
SetLength(Omm, Length(Omm) + 1);
Omm[High(Omm)] := P[I];
end;
end;
result:=FH_NearestTileFrom(omm, xe,ye);
end;
Function FindWhereWeAre:boolean;
var
gp : TPoint;
I, II : Integer;
begin
if not LoggedIn then exit;
WhereWeAre:='';
for I:=0 to 4 do
case I Of
0: if DistanceFrom(P_fally[0])<=2 then
begin
WhereWeAre:='InBank';
break;
end;
1: begin
for II:=0 to High(P_fally) do
begin
If TileOnMM(P_fally[II]) then
begin
WhereWeAre:='AtFally';
break;
end;
if WhereWeAre='AtFally' then break;
end;
end;
2: if DistanceFrom(P_CWToCA[0])<=3 then
begin
WhereWeAre:='AtAltar';
break;
end;
3: begin
for II:=0 to High(P_CWToCA) do
begin
If TileOnMM(P_CWToCA[II]) then
begin
WhereWeAre:='OnRoutToDon';
break;
end;
if WhereWeAre='OnRoutToDon' then break;
end;
end;
4: begin
for II:=0 to High(P_Don) do
begin
If TileOnMM(P_Don[II]) then
begin
WhereWeAre:='InDon';
break;
end;
if WhereWeAre='InDon' then break;
end;
end;
end;
if WhereWeAre='' then
begin
gp := GetMyPos;
FHDebug('Our position is = (' +inttostr(gp.x) + ',' + inttostr(gp.y) + ')' );
FHDebug('We are lost');
exit;
end;
FHDebug('we are ' + WhereWeAre);
result:=true;
end;
procedure FH_WithDraw;
var
clicks: array of Integer; // OMFG I LOVE THIS PROCEDURE !!!
click, Hi, I, XX, YY, R, G, B, GA: Integer; // | |
MyTPA, ATPA1:TPointArray; // | |
ATPA : T2DPointArray; // | |
c : TIntegerArray; // /| | |
H, S, L, X, Y, Z: Extended; // / |___| |
MyPoint : TPoint; // / |
// \ ______|
begin // \ |
if not LoggedIn then exit; // \|
if not BankScreen then exit;
wait(random(300));
BankTab(tab);
wait(400+random(300));
FHDebug('Deposit All');
DepositAll;
FHDebug('---------------WITHDRAWING STUFF---------------');
wait(300+random(400));
SetLength(clicks, 3);
for click := 0 to 2 do clicks[click] := click;
for click := 0 to 100 do Swap(clicks[Random(Length(clicks))], clicks[Random(Length(clicks))]);
for click := 0 to 2 do
case clicks[click] of
0:Begin
FHDebug(' ');
FHDebug('Searching For Food(' + IFood.Name + ')');
FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, IFood.Col1,MSX1, MSY1, MSX2, MSY2, IFood.Tol);
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, IFood.Col2,MSX1, MSY1, MSX2, MSY2, IFood.Tol);
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, IFood.Col1,MSX1, MSY1, MSX2, MSY2, IFood.Tol+4);
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(MSCx, MSCy, MyTPA, IFood.Col2,MSX1, MSY1, MSX2, MSY2, IFood.Tol+4);
if Length(MyTPA) = 0 then
begin
CloseBank;
wait(200+random(500));
Terminate('Nothing Match With The Choosen Color Or No More Food In Suplie.');
end;
ATPA := TPAtoATPA(MyTPA, 3);
Hi := High(ATPA);
For I := 0 To Hi Do
begin
MiddleTPAEx(ATPA[i], XX, YY);
MMouse(XX, YY, 3, 3);
Wait(50 + Random(50));
If IsUpText(IFood.Name) Then
begin
FHDebug('Found Food: '+ IFood.Name);
GA:=GetAmount(XX, YY);
FHDebug('Food(' + IFood.Name + ') Left In Bank: ' + inttostr(GA))
GetMousePos(XX, YY);
Mouse(XX, YY, random(2), random(2), false);
wait(300+random(200));
if ChooseOption('Withdraw-X') then
begin
Wait(900 + Random(500));
TypeSend('20');
wait(random(1555));
break;
end;
end;
if I=Hi then
begin
CloseBank;
wait(200+random(500));
Terminate('We Didnt Got Able To Withdraw Food With Choosent Color Or No More Food');
end;
end;
End;
1:Begin
FHDebug(' ');
FHDebug('Searching For: ' +IGameNeck.Name);
FindColorsTolerance(MyTPA, IGameNeck.Col1,MSX1, MSY1, MSX2, MSY2, IGameNeck.Tol);
if Length(MyTPA) = 0 then FindColorsTolerance(MyTPA, IGameNeck.Col1,MSX1, MSY1, MSX2, MSY2, IGameNeck.Tol + 2);
if Length(MyTPA) = 0 then FindColorsTolerance(MyTPA, IGameNeck.Col1,MSX1, MSY1, MSX2, MSY2, IGameNeck.Tol + 4);
if Length(MyTPA) = 0 then
begin
CloseBank;
wait(200+random(500));
Terminate('Nothing Match With The Choosen Color For Games Necklace Or No More Games Necklace Suplie.');
end;
ATPA1 := RearrangeAndShortenArray(MyTPA, 4);
C := GetColors(ATPA1);
Hi := High(ATPA1);
SortTPAFrom(ATPA1, Point(MSCX, MSCY));
for i := 0 to Hi do
begin
ColorToRGB(C[i], R, G, B);
if (R >= 2) and (R <= 23) and (G >= 4) and (G <= 29) and (B >= 41) and (B <= 183) then
begin
ColorToHSL(C[i], H, S, L);
if (H >= 65.70) and (H <= 66.26) and (S >= 77.04) and (S <= 86.80) and (L >= 8.8) and (L <= 40.6) then
begin
ColorToXYZ(C[i], X, Y, Z);
if (X >= 0.48) and (X <= 9.5) and (Y >= 0.26) and (Y <= 4.60) and (Z >= 2.19) and (Z <= 45.82) then
begin
MyPoint := ATPA1[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
Wait(100 + Random(50));
If IsUpText(IGameNeck.Name) Then
begin
FHDebug('Found: '+IGameNeck.Name);
FHDebug('We Have 1 Or More '+ IGameNeck.Name);
GetMousePos(XX, YY);
Mouse(XX, YY, random(4), random(4), true);
wait(random(1555));
break;
end;
end;
end;
if I=Hi then
begin
CloseBank;
wait(200+random(500));
Terminate('We Didnt Got Able To Withdraw '+ IGameNeck.Name +' With Choosent Color Or You Dont Have Suplie.');
end;
end;
end;
end;
2:Begin
FHDebug(' ');
FHDebug('Searching For: ' + IFalyTab.Name );
FindColorsTolerance(MyTPA, IFalyTab.Col1,MSX1, MSY1, MSX2, MSY2, IFalyTab.Tol);
if Length(MyTPA) = 0 then FindColorsTolerance(MyTPA, IFalyTab.Col1,MSX1, MSY1, MSX2, MSY2, IFalyTab.Tol+3);
if Length(MyTPA) = 0 then FindColorsTolerance(MyTPA, IFalyTab.Col1,MSX1, MSY1, MSX2, MSY2, IFalyTab.Tol+6);
if Length(MyTPA) = 0 then
begin
CloseBank;
wait(200+random(500));
Terminate('Nothing Match With The Choosen Color For The Falador Teleport Tab Or No More Suplie.');
end;
ATPA := TPAtoATPA(MyTPA, 2);
Hi := High(ATPA);
For I := 0 To Hi Do
begin
MiddleTPAEx(ATPA[i], XX, YY);
MMouse(XX, YY, 3, 3);
Wait(50 + Random(50));
If IsUpText(IFalyTab.Name) Then
begin
FHDebug('Found: ' +IFalyTab.Name);
GA:=GetAmount(XX, YY);
FHDebug(IFalyTab.Name+' Left: ' + inttostr(GA));
GetMousePos(XX, YY);
Mouse(XX, YY, random(2), random(2), true);
wait(random(1555));
break;
end;
if I=Hi then
begin
CloseBank;
wait(200+random(500));
Terminate('We didnt got able to withdraw Fally TeleTab with choosent color Or You Dont Have More Fally Teletab');
end;
end;
end;
end;
FHDebug('--------WITHDRAWING SUCCEFULLY DONE--------');
FHDebug(' ');
end;
{*******************************************************************************
function RandomizePath(Path: TPointArray; rX, rY: integer): TPointArray;
By: lordsaturn and me , his function wasnt working.
Description: Randomizes a path with max dist rX and rY.
*******************************************************************************}
function FH_RandomizePath(Path: TPointArray; rX, rY: integer): TPointArray;
var
i, Hi: integer;
begin
Hi := High(Path);
if Hi < 0 then Exit;
setlength(result, Hi+1)
for i := 0 to Hi do
result[high(result)]:=RandomizeTile(Path[i], rX, rY);
end;
Function Walks(where:String):boolean;
var
BT: Tpoint;
Trys:integer;
RP_CWToCA: TPointArray;
begin
case Lowercase(where) of
'bank':
begin
FindWhereWeAre;
if lowercase(WhereWeAre) = lowercase('AtFally') then
begin
trys:=0;
repeat
BT:=FH_FindBestTileToWalk(P_fally[0].x, P_fally[0].y, P_fally);
FH_WalkToTiles(BT.x, BT.y, 1, random(9));
inc(trys);
until((DistanceFrom(P_fally[0])<=2) or (trys > 5));
if trys <=5 then
begin
result:=true
FHDebug('We Succefully Arrived To Bank');
exit;
end;
end;
if lowercase(WhereWeAre) = lowercase('InBank') then
begin
result:= true;
FHDebug('We Succefully Arrived To Bank');
exit;
end;
end;
'altar':
begin
FindWhereWeAre;
if lowercase(WhereWeAre) = lowercase('OnRoutToDon') then
begin
RP_CWToCA:=FH_RandomizePath(P_CWToCA, 2, 2);
trys:=0;
repeat
BT:=FH_FindBestTileToWalk(P_CWToCA[0].x, P_CWToCA[0].y, RP_CWToCA);
FH_WalkToTiles(BT.x, BT.y, 0, random(15));
inc(trys);
until((DistanceFrom(P_CWToCA[0])<=3) or (trys > 13));
if trys <=13 then
begin
result:=true
FHDebug('We Succefully Arrived To Altar');
exit;
end;
end;
if lowercase(WhereWeAre) = lowercase('AtAltar') then
begin
result:= true;
FHDebug('We Succefully Arrived To Altar');
exit;
end;
end;
'ladder':
begin
FindWhereWeAre;
if lowercase(WhereWeAre) = lowercase('InDon') then
begin
trys:=0;
repeat
BT:=FH_FindBestTileToWalk(P_Don[0].x, P_Don[0].y, P_Don);
FH_WalkToTiles(BT.x, BT.y, 1, random(9));
inc(trys);
until((DistanceFrom(P_Don[0])<=1) or (trys > 5));
if trys <=5 then
begin
result:=true
FHDebug('We Succefully Arrived To ladder');
exit;
end;
end;
end;
end;
end;
Function Rdy2Go:boolean;
var
GG : integer;
begin
if not LoggedIn then exit;
if (R_InvCount = 22) then
if (R_CountItems(IFood.ID[0]) = 20) then
if (R_CountItems(IFalyTaB.ID[0]) = 1) then
begin
for GG:=0 to 7 do
begin
if (R_CountItems(IGameNeck.ID[GG]) = 1) then
begin
result:=true;
FHDebug('We are ready to go!');
exit;
end;
end;
end;
end;
Procedure CheckupItem;
var
GII : TItemArray;
II, I, SS, Gt : Integer;
Inv : TIntegerArray;
begin
FHDebug('--------------INVENTORY CHECK--------------');
GII:=GetInventoryItemsEx;
For II:= 0 to 27 do
begin
Slot[II+1].ID := GII[II].ID;
Slot[II+1].StackSize := GII[II].Stack;
If GII[II].ID <= 0 then
begin
Slot[II+1].Name := 'Nothing' ;
Slot[II+1].Stack := False;
continue;
end else
If GII[II].ID = IFood.ID[0] then
begin
Slot[II+1].Name := IFood.Name;
Slot[II+1].Stack := IFood.Stack;
continue;
end else
if GII[II].ID = IFalyTaB.ID[0] then
begin
Slot[II+1].Name := IFalyTaB.Name;
Slot[II+1].Stack := IFalyTaB.Stack;
continue;
end else
begin
for i:=0 to 7 do
begin
if GII[II].ID = IGameNeck.ID[i] then
begin
Slot[II+1].Name := IGameNeck.Name;
Slot[II+1].Stack := IGameNeck.Stack;
break;
end;
end;
if Slot[II+1].Name = IGameNeck.Name then continue;
end;
begin
Slot[II+1].Name := 'Unknow';
if GII[II].Stack > 1 then Slot[II+1].Stack := True else Slot[II+1].Stack := False;
end;
end;
For SS := 1 to 28 do
FHDebug('| Slot:' + IntToStr(SS) + ' | Name:' + Slot[SS].Name + ' | ID:' + IntToStr(Slot[SS].ID) + ' | Stack:' + BoolToStr(Slot[SS].Stack) + ' | StackSize:' + IntToStr(Slot[SS].StackSize) + ' |' );
InventoryContains(IFood.ID[0],Inv);
Gt := GetArrayLength(inv);
IFood.Amount := Gt;
IFood.Slot := Inv;
FHDebug('We Have:' + IntToStr(IFood.Amount) + ' Food('+ IFood.Name + ') In Iventory');
FHDebug('-----------INVENTORY CHECK DONE------------');
FHDebug(' ');
end;
Function GameNeckTele: boolean;
var
I,MT : integer;
begin
Gametab(4);
for I:= 0 to 7 do
begin
if R_CountItems(IGameNeck.ID[I]) >= 1 then break;
if I = 7 then
begin
result := false
FHDebug('We Have No Games neclace In Inventory');
exit;
end;
end;
if R_MouseItemID(IGameNeck.ID[I], 'Rub') then
begin
MarkTime(MT);
repeat
wait(123+random(50));
If TimeFromMark(MT) >= 10000 then
begin
FHDebug('Teleport To Clan War Didnt Been Completed Correctly');
exit;
end;
result:=FindNPCChatText('Clan Wars',ClickLeft)
until(result=true);
if result then FHDebug('Teleport To Clan War Succefully Completed');
end;
end;
procedure SmartSetupp;
begin
SMARTSetupEx(world, True, signed, False);
SetupReflection;
Wait(5000);
SetTargetDC(SmartGetDC);
repeat
wait(100);
until(SmartGetColor(253, 233)<>1118604);
end;
procedure PreparingOpening;
begin
SetupSRL;
SmartSetupp;
DeclarePlayers;
LoginPlayer;
SetInfo;
end;
begin
PreparingOpening;
end.
allway when i press play, i get :Smart_Server was undefined, loading: 27(the number change everytime.) then close smart and reopen, with that i cant test single function.