Search the Community
Showing results for tags 'diag'.
Found 3 results
-
I know I can put diag_activeSQFScripts inside a function. But is it possible to get the line number of the call to that function. lineCalledFrom = { // 1st line diag_activeSQFScripts select 0 select 3; // returns 2, but I want to return 5 }; call lineCalledFrom; // 5th line May be a bit confusing, but as you can see, diag_activeSQF always returns 2 because it's written on the 2nd line. I want it to return the line that `call lineCalledFrom` is written on, in this example 5. Thinking of creating some debugging tools that this would be really useful and awesome.
-
Can't be bothered to keep typing: diag_log format ["test value: %1",_valueToTest]; ? Put this at the top of your scripts: #define diag(a) \ private _pox = toArray str {a}; \ _pox deleteAt count _pox -1; \ _pox deleteAt 0; \ diag_log format ["MyScriptName" + " " + toString _pox + ": %1",a] Then you can type: diag(_valueToTest); And it prints the script name, variablename and value into the log. So these.... _lookAtTheVariableName = 69; diag(_lookAtTheVariableName); _fun = ["stuff","n","ting"]; diag(_fun); _fun = false; diag(_fun); diag(2>1); diag(2 isEqualTo 2); diag(["hello"]); Outputs this.... 18:22:47 "MyScriptName _lookAtTheVariableName: 69" 18:22:47 "MyScriptName _fun: [""stuff"",""n"",""ting""]" 18:22:47 "MyScriptName _fun: false" 18:22:47 "MyScriptName 2>1: true" 18:22:47 "MyScriptName 2 isEqualTo 2: true" 18:22:47 "MyScriptName [""hello""]: [""hello""]"
-
I set up a quick script to check where one of my scripts was stopping without an error using diag_activeSQFScripts and ended up with this: // ]","[ private ["_activeSQF","_count"]; _activeSQF = []; _count = 1; { hint str (_count); _count = _count + 1; _activeSQF pushBack (str _x); } forEach diag_activeSQFScripts; copyToClipboard str _activeSQF; hint str (count _activeSQF); player sideChat "done"; So from there I just paste the array _activeSQF and then manually separate each script for ease of reading (hence the ]","[ - I use that to find the end of each script). It's not hard to do, but is there a better way than this?