SRL Archive - Download S.M.A.R.T.

SMARTv2 (3D Arrays!)


BenLand100

2007-12-27 19:05:27

I added in two method so that you can more easily access 3D arrays. Also, this includes TileToWorld and MinimapToTile which when combined create the prized MMtoMS ;) Main screen walking anyone? I have a different name scheme for most hooks, so I'm putting the ARGA style names in parentheses.

const
//Global Static Hooks
SettingsArray = 'jb.k'; //int[]
CurrentLevels = 'ca.jb'; //int[]
MaxLevels = 'ma.V'; //int[]
Experiances = 'oa.d'; //int[]
BaseX = 'oa.a'; //int
BaseY = 'dd.b'; //int
MyPlayer = 'nf.j'; //Player
CompassAngle = 'rg.o'; //int (MinimapInt1)
MapOffsetAngle = 'vf.c'; //int (MinimapInt2)
BaseLayer = 'vg.u'; //int (plane/terrainInt)
GroundSettings = 'ub.m'; //byte[][][] (groundByteArray)
GroundHeights = 'ld.p'; //int[][][] (groundIntArray)
CamX = 'dc.j'; //int
CamY = 'kh.nb'; //int
CamZ = 'uh.P'; //int
CamPitch = 've.H'; //int (CamCurveX)
CamYaw = 'fe.k'; //int (CamCurveY)

//Character Hooks
CurrentX = 'nb'; //int
CurrentY = 'db'; //int
CharAnim = 'ac'; //int
CharMotion = 'T'; //int
CharName = 'W'; //StringWrap

//StringWrap Hooks
StringBytes = 'K'; //byte[]

//Returns the current level of your player (its a funny array)
function GetLevel(index: integer): integer;
begin
result:= SmartGetFieldArrayInt(0,CurrentLevels,index);
end;

//Converts a byte[] from StringWrap to a DelphiString (max length 256)
function StringFromBytes(jbytearray: integer): string;
begin
SetLength(result, 256);
SetLength(result, SmartStringFromBytes(jbytearray,result));
end;

//Returns last logged in player's name
function GetMyName: string;
var
bytes: Integer;
begin
bytes:= SmartGetFieldObject(0,MyPlayer+'.'+CharName+'.'+StringBytes);
result:= StringFromBytes(bytes);
SmartFreeObject(bytes);
end;

//Returns your animation
function GetMyAnim: integer;
begin
result:= SmartGetFieldInt(0,MyPlayer+'.'+CharAnim);
end;

//True if you are moving
function GetMyMoving: boolean;
begin
result:= SmartGetFieldInt(0,MyPlayer+'.'+CharMotion) > 0;
end;

//Calculates your x,y position or [somehugenumber] if not logged in
procedure GetMyPos(var x, y: Integer);
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;

//Dumps the settings array to an integer array
function DumpSettingArray: array[0..1999] of integer;
var
i: integer;
begin
for i:= 0 to 1999 do
Result[i]:= SmartGetFieldArrayInt(0,SettingsArray,i);
end;

//Returns -1 if no box open or 0..2 for the correct answer to the box
function BoxAnswer: integer;
var
boxIndex: Integer;
begin
boxIndex:= SmartGetFieldArrayInt(0,SettingsArray,312);
if boxIndex = 0 then
result:= -1
else
result:= (boxIndex shr 24) and $FF;
end;

//Returns the current Map angle in degrees
function GetMinimapAngleDeg: extended;
var
clientAngle: integer;
begin
clientAngle:= (SmartGetFieldInt(0,CompassAngle) + SmartGetFieldInt(0,MapOffsetAngle)) mod 2048;
result:= clientAngle * 180 / 1024;
end;

//Returns the current map angle in radians
function GetMinimapAngleRad: extended;
var
clientAngle: integer;
begin
clientAngle:= (SmartGetFieldInt(0,CompassAngle) + SmartGetFieldInt(0,MapOffsetAngle)) mod 2048;
result:= clientAngle * Pi / 1024;
end;

//converts the tile position tileX,tileY to a minimap location
procedure TileToMinimap(tileX, tileY: integer; var screenX, screenY: integer);
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)) + 643;
screenY:= round(tempX*sin(angle) + tempY*cos(angle)) + 84;
end;

//converts the screen position screenX,screenY from the minimap to a tile
procedure MinimapToTile(screenX, screenY: integer; var tileX, tileY: integer);
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;

//converts the tile position tileX,tileY to a mainscreen location
//height is the distance (in px) off the ground
procedure TileToWorld(tileX, tileY, height: integer; var screenX, screenY: integer);
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;

Town

2007-12-27 19:22:58

Huzzah.

XcanadamanX

