NLPI Directory

Contents


Overview

NLPI consists essentially of two parts:


The NLPIProduct Zope ZClass

This is an ordinary Zope ZClass Product which has the advantage that if you change its definition you will immediately see the results in your NLPI project instances when you reload them in your web browser.

The ZClass hierarchy

NLPIClass
This is the main ZClass which defines most of the DTML-methods. It inherits from all Zope base classes and from NLPIaux.

Subclasses

Instances of subclasses defined inside a ZClass can only be added inside an instance of the main ZClass (this is defined by Zope).
Znlpi_infSrcClass
This is the ZClass for views of source files. It defines almost nothing, but instances of it are added for every inform source during scanning them. If they are found in a file system folder then an ordinary Zope folder is created and they are placed inside it.
Znlpi_preferencesClass
This is the ZClass for the "Inform Options" view. For every NLPIClass instance an instance of this is added. It defines DTML-methods for editing properties of the NLPIClass itself ("Global Preferences") and of the instance of that class from where it was called (all other tabs).
If you would like to have the "nonsense instance" of this removed from your inform source hierarchy: so do I. But I found no way to do so.

Changing Management Tabs

These are the tabs which you know as "Inform Console", "Inform Options" and so on. Especially in instances of the main NLPIClass you see lots of Zope management tabs which you don't need. Most of them belong to the ZCatalog from which NLPI inherits, but because I've done nothing further it finds only inform source files.

If you want to change the order or remove these tabs go to the NLPI ZClass you want to change and click on the "Views" tab. You can delete them by selecting them and then pressing "Delete". To change the order select one and press "First". Repeat this until they are in the order you want.

Changing the "GUI" of NLPI

This is very easy because it consists of DTML-methods which are essentially HTML files defining ordinary cgi-forms and some special DTML-code. If you don't know DTML, you do best letting any <dtml-*> and </dtml-*> tags where they are. Make sure that you don't disrupt the cgi-form logic!

By the way: I don't have the impression that the text edit fields you see when clicking on these methods are really ment to edit DTML code within them. You probably do best first to "Select All" by Ctrl+A and then to copy&paste its content into your text editor, altering and saving it and then copy&paste it back to the text edit field.

Feel free to publish your ergomonic and graphically nice redefinitions of the following DTML-methods which make out the user interface! (The other DTML-methods are just functions whitout any html output.)
The problem with that is that you probably do best to publish them (complicated, I know) as individual DTML files so that people can import them as they want. Because the license of anything here is GPL-2, you can also distribute a whole new NLPIProduct, but then it gets really complicated to integrate NLPIProduct updates published by somebody else. (Me, perhaps ;-)

The "GUI" DTML methods

/Control_Panel/Products/NLPIProduct/NLPIClass_addForm
Form which is showed when you add a new NLPI instance.

/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_console
Defines both the "detailed" and "short" inform console in the same document.
/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_icl_process
The screen you see after pressing the "Process ICL file" button.
/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_inf_obj
The screen you see after pressing the "Extract Inform Objects" button.
/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_inf_out
The screen you see after pressing the "Mirror ICL and sources" button.
/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_inf_out_compile
The screen you see after pressing the "Compile sources" button.
/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_write_blorb
The screen you see after pressing the "Create blorb file" button.
/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_inf_out_compile
The screen you see after pressing the "Compile sources" button.
/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_inf_out_play
The screen you see after pressing the "Play the game" button.

/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_pictures_addForm
This is what you see when you press the "Inform Pictures" tab or when you go to a Znlpi_infSrcClass instance. It basically gives you a form to add or delete pictures and creates the selection list named "Available Rooms".
/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_pictures_add
This is part of the above form and prints out these rooms where you have added some pictures already whith a checkbox on the left.

/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_preferencesClass/Znlpi_prefsGlobal
This is the "Global Preferences" input form in the "Inform Options" view of your project. It is not too attractive to make any changes because you define mostly file paths here.
/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_preferencesClass/Znlpi_prefsLocal
Here the "Local Preferences" for every project of yours are set. Because these are used more often, it may make sense to alter the order of input fields for your special needs or to create a more sophisticated table.
/Control_Panel/Products/NLPIProduct/NLPIClass/Znlpi_preferencesClass/Znlpi_prefsBlorb
As above this is the "Blorb Settings" dialog.

Acquisition of Properties

Zope provides a mechanism in parallel to Python class inheritance called "Acquisition". This propagates properties of a class or an instance down the Zope folder/object hierarchy. Subobjects can override properties of their classes.

