Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 11th Jan 2026 at 1:09 AM
Help: Beginner adding a command
Hey, sorry if this is silly/obvious but I'm such a beginner to this all and I'm really confused! I'm so close to giving up
So I followed the Pure Scripting Modding tutorial and made myself a VS project template that I think is correct. Using some of the guidance from that tutorial I ended up trying to make this as my first simple project, another way to type testingCheatsEnabled into the console. This was the result:
Code:
using System;
using Sims3.Gameplay.Core;
using Sims3.SimIFace;

namespace Swiffy.HelloWorldCommand
{
    public class HelloWorld
    {
        [Tunable]
        private static bool kInstantiator = true;
        static HelloWorld()
        {
            World.OnWorldLoadFinishedEventHandler += new EventHandler(OnWorldLoadFinished);
        }
        private static void OnWorldLoadFinished(object sender, EventArgs e)
        {
            Commands.sGameCommands.Register("testingAlias", "enables testing cheats", 2, Commands.OnTestingCheats);
        }
    }
}
Yet I keep getting the errors in VS that 'Commands' does not contain a definition for 'sGameCommands' nor for 'OnTestingCheats'! I managed to reduce an error by using 2 instead of CommandType.Cheat but I'm so confused because when I peek at the Commands definition in Sims3.Gameplay.Core...
Code:
public class Commands
I see...
Code:
private static CommandRegistry sGameCommands;

right there! I think I saw a code snippet in here about using CommandSystem instead but I've checked some other mods in dnSpy and this seems to be the legit way to do it. Please be nice, I'm so stuck
Reaper
staff: moderator
#2 Old 11th Jan 2026 at 2:00 AM
Because the members you're trying to access are private (or any other non-public protection), meaning that it's only available to the class it's contained in. Microsoft Learn explains those protection levels.

You must use unprotected assemblies, which are used to access those kinds of members. The NRaas repository on GitHub has its own unprotected assemblies that you can use.

This is a signature.
Test Subject
Original Poster
#3 Old 11th Jan 2026 at 2:03 AM
So it would still work in game to use the unprotected ones? The mod wouldn't end up still being in a separate container as well? Thanks so much for the help by the way Sorry for assuming VS would just miraculously know that the game doesn't check the levels :P
Reaper
staff: moderator
#4 Old 11th Jan 2026 at 2:25 AM
The other mods you checked with dnSpy also did the same! It should work.

This is a signature.
Back to top