Consume Produce
#1


Hey all, I'm having some trouble with the consume produce UI.




For the buildings that produce something out of nothing, and have a range of food items, I have a drop down menu that lets you select which you want to produce (i.e. lobster or tuna). This works perfectly, and my codes look like this in the fishery.rsc template...



Quote:
Quote




ConsumeProduceDescription consumeproduce

{

    Product _products

    [

        {

            ComponentDescription _produceMaterial = "Template/RawMaterialLobster.rsc";

            ResourceLimit _resourceLimit = Food;

            String _requirements = "Lobster";

        }

        {

            ComponentDescription _produceMaterial = "Template/RawMaterialShrimp.rsc";

            ResourceLimit _resourceLimit = Food;

            String _requirements = "Shrimp";

        }

        {

            ComponentDescription _produceMaterial = "Template/RawMaterialHerring.rsc";

            ResourceLimit _resourceLimit = Food;

            String _requirements = "Herring";

        }

        {

            ComponentDescription _produceMaterial = "Template/RawMaterialMackerel.rsc";

            ResourceLimit _resourceLimit = Food;

            String _requirements = "Mackerel";

        }

        {

            ComponentDescription _produceMaterial = "Template/RawMaterialTuna.rsc";

            ResourceLimit _resourceLimit = Food;

            String _requirements = "Tuna";

        }

    ]




    StringTable _stringTable = "UI/MaritimesRawMaterialsStringTable.rsc";




    float _workTime = 6.0;

    ToolType _toolType = Hoe;

    int _workRequired = 6;

}




... and like this in the MaritimesRawMaterialsStringTable.rsc...



Quote:
Quote




        { String _requirements = "Herring";                String _text = "Herring"; }

        { String _requirements = "Lobster";                String _text = "Lobster"; }

        { String _requirements = "Mackerel";                String _text = "Mackerel"; }




       { String _requirements = "Shrimp";                String _text = "Shrimp"; }

        { String _requirements = "Tuna";                String _text = "Tuna"; }




However, if I change the String _requirements = "Tuna" to String _requirements = "TunaRequire" in both the template and the string table, no name shows up in the drop down menu and the game crashes. This isn't a problem for the above, because I don't need it. However when I move on to buildings that produce something out of something else, I get issues.




If I do the same as above, for example for a grist mill, in the template file...



Quote:
Quote




ConsumeProduceDescription consumeproduce

{

    Product _products

    [

        {

            ComponentDescription _produceMaterial = "Template/RawMaterialFlour.rsc";

            ConsumeRawMaterial _consumeMaterials

            [

                {

                    ComponentDescription _material = "Template/RawMaterialBarley.rsc";

                    int _count = 20;

                }

            ]

            ResourceLimit _resourceLimit = Food;

            String _requirements = "Barley";

        }

        {

            ComponentDescription _produceMaterial = "Template/RawMaterialFlour.rsc";

            ConsumeRawMaterial _consumeMaterials

            [

                {

                    ComponentDescription _material = "Template/RawMaterialCorn.rsc";

                    int _count = 20;

                }

            ]

            ResourceLimit _resourceLimit = Food;

            String _requirements = "Corn";

        }

        {

            ComponentDescription _produceMaterial = "Template/RawMaterialFlour.rsc";

            ConsumeRawMaterial _consumeMaterials

            [

                {

                    ComponentDescription _material = "Template/RawMaterialOats.rsc";

                    int _count = 20;

                }

            ]

            ResourceLimit _resourceLimit = Food;

            String _requirements = "Oats";

        }

        {

            ComponentDescription _produceMaterial = "Template/RawMaterialFlour.rsc";

            ConsumeRawMaterial _consumeMaterials

            [

                {

                    ComponentDescription _material = "Template/RawMaterialWheat.rsc";

                    int _count = 20;

                }

            ]

            ResourceLimit _resourceLimit = Food;

            String _requirements = "Wheat";

        }

    ]




    StringTable _stringTable = "UI/MaritimesRawMaterialsStringTable.rsc";




    float _workTime = 6.0;

    ToolType _toolType = Axe;

    int _workRequired = 18;

}




... and have this in the string table...



