LuaRules in Map files (revisited) and 77b4
Moderator: Moderators
LuaRules in Map files (revisited) and 77b4
Hi Guys,
I've written a couple of LuaRules gadgets that I had intended to put into some maps I was working on - a teleporter, unit duplicator, and an "end game" scenario for a map where you have to hold 5 points to win. I'd just gotten them working under 76b1, with some graphical effects, only for them to stop working under 77b4.
Does anyone know of anything that changed that would have likely caused this and/or how I could work around it?
Under the svn build of Spring that came with the first release of PURE they still work (conversely the "WorldBuilder_GPL" map seemed to loose it's rain when I tried to run in under 77b4).
For now I guess I'll go back to looking through the Spring source code to see if I can find it myself.
Cheers.
I've written a couple of LuaRules gadgets that I had intended to put into some maps I was working on - a teleporter, unit duplicator, and an "end game" scenario for a map where you have to hold 5 points to win. I'd just gotten them working under 76b1, with some graphical effects, only for them to stop working under 77b4.
Does anyone know of anything that changed that would have likely caused this and/or how I could work around it?
Under the svn build of Spring that came with the first release of PURE they still work (conversely the "WorldBuilder_GPL" map seemed to loose it's rain when I tried to run in under 77b4).
For now I guess I'll go back to looking through the Spring source code to see if I can find it myself.
Cheers.
Re: LuaRules in Map files (revisited) and 77b4
You don't get an error in Infolog, just a crash or non-functional Gadget?
Re: LuaRules in Map files (revisited) and 77b4
No errors in Infolog and Spring just runs fine without crashing.
My Initialize() call-in's both run for synced and unsynced, but my gadget:DrawWorld() call-in from my unsynced code isn't, and neither is my gadget:GameFrame(framenumber) from my synced code.
Even when I trim the code down to just the above call-ins and have them both do nothing other than a Spring.Echo so that I know that they've run, they still don't work.
I might try a clean install of Spring tonight and maybe look closer through the gadgets.lua code as well as the related c++.
My Initialize() call-in's both run for synced and unsynced, but my gadget:DrawWorld() call-in from my unsynced code isn't, and neither is my gadget:GameFrame(framenumber) from my synced code.
Even when I trim the code down to just the above call-ins and have them both do nothing other than a Spring.Echo so that I know that they've run, they still don't work.
I might try a clean install of Spring tonight and maybe look closer through the gadgets.lua code as well as the related c++.
Re: LuaRules in Map files (revisited) and 77b4
Hmm. Strange. gadget:DrawWorld() and gadget:GameFrame work just fine over here, although I should note that GameFrame is a sync operation, IIRC. If you'd care to post some code, I'll give it a whirl, see if I can pin it down.
Re: LuaRules in Map files (revisited) and 77b4
Thanks for your assistance Argh.
I did a clean install of 77b4 and found that the LuaRules in my map didn't work for the latest versions of BA or CA, but did work for an older mod that didn't have any LuaRules scripts in it, so it must be some conflict happening.
This gives me somewhere to start at least :)
I noticed from the log file that when I launch BA (or CA) with my map that one of the LUPS lua scripts fail, but when I use my map with its lua removed, there are no errors. I'll work back through the source and see what's run and when.
I did a clean install of 77b4 and found that the LuaRules in my map didn't work for the latest versions of BA or CA, but did work for an older mod that didn't have any LuaRules scripts in it, so it must be some conflict happening.
This gives me somewhere to start at least :)
I noticed from the log file that when I launch BA (or CA) with my map that one of the LUPS lua scripts fail, but when I use my map with its lua removed, there are no errors. I'll work back through the source and see what's run and when.
Re: LuaRules in Map files (revisited) and 77b4
You're supposed to use LuaGaia in a map, LuaRules is only for mods.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: LuaRules in Map files (revisited) and 77b4
That's not entirely accurate KDR, but unfortunately I dunno how to explain why I would say that. Argh could prolly explain what I mean.
Re: LuaRules in Map files (revisited) and 77b4
KDR is right.
The only reason why LuaRules gadgets in maps get loaded is because the current VFS can't differ between mod and map files (they are just handled as zip/base files).
PS: also this example shows why -> the map LuaRules gadgets could crash the whole LuaRules enviroment or interact with the mod gadgets in way the modder didn't predict/want.
The only reason why LuaRules gadgets in maps get loaded is because the current VFS can't differ between mod and map files (they are just handled as zip/base files).
PS: also this example shows why -> the map LuaRules gadgets could crash the whole LuaRules enviroment or interact with the mod gadgets in way the modder didn't predict/want.
Re: LuaRules in Map files (revisited) and 77b4
All right... so we move them to the LuaGaia folder... is that all, or this there something else that needs to be done?
Re: LuaRules in Map files (revisited) and 77b4
you have to setup the gadgetHandler enviroment:
* copy main.lua,draw.lua,gadgets.lua etc. (or link the basecontent ones)
* copy main.lua,draw.lua,gadgets.lua etc. (or link the basecontent ones)
Re: LuaRules in Map files (revisited) and 77b4
Cool, that basically means I'll just have to move the files, np.
BTW, kudos:
BTW, kudos:
That was obnoxious* fixed a bug in lua's fontHandler (it was the bug, which decreased the fps by >50% and was fixable by reloading luaui)

Re: LuaRules in Map files (revisited) and 77b4
Thanks for all the info guys.
I'll convert my stuff over to LuaGaia although this will mean loosing some functionality due to the restrictions that LuaGaia has to work under compared to LuaRules. I had suspected that using LuaRules in a map was a bit of a hack, but it was worth trying at least.
Some of the stuff I was trying to do would have been quite unbalancing for some mods, but the worst offenders were mostly meant as a laugh.
Cheers.

I'll convert my stuff over to LuaGaia although this will mean loosing some functionality due to the restrictions that LuaGaia has to work under compared to LuaRules. I had suspected that using LuaRules in a map was a bit of a hack, but it was worth trying at least.
Some of the stuff I was trying to do would have been quite unbalancing for some mods, but the worst offenders were mostly meant as a laugh.
Cheers.
Re: LuaRules in Map files (revisited) and 77b4
Would you please post said widgets? I have a map concept im working on, and I would like to build on your work