Hey, just wanted to share some of my work using ko...
# scripting
e
Hey, just wanted to share some of my work using kotlin scripting: https://openrndr.discourse.group/t/improved-live-coding-with-orx-olive/106 and

https://www.youtube.com/watch?v=qdgnRct0_nw&feature=youtu.be&t=12428

n
really cool, i have to play with that at some point, can this take external input.. lets say watch a file or socket ? or analyze sound ? that did not seems to use .kts files.. so are you using kotlin scripting or just watching and recompilg the file while holding into the data ?
e
@Nikky that's described in the discourse post. I watch the .kt then generate a kotlin script wrapper around it and feed it to the kotlin scripting host
n
ohh thats a cool solution
e
Should be possible to introduce 'persistent' parts too, for sound and video streams, but that's currently not supported in this setup
would be fun to try it with things like https://plugins.jetbrains.com/plugin/11955-teamhub
l
@edwinRNDR I'm needing a similar functionality, but I take the script as a string and put it on a kafka topic and I am doing something some of hacky... I take the user script string and inject into a larger class string and compile that
@edwinRNDR can you point in your code where it does the eval or compile. I am don't know what this rx-olive thing is or how it suppose to work, is that a separate app to where the user types in the code?
here is how I;m doing the scripting
e
https://github.com/openrndr/orx/tree/master/orx-olive/src/main/kotlin this is the sourcecode for orx-olive. there is some code that is specific to making things work with OPENRNDR but I think the part you are looking for is in the ScriptObjectLoader files
l
thank you, funny you are doing something similar to me which is creating a string with variables to compile
e
yeah 🙂
l
I didn't understand in your post what you were saying about Antlr grammar files.
I thought there might a way to take teh script and parse it then I'm not sure, something cleaner than string injection
e
there's a mode (that is used in the video) that watches .kt files for changes, it looks for a specific part in the code (that is very specific to how OPENRNDR works) and wraps that in a script
l
so you use the parser to find that specific part in the code
?
e
likely there are simpler ways but I may eventually want to do a bit more analysis of the sourcecode, so opted for using Antlr for parsing
l
thanks for sharing, one last question, can you link to where you do the parsing I can't find it
e