how to debug gadgets?

how to debug gadgets?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
BigHead
Posts: 145
Joined: 12 Jul 2007, 18:55

how to debug gadgets?

Post by BigHead »

Solution:
This will allow you to place your gadgets into "Spring/LuaRules/Gadgets" folder*:
.cheat
.devlua

After that you're able to use this command:
.luarules reload

*You need to have gadgets.lua and some other files copied in Spring/LuaRules folder. You can find them at almost any mod (e.g.: BA).

Original post:
I'm writing my first gadget and I need help debuging it. Widgets can be reloaded with simple /luaui reload command. On the other hand Gadget needs to be packed into a file with it's mod. This takes too much time. I'm sure there is an easier way. I tried to put my gadget into this folder: Spring/BA58/LuaRules/Gadgets but it didn't help.
I also briefly read some modding tutorials but didn't find anything on this topic. If this has been documented somewhere then please point me to the documentation and lock this thread.
Otherwise I think someone responsible should update the wiki.
Last edited by BigHead on 13 Oct 2007, 19:45, edited 2 times in total.
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

1) Extract the mod to <whatever>.sdd in the mods dir, so for example you might have: Spring\mods\BA58.sdd, and inside BA58.sdd you'd have modinfo.tdf, the units folder, etc
2) Move the original archive out of the mods folder or edit the new SDD's modinfo.tdf file's name tag so you're sure you're loading the right copy
3) Put the gadgets in their proper folders within the sdd. Edit normally.

Unfortunately, as far as I know the luarules reload command in-game doesn't work, meaning you must reload the entire game for each change you wish to make.
User avatar
BigHead
Posts: 145
Joined: 12 Jul 2007, 18:55

Post by BigHead »

Thanks for your quick reply. I think this should be pasted into the wiki.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Use the .devlua command, it will cause the LuaCob/Gaia/Rules scripts
to be loaded from the raw filesystem. A recent SVN addition is that it will also
allow you to load LuaUI from the raw filesystem, even if LockLuaUI.txt is being
used by the mod. Note that .devlua requires that .cheat be active.
User avatar
BigHead
Posts: 145
Joined: 12 Jul 2007, 18:55

Post by BigHead »

In short:
This will allow you to place your gadgets into "Spring/LuaRules/Gadgets" folder:
.cheat
.devlua

After that you're able to use this command:
.luarules reload
User avatar
TechnoTone
Posts: 165
Joined: 23 Aug 2005, 22:02

Post by TechnoTone »

When I try ".luarules reload" it says:

error = 2, LuaRules/Main.lua, Include() could not load "LuaRules/gadgets.lua"
LuaRules reload failed


I've looked around for gadgets.lua but can't find it.
tombom
Posts: 1933
Joined: 18 Dec 2005, 20:21

Post by tombom »

Check any mod with LuaRules stuff eg CA, Tired Annihilation, FunTA, it's the gadget handler.
Post Reply

Return to “Lua Scripts”