Tutorial:Sims 3 In Depth Scripting

From SimsWiki
Revision as of 15:49, 4 October 2011 by Odistant (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Intro

My goal in this guide is to help the complete "noobs" at scripting languages and put them in words that they can describe. This guide assumes you know absolutely nothing about C# and you really want to learn how to make those cool scripts for objects that you see all the time. This will go over methods, classes, strings, overrides, and more. You should have a very, very basic understanding of the InteliSense system that Visual Studio provides as well as a basic idea of using Reflector.
THIS IS A WORK IN PROGRESS

Requirements

  • Microsoft Visual C# Express 2008 - I will call this program VS for short. I highly reccomend that you use this version instead of the 2010 as it seems to not work correctly when it comes to referencing.
  • Sims3 Package Editor - I call it S3PE for short in this guide.
  • Sims3 Object Cloner - S3OC isn't mentioned very much in this guide until the very end. You'll normally use this program for finding what objects are derived from what and cloning items to change their scripts.
  • .NET assembly browser/decompiler - I use Reflector 6.8. You can get the trial version of Reflector 7 if you want.
  • A good understanding of using text editors and computers. Programming is not for the people who don't know how to use computers.

Lets do this!

Classes

Classes are the building blocks of scripting. They allow you to group up parts of your code and to "derive" parts of code. You will ALWAYS start off your code with a class of some sort.
Still don't understand the concept of a class? Think of them as groups. You group your code together. Similar to how baseball would be under the group of sports. Now, there are a bunch of different types of sports like football, tennis, and volleyball. All of them are sports because they are grouped under sports. It's common knowledge. When you think of baseball, you think of sports. When you think of sports, you think of baseball.
There are a few different types of classes. Here's a chart of them and what you would use them for.

Type of Class How to use it

class

This is normally used right after the namespace. It is typically followed by a public/private class.

public class

This is used right after you have a class, however a class is not needed to use "public class". You can start off with "public class" right after your namespace. This makes your class accessible by anyone trying to use your code.

private class

This is used for making a class unaccessable by anyone but you. This means that if someone references your DLL they will not be able to use methods inside that class.


Deriving A Class

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox