4 Language Overview
vgorl edited this page 2025-07-23 13:33:14 +01:00

Writing in GromScript

GromScript is written to be a writer-friendly language for structuring branching narratives. GromScript files are structured with blocks, sections of text that together create a full narrative structure.

  • .Script blocks are the meat of GromScript, the dialogues and event sequences and player choices. Most GromScript files will be primarily taken up with these.
  • .Actor blocks define characters that can talk in dialogues and have properties attached to them to remember.
  • .Quest blocks structure a full narrative sequence, linking scripts together in sequence defined by .Stage blocks.

A basic example of a single NPC and their default script may look like this:

.Actor Gary
    FullName = Garry Gray
    Description = A happy chappy!
    Friend = false

.Script
    @Default *Gary
    Hello there [*Player]! How can I help?
        I'm looking for work.
            Ah I see. Boost your wares a bit?
            [?if *Player is Friend]
                Yeah I could get you something. Meet me after dark by the armory.
            [?else]
                Sorry, nothing I got for you.
            Good luck! [#end]
        I'm fine actually.
           See you round! [#end]

Script block syntax is made up of branches, forming a dialogue "tree". Branches often have multiple children, which indicate different directions the dialogue can go. When done with player branches, like with the lines I'm looking for work and I'm fine actually, this indicates a player choice where each of these lines will be presented as an option. When done with non-player branches, such as from line Ah I see. Boost your wares a bit? to Good luck! [#end], this indicates a sequence that will be played out in order. When done under flow control branches, such as the [?if] and [?else] lines here, this indicates some automatic check that changes the dialogue flow, rather than a player choice.