Help With Changing Button Names
Posted: 21 Feb 2012, 01:45
I'm working on modifying unit_morph.lua so that I can have customized button names per unit. I poked into it and I actually managed to figure it out (Lua leveling up for me!) but then I realized that if I stop the morph mid-morph, the Stop text on the button stays instead of going back to the customized button name.
I'm at a loss, but I imagine you fine people can give me some help. Here is what I modified (probably filled with nastiness, but it does most of what I want
) First batch starts at line ~279, second batch starts at line ~381, and the last batch at ~ 406 :
Unchanged version on the CT SVN (there's so many versions of unit_morph floating around, I hold onto the one CT has because it snaps buildings to the grid)
Sorry if I didn't provide enough/correct info for help, I don't post often in the lua part of the boards 
I'm at a loss, but I imagine you fine people can give me some help. Here is what I modified (probably filled with nastiness, but it does most of what I want

Unchanged version on the CT SVN (there's so many versions of unit_morph floating around, I hold onto the one CT has because it snaps buildings to the grid)
Code: Select all
newData.texture = morphData.texture
newData.text = morphData.text
newData.name = morphData.name
return newData
end
end
...
if morphDef.name then
morphCmdDesc.name = ''.. morphDef.name
else
morphCmdDesc.name = '#' .. morphDef.into --//only works with a patched layout.lua or the TweakedLayout widget!
end
if morphDef.texture then
morphCmdDesc.texture = "LuaRules/Images/Morph/".. morphDef.texture
--morphCmdDesc.name = ''
else
morphCmdDesc.texture = "#" .. morphDef.into --//only works with a patched layout.lua or the TweakedLayout widget!
end
...
morphCmdDesc.tooltip = nil
morphCmdDesc.texture = nil
morphCmdDesc.text = nil
morphCmdDesc.name = nil
end
