A CAOS Lesson and Preview of the Updated Cheese

CAOS and Albian CheeseWith a few adjustments and a whole lot of CAOS work, I managed to nearly finish up one of two food updates I posted about. The updated cheese for Creatures 1 is coming along quite nicely! Not that it’s all that exciting of an object, but I’ll leave the unveiling of the specific changes for a later time. This was actually a more in-depth project than I originally imagined, which made it all the more rewarding when I figured some things out! CAOS can be tricky, yet I’m learning that it’s almost like a puzzle in itself… And there isn’t just one correct way to accomplish something! As a combination of a CAOS lesson and a preview of what this cheese can do, let’s take a look at one of the updated scripts!

Annotating the Updated Cheese’s Activate 1 Script (2 6 1 1)

This corresponds with the class number for the cheese (2 6 1), and is for the activate 1 script (script number 1).

CAOS Code Explanation
scrp 2 6 1 1 Some programs begin with this line, while others name the file by it. This simply creates a new script for 2 6 1 (cheese) for script number 1 (activate 1). Everything will happen only when a Creature pushes (eats) the cheese.
stim writ from 10 255 0 0 34 30 35 150 57 150 0 0 This is one of those really long lines of CAOS, but take it one step at a time to make it less intimidating! The first part, stim writ from, means that a stimulus will be emitted onto the Creature who is pushing (eating) the cheese. Basically, this is the target, and no one else will experience this benefit. The next string, 10 255 0 0 is beyond the scope of this discussion. Leave that for another day! Then we come to the most important part: 34 30 35 150 57 150 0 0. This looks like a long string of numbers, yet it defines the amounts of various chemicals to be emitted. The first set (34 30) translates to 30 units of NFP decrease. The next set (35 150) corresponds to 150 units of hunger decrease. The third set (57 150) is equivalent to 150 units of starch. The final set (0 0) is simply undefined: Up to four chemicals can be defined, but the cheese only requires three!
snde chwp This means that the sound file chwp.wav will play, giving off a resounding chomp. Basically, this is the typical noise of a Norn or Grendel eating.
setv obv0 pose In this CAOS code, a variable is set or defined with the setv command. An object variable, given as obv0, will be set to the object’s current pose. This is quite important because the following commands depend entirely on what the cheese currently looks like, or what pose it is using.
doif obv0 eq 4 Ah, a wonderful doif statement! This means that the following part of the script will happen only if the defined condition(s) are true. In this case, it is checking to see if obv0 is exactly equal (eq) to 4.
pose 6 This sets the cheese’s pose to 6. Putting some of this together, this means that after a piece of cheese in pose 4 is eaten, it will change to pose 6.
setv actv 0 This bit of CAOS is vital for various types of objects. In particular, food items that last for more than one bite need this. Again, this is setting a variable (setv) equivalent to a value. In this case, actv means the active flag, and a value of 0 means that it is inactive. In simpler terms, an object is active when something has been done to it. When a piece of cheese is eaten, it is given an active flag. However, it can not go through the same action again until it is marked as inactive with this code. Hint: The updated cheese now lasts longer!
endi This marks the end of the current doif statement, and must always be used.
doif … endi There is an almost identical doif-endi pair present, which only has different pose numbers for the cheese. This part of the script states that after a piece of cheese in pose 5 is eaten, it will change to pose 7. Almost exactly like the above codes!
doif obv0 gt 5 Here we have another doif statement. This is checking to see if obv0 is greater than (gt) 5. Going back through our previous statements, this is checking to see if the cheese’s current pose is greater than 5.
kill ownr The kill command is used to destroy something. In this case, ownr means the owner of the script, which would equate to the currently active piece of cheese. It will be destroyed, or removed, from the world. Why? Because it’s been eaten up and won’t be sticking around! An example of a food object that doesn’t use this piece of code is the honey, because each honeypot is refilled and replenished. A piece of cheese that lasts forever sounds biologically dangerous!
endi Here is the end of the current doif statement. Never forget this piece of CAOS!
endm This little piece of code is small, but it must always be present to mark the end of a script. Otherwise, be prepared for a catastrophe!

Finalizing the C1 Cheese UpdatesAny thoughts on this CAOS? I imagine that this will be an important food object to beta test, although I didn’t have any volunteers for the updated C1 carrot variant. It seems to be working well enough: I haven’t received any reports of problems! I suppose one of the last remaining “holes” in the cheese is where to actually put all of it. The kitchen area seems like a good location, yet I would appreciate feedback! This image shows what the current test version does upon injection. I will eventually be working on an updated refrigerator COB to keep a supply of cheese on hand. More importantly, The Shee’s Lost Knowledge has an important article about the doctor’s page that I will need to read through to create a compatible item. Lots to learn!

« Previous Post | Next Post »