# KScript Editor V1.5.0



## kotori (Jan 24, 2012)

Hi everyone,

There is now a new version of my KScript Editor for Mac an PC available here: :arrow: *http://nilsliberg.se/ksp/*

Changes in 1.4.9:
Support for new pgs string functions.
Fixed bug: syntax highlighting not working on some keywords
Fixed bug: local override prefix didn't work in "on_init" functions. 
Fixed bug: return value functions declared in module imported "as" could not be used
Fixed bug: {#pragma ...} instructions didn't work with new compiler
Support for the new native pascal-like 0FFh format for hexadecimal numbers.
Support for SET_CONDITION and USE_CODE_IF constructs with the new compiler
New feature: {#pragma preserve_names ...} can be used within modules imported "as" when using the new compiler.

Sorry for being so absent here lately. I have just had so much to do. 

Cheers,
Nils


----------



## mk282 (Jan 24, 2012)

The man is back!!!

Thanks for the update, Nils! Just one question - will KScript now compile the ° character? 


Also, noticed a bug - when I set up the .KSP extension to open with KScript when double-clicked from the Explorer (or any other file manager, I use Total Commander), it doesn't open KScript, instead it crashes with this traceback:


```
Traceback (most recent call last):
  File "kscript_editor.py", line 2257, in OnFindReplace
  File "kscript_editor.py", line 2246, in OnFindFindNext
AttributeError: 'NoneType' object has no attribute 'SetFocus'
Traceback (most recent call last):
  File "kscript_editor.py", line 17, in <module>
  File "old_compiler\__init__.pyo", line 15, in <module>
  File "old_compiler\ksp_preprocessor2.pyo", line 7, in <module>
  File "old_compiler\ksp_util.pyo", line 13, in <module>
IOError: [Errno 2] No such file or directory: 'ksp_util.txt'
Traceback (most recent call last):
  File "kscript_editor.py", line 17, in <module>
  File "old_compiler\__init__.pyo", line 15, in <module>
  File "old_compiler\ksp_preprocessor2.pyo", line 7, in <module>
  File "old_compiler\ksp_util.pyo", line 13, in <module>
IOError: [Errno 2] No such file or directory: 'ksp_util.txt'
Traceback (most recent call last):
  File "kscript_editor.py", line 17, in <module>
  File "old_compiler\__init__.pyo", line 15, in <module>
  File "old_compiler\ksp_preprocessor2.pyo", line 7, in <module>
  File "old_compiler\ksp_util.pyo", line 13, in <module>
IOError: [Errno 2] No such file or directory: 'ksp_util.txt'
```


----------



## kotori (Jan 24, 2012)

*Re: KScript Editor V1.4.9*



> Thanks for the update, Nils! Just one question - will KScript now compile the ° character?


Hi mk282
Yes, it will.



> Also, noticed a bug - when I set up the .KSP extension to open with KScript when double-clicked from the Explorer (or any other file manager, I use Total Commander)


KScript Editor has always expected to have the installation directory as working directory when it's started. I made a little change in this area and uploaded a new installation file. Download it again and see if it doesn't work now.

Cheers,
Nils


----------



## dxmachina (Jan 24, 2012)

*Re: KScript Editor V1.4.9*

Thank you so much, Nils!


----------



## Thonex (Jan 24, 2012)

*Re: KScript Editor V1.4.9*

Nils!!!

Thanks so much!!! This is great!!

o-[][]-o o-[][]-o 

Cheers,

Andrew K


----------



## planblue (Jan 24, 2012)

*Re: KScript Editor V1.4.9*

Hi Nils,

BIG Thanks from me too o/~

Sorry to tell you, that I still can't use your editor for compiling my actual Kontakt 5 script.

Using the 'new compiler' it throws a syntax error after a $NI_SIGNAL_TYPE statement.
Using the 'old compiler' it has two missing definitions:
$NI_TRANSPORT_RUNNING
$CONTROL_PAR_DND_BEHAVIOUR

Code compiles without syntax errors in Kontakt 5.0.2

Is there any possibility to edit the compiler definitions in external files?
Can I help You in any way?

Thanks for your great work.
michael


----------



## kotori (Jan 24, 2012)

*Re: KScript Editor V1.4.9*

Thanks guys.

Michael,

In the installation directory there is a file called builtins.txt used by the new compiler. You should be able to add variable and function definitions there if you find anything missing.

Cheers,
Nils


----------



## mk282 (Jan 24, 2012)

*Re: KScript Editor V1.4.9*



kotori @ 24.1.2012 said:


> > Thanks for the update, Nils! Just one question - will KScript now compile the ° character?
> 
> 
> Hi mk282
> Yes, it will.



Yay, thanks!



kotori @ 24.1.2012 said:


> > Also, noticed a bug - when I set up the .KSP extension to open with KScript when double-clicked from the Explorer (or any other file manager, I use Total Commander)
> 
> 
> KScript Editor has always expected to have the installation directory as working directory when it's started. I made a little change in this area and uploaded a new installation file. Download it again and see if it doesn't work now.



It still doesn't work. It works only if I have my script (.KSP) in the KScript installation folder. But I have it in KScript Editor/My Scripts folder... and then a couple of subfolders within. Can this be remedied so that any script can be opened from any place on the drive? That'd be neat


----------



## planblue (Jan 24, 2012)

*Re: KScript Editor V1.4.9*

Thanks Nils, for the 'builtins.txt', which gives me some possibilities for testing..

I added the missing $NI_TRANSPORT_RUNNING and $CONTROL_VAR_DND_BEHAVIOUR.
(I tried to attach my edited 'builtins.txt' but - extension 'txt' is not allowed as an attachment :roll: ).

Still a strange 'syntax error' is happening on a 'select' statement.
I looked into the 'KSP Reference' and found a example, where you can reproduce, what I mean:


> { Sample from 'KSP Reference Manual' Kontakt 5.0.2 - Dezember 2011 - page 6 }
> 
> on init
> declare $mscount
> ...


May be, this helps?
I love your work (donations recommended!)

michael


----------



## planblue (Jan 24, 2012)

*Re: KScript Editor V1.4.9*

Sorry Nils - another one:

save_array() returns an integer - i changed the line in 'buildins.txt' and now my script compiles like nothing.. o=? 

thanks
michael


----------



## kotori (Jan 24, 2012)

*Re: KScript Editor V1.4.9*

I updated the PC installation. Please try now.


----------



## planblue (Jan 24, 2012)

*Re: KScript Editor V1.4.9*

Downloaded the PC installation again:

Problems with NEW compiler we discussed ('buildins.txt') are solved - compiles flawlessly.
To solve these problems with OLD compiler 'ksp_util.txt' has to be copied from 'buildins.txt' - this file is not up-to-date!

Syntax Error when new line after 'select' is still there in BOTH compilers (but can easily be avoided by NOT inserting any empty lines after 'select' and before 'case').

I tested the code optimization of the NEW compiler (from clipboard):
The parenthesis (function call) at the end of mf_get_command, mf_get_byte_one and mf_get_byte_two are removed and therefore this code doesn't compile in Kontakt 5.0.2!
OLD compiler works fine.

Is there any 'buildins' solution?
michael


----------



## kotori (Jan 25, 2012)

*Re: KScript Editor V1.4.9*

I released a :arrow: *1.5.0 version* with the following changes:

1.5.0 (2012-01-25)
Added a few missing Kontakt variables and added save_array return value.
Fixed bug: middle-click on unselected tab closed modified file without any question. (thanks to EvilDragon for reporting it)
Fixed bug: new compiler couldn't handle a parameterless function with a return
value.
Fixed bug: it's now possible to use the escape code " inside strings. (problem reported by EvilDragon)
Made it possible to close the last tab.
Made it possible to use empty lines between "select" and "case".
If you associate .ksp files with KScript Editor you can now double-click on them to open (only on PC)



planblue @ Tue Jan 24 said:


> The parenthesis (function call) at the end of mf_get_command, mf_get_byte_one and mf_get_byte_two are removed


Hi Michael,
KSP previously didn't have any parameterless functions with return values, so I had to change a thing in the compiler code to make the output correct in this case. Any new such functions in builtins.txt will work from now on.

Cheers,
Nils


----------



## tonewill (Jan 25, 2012)

*Re: KScript Editor V1.4.9*

First, thanks Nils, glad you're still able to spend time improving kscript.

I bet you hate all the bug messages though! I'm afraid I have one also. (sorry).
The new hex syntax doesn't compile when the value contains a letter (A-F obviously). Those values aren't highlighted either.


----------



## mk282 (Jan 25, 2012)

Hex values work over here. You need to write them like this:

0<hexvalue>h


----------



## kotori (Jan 25, 2012)

mk282 @ Wed Jan 25 said:


> Hex values work over here. You need to write them like this:
> 
> 0<hexvalue>h



Just to clarify. It's Kontakt that imposes this limitation and because it does so I chose to do the same in KScript Editor. Since variable names like 8dB are allowed by KScript Editor I thought that the risk of old variables unexpectedly being turned into hex numbers would be minimized that way.


----------



## tonewill (Jan 25, 2012)

Arr, right, sorry about that. I'll stick with '0x' then. I do a lot of copying and pasting hex values from windows calculator and hitting 'h' after pasting would have been an improvement, that's all.


----------



## kotori (Jan 25, 2012)

The source code of the updated compiler can be downloaded here.


----------



## dxmachina (Jan 25, 2012)

Hey Nils,

1.5 is crashing upon launch here (Mac OS 10.7.2)

1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: <_FuncPtr object at 0x72ea80>
1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: Traceback (most recent call last):
1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: File "/Applications/Nils Liberg's KScript Editor.app/Contents/Resources/__boot__.py", line 187, in <module>
1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: _run('kscript_editor.py')
1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: File "/Applications/Nils Liberg's KScript Editor.app/Contents/Resources/__boot__.py", line 184, in _run
1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: execfile(path, globals(), globals())
1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: File "/Applications/Nils Liberg's KScript Editor.app/Contents/Resources/kscript_editor.py", line 25, in <module>
1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: import old_compiler.ksp_preprocessor as ksp_preprocessor
1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: File "old_compiler/__init__.pyo", line 15, in <module>
1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: File "old_compiler/ksp_preprocessor2.pyo", line 7, in <module>
1/25/12 1:50:12.209 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: File "old_compiler/ksp_util.pyo", line 13, in <module>
1/25/12 1:50:12.210 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: IOError
1/25/12 1:50:12.210 PM [0x0-0x301301].org.pythonmac.unspecified.NilsLiberg'sKScriptEditor: : [Errno 2] No such file or directory: 'ksp_util.txt'
1/25/12 1:50:12.279 PM Nils Liberg's KScript Editor: Nils Liberg's KScript Editor Error


----------



## Big Bob (Jan 25, 2012)

Hi Nils,

Fantastic update o-[][]-o 

I see that V150 even addresses one of my original 'wishlist' items, parameterless RV functions.

Unfortunately, the first thing I tried to use it for, doesn't work :cry: 

Consider the following:

*on init*
``message('')
``*declare* x
``*if* test()
````message('yes')
``*end if*
*end on*

*function* test() -> boolean
``boolean := x = 6* or *x = 10
*end function*


You can remove the parens from the declaration but not from the reference to the function. ie if you invoke as 'if test', the compiler flags it.

Hope this is an easy one to fix.

Rejoice,

Bob


----------



## kotori (Jan 25, 2012)

Hi Bob,

user-defined parameterless functions have actually been supported for some time. The fix was related to built-in functions such as mf_get_command where the function call is included in the compiled code (unlike user-defined functions based on inlining). When I get time I'll try to see how hard it is to make your code work. The difficulty lies in the fact that one cannot see whether test is a variable or a function without knowing the context.

Regarding the OSX version I wonder if I could have made some mistake when uploading it. Please try again one more time and let me know if it still doesn't work. It seemed to work when I tested it.

Cheers,
Nils


----------



## dxmachina (Jan 25, 2012)

> Regarding the OSX version I wonder if I could have made some mistake when uploading it. Please try again one more time and let me know if it still doesn't work. It seemed to work when I tested it.



Yep, working now. Thanks!


----------



## Big Bob (Jan 25, 2012)

Hi Nils,



> The fix was related to built-in functions such as mf_get_command where the function call is included in the compiled code (unlike user-defined functions based on inlining).



Sorry, I misunderstood the above to mean one could now write RV functions without parameters without requiring the empty parenthesis.



> When I get time I'll try to see how hard it is to make your code work. The difficulty lies in the fact that one cannot see whether test is a variable or a function without knowing the context.



That would be nice if you can do it easily, but it's certainly not a biggy. The other stuff you've already done was far more important. I for one am just thrilled to have this 'wishlist' update to 1.4.8 which was already great (even with the bugs) and now is almost a 'dream come true' :D 

Again, thanks a million for a truly marvelous tool my friend o-[][]-o . 

God Bless,

Bob


----------



## planblue (Jan 26, 2012)

*Re: KScript Editor V1.4.9*

Hi Nils!



> Hi Michael,
> KSP previously didn't have any parameterless functions with return values, so I had to change a thing in the compiler code to make the output correct in this case. Any new such functions in builtins.txt will work from now on.


You are absolutely FAST o=< - everything works fine for me now. Thank You!

Of course: one wish left? So: Don't write the logfile to the program folder in Windows 7... (just kidding) o-[][]-o 

greetings
michael


----------



## tonewill (Jan 29, 2012)

It's probably me doing something wrong again, but when I use *SET_CONDITION(MY_CONDITION)* it doesn't appear in the compiled code, while in-built conditions like *SET_CONDITION(NO_SYS_SCRIPT_GROUP_START)* do. Any ideas why that might be? Many thanks.


----------



## mk282 (Jan 29, 2012)

Nils, unfortunately I found another small bug.


KScript won't compile the hex numbers in this format: 0ABCDEFH. In Kontakt it works this way too. KScript only accepts 0ABCDEFh.


----------



## Big Bob (Jan 29, 2012)

> It's probably me doing something wrong again, but when I use SET_CONDITION(MY_CONDITION) it doesn't appear in the compiled code, while in-built conditions like SET_CONDITION(NO_SYS_SCRIPT_GROUP_START) do. Any ideas why that might be? Many thanks.



This is actually a new feature of the KSE to remove the 'dead' code from the source code 'seen' by the KSP. Why do you want to retain the unused code sections?

Do you normally run with the Optimize option enabled? If so, the KSE will remove all such unnecessary code even in 'if-else' and 'select' constructs (when the conditional can be evaluated at compile time).

Of course I suppose Nils could have made the removal of the SET_CONDITION stuff optional by still including it when the Optimize option is *disabled*. Maybe Nils will comment on this when he sees your post.

Rejoice,

Bob


----------



## tonewill (Jan 29, 2012)

Hello Bob,
Thanks for replying. I think it's me not understanding it properly. I've found that if I do this in kscript:


```
SET_CONDITION(TEST)

USE_CODE_IF_NOT(TEST)
message("hello")
END_USE_CODE
```

it works as expected. I.E. when I remove the SET_CONDITION line, "hello" is displayed but not otherwise What's throwing me is that the text: *SET_CONDITION(TEST)* is not compiled in the final post F5 script, yet works :shock: . I have all the optimizations on by the way.

Barry.


----------



## kotori (Jan 29, 2012)

It's not terribly difficult to make the compiler retain the SET_CONDITION / RESET_CONDITION lines in case they are placed within callbacks and functions, but if you place them between functions/callbacks then you run into a problem: KScript Editor will automatically reorder function definitions and in order to keep the original logic even with the reordered definitions the compiler would sometimes have to insert new SET_CONDITION / RESET_CONDITION lines. Since the SET_CONDITION / RESET_CONDITION lines cannot always be retained without insertion of new lines I thought it would be a cleaner solution to have the the compiler just evaluate the conditions itself.

/Nils


----------



## tonewill (Jan 29, 2012)

Hello Nils,
Thanks, I think I understand now. kscript removes the unused code and the set_condition itself, I didn't realize that. It's fine then, no problem at all.

Many thanks.


----------



## kotori (Jan 31, 2012)

If anyone is interested in trying the features of the next KScript Editor you can download a test version http://nilsliberg.se/ksp/setup-kscript-editor-1.5.1_test.exe (here). There are some examples of new syntax in the change log shown during installation so be sure to pay attention to that.

Among other things there is new syntactic sugar that lets you write "myknob->x := 100" instead of the rather lengthy "set_control_par(get_ui_id(myknob), CONTROL_PAR_POS_X, 100)". It also works with control IDs, so you can for example write "%control_ids[2]->text := 'test'". The compiler will automatically figure out whether get_ui_id(...) should be added or not and whether the control parameter is an integer or string.

Comments are welcome.

Cheers,
Nils


----------



## kotori (Feb 1, 2012)

Here is another example of a new feature in the V1.5.1 test version: properties. A property is a kind of pseudo variable. When you assign to the property the set function of the property is invoked and when you retrieve the value of it the get function is used. The macro new_pgs in this example creates a new PGS key and a property with the same name that lets you access the PGS key as if it had been an array.

*macro* new_pgs(name, size)
``pgs_create_key(name,5)
``
``*property* name
````*function* get(index) -> result
``````result := pgs_get_key_val(name,index)
````*end function*
````*function* set(index, value)
``````pgs_set_key_val(name,index,value)
````*end function*
``*end property*
``
*end macro*

*on init*``
``new_pgs(XXX,5)
``new_pgs(YYY,3)``
``new_pgs(ZZZ,3)``
````
``_{ this will cause the get/set functions to be inlined: }_
``ZZZ[0] := XXX[2] * YYY[1]
*end on*

It's also possible to have properties whose get/set functions don't use an index parameter. They will then behave as normal scalar variables. Eg. if you declare a property that you use in order to get/set ENGINE_PAR_VOLUME then you could set the volume by writing something like "engine.volume := my_level_constant".


----------



## Dynamitec (Feb 1, 2012)

Hi Nils,
thanks soo much for all the new features and the bugfixes! 

Cheers,
Benjamin

PS: Too all other scripters here: I strongly recommend to visit Nils website and use the PayPal Donation button to support his work. As a fellow KSP developer I know how little time one has to work on 'free' projekts like the KScript Editor. It's amazing the the editor is still free, so let's support Nils work.


----------



## andreasOL (Feb 1, 2012)

Wow!

Nils is serving us KSP beans... (those who know understand :D )

Thanks for these new features. This can help write more readable code.

One should use it with some naming convention to know that it's not a normal array.

Great!

Cheers,
Andreas


----------



## kotori (Feb 1, 2012)

Andreas and Benjamin, thanks.  

I uploaded a new KScript Editor setup file (same URL) and a http://nilsliberg.se/ksp/temp/engine_properties_demo.html (demonstration script) showing the property construct in use (the import line is a link so click on it if you want to see the code in the imported module).

This version has support for properties with multiple indices. You can for example create a multi dimensional array like this:
*declare* data[100]``_{ 10 rows, 10 columns }_

*property* matrix
``*function* get(x, y) -> result
````result := data[x * 10 + y]
``*end function*
``*function* set(x, y, value)
````data[x * 10 + y] := value
``*end function*
*end property*
``
matrix[4, 5] := 10``_{ Please note that there are two indices }_``


The new compiler also has a kind of peculiar feature: it doesn't matter where in a variable reference you put the subscript - myfamily.x[10] and myfamily[10].x are equivalent. And my[1].property[2] is equivalent to my.property[1,2]. Although this may seem a bit unorthodox it can sometimes enhance readability. For example, in the demonstration script I link to above I use "group[4].slot[0].volume" since I found it clearer "groupfx[4,0].volume" (it's just a matter of taste though). It can also be practical when passing parameters to a function:

*function* clear_note(n)
``n.id := 0
``n.velocity := 0
``n.volume := 0
*end function*

*on init*
``*family* notes
````*declare* id[100]
````*declare* velocity[100]
````*declare* volume[100]
``*end* *family*
``
``_{ The subscript is added to the family name but will later 
automatically be moved to the right so that one gets
notes.id[4], notes.velocity[4] and so on }_
``clear_note(notes[4])```
*end on*


----------



## Big Bob (Feb 1, 2012)

Let me echo Benjamin's post, visit Pay Pal once in a while guys!

This always has been and continues to be a marvelous tool for script development, and, it just keeps getting better. But, just because it's available free doesn't mean we shouldn't contribute to its ongoing support and development.

I've written some fairly ambitious scripts and I know that others have written even more ambitious scripts. Such scripts would be almost a nightmare to write and maintain without the KSE. A regular visit to Pay Pal will help insure ongoing improvement and support.

Thank you again Nils for a fantastic tool. o-[][]-o 

God Bless,

Bob


----------



## tonewill (Feb 1, 2012)

> Let me echo Benjamin's post, visit Pay Pal once in a while guys!


I agree, just been and done that. I sell some of my work so I'd feel pretty bad if I didn't donate every once in a while.


----------



## Big Bob (Feb 1, 2012)

Hey everyone, this new property feature is really very spiffy :D . Let me encourage you to start playing with it.

I'll also mention that Nils' pgs example, using a macro to both declare the pgs var and to declare a property to access it also is very ingenious. However, I should point out that while it works beautifully for declaring and accessing pgs vars, it can't be used as is for ordinary varibles. The reason is that pgs vars are very special and apparently the compiler doesn't check for things like multiple definitions and such.

Thus the example can use the same name for the pgs var as for the property. If one were to use this same exact kind of macro to implement 2-dimensional arrays you can't name both the array and the property with the same name. However, one can easily design the macro to give a name variant to array and use the desired name for the property.

For example:

*on init*
``new_2d(MyArray,10,10)
``new_2d(YourArray,5,8 )
``MyArray[4,5] := YourArray[3,7]
*end on*

*macro* new_2d(#name#,rows,cols)
``*declare* _#name#[rows*cols]
``*property* #name# 
````*function* get(x, y) -> result 
``````result := _#name#[x * cols + y] 
````*end function* 
````*function* set(x, y, value) 
``````_#name#[x * cols + y] := value 
````*end function* 
``*end property*```
*end macro*


Here I've simply used an underscore prefix for the actual array but you could make up your own convention for the variant.

Anyway, great new feature Nils o-[][]-o 

Now, let me get back to the fun of tinkering with this 'new kid on the block' 

Rejoice,

Bob

EDIT: Sorry, I forgot to change the 10* thing so I've corrected the posted code above. I hope this didn't cause any confusion. :oops:


----------



## Big Bob (Feb 1, 2012)

Hi Nils,

Here's kind of an odd thing I just noticed. This is probably not a new problem, but, take a look at the following code.

*on init*
``new_pgs(HOLD,1)
``*if* CC[HOLD[0]] > 63
````message('pedal down')
``*else*
````message('pedal up')
``*end if*
*end on*

*macro* new_pgs(#name#,size)
``pgs_create_key(WIPS.#name#,size)
``*property* #name#
````*function* get(index) -> result
``````result := pgs_get_key_val(WIPS.#name#,index)
````*end function*
````*function* set(index,value)
``````pgs_set_key_val(WIPS.#name#,index,value)
````*end function*
``*end property*
*end macro* _{ new_pgs }_

The problem is that the pgs var actually is given the name WIPS.HOLD. ie the dot is not replaced by a double underscore. So naturally, Kontakt will reject it. This is apparently a macro problem rather than a property problem. Of course one can easily work around this by changing the macro to prefix WIPS__ instead of WIPS. but I thought I'd call it to your attention. It might be nice if one could stick with the dot notation at the source-code level.

Although, this may only be a problem with pgs vars, ie I haven't tried this with ordinary vars, I guess I should try that next.

Rejoice,

Bob

*EDIT: Yep, the dot notation works just fine with ordinary vars. So, this is probably just due to the special treatment of pgs var names.* So, false alarm. :oops:


----------



## tonewill (Feb 3, 2012)

Hello Nils,
Great update, been using it to update an old library of mine to test it out. Love the new syntax, so far been re-creating the UI with it. Came across one minor bug so far unless I'm doing it wrong:

*variable->hide_part := HIDE_PART_BG* will give an error: *$CONTROL_PAR_HIDE_PART* has not been declared. I think you meant to use *$CONTROL_PAR_HIDE* but as I say, I might be doing it wrong.

Will post anything else if I find it.

Barry.


----------



## kotori (Feb 3, 2012)

Bob, 
there is a condition in the compiler to ignore the first parameter of pgs functions, so as you noticed they are a bit special.

Barry,
thanks. There is only ->hide and no ->hide_part. The code completion in the editor has not yet been updated to recognize whether one is typing a control parameter or a normal variable. The only thing that works at the moment is hitting Ctrl+Space directly after "->". I guess it was a Ctrl+Shift+Space command that incorrectly filled out that hide_part.


----------



## tonewill (Feb 4, 2012)

Thanks Nils, got it now. How I got hide_part was by typing 'h' and pressing shift + space. My eyes skipped over 'hide' and straight to 'hide_part' without thinking :oops:.


----------



## gh (Feb 4, 2012)

Hello Nils!

The new features are simpy fantastic. Thank you!

Playing around with version 1.51 I have noticed 2 minor things:

1) auto indent doesn't work for property/end property
2) Builtins.txt
a) missing function: show_library_tab
b) missing variables: $INST_LIB_PIC_ONE_ID
$INST_LIB_PIC_TWO_ID
$INST_LIB_COPYRIGHT_ID
$INST_LIB_DESCRIPTION_ID

Cheers
Günter


----------



## kotori (Feb 4, 2012)

Hi Günter,
thank you (and thanks also for making the KSE 1.4.8 patch). Fixes for the problems that you reported will be included in the next version. I guess those functions and variables must be undocumented because I couldn't find any info about them in the reference manual.

Btw. at the moment I'm working with Big Bob on how to make a special bread of functions re-entrant by storing function parameters and local variables in a thread-local storage (or rather "callback-local"). This type of function is invoked using "call" but unlike what's the case for normal functions one can use parameters (eg. "call myfunc(x, y)"). If it goes well I'll try to include it in an upcoming version.

Cheers,
Nils


----------



## mk282 (Feb 4, 2012)

Nils, those commands are listed in Kontakt Player Developer's Guide. 

Yes, NI's documentation is all over the place. We should've already gotten used to that!


----------



## moonstruck180 (Feb 5, 2012)

Wooo! Thank You!!


----------

