# KScript Editor version 1.18 is out



## kotori (Dec 19, 2006)

Hi everyone,
Version 1.18 of my editor is now available for download.

_Changes:_
Printing fixed (was broken in 1.17)
Integrated patch so that it natively supports all variables/functions/callback types in Kontakt 2.2.
Added a navigation panel to the left. See the updated screenshot.
_How to use the navigation panel:_ Functions are green and callbacks blue. Click on one to go there. Alternatively one can use Ctrl+Tab to alternate between the editor and navigation pane. In addition to clicking on the items it's also possible to select them using the arrow keys or by simply writing the first few letters of the desired item. I hope this will make it easier to get an overview of the code. One can double-click on the splitter between the left and right pane to minimize the left pane (or simply drag it to the left).

Cheers,
Nils


----------



## Dynamitec (Dec 19, 2006)

Nils! This is outstanding!!! Thank you very, very much!!!!!!

I'm sooo glad you do all this great work for us!

Benjamin


----------



## Dynamitec (Dec 19, 2006)

> Added a navigation panel to the left. See the updated screenshot.


I tried it now! I have to say: this is one of the most important features for me! It's so much easier to edit large scripts now! Really, really good!


----------



## xylophonetic (Dec 19, 2006)

Anyone know how powerful the K2 scripting engine is? If it would theoretically be possible to mimic the technology created by AI? features like player balancing according to the number of chord notes, natural delay, dynamic sample switching controlled by a function analysing all input signals should be possible no?

Then, besides sample management, the processing like EQ and reverb, how far would that be possible to incorporate?


If it's theoretically doable, I would be up for the job


----------



## gh (Dec 19, 2006)

Hi Nils!

Thank you so much. Whenever you visit Vienna (Austria) please let me know, I owe you a couple of beers. :lol: 

Günter


----------



## Dynamitec (Dec 19, 2006)

Hi thomastorfs!



> Anyone know how powerful the K2 scripting engine is? If it would theoretically be possible to mimic the technology created by AI? features like player balancing according to the number of chord notes, natural delay, dynamic sample switching controlled by a function analysing all input signals should be possible no?


The K2 Scripting engine is very powerful. It's possible to mimic a lot of AI. Dynamic sample switching is possible as well as humanizing.



> Then, besides sample management, the processing like EQ and reverb, how far would that be possible to incorporate?


I tested a lot of timbre changing stuff with EQ. It's possible however: it's not possible to modulate them (for example to mimic timbre changes on string vibratos) since there is noise. But: for example the timbre changing if you bend a string on a guitar can be simulated.
[/quote]


----------



## kotori (Dec 19, 2006)

Dynamitec @ Tue Dec 19 said:


> It's possible however: it's not possible to modulate them (for example to mimic timbre changes on string vibratos) since there is noise. But: for example the timbre changing if you bend a string on a guitar can be simulated.



In my experience the means KSP gives to directly modulate parameters produces noise when used rapidly in some situations. However, if one has a custom-built instrument one can set up CC modulation and use KSP to set the CC values. This latter solution doesn't produce noise AFAIK. Thomas, please start a new thread if you want to continue the discussion.

Cheers,
Nils


----------



## Big Bob (Dec 19, 2006)

Hey all you guys and gals, let's hear it for Kotori once again!  

Welcome back Nils and, I personally want to tell you that
*V1.18 of the NL Editor/KScript Editor is truly marvelous. *Everyone who writes scripts owes you many thanks for this great tool.

The new Navigation Feature is really spiffy, especially with large scripts. Thanks a million for adding this.

God Bless,

Oh, and Merry Christmas everyone.

Bob


----------



## kotori (Dec 19, 2006)

Thanks everyone and a Merry Christmas to you all!  

(Btw. In Japan they often write "Happy Merry Christmas", but surely that's a bit odd? :???: 
Hmm... I do hope the trip made my Japanese improve more than my English worsened :lol: )

