Difference between revisions of "PrintToConsole"

Jump to navigation Jump to search
1,141 bytes removed ,  22:09, 2 February 2008
using templates
imported>Haama
m (→‎Notes: Corrected 'PrintToC')
imported>DragoonWraith
(using templates)
Line 8: Line 8:
Prints a formatted string to console. Uses the same syntax as [[Message]] and [[MessageBox]]. Mainly useful for debugging purposes.
Prints a formatted string to console. Uses the same syntax as [[Message]] and [[MessageBox]]. Mainly useful for debugging purposes.


==Notes==
== Notes ==
* This function works in conjunction with the console function ToggleDebugText. When PrintToConsole is called while TDT is active, console messages will be visible during normal gameplay. Useful for debugging when a lot of messages need to be displayed.
* This function works in conjunction with the console function ToggleDebugText. When PrintToConsole is called while TDT is active, console messages will be visible during normal gameplay. Useful for debugging when a lot of messages need to be displayed.
* [[GetInventoryObject]] and [[GetNumItems]] will also return messages to the console (1 message for each item). As the number of console lines is limited, use caution with these and PrintToConsole.
* [[GetInventoryObject]] and [[GetNumItems]] will also return messages to the console (1 message for each item). As the number of console lines is limited, use caution with these and PrintToConsole.
**As of v13, '''GetInventoryObject''' and '''GetNumItems''' no longer return messages to the console.
** As of v0013, '''GetInventoryObject''' and '''GetNumItems''' no longer return messages to the console.
* You can increase the number of lines in the console by increasing the '''iConsoleVisibleLines''' setting in the config file, found at
* You can increase the number of lines in the console by increasing the '''iConsoleVisibleLines''' setting in the config file, found at
  ..\Documents and Settings\"User Name"\My Documents\My Games\Oblivion\Oblivion.ini
  ..\Documents and Settings\"User Name"\My Documents\My Games\Oblivion\Oblivion.ini
*As of v14, several new variables types have been added:
* As of v0014, PrintToConsole accepts the "EX" formatting specifiers.
**%i - prints the formID of a reference or object
**%k - prints a string representing the key associated with a DirectInput scan code
**%n - prints the name of a reference or object
**%r - prints a newline
**%c - prints the name of a component within another object. Takes two arguments - an object (ref) and the index of the component you want to access (short). Supported object types:
***Magic Item - prints the name of the nth effect item.
***Faction - prints the male rank title of the nth rank.
**Also, you can now use up to 20 variables.
**Additional format specifiers used by the C function printf() may work as well. Due to the fact that integer script variables are stored as floats, using %0x to display hexadecimal notation may not display the expected output.
**Example:
<pre>    ref refVar1
    short keyCode
    short goldCost
...
    set refVar1 to AdrianDecanusREF
    set keyCode to GetControl 15 ; menu key, assuming 'Tab' (15)
    set goldCost to 500


    PrintC "Press %k to summon companion %n %rCost: %g gold" keyCode refVar1 goldCost</pre>
== Displaying Variables ==
prints out
{{MessageFormatting}}
<pre>    Press TAB to summon companion Adrian Decanus
            Cost: 500 gold</pre>


<!--[[Category: OBSE Functions]]
{{MessageEXFormatting}}
[[Category: OBSE Debug Functions]]-->


[[Category: Functions]]
[[Category: Functions]]

Navigation menu