Page 1 of 1
Simple Button Questions
Posted: 24 Dec 2009, 19:46
by Voidranaut
so I have three realy basic questions about the step involved in making custom buttons for the unit interface
1) are custom buttons made with widgets? or gadgets? or a combo of both?
2) how do I make the newly created button show up or get attached to the unit interface?
3) can you make buttons show up durring first person mode?
thank you for your time :)
Re: Simple Button Questions
Posted: 25 Dec 2009, 03:04
by Voidranaut
local cmdDescID = Spring.FindUnitCmdDesc(unitID, morphDef.cmd)
if (cmdDescID) then
Spring.EditUnitCmdDesc(unitID, cmdDescID, morphCmdDesc)
else
Spring.InsertUnitCmdDesc(unitID, morphCmdDesc)
end
** from what I can tell this code above is whats responcible for adding the button to a units menue... is that right? or am I all turned around on my lua commands?
and is there anything odd I should know about adding the the units commands array? like is it possible to have it added only to be overidden by one of the orginal commands buttons?
Re: Simple Button Questions
Posted: 25 Dec 2009, 12:19
by Forboding Angel
./me points at "Lua Forum"
Re: Simple Button Questions
Posted: 06 Jan 2010, 02:36
by SkyStar
I'd actually like to know this aswell...
Re: Simple Button Questions
Posted: 06 Jan 2010, 03:15
by FLOZi
1. True buttons, gadgets.
2. See your second post
3. Not true buttons, no. You could fake your own buttons though, bypassing the UnitCmdDesc stuff. Of course in FPS mode you don't have a cursor...
Re: Simple Button Questions
Posted: 06 Jan 2010, 04:59
by lurker
If you're using up to date code you can make real buttons in widgets.
Re: Simple Button Questions
Posted: 06 Jan 2010, 13:16
by SkyStar
Any examples you can give us? I can't find another widget that makes buttons, to find out how.
Re: Simple Button Questions
Posted: 06 Jan 2010, 15:25
by lurker
Retreat makes buttons, I don't know if there are any simple ones. Maybe mex placer?
The question is whether the layout.lua packed with spring is fully up to date or if you need the one from ca.
Re: Simple Button Questions
Posted: 07 Jan 2010, 15:43
by Google_Frog
Here's how I figured out how to add buttons with a widget; I took CarRepairer's retreat widget and deleted things which looked unnecessary until the buttons stopped appearing.
There's probably a better way of adding buttons and a way to do it without CA Layout.
Re: Simple Button Questions
Posted: 08 Jan 2010, 19:58
by Caydr
I think someone referred me to this file ages ago but I obviously never found the right one.
Is there a list somewhere of all the default CMDs?
[CMD.STOP]=true, [CMD.GUARD]=true, [CMD.WAIT]=true,
[CMD.REPAIR]=true, [CMD.RECLAIM]=true,
[CMD.AISELECT]=true, [CMD.SELFD]=true, [CMD.AUTOREPAIRLEVEL]=false,
[CMD.MOVE]=true, [CMD.PATROL]=true, [CMD.FIGHT]=true,
[CMD.ATTACK]=true, [CMD.DGUN]=true,
etc.
Re: Simple Button Questions
Posted: 09 Jan 2010, 05:50
by Google_Frog