Jump to content
Sign in to follow this  
barbolani

.rpt forensics

Recommended Posts

Hello,

At some "random" point in Antistasi .rpt is flooded with an error in a BIS function I am not using: BIS_fnc_sotrBy. Around 1MB per minute...

As I said, I'm not using it, but prably it has been called by another BIS_fnc, which fed sortBy with some wrong data and caused the error.

The problem: there is no previous error in rpt which lead to what function / script is failing.

I tried to review the most probable, for example I use a lot BIS_fnc_nearestPosition but no joy, as in the function viewer I cannot find a call to sortBy.

I need you script gurus: is there a way to manage the rpt or do whatever test to know where is the error?

Thanks in advance!

Share this post


Link to post
Share on other sites

Did you already check other BIS functions you use besides nearestPosition?

Are you running any third party scripts or mods?

Any other scripts running that you didn't think of checking?

Other than that no idea, sounds weird.

Cheers

Share this post


Link to post
Share on other sites

No, not yet, I use a lot BIS_fnc: a modification of spawnGroup, selectRandom, findSafePos, arrayShuffle, dirTo, spawnVehicle....

Third party scripts: UPSMon, BTC Quick revive, a very tuned zoolo75 Persistant Save and a client side Tags. The rest is mine.

UPSMon is out of suspect as is used by lot of people and, despite it gives error too often, is not this kind.

Antistasi involves around let's say 80 scripts interacting with each other. Trying to track any error without knowing the script which is failing is very hard. Anyway I reviewed the most common cycle of things with no success, but that means nothing.

Thanks GoM!!!

BTW the specific error:

_sortedArray set [count _sortedArray,_selectedItem];

_sortedValues set [count>

18:09:08 Error position: <_selectedItem];

_sortedValues set [count>

18:09:08 Error Undefined variable in expression: _selecteditem

18:09:08 File A3\functions_f\Arrays\fn_sortBy.sqf, line 131

Share this post


Link to post
Share on other sites

Its probably a bis function or command you use that calls BIS_fnc_sortBy. I belive nearestObjects uses this function because if more than one object is found they will be ordered in array according to their distance.

There are probably other bis fncs or commands that use this function as well. Pay attention to when it is happening and what code/scripts are running at that point to help track it down.

Share this post


Link to post
Share on other sites

When I find it I try to exec all the scripts in the same environment it happened, one by one, and nothing happens.

As there may be 80 scripts running at the same time, probably Im missing something.

Or maybe that function is not working well???? I say this with lots of prudence..

Looking at the function, and the part which is failing:

while {count _values > 0} do {

private["_selectedValue","_selectedItem","_selectedIndex"];

_selectedValue = _initValue;

{

if (call _sortCode) then

{

_selectedValue = _x;

_selectedItem = _unsortedArray select _forEachIndex;

_selectedIndex = _forEachIndex;

};

}

forEach _values;

//store selected

_sortedArray set [count _sortedArray,_selectedItem];

_sortedValues set [count _sortedValues,_selectedValue];

//remove stored from source pool

_unsortedArray set [_selectedIndex,_removeElement];

_unsortedArray = _unsortedArray - [_removeElement];

_values set [_selectedIndex,_removeElement];

_values = _values - [_removeElement];

};

I'm not trying to understand nothing, but: undefined variable _selectedItem is because that variable is not defined, so, the if (call _sortCode) returns false, that variable wont be defined and function will fail.

Isn't it?

Share this post


Link to post
Share on other sites

Hi!

I tried to call that function with wrong data (null objects, nil variables thing like that). Despite I cannot reproduce the SAME ERROR, it seems like this function is not the kind of "bulletproof" function which will report errors in the same way it does usually on BIS ones.

My only thought is maybe while the function is running something, some of the gathered data disappears (a vehicle is deleted, a marker etc..) and suddenly it finds itself with a nil variable instead of the valid one it got when the function started... Can be?

If so, I need to override the function, just rebuilding the function and compile it with the same name (I made this with spawnGroup and works good) but it's a complex one, and I need your help to know where to check variables, put an if statement on execution if variables are ok, etc... This with making everything else work, if possible ;)

Can someone help?

Share this post


Link to post
Share on other sites

You could try to use the folder search of poseidon, if you're using it.

This way you can get a quick overview which of the 3rd party scripts are using the sortBy function.

It could also be some weird usage of "for '_i' from 0 to n" calling the function in one of those scripts, seen quite a few in the past.

The function itself is bulletproof unless you're feeding it with invalid parameters, like you stated.

The array that's being processed is being treated as a duplicated array within the script, as far as I can recall so that shouldn't be the case.

You best bet would be to go through each 3rd party script on its own (using it in a mission the same way you're using it in yours) and wait until errors start to happen.

Tough debugging on this one if you say the error occurs randomly without any chance of replication.

Cheers

Share this post


Link to post
Share on other sites

What I made: I overrided the function, copypasted it on a sqf and called it.

Edited the function to sidechat when it fires and hinting the data which fed it.

With this I discovered it was UPSMon. I was using an old version.

I updated with the hope of no more errors. If it still reproduces, I think there is something like calling the function with objects as parameter, and maybe those objects in the meantime have been deleted (despawned).

If it reproduces againk I think I will edit the error line and put it a condition like "if (not isNil whatever)" to execute the error line.

Thanks GOM!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×