Notepad++

From Frictional Wiki
Revision as of 00:02, 23 July 2020 by Darkfire (talk | contribs) (minor fixes)
Jump to navigation Jump to search

Notepad++

Notepad++ is a text editor with a ton of features useful when writing scripts for the HPL2 engine. Syntax colouring, auto-complete, call tips and so on and on. While it supports many different languages it does not, for obvious reasons, know much about our script functions. Here is a quick how-to for setting up Notepad++ so that it can auto-complete, give tips and give code snippets for .hps files.

Notepad++ Setup

    1. Download Notepad++
    2. Settings menu - Preferences - File Association -> customize add a .hps to registered exts
    3. Settings menu - Preferences - Backup/AutoCompletion -> Enable Function Completion and Function Parameters Hint on input.
    4. Download userdefinelang.zip, unzip and go to Language - Define your dialogue -> Import unzipped file "userDefineLang.XML"
    5. Download hps.zip, unzip and go to Program Files\Notepad++\plugins\APIs and put hps.xml here.


Notepad++ will now be able to

.hps script files should have the text colourized properly when you open them. Suggest functions, callbacks and other specific words when you begin to type, pressing enter completes the word. The suggestion window can be shown manually using ctrl-space. When re-typing a custom word, say "bMyBool", pressing ctrl-return will suggest auto-completions for words found in the current .hps file you are editing. Give a description of variables needed for functions and what type of variable it returns, if any. For example, type "AddTimer(" and it will show the variables needed. This can also be brought up if pressing ctrl-shift-space when in a function.

QuickText

With this plugin you can extend functionality further. If you write a function then press ctrl-shift-return and it will auto-write a whole code snippet.

    1. Using the Plugins menu in Notepad++, start Plugin Manager, in the available tab, select QuickText and install. Might have to download manually instead.
    2. By default QuickText uses ctrl-return, this collides with a Notepad++ shortcut and does not work. Use Settings → Shortcut Mapper … → Plugin Commands and change this to ctrl-shift-return, on line 202.
    3. Download quicktext.zip, unzip and open in Notepad++, copy its content.
    4. Open the file Notepad++/plugins/Config/QuickText.ini in Notepad++ and locate the row with [15], select it and paste the content from the previous step to replace and insert our HPL defined quicktext settings.
    5. Close and start Notepad++ to activate it's functionality.

With QuickText Notepad++ will now be able to

Write a function name and press ctrl-shift-return and the rest of the function should auto-complete, for each following ctrl-shift-return you should move through the different places. For example type “for” then press ctrl-shift-return, it should do:

for(X;X;X){
	X
}
X

Then for each ctrl-shift-return the cursor should jump to the X positions (they are not visible, only to show locations in example). There are also extra function auto-completes, for example add an s after for or if to make it a single line without the {}.

That's it, code snippets and function lists can be extended further of course by the user if wanted! Take note that QuickText can be a little buggy, for example the ctrl-shift-return to jump inside a function does not work reliable with all functions.