Key & Compass Blog

June 4, 2023

IFOOL

Filed under: Interactive Fiction — Tags: , — davidwelbourn @ 9:32 am

IFOOL is my foolish attempt to design an IF Object Oriented Language, partly inspired by all the IF languages and systems I know about, and partly inspired by old discussions about RAIF-POOL, the imaginary universal IF language that could be used to describe any IF game, regardless of what system the author is targeting. I have no plans to actually create any compiler for this language; this is just a fun exercise.

So, as a first draft, without explaining any syntax or what my guiding principles are, here is what the IFOOL source code for “The Angel Curse” might look like:

(Apologies for the poor formatting. WordPress is determined to ignore my max-width and overflow-x CSS parameters.)


== angelcurse ("The Angel Curse") : story
.author: "David Welbourn"
.version: "Version 1"
.headline: "An interactive something for SpeedIF 19.";

== [New commands]

=== about (>: about): meta command
> $about : {
    say "The rules for SpeedIF 19 were:\nWrite a game that includes decency, a Toys-R-Us Bag of Rusty Lead-Painted Metal Bits, a cursed angel, and the phrase \"thy gills are as unclean as a lobster's arse\". Bonus points for including the darkness intrinsic to the human soul, alligators and the women who love them, or professional girls gymnastics. Sign here with URL when done.";
}

=== dance (>: dance): command
> dance around/about ==> $dance
> $dance : {
    say "You cannot dance. It pains you deeply.";
}

=== greet (>:greet/hi/hello $creature): command
.arg1_default : player

> $greet $1 : {
    if ($1 == player)
        say "Talking to yourself again?";
    else {
        say "{The $1} ignore{s} your greetings.";
    }
}

== [Altered standard commands]

> $pray [report] : say "You're not Catholic, or even Christian. You'd hardly know what to say.";


== Gym ("Gymnasium at St. Catherine's") : room (e: LowerHall)

.desc: "St. Catherine's has an excellent gymnasium for its female students, but of course it's of little use to you. The only reason you're here is because your friend Amy    practically begged you to come with her."

=== girls ("female gymnasts") (>: girls gymnasts women pro pros professional athletes female) : plural woman @ Gym

.desc: "There's several women here, including Amy, out practicing for a professional gymnastic competition in Hamburg next Spring. Looking at them fills your mind with envy and self-pity. You cannot join them, and you never will. Such emotions, you upbraid yourself, only illustrate the darkness intrinsic to the human soul. You turn away."

=== Amy ("Amy") (>: your friend amy) : named woman @ Gym

.desc: "Look at her. She's so graceful on the parallel bars. You could never do that. You can't see why she insisted you accompany her here.\n\nWell, okay. It was the decent thing to do. But she's obviously over her performance anxiety, and she's not paying any attention to you. She's too busy working with the rest of the girls."

=== wheelchair ("wheelchair") (>: wheel chair wheelchair) : open unclosable vehicle @ Gym

.desc: "Your wheelchair. You hate it. But it takes you where you need to go, so you're stuck with it."

> $go $down [test]: {
    if (player in wheelchair) {
        say "Not in your wheelchair, you're not."; done;
    }
}
> $exit $wheelchair [test]: {
    if (location != SouthHall) {
        say "No. Not here. What would be the point?"; done;
    }
}

=== player @ wheelchair
.desc: {
    if (player in wheelchair)
        say "You're a girl in a wheelchair feeling sorry for herself. So what else is new?";
    else if (player wears angel)
        say "You're a girl with broken legs, forced to crawl.";
    else
        say "You're a mermaid, until recently under a dread curse.";
}

=== angel (an "angel pendant") (>: white alabaster angel pendent pendant) : worn clothing @ player

.desc: "It's a white angel pendant made of alabaster. At least, you think it's alabaster. You're not sure where you got it from, come to think of it. It's pretty, though, and you've always worn it."

.tried_to_remove : new bool : false

> $remove $angel : {
    if (angel.tried_to_remove == falae) {
        angel.tried_to_remove = true;
        say "You try to remove the angel... uhhh...\n\nYour head hurts. You wanted to do something, but what?";
    }
    else {
        say "You can't! You can't remove the angel! Ah, the pain! Your mind reels with it.";
    }
    done;
}

=== bag ("Toys R Us bag") (>: toys r us bag sack) : closed openable container @ player

.examined : new bool : false

.desc: {
    say "Amy asked you to hold onto her bag for her. What she needed it for, you can't imagine.";
    if (bag.examined == false) {
        bag.examined = true;
        say " Amy always was a little weird. Maybe that's why she's your friend. When you're around, she probably seems almost normal by comparison.";
    }
}

== Bit (>:lead-painted lead painted metal bit) :: thing
.groupname: "lead-painted metal bits"

