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!
Test Subject
Original Poster
#1 Old 16th Jul 2015 at 9:38 PM Last edited by lunacie : 16th Jul 2015 at 10:45 PM.
Default 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
Advertisement
Test Subject
Original Poster
#2 Old 17th Jul 2015 at 4:48 PM
Uh... I guess no one is really interested...

I wanted to add, in case you wish to add modded objects to the game, TheSimsWorkshop implements a similar method, has its own builtin text editor and uses the same compiler, so still no visual studio needed, but I guess most of you guys already knew that.

I hope it helps someone in the future, anyway.
Inventor
#3 Old 17th Jul 2015 at 7:11 PM Last edited by Arsil : 17th Jul 2015 at 7:59 PM.
# I hope it helps someone in the future, anyway.

That's the right attitude.
I, for one, want to thank you for sharing that, even if I have no use for it.
Don't get disappointed, the technical areas (at least TS3's ones that I've followed closely in the last
months) have always had very low traffic and lack of action, with many threads left unanswered.

I can also presume that many people got tired of trying to help and replying because:
- it's always the same questions
- it's rare to get a "hi", "please", "thank you" (not that one should help to be thanked) or hear back
from the opening poster. Not to mention that the ones who get help often don't share what they do,
but, again, not that is mandatory to do that either.
- [EDIT] I forgot what is probably the main reason: there aren't many active modders left and often
answering requires some expertise and experience with the code and the way game resources work.

I guess some of my points make me old fashioned and I'm digressing anyway, so bye ^^
Test Subject
Original Poster
#4 Old 17th Jul 2015 at 11:51 PM
Quote: Originally posted by Arsil
# I hope it helps someone in the future, anyway.

That's the right attitude.
I, for one, want to thank you for sharing that, even if I have no use for it.
Don't get disappointed, the technical areas (at least TS3's ones that I've followed closely in the last
months) have always had very low traffic and lack of action, with many threads left unanswered.

I can also presume that many people got tired of trying to help and replying because:
- it's always the same questions
- it's rare to get a "hi", "please", "thank you" (not that one should help to be thanked) or hear back
from the opening poster. Not to mention that the ones who get help often don't share what they do,
but, again, not that is mandatory to do that either.
- [EDIT] I forgot what is probably the main reason: there aren't many active modders left and often
answering requires some expertise and experience with the code and the way game resources work.

I guess some of my points make me old fashioned and I'm digressing anyway, so bye ^^


I get it. Thank you for your kind answer !
Nah, I'm not disapointed because I know the thread was referenced by google, so if anyone in the future needs help about this issue, they are going to find it easily, it's all that counts.

I wrote the tutorial while I was doing research on how to start modding for the Sims 3. Now that it's all set up, I can get started on my first mod !
I don't know if we lost many Sims3 players to the Sims4, but to me, the Sims 3 still seems like an open playground only waiting for more creative content !
I just started working on a portable bathing bucket like the ones used in traditional japanese culture, for example.
I wasn't planning on talking about this project in this thread, but I'm a fervent user of your mods, and I thought you might find it interesting, for obvious reasons... :p
Instructor
#5 Old 18th Jul 2015 at 5:18 AM
Yeah I do find your thread interesting but usually very few reply to such technical threads, probably because of people's lack of understanding (including me).

While this may be off topic, I want to recommend the use of Xamarin Studio for coding here as well. It may be irrelevant but personally speaking I find the not-referencing-mscorlib.cs part of the program very useful, and is more streamlined than Microsoft VS.
Forum Resident
#6 Old 26th Oct 2016 at 1:25 AM
Hi! Thank you for sharing your information and for the tutorial. It's quite detailed and was exactly what I was looking for Considering that it's been a while since you posted it, I'm not sure if you'll see this but I have been having a few problems with the second step. I am using Command Prompt and I copied and pasted the code you showed (remembering to place my version number instead of <version> ) and pressed enter but I didn't get the desired outcome. It said that "$" is not recognised as an internal or external command, operable program or batch file. I tried a couple of different things such as removing the $ symbol as a whole or changing the space between that and the rest of the text and it didn't work. When I tried testing to see if the alias had formed I got this error:
The system cannot find the path specified.

I'm not sure what I'm doing wrong because I checked and I know that that is the location of the csc.exe file.

Any help or advice would be extremely appreciated
Test Subject
#7 Old 12th Jan 2017 at 5:59 PM
I tested it and it worked without any $ anywhere. The call of csc should always be %csc% in command line and I used it in the same cmd right after I made the alias. I got errors on the compilation when I created a large cs file with ILSpy from a dll of an existing mod. I think it worths to try.
Mad Poster
#8 Old 12th Jan 2017 at 7:47 PM
This is interesting. Might look into it in the near future.

insert signature here
( Join my dumb Discord server if you're into the whole procrastination thing. But like, maybe tomorrow. )
Test Subject
#9 Old 13th Jan 2017 at 2:38 PM Last edited by superstorm : 13th Jan 2017 at 2:59 PM.
I tryed this again today but in some small sample code of mine with syntax errors, just to see what happens. I got errors (some numbers) that I don't know or understand. If you ever get such thing, how you debug it? I mean that you must be 100% sure that you have not made any syntax error (and just to make it clear, a missing semi colon ( ; ) is an error or a curly bracket or any of those stupied things ( {} [] ul <> () ... and more) that can multiply an error in to dozens) What you do in such cases? Is anything else except Visual Studios for that?
Back to top