paddockBox = Box( uid="1", label="Box I", description="in the paddock breeding horses") altarBox = Box( uid="2", label="Box II", description="Before the altars of the gods") seaBox = Box( uid="3", label="Box III", description="Looking out to sea") agnostic.collect() entranceBox = paddockBox incrementTime = SackChange( plus={ "hours":1 } ) # populate with passages ThroughPage( uid="firstLanding", goalBoxUid=entranceBox.uid, page=introText, nextNodeUid="landing", ) ThroughSequence( uid = "landing", change = SackChange( reset=story.startSack ), goalBoxUid = paddockBox.uid, nextNodeUid = "yardArrive", #23456789012345678901234 sequence = [ """You are stationed at the coastal fort of Senhouse You watch for attack
materials, tools and inspiration to complete the tombstone.""", """ You have an advance of {{sack.money}} Denarii for materials. Spend it wisely!""", ], ) #1b Blacksmith am/pm ThroughPage( uid="smith1", missTemplate="This isn't the blacksmith! {{node.goalBox.label}}", page= "You walk across the fort to the blacksmith's workshop. The sign says 'Half day opening today'.", goalBoxUid=smithBox.uid, nextNodeUid="sharpening", ) ConditionFork( uid="sharpening", condition="sack.afternoon == True", trueNodeUid="sharpeningSuccess", falseNodeUid="sharpeningFailure", ) ThroughSequence( uid="sharpeningSuccess", goalBoxUid=smithBox.uid, nextNodeUid="sharpened",
""" Your clerk tells you that ARBEIA, CHESTERS & HOUSESTEADS have sent messengers. Meet them at Box I.""", ], ) # TRADE FORK 1 # 23456789x123456789x1234 ThroughPage( uid="message1", page=""" You make your way to the other side of the fort where the messengers are waiting. They ask you to send...""", goalBoxUid=messageBox.uid, nextNodeUid="tradeFork1", ) # 23456789x123456789x1234 NodeFork( uid="tradeFork1", choices={ "arbeia1": """ Horses to ARBEIA """, "corbridge1": """ Weapons to CHESTERS """, "housesteads1": """ Cavalrymen to HOUSESTEADS """,
) ConditionFork( uid= "workshopArrive", change = SackChange( plus={"hours":2} ), condition = "sack.sharp or sack.smithAnger >= 3", falseNodeUid = "workIntro", trueNodeUid = "ending", ) ThroughPage( uid= "workIntro", missTemplate = "To begin work go to {{node.goalBox.label}}", page = "You are in your workshop. It's early in the morning but you don't have long to complete the tombstone.", goalBoxUid = workshopBox.uid, nextNodeUid = "work", ) NodeFork( uid = "work", choices = { "sharpening": "Get your tools sharpened at the blacksmith", "stone": "Go outside to order stone from the quarry", "inspiration": "Look for inspiration" }, hideChoices = { "sharpening": "sack.sharp==True", "stone": "sack.stone==True", },
homeBox = Box( uid="1", label="Box I", description="at Jack's Mother's house") roadBox = Box( uid="2", label="Box II", description="on The Road To Market") beanstalkBox = Box(uid="1", label="Box III", description="beanstalkBox") # An extra thing to implement some time passing incrementTime = SackChange( plus={"hours":1} ) # A ThroughPage is a node with a uid and you can use operators to # interact with the Sack ThroughPage( uid="landing", change=SackChange( reset=story.startSack ), time = incrementTime, page="Jack, you've fallen on hard times, you need to sell the cow", goalBoxUid = homeBox.uid, nextNodeUid = "sellcow" ) ThroughPage( uid="sellcow", time=incrementTime, change = SackChange( assign={"beans":True} ), missTemplate="Go to {{node.getGoalBox(story).label}} to sell the cow", page="You sold the cow for a handful of beans", goalBoxUid = homeBox.uid, nextNodeUid = "house"
) ConditionFork( uid="stores0", condition="sack.dung == True or sack.water == True", trueNodeUid="rest1", falseNodeUid="stores1", ) # 123456789012345678901234 ThroughPage( uid="stores1", missTemplate=""" This isn't the storeroom! Go to {{node.goalBox.label}}""", page=""" You let yourself into the storeroom. It's dark and musty in here. You find a note with today's list of jobs waiting for you.""", goalBoxUid=storesBox.uid, nextNodeUid="storesFork1", ) # 123456789012345678901234 NodeFork( uid="storesFork1", choices={ "dung1": """ Get your broom and clean the stables""", "water1": """ Collect water from the well""", },
with story: # populate with boxes fortBox = Box(uid="1", label="Box I", description="the Fort") gateBox = Box(uid="2", label="Box II", description="the Arena Gates") arenaBox = Box(uid="3", label="Box III", description="the Arena") garrisonBox = Box(uid="4", label="Box IV", description="the Garrison") entranceBox = fortBox #Intro ThroughPage( uid="firstLanding", goalBoxUid=entranceBox.uid, page=introText, nextNodeUid="landing", ) ThroughSequence( uid="landing", change=SackChange(reset=story.startSack), goalBoxUid=fortBox.uid, nextNodeUid="mask1", sequence=[ """ You are Grecus Turmaerious, a member of the Super Turma Cavalry Troop, Favoured by the God Epona!
from milecastles import Story, Box, ThroughPage # inspects the module to figure out the story name (e.g. corbridge) storyName = __name__.split(".")[-1] # create story story = Story(uid=storyName, startNodeUid="landing", startSack={}) with story: marketBox = Box(uid="1", label="Box I", description="the Market") workshopBox = Box(uid="2", label="Box II", description="the Workshop") tombBox = Box(uid="3", label="Box III", description="the Tomb") quarryBox = Box(uid="4", label="Box IV", description="the Quarry") ThroughPage(uid="landing", ) ThroughPage(uid="ending", ) def run(): from regimes.console import ConsoleSiteEmulator emulator = ConsoleSiteEmulator(story=story) emulator.run() if __name__ == "__main__": run()
#23456789012345678901234 NodeFork( uid="stableFork", choices={ "food1": """ Collect horse food from the South Gate""", "recon1": """ Go to the West Gate to survey the land""", }, ) ThroughPage( uid="food1", page=""" You collect a bale of hay from the supply hut. CARRY THE HAY back to the stable to feed your horse.""", goalBoxUid=battleBox.uid, nextNodeUid="food2", ) #23456789012345678901234 ThroughPage( uid="food2", change=SackChange(plus={"horseFat": 40}, ), page=""" Back at the stable, Your horse munches greedily. The horse's stomach is now {{node.change.plus['horseFat']}}% full.""", goalBoxUid=stablesBox.uid, nextNodeUid="stables2",
}) with story: # populate with boxes smithBox = Box(uid="1", label="Box I", description="the Blacksmith") workshopBox = Box(uid="2", label="Box II", description="the Workshop") tombBox = Box(uid="3", label="Box III", description="the Tomb") quarryBox = Box(uid="4", label="Box IV", description="the Quarry") entranceBox = smithBox # BOX I # 1a - intro / landing ThroughPage( uid="firstLanding", goalBoxUid=entranceBox.uid, page=introText, nextNodeUid="landing", ) ThroughSequence( uid="landing", change=SackChange(reset=story.startSack), goalBoxUid=smithBox.uid, nextNodeUid="workshop1", sequence=[ """ You are a stonemason working at the military base at Corbridge...""", """ Your quest is to get materials, tools and inspiration to complete
"money": 100, } ) # populate passages and boxes with story: northBox = Box( uid="north", label="Box I", description="the Northern Quarter") eastBox = Box( uid="east", label="Box II", description="the Eastern Promise") southBox = Box( uid="south", label="Box III", description="the Southern White House") westBox = Box( uid="west", label="Box IV", description="the Wild West") # create a beginning passage which points to the end passage ThroughPage( uid="landing", goalBoxUid=northBox.uid, page="Welcome to Milecastles.", nextNodeUid="ending" ) # create an ending passage for the story ThroughPage( uid="ending", goalBoxUid=southBox.uid, page="You have finished your adventure", nextNodeUid="landing" ) def run(): from regimes.console import ConsoleSiteEmulator emulator = ConsoleSiteEmulator(story=story) emulator.run()