Log and Board name not changing when resource is harvested

Darth Deity

Citizen
May 9, 2017
25
1
3
32
Hey all!
I am having trouble getting the name of the log/board I harvest to display when the resource is clicked on.

*quick overview*
  • I added BOD's to fletching in my LBR serveer for better archery.
  • I enabled the special logs to be harvest from trees (blood, ash, oak, etc.) by removing the Core.ML section from Lumberjacking.cs
Now I can harvest the special wood and when I create the board the color stays with it so I assume that the properties of the board are still there, but It only says "Log" and "Board" when I try to see what type of wood it is.

Can anyone help me find out what needs to be changed? I am assuming its in the baseboard section of board.cs. I tired to figure out what was wrong by looking at Ore.cs for an example, but I keep hitting a wall.
 
Last edited:

bojangles2872

Rookie
Jul 29, 2018
75
10
6
I know when adding in daats owltr there are a few different scripts it needs to be added to, maybe check your resources.cs or you could download daats scripts and see which scripts for sure need to be edited and make sure you have the custom lumbers added in to add the correct spots
 

Darth Deity

Citizen
May 9, 2017
25
1
3
32
I took a very long hiatus from modding my server but I would like to get back to it!

I still haven't been able to get my logs and boards to show the name of resource that was harvested. When I use lumberjack and get logs, the color is right, and it says you put "frostwood" in you pack. But the name still only says "log" and when cut, says "board".

Does anyone have any input as to what script to edit so it will say the name of log and board I harvest? I am running LBR so what I did to get AoS logs was just use AoS scrips in the "old" section.
 

Falkor

Squire
Apr 11, 2018
298
105
43
wpshard.com
Shard Name
Whispering Pines
It's because you're running the LBR era. It doesn't support Object Property List and that's where the log detail info is displayed.

This thread deals with something similar but it's tricky to get parts of newer eras into the older ones.


How it's displayed when OPL is enabled:

oaklog.jpg
 

Darth Deity

Citizen
May 9, 2017
25
1
3
32
I see that it doesn't support Object Property List, but why does Dull Copper, Shadow Iron, etc, show its name in Pre-AoS? I would assume that it should be as easy as finding where their object name is, and add the special wood to that list.
Post automatically merged:

Maybe the better question is, What in Ors.cs and Ingots.cs allows the colored resource to display its name in Pre-AoS servers?
 
Last edited:

Falkor

Squire
Apr 11, 2018
298
105
43
wpshard.com
Shard Name
Whispering Pines
Because the script (Ingots.cs in /Items/Resource) specifies the resource type within the item's name in the script. The logs (and boards) scripts don't do this.

You may be able to accomplish what you're looking for just by adding something like

Code:
Name = "Petrified Board";
to each lumber / board type in the files using ingots.cs as a guide on where to insert that line. The name change shouldn't affect its ability to work with crafting scripts but test to be sure!
 

Darth Deity

Citizen
May 9, 2017
25
1
3
32
I figured it out! However now the logs are producing random names, or just say "heartwood board" but im pretty sure its because I have changed so many thing in the log.cs file that it doesn't know what to pull from. All i had to do is add LabelNumber.

public override int LabelNumber
{
get
{
if (this.m_Resource >= CraftResource.OakWood && this.m_Resource <= CraftResource.Frostwood)
return 1075062 + (int)(this.m_Resource - CraftResource.OakWood);

return 1075062; // regular wood;
}
}

However, can someone tell me if the return 1075062 is correct when calling regular wood?
 

Falkor

Squire
Apr 11, 2018
298
105
43
wpshard.com
Shard Name
Whispering Pines
But you won't have LabelNumbers for the added wood types. There aren't CLILOC values for custom things unless you add them to the cliloc.enu file. That's why the OWLTR system specified names for the ores and for your era you'll have to do the same for logs & boards.

