There is a console command,
showglobalvars
that shows all global variables. Instead of getting that displayed in a console I want the output to be written in a text file.
I've heard about the command
SetConsoleOutputFilename
However, it doesn't work properly, since using
scof "c:\temp\output.txt"
will output
SetConsoleOutputFilename >> "c:\temp\output.txt"
but no such file is created.
How do I successfully print all global variables in a text file?
Best Answer
In the comments, you indicate that you "just want to see [what] all the global variables are." In general, the easiest way to do this is to open the various ESP/ESM files in xEdit, which is a third-party modding tool. Although it is designed for modifying these files, it will give a very prominent warning before it actually lets you change anything, so it's perfectly usable as a viewer as well.
Once you've loaded Skyrim.esm and the DLC into xEdit, you can expand each of the ESP/ESM files in the panel on the left, which will show a list of categories. Expanding a category shows a list of individual records:
This image is showing Fallout 3, but the same app also works on Skyrim's plugin files. Under the "Global Variables" category, there will be one record for each global variable. Clicking a record will display it in the area to the right of the navigation tree. For a global variable, it will tell you the name of that variable and the value it has at the start of the game. For other records, you will usually see a much larger amount of information. Clicking the "Referenced By" tab at the bottom will also tell you about all the places where other records use the global variable in some way.
If you don't want to download third-party software, you can instead use the official Creation Kit (install via Steam under "Tools" for the original Skyrim, or from the Bethesda Launcher for the Special Edition). It also organizes data into categories and records. You'll find the list of global variables under Miscellaneous / Global. Unfortunately, running the CK is a bit tricky for multiple reasons:
These problems are fixable; see particularly this mod and this thread on Nexusmods. In short, you need to fiddle around with skyrimeditor.ini because its default values are (in many places) incorrect or otherwise problematic.