Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Virtual gardener
staff: administrator
Original Poster
#1 Old 3rd May 2018 at 11:35 AM Last edited by Lyralei : 3rd May 2018 at 12:01 PM. Reason: Damn enter buttons not letting me finish my post :P
Default Skill ITrackedStat is being confusing
Hi there!

I've been working on a sewing table crafting thingy that has a sewing skill script to it. it's far from done, however I got pretty much the "skeleton" or well, something appropriate for a first testing run almost ready. However after studying the way EA, and that mainly being store items, really but also in-game (and used a few people's mods that successfully made a skill as well, to see how they might have bypassed this) Couldn't really get me to see what is causing it to whine about it.

So, here is a small snippet of the code:

Code:
public class SkillSewing : Skill
{
     private class MasterpieceCount : ITrackedStat
            {
                private SkillSewing mSkill;

                public string Description => SewingTable.LocalizeString(mSkill.mSkillOwner.IsFemale, "Lyra/LocalizedMod/MasterpieceCount", (object)mSkill.mMasterpieceCount);

                public MasterpieceCount(SkillSewing skill)
                {
                    mSkill = skill;
                }  // end MasterpieceCount
           } // end Masterpiece count class

        private int mMasterpieceCount;

        private const uint kIdHashMasterpieceCount = 0x62A00EAE;

} // end skill class

            public static string LocalizeString(bool isFemale, string name, params object[] parameters)
	        {
		        return Localization.LocalizeString(isFemale, sLocalizationKey + ":" + name, parameters);
	        }



It especially whines about this line:

Code:
 public string Description => SewingTable.LocalizeString(mSkill.mSkillOwner.IsFemale, "Lyra/LocalizedMod/MasterpieceCount", (object)mSkill.mMasterpieceCount);


Basically it either says "Invalid token ',' in class, struct, or interface member declaration" Or " expected ; " which it says that => was suppose to be ;
Now I tried a few things already myself, by removing the mSkill.mSkillOwner.IsFemale totally. Or changing the privates to public or even internal. Checked the using namespaces and even the resources (not that I was expecting that to fix anything, but hey you gotta try something ;D), seeing if it's maybe the mMasterpieceCount causing it. Even changed the brackets... nothing did it.

So I'm kinda clueless as to how to get it to work without having to write an entire workaround (especially since "description" should have it all inside itself in order for the localizestring to work in the first place as a target)
Advertisement
Space Pony
#2 Old 3rd May 2018 at 5:24 PM Last edited by Battery : 3rd May 2018 at 8:01 PM.
the => as an Expression-bodied Member is a feature of C# 6.0 maybe this is the problem.

so you might want to write the following:

public string Description
{
get
{
return SewingTable.LocalizeString(mSkill.mSkillOwner.IsFemale, "Lyra/LocalizedMod/MasterpieceCount", (object)mSkill.mMasterpieceCount);
}
}
Field Researcher
#3 Old 3rd May 2018 at 8:34 PM
This is what Arsil Programming skill decompiles for me like:

public string Description {
get {
return Localization.LocalizeString ("Arsil/ProgrammingSkill/FreelanceWorksDone", new object[] {
this.mSkill.NumFreelanceWorks
});
}
}

My answer is kind of useless because Battery already answered the same thing^^ I also think the => is the problem
Virtual gardener
staff: administrator
Original Poster
#4 Old 5th May 2018 at 11:19 AM
I guess I missed the get's there then when looking at it. Because I did want to give that a try though I guess because I missed it I thought there were different ways of doing it. But uhhh seems like I overlooked that! Thanks! Sometimes it's just a matter of thinking too hard rather than actually following the traditional ways :P
Back to top