Improve the Lua print() console experience.
Designed to be quick and convenient to use, Print Control adds two essential abilities. The ability to show the script’s name when printing to the console and the ability to silence all or individual scripts, preventing them from writing to the console.
Showing the script name is split into two parts. Headers and Messages.
Headers make it easier to follow the code as it enters each function.
Customized messages identify which script wrote to the console when print() statements of multiple scripts are interweaved.
Silence frees up time spent on commenting/uncommenting print statements and helps to ensure that error messages don’t go unnoticed.
How to use
- Install the
- Place the
PrintControllocator template in the world.
- Add the
PrintControl_HelperScripttemplate to the locator.
- Copy and paste the function.
PrintControl locator template into the world. Do this step only once.
PrintControl_HelperScripttemplate to the
Target Scriptproperty to the desired script. This step is only done once per script file, even if there are multiple script instances.
Rename the script folder from its default name of
printControl_HelperScriptto the name of the target script. This step is optional but highly recommended.
The final step is to add a function to the target script. This function is automatically generated and displayed in the console when the user previews the game. Copy and paste this function into the target script.
Repeat these steps for each script to be controlled.
After changing settings, there is a short delay before they take effect. Cycle the preview once more if desired.
The helper script will look for the
Target Scriptfor five seconds. The function named ‘ActivatePrintControl’ on the helper script can be called manually when the target script belongs to an entity spawned five or more seconds after runtime.
Read the property tooltips for additional information.