Author Topic: containerRadiusSearch, code cleaning  (Read 544 times)

Can someone explain exactly how containerRadiusSearch-es work? I know that they look for all of a specific object in an area, but in what order does it show them?

Also, what are some common mistakes in coding that make it harder to work with?

And how do I 'protect' a looping function (schedule(x, 0, self)) so if it has a copy of itself running it will end said copy?
« Last Edit: March 11, 2012, 10:14:47 AM by ThinkInvisible »

Can someone explain exactly how containerRadiusSearch-es work? I know that they look for all of a specific object in an area, but in what order does it show them?

I believe they show in order of object ID lowest to highest, although I'm not certain.

Also, what are some common mistakes in coding that make it harder to work with?

Excessive/missing parenthesis, among others.

And how do I 'protect' a looping function (schedule(x, 0, self)) so if it has a copy of itself running it will end said copy?

Code: [Select]
function loop()
{
cancel( $loop );

echo( "Schedule test: " @ getSimTime() - $lastLoopTime );
$lastLoopTime = getSimTime();

$loop = schedule( 480, 0, "loop" );
}

Not sure about your first question

Common mistakes that people make are missing semicolons, parenthesis, etc.
Mistakes that make code "harder to work with" are things like messy formatting. They don't break the code themselves, but they do make it a lot harder to find things that do break the code.

As for the third question, what Port said, though I don't see any point in the middle part other than console spam

Mistakes that make code "harder to work with" are things like messy formatting. They don't break the code themselves, but they do make it a lot harder to find things that do break the code.
This is what I'm talking about. Some things that a lot of people do that you don't really need to.

It's more like not doing things you almost need to
I can't really think of anything that people do, but don't need to
« Last Edit: March 11, 2012, 06:09:31 PM by Headcrab Zombie »

As for the third question, what Port said, though I don't see any point in the middle part other than console spam

That was an example.