SRL Archive - Reflection Development

[R] Reflection Walking Update


Runescapian321

2010-03-12 20:04:51

EDIT: Everything useful in this thread has been committed to the Svn: http://scardevreflection.googlecode.com/svn/trunk. However, note that virtually only the functions mentioned in this thread work. If the hooks become outdated (after an update), check the end of this thread on how to update the necessary hooks in Hooks.scar.

J_Pizzle tells me he is very close to being done with reflection as a whole. Nonetheless, I decided to put this together so people can start using at least the walking for however long it takes J_Pizzle to finish, since people would like using Reflection walking apparently.

Save this in SCAR/Includes as RefWalk.scar and then you can include it with {.include RefWalk.scar}:

//****Tad's temporary reflection walking file***** Credits to J_Pizzle for his help

const

CharMotion = 'rc';
MyPlayer = 'wm.c';
BaseX = 'ii.b';
BaseY = 'rh.p';
CurrentX = 'q';
CurrentY = 'm';
FlagX = 'uq.mc';
FlagY = 'kn.t';


{*******************************************************************************
function GetMyPos:TPoint;
By: BenLand100
Description: Calculates your x,y position or [somehugenumber] if not
logged in
*******************************************************************************}
function GetMyPos:TPoint;
var
me: Integer;
begin
me := SmartGetFieldObject(0, MyPlayer);
Result.x := SmartGetFieldInt(0, BaseX) + SmartGetFieldInt(me, CurrentX) shr 7;
Result.y := SmartGetFieldInt(0, BaseY) + SmartGetFieldInt(me, CurrentY) shr 7;
SmartFreeObject(me);
end;

{*******************************************************************************
Function DistanceFrom(Tile: TPoint): Integer;
By: Widget modded by Timer
Description: Returns the distance between your player and the tile. (Tiles)
*******************************************************************************}
function DistanceFrom(Tile: TPoint): Integer;
var
MyPos: TPoint;
begin
MyPos := GetMyPos;
Result := Distance(MyPos.x, MyPos.y, Tile.X, Tile.Y);
end;

{*******************************************************************************
Function TileToIndex(Tile: TPoint; Path: TPointArray): integer;
By: RM
Description: Returns the Index of the Tile on the Path.
*******************************************************************************}
Function TileToIndex(Tile: TPoint; Path: TPointArray): integer;
begin
for Result := 0 to High(Path) do
if Tile.x = Path[Result].x then
if Tile.y = Path[Result].y then
break;
end;

{*******************************************************************************
function TileToMM(Tile: TPoint): TPoint;
By: BenLand100
Description: Converts the tile position tileX,tileY to a minimap location
*******************************************************************************}
function TileToMM(Tile: TPoint): TPoint;
var
angle: extended;
tempX, tempY: integer;
temp: TPoint;
begin
angle:= rs_GetCompassAngleRadians;
temp := GetMyPos;
tempX:= (Tile.x - Temp.x) * 4 - 2;
tempY:= (Temp.y - Tile.y) * 4 - 2;
Result.x:= round(tempX*cos(angle) - tempY*sin(angle)) + 629;
Result.y:= round(tempX*sin(angle) + tempY*cos(angle)) + 85;
end;

{*******************************************************************************
Function TileOnMM(Tile: TPoint): Boolean;
By: Timer
Description: True = Tile on MM
*******************************************************************************}
function TileOnMM(Tile: TPoint): Boolean;
var
PointEx: TPoint;
begin
PointEx := TileToMM(Tile);
Result := rs_OnMinimap(PointEx.x, PointEx.y);
end;

{*******************************************************************************
function GetFlag(var TFlag: TPoint): Boolean;
By: TheGuyWhoGotOn modded by Timer
Description: Gets your destination (Tiles)
*******************************************************************************}
function GetFlag(var TFlag: TPoint): Boolean;

var
xFlag, yFlag: LongInt;

begin
xFlag := SmartGetFieldInt(0, FlagX);
yFlag := SmartGetFieldInt(0, FlagY);
TFlag := Point((SmartGetFieldInt(0, BaseX) + xFlag), (SmartGetFieldInt(0, BaseY) + yFlag));
Result := (xFlag)and(yFlag) > 0;
end;

{*******************************************************************************
Function GetSpeed : integer;
By: Widget
Description: Gets character speed (squares per second)
*******************************************************************************}
function GetSpeed: Integer;
var
Player: Integer;
begin
Player := SmartGetFieldObject(0, MyPlayer);
result:= SmartGetFieldInt(Player, CharMotion);
SmartFreeObject(Player);
end;

