Beiträge von BSM

    this is work in progress and the next version will replace the current sale stock system completely. [...] Instead there will be a new bigger and much more customizeable sell store (like: put in price % for specific goods, store more different items etc)

    That sounds very nice.
    Have you plan to add new panels to the Gui interface? I just started to study the file format to create my own ".gui" files, but maybe that work is already done and there is some kind of editor...

    I like a lot this game, and I meet (as most people) some problems with production automation. AI insist in using several slot in inventory for the same product type, in all building types. Also AI prioritizes production of some items on a weird manner.
    So I decided to code my own AI for this task (Production Automation), just for fun. I already got a system working as I want. Now I want to do it less dependant on the data I hardcoded in the lua scripts, and make the system able to adapt to new variations in the .dbt tables. So it will work for vanilla game, and for most mods, incuding yours (which I love), and even for any change in .dbt tables.


    What I have done is to write inside my lua scripts some hardcoded values for every item for some building types (but had plans to extend it to every building type). Now I understand better the values in items.dbt, so I plan to modify the existing items.dbt to get more accurate data to be used from the scripts, instead of hardcoding values.


    I have a single doubt that maybe you could help me to understand.
    What is (for you) the difference between:
    -- ITEM_TYPE_RESOURCE = 1,
    and
    -- ITEM_TYPE_INTERSTAGEPRODUCT = 2,
    and
    -- ITEM_TYPE_GATHERING= 8,


    and the differences between:
    -- ITEM_TYPE_NEED = 3,
    and
    -- ITEM_TYPE_SUPPLY = 4,


    I mean I don't know well all the changes you included in your mod, and I would like to not mess much with sensible data, but if it is not important for your scripts, I think some data could be changed a bit to make my scripts work without hardcoding data.


    To give you some clue on what I am doing, I will add some example for Windmill and Bakery.
    The data I'm using for these 2 building types is:
    -- Settings for WindMill
    Ingredients ={ "Wheat", "Flachs", "Fruit", "Lavender","Blackberry", "Moonflower" }
    Products = { "WheatFlour", "Oil","Dye","Saft"}
    -- Settings for Bakery
    local Ingredients ={ "WheatFlour", "Honey", "Fat", "Salt" }
    local Products = { "CakeBatter", "BreadDough", "Cookie","Wheatbread", "Pretzel","BreadRoll", "CreamPie","Cake","Candy","Pastry" }
    These data I already am able to read from items.dbt, instead of harcoding it.


    Then I use another hardcoded values to classify ingredients into "Buy" or "Gather" and Products into several categories. And these data I could also read from the 3rd column (type) in items.dbt, but the current values you have used in your mod does not fit well for my needs.


    "id" INT -1 |"name" STRING 0 |"type" INT 0 |
    ---
    BAKERY
    ---
    Ingredients
    ---
    154 "Salt" 1
    70 "WheatFlour" 1
    64 "Honey" 8
    5 "Fat" 2
    ---
    Products
    ---
    20 "BreadDough" 1
    21 "CakeBatter" 1
    23 "Wheatbread" 3
    25 "Pretzel" 3
    26 "BreadRoll" 3
    24 "Cake" 5
    27 "CreamPie" 5
    28 "Candy" 5
    29 "Pastry" 5
    ---
    WINDMILL
    ---
    Ingredients
    ---
    1 "Wheat" 8
    2 "Flachs" 8
    60 "Fruit" 8
    160 "Lavender" 8
    161 "Blackberry" 8
    164 "Moonflower" 8
    ---
    Products
    ---
    70 "WheatFlour" 1
    71 "Oil" 1
    72 "Dye" 1
    73 "Saft" 3


    If I change the coloured values, will that affect some parts of your mod?
    I would like to use that column to classify items to be usable in both vanilla and modded games, as follows:
    -- ITEM_TYPE_SPECIAL = 0, Special items, like "TowerCannonShip", not usable in production and market
    -- ITEM_TYPE_RESOURCE = 1, Resources that can be gathered/collected for free, but REQUIRES owning a field
    -- ITEM_TYPE_INTERSTAGEPRODUCT = 2, Products used as ingredients for other products
    -- ITEM_TYPE_NEED = 3, Products demanded from idle sims
    -- ITEM_TYPE_SUPPLY = 4, Other products, not demanded from idle sims, but with HIGH rate of demand renewal in market
    -- ITEM_TYPE_ARTIFACT = 5, Other products, not demanded from idle sims, but with LOW rate of demand renewal in market
    -- ITEM_TYPE_ANIMAL = 6, Animals (not important for production, if I set as type 8-Gather for sheep, pigs...)
    -- ITEM_TYPE_PRODBYMEASURE = 7, Products usable with Measures
    -- ITEM_TYPE_GATHERING= 8, Resources that can be gathered/collected for free, but DOES NOT REQUIRE owning a field
    -- ITEM_TYPE_QUESTITEM = 9 Special items, used for quests


    The distinction between type 1 and type 8 is not important for me, so type 1 could be used in another way.
    What I actually want to get from items.dbt is a way to classify items into ingredients and products, and a way to classify products into intermediate and final, and a way to classify final products depending on demands (idle sims, low rate of demand renewal and high rate of demand renewal).


    This way I can assign priorities in the production of a building, depending on product type:
    - Keep enough "Need" products to satisfy demand from idle sims
    - Keep enough ingredients (gathering/collecting free resources if possible, and purchasing other required items as needed)
    - Keep enough InterStageProducts if needed for self production, as BreadDough and CakeBatter for a Bakery
    - Produce other items depending on supply/demand on markets, or taking into account if I need some items for another building (both basic resources and intermediate products, like wheat from a farm or flour from a windmill).


    For example, WheatFlour Oil and Dye would be changed to type 2, and these will be considered as InterStage products, instead of Resources.
    Saft and Pretzel would be changed to type 4, considered as Supply, as the current idlelib.lua does not include thse as items demanded from idle sims and are not required to produce any other item. Or I could modify idlelib.lua to include these 2 items.
    For Salt, I have not studied yet the building type Mine, so I am not sure if it needs to be type 1 or type 8.


    Without my scripts, a Bakery keep producing a lot of Cookies, filling all 4 slots in Sales inventory and later more than 1 slot in normal inventory, and become at some point unable to add new bought ingredients (flour, fat, honey and salt). Idle sims cannot buy WheatBread. The profit for the building becomes negative.
    With my scripts, the Bakery keeps a balanced production, favouring in same manner both Cookies and WheatBread, and being able all the time to add new bought ingredients.
    The same for other buildings, but I'm still tweaking values, and just the Windmill could be considered almost done.


    Oh, next move would be to script the Buy and Sale automation :)