{"action":"created","issue":{"url":"https://api.github.com/repos/highfidelity/hifi/issues/9012","repository_url":"https://api.github.com/repos/highfidelity/hifi","labels_url":"https://api.github.com/repos/highfidelity/hifi/issues/9012/labels{/name}","comments_url":"https://api.github.com/repos/highfidelity/hifi/issues/9012/comments","events_url":"https://api.github.com/repos/highfidelity/hifi/issues/9012/events","html_url":"https://github.com/highfidelity/hifi/issues/9012","id":187501783,"number":9012,"title":"Script.include() ignoring previously included: Breaks library use in multiple entities.","user":{"login":"Menithal","id":11814599,"avatar_url":"https://avatars.githubusercontent.com/u/11814599?v=3","gravatar_id":"","url":"https://api.github.com/users/Menithal","html_url":"https://github.com/Menithal","followers_url":"https://api.github.com/users/Menithal/followers","following_url":"https://api.github.com/users/Menithal/following{/other_user}","gists_url":"https://api.github.com/users/Menithal/gists{/gist_id}","starred_url":"https://api.github.com/users/Menithal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Menithal/subscriptions","organizations_url":"https://api.github.com/users/Menithal/orgs","repos_url":"https://api.github.com/users/Menithal/repos","events_url":"https://api.github.com/users/Menithal/events{/privacy}","received_events_url":"https://api.github.com/users/Menithal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-05T15:00:38Z","updated_at":"2016-11-10T22:48:20Z","closed_at":null,"body":"This breaks usage of using external library / or utility scripts within entities, as set variables never be set for the instance.\r\n\r\nNew entities using the same script ignore the entire Script.include line, causing issues as references created in the library script are never defined every subsequent time the script is run. If you have multiple entities running the same script that has the Script.include, basically only one of the entities will ever run without errors.\r\n\r\nReloading the script also causes this not to be re-run. Current work around is to use\r\n> Script.include(\"script?\" + Math.random());\r\n\r\nThis doesnt take advantage of the caching if we have to randomize each instance, and it also does not fix the issue if multiple scripts are running the same script.\r\n\r\nThis is especially vital for having external framework libraries, such as the one [I am working on.](https://github.com/Menithal/hifi-js-wrap)"},"comment":{"url":"https://api.github.com/repos/highfidelity/hifi/issues/comments/259830967","html_url":"https://github.com/highfidelity/hifi/issues/9012#issuecomment-259830967","issue_url":"https://api.github.com/repos/highfidelity/hifi/issues/9012","id":259830967,"user":{"login":"sethalves","id":1137072,"avatar_url":"https://avatars.githubusercontent.com/u/1137072?v=3","gravatar_id":"","url":"https://api.github.com/users/sethalves","html_url":"https://github.com/sethalves","followers_url":"https://api.github.com/users/sethalves/followers","following_url":"https://api.github.com/users/sethalves/following{/other_user}","gists_url":"https://api.github.com/users/sethalves/gists{/gist_id}","starred_url":"https://api.github.com/users/sethalves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethalves/subscriptions","organizations_url":"https://api.github.com/users/sethalves/orgs","repos_url":"https://api.github.com/users/sethalves/repos","events_url":"https://api.github.com/users/sethalves/events{/privacy}","received_events_url":"https://api.github.com/users/sethalves/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T22:48:20Z","updated_at":"2016-11-10T22:48:20Z","body":"Is this due to\r\n```javascript\r\nvoid ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) {\r\n    ...\r\n    if (!_includedURLs.contains(thisURL)) {\r\n        ...\r\n    } else {\r\n        qCDebug(scriptengine) << \"Script.include() ignoring previously included url:\" << thisURL;\r\n    }\r\n}\r\n```\r\n?"}}
{"actor":{"display_login":"sethalves"}}