Nils


----------



## Thonex (Dec 19, 2006)

Thanks Nils... this is truly awesome.

I'm sure this will work with K2.1.1... yes?

Thanks for an early Christmas gift.

Cheers Nils,

T


----------



## xylophonetic (Dec 19, 2006)

Hi Nils,

my apologies for being off-topic. The subject just opened my eyes. Thanks for the wonderful program!


- Thomas


----------



## kotori (Dec 19, 2006)

Hi Thomas,
No problem. The capabilities of KSP are always interesting to discuss, so please do start a new thread about it if you want.

/Nils


----------



## Nickie Fønshauge (Dec 19, 2006)

kotori @ 19th December 2006 said:


> However, if one has a custom-built instrument one can set up CC modulation and use KSP to set the CC values. This latter solution doesn't produce noise AFAIK.


Unfortunately, many CC values in rapid succession can produce noise.

Thanks for the update. It looks interesting.


----------



## Nickie Fønshauge (Dec 30, 2006)

Hi Nils,

:!: I like the new navigation pane very much. I did notice a small bug, though. When I click the function *update_Profile*, the function *update_Profile_Display* (located earlier) gets selected instead. I just thought you should know. :smile: 

:?: And now a feature request: Would it be possible to show a selectable tree structure of all (nested) families of the on_init block in the navigation pane?

I want to thank you for giving us this immensely powerful program, and I hope you will keep developing it in 2007. NI really should pay you for it.

Happy New Year to you and all the other script kiddies! :lol:


----------



## jibrish (Dec 30, 2006)

I'm the most rudimentary user... but this is great.
Thanks Nils!


----------



## mmosc (Dec 30, 2006)

Katori

A great tool just keeps getting better, really like the navigation bar. Can't thank you enough for this indespensible tool. I agree with Nickie NI sould pay you and include it in K2.

Mike


----------



## kotori (Dec 30, 2006)

Thank you very much! :smile: 

Nickie, thanks for posting that problem. I'll try to fix it. I thought about making the navigation panel tree structured but opted for the more simple design currently in use in order to get the 1.18 version out quicker. I would also like to have imports presented as expandable tree items, but that would require quite some work. Currently I'm leaning towards implementing support for tabs with multiple simultaneous scripts first.



Nickie Fønshauge @ Sat Dec 30 said:


> Happy New Year to you and all the other script kiddies! :lol:


Hehe, that's funny :lol:. Happy New Year everbody!


----------



## Nickie Fønshauge (Dec 30, 2006)

kotori @ 30th December 2006 said:


> Currently I'm leaning towards implementing support for tabs with multiple simultaneous scripts first.


Sounds like a really cool idea.  Does it imply, that imports automatically open up in separate tabs? That would be nice. If it does, don't forget that imports can be nested.


----------



## kotori (Dec 31, 2006)

Nickie Fønshauge @ Sun Dec 31 said:


> Sounds like a really cool idea.  Does it imply, that imports automatically open up in separate tabs? That would be nice. If it does, don't forget that imports can be nested.


I like the program to adhere to the principle of least astonishment, so I'm a little hesitant to do that. I'm thinking more in the lines of the user manually opening the files he/she wants. Maybe also some basic workspace implementation to make it possible to quickly bring up a set of files again.


----------



## Big Bob (Dec 31, 2006)

Hi Nils,

I remember once when you told me that you thought I had a way with words but, for this one, I've got to pass the mantle! :wink: 



> I like the program to adhere to the principle of least astonishment



I think that is the best way I ever heard something like that expressed, not to mention that I surely agree with the philosophy behind it  

And, Happy New Year Everyone

Bob


----------



## Nickie Fønshauge (Jan 1, 2007)

All I can say is, that you don't get astonished if you know what you are doing. :wink: You could have two options; one for the easily astonished and one for those, who know what they are doing.


----------



## kotori (Jan 1, 2007)

