User Tools

Site Tools


vehicles

You can of course simply roleplay the use of vehicles. But if you are fond of coding gadgets and would like to create a vehicle that way, the following instructions may be handy:

We have a new vehicle system on Furscape for 2004. Previously we used “simple vehicles”, where a vehicle is basically just a THING with a VEHICLE flag set on it. The new system uses “compound vehicles”, which means you have a THING to represent the outside of the vehicle, and at least one ROOM to represent the inside.

Incidentally, vehicles made with the old system still work. However, the new vehicles are more reliable and they allow you to create multiple compartments (i.e. rooms) inside. When you use MAKEVEHICLE you will get a new-style compound vehicle.

The MAKEVEHICLE command should be very easy to use. Basically you just type the command, answer “yes” when it asks if you're sure you really want to do this, then it makes the vehicle and drops it in the room with you. These freshly made vehicles are fully functional, but you need to rename them and set your own descriptions and so forth. Nobody wants to see generic vehicles driving all around.

To get into the vehicle, simply ENTER it. To get out, you can EXIT or go OUT. You can VPOSE (or VP) actions, which works like the normal pose command. You can DRIVE through exits and use WINDOW to see what's around the vehicle.

The WINDOW command is upgraded. Now you can give it an argument like “window sign” to look at an object (in this case, a sign) outside the vehicle. You can look at players, things, exits and even fake objects. However, there is a bug which causes MPI code to sometimes fail with permission errors. Builders who use a lot of MPI may want to check around their areas with a vehicle to see if they have this problem.

By default, any kind of activity happening outside the vehicle is seen by anybody inside. If you don't want outside activity seen by players in one of your vehicle rooms (say, it doesn't have any windows), just set a property like this in your room: @set here=echo?:no

The DRIVE command follows the same rules as the old vehicles. You can't go through an exit set V, you can't enter a room set V. (This is the way for builders to lock vehicles out of areas where they don't make sense. You can also block vehicles from a whole environment by setting “_vok?:no”.) You can drive around on Wildplanet now, and other areas built with Terraform. Vehicles can't fly unless they have a flight property set: @set vehicle=_flight?:yes

When it's time to get rid of a vehicle you no longer want, just @recycle the vehicle object. The @rec command will know when you are trying to recycle a compound vehicle, and it will ask if you want to recycle the whole thing. If you say YES, it will get rid of the vehicle, all the interior rooms, any exits or actions attached in those rooms, and any sticky objects homed in the rooms. This makes cleaning up old vehicles easy. (But if you enter NO, it will only recycle the vehicle object, and leave the rest of mess for you to clean up.)

This should be everything you need to know about compound vehicles, unless you intend to customize yours or try building one from scratch. For those who want the nitty-gritty details, let's take a close look at how they work!

At its most basic, the compound vehicle is a THING with a VEHICLE flag and a property “_vehicle” pointing to a parent room, which must also have a “_vehicle” property pointing back to the vehicle object. Both of these properties must be dbref values, and if either of them is messed up, the vehicle is invalid and nothing will work.

The MAKEVEHICLE command creates a vehicle with two rooms: a parent room, and a cabin. This means you can easily add rooms to your vehicle with @excavate or EditRoom. The new rooms will automatically go into vehicle's parent. It is also possible to have a vehicle with only one room, which is both the parent and the cabin.

When you enter a vehicle, the program puts you into the “entry room”. In a vehicle with multiple rooms, this is always the first room in the parent. This is also the only room you can exit the vehicle from, by default. You can make it possible to exit from other rooms by setting “vehicle/exit?:yes” on them. If you want players to enter from outside the vehicle into multiple rooms, you can attach exits to the vehicle and link them to the destination rooms.

We have an environment room for vehicles, registered as $vehicles. This environment is where the parent rooms of all vehicles made with MAKEVEHICLE will go. It isn't required, you can parent your vehicle somewhere else and it will still work. You may miss a few properties or actions defined in $vehicles, such as the OUT and VPOSE commands.

In order to see events echoed from outside the vehicle, your vehicle object must have an “_alisten/” property pointing to the $cv/echo MUF. This is set by MAKEVEHICLE automatically, or you can set it yourself using a command something like: “@propset vehicle=dbref:_alisten/cv-echo:$cv/echo”

In order to see players inside the vehicle when you look at the vehicle object, you need a custom contents property on your vehicle. It should call the $cv/contents program with an argument telling it what kind of contents you want should be visible. When using MAKEVEHICLE it sets “_/co:{muf:$cv/contents,players zombies}” on the vehicle object, so you can see players and zombies inside by default. You can also set it to show “things” and “rooms”.

Incidentally, there is nothing to prevent a vehicle object from also being a container, so you could use it as the “trunk” (or “boot” for you Brits) of your car.

If you want to code your own MUF programs to work with vehicles, there is a support library to make this easy. It's compound-vehicles.lib(#6443FLVM2), which is registered as $lib/compound-vehicles and $cv/library. There is no way you can mess up a vehicle using this library, since all it does is return information about the vehicle. You can use it to identify and validate compound vehicles, see if a player is inside a vehicle, get a list of rooms in the vehicle, and so forth.

Other programs we have that work with compound vehicles are:

cv.drive.muf ($cv/drive)         ----- for the DRIVE command
cv.contents.muf ($cv/contents)   ----- for seeing what's inside
cv.pose.muf ($cv/pose)           ----- for the VPOSE / VP command
cv.window.muf ($cv/window)       ----- for the WINDOW command
cv.exit.muf ($cv/exit)           ----- for the OUT command
cv.echo.muf ($cv/echo)           ----- echoes text into the vehicle
enter-exit.muf ($cmd/enter-exit) ----- the global ENTER & EXIT commands
sky-nav.muf ($muf/sky-nav)       ----- for assistance in navigating a flying vehicle
commset.muf ($muf/commset)       ----- for setting up communications systems like CB radios

All these programs are set VIEWABLE, and programmers are free to list them out and study the code.

vehicles.txt · Last modified: 2011/06/30 09:16 by hagalaz