From TechnoDocs
Jump to: navigation, search
(heading from the sac.txt document)
Line 3: Line 3:
 
SAC is short for Servo Automation Control, and is a scripting language that can be used to control the router. The syntax is Visual Basic.
 
SAC is short for Servo Automation Control, and is a scripting language that can be used to control the router. The syntax is Visual Basic.
  
== Examples ==
+
== How to use this document ==
  
Note: Examples are coming.
+
When you encounter [variable/options], the proper syntax is to remove the [].
 +
 
 +
When you encounter "value", leave the quotes in
 +
 
 +
When you encounter (value), leave the ()s in, though you don't always need them.
 +
 
 +
When passing multiple numbers to a function that seems to take ()s, the following rule applies:
 +
 
 +
* function x,y,z
 +
* function (x),(y),(z)
 +
* function (x),,(z)
 +
* function (x),y,(z)
 +
* NEVER function (x,y,z)
 +
* NEVER function (x),(),(z)
 +
 
 +
All established VBscript commands are also usable, use your favorite search engine with the term "vbscript functions" to get an up-to-date list of functions and examples. Currently, one such list is at http://www.w3schools.com/VBscript/vbscript_ref_functions.asp or http://msdn.microsoft.com/en-us/library/t0aew7h6(VS.85).aspx
 +
 
 +
== Good VBscript Practice ==
 +
 
 +
Goto and gosubs are no longer available. Use public functions and subs to do your branching.
 +
If you wrap your entire program in one outer function, it is possible to "end" the program early upon finding an error, as such:
 +
 
 +
<code>
 +
chopblock()
 +
public function chopblock()
 +
    'do some things here,
 +
    if error detected then exit function
 +
    'do some other things here
 +
    if error detected then exit function
 +
    'do some other things here
 +
    if error detected then exit function
 +
    'do some other things here
 +
end function
 +
</code>
 +
 
 +
In the previous example, the first line runs the function chopblock, which frequently checks for an error. When an error is encountered, the function will be exited, and the code will end prematurely.
  
  
 
[[Category:Software]]
 
[[Category:Software]]

Revision as of 08:59, 7 December 2010

Note!
This article is a work in progress. Check back later, or call us to speed things along.

SAC is short for Servo Automation Control, and is a scripting language that can be used to control the router. The syntax is Visual Basic.

How to use this document

When you encounter [variable/options], the proper syntax is to remove the [].

When you encounter "value", leave the quotes in

When you encounter (value), leave the ()s in, though you don't always need them.

When passing multiple numbers to a function that seems to take ()s, the following rule applies:

  • function x,y,z
  • function (x),(y),(z)
  • function (x),,(z)
  • function (x),y,(z)
  • NEVER function (x,y,z)
  • NEVER function (x),(),(z)

All established VBscript commands are also usable, use your favorite search engine with the term "vbscript functions" to get an up-to-date list of functions and examples. Currently, one such list is at http://www.w3schools.com/VBscript/vbscript_ref_functions.asp or http://msdn.microsoft.com/en-us/library/t0aew7h6(VS.85).aspx

Good VBscript Practice

Goto and gosubs are no longer available. Use public functions and subs to do your branching. If you wrap your entire program in one outer function, it is possible to "end" the program early upon finding an error, as such:

chopblock()
public function chopblock()
   'do some things here,
   if error detected then exit function
   'do some other things here
   if error detected then exit function
   'do some other things here
   if error detected then exit function
   'do some other things here
end function

In the previous example, the first line runs the function chopblock, which frequently checks for an error. When an error is encountered, the function will be exited, and the code will end prematurely.