since reflection is not getting into the real base of srl, i had this crappy idee to have an update system, so a new srl doesn't have to be release when reflection is only outdated.
like I said it's crap, but maybe usefull?
//------------------------------------------------------------------\\
//-- Scar Non-Standard Resource Library --||
//-- » Reflection Routines --||
//------------------------------------------------------------------//
// * Procedure SetupReflection; // * by MasterKill
// * Function GetLevel(index: integer): integer; // * by BenLand100
// * Function StringFromBytes(jbytearray: integer): string; // * by BenLand100
// * Function GetMyName: string; // * by BenLand100
// * Function GetAnimation: integer; // * by BenLand100
// * Function GetSpeed: integer; // * by Widget
// * Function CharacterMoving: boolean; // * by BenLand100
// * Procedure GetMyPos(var x, y: Integer); // * by BenLand100
// * Function GetBoxAnswer: integer; // * by BenLand100
// * Function GetMinimapAngleDeg: extended; // * by BenLand100
// * Function GetMinimapAngleRad: extended; // * by BenLand100
// * Procedure TileToMinimap(tileX, tileY: integer; var screenX, // * by BenLand100
// screenY: integer); // º
// * Procedure MinimapToTile(screenX, screenY: integer; var tileX, // * by BenLand100
// tileY: integer); // º
// * Procedure TileToMS(tileX, tileY, height: integer; // * by BenLand100
// var screenX, screenY: integer); // º
// * Function TileOnMM(TileX, TileY : Integer) : Boolean; // * by ss23
// * Function TileOnMS(TileX, TileY, Height : Integer) : Boolean; // * by ss23
// * Function DistanceFrom(TileX, TileY: Integer) : Integer; // * by Widget
// * Function GetNPCs: array of TNPC; // * by Widget
// * Function GetNPCsByName: array of TNPC; // * by Widget
// * Function GetNPCsByID: array of TNPC; // * by Widget
// * Function SortNPCs(NPCs: array of TNPC): array of TNPC; // * by Widget
// * Function FindNPC(Name: string): TNPC; // * by Widget
// * Function FindNPCByID(ID: integer): TNPC; // * by Widget
// * Function ClickTile(TileX, TileY, Height : Integer; // * by ss23 and Widget
// Left : Boolean) : Boolean; // º
// * Function WalkToTile(Tilex, Tiley : Integer): Boolean; // * by ss23 and Widget
// * Function WalkToTileTol(TileX, TileY, Tol : Integer): Boolean; // * by ss23, Widget and TheGuyWhoGotOn
// * Function LongWalkEx(TileX, TileY, DisX, DisY, // * by TheGuyWhoGotOn
// Tol : integer): Boolean; // º
// * Function LongWalk(TileX, TileY, Tol : integer): Boolean; // * by TheGuyWhoGotOn
// * Function PathWalk(Path : array of TPoint; Long : boolean; // * by TheGuyWhoGotOn
// Tol : integer): Boolean; // º
// * Function MMtoMS(x, y: Integer; left: Boolean): Boolean; // * by LeeLokHin
// * Function OpenBankReflection(Bank : String): Boolean; // * by ss23 and TheGuyWhoGotOn
// * Function GetPlayers: array of TPlayer; // * by Widget
//------------------------------------------------------------------//
// NPC stuff completely re-written
//
// TPlayer not used yet but eventually I'll stop being lazy -Widget
//
// Thanks to Speljohan and Quaters for making hooks that we can steal =)
//------------------------------------------------------------------//
type
TNPC = record
TileX, TileY, MSX, MSY, NPCType, height : integer;
Name : string;
InFight, IsMoving: boolean;
end;
TPlayer = record
x, y:integer;
animation, speed: integer;
HPRatio, height, level: integer;
Name: string;
Levels, Experiences: array[1..24]{or whatever} of integer;
end;
Var
BaseLayer, BaseX, BaseY, CamX, CamY, CamZ, CamPitch, CamYaw,
CompassAngle, CurrentLevels, Experiences, FlagX, FlagY, GroundHeights,
GroundSettings, LoopCycle, MapOffSetAngle, MaxLevels, MyPlayer,
NPCArray, NPCCount, NPCIndexArray, PlayerArray, PlayerCount,
PlayerIndArray, SettingsArray, CharAnim, CharMotion, CurrentX, CurrentY, CharHeight, LoopCycleStatus,
CharName, NPCDef, GetNPCName, GetNPCType, StringBytes: String;
//----------------------------------------------------------------------//
// fucntion explode my by: A G E N T 83
function Explode(Delimiter : string; Str : string) : array of string;
var
DelimPos, i : integer;
Arr1 : array of string;
begin
SetArrayLength(Arr1, 100000);
i := 0;
repeat
if (pos(Delimiter, Str) = 0) then Break;
DelimPos := pos(Delimiter, Str);
Arr1[i] := Replace((copy(Str,0,DelimPos)),Delimiter,'');
Delete(Str,1,DelimPos);
i := i + 1;
until(pos(Delimiter, Str) = 0);
Arr1[i] := Str;
SetArrayLength(Arr1, i+1);
Result := Arr1;
end;
{*******************************************************************
Procedure SetupReflection;
By: MasterKill
Description: Loads RS hooks from an text file
********************************************************************}
Procedure SetupReflection;
Var
HooksPage: String;
Hook: TStringArray;
StartTime: Integer;
Begin
StartTime := GetSystemTime;
HooksPage := GetPage('http://www.freewebs.com/srlfiles/hooks.txt');
Hook := Explode(',', HooksPage);
BaseLayer := Hook[0];
BaseX := Hook[1];
BaseY := Hook[2];
CamX := Hook[3];
CamY := Hook[4];
CamZ := Hook[5];
CamPitch := Hook[6];
CamYaw := Hook[7];
CompassAngle := Hook[8];
CurrentLevels := Hook[9];
Experiences := Hook[10];
FlagX := Hook[11];
FlagY := Hook[12];
GroundHeights := Hook[13];
GroundSettings := Hook[14];
LoopCycle := Hook[15];
MapOffsetAngle := Hook[16];
MaxLevels := Hook[17];
MyPlayer := Hook[18];
NPCArray := Hook[19];
NPCCount := Hook[20];
NPCIndexArray := Hook[21];
PlayerArray := Hook[22];
PlayerCount := Hook[23];
PlayerIndArray := Hook[24];
SettingsArray := Hook[25];
CharAnim := Hook[26];
CharMotion := Hook[27];
CurrentX := Hook[28];
CurrentY := Hook[29];
CharHeight := Hook[30];
LoopCycleStatus:= Hook[31];
CharName := Hook[32];
NPCDef := Hook[33];
GetNPCName := Hook[34];
GetNPCType := Hook[35];
StringBytes := Hook[36];
WriteLn('Setting up reflection took ' + IntToStr(GetSystemTime - StartTime) + ' ms.');
End;
function GetLevel(index: integer): integer;
{*******************************************************************
Function - GetLevel(index: integer): integer;
By: BenLand100
Description: Returns the current level of your player (its a funny array)
********************************************************************}
begin
result:= SmartGetFieldArrayInt(0,CurrentLevels,index);
end;
function StringFromBytes(jbytearray: integer): string;
{*******************************************************************
Function - StringFromBytes(jbytearray: integer): string;
By: BenLand100
Description: Converts a byte[] from StringWrap to a DelphiString
(max length 256)
********************************************************************}
begin
SetLength(result, 256);
SetLength(result, SmartStringFromBytes(jbytearray,result));
end;
function GetMyName: string;
{*******************************************************************
Function - GetMyName: string;
By: BenLand100
Description: Returns last logged in player's name
********************************************************************}
var
bytes: Integer;
begin
bytes:= SmartGetFieldObject(0,MyPlayer+'.'+CharName+'.'+StringBytes);
result:= StringFromBytes(bytes);
SmartFreeObject(bytes);
end;
function GetAnimation: integer;
{*******************************************************************
Function - GetAnimation: integer;
By: BenLand100
Description: Returns your animation
********************************************************************}
begin
result:= SmartGetFieldInt(0,MyPlayer+'.'+CharAnim);
end;
function GetSpeed: integer; // :)
{*******************************************************************
Function - GetSpeed: integer;
By: Widget
Description: Gets character speed (squares per second)
********************************************************************}
begin
result:= SmartGetFieldInt(0,MyPlayer+'.'+CharMotion);
end;
function CharacterMoving: boolean; //:)
{*******************************************************************
Function - CharacterMoving: boolean;
By: BenLand100
Description: True if you are moving
********************************************************************}
begin
result:= (GetSpeed > 0);
end;
procedure GetMyPos(var x, y: Integer); // :)
{*******************************************************************
procedure - GetMyPos(var x, y: Integer);
By: BenLand100
Description: Calculates your x,y position or [somehugenumber] if not
logged in
********************************************************************}
var
me: Integer;
begin
me:= SmartGetFieldObject(0,MyPlayer);
x:= SmartGetFieldInt(0,BaseX) + SmartGetFieldInt(me,CurrentX) shr 7;
y:= SmartGetFieldInt(0,BaseY) + SmartGetFieldInt(me,CurrentY) shr 7;
SmartFreeObject(me);
end;
function DumpSettingArray: array[0..1999] of integer;
{*******************************************************************
function - DumpSettingArray: array[0..1999] of integer;
By: BenLand100
Description: Dumps the settings array to an integer array
********************************************************************}
var
i: integer;
begin
for i:= 0 to 1999 do
Result[i]:= SmartGetFieldArrayInt(0,SettingsArray,i);
end;
function GetBoxAnswer: integer;
{*******************************************************************
function - GetBoxAnswer: integer;
By: BenLand100
Description: Returns -1 if no box open or 0..2 for the correct
answer to the box
Comments: Yet another reason reflection is leet =) -Widget
********************************************************************}
var
boxIndex: Integer;
begin
boxIndex:= SmartGetFieldArrayInt(0,SettingsArray,312);
if boxIndex = 0 then
result:= -1
else
result:= (boxIndex shr 24) and $FF;
end;
function GetMinimapAngleDeg: extended;
{*******************************************************************
function - GetMinimapAngleDeg: extended;
By: BenLand100
Description: Returns the current Map angle in degrees
********************************************************************}
var
clientAngle: integer;
begin
clientAngle:= (SmartGetFieldInt(0,CompassAngle) + SmartGetFieldInt(0,MapOffsetAngle)) mod 2048;
result:= clientAngle * 180 / 1024;
end;
function GetMinimapAngleRad: extended;
{*******************************************************************
function - GetMinimapAngleRad: extended;
By: BenLand100
Description: Returns the current map angle in radians
********************************************************************}
var
clientAngle: integer;
begin
clientAngle:= (SmartGetFieldInt(0,CompassAngle) + SmartGetFieldInt(0,MapOffsetAngle)) mod 2048;
result:= clientAngle * Pi / 1024;
end;
procedure TileToMinimap(tileX, tileY: integer; var screenX, screenY: integer);
{*******************************************************************
procedure - TileToMinimap(tileX, tileY: integer; var screenX, screenY: integer);
By: BenLand100
Description: Converts the tile position tileX,tileY to a minimap location
********************************************************************}
var
angle: extended;
tempX, tempY: integer;
begin
angle:= getMinimapAngleRad;
GetMyPos(tempX, tempY);
tempX:= (tileX - tempX) * 4 - 2;
tempY:= (tempY - tileY) * 4 - 2;
screenX:= round(tempX*cos(angle) - tempY*sin(angle)) + 629;
screenY:= round(tempX*sin(angle) + tempY*cos(angle)) + 85;
end;
procedure MinimapToTile(screenX, screenY: integer; var tileX, tileY: integer);
{*******************************************************************
procedure - MinimapToTile(screenX, screenY: integer; var tileX, tileY: integer);
By: BenLand100
Description: converts the screen position screenX,screenY from the minimap
to a tile
********************************************************************}
var
angle: extended;
tempX, tempY: integer;
begin
angle:= getMinimapAngleRad;
tempX:= (screenX - 643);
tempY:= (84 - screenY);
tileX:= round(tempX*cos(angle) - tempY*sin(angle)) / 4;
tileY:= round(tempX*sin(angle) + tempY*cos(angle)) / 4;
GetMyPos(tempX, tempY);
tileX:= tileX + tempX;
tileY:= tileY + tempY;
end;
procedure TileToMS(tileX, tileY, height: integer; var screenX, screenY: integer);
{*******************************************************************
procedure - TileToMS(tileX, tileY, height: integer; var screenX, screenY: integer);
By: BenLand100
Description: Converts the tile position tileX,tileY to a mainscreen location
Height is the distance (in px) above the ground
********************************************************************}
var
cx, cy, cz, dx, dy, dz, locX, locY, layer: Integer;
pitch, yaw, sinYaw, cosYaw, sinPitch, cosPitch, rotation: extended;
begin
locX:= tileX - SmartGetFieldInt(0,BaseX);
locY:= tileY - SmartGetFieldInt(0,BaseY);
if (locX < 0) or (locY < 0) or (locX > 103) or (locY > 103) then
Exit;
layer:= SmartGetFieldInt(0,BaseLayer);
if (layer < 3) and ((2 and SmartGetFieldArray3DByte(0,GroundSettings,1,locX,locY)) = 2) then
Inc(layer);
cz:= SmartGetFieldArray3DInt(0,GroundHeights,layer,locX,locY) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX+1,locY) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX,locY+1) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX+1,locY+1);
cx:= locX * 128 + 64 - SmartGetFieldInt(0,CamX);
cy:= locY * 128 + 64 - SmartGetFieldInt(0,CamY);
cz:= (cz / 4) - height - SmartGetFieldInt(0,CamZ);
pitch:= SmartGetFieldInt(0,CamPitch) * Pi / 1024;
yaw:= SmartGetFieldInt(0,CamYaw) * Pi / 1024;
sinYaw:= sin(yaw);
cosYaw:= cos(yaw);
sinPitch:= sin(pitch);
cosPitch:= cos(pitch);
rotation:= cosYaw*cy-sinYaw*cx;
dx:= Round(sinYaw*cy+cosYaw*cx);
dy:= Round(sinPitch*cz+cosPitch*rotation);
dz:= Round(cosPitch*cz-sinPitch*rotation);
screenX:= (dx * 512) / dy + 256;
screenY:= (dz * 512) / dy + 167;
end;
Function TileOnMM(TileX, TileY : Integer) : Boolean;
{*******************************************************************
Function TileOnMM(TileX, TileY : Integer) : Boolean;
By: ss23
Description: True = Tile on MM
********************************************************************}
Var
PointEx : TPoint;
BoxEx : TBox;
Begin
BoxEx := IntToBox(MMX1, MMY1, MMX2, MMY2);
TileToMinimap(TileX, TileY, PointEx.x, PointEx.y);
Result := PointInBox(PointEx, BoxEx);
end;
Function TileOnMS(TileX, TileY, Height : Integer) : Boolean;
{*******************************************************************
Function TileOnMS(TileX, TileY, Height : Integer) : Boolean;
By: ss23
Description: True = Tile on MS
********************************************************************}
Var
PointEx : TPoint;
BoxEx : TBox;
Begin
BoxEx := IntToBox(MSX1, MSY1, MSX2, MSY2);
TileToMS(Tilex, Tiley, Height, pointex.x, pointex.y);
Result := PointInBox(PointEx, BoxEx);
end;
Function DistanceFrom(TileX, TileY: Integer) : Integer;
{*******************************************************************
Function DistanceFrom(TileX, TileY: Integer) : Integer;
By: Widget
Description: Returns the distance between your player and the tile
********************************************************************}
Var
MyX,MyY : integer;
Begin
GetMyPos(MyX, MyY);
result := Distance(TileX, TileY, MyX, MyY);
end;
function GetNPCs:array of TNPC;
{*******************************************************************
function GetNPCs:array of TNPC;
By: Widget
Description: Returns all the currently loaded NPCs
********************************************************************}
var
i,NumNPCs,Index,TheNPC,TheNPCDef,TheBytes: integer;
begin
NumNPCs := SmartGetFieldInt(0,NPCCount);
if (NumNPCs=0) then Exit;
SetArrayLength(Result,NumNPCs);
for i := 0 to (NumNPCs-1) do
begin
Index := SmartGetFieldArrayInt(0,NPCIndexArray,i);
TheNPC := SmartGetFieldArrayObject(0,NPCArray,Index);
TheNPCDef := SmartGetFieldObject(TheNPC,NPCDef);
TheBytes := SmartGetFieldObject(TheNPCDef,GetNPCName+'.'+StringBytes);
Result[i].Name := StringFromBytes(TheBytes);
Result[i].TileX := (SmartGetFieldInt(0, BaseX) + (SmartGetFieldInt(TheNPC, CurrentX) shr 7));
Result[i].TileY := (SmartGetFieldInt(0, BaseY) + (SmartGetFieldInt(TheNPC, CurrentY) shr 7));
Result[i].NPCType := SmartGetFieldInt(TheNPCDef,GetNPCType);
Result[i].Height := iabs(SmartGetFieldInt(TheNPC,CharHeight));
Result[i].InFight := (SmartGetFieldInt(0,LoopCycle)<SmartGetFieldInt(TheNPC,LoopCycleStatus));
Result[i].IsMoving := (SmartGetFieldInt(TheNPC,CharMotion)>0);
if TileOnMS(Result[i].TileX, Result[i].TileY, Result[i].Height * 2 / 3) then
TileToMS(Result[i].TileX, Result[i].TileY, Result[i].Height * 2 / 3, Result[i].MSX, Result[i].MSY);
SmartFreeObject(TheNPC);
SmartFreeObject(TheNPCDef);
SmartFreeObject(TheBytes);
end;
end;
function GetNPCsByName(name:string):array of TNPC;
{*******************************************************************
Function GetNPCsByName(name:string):array of TNPC;
By: Widget
Description: Returns NPCs matching the name.
********************************************************************}
var
i: integer;
NPCs: array of TNPC;
begin
NPCs := GetNPCs;
if (GetArrayLength(NPCs)=0) then Exit;
for i := 0 to High(NPCs) do
if (pos(trim(name),trim(NPCs[i].Name))>0) then
begin
SetArrayLength(result,GetArrayLength(result)+1);
result[GetArrayLength(result)-1] := NPCs[i];
end;
end;
function GetNPCsByID(TheType:integer):array of TNPC;
{*******************************************************************
Function GetNPCsByID(TheType:integer):array of TNPC;
By: Widget
Description: Returns NPCs matching the ID.
********************************************************************}
var
i: integer;
NPCs: array of TNPC;
begin
NPCs := GetNPCs;
if (GetArrayLength(NPCs)=0) then Exit;
for i := 0 to High(NPCs) do
if (NPCs[i].NPCType=TheType) then
begin
SetArrayLength(result,GetArrayLength(result)+1);
result[GetArrayLength(result)-1] := NPCs[i];
end;
end;
function SortNPCs(NPCs:array of TNPC):array of TNPC;
{*******************************************************************
Function SortNPCs(NPCs:array of TNPC):array of TNPC;
By: Widget
Description: Sorts NPCs by distance from you.
********************************************************************}
var
i,i2,ix,iy: integer;
tpa: TPointArray;
begin
if (GetArrayLength(NPCs)=0) then Exit;
SetArrayLength(TPA,GetArrayLength(NPCs));
SetArrayLength(Result,GetArrayLength(NPCs));
for i := 0 to high(NPCs) do
TPA[i] := Point(NPCs[i].TileX, NPCs[i].TileY);
GetMyPos(ix, iy);
SortTPAFrom(TPA, Point(ix, iy));
for i := 0 to high(TPA) do
for i2 := 0 to high(NPCs) do // they really should be the same
if (TPA[i].x=NPCs[i2].TileX) and (TPA[i].y=NPCs[i2].TileY) then
Result[i] := NPCs[i2];
end;
Function FindNPC(Name: string; var NPC: TNPC):boolean;
{*******************************************************************
function FindNPC(Name: string; var NPC: TNPC):boolean;
By: Widget
Description: Finds the tile of the named NPC and puts it in the NPC var.
Returns true if found, false if not. (Try walking with the MM if
it's not on the main screen.
********************************************************************}
var
NPCs: array of TNPC;
begin
NPCs := SortNPCs(GetNPCsByName(Name));
result := GetArrayLength(NPCs)<>0;
if not result then
Exit;
NPC := NPCs[0];
end;
Function FindNPCByID(ID: integer; var NPC: TNPC):boolean;
{*******************************************************************
function FindNPCByID(ID: integer; var NPC: TNPC):boolean;
By: Widget
Description: Finds the tile of the named NPC and puts it in the NPC var.
Returns true if found, false if not. (Try checking for tiles if
it's not on the mainscreen.)
********************************************************************}
var
NPCs: array of TNPC;
begin
NPCs := SortNPCs(GetNPCsByID(ID));
result := GetArrayLength(NPCs)<>0;
if not result then
Exit;
NPC := NPCs[0];
end;
Function ClickTile(TileX, TileY, Height : Integer; Left : Boolean) : Boolean;
{*******************************************************************
Function ClickTile(TileX, TileY, Height : Integer; Left : Boolean) : Boolean;
By: ss23 and Widget
Description: Clicks a tile. Height is the approximate heigh in pixels
Height doesnt matter if HighestAngle;
********************************************************************}
Var
x, y : Integer;
Begin
TileToMS(TileX, TileY, Height, x, y);
result := TileOnMs(x,y,height);
if not result then
Exit;
Mouse(x, y, 5, 5, False);
end;
Function WalkToTile(TileX, TileY : Integer): Boolean;
{*******************************************************************
Function - WalkToTile(TileX, TileY : Integer): Boolean;
By: ss23 and Widget
Description: Walks to the tile using minimap.
********************************************************************}
Var
x, y : Integer;
Begin
TileToMinimap(Tilex, Tiley, x, y);
if not TileOnMM(TileX, TileY) then
begin
Writeln('Tile off minimap');
Result := False;
Exit;
end;
Mouse(x, y, 3, 3, True);
Result := True;
end;
Function WalkToTileTol(TileX, TileY, Tol : Integer): Boolean;
{*******************************************************************
Function - WalkToTileTol(TileX, TileY, Tol : Integer): Boolean;
By: ss23 and Widget and TheGuyWhoGotOn
Description: Walks to the tile using minimap and tolerance.
********************************************************************}
Var
x, y : Integer;
Begin
TileToMinimap(Tilex, Tiley, x, y);
if not TileOnMM(TileX, TileY) then
begin
Writeln('Tile off minimap');
Result := False;
Exit;
end;
Mouse(x, y, Tol, Tol, True);
Result := True;
end;
function LongWalkEx(TileX, TileY, DisX, DisY, Tol : integer): boolean;
{*******************************************************************
Function - LongWalkEx(TileX, TileY, DisX, DisY, Tol : Integer): Boolean;
By: TheGuyWhoGotOn
Description: Walks to a far tile using the minimap and tolerance.
DisX/DisY is how many tiles it will move at a time.
********************************************************************}
var TX, TY, DX, DY : integer;
begin
repeat
GetMyPos(TX, TY);
if ((DX) > (TileX - DisX)) and ((DX) < (TileX + DisX)) then else
if TileX > TX then DX := TX + DisX
else DX := TX - DisX;
if ((DY) > (-TileY - DisY)) and ((DY) < (TileY + DisY)) then else
if TileY > TY then DY := TY + DisY
else DY := TY - DisY;
WalkToTileTol(DX, DY, Tol);
repeat
Wait(1000 + Random(500));
until (Flag) or (not(CharacterMoving));
until (TileOnMM(TileX, TileY)) or (not(TileOnMM(DX, DY)));
Result := WalkToTileTol(TileX, TileY, Tol);
end;
function LongWalk(TileX, TileY, Tol : integer): boolean;
{*******************************************************************
Function - LongWalk(TileX, TileY, Tol : Integer): Boolean;
By: TheGuyWhoGotOn
Description: Walks to a far tile using the minimap and tolerance.
********************************************************************}
begin
Result := LongWalkEx(TileX, TileY, 11, 11, Tol);
end;
function PathWalk(Path : array of TPoint; Long : boolean; Tol : integer): Boolean;
{*******************************************************************
Function - PathWalk(Path : array of TPoint; Long : boolean; Tol : integer): Boolean;
By: TheGuyWhoGotOn
Description: Walks a path for you with LongWalk options.
********************************************************************}
var Count : integer;
begin
Count := 0;
repeat
if Long then Result := LongWalk(Path[Count].x, Path[Count].y, Tol)
else Result := WalkToTileTol(Path[Count].x, Path[Count].y, Tol);
repeat
Wait(1000 + Random(500));
until (Flag) or (not(CharacterMoving));
if not(Result) then
begin
WriteLn('Path walk failed');
Exit;
end;
Count := Count + 1;
until (not(Result)) or (Count = GetArrayLength(Path))
end;
procedure MMtoMS(MMX,MMY:integer; var MSX,MSY:integer);
{*******************************************************************
Function MMtoMS(x, y: Integer; left: Boolean): Boolean;
By: LeeLokHin
Description: Converts Coordinates x and y on the minimap
to equivilants on the MainScreen and clicks right or left according
to boolean left.
********************************************************************}
var
tx,ty:integer;
begin
MinimapToTile(MMX, MMY, tx, ty);
TileToMS(tx, ty, 5, MSX, MSY);
end;
Function OpenBankReflection(Bank : String): Boolean;
{*******************************************************************
Function OpenBankReflection(Bank : String): Boolean;
By: ss23
Description: Opens the bank. Opens nearest slot
********************************************************************}
Var
x, y : Integer;
Me : TPoint;
Tiles : TPointArray;
Begin
Case Bank of
'veb': Tiles := [Point(3251,3419), Point(3252,3419), Point(3253,3419),
Point(3254,3419), Point(3255,3419), Point(3256,3419)];
'vwb': Tiles := [Point(3190,3435), Point(3190,3437), Point(3190,3439),
Point(3190,3441), Point(3190,3443), Point(3181,3444), Point(3181,3442),
Point(3181,3440), Point(3181,3438), Point(3181,3436)];
'fwb': Tiles := [Point(2945,3367), Point(2946,3367), Point(2947,3367),
Point(2948,3367)];
'feb': Tiles := [Point(3010,3354), Point(3011,3354), Point(3012,3354),
Point(3013,3354), Point(3014,3354), Point(3015,3354)];
'lum': Tiles := [Point(3208,3221)];
'dra': Tiles := [Point(3091,3419), Point(3091,3245), Point(3091,3244),
Point(3091,3243), Point(3091,3242)];
'alk': Tiles := [Point(3268,3168), Point(3268,3167), Point(3268,3166),
Point(3268,3165), Point(3268,3164)];
end;
GetMyPos(Me.x, Me.y);
SortTPAFrom(Tiles, Me);
If (DistanceFrom(Tiles[0].x, Tiles[0].y) > 3) then
Begin
If not(TileOnMM(Tiles[0].x, Tiles[0].y)) then
Begin
Writeln('Couldn''t find bank');
Result := False;
Exit;
end;
WalkToTile(Tiles[0].x, Tiles[0].y);
Wait(10);
Flag;
Wait(100 + Random(100));
end;
If not(TileOnMS(Tiles[0].x, Tiles[0].y, 15)) then
Begin
SetAngle(True);
MakeCompass('n');
If not(TileOnMS(Tiles[0].x, Tiles[0].y, 20)) then
Begin
Writeln('Couldnt'' find bank booth');
Result := False;
Exit;
end;
end;
TileToMS(Tiles[0].x, Tiles[0].y, 20, x, y);
Mouse(x, y, 5, 5, False);
Wait(100 + Random(100));
Result := ChooseOption('e-q');
end;
function GetPlayers: array of TPlayer;
{*******************************************************************
function - GetPlayers: array of TPlayer;
By: Widget
Description: Returns all the players on the minimap
--- DOESN'T WORK YET ---
********************************************************************}
//var
// i, IndexPos, Count, Player, Name: integer;
begin
result := result; // stops the "Variable 'Result' never used" thing
{ Count := SmartGetFieldInt(0, PlayerCount);
writeln('Number of players: '+inttostr(Count));
SetArrayLength(result, Count);
for i := 0 to (count-1) do
begin
IndexPos := SmartGetFieldArrayInt(0, PlayerIndArray, i);
writeln('Index position: '+inttostr(count));
Player := SmartGetFieldArrayObject(0, PlayerArray, IndexPos);
writeln('Player placement: '+inttostr(Player));
Name := SmartGetFieldObject(Player, CharName);
writeln(inttostr(name));
writeln(StringFromBytes(Name));
Result[indexpos].Name := StringFromBytes(Name);
SmartFreeObject(Name);
Writeln(Result[indexpos].Name);
end; }
end;
function GetPlayer(name: string): TPlayer;
{*******************************************************************
function - GetPlayer(name: string): TPlayer;
By: Widget
Description: Gets available stats for a player (Levels only work on you).
--- DOESN'T WORK YET ---
********************************************************************}
begin
result := result; // stops the "Variable 'Result' never used" thing
end;
begin
SetupSRL;
SetupReflection;
end.
Setting up reflection took 313 ms.