{*******************************************************************************
Function CharacterMoving: boolean;
By: BenLand100
Description: True if you are moving
*******************************************************************************}
function CharacterMoving: boolean;
begin
result:= (GetSpeed > 0);
end;

{*******************************************************************************
function WaitToMove(Timeout: integer): Boolean;
By: lordsaturn
Description: Waits for the local player to move with a timeout. Returns true if
moved, false if timed out.
*******************************************************************************}
function WaitToMove(Timeout: integer): Boolean;
var
a, Player: integer;
begin
a := GetSystemTime;
while not(CharacterMoving) do
begin
if GetSystemTime - a > Timeout then Exit;
Wait(100);
end;
Result := True;
end;

{*******************************************************************************
procedure R_FFlag(Distance: Integer);
By: ZephyrsFury
Description: Similar to the original except it uses Reflection.
NOTE: May return false negative
*******************************************************************************}
procedure R_FFlag(Dist: Integer);

var
Tx, Ty, m, d1, d2: Integer;
P, D: TPoint;

begin
while (GetFlag(D)) do
begin
P := GetMyPos;
d1 := Round(Sqrt(Sqr(D.x - P.x) + Sqr(D.y - P.y)) * 4);
if (d1 >= Dist) then
begin
if not WaitToMove(1000) then Exit;
Inc(m);
Wait(100);
if SRL_Procs[SRL_AntiBan] <> nil then
SRL_Procs[SRL_AntiBan]();
if (Random(100) = 0) then IdleTime(500, 1000, 0.01);
if (m mod 100 = 0) then
if (d1 = d2) then
begin
if (FindColor(Tx, Ty, 255, MMX1, MMY1, MMX2, MMY2)) then
Mouse(Tx, Ty + 14, 0, 0, True)
else
Mouse(MMCX, MMCY, 0, 0, True);
end else d2 := d1;
end else Break;
end;
end;

{*******************************************************************************
Function WalkToTile(Tile: TPoint; Randomness, FlagD: Integer): Boolean;
By: Wizzup and TheGuyWhoGotOn
Description: Walks to the tile using minimap.
*******************************************************************************}
Function WalkToTile(Tile: TPoint; Randomness, FlagD: Integer): Boolean;

Var
wTile: TPoint;
t: Integer;

Begin
Result := False;
Tile := Point(RandomRange(Tile.X-Randomness, Tile.X+Randomness), RandomRange(Tile.Y-Randomness, Tile.Y+Randomness));
wTile := TileToMM(Tile);
If Not rs_OnMiniMap(wTile.X, wTile.Y) Then
Exit;
MFNF(wTile.x, wTile.y, -1, -1);
Wait(RandomRange(80, 100));
t := getsystemtime;
R_FFlag(FlagD);
Result := (GetSystemTime - t) < 60000;
End;

{*******************************************************************************
function ReversePath(Path: TPointArray): TPointArray;
By: Tad
Description: Reverses the order of tiles in a path.
*******************************************************************************}
function ReversePath(Path: TPointArray): TPointArray;
var
Index, AHigh: integer;
begin
SetLength(result, GetArrayLength(Path));
AHigh := High(result);
for Index:=0 to AHigh do
result[Index] := Path[AHigh - Index];
end;

{*******************************************************************************
Procedure R_Flag;
By: Timer
Description: Waits Till A COMPLETE Stop. (Not dependant on Flag hooks)
*******************************************************************************}
procedure R_Flag;

var
Ticker: Integer;

begin
Ticker := (GetSystemTime + 30000);
while (CharacterMoving) do
begin
Wait(10 + Random(10));
if SRL_Procs[SRL_AntiBan] <> nil then
SRL_Procs[SRL_AntiBan]();
if (GetSystemTime > Ticker) then
Exit;
end;
Wait(500 + Random(50));
end;

Of course, the hooks at the top will become outdated. If you wish to use this after an RS update, you must update the hooks (if you do update them, please post them on this thread so nobody else has to waste time updating). For now, you can steal them from RSBot. Using Widget's hook stealer, you can get a list of the RSBot hooks. NOTE: Replace line 44 with this in Widget's script

page := GetPage('http://runedev.googlecode.com/svn/trunk/data/info.dat');

After you have all the RSBot hooks, you must find the ones that correspond to the SRL hooks in the include above. Here are the equivalents:

