Building a Sims 3 compatible modding project without visual studio
Hello,
I am not exactly new to Mod The Sims (I've been reading, downloading and thanking for years), but this is my first time posting in here.
I want to start modding for the Sims 3, but downloading Visual Studio is not even an option for me.
This is a tutorial I just wrote about setting up a Sims 3 compatible modding project without Visual studio.
I attempted to post it in the tutorial catagory, but it seems like I do not have the required permission and I couldn't find how to contribute to the wiki, so I'm positing on here, I really hope I am not doing anything wrong by doing so.
I hope it helps some of you !
Setup for Sims 3 modding WITHOUT visual studio
This tutorial is meant for people who - just like me - refuse to use such a heavy IDE just for compiling a simple library.
It's based on this tutorial :
http://simswiki.info/wiki.php?title..._Studio_project
and this one :
https://msdn.microsoft.com/en-us/li...o/78f4aasd.aspx
STEP 0 : Open your terminal
=============================
First, you must open your favourite terminal. I am usually using gitbash when on windows environments, but since we're about to compile a .dll, it's not like we really have a choice, here.
I recommend you simply use Windows command invite if you do not have any preferences.
Just type "cmd" in Start>Search to find it.
STEP 1 : Locate your csc.exe
=============================
To compile our library, we're going to use csc.exe. It's the C# compiler.
You can find it by looking into your C:\Windows\Microsoft.NET\Framework\<version>\ directory.
The version of the .net framework version we're going to be using is 2.0.
If for some reasons you can't find version 2.0 in your directories, you can download it there :
https://www.microsoft.com/en-us/dow...ls.aspx?id=1639
Just follow the installation instructions.
STEP 2 : Create an alias
=============================
Then, for the sake of simplicity, we're going to create an alias on our csc so that we don't have to work
directly in its directory or type in its full path.
If you are using cmd.exe, this is the command to type :
$ set "csc=C:\Windows\Microsoft.NET\Framework\<version>\csc.exe"
Where <version> is 2.0, or 2.0.xxxxx (I personally am working on 2.0.50727)
Our alias is named csc, to this alias, we specify the path to our compiler's binary after the operator '='.
Tip : You don't have to write it all. Just copy it the way you normally would, then right click on the command invite and click "paste".
If you are using another shell, just create the alias the way you usually would.
To test if the alias was successfully created, use this command :
$ %csc%
If you are not using window's cmd, you probably won't need the '%' characters. Just type in "csc".
You should have an output similar to this :
C:\Users\Lunacie>%csc%
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.5483
pour Microsoft (R) Windows (R) 2005 Framework version <version>
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
fatal error CS2008: No input specified
It's not important what kind of fatal error message you get, as along as you get one.
The goal here is to make sure our alias was created, not to actually compile anything. Yet.
Now that our alias was created, we can start the actual setup part.
STEP 3 : Extract the assemblies
===============================
You will need to have already extracted and decrypted the Sims 3 assemblies to do this step.
See Getting Started with Scripting Modding if you haven't done this already.
You only need to do the "Getting Started" part. Ignore anything related to VS.
http://simswiki.info/wiki.php?title...Getting_Started
Once all the needed .dll are extracted, we can move on to the next step.
Once again, ignore anything related to Visual Studio.
STEP 4 : test.cs
=============
Then, decide where you want to create your C# source code file (.cs).
Open your favourite text editor. I am using Emacs.
I suggest you use Notepad++. Or, if you really don't want to download anything at all, and you don't care about syntax highlighting, simply use notepad.
If you choose to use notepad++ and you do not already have it, you can download it on their website :
https://notepad-plus-plus.org/
Notepad++ is the best text editor I have ever used on windows, and it has an amazing syntax colouring.
It will understand by itself that we are coding in C# (from the suffix we give to our file) and setup the language accordingly, plus, it lets
you customize themes, so that you don't get a migraine coding on a black on white window.
I am actually using notepad++ as I am writing this tutorial.
Create a new file, paste the following generic base code in it and save it.
using System;
using System.Collections.Generic;
using Sims3.SimIFace;
using System.Text;
namespace Pausinator
{
public class Class1
{
}
}
I picked this example from this tutorial :
http://simswiki.info/wiki.php?title...Getting_Started
We are not coding just yet, we just want it to compile, so use another example if you would rather. It doesn't matter.
Give any name you want, but it must be suffixed with ".cs" and preffixed by "yourName." , just like suggested in this tutorial :
http://simswiki.info/wiki.php?title..._Studio_project
My file is going to be named lunacie.test.cs, because it's the first time I am making a mod, or even coding in C#.
I'm discovering all this as I am writing this tutorial.
STEP 5 : Compiling
===============
First, we're going to go into the directory in which you created the file name.test.cs.
The command for that is "cd".
$ cd DISK:\path\to\your\file\
Then, we have our alias : %csc%, remember ?
First, we need to specify to our compiler what our source file is called.
(Don't type in the command just yet, please bear with me a little).
The command is going to look something like that :
$ %csc% name.test.cs
Okay. Now, if you are used to installing mods in your game, you know that most of the time, those are contained in .package files.
Well, we can't natively compile to .packages file, so what we are going to do, is compile to .dll and then, I guess
S3PE is going to help us turn this
.dll into a .package.
A .dll is a dynamic library file for windows applications (equivalent to .so for those who get the reference. Ahah see what I did there ? A Reference in a reference ! It's a referenception!!).
Ahem... It means it's going to be loaded in runtime.
So now, what we're going to do, is to tell our compiler we want this .cs file to be compiled into a .dll file, not into a .exe file, like I guess it would
probably have done by default.
Our command should now look something like this : (Please, do not type it in just yet, we're not ready, my simmer friends)
$ %csc% /target:library /out:name.test.dll name.test.cs
The /target:library parameter being used to specify we want a .dll,
the /out:Disk:name.test.dll being the name of our output file.
Okay now, remember the .dll's we extracted earlier using
S3PE ?
What we're gonna do now, is we're gonna tell our compiler that we want to use those files as references.
Our command line is now going to look something like that : (Not yet !)
$ %csc% /lib:"\path\to\your\dlls\directory" /reference:mscorlib.dll;ScriptCore.dll;SimIFace.dll;Sims3GameplayObjects.dll;Sims3GameplaySystems.dll;Sims3StoreObjects.dll;Sims3Metadata.dll;System.dll;System.Xml.dll;UI.dll /target:library /out:name.test.dll name.test.cs
See what we just did ? Pretty simple, right ?
the /reference:... Parameter is just a list of all our assemblies, separated by a ';'. (Be careful not to leave any spaces.)
the /lib:... one just specifies where the compiler needs to go looking for those assemblies.
But be careful, because csc.exe can't even parse it's own parameters and seems pretty stup- uh- I mean... You need to add all this in this specific order.
I really don't think we're gonna need every single one of them for every type of mods(in our example, we are only using SimIFace.dll, for instance) , but...
I didn't write the tutorial this tutorial is based on and I am not willing to take that risk just yet.
Ok now, the thing is, one of the game assembly is named mscorlib.dll, but by default, csc wants to include its own version of it.
Because you have two of it and the compiler doesn't know which one to use, it won't compile.
To deactivate this behaviour, you need to add "/nostdlib".
Now, the command looks like this :
$ %csc% /nostdlib /lib:"\path\to\your\dlls\directory" /reference:mscorlib.dll;ScriptCore.dll;SimIFace.dll;Sims3GameplayObjects.dll;Sims3GameplaySystems.dll;Sims3StoreObjects.dll;Sims3Metadata.dll;System.dll;System.Xml.dll;UI.dll /target:library /out:name.test.dll name.test.cs
You can finally execute the command, and... It compiles !!
Now you can follow any modding tutorial of your choice without having to worry about downloading many gbytes you are never going to use ever again anyway,
and free to use any software of your choosing in a free, simple, lightweight, modular, adapted to your own specific preferences, and practical environment !
Happy codding, my fellow simmers ! :lovestruc