I save the file in directory (windows 7 btw):
As I understand, Zero-K should take the lua script and show it in the list by himself, right ?C:\Users\Juan Pablo\Documents\My Games\Spring\LuaUI\Widgets
May be a mistake in the code can be the reason why the widget can't be loaded in widget list ?
the script is this one:
Code: Select all
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- file: unit_nuke_antinuke_mark.lua
-- brief: adds a mark to each nuke and antinuke units, taken from gui_mobile_anti_marker.lua from Dave Rodgers
-- author: Juan Pablo Cordova E.
--
-- Copyright (C) 2011.
-- Licensed under the terms of the GNU GPL, v2 or later.
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function widget:GetInfo()
return {
name = "Nuke Antinuke Marker",
desc = "Automatically adds a mark to each enemy nuke and antinuke units",
author = "MelKor",
date = "Feb 24, 2011",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = false -- loaded by default?
}
end
--------------------------------------------------------------------------------
local marked = {}
--------------------------------------------------------------------------------
local spGetMyPlayerID = Spring.GetMyPlayerID
local spGetPlayerInfo = Spring.GetPlayerInfo
local spGetMyAllyTeamID = Spring.GetMyAllyTeamID
local spGetUnitDefID = Spring.GetUnitDefID
local spGetUnitPosition = Spring.GetUnitPosition
local spGetUnitVelocity = Spring.GetUnitVelocity
local spMarkerAddPoint = Spring.MarkerAddPoint
----------------------------------------------------------------
function widget:Initialize()
widget:Update()
end
function widget:Update()
local _, _, spec = spGetPlayerInfo(spGetMyPlayerID())
if (spec == true) then
spEcho("<NukeAntinukeMarker> Spectator mode. Widget removed.")
-- widgetHandler:RemoveWidget()
return false
end
end
----------------------------------------------------------------
function widget:UnitEnteredLos(uID, allyTeam)
if (marked[uID]) then return end
if (allyTeam == spGetMyAllyTeamID()) then return end
local uDefID = spGetUnitDefID(uID)
-- if (uDefID == nil) then return end -- Shouldn't need as we have LOS
if ((UnitDefs[uDefID].name == 'armscab') or (UnitDefs[uDefID].name == 'cormabm')) then
local vx, vy, vz = spGetUnitVelocity(uID)
local x, y, z = spGetUnitPosition(uID)
if ((vx ~= 0) or (vy ~= 0) or (vz ~= 0)) then
spMarkerAddPoint(x, y, z, "Mobile Anti (Moving)")
else
spMarkerAddPoint(x, y, z, "Mobile Anti (Stationary)")
end
marked[uID] = true
end
if( (UnitDefs[uDefID].name) == 'armamd')
local x,y,z = spGetUnitPosition(uID)
spMarkerAddPoint(x, y, z, "armamd")
marked[uID] = true
end
if( (UnitDefs[uDefID].name) == 'corfmd')
local x,y,z = spGetUnitPosition(uID)
spMarkerAddPoint(x, y, z, "corfmd")
marked[uID] = true
end
if( (UnitDefs[uDefID].name) == 'cornukesub')
local x,y,z = spGetUnitPosition(uID)
spMarkerAddPoint(x, y, z, "cornukesub")
marked[uID] = true
end
if( (UnitDefs[uDefID].name) == 'armcarry')
local x,y,z = spGetUnitPosition(uID)
spMarkerAddPoint(x, y, z, "armcarry")
marked[uID] = true
end
if( (UnitDefs[uDefID].name) == 'armsilo')
local x,y,z = spGetUnitPosition(uID)
spMarkerAddPoint(x, y, z, "armsilo")
marked[uID] = true
end
if( (UnitDefs[uDefID].name) == 'corsilo')
local x,y,z = spGetUnitPosition(uID)
spMarkerAddPoint(x, y, z, "corsilo")
marked[uID] = true
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------