Page 1 of 1

GetTileObject

Posted: Sat Oct 27, 2012 5:27 pm
by enric
With the 206, I found that a scenario we are testing do not work anymore.

I'm not sure, but I think it could be a issue in the objects index , or in the object data.

In a tile there are several objects, a loop try to find the target object.
For (i = 0; i < 99; i+)
{
id = GetTileObject…
if (id != -1)
then check if it's the searched object:

IsObjectName(id, "object")==1)

and keep the index (i) of the object

SetGlobal ("trap_index", i);

Later in another function…

id = GetTileObject(tilex, tiley, GetGlobal("trap_index")

The routine adds a value to the data object, etc., … this was working, but beginning with 206 the data was reset every turn. As I don't know a way to see values debugging in MP ( Log() don't work? ), I could not test efficiency. Probably the object (i) was not the same???.

I'm not sure of which is the problem. But if the tile has only a object, the target one, then it always works.

For the scenario I found a turnaround: I don't use the Global that keep the object index, and I search for the object again in the other functions, and now seems to work, so probably is not a object data issue.

Some adds to the debugger will be welcome :) .

Re: GetTileObject

Posted: Sat Oct 27, 2012 5:49 pm
by pipfromslitherine
Hmmm. I will take a look at it. I can't think what would have changed to affect it. Are you sure you are looking at the correct tile both times? And also, that you are not removing any objects from the tile?

For debugging, you could try running the campaign in single player mode (just make a copy in your CAMPAIGNS folder, rather than the MP folder) and get more info, or add some output to the screen via DrawScenarioUI.

Cheers

Pip

Re: GetTileObject

Posted: Sat Oct 27, 2012 6:16 pm
by enric
pipfromslitherine wrote:
For debugging, you could try running the campaign in single player mode (just make a copy in your CAMPAIGNS folder, rather than the MP folder) and get more info, or add some output to the screen via DrawScenarioUI.

Cheers

Pip
Yes, I always work in single mode before, and when it works there I copy to MP.