So I’m learning CAOS again

And as I’m learning CAOS I want to share my experiences with you. It’s only been 5 years, how hard could it possibly be? Oh-

Uhhhh.

Well, on the bright side, this means I can help guide other newbies and show them how to get started. Let’s go on this journey together. To start, I’ll be editing the Export Door. Instead of exporting them, it’s going to teleport them to the Norn Terrarium.

Keep in mind that I am running a Windows OS so that’s what my tutorials are designed for. As for the CAOS portion, you should be able to follow that regardless of your OS.

To get started, you want to download Jagent. I got my copy here, courtesy of Eem Foo’s Archive.

Next, you can use CAOS Tool or Notepad to edit the .cos file, but I’ll be using StoryTeller so that I can inject the .cos file into the game directly.

Finally, you’ll want the file we’ll be editing. Go grab yourself a copy of the Export Door by Sgeo here or here.

We’re going to start right from the very top. First, we need to figure out how to open this .agent file and get in there to make our changes. To make things easy, I like to move the .agents file into the Jagent folder so everything’s easy for me to find. Open up monk.

Once it’s open, select “Pray Source” in the top part of the screen then drag export_door.agents onto the white space available.

After just a second or so, you’ll see a new file in the directory called “export_door.agents files”. This is where the real meat and potatoes are.

Mmmm… delicious meat and potatoes.

This is exactly what we’re looking for. Next, open up Storyteller, go to the Dev Tools tab and then select “CAOS Tool 2020”.

This is where we come to the actual CAOS portion. This is what we want to edit.

Now, I’m not going to lie to you. This looks daunting, especially if you’ve never programmed before, never used CAOS before or it’s been a long while since you’ve done either. Thankfully, Export Door just happens to be a good place for us to start because it’s well commented. I won’t be going over the export door line by line or anything, that’s not what this tutorial is about. It’s about getting out feet wet, not being super nerds. Not yet.

So as I’m scrolling through the CAOS here (beautifully color coded by Storyteller) I’m getting a feel for how this script works. I know what it does. It exports creatures that use the Export door, but now I’m learning how.

I’ll let you scroll through the CAOS on your own time. Sharing all the CAOS at once isn’t going to help us any here with fixing this door. Instead, consider this an extra credit reading assignment. (In depth CAOS tutorials will come when I get comfortable with the language again).

We learn that it checks for whether each of the 3 major species is allowed to operate the door, it checks its neighbor door, it animates everything… and finally, in the last quarter of the script, we find the part where it actually exports the creature.

** export the creature!
	setv va00 pray expo "DSEX"

When I delete this section of the script, the door opens, animates and then… nothing happens. The creature is still there. Success! We got rid of the part we didn’t want.

Now all we have to do is make it… do something.

To start, I found a bit of code on the CAOS Code list on the fandom wiki and pasted it into the spot where that code used to be.

targ norn mvft x y

This isn’t quite what we want it to do, but it’s a good place to start. What this code does, is it moves the currently selected creature to a location that you can specify. For us, we want to move it to the C3 Incubator ( 585x 990y ). Let’s take a closer look at that code.

Targ norn mvft is the command and x and y are the coordinates. We already know what coordinates we need so we just need to change X and Y to what we want them to be.

targ norn mvft 585 990

Now, because I don’t really know what I’m doing, I remove “targ norn” thinking that’ll be enough to make the door work. And guess what.

It works perfectly. I saved a new .cos file as teleportdoor.cos in notepad to a new folder to keep things organized.

The final step is to compile the file into an injectable agent. To make things easy on myself, I took the export_door.agents.txt file and edited that for prayBuilder.

"en-GB"


group DSAG "IQ Test Teleport Door DS"

"Agent Animation File" "teleport.c16"
"Agent Animation Gallery" "teleport"
"Agent Animation String" "15"
"Agent Description" "This door will teleport your creatures to the Norn Terrarium Incubation area instead of exporting or taking them to the Norn Mesa.\n\nOriginal Export Door by Sgeo.\nEdits by kezune."
"Dependency 1" "teleport.c16"
"Dependency 2" "pick-ups.c16"
"Dependency 3" "useful_screen.c16"
"Dependency 4" "agent_help.c16"
"Dependency 5" "doro.wav"
"Dependency 6" "buzz.wav"
"Dependency 7" "lg_1.wav"
"Dependency 8" "tele.wav"
"Dependency 9" "cmc3.wav"
"Remove script" "ject \"doors.cos\" 2"

"Script Count" 1
"Script 1" @ "teleportdoor.cos"

"Agent Sprite First Image" 0
"Agent Type" 0
"Dependency Category 1" 2
"Dependency Category 2" 2
"Dependency Category 3" 2
"Dependency Category 4" 2
"Dependency Category 5" 1
"Dependency Category 6" 1
"Dependency Category 7" 1
"Dependency Category 8" 1
"Dependency Category 9" 1
"Dependency Count" 9

All I changed were the Name of the agent and the Agent Description. Lastly, I changed the .cos file that the agent would be built off of to “teleportdoor.cos”. I saved the new file as teleportdoor.txt in my new folder.

All that was left was to drop the .txt onto PrayBuilder…

Drop the resulting .agents file into My Agents folder and…

TADA~

I have a working agent that changes the door outside of Norn Meso into a teleporter that sends creatures to the Norn Terrarium Incubator. It’s ugly, and it’s fudged together and I needed a lot of help, but the most important thing is that we’ve got a working product on our hands. It’s ugly and I love it. Let’s see it in action.

Here’s a copy of the agents, cos file and txt file so you can pick everything apart and learn for yourself. Happy experimenting!

A FEW NOTES!

I actually had a TON of trouble getting the agent to compile at first. I was able to inject the .cos file from Storyteller into the game, but I could not use Storyteller to make edits. I had to edit the file in notepad. After I did that, I had no problems with the injection.

I also had to use a ton of resources to find the information I needed to put this tutorial together.

To get the C3 CAOS Language guide, follow this guide.

To figure out where to even start, I had to use this wiki article.

And for additional support, I got help from Eem Foo’s Archive discord. Thank you!

Leave a Reply

Your email address will not be published.