Showing posts with label commands. Show all posts
Showing posts with label commands. Show all posts

Monday, February 3, 2014

Connecting to the Game: accessing the DDE interface with 3 lines of code. (Tutorial)




We've been studying a lot of stuff lately, most of it involving running CAOS commands against C1 and C2 games.
C3 has a convenient built-in CAOS console, and various third party tools also propose that feature for C1 and C2.

But how would you go about implementing this kind of connectivity inside your own programs?
The simplest way to connect to a running C1 or C2 game is through the DDE interface (Dynamic Data Exchange). Also it REALLY is simple even if you barely know anything about programming, so this might be worth checking out.If you never programmed anything and don't have any development tools handy, you could initiate a DDE connection even from inside an Excel macro using VBA.Also the C1 and C2 DDE interfaces being strictly identical, you'll be writing code only once, and be able to use it in both games right now, without any change.

By sending the game some basic CAOS commands and reading their results you can reproduce all of the game functionalities and then some more: reading a Norn's needs and chemicals levels in realtime, selecting Norns and Grendels, carrying them, monitoring their brains,etc...

This time I show you a very quick overview to get you started in pumping CAOS in and out the C1 and C2 games.More advanced use cases or details will come in futher posts.
 

Saturday, December 28, 2013

CAOS snippets

Learning the CAOS language can be a painful experience.

When you look for command usage examples when debugging your very first CAOS console application, there's not much you can find :
  • The "inst,dde: getb cnam,endm" every single kit, app or example uses as a demo ( it shows current creature's name )
  • Some "cheat codes" to kill creatures, give them full life... always the same ones, and never any further documentation of how they work.
  • Raw CAOS documentation, with very few information on actual syntax, importance of spaces, commas or variables...
Putting it all together can be a tricky process, especially since the early Creatures games are very sensitive to the slightest CAOS script mistake and will mercilessly crash the whole game for a single missing space.

Just so you don't tear your hair out on your early CAOS experiments, here is a list of snippets that do some basic stuff, that you can just copy and paste in your CAOS console or custom app, without wondering if you should use lowercase, uppercase, commas, spaces brackets exactly as in the documentation or not.