Print Control
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
Overview:
- Install the
Print Control
package. - Place the
PrintControl
locator template in the world. - Add the
PrintControl_HelperScript
template to the locator. - Copy and paste the function.
PrintControl Locator
Place the PrintControl
locator template into the world. Do this step only once.
Helper Scripts
-
Add the
PrintControl_HelperScript
template to thePrintControl
locator. -
Change the
Target Script
property 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_HelperScript
to 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.
Other Details
-
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 Script
for 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.