Page 1 of 1

sim.addScriptText seems to not work any more in Version 3.6

Posted: 18 Feb 2019, 16:59
by streets
Hi,

I have the following function:

addAndAttachScript = function(inInts, inFloats, inStrings, inBuffer)
sim.addStatusbarMessage("about to attach script")

local objectHandle = inInts[1]
local scriptType = inInts[2]
local scriptContent = inStrings[1]

local scriptHandle = sim.addScript(scriptType + sim_scripttype_threaded)

errVal = sim.setScriptText(scriptHandle, scriptContent)
sim.addStatusbarMessage(scriptContent)
sim.addStatusbarMessage("call to sim.setScriptText returned")
sim.addStatusbarMessage(errVal)
sim.associateScriptWithObject(scriptHandle, objectHandle)

return {scriptHandle}, {}, {}, ""
end


When I call this function via remote API, the status bar messages report the correct content of the script (variable scriptContent) and the return value is 1 and there is no other error reported on the status bar. The addition of the script works but the script remains empty when I open it. Accordingly calls to script functions fail.

This used to work in Version 3.5.

Re: sim.addScriptText seems to not work any more in Version 3.6

Posted: 18 Feb 2019, 17:36
by Justus
I can confirm this issue, a simple child script like this:

Code: Select all

local hndScript=sim.addScript(sim.scripttype_childscript+sim.scripttype_threaded)
local strScriptText="print('hello world!')"
sim.setScriptText(hndScript,strScriptText)
sim.associateScriptWithObject(hndScript,sim.getObjectHandle('Dummy0'))
works in 3.5, not in 3.6. The script is created, but has no contents.

EDIT: fixed in 3.6.0 rev 1

Re: sim.addScriptText seems to not work any more in Version 3.6

Posted: 20 Feb 2019, 10:06
by coppelia
Thanks Justus!