# KScript Editor V1.20



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

Cool, very cool, Nils.  

How do you accept donations?

Btw, double clicking on the Navigation panel border toggles its show/hide status, in case you didn't know.


----------



## kotori (Jan 13, 2007)

Nickie Fønshauge @ Sat Jan 13 said:


> Cool, very cool, Nils.
> 
> How do you accept donations?


Thanks Nickie!  

I accept donations through paypal at the download page (see the image below the download link). It seems that the number of donations using a credit card (as opposed to using a paypal account) is limited on free paypal accounts such as mine, so if anyone wants to donate by cannot, please send me a PM and let me know.

Cheers,
Nils


----------



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

How on earth could I overlook that link. :roll: It proves the old saying: It's the eyes, that first go blind.



Done. It's not much this time - more may follow. Christmas is still hurting :wink:


----------



## Dynamitec (Jan 13, 2007)

Wow! Thanks Nils! This is nice!

May i ask how far you've got with the python parser engine you wanted to use? I still would need some inline and preprocessor functions... like we once talked about 

Thanks again!!!


----------



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

Big Bob @ 14th January 2007 said:


> I've only been able to get it to close by double clicking, how to you get it back open other than by dragging the border?


Hiya, Bob

Placer the cursor on the Navigation pane border (marked with red) and double click, when it becomes a double pointed arrow.


----------



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

kotori @ 14th January 2007 said:


> The library.zip file should be usable in its compressed state as well. It is to me at least.


And so it is. I always assumed, I had to unpack it. Nice to know, I dont' have to do that anymore. :smile: 

Bob, you can get the double arrow in two different positions - and they are very close to each other: 

 * on the window border itself, where it signifies, that you can rescale the window
*and on the bar, I painted red, where it signifies, that you can rescale the navigation panel
It's only a tiny blink between those two positions.

Nils, I always install on top of the previous version; this time was no different, and double clicking still works. But maybe that's why the Navigation Panel wasn't hidden by default, like you said.


----------



## kotori (Jan 14, 2007)

:arrow: With the kind help from http://frankvangompel.com/ (Frank van Gompel) the latest version has now been ported to *OSX* and is available for download.

Btw. it seems that there is now a universal binary package of the GUI library I use, so it would be possible to make the editor available for Intel macs as well (and linux too for that matter), should there be an interest.

PS. Nickie, thanks for all help explaining. 
Installing the editor on top of another version should be ok.


----------



## Big Bob (Jan 14, 2007)

Hi Nickie (and Nils),

Thanks for all the detailed info. I know that this is going to turn out to be something very simple but right now it's driving me nuts because I still can't get it to work :oops: .

Nils,
I always install into a new folder (I keep about a half-dozen of the prior versions installed until I get a lot of confidence in the latest). However, I still tried deleting the settings.dat file and let it get created again just in case but this didn't help.


and Nickie regarding


> Bob, you can get the double arrow in two different positions - and they are very close to each other:
> 
> * on the window border itself, where it signifies, that you can rescale the window
> *and on the bar, I painted red, where it signifies, that you can rescale the navigation panel



I do see both of these 'double-arrow' positions but double clicking either has the same result -- no effect  .

Since I can't seem to make this thing work, in spite of all your effort (even to the extent of coloring the separation strip red for me), I think I should make sure we are all talking about the same thing here. When the navigation pane is open some distance, when I double click the right edge it snaps closed (ie the right-edge bar moves to the extreme left, just to the right of the left window border). Now, to open the pane again I have to drag this same vertical bar to the right where I want it. However, if I understand everyone correctly, you are saying that instead of dragging this splitter bar, I can simply double click it and it will 'snap back' to the right, thereby opening the pane again? 

I have not been able to obtain the 'snap to the right' action no matter what I seem to do. The only way I can reopen the pane is to drag the splitter bar to the right.

I guess I'm going bonkers or I must be having a bad dream and hopefully I'll wake up soon. :wink: (Or could I be on Candid Camera?)

God Bless,

Bob

PS I'm running under XP SP2 but I am using mostly Windows Classic views and settings. Could this problem perhaps be related to some difference in my Windows settings? I have most of the cutesy animation stuff, etc disabled.


----------



## Big Bob (Jan 14, 2007)

kotori @ Sun Jan 14 said:


