Category Archives: Workflow Tricks

I made a game! Buy on Steam

I didn’t embed the video directly to avoid any tracking from Google and complications with the DSGVO.

++ Update ++

Not only for Notepad++!!

Γ«RiC pointed out that there are ways to use this functionality with every selected text. Independent from any text editor! Click here to read how.

Preface

This article is about an easy-to-use plugin for Notepad++ which makes it possible to work in a TXT or XML and directly open files (which are mentioned with their filepath) without the need for opening a file explorer and go file-hunting.

The Problem

While working on games I often had to work with textfiles like for example material-, effect- and sound-libraries which contain information where the specific assets lay in our asset directory.

When I wanted to look at the texture, I had to look at the filepath, open a windows explorer, click through the folder-structure and finally open the texture.

I don’t like that.

In a dreamworld a click on the filepath in the XML editor would open the file but in our case (developing X:Rebirth) we used relative paths so Notepad++ would have no idea where to look at for the file.

But there’s a great solution coming as plugin to Notepad++!

Easy Installation

If you don’t have NppExec already in the Plugins-menu, use the built-in Plugin-Manager and install it. It’s really easy. :)

Usage

What you have to do first is to press F6, admire the small opened window and paste this code into it:

npp_run $(CURRENT_WORD)

npp_run is a command and will execute (or “open”) what you tell it to.
$(CURRENT_WORD) represents what you currently have selected in your textfile.

You can save your magic script as preset and close the window. What now happens is, that if you select some text, hit F6 and just press Enter (or click “OK”) the program will try to open the file which you’ve selected:

Great thing is, if you have relative paths like we did during our work on X:Rebirth, you can just add what’s needed. Here’s an example of what a path in our material library looks like:

assets\textures\argon\ar_hulls_02_diff

Some information are missing like the beginning of the path and of course the file extension.

D:\Simon\Projekte\Egosoft\XR\[assets]\assets\textures\argon\ar_hulls_02_diff.tga

No problem! Just add what you need around the $(CURRENT_WORD) and you’re perfectly fine!

From now on you can open every file within a blink of an eye and if you want to open WAV, Particles, MP3 … just add another line to your script, adjust the path and you’re done!

Here’s a multi-line script-example. It tries to open several files and when it has success with one of them, it will open it. That’s why you only need one script for everything. :)

npp_run D:\project1\workfiles\$(CURRENT_WORD).psd
npp_run D:\project1\assets\$(CURRENT_WORD).dds
npp_run D:\project1\assets\$(CURRENT_WORD).fbx
npp_run D:\project1\sfx\$(CURRENT_WORD).wav

Also it helps a huge deal if there’s a error in the filepath like a missing “\” and you wonder why the game can’t find your asset. With this plugin you just do your selection press F6+Enter and know 100% if the path to your file is fine.

I hope soon you’ll experience too how drastically this small plugin improved my workflow and removed the annoying part of crawling through file structures to almost zero.

Feel free to drop any feedback in the comments, mail, twitter or facebook!

Update 1
Γ«RiC asked in the comments very good question: “Why not use AutoHotKey to make it generally work?” (not only with Notepad++).

Because of this I copied this code, extended it and if you now press Ctrl+J the currently selected text (doesn’t matter where you select it!) is taken as relative path and executed:

^j::
WinActive(“A”) ; sets last found window
ControlGetFocus, ctrl
if (RegExMatch(ctrl, “A)Edit\d+”))
ControlGet, text, Selected,, %ctrl%
else {
clipboardOld := Clipboard
Send, ^c
if (Clipboard != clipboardOld) {
text := Clipboard
Clipboard := clipboardOld
}
}
PSD := “D:\project1\workfiles\” text “.psd”
DDS := “D:\project1\assets\” text “.dds”
FBX := “D:\project1\assets\” text “.fbx”
WAV := “D:\project1\sfx\” text “.wav”

Run %PSD%,,UseErrorLevel
Run %DDS%,,UseErrorLevel
Run %FBX%,,UseErrorLevel
Run %WAV%,,UseErrorLevel

  • ^j:: means, that you have to press Ctrl+J to execute the script (learn more in the official documentation)
  • The following code gets the currently selected text.
  • Then the paths are build together from static paths like “D:\project1\workfiles\” and the currently selected text in form of the text-variable.
  • After this every variable is executed (UseErrorLevel means, that no error pops up, if the file doesn’t exist)