factory__production__x (https://doc.simutrans-germany.com/Simutrans-Squirrel-API/classfactory__production__x.html)
How do I get the factory__production__x object of a factory?
For factory_x (https://doc.simutrans-germany.com/Simutrans-Squirrel-API/classfactory__x.html) only input and output are listed.
The idea is to read out the production data that is displayed in the info window so that it can then be inserted into the text (https://simutrans-germany.com/translator_page/scenarios/scenario_5/index.php?obj_id=88472&lang=de&ref_lang=none&trans_lang=en,de,es).
We already have "max_storage" and "scaling", I'll see if I can add the missing ones.
Quote from: Yona-TYT on December 30, 2024, 05:12:32 PMWe already have "max_storage" and "scaling", I'll see if I can add the missing ones.
At the moment I just don't know how to get the factory_production_x to access.
The functions listed should already provide the data.
Some work, some don't, and some don't even exist yet.
local fact = build.get_factory()
local desc = fact.get_desc()
local list = fact.output
foreach(value in list){
tx += " -get_base_production "+value.get_base_production()+"<br>"
tx += " -get_base_consumption "+value.get_base_consumption()+"<br>"
tx += " -get_production_factor "+value.get_production_factor()+"<br>"
tx += " -get_produced "+value.get_produced()[0]+"<br>"
}
Edit.
local fact = build.get_factory()
local desc = fact.get_desc()
local list = fact.output
tx += "<br>output<br>"
foreach(value in list){
tx += " -get_base_production "+value.get_base_production()+"<br>"
tx += " -get_base_consumption "+value.get_base_consumption()+"<br>"
tx += " -get_production_factor "+value.get_production_factor()+"<br>"
tx += " -get_produced "+value.get_produced()[0]+"<br>"
}
tx += "<br>input<br>"
local list = fact.input
foreach(value in list){
tx += " -get_base_production "+value.get_base_production()+"<br>"
tx += " -get_base_consumption "+value.get_base_consumption()+"<br>"
tx += " -get_consumption_factor "+value.get_consumption_factor()+"<br>"
tx += " -get_produced "+value.get_produced()[0]+"<br>"
}
Captura de pantalla -2024-12-30 14-57-44.png
I think they are almost all there, but I'm not sure if I missed something.
local fact = build.get_factory()
local desc = fact.get_desc()
local list = fact.output
tx += "<br>output<br>"
foreach(value in list){
tx += " -max_storage "+value.max_storage+"<br>"
tx += " -scaling "+value.scaling+"<br>"
tx += " -get_base_production "+value.get_base_production()+"<br>"
tx += " -get_base_consumption "+value.get_base_consumption()+"<br>"
tx += " -get_production_factor "+value.get_production_factor()+"<br>"
tx += " -get_produced "+value.get_produced()[0]+"<br>"
}
tx += "<br>input<br>"
local list = fact.input
foreach(value in list){
tx += " -max_storage "+value.max_storage+"<br>"
tx += " -scaling "+value.scaling+"<br>"
tx += " -get_base_production "+value.get_base_production()+"<br>"
tx += " -get_base_consumption "+value.get_base_consumption()+"<br>"
tx += " -get_consumption_factor "+value.get_consumption_factor()+"<br>"
tx += " -get_produced "+value.get_produced()[0]+"<br>"
}
(7928), I honestly don't understand what that number means.
Captura de pantalla -2024-12-30 16-32-17.png
Quote(7928), I honestly don't understand what that number means.
That is the amount of oil being transported at the moment to the factory.
Quote from: Combuijs on December 31, 2024, 02:13:23 PMThat is the amount of oil being transported at the moment to the factory.
Thank you very much! As this information is not relevant to the tutorial, I don't see the need to pass it to the squirrel API. ;)
Quote from: Combuijs on December 31, 2024, 02:13:23 PMThat is the amount of oil being transported at the moment to the factory.
The current transport is the number in front of the brackets. Since the factory is not connected, nothing can be transported yet.
It says "Maximum in-transit", I assume that is the maximum amount that can be transported at a given time.