Hello everyone, this tutorial will cover how to use sections, a relatively obscure feature of the editor that makes collaboration of map coding and terrain much easier.
Overview
Sections are a way to manage code from multiple sources that are being worked on at the same time. Note that this is different then libraries and mod dependencies, which are used as shared code to be imported into multiple maps. You can use this feature to merge the code changes from multiple sources into a main map, thus allowing a team to easily subdivide the work for triggers and for placing terrain objects.
Creating a Section
To begin, create a new Map, call it Main for the sake of simplicity. This will be the map code and changes are merged into. Once you have created the map, create a 2nd map, call it External. This will be the map where code is taken from and merged into the Main map.
In the External Map, open up the Overview Manager. In the bottom left part of the module, you will see a area title "Sections" with 2 columns, Name and File. You can right click in this area to bring up a context menu or use the Data menu at the top to see the same menu. We will want to select "Add Section".
This will bring up a dialog asking us to enter a Name and Select a File. For now just input a name (Section One here), and press OK. You will now see the section appear in the sections area of the overview manager.
Adding Triggers to a section
Now we want to fire up the trigger module. You will notice there is a new entry on the top bar called "Section". For now we won't use it but it will come in handy later.
Create a generic trigger, and name it "Test Trigger". Next right click on the trigger and open up "Element Properties". You will now see a drop down menu for sections. Select the section we created earlier (Section One) and click Ok. The trigger is now part of that section. Save and exit this map (External)
Merging Sections
Now open up the first map we created, Main. Open up the Overview Manager again. This time, add a section like before, but name it the same as the one in External map (Section One) and also set the file to External.map. Then click Ok. You will now see the same section but with it referring to the External map (the place where the code we want is located).
Now open up the trigger module. That Section menu we noted earlier? Open it and click Merge All Sections. This will merge code from all sections defined in the Overview Manager (in our case, just External.map). This will bring up a summary of the changes that will be made. It will compare the code in the Main Map to the code found in the External Map to see if they have changed since you last merged. It will also give the time of the last change in the External map and the time of the last merge. Click Ok.
The merge will proceed and present a Summary of Changes. It will tell you what sections were merged, what type of things merged and what kind of change was made (In this case, it added the trigger). It will also show if a element that has the same ID has been renamed. Now close this and look at Main triggers. You will now see Test Trigger in the code. Congratulations, you have merged the code from a separate file into your main one.
Hello everyone, this tutorial will cover how to use sections, a relatively obscure feature of the editor that makes collaboration of map coding and terrain much easier.
Overview
Sections are a way to manage code from multiple sources that are being worked on at the same time. Note that this is different then libraries and mod dependencies, which are used as shared code to be imported into multiple maps. You can use this feature to merge the code changes from multiple sources into a main map, thus allowing a team to easily subdivide the work for triggers and for placing terrain objects.
Creating a Section
To begin, create a new Map, call it Main for the sake of simplicity. This will be the map code and changes are merged into. Once you have created the map, create a 2nd map, call it External. This will be the map where code is taken from and merged into the Main map.
In the External Map, open up the Overview Manager. In the bottom left part of the module, you will see a area title "Sections" with 2 columns, Name and File. You can right click in this area to bring up a context menu or use the Data menu at the top to see the same menu. We will want to select "Add Section".
This will bring up a dialog asking us to enter a Name and Select a File. For now just input a name (Section One here), and press OK. You will now see the section appear in the sections area of the overview manager.
Adding Triggers to a section
Now we want to fire up the trigger module. You will notice there is a new entry on the top bar called "Section". For now we won't use it but it will come in handy later.
Create a generic trigger, and name it "Test Trigger". Next right click on the trigger and open up "Element Properties". You will now see a drop down menu for sections. Select the section we created earlier (Section One) and click Ok. The trigger is now part of that section. Save and exit this map (External)
Merging Sections
Now open up the first map we created, Main. Open up the Overview Manager again. This time, add a section like before, but name it the same as the one in External map (Section One) and also set the file to External.map. Then click Ok. You will now see the same section but with it referring to the External map (the place where the code we want is located).
Now open up the trigger module. That Section menu we noted earlier? Open it and click Merge All Sections. This will merge code from all sections defined in the Overview Manager (in our case, just External.map). This will bring up a summary of the changes that will be made. It will compare the code in the Main Map to the code found in the External Map to see if they have changed since you last merged. It will also give the time of the last change in the External map and the time of the last merge. Click Ok.
The merge will proceed and present a Summary of Changes. It will tell you what sections were merged, what type of things merged and what kind of change was made (In this case, it added the trigger). It will also show if a element that has the same ID has been renamed. Now close this and look at Main triggers. You will now see Test Trigger in the code. Congratulations, you have merged the code from a separate file into your main one.
Merging from multiple sources
Merging from individual sources
Merging terrain objects