Author Topic: Trace() for Variables?  (Read 1113 times)

Is there an equivalent of trace() for variable? In other words, is there some way (perhaps a function; perhaps some other method) that shows what global variables a function uses/modifies?
« Last Edit: May 14, 2017, 03:35:07 AM by Platypi »

Can't figure out which ones they read, however, it's possible to figure out which ones they modify.
export("$*","config/dump/allVars.txt");
run the function
export("$*","config/dump/allVars2.txt");

Then probably find something online that compares the differences.

Can't figure out which ones they read, however, it's possible to figure out which ones they modify.
export("$*","config/dump/allVars.txt");
run the function
export("$*","config/dump/allVars2.txt");

Then probably find something online that compares the differences.
for the lazy: commit allvars to a git repo, then replace it with the contents of allvars2 and check diff


Can't figure out which ones they read, however, it's possible to figure out which ones they modify.
export("$*","config/dump/allVars.txt");
run the function
export("$*","config/dump/allVars2.txt");
I ran export("$*","config/dump/allVars.txt") and the game crashed. Here's the error message:



The error message shows almost immediately after running export. However, a good deal of variables are still written to "config/dump/allVars.txt" beforehand. When I check the file, it usually ends with a half-written variable value. The variable it stops on seems to be rather arbitrary. I am running Blockland through Wine on Ubuntu. Is anyone familiar with this problem?

I'm familiar with it.  I did that on windows.
My solution was to just go through the alphabet.  export("$A*",blahblah);export("$B*",blahblah);

Ahm, I think export can append to a file.
Quote
virtual void Server::Global::export   (   searchString]    [, fileName[, append]   )
So to get it all in one file it'd be like:
export("$A*","base/allvars.txt");
export("$B*","base/allvars.txt",1);
export("$C*","base/allvars.txt",1);
...

I'm familiar with it.  I did that on windows.
My solution was to just go through the alphabet.  export("$A*",blahblah);export("$B*",blahblah);

Ahm, I think export can append to a file.So to get it all in one file it'd be like:
export("$A*","base/allvars.txt");
export("$B*","base/allvars.txt",1);
export("$C*","base/allvars.txt",1);
...
This worked. Thank you!

Here's my code:
Code: [Select]
$alphabet = "abcdefghijklmnopqrstuvwxyz";

function exportVars(%fn) {
%len = strLen($alphabet);
for (%i = 0; %i < %len; %i++) {
%c = getSubStr($alphabet, %i, 1);
export("$" @ %c @ "*", %fn, 1);
}
}
Short, fast, and it doesn't crash.

could also try usin this: https://www.diffchecker.com/diff
Then I used this to check the difference. This is exactly the sort of thing I was looking for.

Thanks, everyone!
« Last Edit: May 15, 2017, 08:46:33 PM by Platypi »