What is OptoScript?

OptoScript is an easy to use, optional programming language that can simplify certain types of operations in PAC Control. It’s an alternative to using standard PAC Control flowchart commands. 

OptoScript Basics

OptoScript is a procedural type of computer language similar to C, BASIC, or Pascal. 

  • It can be used within any PAC Control strategy or subroutine to replace, or supplement standard PAC Control commands. 
  • It doesn't add new functions, but offers an alternative method within PAC Control’s flowcharting environment to simplify some common programming tasks.
  • It’s ideal for control operations involving extensive math calculations, string handling, or complex loops and conditions that are done with standard commands but take up a lot of space on a flowchart.
  • OptoScript code can’t be mixed with commands in action or condition blocks; it is used in its own hexagonal flowchart block.
  • Normally, you wouldn’t write an entire chart in OptoScript. You’ll typically want a combination of OptoScript, action, and condition blocks, mainly for ease of debugging and maintaining code.

Note: When you use OptoScript, be aware that it is not self-documenting. Make sure you use comments often to explain what the code does. Someday, when you or someone else has to come back to it a year later and make changes to the strategy, you’ll know what it’s doing.

Here’s an example of an OptoScript flowchart block and its contents:

Let’s take a look at some OptoScript examples for:

  • Math expressions
  • String handling
  • Complex loops
  • Case statements
  • Conditions
  • Combining math expressions, loops, and conditions
Summary

Summary

Learn the basics of OptoScript including how and when to use this procedural programming language in conjunction with PAC Control.