RSBot (through Widget's stealer):

isMoving = I.kk.rc
getMyRSPlayer = wm.c
getBaseX = I.ii.b
getBaseY = I.rh.p
getX = I.lq.q (NOTE: There are multiple 'getX' and 'getY's. These are the ones right under 'getData')
getY = I.lq.m
getDestX = I.uq.mc
getDestY = I.kn.t


SRL Equivalent:

CharMotion = 'rc';
MyPlayer = 'wm.c';
BaseX = 'ii.b';
BaseY = 'rh.p';
CurrentX = 'q';
CurrentY = 'm';
FlagX = 'uq.mc';
FlagY = 'kn.t';


I was going to make a script to do this for you, but J_Pizzle told me he was almost done, so it's not really worth it.

Enjoy :) Let me know if I forgot/epic failed anything.

EDIT: Check out R_WalkPath.

mormonman

2010-03-12 21:28:26

So all you did was update hooks?

JPHamlett

2010-03-12 21:30:26

thats all that had to be done ive sadi taht before

mormonman

2010-03-12 21:31:43

From: J_Pizzle
thats all that had to be done ive sadi taht before


Wow, really? Do you have all the hooks, if so send me the file and I will commit it.

Timer

2010-03-12 21:31:46

I fixed my whole reflection in like 30 minutes. It's not hard. Hahahaha.

But wow! I'm surprised someone released something.
SRL is so leechy these days I wont wanna release anything.

JPHamlett

2010-03-12 21:33:29

From: Timer
I fixed my whole reflection in like 30 minutes. It's not hard. Hahahaha.

But wow! I'm surprised someone released something.
SRL is so leechy these days I wont wanna release anything.


you ahve tiletoms working?

mormonman

2010-03-12 21:38:41

From: Timer
I fixed my whole reflection in like 30 minutes. It's not hard. Hahahaha.

But wow! I'm surprised someone released something.
SRL is so leechy these days I wont wanna release anything.


No pics no proof. Or in this case, no code instead of pics.

i luffs yeww

2010-03-12 21:47:07

Timer's a trollllllllllllll.

Good work, Tad. ^^

mormonman

2010-03-12 21:51:34

Committed. Update your development revision.

nebster

2010-03-21 21:00:09

Not working again I think.
I run it and it says:
Attempting to update Hooks...
New Hooks are not uploaded yet - please try later...
Also, you can't access runedev.googlecode.com or I can't at least.
It has a 403 Forbidden message

TRiLeZ

2010-03-21 21:49:05

From: nebster
Not working again I think.
I run it and it says:
Attempting to update Hooks...
New Hooks are not uploaded yet - please try later...
Also, you can't access runedev.googlecode.com or I can't at least.
It has a 403 Forbidden message


It looks like the google-code project has been shut down…

Timer

2010-03-21 22:11:57

From: TRiLeZ
It looks like the google-code project has been shut down…


http://mhty.googlecode.com/svn/trunk/data/info.dat

kingarabian

2010-03-22 02:57:34

Or we could have good ole' Method updating ;). Can you get the hooks from the client itself?

mormonman

2010-03-22 09:49:19

From: kingarabian
Or we could have good ole' Method updating ;). Can you get the hooks from the client itself?


He has already said that he was no longer going to work on his updater.

Runescape Pro

2010-03-27 07:30:17

We can't get hooks anymore? We need some authentication bs… How can we get the hooks?

i luffs yeww

2010-03-27 08:53:31

I think the new one is MHTY or something.. one sec.

Yeah. Can't you get them from http://mhty.googlecode.com/svn/trunk/data/info.dat?

Apparently not.

Timer

2010-03-27 10:16:20

const
CharMotion = '??';
MyPlayer = 'wk.Z';
CurrentX = 'F';
CurrentY = 'v';
BaseX = 'jq.p';
BaseY = 'ia.e';
FlagX = 'ak.a';
FlagY = 'lk.L';
//you can use isMoving
SmartGetFieldBoolean(MyPlayerSmartIndex, 'Fc')

Runescape Pro

2010-03-27 10:17:16

Any chance of telling me how to get them myself?

Timer

2010-03-27 10:18:20

You make a updater. :)

i luffs yeww

2010-03-27 10:19:54

And how would one do that? :p

Timer

2010-03-27 10:22:29

