SED crashes for unknown reason

Posted By: DestroyTheRunner

SED crashes for unknown reason - 06/19/08 15:09

Hi

After 5 - 7 times I start the engine,after everything work fine I press ESC to close the engine and return to SED.. and then SED crashes and tells me to close it.
BUT
I noticed that it only happens if my script calls this function.

If i dont call this function, I can call the engine 1000000 times withuot any apparent error.

Here´s the code
Quote:

function SEARCH_DESTINO()
{
var temp_destino;
var temp_tipo[3];
var n;

while(my.found_destiny == 0)
{


path_scan(my,my.x,my.pan,vector(360,0,9000));
temp_destino = path_scannode(my, n);

path_getnode(my,temp_destino, null,temp_tipo[0]);

if(temp_tipo[0] == my.destiny_type)
{
my.alvo = temp_destino;
my.found_destiny = 1;

}

n += 1;
}
}


repeatin:
If my script calls this function, after 5 or 7 times, SED crashes after i close the engine.

PS1.THE GAME RUNS FINE ALL THE TIMES, IT ONLY CRASHES WHEN I CLOSE THE ENGINE.

PS2. IF I COMPILE MY GAME, I DONT HAVE THIS PROBLEM! AND THE GAME RUNS FINE!

please help, its beyound my comprehension!
Posted By: rstralberg

Re: SED crashes for unknown reason - 06/19/08 20:49

Hi

You have forgot to initialize n to 0

var n = 0 ;

Edit:

You may also need this in your while loop
to ensure you don't overwrite you buffer

while(my.found_destiny == 0 && n < 3 )

Posted By: DestroyTheRunner

Re: SED crashes for unknown reason - 06/20/08 18:46

no my friend... none of that work.

And still code works fine, it only crashes when i close the egine.
Please new people read the first post,everything is explained there.

PLEASE HELP!
thanks!
Posted By: frazzle

Re: SED crashes for unknown reason - 06/20/08 20:38

Trouble shooting can be harsh and sometimes the biggest errors are due to very very small mistakes that even can't be seen by the best programmers wink wink

The solution is simple, you use a while expression but you don't end it with a wait instruction.
Normally the engine should indicate an endless loop event but I guess your if-clause overrules the call since you use a 'x++ algoritme' at the end AFAIK. Thus, when ending the application, the thing will crash as you end the 'x++ algoritme'.

Cheers

Frazzle

Posted By: DestroyTheRunner

Re: SED crashes for unknown reason - 06/20/08 21:22

I thought about that when I was going to bed last night ( As you can see this problem is even taking my nights from me). I havent tried yet.
But I also thought is ,that the way I put the objects on the level, the while loop is ALWAYS broke in the same way,and the same time, because the game starts the same everytime, same objects and same positiions and same everything.. but it will ONLY CRASH AFTER THE 5 OR 7 TIME!

ps. I need it to be a fast function, a wait in there shouldnt be a good idea.
Ill try anyway.

Thanks frazzle but Still if new readers care to read the first post and try to help me, i appreciate.
Posted By: flits

Re: SED crashes for unknown reason - 06/20/08 21:28

temp_destino[0]

i once get a realy big terain bug when i didnt asing the [0] brackets
and yes this doesnt needs to be a problem
Posted By: DestroyTheRunner

Re: SED crashes for unknown reason - 06/20/08 21:29

ok just tried it, using the wait(1);

Doesnt work...after closing the engine by the 5-7th time, crashes the entire SED.

I´ve got a insomnia because of that already frown


help!
Posted By: frazzle

Re: SED crashes for unknown reason - 06/20/08 21:59

Maybe you're in a quest for a SED bug rather then a bug in your initial script itself. SED crashes in A7 crashes too with the use of a syntax correct algorithm from time to time at my end here. Thus I suggest you keep on doing the same test for one single day and write down when it crashes. The day after tomorrow, you simply report this at the bug hunt section to see if they confirm the error wink wink

Thanks in progress

Frazzle
Posted By: DestroyTheRunner

Re: SED crashes for unknown reason - 06/20/08 22:21

ok
actually I already did it. Its been like that sinec wednesday i think AND i noticed that If i dont call this function at all, it never crashes.
Thats why I posted it here, because i think sometings is wrong with this code.
If not, then everything is narrowed to Bug Hunt forum. frown
Posted By: testDummy

Re: SED crashes for unknown reason - 06/21/08 01:55

"sometings is wrong with this code"

cached from yesterday:
1. uninitialized locals (mentioned)?
2. NULL passed not NULLVECTOR?
3. path skills array is 3 elements instead of 6 or NULL? ***
4. bad logic / structure?

Posted By: DestroyTheRunner

Re: SED crashes for unknown reason - 06/23/08 17:45

@testDummy

Thank you
the problem was at the Item number 3... problem is that the max local array is [3].
So I defined it as Global and put [6] and worked fine!
The only thing im affraid is that 'simultaneously' other entities will call this function, and the global value of Temp_tipo[6] give wrong values to wrong entities.

anyway thanks!
Posted By: testDummy

Re: SED crashes for unknown reason - 06/23/08 23:37

Temp_tipo[6];
global reuse issue

Imagine:
*Entities are in a list.
*For those caught in a while, when wait(1) is encountered for each such entity, that entity is put aside and the next entity in the list gets its turn.
*Thus, globals can be somewhat safe from undesirable modification by other entities when a certain policy is applied.

nextEntity:
n++;
me = entity[n]; etc.
entity[n] invokes SEARCH_DESTINO and uses path skills array
entity[n] is done with path skills array
wait(1); = goto(nextEntity);
Posted By: DestroyTheRunner

Re: SED crashes for unknown reason - 06/24/08 20:46

ok i see
I ALMOST understood all. lol

Until now is working fine, ill see when more entities are in the level and then ill see.

thanks testdummy smile
© 2024 lite-C Forums