Here you're into territory that "won't need any explanation providing you're already familiar with a language like C".. as i've been so for the last 20 years or so its not something i thought of documenting
So... lets look at the first bit
This is the bit that defines the event.. i.e. it tells the server that there follows a bit of code that needs to get run when this particular event occurs. The formatting of that line is part of the language specification. The spaces don't matter really (they're just there to make things look neat).
The important parts to that line are first the word "Event" which says 'Here comes a bit of code for an 'Event' '. Coz its an event the server expects to find some parameters in brackets straight after. The parameters in brackets define the type of event.
In this case, its saying the event name is "NewBuilding", and the second parameter (in the case of a 'NewBuilding' event) specifies the building type number.
In summary.. the line above says "There follows a bit of code that should be run whenever a new building (of type 3) is created".
The { } brackets set out the block of code that should be run for that event. Once its recognised the Event line, the server looks for a {, then runs through all the statements until it finds a corresponding }
as an example, suppose the code looked like this
Code: Select all
Event( “NewBuilding”, “3” )
{
*say Message 1
*say Message 2
}
*say Message 3
then the output would be 'Message 1' then 'Message 2' but 'Message 3' would not get printed. (As that line is outside of the code block defined by the { .. } )
I have no problem using notepad to edit the files (they're just .txt files really).. Depending on your windows setup, you might need to set a file assignment up first... hold shift, right click a .mit file, then select "Open with".. select Notepad from the list and make sure the 'always use this program to open this filetype' checkbox is selected.
Alternatively, go download the free 'Express' version of Visual Studio 2008 (or 2010 or whatever) and use that to manage your scripts. With a bit of setup (which i won't go into here) you then get the benefit of a project management window (allowing you to arrange all your different files nicely when your script projects starting gettin big) as well as a bit of syntax highlighting in the code. (Once you get used to it, no code looks right unless comments are in green).
Hope that helps.