This page will walk you through the process of setting up your development environment for writing AngelScript scripts for use in SpellForce III.
The editor of choice for this task is Sublime Text 3, which you can download here (there is an unlimited free trial version, but the program is pretty awesome so you might want to consider buying it anyway).
Of course any other text editor/IDE with syntax highlighting support for C++ or something similar (e.g. Notepad++) will work as well, but it won't look as nice and will (probably) not support any of the advanced features discussed in the following sections.
Sublime Text 3 Setup
After downloading and installing Sublime Text 3, you should perform the following steps in order to get full syntax highlighting, auto completion and some basic intellisense support.
- Make sure that you have started Sublime Text 3 at least once (you can leave it running for the following steps).
- Open the install location of SpellForce III (or the grimlore\sf3\root\ folder for internal developers) in the explorer and run UpdateSublimeCompletions.bat by double-clicking it in order to automatically install the most recent auto-completion database with all script commands available in the current SpellForce III build.
You should also make it a habit to run this again after every major update, in order to ensure that you always have the latest scripting features available.
- Start up Sublime Text 3 if it isn't running already and from the top menu select Project and then Save Project as.... Save the project file to a suitable location (e.g. your My Documents folder).
- Again from Project select the option Add Folder to Project... and navigate to the folder bin_win32\configs\levels\ within your SpellForce III installation directory (internal developers should instead choose grimlore\sf3\root\data\configs\levels\). You should now see an overview of all script files and folders on the left side of the window.
- Open any .as file from the list.
- In the very bottom right of the window you will see a text that probably reads ActionScript, as that is Sublime Text's default interpretation of the .as file extension.
In order to change that, click on the text and from the menu that opens select Open all with current extension as... and then C++.
(Note: There is also a plugin for Sublime Text 3 which allows it to highlight the actual AngelScript syntax, however that plugin will not work well with Sublime Text's builtin intellisense. It is therefore recommended to use the default C++ syntax highlighting instead, which will work just fine.)
- That's it, you're done!
Sublime Text 3 Features
Sublime Text 3 provides many helpful shortcuts and features in order to help you write scripts more efficiently. Below is a list of shortcuts that can make your life easier.
|F12||Go to definition||Jump to the definition of the currently selected symbol. This can also be done by hovering the mouse over the symbol and clicking the displayed link.|
|Up/Down Arrow||Select auto completion option||When you start typing, Sublime Text 3 will automatically suggest a list of possible auto completions. You can use the arrow keys to choose the one you want.|
|Tab||Confirm auto completion||Inserts the currently highlighted auto completion option where you are typing.|
|Tab / Shift + Tab (after auto completion)||Navigate function arguments||When using auto completion to select a function, you can press Tab and Shift + Tab to jump between the functions arguments (forward and backward respectively) and fill them in.|
|Ctrl + Space||Open auto completion suggestions||If you have accidentially closed the auto completion suggestions, you can recall them at any time by pressing Ctrl + Space.|