Hotel Vender Code v2

This creates a hotel clerk vendor. It's fairly simple. The sign should be put in another room from the clerk (ie: down a Hallway or whatnot). This is much more complex than the original version posted to this site, and includes the option for both 'room' and 'suite' rental. This allows one or two people to have a room. Alternately, the suite room can have a different (more upscale) desc. If you implement this code with an economy system, you can lock activities in a specific area to people only registered with a room. A sample parent room is included with this code. Lots of nifty features with this code, including checks to make sure people have the room for a limited amount of time, and special door locks.

Author: Gwen Morse
Category: Building
Features: color substitutions.
Compatibility: TinyMUX.

Instructions

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

MUSHCode for Hotel Vender Code v2

@@ This creates a hotel clerk vendor. It's fairly simple. The sign should be put in
@@ another room from the clerk (ie: down a Hallway or whatnot). This is much more complex
@@ than the original version posted to this site, and includes the option for both
@@ 'room' and 'suite' rental. This allows one or two people to have a room. Alternately,
@@ the suite room can have a different (more upscale) desc. If you implement this code
@@ with an economy system, you can lock activities in a specific area to people only
@@ registered with a room. A sample parent room is included with this code. Lots of nifty
@@ features with this code, including checks to make sure people have the room for a limited
@@ amount of time, and special door locks.

