Uncommon Ground

Example 454
★★

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.

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".
Test me with "look / z / look / z / look".
Mud Village
You stand at the center of a quaint mud village.

You can see Leforge and Lolita here.

>(Testing.)

>[1] look
Mud Village
You stand at the center of a quaint mud village.

You can see Leforge and Lolita here.

>[2] z
You jump bodies. Whoops!

>[3] look
Mud Village
You stand at the center of a thrilling mud village.

You can see your former self and Leforge here.

>[4] z
You jump bodies. Whoops!

>[5] look
Mud Village
You stand at the center of a squalid mud village.

You can see your former self and Lolita here.
Finit