Home
Start a new game
Explore games
Help
Log in or sign up
Log in
Username
Password (
Forgot it?
)
×
New to Playfic?
Full Name
Email
Username
Password
Password (confirm)
Are you sure about this?
How to code?! Safe and Combo Locks
by
Mary R. Kiang
Played 1,873 times
View game source
(spoilers!)
Download the
.z8 file
Source Code
"test safe and combo locks" by Mary R Kiang [test IF to show two different ways of coding for a combination lock] Use no scoring. When play begins: say "This is a short tutorial IF to show two different ways of coding for a combination lock. Play through it and then look through source code." [test IF to show two different ways of coding for a combination lock] Office is a room. "A safe and a box are the only interesting items here." Safe is a container in the office. Safe is fixed in place, locked and lockable, closed and openable. The description is "A giant enforced steel safe. The safe has dials that require a 4 digit combo to unlock. You must 'spin the dials to' the correct 4 digit combo." Understand "dial" and "dials" as the safe. [Mrs. Kiang's combination lock code as used by Jordan F. for her SpongBob IF Safe is a container in the office. Safe is fixed in place, locked and lockable, closed and openable. The description is "Mr. Krab's giant enforced steel safe. He likes to keep the money and secret formula close. The safe requires a 4 digit combo to unlock, only Mr. Krabs know this code." Understand "dial" and "dials" as the safe.] Instead of opening the safe when the safe is locked: say "The safe opens only when turned to the correct combination. You must 'spin the dials to' the correct 4 digit combo." [Create an action for spinning the dials.] Understand "spin [something] to [a number]" as spinning it to. Spinning it to is an action applying to one thing and one number. [Check the action spinning in case its not applied to safe.] Check spinning it to: if the noun is not the Safe: say "[The noun] does not spin." instead. [If not the safe, give this feedback.] Report spinning it to: say "Click! and nothing else happens." [If they spin the safe to the correct combo, then safe is unlocked.] After spinning the closed safe to 2314: now the Safe is unlocked; say "Clonk! The safe door is now unlocked." [End of code to open a combination lock.] [Jordan told the player the combo when this game code was triggered... Instead of giving the formula to Mr Krabs: say "Mr. Krabs says, Spongebob I'm busy! Oh... ha well done Spongebob I guess Plankton didn't keep it as safe as he thought. Good job, can you put the formula back into the safe. I will give you the code, remember this: 2314.".] After opening the safe: end the story finally saying "The safe is empty, but you have gained knowledge." After closing the safe: say "You hear the lock mechanism slide back into place as the safe door closes."; now the safe is locked. [ANOTHER way to code for a combo lock. This one is a bit simpler, since it only requires the player to be carrying the combo.] Box is a container in the office. Box is fixed in place, locked and lockable, closed and openable. The description is "[If closed] A small, yet very heavy metal box that looks plain, yet intriguing somehow.[otherwise] The numbers 2314 are written inside the box." After opening box: say "The numbers 2314 are written inside the box." [Make something that has the combo written on it...] Scrap of paper is a thing in office. The description of scrap of paper is "A small slip of paper with the word 'box' and what looks like a combo on it. With your terrible memory, you should probably hang onto this." Understand "combo" as scrap of paper. [Make sure that once your player has it, they hang onto it...] After doing anything to scrap of paper when the player is not carrying scrap of paper: say "You decide to hang onto this."; move scrap of paper to player. Instead of dropping the scrap of paper: say "You decide to hang onto this.". [Then when player tries to open the box, tell them that they use the combo to do so and adjust the status of the box.] Instead of opening the box when the box is locked: if player is carrying scrap of paper: say "This box has a combo lock on it! Thankful that you held onto the scrap of paper you found with the combo on it, you quickly unlock the box."; now the box is unlocked; otherwise: say "This box has a combination lock on it. Probably should look for something with numbers on it."