… Just ask me.
596:596:
LocalPlayer @wk.Z#:
CurrentX @F#:
CurrentY @v#:
BaseX @jq.p#:
BaseY @ia.e#:
CompassAngle @st.m#:
MapOffSetAngle @eq.S#:
MovementSpeed @#:
FlagX @ak.a#:
FlagY @lk.L#:
Animation @zb#:
HpRatio @sb#:
NPCCount @qi.M#:
NPCIndexArray @bi.h#:
NPCArray @ef.b#:
NPCComposite @bd#:
NPCName @t#:
NPCID @n#:
LoopCycle @lo.b#:
LoopCycleStatus @Ob#:
CharHeight @tb#:
InterfaceCache @ef.i#:
InterfaceText @f#:
MaxSkillLevels @ck.Z#:
ClanChatCount @mu.f#:
ClanChatPlayers @u.n#:
clanPlayerName @h#:
LoginIndex @pn.a#:
SelfInteracting @jq.p#:
CharInteracting @L#:
ValidInterfaceArray @ef.i#:
clanWorld @k#:
clanServer @c#:
clanUsername @j#:
CamX @km.G#:
CamY @sa.C#:
CamZ @tm.l#:
CamPitch @qu.a#:
CamYaw @ff.O#:
MenuOptionsCount @fs.g#:
MenuOpenBoolean @ar.d#:
playerLoginName @fi.g#:
playerPassword @cc.A#:
That is for my fixed version of reflection. I have yet to fix Items and Objects. :)

mastaraymond

2010-03-27 10:25:10

And now we just need someone to commit the new hooks to the reflection svn :)

Timer

2010-03-27 10:30:21

From: mastaraymond
And now we just need someone to commit the new hooks to the reflection svn :)


;) cheater. :p

Runescape Pro

2010-03-27 10:57:43

Timer, can you update the svn with your hooks?

Timer

2010-03-27 11:00:23

From: Runescape Pro
Timer, can you update the svn with your hooks?


No, they removed me from svn for developing it too fast. >.>

Runescape Pro

2010-03-27 11:04:18

Are you serious? Sarcasm is hard for me to understand through a monitor lol.

In my hooks.scar it says "BaseX = 'ii.b';". But in your code its says it's "jq.p".
So mine aren't up to date?

Timer

2010-03-27 11:05:29

Yours are outta date.. Or you hooked them wrong?
EDIT: Yes, I am serious.

Runescape Pro

2010-03-27 11:09:08

I don't know how to hook them myself. So, the only way to get them correct is to copy each one from yours to my hooks.scar?

Timer

2010-03-27 11:10:10

Yeah. I'm not doing it. :)

trecool999

2010-04-02 15:50:55

'Runescape Pro':


//------------------------------------------------------------------\\
//-- Scar Non-Standard Resource Library --||
//-- Reflection Routines - Hooks --||
//------------------------------------------------------------------//


const
// Build number
RSBuild = 596;

// NPC
NPCDef = 'bd';

// Player
CharName = 'fi.g';
CharLevel = 'null';

// Client
NPCIndexArray = 'bi.h';
NPCArray = 'ef.b';
NPCCount = 'qi.M';

PlayerIndexArray = 'null.null';
PlayerArray = 'null.null';
PlayerCount = 'null.null';
MyPlayer = 'wk.Z';

BaseX = 'jq.p';
BaseY = 'ia.e';

LoopCycle = 'lo.b';

GroundHeights = 'null.null';
GroundSettings = 'null.null';
BaseLayer = 'null.null';

CamX = 'km.G';
CamY = 'sa.C';
CamZ = 'tm.l';
CamPitch = 'qu.a';
CamYaw = 'ff.O';

LoginIndex = 'pn.a';

SettingsArray = 'null.null';

IsMembers = 'null.null';

MaxLevels = 'ck.Z';
CurrentLevels = 'null.null';
Experiences = 'null.null';

MapOffsetAngle = 'eq.S';
CompassAngle = 'null.null';

ChatMessages = 'null.null';
ChatTypes = 'null.null';
ChatNames = 'null.null';

MenuOptionsCount = 'fs.g';
MenuOpen = 'ar.d';
MenuX = 'null.null';
MenuY = 'null.null';
MenuOption = 'null';
MenuAction = 'null';

SelectedItemName = 'null.null';

FlagX = 'ak.a';
FlagY = 'lk.L';

// Character
CharAnim = 'zb';
CharMotion = 'null';
CurrentX = 'F';
CurrentY = 'v';
LoopCycleStatus = 'Ob';
CharHPRatio = 'sb';
CharHeight = 'tb';
TurnDirection = 'null';
CharInteracting = 'L';

SelfInteracting = 'jq.p';

// NPCDef
NPCName = 't';
NPCType = 'n';
NPCLevel = 'null';

// Ground Item Finding
GroundItemArray = 'null.null';
GroundItemHead = 'null';
NextGroundItem = 'null';
GroundItem = 'null';
GroundItemID = 'null';
GroundItemStackSize = 'null';

GroundArray = 'null.null';

