Sharpee: Chord

Sharpee: Chord

Now that version 2.2 of Sharpee is shipped with the website and developer manual updated, I took a swing at developing a more author friendly syntax that compiles to Sharpee. I'm calling it Chord.

It's currently implemented in a branch and working with Cloak of Darkness. It will need testing on Dungeon which implements every feature of Sharpee and has its own story-specific add-ons.

Here is what Cloak of Darkness looks like in Chord:

story "Cloak of Darkness" by "Roger Firth (Sharpee implementation)"
  id: cloak-of-darkness
  version: 1.0.0
  blurb: A basic IF demonstration - hang up your cloak!

define condition in-darkness: the player's location is dark

create the Foyer of the Opera House
  a room
  aka foyer, hall, entrance
  west to the Cloakroom
  south to the Foyer Bar
  north is blocked: cant-leave

  You are standing in a spacious hall, splendidly decorated in red and
  gold, with glittering chandeliers overhead. The entrance from the
  street is to the north, and there are doorways south and west.

create the Cloakroom
  a room
  aka cloakroom

  The walls of this small room were clearly once lined with hooks,
  though now only one remains. The exit is a door to the east.

create the Foyer Bar
  a room, dark while the player has the velvet cloak
  aka bar

  The bar, much rougher than you'd have guessed after the opulence of
  the foyer to the north, is completely empty. There seems to be some
  sort of message scrawled in the sawdust on the floor.

create the player
  starts in the Foyer of the Opera House
  wears the velvet cloak

  As good-looking as ever.

create the velvet cloak
  aka cloak
  wearable

  A handsome cloak, of velvet trimmed with satin, and slightly
  splattered with raindrops. Its blackness is so deep that it almost
  seems to suck light from the room.

create the brass hook
  aka hook, peg
  scenery, a supporter with capacity 1
  in the Cloakroom

  It's just a small brass hook, screwed to the wall.

create the message in the sawdust
  aka message, sawdust, floor, writing
  scenery
  in the Foyer Bar
  states: intact, trampled, obliterated

  on reading it
    select on its state
      when intact
        phrase message-intact
        win
      when trampled
        phrase message-trampled
      when obliterated
        phrase message-obliterated
        lose
    end select
  end on

when the player enters the Foyer Bar while in-darkness
  phrase stumble
  first time
    change the message to trampled
  third time
    change the message to obliterated
end when

define verb hang or hook means put (something) on (something)

define phrases en-US
  cant-leave:
    You've only just arrived, and besides, the weather outside seems
    to be getting worse.
  stumble:
    Blundering around in the dark isn't a good idea!
  message-intact:
    The message, neatly marked in the sawdust, reads... You have won!
  message-trampled:
    You can just make out: {garbled}
  message-obliterated:
    The message has been trampled beyond recognition. You have lost!

define text garbled from "./extras.ts"

There are core tenants for Chord that include:

  • must rely on Sharpee architecture concepts
    • Traits
    • Behaviors
    • Messages
    • Language Support
    • Phrases
    • Define and Create primary syntax constructs
    • Closed syntax for code blocks and selection criteria
  • Macro conditions for complex selection criteria
  • The stdlib must be able to be rewritten in Chord

This is a brand new endeavor and a work in progress, but it dramatically reduces the amount of effort to write a story and relies on almost entirely pseudo-code like syntax.

When I get through Dungeon, the developer manual will be split into a pure programming manual and an author's manual focused on the Chord syntax.

Subscribe to My So Called Interactive Fiction Life

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe