SetDevelopmentMode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (SetDevelopmentMode is Client-Side only)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
This function is used to set the development mode of the client. Setting development mode allows access to special commands which can assist with script debugging.
This function is used to set the development mode. Setting development mode allows access to special commands which can assist with script debugging.


Development mode commands:
'''Client-side''' development mode commands:
* '''[[Client_Commands#showcol|showcol]]''': Enables colshapes to be viewed as a wireframe object.
* '''[[Client_Commands#showcol|showcol]]''': Enables colshapes to be viewed as a wireframe object.
* '''[[Client_Commands#showsound|showsound]]''': Enables world sound ids to be printed in the debug output window.
* '''[[Client_Commands#showsound|showsound]]''': Enables world sound ids to be printed in the debug output window.
'''Shared''' development mode functions:
* '''[[debugSleep]]''': Sets the freeze time for the client/server.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setDevelopmentMode ( bool enable )
bool setDevelopmentMode ( bool enable [, bool enableWeb = false ] )
</syntaxhighlight>
</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''enable ''': A boolean to indicate whether development mode is on (true) or off (false)  
*'''enable''': A boolean to indicate whether development mode is on (''true'') or off (''false'')  
{{New feature/item|3.0150|1.5||
*'''enableWeb''': A boolean to indicate whether browser debug messages will be filtered (''false'') or not (''true'')
}}


===Returns===
===Returns===
Line 19: Line 25:


==Requirements==
==Requirements==
{{Requirements|n/a|1.1.1-9.03355|}}
{{Requirements|1.5.4-9.11305|1.1.1-9.03355|}}


==Example==  
==Example==  
'''Example 1:''' This example would set the development mode of the client. Use /showcol [<0-1>] and /showsound [<0-1>] later to enable/disable respective funtions.  
'''Example 1:''' This example would set the development mode of the client. Use /showcol [<0-1>] and /showsound [<0-1>] later to enable/disable respective functions.  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler( "devmode",
addCommandHandler("devmode",
function ()
    function()
    setDevelopmentMode ( true )
        setDevelopmentMode(true)
end
    end
)
)
</syntaxhighlight>
</syntaxhighlight>
It is important to note that this example has to be in a client side script. Otherwise, the execution of the command would only result in the shared dev mode that does not allow the use of '''[[Client_Commands#showcol|showcol]]''' and '''[[Client_Commands#showsound|showsound]]'''.


==See Also==
==See Also==
{{Client_utility_functions}}
{{Client_utility_functions}}

Latest revision as of 19:21, 27 October 2021

This function is used to set the development mode. Setting development mode allows access to special commands which can assist with script debugging.

Client-side development mode commands:

  • showcol: Enables colshapes to be viewed as a wireframe object.
  • showsound: Enables world sound ids to be printed in the debug output window.

Shared development mode functions:

  • debugSleep: Sets the freeze time for the client/server.

Syntax

bool setDevelopmentMode ( bool enable [, bool enableWeb = false ] )

Required Arguments

  • enable: A boolean to indicate whether development mode is on (true) or off (false)
  • enableWeb: A boolean to indicate whether browser debug messages will be filtered (false) or not (true)

Returns

Returns true if the mode was set correctly, false otherwise.

Requirements

Minimum server version 1.5.4-9.11305
Minimum client version 1.1.1-9.03355

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.5.4-9.11305" client="1.1.1-9.03355" />

Example

Example 1: This example would set the development mode of the client. Use /showcol [<0-1>] and /showsound [<0-1>] later to enable/disable respective functions.

addCommandHandler("devmode",
    function()
        setDevelopmentMode(true)
    end
)

It is important to note that this example has to be in a client side script. Otherwise, the execution of the command would only result in the shared dev mode that does not allow the use of showcol and showsound.


See Also