Other question: if I try to synchronize the UI between different
sessions, should I share the model or the world every time I send the
"synchronize" instruction?
Probably. Currently, the UI is updated by small diff objects that come
out of the simulation engine—just things like, “|turtle 0|‘s |xcor| is
now |3|“. This is lightweight and all that is really needed for
rendering the view, but, depending on how interactive you want these
connected sessions to be, it might make more sense to be sharing more
about the state of the world. However, if I were undertaking your
project, I would try as much as I could to limit my project to only
transferring lightweight updates.
Where should I put the code? I tried to put it at the end of the code
you told me, but I get an error:
There are programming errors in the code that you pasted. Newlines
cannot be arbitrarily placed in Scala code, since newlines often imply
the end of a line of code. That is the source of the particular error
that you are seeing. But, furthermore, that method was returning the
|CompilationBundle| from it, but it no longer does, since, in Scala, a
method’s return value is the value of the method’s last line of code,
and you wrote a line after the |CompilationBundle| line. The compiler
will complain about this if you fix the previous error.
Realistically speaking, though, I can’t really coach on Scala web
programming through e-mail. You’re going to need at least some basic
knowledge about Scala and the Play Framework if your work is going to
require making changes to the Galapagos server.
On 05/02/2015 06:51 PM, Oscar Martinez wrote:
Hi Jason, thanks for the answer.
Where should I put the code? I tried to put it at the end of the code
you told me, but I get an error:
-------------------------------------------------------------------
ERROR
-------------------------------------------------------------------
[error] /home/ubuntu/TFIA/Galapagos/app/models/ModelSaver.scala:31:
';' expected but '.' found.
[error] -> org.nlogo.tortoise.JSIdentProvider(name) }
[error] ^
[error] one error found
[error] (compile:compile) Compilation failed
[error] application -
! @6m31kbgl4 - Internal server error, for (GET) [/] ->
play.PlayExceptions$CompilationException: Compilation error[';'
expected but '.' found.]
at
play.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27)
~[na:na]
at
play.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27)
~[na:na]
at scala.Option.map(Option.scala:145)
~[scala-library-2.11.6.jar:na]
at
play.PlayReload$anonfun$taskFailureHandler$1.apply(PlayReload.scala:49) ~[na:na]
at
play.PlayReload$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44) ~[na:na]
[warn] play - No application found at invoker init
-------------------------------------------------------------------
CODE -------------------------------------------------------------------
def apply(compiledModel: CompiledModel, jsURLs: Seq[URL] = Seq()):
CompilationBundle = {
val CompiledModel(js, model, _, _, _) = compiledModel
val widgets = model.widgets map CompiledWidget.compile(compiledModel)
val depsJS = jsURLs map slurpURL mkString("", ";\n", ";\n")
CompilationBundle(js, depsJS, Json.toJson(widgets).toString,
model.code, model.info)
* val nlToJSIdentMap = compiledModel.procedures.map { case (name,
_) => name*
* -> org.nlogo.tortoise.JSIdentProvider(name) }*
}
Other question: if I try to synchronize the UI between different
sessions, should I share the model or the world every time I send the
"synchronize" instruction?
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.