Lack of @import in editor? Part 2

Here's ChatGPT's best stab at making it easy to import JavaScript or curly bracket Squiffy code. It doesn't understand @set attributes. I think you have to keep JavaScript in separate .txt/.sq files from curly bracket Squiffy code, but ChatGPT will keep playing with that.

Step 1
Make .txt or .sq files. These files can each contain JavaScript or curly bracket Squiffy code. Not both, for now.

Step 2
Save your txt. or .sq files in in a zip folder. Upload it to

Step 3
Open whatever tool you use to make Squiffy games. I use the editor. put this section anywhere you want. replace the url from the @set API := line with the url that gave you. And no space before or after "/".

@set API := / {import}.txt
    var API = squiffy.get("API");
    var next = squiffy.get("next");
    .done(function (data, status, xhr) {
        try {
        } catch (e) {
            squiffy.set("error", e.message);
        try {
        } catch (e) {
    .fail(function (data, status, xhr) {
        squiffy.set("data", status);

Step 4
The following method for importing JavaScript and curly bracket Squiffy code now works:

@title Squiffy API Demo
@start Import DateTime

[[Import DateTime]]:
@set import = DateTime
@set next = English Conventions

[[English Conventions]]:
@set import = Process DateTime
@set next = test

    squiffy.set("week", Math.trunc(get("week")));

It's {hour}:{if 0=0:0}{else:‍}{minutes} {AMPM} in the {TimeOfDay} on {xday}, {Month} {datenum}{th}, week {week} of {year}.

Now if somebody wants to streamline this further, say, by

  • translating this into something story.js can understand
  • eliminating the @set next and squiffy.story.go()
  • making it possible to have JS and curly code in the same .txt/.sq

that would be very cool of them.

P.S. Some of the details won't work unless you're using Squiffy 5.1.4 by mrangel


I know you're asking for help, but I don't know much, and I actually have a question for you.

Is there a secure way to import my students' names ? I want their names to appear randomly in a game.

I guess when you publish your game you can select "Only people I give the link to." But that's still not very secure. Anybody who opens the game can still "inspect page source." I made an API of nicknames that my students chose for themselves as well as an id number that's only used in my classes. I would not recommend using any real names or identifying information. Sorry to not be more helpful.

This topic is now closed. Topics are closed after 60 days of inactivity.