2007-12-27 21:52:28

its giving me an error :(
Unknown identifier 'SmartGetFieldArrayInt'

probably just me.
someone wanna help me with it on msn tomorrow?
[email]rstevenson23@gmail.com[/email]

BenLand100

2007-12-27 21:59:19

From: XcanadamanX
its giving me an error :(

probably just me.
someone wanna help me with it on msn tomorrow?
[EMAIL="rstevenson23@gmail.com"]rstevenson23@gmail.com[/EMAIL]

Someone didn't copy (or download perhaps?) the plugin :)

Wizzup?

2007-12-28 07:36:03

Cool.
Ben, maybe we should add a smart.scar to the SvN?
Makes it way easier to make 1 global smart.scar….

XcanadamanX

2007-12-28 10:14:33

From: BenLand100
Someone didn't copy (or download perhaps?) the plugin :)


hmm…a possiblility. but id have to say no. anyway ill download again and see.

edit:
hmm…i guess i downloaded to the wrong place. lol :p

BenLand100

2007-12-28 10:18:05

From: Wizzup?
Cool.
Ben, maybe we should add a smart.scar to the SvN?
Makes it way easier to make 1 global smart.scar….

Yea… but then I would have to set up my svn… :rolleyes:

Sumilion

2007-12-28 10:18:05

From: XcanadamanX
hmm…a possiblility. but id have to say no. anyway ill download again and see.

edit:
hmm…i guess i downloaded to the wrong place. lol :p


30 lashes for you young one !

Wizzup?

2007-12-28 11:54:20

From: BenLand100
Yea… but then I would have to set up my svn… :rolleyes:


Oh really? What about the dev SVN. ;)
(No it's not going to become SSRL. But we can easily develop in that SvN.)

mastaraymond

2007-12-28 12:12:25

From: Wizzup?
Oh really? What about the dev SVN. ;)
(No it's not going to become SSRL. But we can easily develop in that SvN.)


Upload the source to the SvN :rolleyes: . We could help you devlop it :p :rolleyes:

Wizzup?

2007-12-28 13:45:31

I added a smart.scar
Without all the constants and reflection things, though.
Benland, mind adding your latest ones?

BenLand100

2007-12-28 14:34:13

From: Wizzup?
I added a smart.scar
Without all the constants and reflection things, though.
Benland, mind adding your latest ones?

By "setup my svn" I meant setup my dev svn ;) But yea, I guess I could :)
Edit: That is… if someone could tell me the address (I do have my name and pass assuming they are the same)

WT-Fakawi

2007-12-28 15:26:29

http://www.srl-forums.com/repos/srl

L/P same as two years ago :)

Renax

2007-12-28 18:04:38

hmm i'm having trouble getting the smart client to initialize on this revision, any ideas on what i could be doing wrong ?

BenLand100

2007-12-28 18:08:16

From: Renax
hmm i'm having trouble getting the smart client to initialize on this revision, any ideas on what i could be doing wrong ?

Nothing related to init has been changed since last version, so its prob just a fluke.

Renax

2007-12-28 18:11:54

yeah, i just noticed it, i had some files mixed up within different scars.

Freddy1990

2007-12-31 07:23:43

I guess it was great for as long as it lasted, they always have to ruin it with tilebased walking and all of that other crap

BenLand100

2007-12-31 11:39:27

From: Freddy1990
I guess it was great for as long as it lasted, they always have to ruin it with tilebased walking and all of that other crap

Thinking out loud by accident or just…?

Freddy1990

2007-12-31 14:26:53

Ben, SMART was great, seriously, imo it was the best rs client extension ever built for SCAR, but I've always been against tilewalking for scar, everyone should know that by now, srr…

EDIT: I feel that tilewalking makes the scripter "lazy" they don't have to preform efforts for complicated walking procedures and such, which if SMART disappears leaves them with the inability to create proper scripts…

The Claw

2008-01-01 00:00:54

First time I tried it just now and its great

BenLand100

2008-01-01 00:47:04

From: Freddy1990
Ben, SMART was great, seriously, imo it was the best rs client extension ever built for SCAR, but I've always been against tilewalking for scar, everyone should know that by now, srr…

EDIT: I feel that tilewalking makes the scripter "lazy" they don't have to preform efforts for complicated walking procedures and such, which if SMART disappears leaves them with the inability to create proper scripts…

If they arn't going to learn in the first place, no harm done, just more good scripts. If they are willing to learn, what's stopping them? The fact that something as simple and integral to good scripts as walking is so complex should lead you to the conclusion that it might not be the best way, but I guess not. Anyway, SMART is still SMART it just provides access to the client. The most beautiful part of this system is that nothing in SMART is client dependent, ie., it will always be there. Its true that the positions in the client change from "week" to "week", however all of that is built in scar with pascal, and with little to no effort could be manually updated by anyone that knows where to look, or can look in the old client and find a pattern to find the new field. Simply put, its no different than maintaining a script, when jagex changes something, you fix your end. This system puts it into the scripter's (and the end user's) control to get the fields from wherever or however they please.

