1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Script development tools

Discussion in 'Scripting Workshop' started by kotori, May 14, 2008.

  1. kotori

    kotori NI Product Owner

    Messages:
    1,153
    Hi everyone,

    Since there's now a new scripting subforum (thanks NI!) I thought I'd post a short note about my script editor in case there are newcomers who haven't heard of it. This freely available software makes it easier to work with scripts by giving you syntax highlighting, code completion, call-tips and an integrated KSP reference. It has syntax checking which detects most common errors.

    It also features an integrated script compiler which lets you use extra syntactic sugar and then have this compiled to standard KSP code which can be used Kontakt: the import keyword lets you modularize your code and split it up into multiple files to simplify code reuse, the function keyword lets you define your own functions, you may omit variable prefix characters like $ and % to make the code clearer, etc. Pressing F5 in the editor compiles the open script and places the resulting code on the clipboard ready for pasting into Kontakt.

    KScript Editor download page
    Documentation of the extended syntax

    In addition to this forum VI-Control is a good place to learn about and get help with scripting.

    Regards,
    Nils
     
  2. Big Bob

    Big Bob Forum Member

    Messages:
    606
    KScript Editor

    No scripter should be without this Great Editor! Since Nils has graciously made it available without charge, why use anything else?

    And, don't let the long list of powerful features and options intimidate you; you can use the KScript Editor as a plain vanilla editor if you want. Even without all the advanced features, the KScript Editor is K2/K3 'oriented', so you get all kinds of fringe benefits like syntax highlighting and an 'online' KSP reference.

    Then, once you get used to using the KScript Editor as a simple editor, you can slowly (and at your own pace) begin to explore and start using the more powerful features and options that will allow you to make your souce code ever so much more readable and easy to maintain.

    Once you start using this editor, you'll wonder why anyone would want to read or write scripts any other way. I cannot recommend it more highly. Try it, you'll love it.

    Thanks a million Nils for a truly wonderful tool.

    God Bless,

    Bob
     
  3. Thomas @ NI

    Thomas @ NI Administrator

    Messages:
    1,576
    Thanks Nils! I am making this thread a sticky now.

    Regards, Thomas
     
  4. chikitin

    chikitin NI Product Owner

    Messages:
    140
    Nils. I am trying to get into script writing! Seems very difficult but very intersting. How did you start? did you start in the school?

    Any help would be greatly appreciated.

    regards,

    cs
     
  5. kotori

    kotori NI Product Owner

    Messages:
    1,153
    Hi chitikin,

    I started programming in sixth grade or something on a machine like this.
    When you know a couple of procedural programming languages you realize that they are all quite similar and often borrows syntax from each other. The syntax of the KSP language is for example quite similar to the programming language Pascal so picking it up was easy. Of course it takes some time to learn all built-in functions, variables and quirks of Kontakt though.

    If you are interested I wrote an introduction to script development which can be used as a complement to the KSP tutorial pdf bundled with Kontakt. My tutorial, being shorter and all, is not necessarily easier to follow but it's structured in another way so hopefully it should be able to provide a good overview of the different aspects of the scripting language.

    Regards,
    N
     
  6. chikitin

    chikitin NI Product Owner

    Messages:
    140
    Thanks for the encouragement. I know already a few programming paradigms: procedural, fuctional, rule-based. Thanks for the informatin.

    chekad
     
  7. Dimitris Plagiannis

    Dimitris Plagiannis New Member

    Messages:
    11
    Hej and Thanks!

    Thank you very much for this wonderful tool!

    I also have a question for you:
    The horizontal scrollbar in the code panel doesn't appear automatically when it should (when lines exceed panel width). Vertical bar works just fine. Is this a known problem? Can I do something to make it work?
    Btw, I'm using v1.25.6 on WinXP.

    Best,

    Dimitris
     
  8. kotori

    kotori NI Product Owner

    Messages:
    1,153
    Hi Dimitris
    Thanks! Glad you like it.

    The absence of the horizontal scrollbar is by design. I find that trying to keep lines within the visible size enhances readability and if just a few lines happen to go outside the window I don't want a horizontal scrollbar to occupy vertical space since it would do this even when these rare long lines are vertically scrolled out of sight.
    In KSP it's possible to break a long line into multiple lines using the ... syntax. Furthermore, since my compiler makes it possible to use user-defined functions there is less need for deep nesting. The HOME and END keys and Ctrl+Left / Ctrl+Right provide convenient ways to move through the code. If you have the KSP Reference panel open you can close that to save some space.

    It's not like I'm completely against adding horizontal scrollbars as an option, but I can't say I see very much use for them. I hope this makes sense.

    Best,
    Nils
     
  9. Dimitris Plagiannis

    Dimitris Plagiannis New Member

    Messages:
    11
    Yes, I see your point.

    It's not nesting, but some debug lines that end up longish, but the ... syntax will do just fine. I had no idea about it, thanks for that as well!

    Ha det bra :)

    Dimitris
     
  10. dksellou

    dksellou NI Product Owner

    Messages:
    96
    Just Only To Mention That I Am Happy To Find A Greek Guy In The Forum. I Am Also Greek.
    Have A Wonderful Day.
     
  11. cc.

    cc. New Member

    Messages:
    5
    This editor looks very interesting!

    It seems that there is something wrong with the website at the moment though, all the pages that rely on python (eg http://nilsliberg.se/ksp/using_functions.py) just give blank pages.
     
  12. Xill

    Xill Forum Member

    Messages:
    55
    Looks very interesting but all the links are dead.
     
  13. cc.

    cc. New Member

    Messages:
    5
  14. Xill

    Xill Forum Member

    Messages:
    55
  15. brunodegazio

    brunodegazio New Member

    Messages:
    15
    KScript Editor for Kontakt 3.5?

    Is there a version (OSX) that can open K3.5 scripts?

    I've been trying 1.3.0, which will not.

    thanks
    Bruno
     
  16. cc.

    cc. New Member

    Messages:
    5
    If you need new constructs, it is possible to extend the Nil's editor just by editing a text file.

    On OSX the file it is somewhere like:
    /Applications/Nils Liberg's KScript Editor.app/Contents/Resources/ksp_util.txt

    The syntax is pretty easy to figure out.

    You need to restart the editor afterwards for your changes to take effect.
     
  17. kotori

    kotori NI Product Owner

    Messages:
    1,153
    I have updated KScript Editor to support all new Kontakt 4 KSP features (and also added documentation for these in the integrated and searchable KSP reference).

    The new version is available for both Windows and OSX. >>Download<<
     
  18. losan

    losan Forum Member

    Messages:
    627
    Hi Nils,

    just a quick thank you for all that you contributed to the Kontakt crowd.
    You really deserve it - much appreciated.
    (Just to let you know, that there are people out there, who don't take all the work you did and share it with others as self-evident).

    :)
     
  19. kotori

    kotori NI Product Owner

    Messages:
    1,153
    That's very kind of you. Thank you! :)

    Btw. there was one new feature of the KScript Editor that I forgot to mention in the message that appears during installation: the ability to have the editor automatically save the compiled code to a file upon successful compilation. Details can be found here. The reason for this new option is that Kontakt 4 apparently provides a way to let you establish links to files containing script source code in order to make updating script source easier.
     
  20. Dimitris Plagiannis

    Dimitris Plagiannis New Member

    Messages:
    11
    Thank you very much!