For example, this part of each type of log will go from:
Code:
    public class HeartwoodLog : BaseLog
    {
        [Constructable]
        public HeartwoodLog()
            : this(1)
        {
        }

        [Constructable]
        public HeartwoodLog(int amount)
            : base(CraftResource.Heartwood, amount)
        {
        }

        public HeartwoodLog(Serial serial)
            : base(serial)
        {
        }
<snip>
to

Code:
    public class HeartwoodLog : BaseLog
    {
        [Constructable]
        public HeartwoodLog()
            : this(1)
        {
        }

        [Constructable]
        public HeartwoodLog(int amount)
            : base(CraftResource.Heartwood, amount)
        {
            Name = "Heartwood log"; // added resource name for pre-OPL
        }

        public HeartwoodLog(Serial serial)
            : base(serial)
        {
        }
<snip>
I don't have a client/server to test this modification with but I bet if you try it, it'll do what you're looking for.
 

Darth Deity

Citizen
May 9, 2017
25
1
3
32
That worked beautifully! Everything is working now, with the correct names, with the exception of creating normal boards from logs. When I create boards from normal logs the server freezes. All other logs create boards and have no problem. I assume that it doesn't have a name to call and the script just stops there. I'll need to look further into it.
 

Falkor

Squire
Apr 11, 2018
298
105
43
wpshard.com
Shard Name
Whispering Pines
Is this what the regular log section looks like in your Log.cs file?
Code:
    public class Log : BaseLog
    {
        [Constructable]
        public Log()
            : this(1)
        {
        }

        [Constructable]
        public Log(int amount)
            : base(CraftResource.RegularWood, amount)
        {
        }

        public Log(Serial serial)
            : base(serial)
        {
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            //don't deserialize anything on update
            if (BaseLog.UpdatingBaseLogClass)
                return;

            int version = reader.ReadInt();
        }

        public override bool Axe(Mobile from, BaseAxe axe)
        {
            if (!TryCreateBoards(from, 0, new Board()))
                return false;

            return true;
        }
    }
Also, can you [add board without the server freezing? If so, do you get a normal board from that command?

It's a lot easier to troubleshoot when it crashes rather than a total freeze!
 

Darth Deity

Citizen
May 9, 2017
25
1
3
32
Thats exactly what my log.cs looks like. I can add all logs, and add all boards. I can't select a normal board to show its name. As soon as i click on a normal board, it shows nothing and freezes the server. All other boards work perfectly.

I do need to say, that I haven't done a pull in over a years. so my log.cs and my board.cs are updated but most of my other scripts are not.
 

Falkor

Squire
Apr 11, 2018
298
105
43
wpshard.com
Shard Name
Whispering Pines
That lets us know the issue is most likely in board.cs or one of the helper scripts.

Are you using OWLTR for the resources? If so, this should be in your /misc/ResourceInfo.cs script:

Code:
        private static CraftResourceInfo[] m_WoodInfo = new CraftResourceInfo[]
            {
                //daat99 OWLTR start - custom wood
                new CraftResourceInfo( 0, 0,    "Normal",        CraftAttributeInfo.Blank,        CraftResource.RegularWood,    typeof(Board),                typeof( Log ) ),
                new CraftResourceInfo( 1281, 0, "Oak",            CraftAttributeInfo.OakWood,        CraftResource.OakWood,        typeof(OakBoard),            typeof( OakLog ) ),
                new CraftResourceInfo( 488,  0, "Ash",            CraftAttributeInfo.AshWood,        CraftResource.AshWood,        typeof(AshBoard),            typeof( AshLog ) ),
                new CraftResourceInfo( 2313, 0, "Yew",            CraftAttributeInfo.YewWood,        CraftResource.YewWood,        typeof(YewBoard),            typeof( YewLog ) ),
                new CraftResourceInfo( 1262, 0,    "Heartwood",    CraftAttributeInfo.Heartwood,    CraftResource.Heartwood,    typeof(HeartwoodBoard),        typeof( HeartwoodLog ) ),
                new CraftResourceInfo( 1194, 0,    "Bloodwood",    CraftAttributeInfo.Bloodwood,    CraftResource.Bloodwood,    typeof(BloodwoodBoard),        typeof( BloodwoodLog ) ),
                new CraftResourceInfo( 1266, 0,    "Frostwood",    CraftAttributeInfo.Frostwood,    CraftResource.Frostwood,    typeof(FrostwoodBoard),        typeof( FrostwoodLog ) ),
                new CraftResourceInfo( 1457, 0, "Ebony",        CraftAttributeInfo.Ebony,        CraftResource.Ebony,        typeof(EbonyBoard),            typeof( EbonyLog ) ),
                new CraftResourceInfo( 1719, 0,    "Bamboo",        CraftAttributeInfo.Bamboo,        CraftResource.Bamboo,        typeof(BambooBoard),        typeof( BambooLog ) ),
                new CraftResourceInfo( 114,  0, "PurpleHeart",    CraftAttributeInfo.PurpleHeart,    CraftResource.PurpleHeart,    typeof(PurpleHeartBoard),    typeof( PurpleHeartLog ) ),
                new CraftResourceInfo( 37,   0,    "Redwood",        CraftAttributeInfo.Redwood,        CraftResource.Redwood,        typeof(RedwoodBoard),        typeof( RedwoodLog ) ),
                new CraftResourceInfo( 1153, 0, "Petrified",    CraftAttributeInfo.Petrified,    CraftResource.Petrified,    typeof(PetrifiedBoard),        typeof( PetrifiedLog ) ),
                //daat99 OWLTR end - custom wood
It's really a shot in the dark since the server just freezes. A crash would give us a place to start.
 

Darth Deity

Citizen
May 9, 2017
25
1
3
32
I didn't add OWLTR to my server, but i did add those to my Resourceinfo.cs file. However, mine looks like this:

C#:
        private static readonly CraftResourceInfo[] m_WoodInfo = new CraftResourceInfo[]
        {
            new CraftResourceInfo(0x000, 1011542, "Normal", CraftAttributeInfo.Blank, CraftResource.RegularWood,    typeof(Log), typeof(Board)),
            new CraftResourceInfo(0x7DA, 1072533, "Oak", CraftAttributeInfo.OakWood, CraftResource.OakWood, typeof(OakLog), typeof(OakBoard)),
            new CraftResourceInfo(0x4A7, 1072534, "Ash", CraftAttributeInfo.AshWood, CraftResource.AshWood, typeof(AshLog), typeof(AshBoard)),
            new CraftResourceInfo(0x4A8, 1072535, "Yew", CraftAttributeInfo.YewWood, CraftResource.YewWood, typeof(YewLog), typeof(YewBoard)),
            new CraftResourceInfo(0x4A9, 1072536, "Heartwood", CraftAttributeInfo.Heartwood,    CraftResource.Heartwood,    typeof(HeartwoodLog),    typeof(HeartwoodBoard)),
            new CraftResourceInfo(0x4AA, 1072538, "Bloodwood", CraftAttributeInfo.Bloodwood,    CraftResource.Bloodwood,    typeof(BloodwoodLog),    typeof(BloodwoodBoard)),
            new CraftResourceInfo(0x47F, 1072539, "Frostwood", CraftAttributeInfo.Frostwood,    CraftResource.Frostwood,    typeof(FrostwoodLog),    typeof(FrostwoodBoard))
        };
Only difference I see is the m_hue and m_number
Post automatically merged:

It is for sure something i changed recently because I have old boards in my pack and they show "boards: 60" but as soon as i create new boards, it separates them to another stack. I can move that new stack around I just can't click on them without a total freeze, and the client doesn't throw any errors. so frustrating.
 
Last edited:

Falkor

Squire
Apr 11, 2018
298
105
43
wpshard.com
Shard Name
Whispering Pines
I wonder if using the [props command on a new board would freeze things? If not it may let you compare them with the old boards to see what's different.
 

Darth Deity

Citizen
May 9, 2017
25
1
3
32
That's getting closer! Using [props, the name is -null-. So i need to find where I can name the board that is it producing. Not sure if the version section of boards.cs has anything to do with it, but I think we are close.

So i can use [props on both old and new boards, and I can rename a new board and not have the server freeze.
Post automatically merged:

Finally!

C#:
    public class Board : BaseWoodBoard
    {
        [Constructable]
        public Board()
            : this(1)
        {
        }

        [Constructable]
        public Board(int amount)
            : base(CraftResource.RegularWood, amount)
        {
            Name = "Boards"; // added resource name for pre-OPL
        }

        public Board(Serial serial)
            : base(serial)
        {
        }
adding the name to Public class Board fixed the hang up. All is good! You have been SO much help. Thank you for taking the time out of your day to help this guy who knows so little about all of this. I feel like I've learned a lot.
 
Last edited:

Falkor

Squire
Apr 11, 2018
298
105
43
wpshard.com
Shard Name
Whispering Pines
Great to hear that it's all working like it should!

I thought about suggesting a name for the plain one and thought "Nah, it's pulling a name already...." but now it dawns on me that your client may not have any of the cliloc entries the current scripts take for granted.

Because of that, be sure to change your commodity deed like I mentioned in the other thread so they'll be able to use the text names (TextDefinition) that are attached to your custom resources. TextDefinition is simply a variable type that can handle a number or a word/phrase which lets it accept a cliloc entry number or any other text you've specified.