# Author: Malcolm Kesson (2007)
  
# Specify the full path to the directory that contains the
# Lsystem TCL code
set LROOT PATH_TO_YOUR_LCODE_DIRECTORY
  
# Set output to MEL or RMAN
set output "MEL"
  
source $LROOT/LScriptReader.tcl
source $LROOT/LGenerator.tcl
if {$output == "MEL"} {
    source $LROOT/LMel.tcl
    source $LROOT/LMayaPort.tcl
} else {
    source $LROOT/LMan.tcl
    }
    
# Set a default script incase the user doesn't specify one
set path "$LROOT/default.dat"
  
# LControl has been invoked with an argument. The argument
# will be the path to the script file containing the Lsystem
# data - see sample.dat.
if { $argc == 1 } {
    set path [lindex $argv 0]
    if {[file exists $path] == 0} {
        set path $LROOT/$path
        }
    if {[file exists $path] == 0} {
        set path $LROOT/default.dat
        }
    }
                                       
# Use LScriptReader.tcl to create the script database
set lines [getScript $path]
readScript $lines script
  
# Lock down the random number generator if the user has 
# provided a "seed" value
set seed [getArrayValueOf Script "seed"]
if {$seed != ""} {
    set seed [expr int($seed)]
    expr srand($seed)
    }
  
# Both LMel.tcl and LMan.tcl implement a "render" proc
render [generate script] script "temp"
#puts "[generate script]"
  
# Use a socket connect...
if {$output == "MEL"} {
    sendToMaya $LROOT/temp.mel
    }