Jump to content
Sign in to follow this  
twisted

how to get name of parent process?

Recommended Posts

it would be really useful to be able to tell what process is calling another. especially when you are making multiple callss to 3rd party scripts that you don't want to change. edit - i am in a mp environment.

Edited by twisted

Share this post


Link to post
Share on other sites

Hmm, I see where your getting at with this (well understand what your wanting at least), I don't know of a way to do it, but if I may ask for a more in-depth example of why this would be useful? Currently half-brain dead and can't think of an appication.

Share this post


Link to post
Share on other sites
Hmm, I see where your getting at with this (well understand what your wanting at least), I don't know of a way to do it, but if I may ask for a more in-depth example of why this would be useful? Currently half-brain dead and can't think of an appication.

i am using 3rd part scripts indlucing bis scripts of course. but for some reason one of the many calls i am making to it is passing [0,0] as opposed to a proper position. it would make tracking down the error a hell of a lot easier.

Share this post


Link to post
Share on other sites
but for some reason one of the many calls i am making to it is passing [0,0] as opposed to a proper position. it would make tracking down the error a hell of a lot easier.

Why don't you check the values of that position before you make the call?

Share this post


Link to post
Share on other sites
i am using 3rd part scripts indlucing bis scripts of course. but for some reason one of the many calls i am making to it is passing [0,0] as opposed to a proper position. it would make tracking down the error a hell of a lot easier.

Since you are using BIS functions, it does not mean you will always get a guarenteed feasible result. For example some BIS functions return [0,0] when they fail while other link BIS_fnc_findSafePos returns the center of the map

getArray(configFile >> "cfgWorlds" >> worldName >> "centerPosition").

You can compare the result of the functions to an expected answer.

For example if you use BIS_fnc_findSafePos and it returned the center of the map, you know it failed.

Edit:

You can make a global array and store your script handles(asynchronous) in it.

globalHandlesArray = [];

_h = spawn xyz;

globalHandlesArray pushBack _h;

OR

You can make a nested array and let the nested arrays be the children handles.

[[handleParent,[[handleChild,[]],[handleChild,[]],[handleChild,[]]]],

[handleParent,[handleChild,[[handleChildOfChild,[]]]]]]

Edited by Ed

Share this post


Link to post
Share on other sites
If your using function defined by CfgFunctions you can use the local variable _fnc_scriptNameParent to get the calling function i believe.

Have not actually tested it myself but see META variables at the bottom of the Functions Library page.

Thanks, that's a quite useful page. I thought I had seen most interesting stuff on the wiki, guess I was wrong :)

Share this post


Link to post
Share on other sites

Thanks for the answers, the meta information looks really useful and I'll also start logging the troublesome scripts to a global array and see if that helps me track Dien these problems.

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  

×