DxSetTestMode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 21: Line 21:


==Example==  
==Example==  
Use /setmode [param] to set the test mode.
With this example you can use /setmode command to set the test mode.
<syntaxhighlight lang="lua">local testValues = {
<syntaxhighlight lang="lua">local testValues = {
["none"] = true,
["none"] = true,
Line 34: Line 34:
outputChatBox( "Test mode set to " .. value .. ".", 220, 175, 20, false )
outputChatBox( "Test mode set to " .. value .. ".", 220, 175, 20, false )
else
else
outputChatbox( "Invalid test mode entered.", 245, 20, 20, false )
outputChatBox( "Invalid test mode entered.", 245, 20, 20, false )
end
end
end
end

Latest revision as of 16:34, 2 February 2014

This function is used for testing scripts written using guiCreateFont, dxCreateFont, dxCreateShader and dxCreateRenderTarget.

Each one of the 3 test modes should be used in turn to help highlight any potential problems.

Syntax

bool dxSetTestMode ( string testMode )

Required Arguments

  • testMode : The test mode to be set. It can be one of the following values:
    • none : Test mode disabled
    • no_mem: Simulate no free video memory available for MTA.
    • low_mem: Simulate little free video memory available for MTA.
    • no_shader: Simulate shaders failing validation.

Returns

Returns true if the test mode was successfully set, false otherwise.

Example

With this example you can use /setmode command to set the test mode.

local testValues = {
	["none"] = true,
	["no_mem"] = true,
	["low_mem"] = true,
	["no_shader"] = true
}

function testmode( cmd, value )
	if testValues[value] then
		dxSetTestMode( value )
		outputChatBox( "Test mode set to " .. value .. ".", 220, 175, 20, false )
	else
		outputChatBox( "Invalid test mode entered.", 245, 20, 20, false )
	end
end
addCommandHandler( "setmode", testmode )

See Also