News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

factory__production__x

Started by Andarix, December 30, 2024, 03:14:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andarix

factory__production__x

How do I get the factory__production__x object of a factory?

For factory_x 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.


Yona-TYT

We already have "max_storage" and "scaling", I'll see if I can add the missing ones.

Andarix

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.

Yona-TYT

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


Yona-TYT

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

Combuijs

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.
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Yona-TYT

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. ;)

Andarix

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.

Yona-TYT

It says "Maximum in-transit", I assume that is the maximum amount that can be transported at a given time.