http://pastebin.com/BesqZgMC
Has anyone implement a way to cycle through a 3 state cmd desc button both forwards and backwards?
Also could some one point me in the right direction to assign each state of the cmd desc to a keybind?
I assume i should use the Lua callin "KeyPress()"
where in the gadget should I insert this?
Should I put it at the very bottom of the gadget code?
Gadget code with my first stab in the dark at coding keybinds to the comand:
http://pastebin.com/nTHRgnfV
The below code is what I added to attempt to make a keybind:
I would have to repeat this for each key i wanted to bind.
This is obviously needs work.
I don't know if there is a callin to give the id of what units the player has selected at a given time?
I have wrtten some pseudo code at the top to describe the steps i think need to be taken.
Code: Select all
-------[[Keypress callin for reference:
KeyPress() --> "key, mods, isRepeat", where key = keymap, mods = SHIFT, etc.]]---
---------------how to write no mods? "false"?
------what does "isRepeat" do?
--press the "y" letter on kb
--check if any units are selected by player
---are selected units on the units in the list of units that have the cmd --desc button.
--
--set the state of the button the state bound to that key
function Gadget:KeyPress(y,false, false)
if unitselected then --what is the callin for this
if STANCE[unitDefID] then
local cmdDescID =FindUnitCmdDesc(unitID,CMD_STANCE)
cmdDescID.cmdParams[1] = 1
end
end
end