Thursday, July 04, 2013

Scratch for Second Life Revisited

Sometime ago I posted about a script generator for Second Life based on Scratch. The idea is is to graphically generate LSL script by first fitting program blocks together. The original Scratch generator was out of MIT. The MIT Scratch site is here: http://web.mit.edu/~eric_r/Public/S4SL/.  Recently a Flash based Scratch LSL generator has been put together by John Bennett from the University of Colorado to help introductory computer science students learn to think computationally.



The interface is similar to the MIT Scratch for LSL,  The new Lash version is called called FS2LSL. Here is the interface along with a real simple program to change the color of a prim from red to green to blue and to white, shown in Scratch blocks.








The LSL code generated by FS2LSL can then be copied and then pasted into Second Life or other viewer's script editor.  Granted, my program is super-simple but it gratifyingly worked without any modification. The code is well laid out and some automatic commenting related to the program is generated. The web site for FS2LSL gives lots of good examples many of which are from Scripting Your World: The Official Guide to Second Life Scripting. 




Most of the basic elements of the LSL language are covered, but don't expect to make complex menus and don't expect to find more than a few math functions built in. But you do have the ability to make your own functions. I appreciate that there is good coverage of control structures and if you work with IF statements you might find FS2LSL useful for working with them. 




I am not an expert LSL programmer; It took me forever to understand events and states for instance but I think FS2LSL is potentially useful not just for beginners but people such as myself who are trying to improve their programming skills. Certainly anyone just starting programming in LSL either in Second Life or OpenSim's version of LSL will find this tool useful, though it may not be completely compatible with OpenSim's version of LSL.

The Link to FS2LSL's page and examples is http://redwood.colorado.edu/jkb/fs2lsl/. The link to the actual Flash program is at http://www.free-lsl-scripts.com/Secondlife/Posts/fs2sl/




No comments: