(LUA) How to get:
1. Resource string/description (ex. Marble) from ResourceID or GameInfo.Resources().
1.5 ResourceID from GameInfo.Resources().
2. PolicyBranchType from PolicyID.
(LUA) How to get:
1. Resource string/description (ex. Marble) from ResourceID or GameInfo.Resources().
1.5 ResourceID from GameInfo.Resources().
2. PolicyBranchType from PolicyID.
1 GameInfo.Resources[ResourceID].Description is the text key for the description of a resource
1.5 GameInfo.Resources() is an iterator which you use to iterate over all of the resource information tables. Each one returned by it will have an ID entry which is the ID.
E.g.:
Code:
for pInfo in GameInfo.Resources() do
-- prints all resource IDs
print(pInfo.ID)
end
Side note: GameInfoTypes.RESOURCE_NAME is much, much faster than doing the above loop to find an ID.
for iResource in GameInfo.Resources() do
if Game.GetResourceUsageType(iResource.ID) == ResourceUsageTypes.RESOURCEUSAGE_LUXURY then
LuxCount = LuxCount + 1;
PhoResTable[LuxCount] = iResource.ID;
end
end
That's why I needed ID, previously I was just using variable increasing by 1, was working but... not elegant enough.
Now, I have for example TXT_KEY_RESOURCE_SILK, how to make it "Silk".
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.