Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Accessing recipe of a component

Discussion in 'Programming Questions and Suggestions' started by BobbySix, Jan 6, 2019.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. BobbySix Trainee Engineer

    Messages:
    32
    Hi everyone,

    I made a script of auto-producing component.

    But now i would like to know the quantity of ingot needed for a production.

    I take a look of some scripts in workshop who give the amount of ingot needed for any component, but every time it was with an in-script array.

    I'm sure it could be possible from the MyProductionItem class, to access to a list of component needed.


    Code:
    IMyTerminalBlock NowSender = OreBlock.Block; // get a block
    _Items = NowSender.GetInventory(0).GetItems(); //get the inventory
    
    MyDefinitionId xxx = _Items[0].GetDefinitionId(); ; // get the definition ID of first inventory slot, stucked here :(
    
    var yyy = xxx.TypeId; // try to get that but not found any interesting property
    MyDefinitionId is used by assembler to launch the production, but I don't find any link from this class to any data containing the Item recipe :(
     
    Last edited: Jan 6, 2019
  2. Malware Master Engineer

    Messages:
    9,466
    There's a reason it's usually an "in-script array". There's no access to recipes in ingame scripts. Sorry.
     
    Last edited: Jan 6, 2019
  3. BobbySix Trainee Engineer

    Messages:
    32
    Sad but very clear, thank you.
     
  4. BobbySix Trainee Engineer

    Messages:
    32
    After scripting the recipe calculator, I encounter a new annoying complication.

    The Assembler Efficiency Setting.

    I look everywhere a way to get this setting from the API, but don't find it.
    Maybe it's not accessible too.
     
  5. Malware Master Engineer

    Messages:
    9,466
  6. BobbySix Trainee Engineer

    Messages:
    32
    Ok.
    I admit most of the time I use directly the intellisense of Visual Studio to find any usefull class.

    Not only for lazyness reason, but I see other scripts who need other library to run like :

    using VRage.Game;

    I need this one to have MyDefinitionId.


    Edit : I take a look of your Wiki, I see some informations about the namespaces used for scripting, it will answer to some questions I had for a long time, thx :)
     
    Last edited: Jan 10, 2019
Thread Status:
This last post in this thread was made more than 31 days old.