Results 1 to 7 of 7

Thread: Where do I start from?

  1. #1
    Registered User
    Join Date
    Aug 2018
    Location
    Kkkkk
    Posts
    7

    Where do I start from?

    I'm interested in learning Lscript but I've no idea where should I start from. There are no (Official) tutorials , nor any video courses .

  2. #2
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,522
    In your Lightwave folder, there is the SDK Folder. There should be an lscript archive, that should contain the original documentation. The first exercise is replacing the weld tool, which use to have an annoying popup at the end you had to click through.

    lScript is very C like. Every line ends in a ";". Scripts differ between modeler and layout. However, you'll probably only deal with modeler scripts (main {...} ) and layout generic (generic {...} ).

    Here's the aforementioned weld script...
    Code:
    @script modeler
    @warnings off
    @name Weld Points
    
    main
    {
        selmode(DIRECT);
        pntCnt = pointcount();
        if(pntCnt == 0 ) error("No points selected!");
        editbegin();
        lastPntPos = pointinfo(points[pntCnt]);
        for(currPnt = 1; currPnt <= pntCnt; currPnt++)
        {
            pointmove(points[currPnt],lastPntPos);
        }
        editend();
        mergepoints();
    }
    And here's an invaluable guide : http://www.mikegreen.name/Lscript/Lscript%20Index.html

    Above all, ASK Questions. And look through the scripting forum. And keep in mind that the documentation for lscript is in a poor state, having been ill maintained for many years. You may have to work out your own solutions.
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  3. #3
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,522
    Where to start :
    1) Have an idea. To start with, a simple task that is clearly defined.
    2) What steps do you need to do to accomplish 1)? Write them down, in sequence.
    3) Begin looking at commands that will accomplish each step in 2).
    4) Begin debugging. The most common mistake in lscript is a missing ; at the end of the line. The debug(); statement is your friend. Repeat 4) until there are no more errors, and script functions as intended.

    The first program most people write in school is "Hello World!".

    1) Print "Hello, World!" On the screen.
    2) this task is so simple, it does not need steps.
    3) Looking through Mr. Green's lscript reference, we find the info command under messages.

    So, our code for modeler would look something like this:
    Code:
    main{
        info("Hello, World!");
    }
    For layout, the code is slightly different:
    Code:
    generic{
        info("Hello, World!");
    }
    And there you go, your first script.

    I would also reccomend that you learn Python. If you can't get it done in lscript, you can probably get it done in Python, which wraps the LW SDK.
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  4. #4

    isn't Python the way to go these days ?
    LW vidz   DPont donate   LightWiki   RHiggit   IKBooster   My vidz

  5. #5
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,522
    I would agree, but lscript is a good starter language.
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  6. #6

    yeah, looked a bit easier, i have no idea though  

    Nomen, you might want to check out theses videos also >
    https://www.youtube.com/user/erikals...=Lscript+Deuce

    and >
    https://www.youtube.com/watch?v=rRgnqWGojIM
    LW vidz   DPont donate   LightWiki   RHiggit   IKBooster   My vidz

  7. #7
    Registered User
    Join Date
    Aug 2018
    Location
    Kkkkk
    Posts
    7
    Thank you Kryslin & erikals

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
  •