[bug ?] error exporting external scripts
Re: [bug ?] error exporting external scripts
Placed in the Superthread : Editor issues ^^
Re: [bug ?] error exporting external scripts
It's probably a bug, but we haven't checked it out yet what's going on here.
Steven Seagal of gaming industry
Re: [bug ?] error exporting external scripts
This is not a bump to catch the attention of a Dev but anyone that has successfully got past this sort of error. If so, please share. My entire map runs off external scripts with the exception of one script called gateway and I still can not Export no matter what I try.
Re: [bug ?] error exporting external scripts
Ok scratch that; this is a bump for confirmation or work around from a dev so I can play my module outside the editor. Don't worry I'll try to keep it to one bump every couple days after this one. ~laughs~ ...unless, I'm the last person who can not Export, then I'll just throw my towel in and move on.NutJob wrote:This is not a bump to catch the attention of a Dev[...]
Re: [bug ?] error exporting external scripts
Here is a workaround for you
Tested and it even seems to be save game compatible . This will make loading huge libraries with multiple scripts a breeze.
And as a bonus you don't have to place those script-enties by hand, they are created dynamically. And this means that we can load and destroy scripts any time we want, may be useful for really large and complex dungeons, like orrr3, maybe.
Code: Select all
function loadScript(entityName,scriptPath)
if findEntity(entityName) then
Console.warn('Entity named '..entityName..' already exists')
return false
end
local scr = spawn('script_entity',party.level,1,1,1,1,entityName)
scr.script:loadFile(scriptPath)
end
loadScript('test','mod_assets/jkos/my_test.lua')
loadScript('otherScript','mod_assets/jkos/my_other_test.lua')
And as a bonus you don't have to place those script-enties by hand, they are created dynamically. And this means that we can load and destroy scripts any time we want, may be useful for really large and complex dungeons, like orrr3, maybe.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
Re: [bug ?] error exporting external scripts
If I simply understood, this script consider external scripts like "items". When spawning them, we give an iteration and so, can destroy them like other items. Really wonderful/useful/epicness !JKos wrote:And as a bonus you don't have to place those script-enties by hand, they are created dynamically. And this means that we can load and destroy scripts any time we want, may be useful for really large and complex dungeons, like orrr3, maybe.
Letting NutJob testing it and I'll place it in the superthread. I think you'll make love-modders JKos
Re: [bug ?] error exporting external scripts
Appreciate the work around. While it's loading I'm now having a problem with the namespace and I'll have a lot syntax and hierarchy to rework before I can confirm it's [personally] working. I'm sure it does, though. Thanks.JKos wrote:Here is a workaround for you
Tested and it even seems to be save game compatible . This will make loading huge libraries with multiple scripts a breeze.Code: Select all
function loadScript(entityName,scriptPath) if findEntity(entityName) then Console.warn('Entity named '..entityName..' already exists') return false end local scr = spawn('script_entity',party.level,1,1,1,1,entityName) scr.script:loadFile(scriptPath) end loadScript('test','mod_assets/jkos/my_test.lua') loadScript('otherScript','mod_assets/jkos/my_other_test.lua')
And as a bonus you don't have to place those script-enties by hand, they are created dynamically. And this means that we can load and destroy scripts any time we want, may be useful for really large and complex dungeons, like orrr3, maybe.
Re: [bug ?] error exporting external scripts
What kind of namespace problems? I didn't test this much, but doesn't it work if you remove/rename your external script entites and instead load them with loadScript-method?
I mean if you have a external script entity named "lib" which points to "mod_assets/nutjob/lib.lua", just remove it from the dungeon and call loadScript("lib","mod_assets/nutjob/lib.lua")
I mean if you have a external script entity named "lib" which points to "mod_assets/nutjob/lib.lua", just remove it from the dungeon and call loadScript("lib","mod_assets/nutjob/lib.lua")
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
Re: [bug ?] error exporting external scripts
That is what I did and it can find the script_entity ('lib.script') but once it gets to my [fake] namespace "GFX" it drops me errors. The external file starts:JKos wrote:What kind of namespace problems? I didn't test this much, but doesn't it work if you remove/rename your external script entites and instead load them with loadScript-method?
I mean if you have a external script entity named "lib" which points to "mod_assets/nutjob/lib.lua", just remove it from the dungeon and call loadScript("lib","mod_assets/nutjob/lib.lua")
Code: Select all
GFX = {}
GFX.v = {}
-- followed by all functions under
GFX.myfunctionA = function() end
GFX.myfunctionB = function() end
-- and so on, using GFX.v to store any variables that need to be saved (or the odd parameter pass to something else, like when using delayedCall)
Code: Select all
lib.script.GFX.getSomethingAndDoit()
Edit: important to note I manually CUT & PASTED that script entity to the top of the dungeon.lua file so it was loaded first, so it's not a load-order issue.
Re: [bug ?] error exporting external scripts
It is a kind of load order problem, we had this same issue with LoG1 too. Dynamically loaded scripts can not be used until all Embeded scripts all loaded.
But this can be solved, I'll get back to this soon. I just have to implement same kind of autoexec-mechanism like Xanathar did with his GrimQ-library, should be easy now with dynamic connectors.
You can test this like this:
and now call this method from the console.
Edit: Ok, this is fixed now, great. But dynamically loading scrpts will be useful, so I'm going to develop this further anyway.
But this can be solved, I'll get back to this soon. I just have to implement same kind of autoexec-mechanism like Xanathar did with his GrimQ-library, should be easy now with dynamic connectors.
You can test this like this:
Code: Select all
function test()
lib.script.GFX.getSomethingAndDoit()
end
Edit: Ok, this is fixed now, great. But dynamically loading scrpts will be useful, so I'm going to develop this further anyway.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450