=== whiteBit ("jagged white bit") (>: jagged white bit) : Bit @ bag
.desc: "Ick. Looks dangerous. Someone could cut themselves with that."

=== pole ("long red hooked bit") (>:long red hooked pole) : Bit @ bag
.desc: "Kinda like a pole, with a hook at the end."

=== dagger ("shiny triangular bit") (>:shiny triangular dagger) : Bit @ bag
.desc: "\"Is this a dagger I see before me?\" Naaah."

=== coin ("small green circular bit") (>: small green circular coin) : lit Bit @ bag
.desc "This bit's rather like a coin. Except it's painted green and doesn't have a queen on it, or E Pluribus Uranium, or whatever coins are supposed to have on them."

== LowerHall ("First Floor Hallway (North End)") : room (w:Gym) (s:SouthHall)
.desc: "The hallway outside the gym is nothing special. Some trophies. The Christian cross. An aquarium of fish.    The hallway continues south, the gym is west, the chapel east, and the exit to the street is to the north."
.n: "No. You can't leave without Amy. You promised."
.e: "You peek into the chapel, but the nuns are preparing for some sort of ceremony. A funeral, maybe. Or perhaps just a normal    prayer service. You don't know why you're so gloomy today."
.unimportant: trophies trophy christian cross

=== tank (an "aquarium") (>:aquarium fish tank) : background untakeable thing @ LowerHall
.desc "You watch the fish swim about for awhile, and you feel the darkness in your soul ebb. These simple fish comfort you. Why?"

== SouthHall ("First Floor Hallway (South End)") : room
.desc: "The south end of the hallway is even less interesting than the north end, except for a sewer grating in the floor."
.n: {
    if (player in wheelchair)
        go LowerHall;
    else
        say "You should probably get back in your wheelchair, first.";
}
.d: {
    if (player in wheelchair)
        say "You'll need to leave the wheelchair, first.";
    else if (!grate.isopen)
        say "You'll need to open the grating, first.";
    else {
        say "Heedless of the risk, you push yourself into the hole, and fall...\n";
        go Sewer1;
    }
}

=== grate ("sewer grating") (>: sewer grating grate) : closed openable thing @ SouthHall
.desc: {
    say "A sewer grating in the floor. You hear something down there, something alive? Something or someone trapped? The grating is ";
    if ($grate is open) say "open."; else say "closed.";
}

> $open $grate [test]: {
    if (player !carries pole) {
        say "You'll need a tool in your hand to open the grating with."; done;
    }
}
> $open $grate [report]: {
    say "Using the long hooked bit, you manage to pry open the grating.";
}

== Sewer1 ("Sewer") : dark room
.desc: "You're in the sewer. It's dark and gloomy and smelly. But it's also cool and wet, which you don't mind so much. The hole you fell through is high above you, and the sewer extends east."
.u: "You'll never get back up there now. For better or worse, you're committed to the sewers."
.e: {
    say "You crawl, fall, further down the sewer.\n";
    go Sewer2;
}

== Sewer2 ("Deeper in the Sewer") : dark room
.desc "The water is deeper here; you can swim. But an alligator blocks further passage east."
.w: "You cannot return."
.e: {
    if (player wears angel)
        say "The alligator blocks your way.";
    else {
        say "You swim past the alligator joyfully, and swim, swim, SWIM out through the sewers, out of mankind's waterways in into the ocean...\n\n";
        say "   *    *   *\n\n";
        say "You swim to an underwater palace, where you find your father, the Merfolk King. He looks at you, unbelieving his eyes, then rushes to embrace you. When the initial shock has worn off, he takes a more critical look at you and says, \"Where hast thou been, my child? Thy gills are as unclean as a lobster's arse.\" You laugh, and hug him again.";
        win;
    }
}

=== gator ("alligator") (>: gator alligator croc crocodile): animal @ Sewer2
.desc: {
    if (player wears angel)
        say "The alligator seems a friendly sort. It grins at you with sharp, sharp teeth. You feel you can trust it. Maybe even love it. But it blocks your way east.";
    else
        say "The alligator grins at you, and moves you one side to let you pass.";
}
> $kiss $gator : {
    if (player wears angel) {
        move angel to nowhere;
        say "You give the alligator a kiss, and he snaps at you!!\n\n";
        say "No! At your angel pendant! He crushes it into powder and...\n\n";
        say "A miracle! Your broken legs become a fish's tail, and you... you are a mermaid! How? How did this happen? Who put this curse on you? And oh! Your father and mother? How long have they missed you and thought you dead?";
    }
    else
        say "You give the alligator another kiss in thanks. You will love alligators forever more.";
}

Blog at WordPress.com.

Design a site like this with WordPress.com
Get started