I’ve been somewhat off Oolite work recently. Rather than procrastinate or go off and do something completely different, I’ve been working on something peripheral: the Mac-only debug OXP.
In 1.69, Debug Menu.oxp
works as an enabler – its presence, and the support files it contains, activates debugging code in Oolite. In the next release, it will contain the debug code itself, working like a plug-in. This means I can add loads of stuff to it without complicating the Oolite application much.
I’ve now added to items of stuff. The first is F-Script
. This is not yet another OXP scripting language; rather, it’s a dynamic scripting language which works directly with Objective-C objects. This makes it a very powerful (and very dangerous) debugging tool.
Bold lines prefixed with > are commands. In this example all the other lines are responses to the commands, but in general use warnings, errors and long messages pertaining to other scripts running in the game will also appear in the console.
The first three commands in the screen shot are your basic using-an-interactive-shell-as-a-calculator example. The first one uses invalid syntax to generate a warning (although the warning is somewhat unhelpful since it always points at an eval
of the macro, that is, the code it’s translated to: dumpObjectLong(eval("player.position"))
. This is followed by the results of running the dumpObjectLong
function. The next command, :showM dl
, shows the definition of the dl
macro. The macro could have been defined using the macro :setM dl dumpObjectLong(eval(PARAM))
The sixth command simply demonstrates the ability to enter multi-line commands. This can be done by pressing option-return (this works in most Cocoa text fields, incidentally) or by pasting multiple lines.
Oh, those strange people who are addicted to white-on-black consoles will be relieved to know that the colours can be customized in a plist. ;-)
On matter of Mac-onliness:
Mac-only features obviously suck, but making these features cross-platform would require a great deal of extra work. It would either require me to implement a relatively complex UI system within Oolite, or to write a separate application to communicate with a debugger object within Oolite. The latter might end up being a good idea for the Mac side anyway, but porting such an application would require more active Linux and Windows developers with a greater familiarity with GNUstep. As it is, the debug OXP consists of tools that are useful to me in working on Oolite, which also happen to be useful for developing OXPs.