This a collection of small Inform 7 recipes.
Last active
September 20, 2021 19:08
-
-
Save floriancargoet/3feebe16442dc372bde5c24508c55dae to your computer and use it in GitHub Desktop.
Inform 7 recipes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A thing can be examined or unexamined. | |
Carry out examining something: | |
now the noun is examined. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Printing a different text before and after examination.] | |
The Office is a room. | |
A wastepaper basket is a transparent open container in the Office. | |
Understand "garbage" as the wastepaper basket. | |
After printing the name of the wastepaper basket while listing contents: | |
[See "Examined things.ni" for the examined property.] | |
if the wastepaper basket is not examined: | |
say " full of garbage"; [The leading space is important.] | |
omit contents in listing. [Do not list the contents of the basket.] | |
In the wastepaper basket are a soda can, some shredded documents, crumpled gift wrap and an empty paper towel roll. | |
Test me with "look / examine basket / look". | |
[ | |
>[1] look | |
Office | |
You can see a wastepaper basket full of garbage here. | |
>[2] examine basket | |
In the wastepaper basket are a soda can, some shredded documents, crumpled gift wrap and an empty paper towel roll. | |
>[3] look | |
Office | |
You can see a wastepaper basket (in which are a soda can, some shredded documents, crumpled gift wrap and an empty paper towel roll) here. | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
La hache is in The Office. | |
Include (- | |
with articles "La " "la " "une ", | |
-) when defining la hache. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Demo is a room. | |
The ATM is in the demo. | |
Instead of examining the ATM: | |
say "You insert your card and try to remember you PIN code."; | |
now the command prompt is "Enter PIN: ". | |
After reading a command when the command prompt is "Enter PIN: ": | |
if the player's command matches "1234": | |
say "Here's some money."; | |
otherwise: | |
say "Incorrect PIN number. Your card has been destroyed."; | |
now the command prompt is ">"; | |
reject the player's command. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Sound demo" | |
Section 1 - This should be an extension | |
[ A phrase to detect sound support. ] | |
To decide whether glulx sound is supported: | |
(- ( glk_gestalt(gestalt_Sound, 0) ) -) | |
[ Add an alternative text to sound, displayed instead of the sound when it's not supported. ] | |
A sound name has a text called alt-text. | |
[ Play a sound, optionally in loop. ] | |
To safeplay (s - a sound name), in loop: | |
if glulx sound is supported: | |
if in loop: | |
loopplay s; | |
else: | |
play s; | |
otherwise: | |
say the alt-text of s; | |
[ A low-level phrase to play a sound in loop. ] | |
To loopplay (SFX - sound name): | |
(- PlaySoundLoop(ResourceIDsOfSounds-->{SFX}); -). | |
[ A phrase to stop all sounds. ] | |
To stop the sound: | |
(- StopSound(); -). | |
[ I6 code to play in loop & stop sounds. ] | |
Include (- | |
[ PlaySoundLoop resource_ID; | |
if (resource_ID == 0) return; | |
ResourceUsageFlags->resource_ID = true; | |
if (glk_gestalt(gestalt_Sound, 0)) { | |
glk_schannel_play_ext(gg_foregroundchan, resource_ID, -1, 0); | |
} | |
]; | |
[ StopSound; | |
if (glk_gestalt(gestalt_Sound, 0)) { | |
glk_schannel_stop(gg_foregroundchan); | |
} | |
]; | |
-) | |
Section 2 - The story | |
Sound of shakira is the file "wakawaka.ogg". The alt-text of sound of shakira is "Une chanson non libre de droit OMG." | |
Demo is a room. "Go north if you'd like a silent room." | |
Silence is a room. "Quiet. Nice." | |
It is north of the demo. | |
When play begins: | |
safeplay the sound of shakira, in loop. | |
After going from the demo: | |
stop the sound; | |
continue the action. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment