JuKKa
2008-07-24 09:42:42
Hi
This tutorial is about reflection. ALWAYS WHEN USING REFLECTION YOU HAVE TO USE SMART OR IT WONT WORK.
I wont go into detail on HOW reflection works and what it does.
Reflection is what its called when its "asking" the runescape client on whats on screen or what is happening.
Reflection is a powerfull tool in runescape cheating, its being used by most runescape bots and autos, simply because its so powerfull.
Imagine finding that rock without using any color, and 10 times less code, or walking to falador from varrock using only 10 lines.
However! Whenever runescape updates, the "variables" that reflection uses often change and thus reflection breaks, making it unable to use.
This is why you shouldnt relie 100% on reflection so DO add normal fail safes like the "old" radialwalk, dtms etc.
Before you start coding with reflection what you need is THIS.
This is "Reflection.Scar"
Copy paste this to scar and save it to "Scar/Includes/SRL/SRL/Misc/" As "Reflection.Scar"
Okay, when you have done that.
This is the way you use reflection in ur script.
Now you might wonder… Okay how do i use this reflection….
Simple…
To get your animation you would use something like this
Writeln('Your animation is = '+IntToStr( GetAnimation ));
This writes ur current animation to the debug box.
What you HAVE to remember is that EVERY SINGLE animation has a different number.
Meaning that GetAnimation = 621, means that you are fishing with a net.
IMPORTANT!!!
Different axes and pickaxes have different animations.
But to solve this in a easy way.
Lets say while woodcutting animation with bronze axe is 100 and iron is 101, steel 102, black 103 and so on.
We can simply do this:
Please post if you missunderstood anything about getanimation.
Tiles and walking…
Okay… every single square in runescape has a tile number. Its a bit like a x, y coordinate like in math.
Well you might wonder well how do i walk using these tiles numbers.
To get your tile number (where you are standing) is simple just run this in scar
Remember to include the basic reflection includes and SMART!
You might wonder ok.. Whats the best way to use the tiles…
HERE
Loading your tiles to a TPA (T Point Array, you might need to read a small tutorial about that, its quite easy)
Tiles := [Point( TileX1, TileY1), Point(TileX2, TileY2), Point(TileX3, TileY3)];
OR
Tiles[0] := Point( TileX1, TileY1);
etc
or
Tiles[0].X := TileX1;
Tiles[0].Y := TileY1;
Thats 3 different ways to make a tile array
Now to use the tiles to walk on them is easy, if you have made a series of tiles like this the simpliest way to execute them is this:
For I:= 0 To High(Tiles) Do
WalkToTile(Tiles.X, Tiles.Y);
You might need to read a tutorial about arrays to fully understand this.
please POST if you didnt understand something.
This tutorial is about reflection. ALWAYS WHEN USING REFLECTION YOU HAVE TO USE SMART OR IT WONT WORK.
I wont go into detail on HOW reflection works and what it does.
Reflection is what its called when its "asking" the runescape client on whats on screen or what is happening.
Reflection is a powerfull tool in runescape cheating, its being used by most runescape bots and autos, simply because its so powerfull.
Imagine finding that rock without using any color, and 10 times less code, or walking to falador from varrock using only 10 lines.
However! Whenever runescape updates, the "variables" that reflection uses often change and thus reflection breaks, making it unable to use.
This is why you shouldnt relie 100% on reflection so DO add normal fail safes like the "old" radialwalk, dtms etc.
Before you start coding with reflection what you need is THIS.
//------------------------------------------------------------------\\
//-- Scar Non-Standard Resource Library --||
//-- » Reflection Routines --||
//------------------------------------------------------------------//
// * 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; height: integer; // * by Widget
// * var x,y:integer): Boolean; //
// * Function FindNPCTile(Name: string; var x,y:integer): Boolean; // * by Widget
// * Function ClickTile(TileX, TileY, Height : Integer; // * by ss23 and Widget
// Left : Boolean) : Boolean; //
// * Procedure WalkToTile(Tilex, Tiley : Integer); // * by ss23
// * Function MMtoMS(x, y: Integer; left: Boolean): Boolean; // * by LeeLokHin
// * Function OpenBankReflection(Bank : String): Boolean; // * by ss23
//------------------------------------------------------------------//
// NPC stuff completely re-written
//
// Added TNPC type, will use later; Improved TileOn functions - ss23
//
// Thanks to Speljohan and Quaters for making hooks that we can steal =)
//------------------------------------------------------------------//
type
TPlayer = record
x, y:integer;
animation, speed: integer;
HPRatio, height, level: integer;
Name, PrayerHeadIcon: string;
Levels, Experiences: array[1..28]{or whatever} of integer;
end;
type TNPC = record
x, y, NPCType : integer;
TheName : string;
InFight, IsMoving: boolean;
end;
const
// Global Static Hooks
BaseLayer = 'bc.f';
BaseX = 'pa.e';
BaseY = 'rb.D';
CamX = 'ph.j';
CamY = 'bb.y';
CamZ = 'bi.w';
CamPitch = 'pi.E';
CamYaw = 'sh.N';
CompassAngle = 'oj.p';
CurrentLevels = 'fd.eb';
Experiences = 'e.n';
FlagX = 'sc.Y';
FlagY = 'le.f';
GroundHeights = 'lh.N';
GroundSettings = 'ad.P';
LoopCycle = 'lg.a';
MapOffsetAngle = 'fa.m';
MaxLevels = 'hk.e';
MyPlayer = 'th.u';
NPCArray = 'gj.o';
NPCCount = 'qi.h';
NPCIndexArray = 'cf.c';
SettingsArray = 'ki.c';
// Character Hooks
CharAnim = 'cb';
CharMotion = 'pb';
CurrentX = 'Q';
CurrentY = 'Bb';
Height = 'y';
LoopCycleStatus= 'qb';
// Player Hooks
CharName = 'uc';
// NPC Hooks
NPCDef = 'Nb';
// NPCDef Hooks
GetNPCName = 'V';
GetNPCType = 'j';
// RSString Hooks
StringBytes = 'B';
//----------------------------------------------------------------------//
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 GetNPCObjects:array of integer;
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].TheName := StringFromBytes(TheBytes);
Result[i].x := (SmartGetFieldInt(0, BaseX) + (SmartGetFieldInt(TheNPC, CurrentX) shr 7));
Result[i].y := (SmartGetFieldInt(0, BaseY) + (SmartGetFieldInt(TheNPC, CurrentY) shr 7));
Result[i].NPCType := SmartGetFieldInt(TheNPCDef,GetNPCType);
Result[i].InFight := (SmartGetFieldInt(0,LoopCycle)<SmartGetFieldInt(TheNPC,LoopCycleStatus));
Result[i].IsMoving := (SmartGetFieldInt(TheNPC,CharMotion)>0);
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].TheName))>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
SetArrayLength(TPA,GetArrayLength(NPCs));
SetArrayLength(Result,GetArrayLength(NPCs));
for i := 0 to high(NPCs) do
TPA[i] := Point(NPCs[i].x, NPCs[i].y);
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].x) and (TPA[i].y=NPCs[i2].y) then
Result[i] := NPCs[i2];
end;
Function FindNPCTile(Name: string; var TileX,TileY:integer):boolean;
{*******************************************************************
Function GetNPCTile(Name: string; var x,y:integer):boolean;
By: Widget
Description: Finds the tile of the named NPC, returns tile (useful for banking)
********************************************************************}
var
NPCs: array of TNPC;
begin
NPCs := SortNPCs(GetNPCsByName(Name));
result := False;
if (GetArrayLength(NPCs)=0) then
Exit;
result := true;
TileX := NPCs[0].x;
TileY := NPCs[0].y;
end;
Function FindNPC(Name: string; height:integer; var x,y:integer):boolean;
{*******************************************************************
function FindNPC(Name: string; var x,y:integer):boolean;
By: Widget
Description: Finds the tile of the named NPC, returns MS Point
********************************************************************}
var
p: TPoint;
begin
result := FindNPCTile(Name,p.x,p.y);
TileToMS(p.x,p.y,height,x,y);
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;
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. Bank = 'veb' atm. 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);
// Make choose option work here
// Wait(100 + Random(100));
// ChooseOption('uic');
Result := True;
end;
This is "Reflection.Scar"
Copy paste this to scar and save it to "Scar/Includes/SRL/SRL/Misc/" As "Reflection.Scar"
Okay, when you have done that.
This is the way you use reflection in ur script.
Program ReflectionSetup;
{.Include SRL/SRL/Misc/SMART.Scar}
{.Include SRL/SRL.Scar}
{.Include SRL/SRL/Misc/Reflection.Scar}
Procedure SetupSMART;
Begin
SmartSetupEx(136, True, True, False);
SetTargetDC(SmartGetDC);
If Not (LoggedIn) Then
While Not (SmartGetColor(360, 172) = 13158) Do
Wait(100);
End;
Begin
SetupSRL;
SetupSMART;
End.
Now you might wonder… Okay how do i use this reflection….
Simple…
To get your animation you would use something like this
Writeln('Your animation is = '+IntToStr( GetAnimation ));
This writes ur current animation to the debug box.
What you HAVE to remember is that EVERY SINGLE animation has a different number.
Meaning that GetAnimation = 621, means that you are fishing with a net.
IMPORTANT!!!
Different axes and pickaxes have different animations.
But to solve this in a easy way.
Lets say while woodcutting animation with bronze axe is 100 and iron is 101, steel 102, black 103 and so on.
We can simply do this:
Function WoodCutting: Boolean;
Begin
Result := InRange(GetAnimation, 100, 107);
End;
Please post if you missunderstood anything about getanimation.
Tiles and walking…
Okay… every single square in runescape has a tile number. Its a bit like a x, y coordinate like in math.
Well you might wonder well how do i walk using these tiles numbers.
To get your tile number (where you are standing) is simple just run this in scar
Var
X, Y: Integer;
Begin
SetupSRL;
SetupSMART;
GetMyPos(X, Y);
Writeln('Tile X = '+IntTostr(X)+' - Tile Y = '+IntToStr(Y));
End.
Remember to include the basic reflection includes and SMART!
You might wonder ok.. Whats the best way to use the tiles…
HERE
Loading your tiles to a TPA (T Point Array, you might need to read a small tutorial about that, its quite easy)
Tiles := [Point( TileX1, TileY1), Point(TileX2, TileY2), Point(TileX3, TileY3)];
OR
Tiles[0] := Point( TileX1, TileY1);
etc
or
Tiles[0].X := TileX1;
Tiles[0].Y := TileY1;
Thats 3 different ways to make a tile array
Now to use the tiles to walk on them is easy, if you have made a series of tiles like this the simpliest way to execute them is this:
For I:= 0 To High(Tiles) Do
WalkToTile(Tiles.X, Tiles.Y);
You might need to read a tutorial about arrays to fully understand this.
please POST if you didnt understand something.