How to change custom command draw colour?

How to change custom command draw colour?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

How to change custom command draw colour?

Post by Jools »

I created a custom command along with a button, but I can't configure the draw colour. Anyone knows how to do this?

I tried using Sping.SetCustomCommandDrawData, but I can't get it to work. It returns nil.

Code: Select all

local result = SetCustomCommandDrawData(CMD_AREA_GUARD, CMDTYPE.ICON_UNIT_OR_AREA, {1,0,0,0.8},true)
Am I just being stupid, using wrong fucntion or is something else wrong?

That is set in gadget:Initialize(). And I also did use gadgetHandler:RegisterCMDID(CMD_AREA_GUARD), but I'm unsure what that does, maybe calls Microsoft to activate my command :)
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: How to change custom command draw colour?

Post by jK »

Jools wrote:I tried using Spring.SetCustomCommandDrawData, but I can't get it to work. It returns nil.
Jools wrote: local result = SetCustomCommandDrawData(CMD_AREA_GUARD, CMDTYPE.ICON_UNIT_OR_AREA, {1,0,0,0.8},true)
wiki: "number cmdIconID | string iconname | nil"
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: How to change custom command draw colour?

Post by Jools »

Well, that's how it's used in http://imolarpg.dyndns.org/trac/balates ... attack.lua and it seems to work.
Post Reply

Return to “Lua Scripts”