A sugarcube widget just saved me 12 Kb

- Posted in Coding by

I'm proud of a programming accomplishment I've made: I've been developing an introductory tutorial series covering Twine 2.10.0 and Sugarcube 2.37.3 — for an interested coworker.

I've been naming the tutorial passages after this convention:

TwineLesson001Passage001
TwineLesson001Passage002
etc.

Well, I had been using a block of Twinescript like the following in order to implement some cute back/forward navigation icons (shown below):

But I got to thinking to myself, "Self, there has to be a way to use a widget or function so that I'm not pasting the equivalent of a small paragraph in every single tutorial passage, just to implement this."

It took me awhile to incrementally write code, test, repeat to get the above. Just three lessons into a tutorial series (weighing in at 51 passages), my Twee3 file was 39 Kb. Using the above widget allowed me to trim that down to 27 Kb.

Important notes regarding Harlowe 3 programming in Twine

- Posted in Coding by

Well, I've learned an important lesson regarding menuing in Harlowe. Don't set variables inside menu passages. I've also found some resources online including Tweego templates, SugarCube templates, etc.

I've also developed some interest in learning SugarCube, but I'm not entirely sure I have the programming chops for it.

I'm spending some time looking over [this][1] often-cited introductory material on Twine.

In the current story I'm writing, I've been able to figure out how to advance the story both by clicking on links (the hallmark of Twine) and by just clicking on or tapping the screen.

Here is the Save/Load code I'm currently using:

<div id="text_centered"><small> 
    {(link-repeat:'[Save]<saverepeat|')[
        (if: (save-game:"GameSlot1"))[
            (replace: ?saverepeat)[SAVE AGAIN!]
            (dialog: "#### Save Successful!")
        ]
        (if: not (save-game:"GameSlot1"))[
            (replace: ?saverepeat)[Save... Again?]
            (dialog: "### Save Failed...", "Bummer...")
        ]
    ]
    (link-repeat:'Load')[
        (if: (savedgames:) contains "GameSlot1") [
            (dialog: "### Loaded Save", "Yay!")
            (load-game:"GameSlot1")      
    ]
  (else:)[
    (dialog: "### No Savefile!", "Ah...")
  ]
]}
</small></div>

Moldvay Saving Throws

- Posted in Scarlet-Horizons by