Site Tools
User Tools

Programming Tutorial IV - Private Doors

You'd like to have a wing of your Place just for your clan. Of course you would. Who wouldn't? That is, you want the door to this wing to be locked to the general public but unlocked to clan members. How do you go about doing this?

Let Room A be the Room that is open to the general public, and Room B be the private room, with a door between the two which should be only accessible to clan members.

Lock the door first. Then build a program to unlock it for clan members. First take a 'Clan' Contrivance. This has a parameter for which clan it is that you want to look out for. Put this in the top left of your logic grid. Underneath this put an 'Unlock Door' Contraption, with the parameter set to the appropriate door. Then the Contrivance looks to see if a player's in the right clan, and if so then the Contraption unlocks the door for them.

 Making a private door for clan members only.

And Bob's your uncle. There we go. But there's a little problem here. From Room A everything's fine and dandy. But once a clan member's in Room B, the door's locked. Nobody without a key can get through it. You've made a Clan trap! Outrageous! To counteract this, build a program in Room B with just a single Contraption to unlock the door. There's no need to check for clan membership here, there should only be clan members here in the first place. And if there is a non-clannie in there for some reason, then you probably want to let them out anyway.

Note for budding programmers

Once again, we've used a Contrivance to look out for something and then acted accordingly. The program finds a Contrivance in the first row, and then moves on to the next row only if the Contrivance finds what it's looking for.

Also - we've used two programs to achieve what we want. One in Room A to unlock the door for clan members, and one in Room B to unlock the door for everybody. Notice that the program in Room B, by itself, simply makes the door a oneway door. You can get out but not in. It's the program in Room A which adds to this the ability for clan members to go in through the door as well.

Place owners and/or those with the appropriate keys always see doors as unlocked. When making sure your programs work as intended it's a good idea to ask a friend to look round, or look round using an alt (one who you haven't cut any keys for). Don't worry about rule 3, this doesn't count as a dickish use for alts, you're not messing anybody about.

Exercise.

Suppose that you want to have a hidden catnip field which kittymorphs can smell out. So one room with a door that only kittymorphs can see entitled “What's that interesting smell?” which if clicked, takes them to the catnip field. How would you go about doing this?


Go to next tutorial.
Return to previous tutorial.
Tutorial Contents Page
Return to Introduction to Programming.
Return to Places Overview

gameplay/guides/places/progtutiv.txt · Last modified: 2023/11/21 23:02 by kuhsodas