The main instance to store data is the NLPIClass instance. The "Inform Options" are defined in the Znlpi_preferencesClass sub-ZClass, but they work on the NLPIClass instance. Zope defines items called "Property Sheets" to collect data. NLPI uses three of them. You can see them by going to the NLPIClass and then pressing the "Property Sheets" tab. Here they are:

Znlpi_propGlobal
As the name says, these are the global properties. Znlpi_prefsGlobal always works directly on the class definition, so if you change global properties and export the whole NLPIProduct, you will distribute your personal settings. An example of my personal settings are the path to my favourite text editor.
Znlpi_propLocal
Znlpi_prefsLocal works always on the NLPIClass instance which inherits these properties. The property values defined here are just default values which will definitively been overridden by any changes you make, so changing the default values will only have effect if you never changed any local property and for new NLPIClass instances.
Znlpi_propBlorb
These are the properties used for creating Blorb files. They work the same way as the ones of the Znlpi_propLocal Property Sheet above.

The NLPIaux Python Class

This gets automatically installed when you place it where it should be and then start up Zope under /Control_Panel/Products/NLPIaux.

Because this is a is a Python mix-in class you can't make any changes from Zope directly; you'll have to edit the Python source files themselves. To see any changes, Zope must be shut down and then restarted. This is annoying and was one of the reasons why the Zope people have invented ZClasses.

Furthermore NLPI is a compilcated product and uses a lot of third party software. For that reason I will list here all directories which make up NLPIaux, not only the python files. The file tree looks as follows (starting with the "NLPIaux" folder inside the Products folder of your Zope installation):

NLPIaux\var\
NLPI creates temporary directories in this folder to mirror your inform source code file tree for the compiler to work on it. Your games that you produce are created here.

NLPIaux\lib\
In this directory all the soures and executables are found.
NLPIaux\NLPIaux.py
Here the interface between Zope and NLPI Python code is declared. Any function which is called from DTML can be found here. NLPIaux.py declares the NLPIaux Python class which inherits from all python classes defined in NLPIaux\lib\python\. This NLPIaux class itself is inherited by the NLPIProduct Z-Class in the form of a mix-in class.

NLPIaux\lib\bin\
Any binary executables are stored here, the most important are the different inform compilers and their corresponding interpreters.

NLPIaux\lib\perl\
This is the directory for perl helper scripts.
NLPIaux\lib\perl\perlBlorb.pl
This script was written by Graham Nelson and is - slightly modified - used for creating Blorb files.

NLPIaux\lib\inform\
This is the directory for inform code libraries which get included into your inform sources.
NLPIaux\lib\inform\libg610\
This is the normal inform bi-platform library. You can add any library here, especially for translations of inform into other languages. All you have to do is to enter its folder name into the "Inform library" field in the "Local Preferences" dialog of your NLPI project.
NLPIaux\lib\inform\infglk.h
"an Inform library to allow easy access to glk functions under glulx" it says about itself.
NLPIaux\lib\inform\sensory_lib.h
"This is the library of Andrew Plotkins sensory example game." I let it say about itself.

NLPIaux\lib\python\
Here are the Python classes from which NLPIaux inherits.
NLPIaux\lib\python\Znlpi_utilities.py
Utility functions used by several Python classes.
NLPIaux\lib\python\Znlpi_iclProcess.py
This defines the class Znlpi_iclProcess which reads information from the inform ICL file you provide on adding a NLPI instance. The properties it adds to it are documented in the script itself.
NLPIaux\lib\python\Znlpi_infObj.py
This huge class Znlpi_infObj reads your inform files using Python Perl-style regular expressions in a server object instance of the helper class inform_process_class. It creates (among other information) a list of infobj instances which store the inform object properties of all the objects read. It's also this class which creates the inform source tree inside the NLPI instance using the function Znlpi_add_infSrcTree.
NLPIaux\lib\python\Znlpi_infOut.py
This is a bit chaotical because here is anything defined which has to do with output of NLPI. It mirrors your source tree in NLPI's \var\ directory, it calls compilers and interpreters and the text editor.
NLPIaux\lib\python\Znlpi_infSrcModify.py
Well, Znlpi_infOut.py would be useless if the sources could not be modified, e.g. by adding picture information to rooms. Znlpi_infSrcModify is the class for the job.
NLPIaux\lib\python\Znlpi_blorb.py
This class Znlpi_blorb is used to handle blorb files. For perlBlorb it creates an appropriate blurb file and calls perlBlorb. For iblorb it works analoguous.
NLPIaux\lib\python\Znlpi_pictures.py
The class Znlpi_pictures stores the information you add by adding pictures in the "Inform pictures" view of your NLPIProject instance.

Copyright © by Toni Arnold, Zürich

Distributed under the GNU GPL-2

Last update on Oktober 24, 2000