Difference between revisions of "PrintToConsole"
Jump to navigation
Jump to search
imported>Haama (→Notes: Added v13 and v14 notes) |
imported>Haama (→Notes: Better Example) |
||
Line 24: | Line 24: | ||
**Also, you can now use up to 20 variables. | **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. | **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 | **Example: | ||
<pre> ref refVar1 | <pre> ref refVar1 | ||
short keyCode | short keyCode | ||
short goldCost | short goldCost | ||
... | ... | ||
set refVar1 to AdrianDecanusREF | set refVar1 to AdrianDecanusREF | ||
set keyCode to GetControl 15 ; menu key, assuming 'Tab' (15) | set keyCode to GetControl 15 ; menu key, assuming 'Tab' (15) | ||
set goldCost to 500 | set goldCost to 500 | ||
PrintToC "Press %k to summon companion %n %rCost: %g gold" keyCode refVar1 goldCost</pre> | |||
prints out | prints out | ||
<pre> Press TAB to summon | <pre> Press TAB to summon companion Adrian Decanus | ||
Cost: 500 gold | Cost: 500 gold</pre> | ||
<!--[[Category: OBSE Functions]] | <!--[[Category: OBSE Functions]] |
Revision as of 04:30, 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 PrintToC "Press %k to summon companion %n %rCost: %g gold" keyCode refVar1 goldCost
prints out
Press TAB to summon companion Adrian Decanus Cost: 500 gold