Quote:
Quote




        { String _requirements = "Barley";                String _text = "Barley"; }

        { String _requirements = "Corn";                String _text = "Corn"; }

        { String _requirements = "Oats";                String _text = "Oats"; }

        { String _requirements = "Wheat";                String _text = "Wheat"; }




... again it works fine, the mill will take in which ever crop you select it to. However, as soon as I try to change the string _text to "Flour [Oats]" for example, nothing shows up in the drop down menu. If I try to change the String _requirements to something like "FlourRequire" or "OatsRequire" or "FlourOats", again, no name shows up in the drop down and it crashes the game.




Now I also tried to add a drop down to the rope maker and dory maker to show what ingredients they need. For the rope maker, I have this...



Quote:
Quote




ConsumeProduceDescription consumeproduce

{

    Product _products

    [

        {

            ConsumeRawMaterial _consumeMaterials

            [

                {

                    ComponentDescription _material = "Template/RawMaterialflax.rsc";

                    int _count = 125;

                }

            ]

    

            ComponentDescription _produceMaterial = "Template/RawMaterialRope.rsc";

            ResourceLimit _resourceLimit = Coal;

            String _requirements = "Rope";

        }

    ]




    StringTable _stringTable = "UI/MaritimesRawMaterialsStringTable.rsc";

    int _workRequired = 10;

    float _workTime = 5.0;

    ToolType _toolType = Saw;

}




... and this...



Quote:
Quote






        { String _requirements = "Rope";                String _text = "Rope [Flax]"; }




... and for some reason, the drop down menu shows a nice picuture of rope, but no text saying "Rope [Flax]". Again, if I change the String _requirements to something else, nothing shows up or crashes. If I change the string _text, it tells me it will produce Rope, but not what the ingredient is. The Dory maker is the same, only in the String _text I have "Dory [Rope + Lumber]" and nothing shows up apart from a picture of a little dory.




I have compared my template and string table files to that in the mod kit for Blacksmiths and Tailors, and cannot for the life of me figure it out. The same is happening for the lumber cutter, it shows that the output will be lumber, but not what is used to make lumber. I also tried to add firewood, in the exact same way, but it would only show lumber in the drop down menu not firewood too.




 




What am I missing?


  Reply
#2

Oh and another thing, why are pictures showing up for the production buildings drop down menu when you have dory, or rope, or domesticated animal as they do in the vanilla blacksmith, but no pictures show up in the food ones? There is no picture of flour for the mill, or lobster etc. for the fisheries?

  Reply
#3


1) Why does your stringtable have "String _requirements...". Every stringtable entry should be "String _name...". The consumeproduce has the _requirement, but it should point to an equivalent _name.




 




2) Look in your template files for the foods that don't show the picture. Down in the rawmaterial section, it should say




    String _name = "Flour";

    String _nameSmall = "FlourSmall";




The "small" version is the one that shows up in the drop down menu. You need to have a 2nd icon that's only 16x16, and a second entry in the spritesheet for it. Luke only put the small line in some of his things, it's kind of annoying. [img]<fileStore.core_Emoticons>/emoticons/smile.png[/img]/emoticons/smile@2x.png 2x" title=":)" width="20" />

  Reply
#4

Quote:
36 minutes ago, Kralyerg said:




The "small" version is the one that shows up in the drop down menu. You need to have a 2nd icon that's only 16x16, and a second entry in the spritesheet for it. Luke only put the small line in some of his things, it's kind of annoying




I remember when I discovered that years ago, I was so pleased that I'd figured something out.




Seems so long ago lol


  Reply
#5

haha

  Reply
#6


Thank you <a contenteditable="false" data-ipshover="" data-ipshover-target="<___base_url___>/index.php?/profile/3-kralyerg/&do=hovercard" data-mentionid="3" href="<___base_url___>/index.php?/profile/3-kralyerg/">@Kralyerg</a>! I see where I went wrong. Ergh every time I feel I have a handle on the code I realize something else is wrong. I get confused between all of the terms used.




It is fixed, and it looks beautiful. I had made all of the small icons, just didn't have the little snippet of code in the food ones. 


  Reply