SRL Archive - Reflection Help

how to find out if an obj (tree) is cut or not?


fre

2010-06-01 11:54:08

I have the ID of the trees but i can't seem to find a good procedure for it.

HyperSecret

2010-06-01 12:03:29

Assuming you are using reflection (since you say you have the ID). You don't need to check if the tree is gone or not. Simply just check to see if your player is animating (chopping). If he is chopping then the tree is still there, if he is not chopping then the tree is gone.

fre

2010-06-01 12:16:33

Yes that is a simple solution and that is how i have done it before.
But this is not sufficient.

When my player arrives at a tree that is already cut it dont animate
and it keeps searching for the tree

and i don't want to make a loop with tries
and if it fails after # ammount of tries it goes to find another tree.

This is not human like and waste time.


I just have to check if the tree is there or not.
I was thinking about this

[php]
Object1 := GetObjectByID(1309,0,10);

begin

if FindRSObject(Object1) then
begin
writeln('object is found')
end;
end;
[/php]

But i get this error:
Error: Could not call proc at line 294 in objects.simba

aran armath

2010-06-01 12:19:34

From: fre
Yes that is a simple solution and that is how i have done it before.
But this is not sufficient.

When my player arrives at a tree that is already cut it dont animate
and it keeps searching for the tree

and i don't want to make a loop with tries
and if it fails after # ammount of tries it goes to find another tree.

This is not human like and waste time.


I just have to check if the tree is there or not.
I was thinking about this

[php]
Object1 := GetObjectByID(1309,0,10);

begin

if FindRSObject(Object1) then
begin
writeln('object is found')
end;
end;
[/php]


Why not just use good old fashioned colors?

fre

2010-06-01 12:21:37

Well i spend alot of time on a function to find out if i am cutting the tree and the tree
is chopped down, to notice this.

I succeed, but now i dont have a function to see if my player arrives and the tree is ALREADY chopped down. I don't like to mmouse to find the uptext because this is supsecious and not human like.

Drakan

2010-06-01 16:00:43

From: fre
Well i spend alot of time on a function to find out if i am cutting the tree and the tree
is chopped down, to notice this.

I succeed, but now i dont have a function to see if my player arrives and the tree is ALREADY chopped down. I don't like to mmouse to find the uptext because this is supsecious and not human like.


The ID of a tree is different when it is chopped down ;) Same with mined rocks, or anything of the likes. So check just to see if the id of the tree you're cutting is at the tile you're cutting.

fre

2010-06-01 16:54:07

That is what i am doing here?
[php]
Object1 := GetObjectByID(1309,0,10);

begin

if FindRSObject(Object1) then
begin
writeln('object is found')
end;
end;
[/php]

But this gives me an error in objects.simba

Drakan

2010-06-01 17:11:30

From: fre
That is what i am doing here?
[php]
Object1 := GetObjectByID(1309,0,10);

begin

if FindRSObject(Object1) then
begin
writeln('object is found')
end;
end;
[/php]

But this gives me an error in objects.simba


and that error is…?

fre

2010-06-01 17:38:31

Error: Could not call proc at line 294
in objects.simba

[php]
{*******************************************************************************
function GetObjectByIDEx(IDs: TIntegerArray; objType, MaxDist: Integer): TRSObject;
By: Drags111
Description: Returns the nearest object with one of the IDs. Sorted from closest
to your character to farthest. //this is line 294!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MaxDist: This is the maximum distance from your player you wish to
search. The smaller the number, the faster the search is
completed. The maximum is 52.
*******************************************************************************}
[/php]

JPHamlett

2010-06-01 18:11:18

post your whoel script plz

masterBB

2010-06-02 11:07:26

I would use:
Const
treeTile
treedIDCut

/--------------------------/

begin
object := getObjectAt(treeTile,0);
if object.ID = treeIDCut then
begin
writeln('tree is down :( ')
end else
begin
writeln('tree is not down :) ')
end;
end;

e: added smillies in the writeln

fre

2010-06-05 11:19:55

nice smilies :)

Thx for the help this works.