The Beginning
page 1

Updated May 7, 2004
Programming for the Genius-Impaired

A series of lessons for those who want to learn how to create their own Lightwave Plugins with Lscript.


So You've Decided to Learn LScript

Welcome, hardy adventurer!  This is the beginning of a series of lessons designed to get you writing your own LScripts.  If you've never written a line of code in your life, I'd suggest you spend a few minutes here, learning all that stuff you need to know before tackling the beginning.

That said, all you need for this exercise is a computer running a recent enough version of Lightwave to support LScript v2.0 or above, this file:

pickanum.zip

and a text editor. The Notepad program that comes with all flavors of windows will suffice.  I've used PFE, Programmer's File editor for ages, but it appears to have dropped off the web. I'd take the time to find a good text editor; it makes the work more pleasant. If you're looking for a solution close at hand, check your LightWave_3D_7.0\Programs folder for a program called lsed.exe. It stands for LScript Editor, and it's pretty nice, though it does have some stability issues.

A Few Words About Lscripts

There are many different flavors of LScript, but for now, we'll divide them into two types, Layout Scripts and Modeler Scripts. This tutorial is going to focus on Modeler LScripts.

When you want to run an LScript, either to test what you've written, or to run one of the scores of LScripts available on the web, look in the Construction tab. Under Utility, you'll find an entry for LScript.

It will pop up a file requester.  Navigate to your script and double click on it, and it's running!

 

You can see what version of LScript you are running by looking in the upper left hand corner of the requestor.

An LScript is just a text file, nothing more. No secret handshakes, no binary numbers, just plain old text.  These are labeled with the .ls extension. LScript also offers the option to compile a script into binary form (these are labeled with the .lsc extension), but this is only for preventing people from reading a script. It does not offer any speed advantage, and in my experience, is more prone to failure as the scripting language is updated.

So we're only going to bother with the regular old test version. It's easy to read and change, and it allows others to see what you've done, which in my opinion, is a good thing.

To keep the hard drive looking tidy, save your LScripts with a ".ls" instead of a ".txt" extension.

Let's Get Started!

Today's mission: write a simple number guessing game.  Learn how to write and run a simple script.  Learn the basic structure of Lscript. Have some fun.

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