General Car

A general car vehicle, with an engine you can start and stop, and various other commands.

Category: Vehicles
Compatibility: CobraMUSH, PennMUSH, TinyBit, TinyMUSH, TinyMUX.

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for General Car

@create General Car
@lock General Car==me
&START General Car=$start engine:@switch [get(me/engine)]=on,@pemit [v(#)]=The [name(me)]'s engine is already running.,off,{@switch [num(me)]=[loc([v(#)])],{&engine me=on;@Pemit me=[v(n)] turns the key, and the ignition turns over.;@emit [name(me)]'s engine rumbles to life.}}
@Listen General Car=*
@Prefix General Car=From inside the [name(me)],
@Inprefix General Car=From the outside,
&ENGINE General Car=off
&STOP General Car=$stop engine:@switch [num(me)]=[loc([v(#)])],{@switch [get(me/engine)]=off,@pemit [v(#)]=The engine is already off.,on,{@pemit me=[v(n)] turns the key.;@emit [name(me)]'s engine comes to a halt.;&engine me=off;&speed me=0}}
&DRIVE General Car=$drive *:@switch [num(me)]=[loc([v(#)])],{@switch [get(me/engine)]=off,@pemit [v(#)]=The [name(me)]'s engine is not running.,on,go [v(0)]}
@Oenter General Car=sits down inside.
@Oxenter General Car=opens a door of the [name(me)], and climbs inside.
@Enter General Car=You open a door, and climb inside.
@Leave General Car=You open a door, and climb outside.
@Oleave General Car=gets out of the car.
@Oxleave General Car=steps out of the [name(me)].
@Desc General Car=You have created a car object! Now you will want to personalize your car in the following ways.%r%r@name [name(me)]=< What you want your car to be called. >%r@desc [name(me)]=< What you want your car to look like on the outside. >%r@idesc [name(me)]=< What you want your car to look like on the inside. >%r%rYou can also set other attributes such as @enter and @leave messages, but they are already covered in the parent code. For more help on those, type help @enter and help @leave.
@Idesc General Car=You are in a [name(me)] with [get(me/icolor)] interior.%r%rType CARHELP for help.
&ICOLOR General Car=Black
&XCOLOR General Car=Black
@Fail General Car=It's too heavy.
&HORN General Car=$horn:@switch [num(me)]=[loc([v(#)])],{@pemit me=[v(n)] honks the horn.;@emit The [name(me)]'s horn HONKS!}
&VIEW General Car=$view:@pemit [v(#)]=[get_eval(here/desc)];@dolist [lexits(here)]=@pemit [v(#)]=[name(##)]
&HELP_CAR General Car=$carhelp:@switch [num(me)]=[loc([v(#)])],{@pemit [v(#)]==-=-=-=-=-=Car Help=-=-=-=-=-=-=-=%rStart Engine%rView%rCarStats%rStatus%rDrive <Direction>%rAccelerate <amount>%rDecelerate <amount>%rBrake%rHorn%rStop Engine%r=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
@Ealias General Car=drive
&SPEED General Car=0
&ACCELERATE General Car=$accelerate *:@switch [num(me)]=[loc([v(#)])],{@switch [get(me/engine)]=off,@pemit [v(#)]=Perhaps you should start the [name(me)] before trying to accelerate?,on,{@switch [gte([add([v(0)],[u(speed)])],[u(max_speed)])]=1,{@pemit [v(#)]=To accelerate that much would exceed the max speed of your [name(me)]. Max Speed : [u(max_speed)] MPH.},0,{@pemit me=[v(n)] pushes down on the accelerator.;&speed me=[add([get(me/speed)],[v(0)])];@emit [name(me)] speeds along at [get(me/speed)] MPH.}}}
&DECELERATE General Car=$decelerate *:@switch [num(me)]=[loc([v(#)])],{@switch [get(me/engine)]=off,{@pemit [v(#)]=If the car is off... it's not moving.},on,{@switch [lt([sub([u(speed)],[v(0)])],0)]=1,{@pemit [v(#)]=You cannot decelerate to a speed less than zero.},0,{@pemit me=[v(n)] presses on the brakes to slow down.;&speed me=[sub([u(speed)],[v(0)])];@emit [name(me)] slows to [get(me/speed)] MPH.}}}
&BRAKE General Car=2
&STATUS General Car=$status:@switch [num(me)]=[loc([v(#)])],{@pemit me=[v(n)] examines the gauges closely.;@pemit [v(#)]=Engine: [get(me/engine)]%rSpeed: [get(me/speed)] MPH%rBattery: [get(me/battery)]%rOil: [get(me/oil)]%rFuel: [get(me/gas)]}
&GAS General Car=full
&OIL General Car=full
&SPEED_SAFE General Car=80
&MAX_SPEED General Car=100
&MANUEVER General Car=Maneuverable
&TYPE General Car=Compact Car
&SPEED_MAX General Car=100
@Cost General Car=$15,000
&STATS_CAR General Car=$carstats:@switch [num(me)]=[loc([v(#)])],@pemit [v(#)]=-------[name(me)] Stats-------%rType: [get(me/type)]%rSafe Speed: [get(me/speed_safe)]%rMaximum Speed: [get(me/speed_max)]%rManuever: [get(me/manuever)]%rBrake: [get(me/brake)]%rCost: [get(me/cost)]
@Amove General Car=:rumbles in.
&BRAKES General Car=$brake:@switch [num(me)]=[loc([v(#)])],{@pemit me=[v(N)] slams on the brakes.;@emit [name(me)] screeches to a halt.}
&CREDITS General Car=PENTEX@ElysiumMUSH
@Adesc General Car=@pemit %#=[switch(match([owner(me)],%#),1,Type 'carhelp' for help.,You look at [name(owner(me))]'s car.)]
@Lalias General Car=out
&BATTERY General Car=full
@set General Car=AUDIBLE
@set General Car=ENTER_OK
@set General Car=INHERIT
@set General Car=COMMANDS

drop General Car
enter General Car