SRL Archive - Reflection Help

Reflection tree tracking?


Harry

2011-03-19 12:52:20

Anyone know a nice simple way for tracking if a tree (willow) is still alive, using Reflection?

I am using something like:
//Spaghetticode
GetObjectByIDEx([5551,5552,5553], OBJECT_TYPE_INTERACTABLE, 10);
TileToMs(etc);
Mouse(etc,True);
repeat wait until GetAnimation = -1;

Works great, problem happens when you get "beat", and will continue to chop for a few seconds when the tree no longer exists.

Color could probably do it great, but I want a method using Reflection is anyone has some ideas… preferably one simple and not very "mathy".

Thanks~

Emaziz

2011-03-19 12:55:12

If object ID changes when it's cut, you could use FindRSObject

Harry

2011-03-19 12:57:14

Yeah, it does, but there's a group of 4 trees there close together (Port Sarim). Don't know a good way to track the actual one that I clicked on… silly as it sounds.

Some way to get the tile of where I clicked, then I can search for the stump on that tile?

Feroc1ty

2011-03-19 12:57:23

Well GetObjectByID works, except you're waiting for the animation to finish, you'd have to create a function to check if the object exists every 50-200 MS, since every time you receive object data it's for that specific instance, rather than an actual variable from the game.

EDIT: Create a variable to maintain the value of the object it found, and track that specific object, after it's finished doing the job, simply continue the loop?

Emaziz

2011-03-19 13:01:47

Ops

TomTuff

2011-03-19 13:04:16

You need to have a preset list of all the trees as well. Know the last tree you clicked, compare that to the tile array, and check for the stump object.

Emaziz

2011-03-19 13:05:41


// Sample
obj := GetObjectByID(TREE);
tile := obj.Tile;
while obj = GetObjectAt(tile) do
wait(100);

Harry

2011-03-19 13:12:24

From: Emaziz

// Sample
obj := GetObjectByID(TREE);
tile := obj.Tile;
while obj = GetObjectAt(tile) do
wait(100);

Haha oh hoh. I had something just like this only I didn't do .tile for some reason >_> I understand it now, that seemed really simple now, "derp moment". Thanks everyone.

Floor66

2011-03-19 13:13:47

The thing I do is make a list of the trees I'm gonna be using.
For example (from my Willpower script):

//Global variables btw
Trees[0] := Tile(3084, 3238);
Trees[1] := Tile(3086, 3236);
Trees[2] := Tile(3089, 3234);
Trees[3] := Tile(3088, 3232);
Trees[4] := Tile(3089, 3228);

That's in draynor village, btw. Furthermore, I have this func:

function TreeIsUp(Tree : Integer): Boolean;
var
treeObj : TRSObject;
begin
treeObj := GetObjectAt(Trees[Tree], OBJECT_TYPE_INTERACTABLE);
Result := (treeObj.ID = 5551) or (treeObj.ID = 5552) or (treeObj.ID = 5553); //these are the ID's that I just datamined.
treeObj := NULL_RSObject; //no mem leaks pls? plspls ;d
end;

The while chopping, I just do

current_tree := Blablablasuperfunctofindclosest_tree_byusingthetiles;
ClickTree(TileToMS(current_tree));
while TreeIsUp(current_tree) do
begin
//anti ban shit, etcetc
end;

This way I can chop at like the same speed as legit because the ID of a tree changes a split second before its' change is visible on the screen. Gives me just the edge I need.

edit:
aww darnit you just posted as I was posting this.

Emaziz

2011-03-19 13:14:00

From: Harry
Haha oh hoh. I had something just like this only I didn't do .tile for some reason >_> I understand it now, that seemed really simple now, "derp moment". Thanks everyone.


:thumbsup:

Flight

2011-03-19 21:19:58

Do what I did, use both reflection and color to find trees. Reflection to find the tree tile, then search within a X/Y radius of that point for the tree's color and UpText.

Yago

2011-03-19 21:21:45

Yeah harry sometimes your cutter searches like .5 - 1.5 secs looking for the correct uptext. cause its off only by a few pixels

rogeruk

2011-03-21 15:00:10

Simple? Just check the object is no longer there?.

InIntArray, GetObjectAt. Wolla