Hello, comrades.
There is a same questions.
I watch "GameScript" Lexicon thread, but still don't get, where i need to call game.interface callbacks? I mean is it needed to be created in game_script/some-name.lua file? I need to make separate functions or insert it into update function? How I can call that function from my scripts?
I already try to call game.interface from my script, there is nil value returned
I try from update function of game_script/some-name.lua - and there is nothing happens, even answer for game.interface nil check.
I try from separate function of game_script/some-name.lua still nothing.
I try to call separate function of game_script/some-name.lua from my external script - and i cant register my gamescript as util script holder.
P.S. I know nothing about coding, start luring few days ago, make "industry workers" mod, but it was simple. Now i wanna expand it, make usable UI for it with complied data about available and filled workplaces to make passenger logistic clearly. Now, coas of there is no autobalancing we have to much amount of workplaces (coas towns have their own workplaces for all the population and new workplaces in industries is additional, so we have not enough population for all the workplaces) and asset-placed residential buildings also have no visible UI to watch how many living places are you added.
So, for the beginning i need to use, but cant reach no of this functions:
-- getIndustryProductionLimit
-- getTowns
-- getTownCapacities
-- getTownReachability
-- getBuildingType
-- getBuildingTypes
-- getEntities
-- getEntity
-- getLines
-- etc.
My test function:
local workersutil = require "workersutil"
local function getTownList () --In update function placed without this and last "end"
if workersutil.showtowns(0) == 23 then --Check external counter to prevent multiple returns
if game.interface ~= nil then --Check is game.intarface reachable
print(game.interface.getTowns()) --Answer for reachable game.interface
else
print("game interface is nil") --Answer for game.interface nil check
end
end
end
Alles anzeigen