OutputDebugString: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
[[Category:Incomplete]]
__NOTOC__  
__NOTOC__  
This fake function is for use with blah & blah and does blahblahblabhalbhl
This function outputs scripting debug messages, which can be read by enabling the debug textbox. The debug display level can then be set so that info or warning messages get filtered out.


==Syntax==  
==Syntax==  
Line 10: Line 8:


===Required Arguments===  
===Required Arguments===  
*'''argumentName:''' description
*'''text:''' the text to be output to the debug box.


===Optional Arguments===  
===Optional Arguments===  
{{OptionalArg}}  
{{OptionalArg}}  
*'''argumentName2:''' descriptiona
*'''level:''' the debug message level. Possible values are:
*'''argumentName3:''' description
**'''0:''' Custom message
**'''1:''' Error message
**'''2:''' Warning message
**'''3:''' Information message (default)
*'''red''': The amount of red in the color of the text. Default value is 255.
*'''green''': The amount of green in the color of the text. Default value is 255.
*'''blue''': The amount of blue in the color of the text. Default value is 255.
'''Note:''' Color values are only applied when debug level is 0.


===Returns===
===Returns===
Returns ''true'' if blah, ''false'' otherwise.
Returns ''true'' if the debug message was successfully output, ''false'' if invalid arguments are specified.


==Example==  
==Example==  
This example does...
This script notifies when its resource has been loaded using a debug message:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
addEventHandler( "onResourceStart", getRootElement(), "resourceStartNotify" )
blabhalbalhb --abababa
function resourceStartNotify ( resourcename )
--This line does this...
--if the started resource is this one
mooo
if ( resourcename == getThisResource() ) then
--send an info debug message as a notification
outputDebugString ( "Resource "..resourcename.." loaded.", 3 )
end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{Server functions}}

Revision as of 00:16, 27 January 2007

This function outputs scripting debug messages, which can be read by enabling the debug textbox. The debug display level can then be set so that info or warning messages get filtered out.

Syntax

bool outputDebugString ( string text, [ int level=3, int red, int green, int blue ] )             

Required Arguments

  • text: the text to be output to the debug box.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • level: the debug message level. Possible values are:
    • 0: Custom message
    • 1: Error message
    • 2: Warning message
    • 3: Information message (default)
  • red: The amount of red in the color of the text. Default value is 255.
  • green: The amount of green in the color of the text. Default value is 255.
  • blue: The amount of blue in the color of the text. Default value is 255.

Note: Color values are only applied when debug level is 0.

Returns

Returns true if the debug message was successfully output, false if invalid arguments are specified.

Example

This script notifies when its resource has been loaded using a debug message:

addEventHandler( "onResourceStart", getRootElement(), "resourceStartNotify" )
function resourceStartNotify ( resourcename )
	--if the started resource is this one
	if ( resourcename == getThisResource() ) then
		--send an info debug message as a notification
		outputDebugString ( "Resource "..resourcename.." loaded.", 3 )
	end
end

See Also