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 :)
Simple Button Questions
Moderator: Moderators
-
- Posts: 47
- Joined: 20 Dec 2009, 21:16
Re: Simple Button Questions
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?
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?
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Simple Button Questions
./me points at "Lua Forum"
Re: Simple Button Questions
I'd actually like to know this aswell...
Re: Simple Button Questions
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...
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
If you're using up to date code you can make real buttons in widgets.
Re: Simple Button Questions
Any examples you can give us? I can't find another widget that makes buttons, to find out how.
Re: Simple Button Questions
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.
The question is whether the layout.lua packed with spring is fully up to date or if you need the one from ca.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Simple Button Questions
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.
There's probably a better way of adding buttons and a way to do it without CA Layout.
- Attachments
-
- ca_layout.lua
- (11.54 KiB) Downloaded 117 times
-
- cmd_add_command_minimal.lua
- (1.19 KiB) Downloaded 119 times
Re: Simple Button Questions
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.
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.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24