Adding new script via Remote API

Typically: "How do I... ", "How can I... " questions
Post Reply
Posts: 8
Joined: 17 Jul 2014, 11:28

Adding new script via Remote API

Post by tumsimon »

Hi coppelia,

The task to be performed is very easy, just following a defined path. But the path is supposed to come from Remote API.

I understand it is possible to define a path via remote API. I guess you can transfer the path-values and then use a signal to execute the regular API createPath and InsertPathCtrlPoints functions. Is that right?

Beyond that, it would be even greater, if it was possible to also define the child script with the path following functionality via remote API. Is that in any way possible? I imagine just having my robot model and the main script and then remotely assigning a chid script to the model base to make the movement possible.

Thanks for your help!


Site Admin
Posts: 7911
Joined: 14 Dec 2012, 00:25

Re: Adding new script via Remote API

Post by coppelia »

Hello Simon,

yes, that is correct.

Currently there is no possibility to define a child script and to attach it to an object from another child script.

But you could have a child script with following code:

Code: Select all

require "myScript"
It will look for a file myScript.lua and execute the function functionDefinedInFileMyScriptAbove in that file. You will have to try what happens if the file gets dynamically changed though.

Another way would be to prepare several dummy objects with attached child scripts. Flag the child scripts as Explicit handling in here so that they won't get executed by default. You can then untag them programmatically with simSetExplicitHandling, so that they will be executed when needed.


Post Reply