Comment Your Scripts (!)

October 4, 2019 Josiah Feuerbacher

Hello again FWIers. This week I’m jumping on the blog soapbox to talk about a pet peeve: Script Comments. Or more specifically, the lack thereof. 

If you are using scripts in your sign, maybe to set a variable, trigger a piece of content, or assign a language; you should always comment your scripts. Commenting allows you to explain exactly what your scripts are doing. For instance, if you are setting a variable, where is that variable used? What is its purpose? Was it originally set somewhere else? 

This is a really critical habit to get into. Sure, it can be annoying and it seems frivolous at times, but so does brushing your teeth. And like brushing your teeth, you will be so grateful down the road. But, instead of visiting the dentist, it’s when you open up a sign that you haven’t touched in ages and there are nice, organized comments to help you. 

If you’ve ever done any programming, you might find Comments in Content Manager to be a little limited. And they are. But they get the job done. 

Content Manager supports only Inline Comments. Another way to say this is “Single Line” comments. To add a comment, start a line with two (forward) slashes. Anything following the slashes will be ignored by Content Manager and Content Player. It is strictly for your own edification. For example: 

// This line is a comment. It is ignored. 

This line would not be ignored. 

Content Manager only supports this when the comment STARTS a line. So you cannot add a comment following a script (as you can with some traditional programming languages). For anyone familiar with C, C++, C#, Javascirpt, PHP, or Objective-C, this syntax should look familiar. However, unlike those other languages, Content Manager does not support block comments, so stick to single line (//) comments. 

So, the following screenshot is a good example for commenting scripts:

Note that I have used separate three lines at the top for comments. As an alternative, you could use one very long comment, and allow the window to wrap the comment onto multiple lines. This is an example of what that looks like: 

I prefer the first option, as I think it makes it very clear which lines are comments and which lines are the actual scripts. But that’s a personal preference; any comment is a good comment! 

So, #DoYouFWI ? If so, use comments! (Stepping down from the soapbox).

Previous
Content Category Tips and Tricks
Content Category Tips and Tricks

With these helpful tips, you'll be able to schedule content categories, assign content permissions, and sch...

Next Up
#DOYOUFWI Challenge
#DOYOUFWI Challenge

Four Winds Interactive has a little challenge for users of our software. Figure out what a new expression d...