Page 1 of 2 12 LastLast
Results 1 to 15 of 26

Thread: LS script and LSC question (newbie)

  1. #1
    Registered User
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    21

    LS script and LSC question (newbie)

    dear LW friends:-)

    hello script guys and nice Lightwave Users!

    I have some simple question about LS Script and LSC Scripts/Plugins...
    I am playing around with script example but without success or with no really fun at all

    a) what is the different between these two kinds???
    b) documentation could help or a link to it
    c) would like to develop some simple *.ls scripts and improve it... where can I find a useful editor for it???

    d) why doesn't run elder scripts with the current LW 9.x version???

    perhaps somebody can help, would be very nice,

    my aim:
    e) I will write an ambient (light) script
    f) something with Emitter FX too:-)

    best wishes for all here and Lightwave too :-D

    Franky GTH with sunshin in my heart :-)

  2. #2
    Valiant NewTeKnight Matt's Avatar
    Join Date
    Feb 2003
    Location
    San Antonio, Texas, USA
    Posts
    13,056
    LS = LScript

    LSC = Compiled LScript

    Compiled LScripts don't run any faster, they just allow you to protect your code by making it hidden if you so wanted.

    Not the official documentation, but MUCH better:
    http://www.mikegreen.name/Lscript/Lscript%20Index.html

    The official documentation:
    http://www.newtek.com/lightwave/developers.php

    You can use the two programs in your Programs folder in your LightWave install:

    lsed.exe - LScript Editor
    lsid.exe - LScript Interface Designer

    But most people just use their preferred text editor of choice, I use ConText.

    Some older scripts might not run because specific commands / features they are using have changed in their behaviour. Although sometimes a script just needs the version number putting up to the latest version and it runs fine.

    There are also loads of LScripts that have been given away freely, with the code commented, check the forums.

    Hope that helps!
    Matt
    UI / UX Designer @ NewTek
    __________________________________________________
    www.pixsim.co.uk : LightWave Video Tutorials & Tools


  3. #3
    Code Muppet evenflcw's Avatar
    Join Date
    Feb 2003
    Location
    Stockholm, Sweden
    Posts
    2,642
    (1) LS is plain text so you can read the code in Notepad. LSC is compiled and is not plain text. By compiling you make it harder for others to see your code and the compiler also has some additional options that will provide copy protection. Compiling can alos bring together several source files into a single LSC file.

    (2) Go to Lightwaves Developer page at www.lightwave3d.com and download the lscript documentation. It should mention something. The explanation of the compiler interface and options might be in the regular LW manuals. Not sure.

    (3) Your lightwave installation should include an LScript Editor and an LScript Interface Designer (gui code generator). But the editor is buggy and may crash on undo, save and I'm sure lots of other cases. So I would not recommended it as the main aditor to use. Use Notepad++ or that other one I can't remember the name of (for which someone I also can't remember the name of created a syntax highlighting preset for). Search the forum! The LScript Editor does include a syntax checker that you might want to use from time to time, when you can't find errors just from error messages and debugging alone.

    (4) That's on a script by script basis. When running a script LW will check what versions the script has declared itself to be compatible with. And it might be for no good reason. If you find such a script contact the author or ask for help in the forum.

    (5,6) Good luck!

    EDIT: What he said!

  4. #4
    Registered User
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    21
    :-D short reply...

    thank your dear dan and matt !!! :-)))

    ... by the way...

    what is the sdk good for??? it includes c++ code, it's the right way to build lw plugins???

    have a nice day both of you :-)
    I will read all infos and documentations I can perhaps use for my first steps

    ahhh... one more:

    the content cd of lightwave (I am working with 8.3, 8.5) includes also script or plugin examples???

    bye, FrankyGTH
    after that I will check the new trial version of LW 9.6 !

    good to now here at the board I can perhaps find more help! you are welcome!

  5. #5
    Valiant NewTeKnight Matt's Avatar
    Join Date
    Feb 2003
    Location
    San Antonio, Texas, USA
    Posts
    13,056
    Quote Originally Posted by FrankyGTH View Post
    :-D short reply...

    thank your dear dan and matt !!! :-)))

    ... by the way...

    what is the sdk good for??? it includes c++ code, it's the right way to build lw plugins???

    have a nice day both of you :-)
    I will read all infos and documentations I can perhaps use for my first steps

    ahhh... one more:

    the content cd of lightwave (I am working with 8.3, 8.5) includes also script or plugin examples???

    bye, FrankyGTH
    after that I will check the new trial version of LW 9.6 !

    good to now here at the board I can perhaps find more help! you are welcome!
    Yes, the SDK is mainly for C++ developers wanting to write plugins (.p files). These allow much more access than the scripting language, and run considerably faster.

    You can also look in your Programs > Plugins folder for many NewTek scripts. Most are not fully commented though, but some are. I know I found out a few things looking at some of those.

    If you do a search for threads I've starting with the keyword "Script" in the 'Titles Only' option, you will find a few scripts I've written that are fully commented.

    Cheers
    Matt
    UI / UX Designer @ NewTek
    __________________________________________________
    www.pixsim.co.uk : LightWave Video Tutorials & Tools


  6. #6
    Registered User
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    21

    first hello world script but doesn't run

    my first try :-)

    but I have done a mistake... it doesn't run :-( but I am thinking it's just a simple word or item missing... I wish to run it.

    @warnings
    @name text

    main
    {
    // This is a comment.
    text = “Hello Franky GTH, this is my first lw script!”;
    info(text);
    }

    btw: the "text.ls" script of the lw script/modeler folder also doesn't run, must laugh...

    have downloaded the 9.6 trial version, wow!!! what a great 3d app! :-)))

    perhaps matt or dan can you have a look at the script???

    best wishes, FrankyGTH
    Last edited by FrankyGTH; 01-27-2009 at 07:46 AM.

  7. #7
    Valiant NewTeKnight Matt's Avatar
    Join Date
    Feb 2003
    Location
    San Antonio, Texas, USA
    Posts
    13,056
    If you want a script to run in Modeler, you need to put the following line somewhere at the top:

    @script modeler

    If you want it to run in Layout then the line becomes:

    @script generic

    There are other types, but these are the two main ones. Essentially you need to let LightWave know what type of script it is so it knows what to do with it.
    UI / UX Designer @ NewTek
    __________________________________________________
    www.pixsim.co.uk : LightWave Video Tutorials & Tools


  8. #8
    Registered User
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    21

    done something wrong...

    hi matt
    hi dan

    can you check the script it for me again ???
    my script

    @script modeler

    main
    {
    // This is a comment.
    text = “Hello World!”;
    info(text);
    }

    it doesn't run with the modeler, although I have done everything right, but get an error message

    In main, line 6, found "W", expecting '@'
    line: text = Hello World!

    hmh... don't know how it should be done correctly ?

    perhaps you can have a closer look for it

    best regards, FrankyGTH

  9. #9
    Valiant NewTeKnight Matt's Avatar
    Join Date
    Feb 2003
    Location
    San Antonio, Texas, USA
    Posts
    13,056
    Ahhhhhh, you're using the wrong quotation marks!

    Use these ones " " (above the 2 on my keyboard).

    And not “ ”.

    See the difference " " vs “ ”

    That caught me out once, took me ages to figure it out!
    UI / UX Designer @ NewTek
    __________________________________________________
    www.pixsim.co.uk : LightWave Video Tutorials & Tools


  10. #10
    Registered User
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    21

    Uaahrg :D

    ooohps:-D

    yes, you are quite right, the damned quotation marks, rummms!
    I have copied the script and perhaps the little devil gets between the script lines (must laugh)

    @script modeler

    main
    {
    // This is a comment.
    text = "Hello dear FrankyGTH, this is my first Lightwave script!";
    info(text);
    }

    now the script runs as well as I wish...
    more I send it here perhaps... in the next days :-D

    many thanks, matt, don't know why I am so confused today

    but with this entry I have fun to work with a new script...

    see you and the next script will run without mistakes, I promise you! :-)))

    ciao and servus, FrankyGTH
    Last edited by FrankyGTH; 01-27-2009 at 08:36 AM.

  11. #11
    Valiant NewTeKnight Matt's Avatar
    Join Date
    Feb 2003
    Location
    San Antonio, Texas, USA
    Posts
    13,056
    Sure thing, feel free to ask more questions, it's good practise for me too!
    UI / UX Designer @ NewTek
    __________________________________________________
    www.pixsim.co.uk : LightWave Video Tutorials & Tools


  12. #12
    Registered User
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    21

    lightscript ;)

    hi matt, one script again, it runs, but started in the ending with an error line...
    info("Position: ",light.getPosition(frame));
    is unknown, why??? the script is one basically part of my light_script with ambient light

    @version 2.2
    @warnings
    @name "LightsTest_FB"
    generic

    //Set Globals
    {
    light = Light();

    // Display some Data Members.
    info("Name: ", light.name);
    info("Type: ", light.type);

    //Display some Methods.
    info("Position: ",light.getPosition(frame));
    info("Rotation: ",light.getRotation(frame));
    info("Scaling: ",light.getScaling(frame));
    info("Ambient: ", light.Ambient(frame));
    info("Color: ", light.Color(frame));
    }

    this script is from here:

    http://www.mikegreen.name/Lscript/Lscript%20Index.html

    perhaps you find a solution, have a nice evening, sorry for my silly questions ))

    ciao, FrankyGTH
    Last edited by FrankyGTH; 01-27-2009 at 11:37 AM.

  13. #13
    Registered User
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    21

    can somebody test this???

    hi all,
    perhaps somebody can test the light-script with the current lightwave release 9.6???
    I have worked some years with 8.3

    @version 2.2
    @warnings
    @name "LightsTest_FB"
    generic

    //Set Globals
    {
    light = Light();

    // Display some Data Members.
    info("Name: ", light.name);
    info("Type: ", light.type);

    //Display some Methods.
    info("Position: ",light.getPosition(frame));
    info("Rotation: ",light.getRotation(frame));
    info("Scaling: ",light.getScaling(frame));
    info("Ambient: ", light.Ambient(frame));
    info("Color: ", light.Color(frame));
    }

    Sometimes it runs, sometimes with error messages...

    best regards, nice day, FrankyGTH

  14. #14
    Code Muppet evenflcw's Avatar
    Join Date
    Feb 2003
    Location
    Stockholm, Sweden
    Posts
    2,642
    Where is the value to the frame variable initialized (ie. assigned a value)? Assign it a value of 0.0 for frame 0.

    You should perhaps change the variable name as, according to the docs, these methods want a time value (ie. in seconds!; =frame/fps), not a frame value (=time*fps).

    EDIT:
    There are two other errors aswell but you'll find them yourself.

    HOT TIP!
    Add the line:

    debug();

    at the top of the script (inside the { } naturally). This will open up a debugger window when you run the script and let you execute it one line at a time. Press F10 to step one line. You'll be able to watch how any variables change as the script is executing. It is a gem of a tool. (check menus for other hotkeys)
    Last edited by evenflcw; 01-28-2009 at 10:43 AM.

  15. #15
    Registered User
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    21
    hi dan thank you for the useful infos... I like it!

    I have the script from the LSscriptUserGuide haven't thought it's not running in this way...

    I need help :-)
    don't know how to handle time and frame values... I must see it, then I can understand it, there's missing a lot of LW scripts to understand the code structure, I am learning better with existing examples they are running!

    @version 2.2
    @warnings
    @name "LightsTest_FB"
    generic

    //Set Globals
    frame = 0.0;
    time = frame/fps;

    {
    light = Light();

    var time, frame;
    // time = 1/24

    debug();

    // Display some Data Members.
    info("Name: ", light.name);
    info("Type: ", light.type);

    //Display some Methods.
    info("Position: ",light.getPosition(time));
    info("Rotation: ",light.getRotation(time+1.0).h);
    info("Scaling: ",light.getScaling(time));
    info("Ambient: ", light.Ambient(time));
    info("Color: ", light.Color(time));
    }

    perhaps you can help so I can see the light in my head :-)
    don't forget I am a newbie with LW scripting...

    good evening, FrankyGTH

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •