1. »BoS« Xap

    »BoS« Xap Naked Wanderer

    I am learning scripting in ROK by making modifications to the SurvivalEssentials plugin. The problem that currently has me stumped is that I cannot get anything out of InvItemBlueprint. That is, in code like this...

    Code (Text):
    [ChatCommand("blueprint")]
    private void ListBlueprint(Player Player, string Command, string[] Args)
    {
            int ItemId = 1;
            InvItemBlueprint Blueprint = null;
            foreach (InvItemBlueprint Blueprints in Marketplace.Items.Values)
            {
                    PrintToChat(Player, "Blueprint: {0}: {1}", ItemId, Blueprint.Name);
                    ItemId++;
            }
    }
    ...the Blueprint.Name does not seem to work as expected.

    Questions:
    1. What are the attributes of InvItemBlueprint (i.e. Name, Value, Count, etc.)?
    2. How exactly do I get the item's name (i.e. "Stone Block') out of the Blueprints variable?
    3. Where can I find detailed scripting information on this and other classes for ROK?
     
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Open up the game's Assembly-CSharp.dll using a .NET decompiler such as JustDecompile.
     
  3. »BoS« Xap

    »BoS« Xap Naked Wanderer

    @Wulf ... OK I installed that (ThanX!) and looked up the InvItemBlueprint properties (see attached) but I still can't get this code to produce anything :(

    Note that if I uncomment the "Test" line and comment out the "Blueprint" output line I get "Test" printed to chat for every item in the marketplace (so that proved the for loop is stepping through the marketplace items. With the code run as is, it crashes the plugin.

    Here is the current code:

    Code (Text):
            [ChatCommand("showmarket")]
            private void ListBlueprint(Player Player, string Command, string[] Args)
            {
                // If there are items in the marketplace
                if (Marketplace.Items.Count > 0)
                {
                    // Step through each item
                    foreach (InvItemBlueprint Blueprint in Marketplace.Items.Values)
                    {
                        //PrintToChat(Player, "Test");
                        PrintToChat(Player, "Blueprint: {0}: {1}", Blueprint.ID, Blueprint.Name);
                    }
                } else
                {
                    PrintToChat(Player, "[FF0000]No items available in marketplace![-]");
                }

            }
     
    Last edited: Jan 28, 2017