Logic Editor

The logic editor allows you to compile and decompile logic resources. To open an existing logic, double-click on it in the resources window, or to create a new one select 'Logic editor' from the 'Tools' menu or the toolbar (you will be prompted for the logic number when you save or compile it).

It is designed to be easier to use than its DOS counterparts in that you can save your source code, compile your logic, add it to the game and run the game all with the press of one key, eliminating the several steps and switching between applications previously required. It will also hilight any errors in the source code it encounters when compiling, so you can find them easily.

Previously, the syntax used for programming AGI logics has varied very slightly between compilers and has not been properly documented. Myself and other AGI developers have now decided on a proper syntax which will be supported by all logic compilers/decompilers. This syntax is documented in AGI specs. AGI Studio fully supports the syntax, although at the time of writing the logic compilers MATS and AGIC do not completely, although they will probably be fixed up soon.

Editing

When editing a logic, you edit the source code with a text editor (in this case the logic editor) and then compile it, as with most other programming languages. When you compile the logic in AGI Studio, it is automatically added to the game. The source code is saved in a text file in the "src" subdirectory of whatever game you are editing. The name of the file is "LogicX.txt" where X is the number of the logic. This file is saved whenever you compile the logic.

If you double-click on a logic in the resources window, the editor will be brought up. If the "LogicX.txt" file exists in the "src" directory, this will be loaded. Otherwise it will decompile the resource that is already in the game.

Compiling

To compile a logic, simply select compile from the file menu or press F9. Pressing F10 does the same thing except it runs the game after the logic has compiled successfully. Whenever you compile the logic, the source code and any open text files that are included with the #include command are saved.

This is basically all you need to know about AGI Studio's logic editor. You will need to know how to program in the language though. This can best be done by looking at the code of existing games and reading the logic help included with AGI Studio.

Back to Contents