I have been trying the ctrlpanels from: http://taspring.clan-sy.com/phpbb/viewtopic.php?t=7449
I'd like to use these panels or maybe even modify them a bit. But I ran into this problem:
When placing a metal extractor the view is changed to metalmap. On a few maps I do like to change the view to pathmap, because it's pretty difficult to find a spot for the big moho metal extractor sometimes.
Now, when I use either of the ctrlpanel.lua, the view is immediately reverted back to metalmap. Most of the times so quick, that I couldn't look for a valid spot to place the MME at all.
This only happens, when one of those ctrlpanel.lua is in place. Without it changing between the views los/metalmap/pathmap/elevation works fine while placing a metal extractor.
Could it be, that the UpdateLayout-function needs more checks? What checks should I add?
As a side note: pathmap is not working for construction planes at all.
metalmap/pathmap problem with ctrlpanel.lua
Moderator: Moderators
I'm to hear that someone knows that UpdateLayout(),
exists, and apparently even knows what it does
Here's a snippet I tried out ...
exists, and apparently even knows what it does
Here's a snippet I tried out ...
Code: Select all
function UpdateLayout(commandsChanged, page, alt, ctrl, meta, shift)
local needUpdate = ... blah ... blah ... blah ...
-- do not ask for updates if we are trying to build a mex,
-- avoid the automatic reversions to metalmap from pathmap
local slot, id, type, name = Spring.GetInCommand()
if ((slot ~= nil) and (id ~= nil) and (id < 0)) then
unitDef = UnitDefs[-id]
if (unitDef ~= nil) then
if (unitDef.extractsMetal > 0) then
needUpdate = false -- do not ask for an update
end
end
end
return needUpdate
end
Ahhh, thanks a lot, Trepan, works like a charm now
Now I just need to read through the other code in ctrlpanel.lua Is there any written doc/help about the functions that may be used in it?
I am going to download spring's source tarball, but of course I would really appreciate any pointers you might have.
Now I just need to read through the other code in ctrlpanel.lua Is there any written doc/help about the functions that may be used in it?
I am going to download spring's source tarball, but of course I would really appreciate any pointers you might have.
Nope, not really. Those examples, and reading throughIs there any written doc/help about the functions that may be used in it?
rts/Game/UI/IconLayoutHandler.cxx are probably the best
you'll find right now. I do intend to do some doc work on the
additions made to 0.73b1/2, but I'm still playing around with
code at the moment
https://taspring.clan-sy.com/svn/spring ... andler.cpp
P.S. I forgot, I can give you one tip that you may find useful:
HOWTO Print The LUA Definition Tables:
1. Move uikeys.txt and ctrlpanel.lua to a temporary directory
2. Start spring with the mod to be printed
3. Type: /keydebug 2
4. Move uikeys.txt and ctrlpanel.lua back to the config directory
5. Type: /ctrlpanel
6. Type: /layout reload
* The Unitdefs[] and WeaponDefs[] tables should
have been written into your infolog.txt file.
Alright, thanks again
Actually, I am not really qualified, but I think that in the CIconLayoutHandler::LayoutIcons function of IconLayoutHandler.cpp it should be Call_LayoutIcons at line 286:
Actually, I am not really qualified, but I think that in the CIconLayoutHandler::LayoutIcons function of IconLayoutHandler.cpp it should be Call_LayoutIcons at line 286:
Code: Select all
245 bool CIconLayoutHandler::LayoutIcons(int& xIcons, int& yIcons,
...
282 // call the function
283 const int error = lua_pcall(L, 4, LUA_MULTRET, 0);
284 if (error != 0) {
285 logOutput.Print("error = %i, %s, %s\n", error,
286 "Call_ConfigureLayout", lua_tostring(L, -1));
287 lua_pop(L, 1);
288 return false;
289 }