@create Darla the Clerk=10
&CMD_GUEST_LIST Darla the Clerk=$guest list:@pemit %#=%r[space(5)]**Registered Guests of [u(HOTEL)];@pemit %#=[iter(iter(edit([lattr(me/r_*)],R_, ),%%r ## %%b %%b [get(me/r_##)]),[ifelse(isdbref(##),name(##),##)])]
@Desc Darla the Clerk=%rDarla is a short, round, middle-aged woman in a crisp maroon hotel uniform. Her chin-length brown hair is gelled neatly away from her face. Light touches of cosmetics brighten her lined face, and a cheerful expression adds another layer of attractiveness to what otherwise would be rather plain and doughy features. Her brown eyes glance alertly around the room. She waits at the secretary, to take bookings and provide information to guests.
&CHECKOUT_ROOM2 Darla the Clerk=$check * out:@switch %#=[owner(me)]=0,{@pemit %# = You are not authorized to 'check out' guests.},{@switch member(iter(lattr(#239/r_*),get(#239/##)),[num(*%0)]) = 0,{@pemit %#=[name(me)] quickly informs you that %0 is not registered.},{@pemit %# = [name(me)] clears %0's guest registration and unbooks the room/suite.; @trigger #239/dest_room=[num(*%0)]}}
&MAPAY-SUITE Darla the Clerk=$book suite:@switch member(iter(lattr(#239/r_*),get(#239/##)),%#) = 0,{@switch [hasattr(me,SUITENUMS)]=0,{@pemit %# = %r[name(me)] informs you that you must choose two names to be registered to the suite before you book it. 'suite <Name1>+<Name2>' will work. Be sure to include the '+' sign between the names.%r},{@trigger #239/MAKE_SUITE = %#; @set me = suite_count:[add(v(SUITE_COUNT),1)]; @pemit %# = %rYou register for a suite with [name(me)]%r%rYou are informed "If you head up to the Loft, you will find the door to the suite, with both names on it. If you did not register your own name on the suite, you will not be able to access it. If there is anything you need, please let the [v(HOTEL)] staff know. Enjoy your stay."%r}},{@pemit %# = [name(me)] notifies you that you are already a registered guest of [v(HOTEL)];}
@Adesc Darla the Clerk=@pemit %#=%rYou can %ch'ask rates'%cn to get help from [name(me)].%r;@pemit owner(me)=%N looked at [name(me)].%r
&MAPAY-ROOM Darla the Clerk=$book room:@switch member(iter(lattr(#239/r_*),get(#239/##)),%#) = 0,{@trigger #239/MAKE_ROOM=%#; @set me = room_count:[add(v(ROOM_COUNT),1)]; @pemit %# = %rYou register for a room with [name(me)].%r%rYou are informed "If you head up to the Loft, you will find the door to your room, with your name on it. If there is anything you need, please let the [v(HOTEL)] staff know. Enjoy your stay."%r},{@pemit %#=[name(me)] notifies you that you are already a registered guest of [v(HOTEL)].;}
&CHECK-EARN Darla the Clerk=$check earn:@switch %#=[owner(me)]=0,{pemit %#=You are not authorized to 'check earn'ings.},{@pemit %#=[name(me)] has registered [v(ROOM_COUNT)] room(s) and [v(SUITE_COUNT)] suite(s).}
&CMD_CHECKOUT Darla the Clerk=$check out:@switch member(iter(lattr(#239/r_*),get(#239/##)),%#)=0,{@pemit %#=[name(me)] efficiently informs you that you are not registered in the [u(HOTEL)], but if you would like information about staying here, just 'ask rates'.},{@pemit %#=[name(me)] clears your guest registration and unbooks the room/suite. Don't forget to +mail the owner "[name(owner(me))]" about how you liked your visit.; @tr #239/dest_room=%#}
&CMD_SUITENAMES Darla the Clerk=$suite *+*:@switch type(*%0)=PLAYER,{@switch type(*%1)=PLAYER,{@pemit %#=%rBoth names you entered are players. You may now 'book suite'. If at least one of the names submitted was not yours, you will not have control over the room, and you will not be able to check out%r;&suitenums me=[num(*%0)] [num(*%1)]},{@pemit %#=%r"%1" is not a player but "%0" is. Please try 'suite <Name1>+<Name2>' again.}},{@pemit %#=%r"%0" is not a player. Please try 'suite <Name1>+<Name2>' again.}
&HOTEL Darla the Clerk=Denver Heights Ski Lodge
&RATES Darla the Clerk=$ask rates:@pemit %#=%r[name(me)] informs you "We have two ways to register. A single room (which allows full access for one guest), and a suite (which allows full access for 2 guests). These accomodations will be registered for 60 RL days before they will be automatically destroyed (however, we prefer you %ch'check out'%cn when you're done here)."%r%r[space(5)]%ch'book room'%cn for a room.%r[space(5)]%ch'suite <Name1>+<Name2>'%cn to set up the names for the suite, and then %r[space(5)]%ch'book suite'%cn for a suite.%r
&ROOM_COUNT Darla the Clerk=13
&SUITE_COUNT Darla the Clerk=2
@set Darla the Clerk=PUPPET
@set Darla the Clerk=SAFE

@create Sign=10
@lock Sign=*Coder
@Desc Sign=%rTo book a room, head back downstairs to the Main Room.%r
&MAKE_ROOM Sign=@dig [name(%0)]'s Room={[name(%0)]'s Room;[mid([name(%0)],0,3)]R;[mid([name(%0)],0,2)]R;[mid([name(%0)],0,1)]R;}; [setq(0,[loc([name(%0)]'s Room)])]; [setq(1,[name(%0)]'s Room)]; [setq(2,[num([name(%0)]'s Room)])]; [setq(3,[num(%0)])]; &R_%q2 me=%q3; @parent %q0=[v(parent-room)]; @desc %q2=This is a plain wooden door leading into %q1. There is the small, round, glassy-looking circle of a peephole at eye level. You notice an information plaque that reads: "Every room is protected by an automatic locking mechanism. Whenever the guest registered to this room leaves or goes to sleep (disconnects), the exit into the room automatically locks. At any time, they can re-enter the room. Friends of this guest may be allowed into the room by having the registered guest <unlock exit> from within the room itself."; @succ %q2=You enter %q1.; @osucc %q2=enters %q1.; @odrop %q2=enters the room from the door to the hallway.; @fail %q2=You try to enter %q1, but the door is locked. If you are a friend of the guest registered to this room, you may be allowed into the room by having the registered guest <unlock exit> from within the room itself.; @ofail %q2=tries to enter %q1, but the door is locked.; @set %q0 = UNFINDABLE; @set %q0 = MONITOR; @set %q0 = INHERIT; @set %q0 = ABODE; @set %q0 = COMMANDS; &CHECK-IN %q0=time(); &DOOR-IN %q0=%q2; &OWNER %q0=[num(*%0)]; &OWNER %q1=[num(%0)]; &KEY-LOCK %q2=%[match(u(OWNER),%%#)%]; &STATE %q2=unlocked; &colors %q0=[switch(rand(4),0,black white and red,1,dark blue and bold yellow,2,teal and mauve,3,silver and blue,4,ivory mauve and seafoam green)]; &descnum %q0=[rand(4)]; @trigger me/cmd_locks1=%q0
&DEST_ROOM Sign=[first(iter(lattr(me/r_*),switch(match(v(##),%0),0,,setq(0,extract(##,2,6,_ )))))]; &r_%q0 me; @dest [loc(%q0)]; @wait 1=@dest %q0
&CMD_LOCKS1 Sign=&CLEANUPSEATSA %0=get(#143/CLEANUPSEATSA); &CLEANUPSEATSB %0=get(#143/CLEANUPSEATSB);&DISCONNECT %0=^* has disconnected.:@switch %%0=%[name(u(OWNER))%]=0,,%{@fo me=@lock %[v(DOOR-IN)%]=!KEY-LOCK/0%; &STATE %[v(DOOR-IN)%]=locked%}; @trigger me/cmd_locks2=%0
&CMD_LOCKS2 Sign=&LEFT %0=^* has left.:@switch %%0=%[name(u(OWNER))%]=0,,%{@fo me=@lock %[v(DOOR-IN)%]=!KEY-LOCK/0{;} &STATE %[v(DOOR-IN)%]=locked{;} @pemit %%#=%%rThe exit to the room locks behind you with an audible >>click<<.%; @trigger me/startup=%%0%}; @trigger me/cmd_locks3=%0
&CMD_LOCKS3 Sign=&UNLOCK_DOOR_CODE %0=$unlock exit:@switch %[u(v(DOOR-IN)/STATE)%]=unlocked,%{@pemit %%#=The exit is already unlocked.%},locked,%{&state %[v(DOOR-IN)%]=unlocked{;} @pemit %%#=The exit is now unlocked.{;} @unlock %[v(DOOR-IN)%]%},%{@pemit %%#=WARNING: The unlocking command has malfunctioned. Please +mail [name(owner(me))] and let them know what happened!%}; @trigger me/cmd_startup=%0,num(me)
&CMD_STARTUP Sign=@Startup %0=@switch %[gte(sub(convtime(time()),convtime(u(CHECK-IN))),5184000)%]=1,%{@pemit %%0=%%rYou have spent at least 60 days in this room without checking out or renewing your registration. Your registration has been revoked. You may register for a new room at any time.%%r %; @trigger %1/DEST_ROOM=%%0%; &r_%[v(DOOR-IN)%] %1%; %},%{@pemit %%0=%%rYou have %[trunc(div(sub(5184000,sub(convtime(time()),convtime(u(CHECK-IN)))),86400))%] more days until your registration expires.%%r %}
&MAKE_SUITE Sign=@dig Suite: [iter(u(#238/suitenums),name(##))]={Suite: [iter(u(#238/suitenums),name(##))];[edit(S[iter(u(#238/suitenums),mid(name(##),0 ,1))],%b,) ];[edit([iter(u(#238/suitenums),mid(name(##),0,1))],%b,)]}; [setq(0,[loc(Suite: [iter(u(#238/suitenums),name(##))])])]; [setq(1,Suite: [iter(u(#238/suitenums),name(##))])]; [setq(2,[num(Suite: [iter(u(#238/suitenums),name(##))])])]; [setq(3,[u(#238/suitenums)])]; &R_%q2 me=%q3; @parent %q0=[v(parent-suite)]; @desc %q2=This is a carved wooden door leading into %q1. There is the small, round, glassy-looking circle of a peephole at eye level. You notice an information plaque that reads: "Every suite is protected by an automatic locking mechanism. Whenever one of the guests registered to this suite leaves or goes to sleep, the exit into the suite locks. At any time, guests can re-enter the suite. Friends of either guest may be allowed into the suite by having someone <unlock exit> from within the suite itself."; @succ %q2=You enter %q1.; @osucc %q2=enters %q1.; @odrop %q2=enters the suite from the door to the hallway.; @fail %q2=You try to enter %q1, but the door is locked. If you are a friend of either of the guests registered to this suite, you may be allowed into the suite by having someone <unlock exit> from within the suite itself.; @ofail %q2 = tries to enter %q1, but the door is locked.; @set %q0 = UNFINDABLE; @set %q0 = MONITOR; @set %q0 = INHERIT; @set %q0 = ABODE; @set %q0 = COMMANDS; &CHECK-IN %q0=time(); &DOOR-IN %q0=%q2; &OWNER %q0=[u(#238/suitenums)]; &OWNER %q1=[u(#238/suitenums)]; &KEY-LOCK %q2=%[match(u(OWNER),%%#)%]; &STATE %q2=unlocked; &SUITENUMS #238; &colors %q0=[switch(rand(4),0,black white and red,1,dark blue and bold yellow,2,teal and mauve,3,silver and blue,4,ivory mauve and seafoam green)]; &descnum %q0=[rand(4)]; @trigger me/cmd_locks1=%q0
&PARENT-ROOM Sign=#235
&PARENT-SUITE Sign=#235
&HOTEL Sign=Denver Heights Ski Lodge
@set Sign=DARK
@set Sign=STICKY
@set Sign=SAFE

@dig/teleport Parent Room -- Ski Lodge
@Desc here=%r[u(desc[v(descnum)])]%r
&DESC0 here=[space(5)]This room is the heigh of rustic plushness. Mirrors line the entire left wall, reflecting the enormous central bed with slotted skylights above it and a gorgeous stone fireplace opposite it. Long windows cover the back wall and then fan out in a semicircle on the end wall to create a wide alcove for a white marble hot tub on a raised dais. A pair of curving tapestry-upholstered sofas in [u(COLORS)] striped fabric are positioned before the fireplace. On the dais, on either side of the tub, are two more overstuffed chairs upholstered in the same fabric.
&DESC1 here=[space(5)]This room has a definate masculine influence, with the heavy dark green and leather of a gentlemen's club, but a few subtle feminine touches save it from austerity. The walls are covered in dark-burgandy and pale-cream striped fabric. A pair of dark green leather couches face a greenish granite fireplace. Two large, comfortable, green-and-burgandy striped wing chairs flank the couch - their sturdy legs resting on a green and cream tufted rug with traces of pink. Heavy mahogany furniture is scattered around. Long windows cover the back wall and then fan out in a semicircle on the end wall to create a wide alcove for a green marble hot tub on a raised dais. Rose brightens the room in the velvet drapes and damask throw-pillows. On the dais, on either side of the tub, are two more overstuffed chairs upholstered in the same striped fabric as the wing chairs.
&DESC2 here=[space(5)]This room is done in what looks like hundreds of shades of blue, ranging from very dark to so light it's nearly white. The walls are papered with varigated striped shades of blue. In the middle of the room is an overwhelming cherrywood four-poster bed draped in an airy cotton of the palest silvery-blue imaginable. Silky-smooth Queen Anne style cherrywood furniture is arranged around, including a pair of couches upholstered in dark blue velvet stretching along the front of the blue-veined stone fireplace. Long windows cover the back wall and then fan out in a semicircle on the end wall to create a wide alcove for a blue marble hot tub on a raised dais. These windows are curtained in a dark blue silk that's almost purple. On the dais, on either side of the tub, are two more overstuffed chairs upholstered in the same velvet fabric as the couches.
&DESC3 here=[space(5)]This is a beautifully bright and cheery room. The floor is light golden oak waxed to a low shine. A pair of soft buff leather couches sit before a glass-topped coffee table which rests on a bright [u(COLORS)] patterned rug. These are arranged in front of a large stone fireplace. Through an arch up one step is the sleep area, dominated by a king-sized waterbed, satin-sheeted and piled high with fluffy pillows. Closets and drawers line the wall opposite the arched opening. Long windows cover the back wall and then fan out in a semicircle on the end wall to create a wide alcove for a deep marble hot tub on a raised dais. These windows are curtained in [u(COLORS)] striped sheers. On the dais, on either side of the tub, are two more overstuffed chairs upholstered in fabric striped with the same colors as the rug and curtains.
&COLORS here=ivory, mauve, and seafoam green
&DESCNUM here=3
&CLEANUPSEATSA here=^* has left.:@switch member(iter(rest(lnum(add(v(maxplaces), 1))), [v(place##names)]), %#)=>0,{[setq(0, [extract(iter(rest(lnum(add(v(maxplaces), 1))), [switch(words(v(place##names)), 0,, [repeat(%b##,words(v(place##names)))])]), member(iter(rest(lnum(add(v(maxplaces), 1))), [v(place##names)]), %#), 1)])];&place[r(0)]names me=[remove(v(place[r(0)]names), %#)];@dolist [v(place[r(0)]names)]={@pemit ##=%N stands, leaving the place.};@pemit %#=You stand, leaving your seat.}
&CLEANUPSEATSB here=^* has disconnected.:@switch member(iter(rest(lnum(add(v(maxplaces), 1))), [v(place##names)]), %#)=>0,{[setq(0, [extract(iter(rest(lnum(add(v(maxplaces), 1))), [switch(words(v(place##names)), 0,, [repeat(%b##, words(v(place##names)))])]), member(iter(rest(lnum(add(v(maxplaces), 1))), [v(place##names)]), %#), 1)])];@dolist [v(place[r(0)]names)]={@pemit ##=%N stands, leaving the place.};&place[r(0)]names me=[remove(v(place[r(0)]names), %#)]}
&MAXPLACES here=3
&MAXSEATS1 here=3
&PLACE1 here=Bed
&MAXSEATS2 here=6
&PLACE2 here=Couches
&MAXSEATS3 here=8
&PLACE3 here=Hot Tub area
@set here=MONITOR
@set here=SAFE