Well, it’s not necessarily true that a given NetLogo model will even have |setup| and |go|. Even so, the code for compiling NetLogo procedures into JavaScript code lives in the *Tortoise repository* (here <https://github.com/NetLogo/Tortoise/blob/4ec73a487c3f8dc6f3583c0e588491511f81e0aa/src/main/scala/Compiler.scala#L54-L62>). Neither |go| nor |setup| is given any special treatment there. You can make changes to the Tortoise compiler at the place that I linked, but it’s not straightforward to get your new Tortoise |.jar| file into Galapagos. However, I would be able to help you with that if that’s what you want to do.

Maybe it you’d just prefer an easier solution, though. It isn’t elegant, but maybe you could add something like this to the end of the JavaScript for the standalone pages:

|__go = go;
go = function() {
  __go();
  sendMyWebSocketStuff();
};

__setup = setup;
setup = function() {
  __setup();
  setupWebSocket();
};
|

This way, you can essentially enhance the |setup| and |go| calls without having to really mess with the compiler and building new Tortoise artifacts.

On 4/26/2015 1:28 AM, Oscar Martinez wrote:

Hi Jason,

I saw that piece of code, but what I'm looking for the piece of code where Galapagos compiles the netlogo model (.nlogo file), because I would like to add some "web socket instructions" to function as "Go" ot "Setup".

Thanks,

On Saturday, April 25, 2015 at 11:12:32 PM UTC-6, Oscar Martinez wrote:

    Hi,

    I have been investigating about Galapagos/Tortoise, because my
    idea it's to connect two different session of Tortoise through Web
    Sockets. By the moment, I have gotten take a pre-compiled model
    and modify it to have two different sessions using NodeJS. I also
    have a local intance of Galapagos, running and generating savable
    JS tortoise models.

    The new step in my project is to modified the JS code generated by
    Galapagos to add my custom code, automatically. But, I haven't
    found where the .nlogo code is compiled. I have checked the scala
    files, and I pretty sure it's near of
    <models.ModelCollectionCompiler> in line 36
    <CompiledModel.fromNlogoContents(contents).map(ModelSaver(_))>,
    but I haven't understand exactly what's next.

    Kind regards,

--
You received this message because you are subscribed to the Google Groups "netlogo-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

​

--
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to