Vehicle Tutorial (by BoingDragon) Topics: 1) Creating the vehicle 2) Vehicle exits and windows with ObjExit.muf 3) Drive action with DriveTo.muf 4) Miscellaneous Part 1: Creating The Vehicle A vehicle consists of two main parts, an OBJECT to serve as the 'outside' of the vehicle, and a ROOM to serve as the inside. Start by creating the object: @create Omni Car This will return a database reference number which you need to note, as it is used later by the vehicle actions. For this example, the db# of Omni Car will be #12345. Vehicle objects must be JUMP_OK in order for the driveto program to move them around, so the next step will be: @set Omni Car=J Now we can @dig the room to be the inside. We'll use the parent and register options of @dig in order to save time and make things more convenient. @dig Omni Car Cabin=#78722=inside This creates the room 'Omni Car Cabin' and parents it to room #78722, which is a room containing many vehicle destinations and a handy navigation action, as well as Greywolf's Vehicle Environment Room, #28616, which includes both a 'drive' action and an 'out' action (convenient if you only plan on a one-room land-based vehicle). It has default messages you can change by setting props on the room (listed later in this tutorial). The word 'inside' will let you reference this room with '$inside' instead of having to remember its db number. The last step for this phase of vehicle creation is to make an entry action for the vehicle. The entry action should be both obvious and unique, since other vehicles may be in the same area and like-named actions will be chosen at random. @act enter omni;enter car=Omni Car @link enter omni=$inside The @osucc, @succ, and @odrop messages for this action work as they do for any other exit, as do the transparent-exit programs. You can now enter the vehicle for the next part of the tutorial. Part 2: Vehicle Exits and Windows Normally, you can't have an exit to an object that will take someone to that object. To do this for vehicles, a special program called Object-Exit is used. To create an exit from the inside room of the vehicle to the vehicle object, use: @open out;exit=#32153 (NOTE: Parents #78722 and #28616 come with this.) This action now needs to know the db # of the vehicle object. For the Omni Car example, that number was #12345: @set out=goto:12345 Because this 'exit' is actually a program call, the standard @drop and @odrop type messages can't be used. These messages are instead stored on the action as the following properties: (For the built-in exit, these messages can be set on the room as well, just use 'here' instead of 'out') @set out=exit_osucc:climbs out of the cabin. @set out=exit_drop:You climb out of the Omni Car's cabin. @set out=exit_odrop:climbs out of the Omni Car. If the vehicle happens to be in an area that is not _vok?:yes or is set to noexit:yes, the following messages are used: @set out=exit_fail:You can't get out here! @set out=exit_ofail:tries to leave to cabin. Vehicle windows that let you view the area the vehicle object is in use the Window.muf program, #36002. They can be added to Objexit actions by simply setting the @desc of the action to that number: @desc out=@36002 You look out through the bubble-canopy and see: Now when a person does 'look out' they will see the description of the room that the vehicle object is currently in. This view can be modified using the standard transparent-exit control flags and the 'show' property. Those flags are N (room name), D (description), C (contents), and P (programs run from the room's @succ, like Obvious-Exits). To display use all of these viewing options: @set out=show:ndcp Not all windows need to be exits, especially in the case of a vehicle with multiple interior rooms such as an airplane or spaceship, where the exit is in a seperate room from the control area. The simplest way to implement a window in this case is to set the 'goto' property on the room itself, and use look-traps for the windows: @set here=goto:12345 @set here=show:ndcp look #add window view outside=@36002 You see through the window: Part 3: The Drive Action Driveto.muf, #32249, is the program used to 'move' your vehicle object from room to room. It has certain necessary restrictions, however. A room must be set _vok?:yes in order for a vehicle object to be moved there. Exits can be driven through if both the source and destination rooms allow vehicles, or if the exit itself is _vok?:yes. Exits can also be set to only allow vehicles that use a certain 'dmode' to pass through them (so cars don't end up in the lake, or in the sky). Driveto.muf does not require that a vehicle has an 'inside' room. There is a special '_bike' mode for it that allows the action to be attached to an object, which the user then carries to use. (For info on _bike vehicles, look at the driveto docs with @view #32249. This tutorial focuses on vehicles that use a room, although the settings for the driveto action are the same.) This example is for the Omni Car, which can travel in any drive mode, so the the mode would be set with: @set Omni Car=dmode:any Other drive modes are: air, water, land. Setting a dmode on a _vok?:yes exit will lock that exit to only allow vehicle objects with the matching dmode to pass. To create the action in the vehicle's inside room, just use: @open drive;fly;pilot=#32249 ('drive' alone is in the vehicle environment room) Driveto properties can be set on the action itself, or on the room if you're using an environment action. The following message properties can be set: (Note: In drive_osucc and drive_odrop, %vehicle will be substituted by the name of the vehicle object.) @set here=drive_osucc:pilots the Omni Car out of the area. This message is seen by the room the vehicle object is leaving. @set here=drive_odrop:zooms the %vehicle into the area! This is the message seen in the room the vehicle object enters. @set here=drive/window?:yes This will cause the name and contents of a room to be displayed when the vehicle drives into it. If you created a drive action instead of using the environment one, you can use the @succ and @osucc of the action for messages also. The drive action needs to know the db number of the vehicle object. For the Omni Car, #12345, it would be set with: @set here=object:12345 If you don't want the vehicle to be able to drive through exits, and just use preset destinations: @set here=_drive_compass?:no Destinations can be added to the vehicle with: @set here=_drive_<destination>:<db ref of that room> For example: @set here=_drive_garage=98765 Where the garage room's db ref is #98765. Destination names should be kept to one word for convenience (That doesn't mean the name of the actual room needs to be one word, just the destination name). Destinations must be rooms, and must be _vok?:yes. Destinations can also have custom messages that are displayed when you drive to them: @set here=_drivemsg_garage:The Omni Car slips smoothly into its garage. These messages are displayed to the room the drive action is in, or to any rooms with their db #'s listed in the _drivein property: @set here=_drivein:23456 34567 45678 <etc> Miscellaneous @set here=drive/window?:yes > This will display the name of the room and its contents to all the _drivein rooms when driven into. @set here=_map/ref:nnnnn > Where nnnnn is the db # of the vehicle object. Allows the global 'map' command to work within the vehicle, using the vehicle object as a map location reference. %call[46956] or {muf:#46956,} > Fidget's Look-Item. Include this in the desc of the inside room to show the vehicle's location. @list #46956=1-23 for settings. nav;navigate > (only in the #78722 vehicle environment) Handy action to list the vehicle destinations in a given region, covers all the preset environment destinations.