[Originally written September 4 2020]
Having the day off work, I decided it was as good a day as any to jump into the COBbling pool. I fully expect to break things in my reckless charge into mucking around in the game’s scripts, so instead of using my main world, I decided to insulate myself and experiment within the safety of a VM. I tossed Creatures 1 into Ye Olde XP Box, imported the female Purple Mountain Norn that comes with the game, and named her Betty – Betty the Beta Tester. I then set up my camera points for easy navigation, and injected Grendel Friendly and the Grendel Button, and Jessica’s carrots. After teaching Betty her verbs, and the words “food” and “hand” and teaching her to eat, I briefly exported her to make a backup copy of her file. This way if things go horribly wrong, which I expect them to, I’ll be able to simply reimport her and not have to deal with re-teaching her. I plan to do the same with the Grendel when he shows up.This was a rather speedy world setup since I just want a bare-bones playground for testing CAOS and COBs, so I imported Betty again after copying her file, then exited the game to set up the editor. I first tried CrEd32, but it gave me a bunch of registry errors, and I didn’t feel like mucking around in the registry if I didn’t have to. So I spun up BOBCOB instead. This one appeared to work, but I immediately ran into some issues where autoscript and other features were mysteriously grayed out – I soon realized that it apparently couldn’t find the game. I suspect this is because the Albian Years are in a different place than older tools expect. Well, whatever; it’s a VM, so I’m throwing all caution to the wind. Worst comes to worst, I’ve copied Betty and the C1 installer to a USB so I can spin a whole new VM up if needed. So I ended up mucking around in the registry anyway. A few hacks later and it was working just fine – anything that’s under HKEY_LOCAL_MACHINE\SOFTWARE\Gameware Development\Creatures 1\1.0\ needs to be copied into an identical entry in HKEY_LOCAL_MACHINE\SOFTWARE\Millennium Interactive\Creatures\1.0\ and you’re good to go! With that I was able to extract the default carrot scripts. Time to dive in!
There are five scripts associated with the carrot. All begin with “scrp 2 6 3 #” where # is some number. 2 6 3 is the designation of the carrot itself, and the number seems to indicate what action the script is for.
This right here is the push script! Thankfully, I don’t have to decipher it all by myself, thanks to Jessica’s helpful post. Even without the post, a good chunk of this is quite familiar to me as a programmer, such as the if/endif block (doif/endi in CAOS apparently).I likely could have figured out the pose and snde (sprite frame and sound) bits myself without much trouble using the official guide (which she also helpfully linked), but I am grateful for the explanation of that fourth statement!
I wasn’t expecting to get ramped up this quickly but I already feel pretty confident. I hope Jessica doesn’t mind, but I’m going to start by cracking open her improved carrots; comparing them to the originals should give me a pretty good idea of how the sorts of changes I need to make are implemented.
It looks like she’s done away with the if statement, which makes sense given that her carrots are invisible until they’re edible. She’s left the stimulus portion of the stim command alone, but altered some of the chemicals. It still plays a sound, and now it goes to pose 8 (Jessica’s custom stub) rather than reverting to a seedling.Then it performs the rest of the script instantaneously. That 7th command, new: simp ucrr 9 0 500 0, creates a new object using the image file ucrr, which contains 9 images, and it starts on image 0. It exists on plane 500, and does not create a cloned image gallery (whatever that is).
The next line sets that new object to class 33948416. Having fixed my registry issues I can now use CrEd32’s classifier calculator, and indeed this is the value for the carrot. The next line sets its attributes to 80: invisible (16) + wallbound (64). After that, is the behavior set. The first number is its behavior to the mouse and the second is its behavior to creatures. The 0 is “no effect” and the 1 means it can be pushed by creatures. Of course, that shouldn’t matter because it is invisible to them.
The next two lines are quite obvious to me without even looking them up – they’re generating random numbers between two endpoint numbers (presumably the bounds of the garden) and saving them into variables! Then the mvto line uses those variables as coordinates to place the new carrot in the garden. Finally, it sets the timer for 200 ticks (for the growing script) and kills the original carrot item. Makes sense to me.
The only other part I’d like to take a good look at is the injection script. The second, third, and fourth lines go through and destroy each existing carrot. The reps/repe lines form a pair that is essentially a for loop: everything between reps and repe gets repeated, in this case 10 times.The rest of it should look familiar, since it’s the “make new carrot” code also featured in the push script. The only difference is that the tick value is much lower – the carrots grow much faster when you inject them for the first time than they do when regrowing. Since the code is in the reps 10 block, it produces 10 carrots.
That was quite insightful… I think I’m ready to do my own COBbling!
No comments:
Post a Comment