> Hi Bob,
> 
> It seems the double-click toggle doesn't work when one uses the classic window style. I'll try to see if I can fix this. But if I understood you right you can still use the navigation panel, right?



Oh yes definitely, I use it all the time. I just have to drag it to the right to 'open' it and that's not really a problem. But, since Nickie indicated the double click thing was supposed to open as well as close the pane, I thought I must be doing something wrong. If it's the classic view versus 'XP style' causing the problem, please don't spend any more time on this just for my benefit, I'm very happy to live with it the way it is.

God Bless,

Bob


----------



## Big Bob (Jan 17, 2007)

Hi Nils,

The next time you are tweaking your editor, here is a hopefully small thing I'd like to see added. Could you make the parenthesis optional for the control name in a UICB block header, as it is for 'if', 'select', etc?

Currently it must be written as:

```
on ui_control (xyz)
  ------
end on
```

I would like the option of writing it as:

```
on ui_control xyz
  ------
end on
```

If this isn't difficult to do it would be very nice because I keep forgetting to enclose the control name in parenthesis and of course the KSP spits it out. Boy, how spoiled we get huh? :wink: 

God Bless,

Bob


----------



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

It's great to be spoiled


----------



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

Hi Nils,

Sorry to spoil your weekend, but there is still a small bug in the Navigation Panel. If I have a function "update_GUI_Vibrato_Fade_in" in front of another one "update_GUI_Vibrato", I am taken to "update_GUI_Vibrato_Fade_in" when I select "update_GUI_Vibrato".

It seems the editor searches from the top and stops whenever it encounters a string, that matches, even partially, the selected string, instead of looking for whole strings, that match.

It is no big deal; I can get around it by declaring functions alphabetically. I just thought you should know.


----------



## kotori (Jan 20, 2007)

Nickie, Yes, I have noticed that problem myself and I got a bit surprised since I made an attempt at fixing this before releasing V1.20. I'll fix this when I get time, but since it's not very serious I can't say that it has that high a priority.

Bob, how about if I implement an error check for the parenthesis so that leaving them out will make the compiler bring your attention to it?

Cheers,
Nils


----------



## kotori (Jan 21, 2007)

Dynamitec @ Sat Jan 13 said:


> May i ask how far you've got with the python parser engine you wanted to use? I still would need some inline and preprocessor functions... like we once talked about



Not that far. I haven't really looked much on it since I went away before Christmas. But I decided to go through it a bit today. Checked out some solutions using the Visitor design pattern to walk/modify the parse tree, which seemed to work out well. I can't say it has come that far yet though. I can generate parse trees and I now have some helper classes to make it possible to do the analysis necessary to compile it, but the actual compilation phase steps are not yet implemented. 

/Nils


----------



## kotori (Jan 22, 2007)

