Difference between revisions of "Debug Dumps"
m
→Actor Inventory: typo
imported>Odessa (Created) |
imported>Odessa m (→Actor Inventory: typo) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
===Start=== | ===Start=== | ||
<pre> | <pre> | ||
scn | scn CreateDebugDump | ||
int LastEcho | int LastEcho | ||
Line 12: | Line 12: | ||
array_var UT | array_var UT | ||
array_var aQuests | array_var aQuests | ||
array_Var aObjects | |||
array_var entry | array_var entry | ||
string_var file_name | string_var file_name | ||
Line 17: | Line 18: | ||
string_var FO_dir | string_var FO_dir | ||
ref rQuest | ref rQuest | ||
ref | ref rObject | ||
Begin Function { } | Begin Function { } | ||
Line 42: | Line 41: | ||
Print "Starting debug dump to file: " + file_name | Print "Starting debug dump to file: " + file_name | ||
</pre> | </pre> | ||
A [[String Variable]] and the [[GetUserTime]] function can be used to create a unique and recognizable file name for your dump, based on your mod name and the real life time it is created. The [[Con_SCOF]] command writes all console output to the specified file, which will be found in the main game directory of the user. The [[Print]] command outputs text to the console, and supports many convenient features. | A [[String Variable]] and the [[GetUserTime]] function can be used to create a unique and recognizable file name for your dump, based on your mod name and the real life time it is created. The [[Con_SCOF]] command writes all console output to the specified file, which will be found in the main game directory of the user. The [[Print]] command outputs text to the console, and supports many convenient features. (See also [[Tutorial: String Variables|the string variables tutorial]]) | ||
The debug dump file name will look like: "MyModName-Debug-Dump-YEAR-MONTH-DAY--HOUR-MINUTE-SECOND.txt" | The debug dump file name will look like: "MyModName-Debug-Dump-YEAR-MONTH-DAY--HOUR-MINUTE-SECOND.txt" | ||
Line 63: | Line 62: | ||
let iIndex := 0 | let iIndex := 0 | ||
while iIndex < iTotalMods | while iIndex < iTotalMods | ||
Print (NumToHex iIndex) + " (" + $iIndex + "): " + (GetNthModName iIndex) | Print (NumToHex iIndex, 2) + " (" + $iIndex + "): " + (GetNthModName iIndex) | ||
let iIndex += 1 | let iIndex += 1 | ||
loop | loop | ||
Line 88: | Line 87: | ||
Above, we create an array with [[Ar_List]] and put all the quests we want to dump in it. You can specify up to 20 entries in one <b>Ar_List</b> call, see the [[Tutorial: Array Variables 1|arrays tutorial]] if you want more than 20 entries. Then we print the name of the quest '$rQuest' and do <b>Con_SQV</b> [[Foreach|for each]] one. | Above, we create an array with [[Ar_List]] and put all the quests we want to dump in it. You can specify up to 20 entries in one <b>Ar_List</b> call, see the [[Tutorial: Array Variables 1|arrays tutorial]] if you want more than 20 entries. Then we print the name of the quest '$rQuest' and do <b>Con_SQV</b> [[Foreach|for each]] one. | ||
=== | ===Object Script Variables=== | ||
<pre> | <pre> | ||
; * Object Variable Statuses | |||
let aObjects := Ar_List SunnyREF, MyActorREF, MyDoorREF, PlayerREF... | |||
let LastEcho := SetConsoleEcho 1 | |||
foreach entry <- aObjects | |||
let rObject := *entry ; '*' is shorthand for entry["value"] | |||
Print "Variables for " + $rObject | |||
Con_ShowVars rObject | |||
Print " * * * * * " | |||
loop | |||
SetConsoleEcho LastEcho | |||
</pre> | </pre> | ||
The function, [[Con_ShowVars]] is similar to <b>Con_SQV</b> for quests; it prints the name and value of all variables in object scripts attached to the reference (including those on their inventory items). It also requires console echo to be toggled on. | |||
=== | ===Actor Inventory=== | ||
<pre> | <pre> | ||
; * Player inventory | ; * Player inventory | ||
Print "Player Inventory: " | Print "Player Inventory: " | ||
let | let LastEcho := SetConsoleEcho 1 | ||
PlayerREF.Con_Inv | |||
SetConsoleEcho LastEcho | |||
Print " * End Inventory *" | Print " * End Inventory *" | ||
</pre> | </pre> | ||
The | The [[Con_Inv]] command is equivalent to typing [[ShowInventory|Inv]] into the game console to print the contents of an inventory. This command also requires console echo to be toggled on. (You can just toggle it on once at start, if you need it multiple times) | ||
===Array dumping=== | |||
<pre> | |||
Ar_Dump SomeQuest.SomeArray | |||
</pre> | |||
If you have some arrays you want to read, you can use [[Ar_Dump]], or call some UDF that does a more bespoke version. | |||
===Player Actor Values=== | ===Player Actor Values=== |