Hearts of Iron IV

Hearts of Iron IV

Not enough ratings
Syntax highlighting and auto-completion for Notepad ++ | Синтаксис и автозавершение для Notepad ++
By Viktor_Skopin
This set for Notepad ++ increases the readability of the Hearts of Iron 4 files and simplifies the creation of mods.

Данный набор для Notepad++ увеличивает читаемость кода файлов Hearts of Iron 4 и упрощает создание модов.
   
Award
Favorite
Favorited
Unfavorite
Examples | Примеры
With Iosevka font | Со шрифтом Iosevka

Components | Комплектация
This set of files includes a file that defines a UDL (User Defined Language), which defines rules for syntax highlighting and code folding, and a file that defines a list of words for auto-completion.

The release archive contains two folders "Auto-completion" and "UDL". The first folder contains one file - "Hearts of Iron 4.xml", with a list of words for auto-completion, the second contains several files defining the syntax, the difference between which is only in the color palette.

  1. "HOI4 - Standard.xml" - Standard dark color palette for use in standard Notepad ++ style
  2. "HOI4 - Standard Bright.xml" - The palette is the same, but brighter.
    The difference between different types of words is more noticeable. Also designed for standard style use.
  3. "HOI4 - Plastic Code Wrap.xml" - A palette designed for the dark Notepad ++ style, specifically for the "Plastic Code Wrap" style.
    However, with other dark styles it looks good too.

-------------------------------------------------------------------------------------------------------

В данный набор файлов входит файл, задающий UDL (Пользовательский язык), который определяет правила подсветки синтаксиса и сворачивания кода, а также файл, который задаёт список слов для авто-завершения.

В релизном архиве расположены две папки «Auto-completion» и «UDL». В первой папке лежит один файл - «Hearts of Iron 4.xml», со списком слов для авто-завершения, во второй находятся несколько файлов определяющих синтаксис, разница между которыми состоит только в цветовой палитре.

  1. «HOI4 - Standard.xml» - Стандартная палитра тёмных цветов для использования в стандартном стиле Notepad++
  2. «HOI4 - Standard Bright.xml» - Палитра та же, но более яркая. Разница между разными типами слов более заметна. Также рассчитана на использование в стандартном стиле.
  3. «HOI4 - Plastic Code Wrap.xml» - Палитра, предназначенная для тёмного стиля Notepad++, конкретно для стиля «Plastic Code Wrap». Впрочем, с другими тёмными стилями выглядит также хорошо.
Downloading and installing | Скачивание и установка
You can download the set from this repository - https://github.com/Viktor-Skopin/NPP-HOI4-Syntex/releases

  1. On the release page in the "Assets" list, select the first item (HoI4-Syntax.7z).
  2. After downloading the archive, unpack its contents to any location.
  3. Open Notepad
  4. In the menu go to "Language - Define your language..."
  5. In the window that opens, click "Import..." and select one of the syntax files from the UDL folder
  6. Next, you need to go to the program folder and open the "autoCompletion" folder
  7. Move the "Hearts of Iron 4.xml" file from the "Auto-completion" folder to this folder
  8. Done. The "Hearts of Iron 4" language should appear at the end of the languages list. When you use it, auto-completion will also work for you.

-------------------------------------------------------------------------------------------------------

Скачать набор можно с данного репозитория - https://github.com/Viktor-Skopin/NPP-HOI4-Syntex/releases

  1. На странице релиза в списке «Assets» выберите первый пункт (HoI4-Syntax.7z).
  2. После скачивания архива, распакуйте его содержимое в любое место.
  3. Откройте Notepad++
  4. В меню перейдите в «Синтаксисы – Задать свой синтаксис…»
  5. В открывшемся окне нажмите «Импорт» и выберите один из файлов синтаксиса из папки UDL
  6. Далее вам нужно перейти в папку с программой и открыть папку «autoCompletion»
  7. В эту папку переместите файл «Hearts of Iron 4.xml» из папки «Auto-completion»
  8. Готово. Синтаксис «Hearts of Iron 4» должен появиться в конце списка синтаксисов. При его использовании у вас также будет работать авто-завершение.

