How do you write assemblies

Started by Gabe C, May 23, 2014, 11:19:33 PM

Previous topic - Next topic

Gabe C

I want to know how to write assemblies because I would create new stuff like aliens that don't stand still and have super abilities or potions or something. ;)
If you think about it, than it will be possible within one of many infinite universes.

ItchyFlea

I use ILSpy to read the \RimWorld413Win_Data\Managed\Assembly-CSharp.dll file to see the code Tynan has used to do certain things, then I modify that code with MonoDevelop and go from there.

Both programs are free to download and use. As for learning C#, I haven't a clue. I've basically been trying different things to see what works.

When compiling an assembly with MonoDevelop (Called Xamarin Studio when installed) make sure that you tell it to include references to "Assembly-CSharp.dll" and "UnityEngine.dll" Screenshot: http://i.imgur.com/LO7Asfm.jpg
You also need to tell it that the 'Target framework' is for .NET 3.5. Screenshot: http://i.imgur.com/P8hj3WS.jpg This step is extremely important, as the game may fail to load your assembly otherwise.
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Haplo

I've also made a small tutorial for it,  which can be found here.
Unfortunately it is dropped to page 3 now so not easy to find.

Crimsonknight3

Quote from: Haplo on May 24, 2014, 02:30:23 AM
I've also made a small tutorial for it,  which can be found here.
Unfortunately it is dropped to page 3 now so not easy to find.

I think your tutorial should include at least a few small steps on HOW to use Visual Studio... I am usually pretty good at figuring things out and common sense and VS still overwhelmed me!! :) Otherwise I looked through your tutorial and again, it is a pretty good example, but I think it needs just a bit more commenting to say what each piece of code is doing, again to help beginners understand how the language works etc :) - Maybe link a decent c# tutorial aswell. I'm reading http://www.homeandlearn.co.uk/csharp/csharp.html at the moment :)

mrofa

Start Visual
File -> New Project-> Templates-> Visual C# -> Class Library
Write a name and location where the project will be, no idea what solutions are so dont change them :D
And press Ok.
It will create that stuff and open editor and you will get stuff similar to this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClassLibrary4
{
    public class Class1
    {
    }
}


So now look on the right side of the window and you will see solution explorer.
Click RMB on reference and on add reference.
Now Click browse and go to RimWorld\RimWorld413Win_Data\Managed
Select Assembly-CSharp.dll and UnityEngine.dll.
Press ok and your done.

Oh and F7 will compile and create .dll.


All i do is clutter all around.

Crimsonknight3

/\
Should add that to your guide Haplo and thanks mrofa :)