Nickie Fønshauge @ Mon Jan 01 said:


> All I can say is, that you don't get astonished if you know what you are doing. :wink: You could have two options; one for the easily astonished and one for those, who know what they are doing.



Hi Nickie,
Hehe, thanks for bringing the subjectivity of astonishment to my attention. :lol: 
I'm beginning to weaken :wink:, so I'll consider implementing this as an option. Another component of this is that the program currently doesn't stop you from opening the same file twice at the same time. If the editor opens files automatically one would also expect it to take a bit more responsibility for knowing about files already being open in another instance of the program. 

Cheers,
Nils


----------



## Big Bob (Jan 1, 2007)

Nickie Fønshauge @ Mon Jan 01 said:


> All I can say is, that you don't get astonished if you know what you are doing. :wink: You could have two options; one for the easily astonished and one for those, who know what they are doing.



Now now Nickie,

Just wait until you get a lot older. I'm at the point where everything astonishes me :o . I'm amazed every morning that I'm still here :wink:

But then it looks like I made it into 2007 so who knows, maybe I can handle a little astonishment with the NL Editor, so bring it on :lol: .

God Bless,

Bob


----------



## Nickie Fønshauge (Jan 1, 2007)

Big Bob @ 1st January 2007 said:


> Now now Nickie,
> 
> Just wait until you get a lot older. I'm at the point where everything astonishes me :o . I'm amazed every morning that I'm still here :wink:
> 
> ...


I didn't really have you in mind, Bob. Script kiddies like you don't usually get easily astonished


----------



## Nickie Fønshauge (Jan 1, 2007)

kotori @ 1st January 2007 said:


> Hi Nickie,
> Hehe, thanks for bringing the subjectivity of astonishment to my attention. :lol:
> I'm beginning to weaken :wink:, so I'll consider implementing this as an option.


I'm glad to hear, you're not a hard man, Nils :smile: 



kotori @ 1st January 2007 said:


> Another component of this is that the program currently doesn't stop you from opening the same file twice at the same time. If the editor opens files automatically one would also expect it to take a bit more responsibility for knowing about files already being open in another instance of the program.


I am aware of this fact. Of course, responsibility on the part of the editor is only needed where responsibility on the part of the user is lacking. And a user, that dares to face possible astonishment, would have to be responsible ... or just foolhardy :wink:


----------



## Nickie Fønshauge (Jan 5, 2007)

Hi Nils,

I've run into a serious problem (for me at least) with the editor. I copied the "on init" block from a working script and pasted it into a brand new script, only I changed it to "function on_init". It seems I can't declare variables inside "if 1=1" blocks in imported modules - it works in a standard script, though. I need these blocks to avoid the infamous "Parser stack overflow". Is this something you can fix?

There is (was?) a similar problem with families in standard scripts. I am guessing they are related and I think you once said, it would be possible to fix this.

Cheers


----------



## kotori (Jan 5, 2007)

Hi Nickie,
Maybe instead of this:
````*function* on_init
``````*if* 1=1
````````*declare* x
``````*end if*
````*end function*

````*on init*``````
``````on_init``````
````*end on*

You could write your script like this:
````*function* on_init
``````*declare* x
````*end function*

````*on init*
``````*if* 1=1
````````on_init
``````*end if*
````*end on*

Does this workaround work for you?

Cheers,
Nils


----------



## Nickie Fønshauge (Jan 5, 2007)

kotori @ 5th January 2007 said:


> Does this workaround work for you?



I doubt it. It is a 2051 line (compiled&compacted) "on init" block with many "if 1=1" blocks. But I wil give it a try.


EDIT: I tried it now, and the result was as I expected: "parser stack overflow".


----------



## kotori (Jan 5, 2007)

Nickie Fønshauge @ Fri Jan 05 said:


> kotori @ 5th January 2007 said:
> 
> 
> > Does this workaround work for you?
> ...



