1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-07 17:44:22 +03:00
inform7/resources/Documentation/Examples/UncommonGround.txt
2023-07-24 11:56:58 +01:00

57 lines
1.6 KiB
Plaintext

Example: ** Uncommon Ground
Location: To say one of
RecipeLocation: Viewpoint
Index: Creating our own text variations rules, part two
Description: Making a "by viewpoint" token, allowing us to design our own text variations such as "[show to yourself]quaint[to Lolita]thrilling[to everyone else]squalid[end show]" depending on the identity of the player at the moment.
For: Z-Machine
A slightly more challenging case than the "by atmosphere" example is one in which we want to create text variations depending on the identity of our player character.
What we want to do is build a switch statement in I6, one that looks something like
switch(player)
{
yourself: print "quaint";
Lolita: print "thrilling";
default: print "squalid";
}
out of I7 that looks like this:
say "[show to yourself]quaint[to Lolita]thrilling[to everyone else]squalid[end show]".
{*}"Uncommon Ground"
The Mud Village is a room. "You stand at the center of a [show to yourself]quaint[to Lolita]thrilling[to everyone else]squalid[end show] mud village."
Leforge is a man in the Mud Village. Lolita is a woman in the Mud Village.
Instead of waiting:
if the player is Lolita, now the player is Leforge;
if the player is yourself, now the player is Lolita;
say "You jump bodies. Whoops!"
To say show to (N - a person) -- beginning say_seen_by:
(-
switch(player)
{-open-brace}
{N}:
-).
To say to (N - a person) -- continuing say_seen_by:
(-
{N}:
-).
To say to everyone else -- continuing say_seen_by:
(-
default:
-)
To say end show -- ending say_seen_by:
(-
{-close-brace}
-)
Test me with "look / z / look / z / look".