Think about it from this angle, color based walking is complex and inaccurate. For more complexity, you can get more accuracy, correct? Think about the whole process; if you include finding the field, calculating your position, and extrapolating the next position, you end up with an extremely complex (and therefore easier to break) operation but with super-accurate results. In reality, its no different than using a RadialWalk on steroids, you don't have to know how RadialWalk works in order to use it, you just need to know what information to give it in order to get the results you want. If you wanted, you could modify how RadialWalk works to suit your needs, same with this since all of the client-specific parts are written in Scar.

So take what you will, but remember that just because you can slap the same label on everything does not make everything the same. ;)

Freddy1990

2008-01-02 06:36:32

Well, that's just how I feel about it, I guess as wizzup pointed out to me, everyone in here already has the ability of making color based walking procedures, but if it's released to members and/or leaked…

But anyway, I'm just saying, people who'd use this instead of first learning how to walk might just ditch SCAR if SMART'd be gone…

Wizzup?

2008-01-02 08:13:01

This is the future though.
The nature crafter I just made is flawless.
I'd like you to say it's an easy script. :p
The actual minimap walking is approx 70 lines.

Function LoadPath(PathType: String): TPointArray;

Begin
Case PathType Of
'ToGlider':
Result := [Point(3269, 3166), Point(3276, 3174), Point(3281, 3185),
Point(3281, 3193), Point(3282, 3203), Point(3283, 3210)];

'ToLog':
Result := [Point(2971, 2969), Point(2962, 2977), Point(2951, 2979),
Point(2946, 2985), Point(2940, 2994), Point(2932, 3003),
Point(2930, 3014), Point(2921, 3022), Point(2919, 3032),
Point(2914, 3041), Point(2910, 3048)];
'LogToAltar':
Result := [Point(2906, 3049), Point(2901, 3052), Point(2895, 3044), Point(2885, 3041),
Point(2876, 3035), Point(2870, 3027), Point(2868, 3021)];
'ToBank':
Result := [Point(3314, 3235), Point(3308, 3234), Point(3299, 3228),
Point(3295, 3219), Point(3289, 3210), Point(3281, 3203),
Point(3281, 3194), Point(3282, 3185), Point(3278, 3174),
Point(3276, 3167), Point(3269, 3165)];
End;
End;

The rest is pure coding. (700 lines)

Skilling in RuneScape is the new way of Macroing.

BenLand100

2008-01-02 23:30:18

From: Freddy1990
Well, that's just how I feel about it, I guess as wizzup pointed out to me, everyone in here already has the ability of making color based walking procedures, but if it's released to members and/or leaked…

But anyway, I'm just saying, people who'd use this instead of first learning how to walk might just ditch SCAR if SMART'd be gone…

My point is that those people would not be willing to learn SCAR anyway, and therefore would just be leachers or never use SCAR at all. However, SMART might just attract more people to SCAR and at the same time increase the script base of SRL.

@Wizzup, I assume that nature crafter is main account safe if used in moderation? If so, i've got lots of pure essence on an account with 64 runecrafting ;)

Wizzup?

2008-01-03 04:30:18

From: BenLand100
@Wizzup, I assume that nature crafter is main account safe if used in moderation? If so, i've got lots of pure essence on an account with 64 runecrafting ;)


I'm actually testing on my 'new' ( 86 mining :p ) members account.
He's now rc 51. I'm going to add pouches support now. ;)

Banked 40 Times
Used up 1092 Essence.
Crafted 1092 Natures.
Crafting 339 Natures per hour.
Made 273000 Geepees.
Worked For 3 Hours, 12 Minutes and 44 Seconds

It's not super fast.. But hey… it doesn't use pouches and run… And it's a long walk! :p

Anyway, when it's fully finished I'll make a topic and release it. :)

RAM

2008-02-17 20:52:42

Glad to see this is finally released Ben (even though i probably won't use it :P)…I see you're still facing opposition for it, but everyone is entitled to their own opinions…..

My views have certainly changed over the last couple of years, but IMOHO I think this is definitely a step back into the right direction, especially since our characters we are using are more precious to us, good that we can eliminate some of the negative variables that had caused us problems in the past, and concentrate our efforts that will be most rewarding….

Keep up the GREAT WORK !!!!

~RAM

Bobarkinator

2008-02-17 22:40:16

Yay RAM is posted :)