Making a Vendor for C3

A vendor can take many forms, and can produce anything that you like! Using the knowledge from the previous two tutorials it is now straightforward to produce a vendor for making toys or food. Have a look at the code below, and download the COS file here.

**make the vendor 
new: simp 2 23 10 "fishbowl" 2 0 5000Create new simple object
attr 199Give it attributes that allow it to be picked up and activated by the hand. Responds to gravity and boundaries.
perm 60A permeability that will allow it to sit on wooden platforms (rather than fall through them)
elas 0Elasticity of 0%
fric 100Friction of 100%
accg 3Acceleration due to gravity of 3
mvto 5000 3400Move to the corridor area of the ship
cmrt 0Move the camera to look at the object
*****vendor activate 
scrp 2 23 10 1This is the activate 1 script for the vendor created above
*make the bowl animate 
anim [0 1 0 1 0 1 0 1 0 1 0]Animate the bowl
*get the coordinates for the bowlThis part gets some world coordinates from the bowl - the food can then be created at this position later in the script
setv va00 poslGet the left position of the bowl
addv va00 30Add 30 to the left position (makes the coordinate further to the right on the screen)
setv va01 postGet the top position of the bowl
addv va01 10Add 10 to the top position (makes the coordinate further down screen)
*produce something here! 
instmake the rest of the script run instantly
new: simp 2 11 1000 "infinite_cheese_machine" 2 44 4900Create new simple object. This cheese food is the same one created in a previous tutorial
attr 195
bhvr 48
elas 30
fric 50
accg 3
mvto va00 va01Move it to the position calculated.
*give it some velocity 
velo rand -10 10 rand -15 -20Give it some velocity - this will make it come flying out of the top of the vendor. In this case we're using random values for both the X and Y velocities.
*give it a tick 
tick 8Give it a small tick (this is purely used to change the image plane of the cheese - it starts off at a plane behind the vendor and then after a small time moves to a plane in front of the vendor)
endmEnd of activate 1 script
*****cheese timer 
scrp 2 11 1000 9The timer for the cheese created by the vendor
plne 5001Change image plane
tick 0Stop the timer
endmEnd of timer script
*****eat script 
scrp 2 11 1000 12Eat script for the cheese - identical to eat script from previous tutorial
sndc "chwp"
stim writ from 79 1
pose 1
wait 20
kill ownr

Injecting this item into the world will show you a fish bowl type object sitting on the floor. Clicking on it will produce a lump of cheese from the top of the device.This can be altered to produce anything you desire ... toys, devices, eggs, anything! There are many examples of vendor type machines in C3, including:

The same principle can be used to create temporary items - such as a spray of mist from the Anti-Infection spray or the Atmosphere machine in the Norn Terrarium - the thing that is produced does not have to be an agent that will exist in the world for long.

The important things to remember when creating a vendor:

Downloads:   COS File