Welcome to the Creatures Wiki! Log in and join the community.

A simple food cob

From Creatures Wiki
Revision as of 23:59, 25 January 2020 by ScoobyGambit (talk | contribs) (Helen's Cob Tutorials Part 1)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction[edit]

For our first project, lets write a very simple food cob. We’ll make a cheese alternative. This will be easy to make, as it doesn’t need it’s own new picture file. To create the installation script type out the in bold. All other text is a description of what the syntax does.

Installation script[edit]

Let’s start off with the installation script. Type the below into BoBCoB

inst
new: simp cmac 2 25 1000 0
setv cls2 2 6 31508
setv attr 195
bhvr 0 64
slim
edit
endm

Here’s what all that stuff does:

inst

This tells Creatures that a new object is being added. It creates the object straight away without any interruptions

new: simp cmac 2 25 1000 0

Brings the picture of the cheese into Albia. New: tells creatures that it is a new cheese object. Simp tells creatures that it is a simple object (has only one clickable part). Cmac is the name of where the cheese picture is installed. The numbers at the end tell creatures the number of pictures in the cmac file and the one that the cheese starts on, but don’t worry too much, I’ll explain these in the next tutorial

setv cls2 2 6 31508

This sets the class number of the cheese objects. This is an identifying number so it can not be the same as any other object. Setv means set the variable. Cls2 means creatures 2 class number. 2 is the family and tells creatures that this is a simple cob. 6 is the genus and tells creatures that this is a food cob. 31508 is the number that tells this cheese version from all the other cheese versions. It is called the species number. The species number can be anywhere between 20,000 and 65,000. It’s best to stake out a claim though on the creatures newsgroup so you do not overwrite anyone else’s cobs. I’ll use species numbers in my range for these tutorials (my range is 31500 - 32000) so please don’t decide to use numbers around this area. :)

setv attr 195

This sets the variable attributes to 195. This means the object falls, the object can be picked up by Norns and creatures, the object can be activated by creatures and the object is subject to room boundaries and the like.

bhvr 0 64

This command sets the behaviour of the cheese. It tells the game that the cheese can be eaten by the Norn, but can not be activated by the hand.

slim

Sets the limits of the objects (don’t ask, I don’t really understand it myself)

edit

makes the object inject on the hand

endm

endm means end macro. This means you must put it at the end of every script to tell Creatures that this is the end of the script.

Wow! You just wrote your first installation script! Feel special? :)

The Eat script[edit]

Now lets write a script that makes a chewing noise, makes the Norn less hungry and makes the cheese disappear after it’s eaten.

scrp 2 6 31508 12
snde chwp
stim writ from 0 255 0 0 37 150 71 150 73 150 0 0
kill ownr
endm
scrp 2 6 31508 12

Scrp tells creatures that this is a new script. All scripts except the installation and removal must start with this. Recognise 2 6 31508? This is the number we set with the cls2 in the installation script. We use it at the beginning of all the scripts for that object in this scrp command. The last number of this command tells the game what sort of action calls this script. They range from one through to 255. Number 12 tells creatures this is an eat script

snde chwp

This tells Creatures to play the sound chwp from the /creatures/sounds/ directory. All sound names must be four characters long. This particular sound is the sound of a Norn chewing

stim writ from 0 255 0 0 37 150 71 150 73 150 0 0

Ah! This is the most important part of the script. This is the part that tells creatures what chemicals to inject into the Norns when the script is activated. Each stim writ command has the following formula:

stim writ from number number 0 0 chemical amount chemical amount chemical amount chemical amount

There must be four chemicals specified in each stim writ command. To use three or less make the number of chemicals up to four by using 0 0 for chemical and amount. (ie. stim writ from 0 255 0 0 37 150 0 0 0 0 0 0 would make creatures inject 150 units of hunger decrease and nothing else) To have more than four chemicals specified add another stim writ command in under that one.

This stim writ command injects 150 units of hunger decrease, 150 units of Fatty Acid and 150 units of starch. Remember, don’t make your cob a cure all. If it’s a food, don’t make it reduce boredom, sleepiness, tiredness, anger, loneliness, hotness, coldness etc as well. A cob reducing everything will confuse a Norn. A food cob reducing hunger and adding nutrients will confirm a Norn’s idea that you eat food to decrease hunger. Also, never put reward or punishment in a stim writ command. These products are produced after the hunger is decreased. Too much of them in the Norn’s body will stuff things up so if you inject it with the stim writ command as well as the Norn getting it as a result of decreasing hunger it will become very confused and be more likely to bonk into walls.

kill ownr

This will delete this instance of the object from Albia now that it has been eaten by the Norn

endm

The end of script command again

Well, that wasn’t so bad was it? :) There’s the eat script for your first cob done. Now we only need to create a remover script so that people using this cob can remove it if (heaven forbid) they tire of it.

Remover script[edit]

It’s really important you include a remover script with all your cobs (it’s extremely bad manners not to). This is a simple (painless) script of only about six lines.

inst
enum 2 6 31508
kill targ
next
scrx 2 6 31508 12
endm
inst

This tells creatures that this is an installation or removal cob. :) It’s a bit like windows 95 hiding the shut down option under the start button as it is the command that tells creatures that this is an installation script in the installation script. This is kept in the removal script as a legacy of C1 as removal scripts in C1 were installation scripts which told Creatures to remove an object. Confused? Don’t worry. Just remember you need this command at the beginning of your removal script

enum 2 6 31508

Enum means find. 2 6 31508 is the number of this cob. So this command tells Creatures to find an instance of this cob

kill targ

Delete this instance of the cob in Albia

next

Find the next instance and repeat the kill ownr until there are no more cobs of this number in Albia

scrx 2 6 31508 12

scrx is a lot like scrp. That’s because scrx means delete the script of the following number (instead of telling creatures a script is about to be installed as scrp does). The number following it is the cob’s special identifying number and the number of the script that is installed with this cob (the eat script remember?)

endm

Yet again the faithful “I’m finished” command

Conclusion[edit]

Well congratulations! You just made your first cob! You should be very proud! Your first cob is always one of the hardest as there is so much new stuff to learn for it. :) Try injecting it into Albia now using the “inject agent” command in BoBCoB under the tools menu.