An hour of copy pasting and I've made a functional script that marks trolls.
function widget:GetInfo()
	return {
		name      = "Ally Troll Reclaim Alert",
		desc      = "",
		author    = "",
		date      = "",
		license   = "",
		layer     = 20,
		enabled   = true
	}
end
local gameID_to_playerName
function widget:Initialize()
	gameID_to_playerName = {}
	local teamList = Spring.GetTeamList() --//check teamIDlist for AI
	for j= 1, #teamList do
		local teamID = teamList[j]
		local _,playerID, _, isAI = Spring.GetTeamInfo(teamID, false)
		if isAI then
			local _, aiName = Spring.GetAIInfo(teamID)
			gameID_to_playerName[teamID] = "[AI]"..aiName
		elseif not isAI then
			local playerName = Spring.GetPlayerInfo(playerID, false)
			gameID_to_playerName[teamID] = playerName or "Gaia"
		end
	end
end
function widget:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag)
	if (not Spring.ValidUnitID(unitID)) then
		return --invalid unit ID
	end
	if (cmdID ~= 90) then
		return --not reclaim command
	end
	
	if (type(cmdParams) ~= "table") then
		return --corrupted command parameters
	end
	
	if (cmdParams[2]) then
		return --more than 1 param: not targetID but actually X,Y,Z position for area-reclaim
	end
	
	local targetUnitID = cmdParams[1]
	if ((type(cmdParams[1]) ~= "number") or (not Spring.ValidUnitID(targetUnitID))) then
		return --invalid unit ID
	end
	
	local targetUnitTeamID = Spring.GetUnitTeam(targetUnitID)
	if (targetUnitTeamID == unitTeam) then
		return --target is on origin team
	end
	
	local health,maxHealth,paralyzeDamage,captureProgress,buildProgress = Spring.GetUnitHealth(targetUnitID)
	if ((type(buildProgress) ~= "number") or (buildProgress >= 1)) then
		return --not a unit frame
	end
	
	local originAllyTeamID = Spring.GetUnitAllyTeam(unitID)
	local targetUnitAllyTeamID = Spring.GetUnitAllyTeam(targetUnitID)
	
	if (originAllyTeamID ~= targetUnitAllyTeamID) then
		return --not allied
	end
	
	local perpetratorName = gameID_to_playerName[unitTeam]
	local victimName = gameID_to_playerName[targetUnitTeamID]
	
	local message = "ALERT: '"..perpetratorName.."' is attempting to reclaim property of '"..victimName.."'"
	
	local x,y,z = Spring.GetUnitPosition(unitID)
	Spring.MarkerAddPoint(x,y,z,perpetratorName,true)
	Spring.MarkerErasePosition(x,y,z)
	
	x,y,z = Spring.GetUnitPosition(targetUnitID)
	Spring.MarkerAddPoint(x,y,z,message,true)
	Spring.MarkerErasePosition(x,y,z)
end