The Beginning
appendix B
Programming for the Genius-Impaired
A series of lessons for those who want to learn how to create their own Lightwave Plugins with Lscript.

Odds and Ends


Additional LScript Resources

There is a great mail list for people working with LScript:
Lscript@lists.newtek.com
http://lists.newtek.com/mailman/listinfo/lscript

The list is peopled by great, helpful folk with much experience with the intricacies of LScript.


Basic Mathmatical Operators

+ Add 3 + 5 = 8
- Subtract 3 - 5 = -2
* Multiply 3 * 5 = 15
/ Divide 3 / 5 = 0.6
^^ To the Power of 3 ^^ 5 = 243

There is a long-standing issue in LScript with the "-" sign. The script can get confused if the minus sign is butted up against a number in an equation: myVar = (someVar-45);

To be safe, write it out with spaces: myVar = (someVar - 45);


What Should I Name My Variables?

I'm glad you asked. Hardcore programmers frequently use the smallest names they can get away with, because they are typing all day long, and shorter variable names equals less typing.

Bah. Most of these scripts won't be more than a day or two of work, and short, cryptic variable names mean that your program will be hard to read. And yes, that script that you lovingly slaved away at for two days will look like so much gibberish to you three months later when you need to go in and tweak something.

So use variable names that best describe what cargo they hold.

myName = "Sean Hyde-Moyer";
colorOfPants = "Red";
favoriteNumber = "6";
freshBakedPi = 3.14159;
booleanFlag = "TRUE";


What's with the Crazy Captitalization?

Frequently, you'll see variables names written like this:

someName
anotherBrick
redPants
clownNose

What's the deal? Well, LScript commands (and this is true for a lot of languages) are all lower case. So, when coders make variables, they sometimes add a capital letter in there to differentiate it from a command.

Why in the middle, and not at the beginning? Probably to look cool, and feel special. More than likely, it's because when we type in our everyday non-coding lives, we captialize the beginning of a sentence. Since capitalization can mean bugs if used in the wrong place in a script, placing a capital in the middle of a variable name is a habit that can be used to counter our impulse to put a capital at the begining of a line.

In addition, since variable names can't have spaces in them, capsAtTheBeginingOfWordsMakesItALittleEasierToRead.

Bear in mind, I'm making most of this stuff up.

<<PREV 1 2 3 4 5 6 7 8 9 A B NEXT>>