Thursday, May 28, 2015

Finding out what is what in Creatures 1 & 2

One of the most frustrating aspects of trying to understand C1 or C2 cobs might just be the first step you need to take.

Say you are looking at an object, and wonder "What is this object's classifier so I can look up it's scripts ?"
Or the other way round ? What if you find an interesting script and wonder which object it governs?

I've found no easy way so far to answer those questions, and got tired pretty quick of trying to manually look up my targets each time.
 
Cross referencing the various online lists of classifiers didn't cut it either: many of them are at best incomplete when not downright wrong.And they are limited to the standard game items, with obviously no way to reference every single COB ever made.

Things don't have to be this way.
Read through this very quick article with me, and grab a tool that makes the job as simple as hovering the hand over an object to get the needed information.





Identifying things from a classifier

As I've already mentioned in previous articles , one CAOS command I like to use is a simple command to quickly identify an object by it's classifier is :

rtar X Y Z,sys: camt,sys: edit posl post posr posb 







This is useful when you want to know what object a classifier corresponds to, but let's face it, the ability to obtain a given object's classifier by sight would be even more useful.

Identifying  a classifier from an object

C2 offers the "ETCH,NEXT" command to help enumerate through all objects currently touching the owner of the script.
But to make our solution C1 compatible, we will need to only use commands present in both games.

We will be using the following script to achieve the expected effect:


 enum 0 0 0,
    doif touc targ pntr gt 0,
        doif targ ne pntr,
            sys: edit posl post posr posb,
            dde: putv fmly,
            dde: putv gnus,
            dde: putv spcs,
            stop,
        endi,
    endi,
next



What does it do ?


 enum 0 0 0, # Iterate through all objects in the world
    doif touc targ pntr gt 0,
# Only enter this bloc if current object in loop does touch the mouse pointer
        doif targ ne pntr, 
# Only enter this bloc if current object IS NOT the pointer itself.Because technically, yes, the pointer does touch itself.

            sys: edit posl post posr posb, 
# Draw the edit box using objects edges

            dde: putv fmly,
# Print out objects Family
            dde: putv gnus,
# Print out objects Genus
            dde: putv spcs,
# Print out objects Specie
            stop,
# exit the loop once we found the first object, otherwise we would end up only circling the last object in the list of objects touching the pointer.
        endi,
    endi,
next



This command although slightly sub optimal is compatible with C1 & C2, and allows you to know at a glance the classifier of the object under the cursor.

Contrary to the preceding command, having to type this script in a CAOS console would make aiming the cursor highly impractical.
One could technically implement a CAOS only solution, but that would not be worth the trouble.

As we've already seen, sending CAOS commands to C1 and C2 games is easy from your favorite programming languages.
Then, it's just a matter of sticking this piece of code into a timer loop to get a pretty useful tool.








Initially, such a tool was part of the Creatures Kontrol Center app I was working on, but due to delayed development on it, and the immediate usefulness of a classifier identifier tool, I decided I would publish a small standalone version of it right now.

You can grab the tool here.( You will need to have the Visual Basic 6 runtime files for it to work, so grab those if you run into problems when running the exe.)




2 comments:

  1. As always, this is an awesome tool! I haven't downloaded it yet, although I'm sure it will be super useful. I really need to go back through a lot of your earlier posts, because some stuff that didn't make sense to me before is a lot more applicable, particularly since I understand some of the basics behind CAOS. Keep doing all of the wonderful stuff for Creatures that you do! I'm always excited to see what other subject you're going to talk about, or what new tool you've come up with!

    ReplyDelete
  2. Thanks !

    Well, I mostly make the tools I find are lacking to answer my questions or to do stuff in a more practical way.

    It's nice to see some of them being useful to others.
    Most of the tools I'm only publishing now were planned for since my very first post.Many aren't even mentioned yet.
    That's how much stuff there is to understand,publish,explore or create !
    Most of the articles written so far were the documentation for basic building blocs.
    The real tools and concepts that take advantage of those basics are still to come.

    You've opened a whole new world of things to explore by diving into CAOS.
    I hope you have fun along the way !

    ReplyDelete