Your first preview
Open your mod in VS Code, preview one of its windows and watch it redraw as you type.
The preview draws a window of a .gui file beside the editor, close to how the game shows it. It
needs no running game. These steps copy a window of the base game into your mod and edit it.
Before you start
Section titled “Before you start”- Etch is installed, and EU4 1.37.5 is installed through Steam, or its folder is set in the
setting
etch.gamePath: see Install and requirements. - You have a mod: one the game’s launcher lists, or a folder with a
descriptor.mod.
Preview a window
Section titled “Preview a window”- In VS Code, choose File › Open Folder… and open your mod’s folder, the one that holds its files. The Explorer lists them.
- Copy
provinceview.guifrom the game’sinterfacefolder into your mod’sinterfacefolder. Make that folder if your mod has none. To open the game folder, right-click Europa Universalis IV in your Steam library and choose Manage › Browse local files. It is usuallysteamapps/common/Europa Universalis IVin your Steam folder. - Open your copy in the editor.
- Run Etch: Open Preview from the Command Palette (Ctrl+Shift+P), or click the
Open Preview button in the editor’s title bar, at the top right. The preview opens beside
the editor. Until you put the cursor in a window, it shows the file’s first window,
janissaries_state_view. - Put the cursor inside the province view: press Ctrl+F, search for
name = "provinceview"and click on that line. The preview draws the province view. The toolbar at the top of the preview showsprovinceviewand the file’s path. - Search for
name = "provincename", the text that shows the province’s name. Change thexof itspositionfrom 100 to 150. As you type, the name moves to the right in the preview. The name is a stand-in, “Northmarch”. You do not need to save. - Open the Problems panel (Ctrl+Shift+M). Etch lists there what it finds wrong in the
file. Try it: in any
spriteType = "GFX_…"line of the window, add a letter to the sprite’s name. The Problems panel lists a warning for that line. It goes away when you remove the letter. - When you are done, delete your copy, unless your mod is meant to change the province view: the game would use your copy instead of its own.
What you see
Section titled “What you see”- The previewed window. The preview shows one window at a time: the window your cursor is in.
Only windows written directly inside
guiTypes = { … }count; a window inside another one shows as part of the outer one. Move the cursor into another window and the preview follows. When the cursor is outside every window, the preview stays on the last one it showed in that file, and a notice says so. To keep it on one window, click the window’s name at the left of the toolbar and choose it in the list: see Preview. - One view of the window. The province view holds widgets for many situations, such as your own and a foreign province. Etch knows which ones go together, so it draws one situation, the “Own province” view, instead of every widget at once. Click View ▾ in the toolbar to pick another, such as a foreign province: see Views and window profiles.
- Sample data. The game’s code writes the province’s name; the
.guifile leaves that text empty. The preview shows a stand-in such as “Northmarch” there, until you choose a save in Data ▾: see Sample data. - Your game’s screen size. The window is laid out at the screen size set in your game’s
settings.txtor, without one, at your monitor’s, and fitted into the panel: see Zoom and resolution.
Where to go next
Section titled “Where to go next”- Widget Outline: the widgets of the previewed window as a tree. Click one, or a widget in the preview, to go to the line that defines it.
- Problems: each warning Etch gives, and what to do about it.
- Where Etch finds the game: the game folder, the mods loaded with yours, and the language.
- Start and stop the live game: the game itself running beside the editor, which reloads each file you save.