SRL Archive - News

[Reflection]Update 2/24/2015


Kyle

2015-02-24 13:32:05

Sorry it has been so long since the last update, I have been really busy working on some really big changes to the include on a dev branch of it. I ended up changing a lot of what I original wrote, but It is now committed to the main branch.

Note: This was a rather large update and most, if not all current reflection scripts will break from it, and since I also changed the folder setup, you may have to reinstall the include from github. This should be the last update that breaks anything and if all goes well, will be out of beta quite soon!

Changes:
[INDENT]
  • No longer uses a record to store data for non static objects, uses Get methods now.
  • All non static objects reference live within the variable itself, so there is no need to loop .Get/.Find method to keep the object updated
  • Adds a lot of static functions to bank and inventory items
  • Adds Non static dropping functions to Inventory Items
  • Changes the Folder configuration to be more organized
  • Adds Graphics.simba
  • Removes a lot of Reflect.Internals functions, now placed in correct naming
  • GetMSPoint is added to all objects. objGame finding is now 100% accurate
  • Removes InventoryItem.Click
[/INDENT]

Upcoming:
[INDENT]
  • More small name changes
  • Documenting the include
[/INDENT]

Please use the suggestions and bugs forum if need be.

There has been a complete change to how memory is handled in the include when it comes to non static objects. The only thing that will be held in the record that is of use, is the actually reference to the object in memory. This makes the include now incredible fast and efficient compared to how it was. While scripts can be written is a similar manner to how they used to be done, I will update the tutorial and post some snippets of how to use it, and some errors that may have to be fixed on current scripts

Fitta

2015-02-24 14:52:48

:wowzers:

Myke

2015-02-24 18:47:45

From: elfyyy

  • GetMSPoint is added to all objects. objGame finding is now 100% accurate



This is very noticable, great work.

Only took around 5 minutes to fix a script after breaking from the update, though others might have had more dependencies.

Kyle

2015-02-24 19:38:26

From: Myke
This is very noticable, great work.

Only took around 5 minutes to fix a script after breaking from the update, though others might have had more dependencies.


:)

Please check out the Tutorial, as I just updated it for today's update.

Also, here is a snippet showing the major difference with the new memory handling and how it can be used to speed up a script


program Meh;

{$DEFINE SMART}
{$i Reflection/Reflection.simba}

var
Guard: TReflectNpc;
Me: TReflectLocalPlayer;

begin
Me.Username := 'UN';
Me.Password := 'Pass';
Me.Active := True;
Reflect.Setup;
Me.Login;
ClearDebug;

{ Old Way }

if Guard.Find('Guard') then
begin
Reflect.Mouse.Move(Reflect.Tiles.TileToMs(Guard.Tile), 2, 2);
Reflect.Mouse.Click(Mouse_Left);
while Guard.Health > 0 do
begin
//Antiban
//EatFood
Guard.Find('Guard'); //Have to find Guard again to 'Refresh' the record
end;
end;

if Guard.Find('Guard') then
begin
Reflect.Mouse.Move(Guard.GetMSPoint, 2, 2);
Reflect.Mouse.Click(Mouse_Left);
while Guard.GetHealth > 0 do //Guard.GetHealth is an actual function now, returning the guards current Health, so no need to 'refresh'
begin
//Antiban
//EatFood
end;
end;
end.

Floor66

2015-02-27 10:32:09

Awesome! Fixed my script in a few minutes too :) There's one slight inconsistency I've noticed:

In widgets/gametab/Inventory.simba the function for translation to a mainscreen point is called 'TReflectInvItem.GetMainScreenPoint', whereas in other parts of the include (NPC, GroundItem) it is called 'xxx.GetMSPoint'

Kyle

2015-02-27 12:40:10

From: Floor66
Awesome! Fixed my script in a few minutes too :) There's one slight inconsistency I've noticed:

In widgets/gametab/Inventory.simba the function for translation to a mainscreen point is called 'TReflectInvItem.GetMainScreenPoint', whereas in other parts of the include (NPC, GroundItem) it is called 'xxx.GetMSPoint'


Ah, thanks for that! Just pushed the fix :)