Please note that if you use several functions for declaring the variables you can wrap the function invocations within "if 1=1" like this:
````*function* on_init_xvars
``````*declare* x
````*end function*

````*function* on_init_yvars
``````*declare* y
````*end function*

````*function* on_init
``````*if* 1=1
````````on_init_xvars
``````*end if*
``````*if* 1=1
````````on_init_yvars
``````*end if*
````*end function*

If this seem very akward I'll try to remove this limit to make it possible to declare variables everywhere and send you a beta of the compiler for testing (if you like).

Cheers,
Nils


----------



## Nickie Fønshauge (Jan 5, 2007)

Hi Nils,

I am trying to implement your last suggestion, but K2.2 gives me some odd parser errors. It claims that the variable "%227" is not declared in 

declare %227[$427]
set_text ($229, "Filter 0 ")
%180[$139] := 4
%179[$139] := 2
set_text ($70, "Filter 1 ")
%232[$139] := 5
%233[$139] := 2
set_text ($102, "Filter 2 ")
%58[$139] := 4
%57[$139] := 3
set_text ($152, "Filter 3 ")
%381[$139] := 5
%239[$139] := 3
set_text ($372, "Filter 4 ")
%101[$139] := 4
%20[$139] := 4
set_text ($352, "Filter 5 ")
%431[$139] := 5
%432[$139] := 4
set_text ($252, "Filter 6 ")
%272[$139] := 4
%271[$139] := 5
set_text ($325, "Filter 7 ")
%421[$139] := 5
%422[$139] := 5
set_text ($167, "Filter 8 ")
%341[$139] := 4
%340[$139] := 6
set_text ($194, "Filter 9 ")
%43[$139] := 5
%44[$139] := 6
if ($306 = $365)
set_text ($192, "")
@267 := ""
@197 := ""
@166 := ""
@328 := ""
@9 := ""
@397 := ""
@36 := ""
@198 := ""
@407 := ""
@168 := ""
message ("")
end if
%64[$139] := 1
%342[$139] := 2
set_text ($103, "Clear window")
%226[$139] := 2
%227[$139] := 5
if ($306 = $365)

which it obviously is. These lines are part of the same "if 1=1" block within a "on_init_function" block. This is the source code:


``````````*family* Position
````````````*declare* x[View.Pages]
````````````*declare* y[View.Pages]
````````````Debug.Window.Clear.Position.x[View.Page.Debug0] := 2
````````````Debug.Window.Clear.Position.y[View.Page.Debug0] := 5
``````````*end* *family*_{Position}_


Any ideas?

EDIT: The problem seems to be the constant $427, used in the declaration %227. $427 is declared *after* %227! The same goes with other constants, that result in the same error.


----------



## kotori (Jan 5, 2007)

Hi Nickie,
It seems K2 is very bad at reporting errors in an intelligible manner. If a variable is reported undeclared even though it evidently is, it's often the array size or initialization expression which contains an error. I would have a closer look at that $427 variable. 

If it would be ok for you to have me look at the code (and I completely understand if for some reason it's not possible), please feel free to mail it to me.

Cheers,
Nils


----------



## Nickie Fønshauge (Jan 5, 2007)

Hi Nils,

I know now what the problem is. When everything is declared in the "on init" block - the way I used to do it - the compiler puts all constant declarations at the top of the "on init" block. When I split the "on init" into multiple functions, like you suggested, constants are only put at the top of the function block, meaning the sequence of functions now becomes crucial.

I'll see if I can rearrange things. If everything goes completely sour for me, I'll send the source code to you. Thanks for your help!


----------



## Nickie Fønshauge (Jan 5, 2007)

Bulls Eye! 


EDIT: Too rash. K2.2 crashes, when I close its script editor window.  Probably because the blocks are too big; it has happened to me before. :sigh: It looks like I cannot split it further without breking the Family structure, and that would really create havock.


----------