Mostly for fun I generated a graph of the syntax tree for a portion of the SIPS legato script using the new compiler engine (in it's current state) using Graphviz. Kind of cool.  Maybe this kind of graphing could be used for something later on, eg. visualizing dependencies in the code.

Cheers,
Nils


----------



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

Hi Nils/anybody,

I was under the impression, that I could edit ksp_util.txt, in order to include items not currently supported by the editor. I tried to add three built in variables, that are a bit obscure and not yet supported by the editor:

$INTMOD_TYPE_LFO 
$LFO_TYPE_SINE 
$INTMOD_TYPE_NONE

I added them immediately after the $FILTER_TYPE_ variables, but then I can't open the editor. It gives me an error messages and tells me to see the log file. Am I completely off track here or what? How do I go about with this?


----------



## Thonex (Jan 22, 2007)

Wow Nils... that graph/flow chart is pretty cool. It's amazing that a program was able to do that automatically.

Thanks for sharing.

T

BTW.... SIPS' chart is pretty involved :lol:


----------



## kotori (Jan 22, 2007)

Hi Nickie,
It should indeed be possible to edit the ksp_util.txt file. However, upon doing so it seems that many newlines go away. This is probably the normal problem when one uses text files on different platforms - that the end of line character differs. I'll fix this.

Cheers,
Nils


----------



## Dynamitec (Jan 23, 2007)

> Mostly for fun I generated a graph of the syntax tree for a portion of the SIPS legato script using the new compiler engine (in it's current state) using Graphviz. Kind of cool. Cool Maybe this kind of graphing could be used for something later on, eg. visualizing dependencies in the code.



Hi Nils,

this looks interesting! 

I had an idea about the whole parsing stuff tonight: it would be very nice to have those syntax definitions / translation definitions in an extra file (like you have it with "ksp_utils.txt")  So one could adjust the language or add new things to it...

What do you think?


----------



## Dynamitec (Jan 23, 2007)

Hi Nils,

a little report from me. I use your 1.20 build around 6-8 hours a day  So far: i had no crash and no problems (Kontakt crashs around 10-20 times a day).

Another suggestion: I can see how much time you put into this project! And with the new parsing engine and all that comes with it i think you should change your license system a little bit. Keep the editor free for personal use, but don't allow commerical products with your free editor! I don't see any point why someone should make money with a free product.

I think everyone would profit from this, since you have a compensation for your work. The editor (which you could even improve more if you have a little compensation for your work) would be free for everyone. And if someone earns money with it (and i think you can't write any really great commercial script without it) he or she could give you a little bit from that. It just would be fair.


----------



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

kotori @ 23rd January 2007 said:


> Hi Nickie,
> It should indeed be possible to edit the ksp_util.txt file. However, upon doing so it seems that many newlines go away. This is probably the normal problem when one uses text files on different platforms - that the end of line character differs. I'll fix this.


Thanks, Nils. It would be very helpful to be able to edit this file.


----------



## kotori (Jan 23, 2007)

Nickie, thanks again for pointing this out. I uploaded a slightly modified version of 1.20 which you can download from the web page. I hope you will be able to edit this version of ksp_util.txt (the three variables you mentioned have been inserted).



Dynamitec said:


> it would be very nice to have those syntax definitions / translation definitions in an extra file. So one could adjust the language or add new things to it...


I think I could do that. I haven't decided whether to release the actual compilation phase as open source or not, but in any case I could open up the parsing part and make it possible to augment the grammar with syntactic sugar by modifying how the abstract syntax tree is built. Btw. here's the http://nilsliberg.se/ksp/grammar.html (grammar) for the extended ksp (and a http://nilsliberg.se/ksp/grammar_graph.png (graph) for those who like that better  ). 

Regarding commerical use of the compiler I'm a bit undecided. Do you other guys (and girls/women!) have any suggestions?
I'm glad that you find the editor stable Benjamin. Btw. I've had 109 downloads of the version 1.20 (25 mac, 84 pc) so far, so it's getting popular. 

Cheers,
Nils


----------



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

Thanks, Nils. I'll give it a try.


EDIT: Sorry, Nils. But when I add a few more variables


*$INTMOD_TYPE_AHDSR
$INTMOD_TYPE_DBD*
$INTMOD_TYPE_LFO
$LFO_TYPE_SINE*
$LFO_TYPE_RECT
$LFO_TYPE_TRI
$LFO_TYPE_SAW
$LFO_TYPE_RAND*
$INTMOD_TYPE_NONE 

I get the same error message again. They were inserted like you see them here (without the boldface, of course).

EDIT EDIT: I wiped out the old installation and did a clean reinstall. Now it works. :smile:


----------



## kotori (Jan 23, 2007)

Nickie Fønshauge @ Tue Jan 23 said:


> EDIT EDIT: I wiped out the old installation and did a clean reinstall. Now it works. :smile:


Great! Thanks for letting me know. I'll run a comparison of all variables in the documentation and those in ksp_util.txt when I find time to see if there are more of them.

Cheers,
Nils


----------



## kotori (Jan 23, 2007)

Hi Nickie,
Yes, you're right. That's one area where my compiler differs slightly from how Kontakt works. KSP has different namespaces for each type of variable (eg. scalars and arrays) and functions while my compiler just has one namespace and will report any - as it perceives - redeclarations (except in some cases like this - for no good reason really). I think I'm going to keep this single namespace because it's much easier to work with and having this constraint doesn't affect many scripts nor hurt much in my view. Maybe you could call your knob "fadein" instead. :wink: 

Cheers,
Nils


----------



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

Ah, so that's why. You cannot have functions and variables with the same name. Well, easy enough to avoid, as long as I know it. :smile:


----------



## Big Bob (Jan 30, 2007)

Hi Nils,

I think I found a new V1.20 NL Editor problem. Take a look at the following code using what I think you called 'functional' programming. The function UserProcess uses a dummy parameter 'fname' which is to be replaced by the name of a user-supplied routine. In the NCB, UserProcess is invoked with fname = Calculate.

The compiled code body is just fine but the problem is that local variables declared in Calculate (or any functions called by Calculate such as Helper) are not declared in the ICB. In the example shown, this means that zz and ww are not declared. I suspect this problem is related to the new feature of the editor that omits declaring locals defined in functions that aren't referenced. Since the Calculate function is referenced only indirectly, I guess the editor doesn't see it as referenced?

Allowing the user to pass the name of a function that he/she writes will be a very useful feature that will allow a library routine to provide 'hooks' to what will later be user-supplied routines. However, having to write the user-supplied functions without any local vars will be somewhat limiting, so I hope this is something easy to fix. If it's not easy to fix in an automatic way, perhaps you could provide a programmer-assisted fix like a new keyword that forces locals to be declared even if the compiler 'thinks' the enclosing function isn't referenced?

God Bless,

Bob

*on init*
``*declare* yy
*end on*

*on note*
``UserProcess(Calculate)
*end on*

*function* UserProcess(fname)
``*declare* xx
``
``fname(13,6,xx)
``message(xx)
*end function*

*function* Calculate(p1,p2,result)
``*declare* zz
``
``Helper
``zz := p1 - p2
``inc(zz)
``result := zz
*end function*

*function* Helper
``*declare* ww
``
``inc(ww)
*end function*

_{ ------------------- Compiled Code --------------------- }_

*on init*
``*declare* $yy
``*declare* $_xx
*end on*

*on note*
``_{begin UserProcess(Calculate)}_
````
````_{begin Calculate(13,6,$_xx)}_
``````
``````_{begin Helper}_
````````
````````inc($_ww)
``````_{end Helper}_
``````$_zz := 13 - 6
``````inc($_zz)
``````$_xx := $_zz
````_{end Calculate(13,6,$_xx)}_
````message($_xx)
``_{end UserProcess(Calculate)}_
*end on*


----------



## kotori (Jan 30, 2007)

Hi Bob,
You're right. I posted an http://nilsliberg.se/ksp/setup-kscript-editor-1.20.1.exe (V1.20.1) update which you can try out. I hope this will work better.

Cheers,
Nils


----------



## Big Bob (Jan 30, 2007)

Thanks Nils, that was sure fast! 

I've just downloaded it and I'll post some feedback after some test time.

God Bless,

Bob


----------



## Big Bob (Jan 30, 2007)

Hi Nils,

V1.20.1 seems to have solved the problem. Thanks a million and have a beautiful day Nils.

God Bless,

Bob


----------



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

*Disappearing file with KScript Editor 1.20.0*

Nils, I am afraid I have to report a wee problem with v1.20.0 (I have not tried v1.20.1 yet). A moment ago, when I clicked "Open" in the File | Open... window, the file I tried to open vanished from the face of the earth. Just like that. Poof! And it was gone. :shock: It didn't open and it disappeared from the folder. Luckily I had just made a backup of it.


----------



## kotori (Feb 1, 2007)

*Re: Disappearing file with KScript Editor 1.20.0*



Nickie Fønshauge @ Thu Feb 01 said:


> Nils, I am afraid I have to report a wee problem with v1.20.0 (I have not tried v1.20.1 yet). A moment ago, when I clicked "Open" in the File | Open... window, the file I tried to open vanished from the face of the earth. Just like that. Poof! And it was gone. :shock: It didn't open and it disappeared from the folder. Luckily I had just made a backup of it.



Are you sure? 
I must say I find that very hard to believe because nowhere in the source code I call any function for removing files. 
Could there be an external cause for this? Please elaborate a bit on the circumstances if possible.


----------



## Nickie Fønshauge (Feb 9, 2007)

Hi Nils/all,

I have encountered a strange error (bug?), that I can't quite figue out. This is declared in an imported file:

``*declare* *const* FALSE := 0
``*declare* *const* TRUE := 1
``*declare* *const* OFF := 0
``*declare* *const* ON := 1
``*declare* *const* C := 0
``*declare* *const* Cis := 1
``*declare* *const* D := 2
``*declare* *const* Dis := 3
``*declare* *const* E := 4

and it is compiled into:


```
declare const $15 := 0
declare const $57 := 1
declare const $512 := 0
declare const $394 := 1
declare const KeySwitch__C := 0
declare const KeySwitch__Cis := 1
declare const KeySwitch__D := 2
declare const KeySwitch__Dis := 3
declare const KeySwitch__E := 4
```

Why don't C, Cis, D, Dis and E get compiled properly, when the other constants do? I may be going blind or dumb, but I can't see the difference.

UPDATE: If I add a "$" to C, Cis, D, Dis and E they get compiled correctly, but not without "$". :?:

UPDATE 2: Even with "$" in the declarations, references to these constants are still screwed up.

UPDATE 3: It turned out I can't have a constant and a family with the same name on the same level. Beats me why, since familie names never exist on their own, but only as a part of a variable/constant name :?:


----------



## Nickie Fønshauge (Feb 9, 2007)

By the way Nils, is there any chance you can fix the "if 1 = 1" issue with import files. I just now ran into the parser stack overflow again in a file with 3417 "on init" lines. Many of these lines come from import modules and I fear very much I won't be able to work around the bug this time. If this is the case, a project I have been working on for months will be put dead in the sea. :cry:

EDIT: Never mind. I did find a workaround


----------



## Dynamitec (Feb 9, 2007)

> Your editor is a wee tad more efficient when dealing with 11200 line scripts



Hehe,
Nickie, i second that! That's why i splitted up my guitar script into a two slot script...it's taking soooo long to copy and paste a script into kontakt. I "just" have a little bit more than 10000 lines in the first slot, but the second slot now also has more than 5000 lines...15000 lines in kontakt...this would be pain.


----------



## kotori (Feb 9, 2007)

The new compiler code base which I'm working on got a bit complicated in certain areas and I don't know when I'll find time to iron it out. However, as long as I don't have to do any actual translation of extendeò¯r   PÞ§¯r   PÞ¨¯r   PÞ©¯r   PÞª¯r   PÞ«¯s   PÞ¬¯s   PÞ­¯s   PÞ®¯s   PÞ¯¯s   PÞ°¯s   PÞ±¯s   PÞ²¯s   PÞ³¯s   PÞ´¯s   PÞµ¯s   PÞ¶¯s   PÞ·¯s   PÞ¸¯s   PÞ¹¯s   PÞº¯s   PÞ»¯s   PÞ¼¯s   PÞ½¯s   PÞ¾¯s   PÞ¿¯s   PÞÀ¯s   PÞÁ¯s   PÞÂ¯s   PÞÃ¯s   PÞÄ¯s   PÞÅ¯s   PÞÆ¯s   PÞÇ¯s   PÞÈ¯s   PÞÉ¯s   PÞÊ¯s   PÞË¯s   PÞÌ¯s   PÞÍ¯s   PÞÎ¯s   PÞÏ¯s   PÞÐ¯s   PÞÑ¯s   PÞÒ¯s   PÞÓ¯s   PÞÔ¯s   PÞÕ¯s   PÞÖ¯s   PÞ×¯s   PÞØ¯s   PÞÙ¯s   PÞÚ¯s   PÞÛ¯s   PÞÜ¯s   PÞÝ¯s   PÞÞ¯s   PÞß¯s   PÞà¯s   PÞá¯s   PÞâ¯s   PÞã¯s   PÞä¯s   PÞå¯s   PÞæ¯s   PÞç¯s   PÞè¯s   PÞé¯s   PÞê¯s   PÞë¯s   PÞì¯s   PÞí¯s   PÞî¯s   PÞï¯s   PÞð¯s   PÞñ¯s   PÞò¯s   PÞó¯s   PÞô¯s   PÞõ¯t   PÞö¯t   PÞ÷¯t   PÞø¯t   PÞù¯t   PÞú¯t   PÞû¯t   PÞü¯t   PÞý¯t   PÞþ¯t   PÞÿ¯t   Pß ¯t   Pß¯t   Pß¯t   Pß¯t   Pß¯t   Pß¯t   Pß¯t   Pß¯t   Pß¯t   Pß	¯t   Pß
¯t   Pß¯t   Pß¯t   Pß ¯t   Pß¯t   Pß¯t   Pß¯t   Pß¯t   P


----------

