Show commandqueue lines for custom commands

Show commandqueue lines for custom commands

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

Moderator: Moderators

Post Reply
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Show commandqueue lines for custom commands

Post by knorke »

My custom command is queable with shift-key but there are no lines drawn for it. For example here the unit has some move commands qued and in middle of queue is my custom command:
Image
The red line between most left waypoint and the wreck is what I want it to draw.

http://pastebin.com/bD1FGVeu
(change "panther" to some mobile unit of your mod. note it is in two places)

Code: Select all

function gadget:Initialize()
   gadgetHandler:RegisterCMDID(gadget, CMD_PICKUPFEATURE)
   Spring.AssignMouseCursor ("pickUp!", "cursorrepair")
   Spring.SetCustomCommandDrawData(CMD_PICKUPFEATURE, "cursorrepair", {1,0.5,0,.8}, true)
I tried different commandIDs and
changing gadgetHandler:RegisterCMDID(gadget, CMD_PICKUPFEATURE)
to :arrow:
gadgetHandler:RegisterCMDID(CMD_PICKUPFEATURE)
(like all other examples do) but that leads to Error: Lua LoadCode pcall error = 0, LuaRules/main.lua, error = 2, LuaRules/gadgets.lua, [string "LuaRules/gadgets.lua"]:901: attempt to compare nil with number

Tried in XTA and zeroK, no difference.

To test spawn the defined unit, select "pickUp!" command and click on a feature. The unit should drive over to it and pick it up.
Now try shift-queing the command and notice how now command-line is drawn for it. (it works but is invisible)
video (1min) that shows the problem: http://www.youtube.com/watch?v=tOl4f0OkRhE
hope the lines are visible enough even with video compression..
(dont mind the panther driving silly circles and almost getting stuck, it wasnt made for that unit)
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Show commandqueue lines for custom commands

Post by FLOZi »

Not sure if important but;

Code: Select all

	Spring.AssignMouseCursor("Clear Mines", "cursordemine", true, false)
	Spring.SetCustomCommandDrawData(CMD_CLEARMINES, "Clear Mines", {1,0.5,0,.8}, false)
Note Arg 1 for AMC = Arg 2 for SCCDD
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Show commandqueue lines for custom commands

Post by knorke »

http://pastebin.com/0xq4ryS6

1) pickUpFeatureCMD is type = CMDTYPE.ICON_UNIT_FEATURE_OR_AREA ,
2) putDownFeatureCMD is type = CMDTYPE.ICON_MAP,

1) draws, 2) does not draw
Is it possible not all command types worth with SetCustomCommandDrawData?
Post Reply

Return to “Lua Scripts”