// Object Hooks
Object1 = 'null';
Object2 = 'null';
Object3 = 'null';
Object4 = 'null';
Object5Array = 'null';

ObjectUID1 = 'null';
ObjectUID2 = 'null';
ObjectUID3 = 'null';
ObjectUID4 = 'null';
ObjectUID5 = 'null';

// Interface Hooks
// General
InterfaceCache = 'ef.i';
ValidInterfaceArray = 'ef.i';
InterfaceChildren = 'null';
InterfaceText = 'f';
TextColor = 'null';
SelectedModelID = 'null';
NotSelectedModelID = 'null';
SelectedModelType = 'null';
NotSelectedModelType = 'null';
ModelZoom = 'null';

// Bank
BankItemID = 'null';
BankItemStackSize = 'null';
BankItemName = 'null';
BankItemIndex = 'null';

// Inventory
InventoryItemIDs = 'null';
InventoryItemStackSizes = 'null';

// Ground Data
GroundDataArray = 'null.null';
GroundDataBlocks = 'null';

TRiLeZ

2010-04-02 17:23:52

From: trecool999
'Runescape Pro':


//------------------------------------------------------------------\\
//-- Scar Non-Standard Resource Library --||
//-- Reflection Routines - Hooks --||
//------------------------------------------------------------------//


const
// Build number
RSBuild = 596;

// NPC
NPCDef = 'bd';

// Player
CharName = 'fi.g';
CharLevel = 'null';

// Client
NPCIndexArray = 'bi.h';
NPCArray = 'ef.b';
NPCCount = 'qi.M';

PlayerIndexArray = 'null.null';
PlayerArray = 'null.null';
PlayerCount = 'null.null';
MyPlayer = 'wk.Z';

BaseX = 'jq.p';
BaseY = 'ia.e';

LoopCycle = 'lo.b';

GroundHeights = 'null.null';
GroundSettings = 'null.null';
BaseLayer = 'null.null';

CamX = 'km.G';
CamY = 'sa.C';
CamZ = 'tm.l';
CamPitch = 'qu.a';
CamYaw = 'ff.O';

LoginIndex = 'pn.a';

SettingsArray = 'null.null';

IsMembers = 'null.null';

MaxLevels = 'ck.Z';
CurrentLevels = 'null.null';
Experiences = 'null.null';

MapOffsetAngle = 'eq.S';
CompassAngle = 'null.null';

ChatMessages = 'null.null';
ChatTypes = 'null.null';
ChatNames = 'null.null';

MenuOptionsCount = 'fs.g';
MenuOpen = 'ar.d';
MenuX = 'null.null';
MenuY = 'null.null';
MenuOption = 'null';
MenuAction = 'null';

SelectedItemName = 'null.null';

FlagX = 'ak.a';
FlagY = 'lk.L';

// Character
CharAnim = 'zb';
CharMotion = 'null';
CurrentX = 'F';
CurrentY = 'v';
LoopCycleStatus = 'Ob';
CharHPRatio = 'sb';
CharHeight = 'tb';
TurnDirection = 'null';
CharInteracting = 'L';

SelfInteracting = 'jq.p';

// NPCDef
NPCName = 't';
NPCType = 'n';
NPCLevel = 'null';

// Ground Item Finding
GroundItemArray = 'null.null';
GroundItemHead = 'null';
NextGroundItem = 'null';
GroundItem = 'null';
GroundItemID = 'null';
GroundItemStackSize = 'null';

GroundArray = 'null.null';

// Object Hooks
Object1 = 'null';
Object2 = 'null';
Object3 = 'null';
Object4 = 'null';
Object5Array = 'null';

ObjectUID1 = 'null';
ObjectUID2 = 'null';
ObjectUID3 = 'null';
ObjectUID4 = 'null';
ObjectUID5 = 'null';

// Interface Hooks
// General
InterfaceCache = 'ef.i';
ValidInterfaceArray = 'ef.i';
InterfaceChildren = 'null';
InterfaceText = 'f';
TextColor = 'null';
SelectedModelID = 'null';
NotSelectedModelID = 'null';
SelectedModelType = 'null';
NotSelectedModelType = 'null';
ModelZoom = 'null';

// Bank
BankItemID = 'null';
BankItemStackSize = 'null';
BankItemName = 'null';
BankItemIndex = 'null';

// Inventory
InventoryItemIDs = 'null';
InventoryItemStackSizes = 'null';

// Ground Data
GroundDataArray = 'null.null';
GroundDataBlocks = 'null';


Those are a revision too old.

trecool999

2010-04-02 17:38:58

You're kidding?
Urgh.