What is it?
Before you can edit the main.scm file, you first have to decompile. This means that it will become humanly readable, you transform the extension from .scm to .txt. You can do this in programs as MisionBuilder and SannyBuilder, but not in notepad. Once you have the txt file, you can also open it in notepad or any other text editor. This isn't very handy, because there aren't any extras in notepad (which makes it a lot more difficult).
How to decompile?
Because these tutorials are about SannyBuilder, I will explain it for SannyBilder.
Press F5, or the icon "Decompile" or "run" > "Decompile".
Go to the folder: Program Files > GTA San Andreas > Data > Script and select "main" (a .scm file). Open it.
When you are doing it for the first time, you will get a screen like below. Select the folder "GTA San Andreas". Then you have to do the previous step again.
Now you will get the text, which you can edit. When you save it, you will get a txt file.
What is it?
This is the opposite of decompile. When you want to test your code, you have to transform it back to the language which GTA SA can read. So you have to make it a .scm again. You can do it by pressing F6, press the icon of "compile" or by "Run" > "compile".
What is the difference between compile and compile + copy?
You can choose to save your txt file is at another folder on your pc than the original Data folder. Compile means that the SCM file will be created in the folder where your .txt file is saved. Compile + Copy means that the SCM file is copied into the Data folder after compilation. So the main.scm in the data folder will be replaced. There is no difference when you are editing the main.txt that is located in the "data" folder itself.
In SannyBuilder are some words marked:
Black: these are often used commands, like jump, wait, create_thread, fade, repeat, jf, etcetera. You don't have to put the code before it.
Green: these are labels, for example ":label" or "@label".
Blue: the variables have a blue colour.
Red: names of for example objects, texts and threads are red.
Yellow and blue: Yellow is the "object", the blue is what is said about the object. It is difficult to explain, but when you look at it, I'm sure you will understand it.
Brown: names of the models.
Blue/Grey (light): this are comments, they are not read by the game and are handy as a note. They are proceeded with //.
There are a few functions in SannyBuilder, which are very handy to use. Of course there are more functions, but these are the most important ones.
Coords manager. You can find it in Tools > Ide Tools > Coords Manager (hot key: CTRL+ALT+1). You can find the X, Y and Z coordinate of the place where you are in San Andreas. You can also find your angle. You can't use this when SA isn't running of course.
Opcode search. You can find it: Tools > Ide Tools > Opcode Search (hot key: CTRL+ALT+2). With this tool you can find opcodes very easily.
F1 key: when you typ a little part of a command, sannybuilder will try to find a command as it was used in the original main.scm.
SCM documentation. You can find it under the help-menu (hot key: F12). You will find a usefull database. You can find here for example the icon-numbers.
Start SA: you can start SA by pressing F8 or the icon "Run San Andreas".
Missionbuilder > Sannybuilder converter: it doesn't work perfect, but you can find it under Tools-menu > Code Converter > MB -> SB.