Difference between revisions of "PrintToConsole"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Haama
(→‎Notes: Better Example)
imported>Haama
m (→‎Notes: Corrected 'PrintToC')
Line 33: Line 33:
     set goldCost to 500
     set goldCost to 500


     PrintToC "Press %k to summon companion %n %rCost: %g gold" keyCode refVar1 goldCost</pre>
     PrintC "Press %k to summon companion %n %rCost: %g gold" keyCode refVar1 goldCost</pre>
prints out
prints out
<pre>    Press TAB to summon companion Adrian Decanus
<pre>    Press TAB to summon companion Adrian Decanus

Revision as of 14:17, 27 January 2008

A command for Oblivion Script Extender

Syntax:

PrintToConsole "Message text", [var1], [var2], etc
PrintC "Message text", [var1], [var2], etc

Prints a formatted string to console. Uses the same syntax as Message and MessageBox. Mainly useful for debugging purposes.

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.
  • 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.
  • 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
  • As of v14, several new variables types have been added:
    • %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:
    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

prints out

    Press TAB to summon companion Adrian Decanus
            Cost: 500 gold