Setting up CodeLite
This is a quick guide on how to set-up the third party scripting tool - CodeLite.
CodeLite - Introduction
As mentioned, scripting in HPL3 can look a lot like regular programming, but less complicated.
Because of that, we need tools that will be able to aid us when we write our code. For HPL2, Notepad++ or even Notepad were enough for that. This time around, something more powerful is needed.
CodeLite is very much like a text editor, but much more programming-oriented than Notepad++. It is the tool used officially by Frictional Games to develop their HPL3 games. Here are some of the relevant features of CodeLite:
- Code documentation on the fly
- Code autocompletion and smart code suggestion
- Fast and easy way to navitgate through large script files
- The ability to run the game from CodeLite
For the scripting guide, CodeLite 12.0.0 will be used, which is the latest stable release that can work with HPL3 without any errors or bugs.
This section explains how to configure CodeLite so it can be suitable for HPL3 scripting, how to create a workspace and a project, and how to import the script files.
- Download the optimized color theme
- Download and install CodeLite version 12.0.0.
- Launch CodeLite and configure:
Settings → Code Completion → General:
;*.hpsat the end of the
Additional file extensions to parselist.
Keep function signature un-formatted.
Re-parse on workspace loaded.
Settings → Code Completion → Colouring: Enable
Apply context aware colouring.
Settings → Code Completion → CTags → Search Paths: Click
Add..., navigate to the game folder and select the
Settings → Colours and Fonts...: Click on
Import settings from a zip archiveand select the
- Configure the rest of CodeLite to your liking.
- Create a new workspace: Create a folder inside your game directory and name it
_src. Go to the
Workspacemenu and click on
New Workspace.... Save the workspace inside the
- Create a new project:
Right click on the workspace → New → New Project. Select
Others → Non-code project. Give the project a name (For example: "soma"). Leave the rest as default.
- Add a folder to the project: Right-click on the project and choose
New Virtual Folder. Name it
- Add the game script files:
- Right-click on
_api → Add An Existing File..., add the file
hps_api.hpsfrom the game folder (If the file does not appear in your game folder, launch the game, and the file will appear).
- Right-click on the project and choose
Import Files From Directory. Navigate to the game folder and select it. In the next window, check the boxes for the folders:
maps, script, modsand click ok.
- Right-click on
Lastly, go to
Workspace and click on
That should be it, you should now have three top folders in your project and a lot of sub-folders with various script files.
Start typing something, for example
Entity_ and a list should appear showing all the functions that begin with
Entity_ and the documentation for each selected function.
Launching the Game From CodeLite
One additional thing you can do is to launch the game or your mod in dev mode through CodeLite itself.
To do this, right click on your project and go to settings. Then Click on
Customize → Custom Build.
Enable Custom Build. In the working directory, select the game folder.
Now you will need to add the command that launches the game or the mod. For example, a command that launches the main game of SOMA in dev mode will look like this:
Soma.exe -user Dev -cfg config/main_init_dev.cfg
Add the command to the
Build section in the table.
For more information about available commands, visit the Developer Commands article.
Now, all you need to do is to press F7, and the game will run!
Issues & Info
Class@ objectand not
Class @object, the latter will screw up coloring.
- If you lose coloring / code completion and can't get it back, re-parse the workspace:
- Parameters with
&inmight break the coloring of function parameters, but will have no other side-effects.