Features | Особенности работы
Words in UDL are divided into seven groups.
  1. Conditions (Triggers)
  2. Effects (Commands)
  3. Modifiers
  4. Scopes
  5. On actions
  6. Game Variables

In addition to the listed six groups, there is a group "Parameters". It consists of various parameters that may belong to words from other groups. And also from words that are not suitable for other groups.

After checking the word lists of different groups from the official documentation, I found that quite a few words are in several groups. For each such word, I defined a group for them myself.

Due to the fact that one word can belong to different groups in different contexts, the highlighting of words can sometimes be incorrect. It is not possible to fix these bugs in Notepad ++. However, in practice, these bugs usually do not interfere with scripting.

It is also worth considering that this syntax will be automatically applied to all files with the ".txt" and ".asset" extensions.

-------------------------------------------------------------------------------------------------------

Слова в UDL разделены на семь групп.
  1. Conditions (Triggers)
  2. Effects (Commands)
  3. Modifiers
  4. Scopes
  5. On actions
  6. Game Variables
Помимо перечисленных шести групп есть группа «Parameters». Она состоит из различных параметров, которые могут принадлежать словам из других групп, а также из слов, которые не подходят для других групп.

Сверив списки слов разных групп из официальной документации, я обнаружил что довольно много слов находятся в нескольких группах одновременно. Для каждого такого слова мне пришлось определить группу самостоятельно.

Из-за того, что одно и то же слово в разных контекстах может относиться к разным группам, подсветка слов иногда может быть неправильной. Исправить данные ошибки в Notepad++ не представляется возможным. Впрочем, на практике данные ошибки, как правило, не мешают написанию скриптов.

Также стоит учитывать что данный синтаксис будет автоматически применятся ко всем файлам с расширением «.txt» и «.asset».
Difference between color palettes | Разница между цветовыми палитрами
«Standard»


«Standard Bright»


«Plastic Code Wrap»
Recommendations | Рекомендации
Do not import multiple UDL file variants at the same time.
This can cause errors in Notepad ++. Uninstall the old version before installing the new version of the file.

For better readability of the code, I recommend changing the default Notepad ++ font to something else. For example, the font "Iosevka". You can download it here - https://github.com/be5invis/Iosevka/releases

Visual comparison:
-------------------------------------------------------------------------------------------------------

Не импортируйте несколько вариантов UDL файла одновременно. Это может вызывать ошибки в работе Notepad++. Перед установкой новой версии файла удалите старую версию.

Для лучшей читаемости кода я рекомендую сменить стандартный шрифт Notepad++ на другой. Например, на шрифт «Iosevka». Вы можете скачать его здесь - https://github.com/be5invis/Iosevka/releases

Сравнение:
Questions and answers | Вопросы и ответы
Q: I switched the style in Notepad ++ to "Plastic Code Wrap", but the background color remains white, how can I change it?
A: Go to "Settings - Style Configurator" and check the box "Enable global background colour". Now the background color of the text will always be set by the style and not by the syntax.

Q: I don't like the highlight colors of the words. How can I change them?
A: Go to "Language - Define your language...". In the field "User language:" select "Hearts of Iron 4". Select the desired word group and click the "Styler" button. In the window that opens, you can change many things, including the color.

-------------------------------------------------------------------------------------------------------

В: Я переключил стиль в Notepad++ на «Plastic Code Wrap», но цвет фона остался белым, как мне его сменить?
О: Перейдите в «Опции – Определение стилей» и поставите галочку в пункте «Общий цвет фона текста». Теперь цвет фона текста всегда будет задаваться стилем, а не синтаксисом.

В: Мне не нравятся цвета подсветки. Как мне их сменить?
О: Перейдите в «Синтаксисы – Задать свой синтаксис…». В поле «Польз. язык:» выберите «Hearts of Iron 4». Выберите нужную группу слов и нажмите кнопку «Стиль». В открывшемся окне вы сможете поменять, в том числе и цвет.