Talk:NSS Files/@comment-5893557-20130121213126/@comment-3508190-20130121231654

I can tell you the basics from the top of my head, but I'll have to warn you: Since no one ever expressed interest in scripting JE I never made an effort to make the debug code separable from my mod. It's all very much intertwined with everything else.

Since there are no real debug functions and no real console, I repurposed.

That function does two things:


 * 1) It displays an in-game dialog in the bottom half of the screen. I don't recall in what context it's used normally, but you've doubtlessly seen that dialog a number of times during a regular play-through.
 * 2) It logs the current dialog to the dialog log. This latter functionality is actually a lot more useful than the former because it allows you to track developments over time.

Unfortunately  doesn't simply accept a string as its parameter. It expects the name of a DLG file. So I created a DLG file with the name debug.dlg. DLG files don't accept strings either and so I had to add a line to to the dialog.tlk. That line however can be modified. You can add a custom token to it by adding the magic word  to the dialog entry. XX stands for a number. It's a good idea not to use a number smaller than five because the game itself uses those entries. Now that custom token can be set with the scripting function.

Since that's not complicated enough, there's an additional problem: When you set a custom token all uses of that token are affected. That means not just the current entry in the log will show the new value for the custom token, but all past entries will as well. And so I did not just create one DLG file with one custom token, but 30 DLG files with 30 custom tokens and a script that cycles through them. The global variable  contains the index of the DLG file/custom token that was used last.

The code that deals with all of that is in i_message.nss. The most important functions are  and. Most other functions in that file are convenience functions that simplify more complicated output procedures - like fetching a value from a 2da e.g.


 * 1)   writes a string to a global string variable and
 * 2)   is called every three seconds by the heartbeat script and dumps the contents of that global string to the pseudo console.

3 seconds is just long enough that you can read the message in game and/or pause the game long enough to read it.

is actually far less interesting - at least for you. It sets and applies a bunch of flags with which I was able to turn debugging for various parts of my mod on and off. If you set FLAG_POINT_REWARDS e.g. you will see all kinds of info about those style point orbs...

From the looks of it, I've left all of my debug code in the final version(s) of my mod but used a local variable of the player object to turn debugging on and off. The functions in  require you to set DEBUG_BUILD first:

SetLocalBoolean(GetPlayer, DEBUG_BUILD, 1);