Archive for May, 2009

Programmer’s Notepad: Using the Built in Logger

Tuesday, May 12th, 2009

Many times when scripting a game, the core game engine will output errors,warnings, and other general information to some log file. When scripting, it is usually very helpful to constantly check the log file to ensure that your scripts are working in a proper manner. Programmer’s Notepad gives us the ability to configure its Output panel to pipe in info from a system command.

Some of you may be familiar with the unix command “tail”. Tail allows someone to see that last 10 lines or so of a file. It is a perfect little program for us to use to let us see the log being updated. Most Unix and Linux distros come with the tail command by default. For Windows, you will need to surf the net for a Windows based tail command. Another option for Windows is to download the Cygwin package. Cygwin is a linux simulator for windows and is generally a good idea to have installed for windows developers. You can download it at http://www.cygwin.com/.

Assuming you have installed tail, fire open Programmer’s Notepad. Goto Tools->Options.

Next we need to add a new Ouput program. Select the “Tools” category in the left hand pane.

Now we will tell Programmer’s Notepad, with respect to the logger, what command to execute along with its parameters.

The “Log Preview” is the name of our new tool. You can call it anything you like as it will appear in the Tools menu when we are done. The “-f” tails “Tail” to follow or show us the latest additions to our log file. The “log.txt” is the file we want the logger to pipe out. Click “OK” to proceed.

Now it is time to enjoy the logger. Again, click on “Tools” and then you should see your “Log Preview” option. Select the “Log Preview” option, or whatever you called it when we made the tool, and then an output window should pop up to your delight. From now you can trace log messages in real time while writing your scripts making your life easier and more enjoyable!

Did you find this article useful?

View Results

Loading ... Loading ...

Programmer’s Notepad: Associate a file extension with a syntax scheme

Monday, May 11th, 2009

As a game programmer,  somtimes I have to resort to scripting in Lua or XML.  In those cases, many developers scour the internet in search for an IDE that will be sufficient for their needs.  I perfer to use a free generic windows IDE called “Programmer’s Notepad”.  http://www.pnotepad.org/  It seems to be everything I want in an IDE and more.

There are several reasons why I like Programmer’s Notepad.   For starters,  the UI is very intuitive and easy to use unlike other IDE’s out there.  Secondly,  it has an easy to use output system so that I can tail log files and stream in their output.  Thirdly, Programmer’s Notepad has syntax highlighting support for a vast variety of programming languages.  Fourthly,  I can export my syntax highlighted code as an html or rtf document.  Finally,  Programmer’s Notepad is extendible and configurable via scripts.

Although there are many benefits to using Programmer’s Notepad,  there are a few tasks which could be easier to do.  For example,  I use Lua quite frequently to script gameplay.  I would like to just open a lua file and have Programmer’s Notepad automatiaclly apply the Lua Syntax Highlighting Scheme to my lua document.  

In this article,  I plan to show you how to configure Programmer’s Notepad to apply a Lua scheme to a specific .lua extension.

First open up your Programmer’s Notepad directory.  For me it would be “ C:\Program Files (x86)\Programmer’s Notepad\”.  From there open up the “schemes” directory.  In the “schemes” directory,  you should find a file called “extmap.dat”.  Open that file up in a text editor, preferrably Programmer’s Notepad.

Within the file,  you should see a general pattern file so,

.asm=asm
.asp=Web
.aut=properties
.bas=vb
.bat=batch
.bsh=bash
.build=xml
.c=cpp
.cgi=perl

As you can probably see,  the syntax is 

extension=scheme

So simply add a 

.lua=lua

That’s it!  Now you are done!  You should edit the extmap.dat file anytime you want to apply a scheme to a certain file type.  Well that’s all for now.  In my next Programmer’s Notepad article,  I will teach you how to take advantage of their logger system.

Did you find this article useful?

View Results

Loading ... Loading ...