well . you can include js content by putting your Utils into Cycling ’74/jsextensions/ folder .
This way your functions are seen within every JS project used in max .
Personally i would love to have #include directive as an option and be specific to the current project, but thats not possible without writing a compiler for JS (someone did) ,
every changes require recompiling .
There is third option . Pack your utils into Global object inside one JS instance and access it in another .
mostly im using the last one .
Thanks for the tip with the Global. Works fine!
Excuse me, but I’m not sure to understand that third solution about global object :/ someone can explain ?
U are able to setup a global object in one JS instance, that holds your methods/variables/objects and access them inside other JS instances .
But in Max 7 weve got new directives https://cycling74.com/forums/topic/js-require/ that let us concatinate functionality .
It’s very unfortunate that the implementation of JS
require is wrong – or at least, it was wrong in the first release of Max 7 (I haven’t upgraded, partly for that reason, partly because I have shows coming up and want to wait until there’s a break with some time to kill before potentially destabilizing my world. I hear good things about Max 7 but experience with software in general leads me to caution…)
The issue is that you can’t refer to files in subdirectories – even though the Common JS spec requires it. It’s unfortunate, because most third-party Common JS packages do use subdirectories in their
require sections, rendering them incompatible with Max/MSP’s JS implementation.
I do hope this gets fixed and I will upgrade to Max 7 the moment it is… hint hint hint! :-) There was some argument last time this came up as to whether this was even a bug but I think the Common JS specification is authoritative in this matter…
OK :) thank!
Heh, well, I wrote the examples of this, but it actually uses gcc and make, standard tools that are on pretty well every machine!
I’d love to stop having that phase – if nothing else to avoid the error where I change the program and forget to compile them – and perhaps when Max 7 JS handles relative paths I can!
It makes my life much easier when I’m not dragging wires to land on tiny inlets… :-)
Its not popular approach here :) its against Max’ing attitude :D . Since dealing with the coding myself , im patching less for similar reasons , desires and efficiency . But we wont be applaud for this here , its sort of a sin not to wire stuff TOM :)))))))))
A sin! :-o ;-)
Well, "Better to reign in Hell, than to serve in Heaven." Though I’m pretty sure Satan invented the computer mouse…
you mean Douglas Engelbart ? you ingrate :DDDDD