The need to host scripts


I need some real clarification regarding putting entity scripts into entities.

Now logic (well my logic) dictates this… one script > one entity put the script in the entity.

But noooo

I am unable to run a script inside an entity, I have to upload the script to a webhost and provide a URL.

A silly little one line script, every single silly one line script, of which I will need to write hundreds eventually, and I cant just put them into entities?

Tell me I have this wrong please, tell me I dont have to upload and forever host every single script I write for hifi,
or kill me now.

I am going to save my words until I hear one way or the other, and believe me if the answer is what I fear, then this is a mistake of monumental proportion.
Just tell me I can put a script (eventually) in an entity and I will be happy.


kills you now


@Adrian You mean “direct code direction” per (see “Attaching Scripts to Entities”) … according to the docs it should be possible, and I’m sure it used to be possible once upon a time.


Direct code injection yeah, as the doc says yeah, cause I wrote that doc over 12 months ago now, and it was possible then but hasnt been for a long time.

Have you tried it? Has anybody else tried it?

Still waiting for an official answer on this @chris ?


Nice doc, @Adrian!

Just tried it now and no, it doesn’t want to work. Get an error in program log:

[03/20 20:30:14] [DEBUG] ScriptEngine::loadEntityScript() entity: [entity-id: "{34e660cf-495b-438e-819b-f098ac59487b}" ] 
[03/20 20:30:14] [DEBUG]     NOT CONSTRUCTOR
[03/20 20:30:14] [DEBUG]     SCRIPT: "file:///"```

@Chris I've entered an Asana bug report for this.


OK thanks @ctrlaltdavid. Internally we do not do it that way, we use a host (e.g. gist) or ATP.


@chris can you confirm that this is intentional or a bug? Is this the way its going to stay?
Your reply doesnt quite confirm anything, thanks.


It is a bug and has been marked as a bug. You used to be able to just embed the script in the value, not needing a URL. Internally, we are working on crash bugs and networking so this bug is not at the top of the list.


Cool, thanks for the reply. I dont mind that it doesnt have priority, just glad this is not a permanent state.