Creatures 2 has an OLE interface which provides easier access to Creatures than the previous DDE interface from some programming languages. By implementing portions of an OLE interface you can also create Kits that interface with Creatures in the same manner as the standard Creatures kits like the Science kit, etc.
I intend to explore some of what can be done with the OLE interface in C++ and Visual Basic and provide an example kit but in the meantime I've got a quick description of the OLE interface and some sample code. Thanks to Ben Campbell for sending me details on the Creatures 2 OLE interface.
C++ OLE Code (Version 1.0 - 35KB
- 5/11/98)
This Visual C++ V5.0 example program has a single dialog box with a button on
it. Pressing the button will get the name of the currently selected norn from
Creatures 2 using the OLE interface. It does this by executing CAOS code. It
provides a simple example of using the 'FireCommand' method. Included in this
is a type library which describes the SFC interface and a Class Wizard generated
wrapper allowing you to call the methods.
If you are not using Visual C++ you should still be able to use the included type library with any other C++ development environment and follow a similar method to create the OLE objects.
As an example of using the OLE objects, the following is the code that retrieves and displays the Creatures name:
ICreaturesSFC sfc;
BSTR name = 0;
sfc.CreateDispatch("SFC2.OLE");
sfc.FireCommand(1, "inst,dde: getb cnam,endm", &name);
MessageBox(CString(name));
SysFreeString(name);
More examples will follow including, hopefully, an example of making a kit. The OLE interface should also make things easier when programming in other languages like Visual Basic.