Difference between revisions of "Debug Dumps"

364 bytes added ,  05:54, 19 September 2014
Added new NVSE 4.5.7 stuff
imported>Odessa
(→‎Load Order: numtohex supports width)
imported>Odessa
(Added new NVSE 4.5.7 stuff)
Line 5: Line 5:
===Start===
===Start===
<pre>
<pre>
scn fnCreateDebugDump
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 rItem
ref rObject
int iChoice
int iCount


Begin Function { }
Begin Function { }
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.


===Array dumping===
===Object Script Variables===
<pre>
<pre>
     Ar_Dump SomeQuest.SomeArray
; * 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>
If you have some arrays you want to read, you can use [[Ar_Dump]], or call some UDF that does a more bespoke version.  
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.


===Player Inventory===
===Actor Inventory===
<pre>
<pre>
; * Player inventory
; * Player inventory
     Print "Player Inventory: "
     Print "Player Invenory: "
     let iChoice := PlayerREF.GetNumItems
     let LastEcho := SetConsoleEcho 1
     while iChoice > 0
     PlayerREF.Con_Inv
        let iChoice -= 1
    SetConsoleEcho LastEcho
        let rItem := PlayerREF.GetInventoryObject iChoice
</pre>
        let iCount := PlayerREF.GetItemCount rItem
        Print $rItem + " (" + (GetFormIDString rItem) + ") : " + $iCount
    loop
     Print " * End Inventory *"
     Print " * End Inventory *"
</pre>
</pre>
The above is similar to typing [[ShowInventory|Player.inv]] into the game console, but unfortunately you can't do that from a script. It prints the name, [[GetFormIDString|formid]] and [[GetItemCount|count]] of every item in the player's inventory. (See also: [[GetInventoryObject]], [[GetNumItems]])
The [[Con_Inv]] command is equivalent to typing [[ShowInventory|Inv]] into the game console to print the contents of an inventory. This command requires console echo to be toggled on.
 
===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===
Anonymous user