I don't know, I probably asked a stupid question but the function is named HooksValid after all :blushing:.
Thanks for explaining.
Hmm.. okay.
Do you have a link which can lead me to somewhere I can learn more about these "hooks" ?
Printable View
I don't know, I probably asked a stupid question but the function is named HooksValid after all :blushing:.
Thanks for explaining.
Hmm.. okay.
Do you have a link which can lead me to somewhere I can learn more about these "hooks" ?
There were two updates today for OSRS.
It's also one of the few hooks you can access from the login screen :p GameState would be a better name for the hook I know (b/c it also handles rendering state).
I know most people's updaters don't support the hooks which we use. Especially people who didn't make their own updater.
The f2p update has been a hassle, I think they were paranoid about java bots on f2p.
We're still working on hooks, elfyyy is MIA.
How do you make ur own updater? How does these hooks work? Could one of you merciful gods show us how to make fire? :redface:
Hooks have been updated, just run a reflection script and they'll auto-update.
You know the drill people, if anything's not working post it here and we'll take a look as soon as we can :)
I'm glad to see some of the reflection developers are staying active on this project. Regardless of if I use it or not I'm always pleased to see teamwork, as everyone on SRL is in the same boat; keep up the good work team! :thumbsup:
I'm active, now like me! :(
Hmm..? Getting an out of range at line 465 in Tiles.simba :
Code:Confirmed : needtobank.
Error: Out Of Range at line 465
The following DTMs were not freed: [SRL - Lamp bitmap, SRL - Book of Knowledge, 2, 3]
Simba Code:.. note::
by Frement < line 465
*)
function R_TileToMSEx(X, Y, Height: Extended): TPoint;
var
SetupReflection is called in the script.
I'm finding that R_WalkPath is broken. Worked before the update now seems to be completely off, seems to want to go in the opposite direction to where it is supposed to.
Found 3 bad multipliers in the client.. Tested R_InteractTile and R_WalkToTileMM, both are working well. I missed them when I checked the tiles :3
Now works (not using same script as before though), thanks very much for all the effort you guys put into this project.
Yeah everything I'm using is working great now, thanks guys!
Hahaha one of the reflection functions I use in my script was broken (dunno which, likely a tile function). I woke up this morning and hit start on my law crafter before I went to school. I failsafed the fk out of my script to make it basically never end by teleporting back to castle wars and restarting if there's a problem. Burned through over 300 rings of dueling xD
works fine now after auto updating. TY all reflection devs <3 <3 <3
Have just made some model clicking methods, and resurrected a Dijkstra's algorithm path generator (Finds the shortest path taking into account the obstacles). Am going to test them after lunch. Also got my updater to post to a static URL as it will be needed to get the hooks required for the functions I have just created (No support for collision maps/Object_Renderable in current ones)
These are completely untested at the minute. Just ported them from my Java bot...
Will test and fix later tonight
Simba Code:Type TModel = Record
xVertices, yVertices, zVertices : TIntegerArray;
xIndices, yIndices, zIndices : TIntegerArray;
tile: TPoint;
verticesLength, indicesLength: Integer;
end;
TModelArray = Array of TModel;
function NULL_MODEL: TModel;
begin
with Result do
begin
Tile := Point(0, 0);
end;
end;
(*
R_NewModel
~~~~~~~~~~~
.. code-block:: pascal
function R_NewModel(obj : Integer): TModel;
Generates a TModel from a Java model
.. note::
by Cheddy
*)
function R_NewModel(obj : Integer): TModel;
var
i : Integer;
begin
with Result do
begin
verticesLength := SmartGetFieldInt(SmartCurrentTarget, obj, Model_VerticesLength);
indicesLength := SmartGetFieldInt(SmartCurrentTarget, obj, Model_IndicesLength);
for i := 0 to verticesLength do
begin
xVertices[i] := SmartGetFieldArrayInt(SmartCurrentTarget, obj, Model_VerticesX, i);
yVertices[i] := SmartGetFieldArrayInt(SmartCurrentTarget, obj, Model_VerticesY, i);
zVertices[i] := SmartGetFieldArrayInt(SmartCurrentTarget, obj, Model_VerticesZ, i);
end;
for i := 0 to indicesLength do
begin
xIndices[i] := SmartGetFieldArrayInt(SmartCurrentTarget, obj, Model_IndicesX, i);
yIndices[i] := SmartGetFieldArrayInt(SmartCurrentTarget, obj, Model_IndicesY, i);
zIndices[i] := SmartGetFieldArrayInt(SmartCurrentTarget, obj, Model_IndicesZ, i);
end;
end;
end;
(*
R_GetWorldObjectModel
~~~~~~~~~~~
.. code-block:: pascal
function R_GetWorldObjectModel(ob : Integer): TModel;
Gets the model associated with a world object
.. note::
by Cheddy
*)
function R_GetWorldObjectModel(ob : Integer): TModel;
var
obj : Integer;
begin
obj := SmartGetFieldObject(SmartCurrentTarget, ob, WorldObject_Renderable);
Result := R_NewModel(obj);
Result.tile := Point(SmartGetFieldInt(SmartCurrentTarget, ob, WorldObject_Get_X) * WorldObject_Get_X_Multiplier, SmartGetFieldInt(SmartCurrentTarget, ob, WorldObject_Get_Y) * WorldObject_Get_Y_Multiplier);
SmartFreeObject(SmartCurrentTarget, obj);
end;
(*
R_GetBoundaryObjectModel
~~~~~~~~~~~
.. code-block:: pascal
function R_GetBoundaryObjectModel(ob : Integer): TModel;
Gets the model associated with a boundary object
.. note::
by Cheddy
*)
function R_GetBoundaryObjectModel(ob : Integer): TModel;
var
obj : Integer;
begin
obj := SmartGetFieldObject(SmartCurrentTarget, ob, BoundaryObject_Renderable);
Result := R_NewModel(obj);
Result.tile := Point(SmartGetFieldInt(SmartCurrentTarget, ob, BoundaryObject_Get_X) * BoundaryObject_Get_X_Multiplier, SmartGetFieldInt(SmartCurrentTarget, ob, BoundaryObject_Get_Y) * BoundaryObject_Get_Y_Multiplier);
SmartFreeObject(SmartCurrentTarget, obj);
end;
(*
R_GetFloorDecorationObjectModel
~~~~~~~~~~~
.. code-block:: pascal
function R_GetFloorDecorationObjectModel(ob : Integer): TModel;
Gets the model associated with a floor decoration object
.. note::
by Cheddy
*)
function R_GetFloorDecorationObjectModel(ob : Integer): TModel;
var
obj : Integer;
begin
obj := SmartGetFieldObject(SmartCurrentTarget, ob, FloorDecorationObject_Renderable);
Result := R_NewModel(obj);
Result.tile := Point(SmartGetFieldInt(SmartCurrentTarget, ob, FloorDecorationObject_Get_X) * FloorDecorationObject_Get_X_Multiplier, SmartGetFieldInt(SmartCurrentTarget, ob, FloorDecorationObject_Get_Y) * FloorDecorationObject_Get_Y_Multiplier);
SmartFreeObject(SmartCurrentTarget, obj);
end;
(*
R_GetWallObjectModel
~~~~~~~~~~~
.. code-block:: pascal
function R_GetWallObjectModel(ob : Integer): TModel;
Gets the model associated with a wall object
.. note::
by Cheddy
*)
function R_GetWallObjectModel(ob : Integer): TModel;
var
obj : Integer;
begin
obj := SmartGetFieldObject(SmartCurrentTarget, ob, WallObject_Renderable);
Result := R_NewModel(obj);
Result.tile := Point(SmartGetFieldInt(SmartCurrentTarget, ob, WallObject_X) * WallObject_X_Multiplier, SmartGetFieldInt(SmartCurrentTarget, ob, WallObject_Y) * WallObject_Y_Multiplier);
SmartFreeObject(SmartCurrentTarget, obj);
end;
(*
R_GetPolygons
~~~~~~~~~~~
.. code-block:: pascal
function function R_GetPolygons(model : TModel): T2DPointArray;
Gets the clickable polygons for a model.
.. note::
by Cheddy
*)
function R_GetPolygons(model : TModel): T2DPointArray;
var
p1,p2,p3 : TPoint;
polys : T2DPointArray;
i : Integer;
begin
for i := 0 to High(model.xVertices) do
begin
p1 := R_TileToMSEx(model.tile.x + model.xVertices[model.xIndices[i]],model.tile.y + model.zVertices[model.xIndices[i]], 0 - model.yVertices[model.xIndices[i]]);
p2 := R_TileToMSEx(model.tile.x + model.xVertices[model.yIndices[i]],model.tile.y + model.zVertices[model.yIndices[i]], 0 - model.yVertices[model.yIndices[i]]);
p3 := R_TileToMSEx(model.tile.x + model.xVertices[model.zIndices[i]],model.tile.y + model.zVertices[model.zIndices[i]], 0 - model.yVertices[model.zIndices[i]]);
if((p1.x >= 0) and (p2.x >= 0) and (p3.x >= 0)) then
begin
polys[High(polys)] := [p1, p2, p3];
end;
end;
result := polys;
end;
(*
R_RandomModelPoint
~~~~~~~~~~~
.. code-block:: pascal
function R_RandomModelPoint(model : TModel): TPoint;
Gets a random clickable point within a TModel
.. note::
by Cheddy
*)
function R_RandomModelPoint(model : TModel): TPoint;
var
atpa : T2DPointArray;
tpa : TPointArray;
tempPoint : TPoint;
i : Integer;
begin
atpa := R_GetPolygons(model);
for i := 0 to 100 do
begin
tpa := atpa[RandomRange(0, High(atpa))];
tempPoint := Point(tpa[RandomRange(Low(tpa), High(tpa))].x,tpa[RandomRange(Low(tpa), High(tpa))].y);
if(PointInBox(tempPoint, MSBox)) then
begin
result := tempPoint;
exit;
end;
end;
if(not PointInBox(tempPoint, MSBox)) then
begin
result := Point(-1, -1);
exit;
end;
end;
(*
R_ClickModel
~~~~~~~~~~~
.. code-block:: pascal
function R_ClickModel(model : TModel, left : Boolean): Boolean;
Returns whether the NPC is moving or not.
.. note::
by Cheddy
*)
function R_ClickModel(model : TModel; button : Variant): Boolean;
var
p : TPoint;
begin
p := R_RandomModelPoint(model);
if(not PointInBox(p, MSBox)) then
begin
result := false;
exit;
end;
Mouse(p.x,p.y,0,0, button);
result := true;
end;
It doesn't work as of yet. It grabs the model correctly, but veryyyy slowly as Simba has to crunch a lot of numbers and being an interpreted language makes it very slow at that. So I need to find a new way of implementing the model grabber; and need to adjust R_GetPolygons so it uses a list instead of an array
I think your bottleneck is the calls to R_TileToMSEx. Check out how we did it a while back: https://github.com/Drags111/Kronos/b...ers/Model.scar
Oh, I didn't know there was a TPolygon, that would have made thing a whole lot easier ;)
That's a class made with a different script compiler...
Hey, it's mormonman ;)
You were the one who told me that my cacheable node hooks were wrong in R45 ;)
I didn't know you were a dev here haha, How is the updater coming along?
Can someone please explain what a model is ?
Players, plants, trees, npcs all have models like this:
http://i.imgur.com/Lh1XpOF.png
A model is a collection of triangles making up any 3 dimensional object.
Vertices are the 3D points:
[100, 100, 100]
[200, 100, 100]
[200, 200, 100]
[100, 200, 100]
Indices are the indexes of the 3D point array making a triangle
[0,1,2]
[0,2,3]
This would make two triangles, making up a square.
It is ineffecient for a simba bot. Het gets all indices and vertices. Uses non of the indices though. Note that for every ellement in an array a call to Smart has to be made(slow-ish). He then transforms every vertex to a 2D point(slow). Then loops randomly through 100 of them to check which one is on the mainscreen.
Basically the code is good for grabbing an entire model. But for a simba bot grabbing individual points and transforming them one by one till you got a point on your mainscreen would be way faster.
e: I was wrong, he does use the indices. my bad. My theorie still stands though.
This sounds like a rant(it is not)
The only thing I could speed up without completly changing how it works is this:
Simba Code:function R_GetPolygons(model : TModel): T2DPointArray;
var
p1,p2,p3 : TPoint;
polys : T2DPointArray;
i, j : Integer;
begin
for i := 0 to High(model.xVertices) do
begin
p1 := R_TileToMSEx(model.tile.x + model.xVertices[model.xIndices[i]],model.tile.y + model.zVertices[model.xIndices[i]], 0 - model.yVertices[model.xIndices[i]]);
p2 := R_TileToMSEx(model.tile.x + model.xVertices[model.yIndices[i]],model.tile.y + model.zVertices[model.yIndices[i]], 0 - model.yVertices[model.yIndices[i]]);
p3 := R_TileToMSEx(model.tile.x + model.xVertices[model.zIndices[i]],model.tile.y + model.zVertices[model.zIndices[i]], 0 - model.yVertices[model.zIndices[i]]);
if((p1.x >= 0) and (p2.x >= 0) and (p3.x >= 0)) then
begin
polys[High(polys)] := [p1, p2, p3];
end;
end;
result := polys;
end;
A cube has 8 points, 6 sides, 12 triangles which got 36 points. You loop through the indices, thus projecting all 36 points. Faster would be(untested/in my head):
Simba Code:function R_GetPolygons(model : TModel): T2DPointArray;
var
p1,p2,p3 : TPoint;
projectedPts, polys : T2DPointArray;
i : Integer;
begin
SetLength(projectedPts, Length(model.xVertices));
for i := 0 to High(model.xVertices) do
projectedPts := R_TileToMSEx(model.tile.x + model.xVertices[i],model.tile.y + model.zVertices[i], 0 - model.yVertices[i]);
for j := 0 to High(model.xIndices) do
begin
p1 := projectedPts[model.xIndices[j]];
p2 := projectedPts[model.yIndices[j]];
p3 := projectedPts[model.zIndices[j]];
if((p1.x >= 0) and (p2.x >= 0) and (p3.x >= 0)) then
polys[High(polys)] := [p1, p2, p3];
end;
result := polys;
end;
@fishy1328 After writing this in browser I noticed something odd. Your for loop goes to High(model.xVertices) instead of High(model.xIndices). Why? Also I noticed indices having an x, y and z value. I just assume these are the indices of the corners of the triangles?
I really need to make a polygon class like they used to have. Got exams for the next few days then I'll look at it. Yes BB, the indices are the triangle corners and the codes should go to high(indicesX) :-)
Nice mesh flight, I never figured how to hide the object without using bytecode to spoof the renderer and load the mesh instead :-D
I think I have perfected it. Will test later today :-)
Simba Code:[Error] C:\Simba\Includes\SRL-OSR\SRL\core\mapwalk.simba(20:8): Unknown identifier 'R_TileToMM' at line 20
Too late/early for me to try solve atm, please if someone can tell me the solution; Probably a easy fix.
Cheers.