Thanks for the hint! Unfortunately, Player:GetResources():IsResourceVisible(resourceID) doesn't work for me in a tuner panel. At least the following tuner panel code prints a list of resources names, associated IDs and correct resource counts. However, when the line using IsResourceVisible is not commented, the code only prints the header and playerId.
Suggestions?
<EnterAction>
print("Test Entered")
local player, resource, resourceName, resources, resourceID, isVisible, resCount
local resourceIdByName = {}
player = Game.GetPlayers{Human = true}[1]
print("Human playerId: " .. player:GetID())
for resource in GameInfo.Resources() do
resourceName = string.gsub(resource.ResourceType, "RESOURCE_", "")
resourceIdByName[resourceName] = resource.Index
end
resources = player:GetResources()
for resourceName, resourceID in pairs(resourceIdByName) do
isVisible = true
-- isVisible = resources:IsResourceVisible(resourceID)
resCount = resources:GetResourceAmount(resourceID)
if isVisible then print(resourceName .. "\t" .. resourceID .. "\t" .. resCount) end
end
</EnterAction>