r/twinegames • • Dec 03 '25

Discussion Harlowe, Sugarcube, Chapbook - Which Story Format should you choose?

18 Upvotes

The first question for anybody starting out with Twine is most likely which story format to choose from among the various options (which most often boils down to Harlowe vs Sugarcube). Since r/twinegames is one of the first places to look for advice when it comes to this topic, we wanted to create a place that might help new creators make this decision by providing information, insights, and opinions from more seasoned Twine writers.

For those interested - here is a list of the various formats compiled by M. C. DeMarco - covering both Twine 1 and 2 story format. It should be noted that a lot of these formats are highly obscure (with a few only rumored to exist). It is also likely that the list is incomplete, or will become incomplete in the future.

Another very informative post that we'd encourage people to take a look - An in-depth comparison between Harlowe and Sugarcube by Chapel - which has been regularly updated and holds a lot of valuable information that might guide your decision.

While this comparison heavily favors Sugarcube over Harlowe - an assessment that both me and u/HiEv currently agree with - we do not want to say that Sugarcube is the only correct choice here.

One of the most important factors after all is which format feels most comfortable to work with for you personally. Both Harlowe and Sugarcube are perfectly capable of creating regular text adventures and both offer tools to tackle the common tasks you will encounter when writing your story. If you plan to include any more complex mechanics however you will want to make sure first that the format of your choice is equipped to handle it.

-

We would like to encourage other Twine creators and writers to share their own opinions and experiences. Which story format  are you currently working with? Why does it feel like the right choice for you? Are there any challenges or problems that a new creator should be aware of when picking this format?

Please keep any discussions civil and friendly. We all have our unique tastes and needs, and there is certainly no universally correct answer here.


r/twinegames • • Aug 06 '25

Useful Tool/Code/Tips!!! Warning about using ChatGPT or other LLMs to generate Twine Code!

120 Upvotes

As AI becomes more popular and integrated into our daily lives, we can see more and more people relying on it to tackle their daily problems. Many who are just starting out with Twine might also turn to an LLM of their choice to help them with coding and troubleshooting, but this sadly runs into a number of issues.

ChatGpt and similar large language models rely on a certain amount of data to give reliable information on a topic. Since there is not enough data available when it comes to Twine and its various story formats, AI will consistently give wrong or vastly misleading answers when it comes to Twine code. It will often interject overly-complicated chunks of Javascript, or mash together Code meant for two different formats for example. Even in cases where these solutions seem to be working at first, there is a high likelihood that they might produce bad errors in the long run.

Instead of relying on AI to answer your Twine-related issue, we would therefor recommend turning to the Twinegames subreddit or the Twine Discord server if you have any questions. There are many talented members of our community waiting to offer their support and knowledge.

Additionally - If you have problems with AI-generated code, and want to ask for advice on how to fix it, please consider just asking directly what you'd like to accomplish, instead of posting the broken code. Chances are it is not really fixable, and you will get faster replies and advice if you just left it out entirely.

Thanks for reading - and have fun creating your Twine-story!


r/twinegames • • 18h ago

News/Article/Tutorial Let's make a game! 532: The optimal strategy (Twine Sugarcube)

Thumbnail
youtube.com
2 Upvotes

r/twinegames • • 1d ago

Harlowe 3 Background-image not working

2 Upvotes

I started using Twine today and i wanted to make a background image for only taged paths.
i watched Videos and looked into the Twine Wiki. I did it like they said and also asked multible ais.
now i want to ask here why a can see the picture in the background of the taged paths.
here is my code for css ::

tw-story{ background-color:white;color:black;}

tw-sidebar {display:none;}

tw-story [tags~="verloren"]

{

background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Blood_splatter.svg/1200px-Blood_splatter.svg.png");

background-size:cover;

}

i all so use other images and it did not work

pls help meeeeee


r/twinegames • • 1d ago

Game/Story CEO sim, a little game I've been cooking up.

2 Upvotes

Hello! I have been working on a simple clicker style / incremental twine game called CEO simulator (Original, I know. But It's what I want it to be!)

There's not much of a STORY per se but there is a lot of buttons to click to make numbers to up.

if you'd like to give it a shot, you can play it here:

https://hereticsys.itch.io/ceo-simulator

I'd really appreciate checking it out and letting me know any glaring bugs you may see! and any positive feedback of course.


r/twinegames • • 1d ago

Game/Story SOUPIR : The bastion - Need beta testers and feedback

2 Upvotes

Playable Link: https://vivi-crazy-writer.itch.io/soupir-the-bastion

Or on android: https://drive.google.com/file/d/1sP8GLi7Nmu4sbmVvWSgu0BYqYkWgKzB9/view?usp=drive_link

Platform: web/sugar/twine

PLEASE
Any feedback would already be extremely useful.
You can also add a UP for this post to stay visible :)

Description: 
Hi everyone!

I'm currently developing SOUPIR: The Bastion, a free browser-based text RPG set in the universe of my SOUPIR novels. I already made a post long ago but i make it again here as the game has a lot of new things now.

The world has collapsed under the spread of a strange fungal ecosystem, and humanity survives inside isolated fortified settlements known as Bastions.

You arrive as a newcomer in one of them.

From there, the game is about surviving, finding your place in the city, building relationships, working, exploring, improving your skills, getting involved in local factions, and dealing with the increasingly unpleasant things happening inside and outside the walls.

The game features:

  • Character creation with different backgrounds, attributes and skills
  • A large skill and progression system
  • Jobs and daily survival
  • NPC relationships and reputation
  • Factions, politics and clandestine groups
  • Exploration and expeditions outside the Bastion
  • Dynamic events
  • A living city with different districts and activities
  • Adult themes, violence and morally difficult situations
  • Lots of choices and different ways to approach situations

The game is still under development, so I'm specifically looking for people willing to test it and give honest feedback.

You don't need to play for hours but any feedback would already be extremely useful.

The game is Free to Play

Thank you very much :)


r/twinegames • • 2d ago

Game/Story Cosmic Drink Factory

Thumbnail
theastraltourist.itch.io
2 Upvotes

I am so excited. I finally finished my second game using Twine/Sugarcube 2. I hope folks enjoy it. It is text-based with a full soundtrack which also tells the story and is entirely free to play at Itch.io.

Welcome to The Cosmic Drink Factory. Hidden deep within a luminous nebula lies a colossal interstellar facility where memories, starlight, and cosmic gases are distilled into glowing, reality-bending beverages.

Step off the deep space routes, slip into your finest lounge attire, and take a seat at the galaxy’s most surreal cosmic factory space lounge. What begins as a relaxing evening beneath chromatic auroras quickly shifts as you wander past bubbling fermentation vats, navigate unauthorized maintenance corridors, and sample experimental vintages that bend time and perception. 


r/twinegames • • 3d ago

Chapbook I prefer the reveal link to look like how this twine story does it

7 Upvotes

(beginner in twine)

So I have a lot of inspiration from With Those We Love Alive, and i want the reveal link to look like theirs, How would i go about doing this?

I am using Chapbook 2.3.1, I am unable to add two videos but the chapbook reveal link sort of just, fades out and in and with the new text added, but the previous test moves up, it is disorienting and makes it hard to follow in the way I want it to.


r/twinegames • • 3d ago

Game/Story Kate is Calling: an interactive short story

Thumbnail
bretkav.itch.io
4 Upvotes

My submission for the 20 Second Game Jam on itch. I’m quite happy with it! :)


r/twinegames • • 3d ago

News/Article/Tutorial Let's make a game! 530: Maximizing activations (Sugarcube)

Thumbnail
youtube.com
1 Upvotes

r/twinegames • • 4d ago

Chapbook Italics straight up not working, new to twine.

4 Upvotes

I have tried using the asterisk as well, same result. I have tried highlighted the text and hitting style and choosing italics, doesn't work either. i have tried playing the story from the very beginning to make sure things were loaded in, nothing :(( Idk what to do. This passage is in a reveal link context, is that why?? if so is it just that you can't use italics when you reveal a passage though a link??


r/twinegames • • 4d ago

Game/Story FINAL CUT: a text horror game about a cursed 1970s grindhouse actress (free demo, Steam Dec 7)

3 Upvotes

I made a text-driven horror game, and the demo is free to play in your browser, no download.

You play Vera Kessler, a cursed 1970s grindhouse actress trapped on an abandoned studio lot. Every wing is a different horror genre: slasher, cult, mad science, creature feature, the dead. Your choices cost something, because wounds and corruption carry from wing to wing.

The demo covers the prologue and the first wing (about 15–20 minutes). The full game is about 1.5 hours and comes out on Steam on December 7, 2026, for $7.99. I’m a solo dev and built it in Twine/SugarCube.

Demo: https://johnny-rewind.itch.io/final-cut
Steam: https://store.steampowered.com/app/5578420

I’d really like feedback on the opening: is it clear what to do, and does the dread land? Did anything feel unclear or slow?

Content note: industry exploitation, psychological horror, violence, and implied sexual assault (not shown).
AI disclosure: the background images were made with AI tools; the story, writing and design are mine.


r/twinegames • • 4d ago

SugarCube 2 Perk if statment issues

3 Upvotes

I started a side project and have been working on all the different backgrounds, player roles and perks/drawbacks. I seem to have an issue with an if statment in the perks and drawback menu. hear is the code for the perks and drawback passage.
<<if $perkSlots is undefined>>
<<set $perkSlots to 5>>
<<set $selectedPerks to \[\]>>
<<set $selectedDrawbacks to \[\]>>
<</if>>

You may choose <strong>$perkSlots</strong> perks.
Each drawback you take grants one extra perk slot.

<h3>Perks</h3>
<div class="squad-grid" id="perk-grid">
<<for _name, _data range setup.perks>>
<label>
<input type="checkbox" id="perk-_name" value="_name" <<if $selectedPerks.includes(_name)>>checked<</if>>
onchange="window.togglePerk('_name')">
<span>_name</span>
</label>
<</for>>
</div>

<div id="perk-description" class="description-box">
Select a perk to see its description.
</div>

<h3>Drawbacks</h3>
<div class="squad-grid" id="drawback-grid">
<<for _name, _data range setup.drawbacks>>
<label>
<input type="checkbox" id="drawback-_name" value="_name" <<if $selectedDrawbacks.includes(_name)>>checked<</if>>
onchange="window.toggleDrawback('_name')">
<span>_name</span>
</label>
<</for>>
</div>

<div id="drawback-description" class="description-box">
Select a drawback to see its description.
</div>

<div id="perk-feedback" style="margin:1em 0; min-height:1.5em;"></div>

<<link "Confirm Perks & Drawbacks">>
<<if $selectedPerks.length > $perkSlots>>
<<replace "#perk-feedback">>
<span style="color:#ff5555;">You have selected too many perks. You only have $perkSlots slots.</span>
<</replace>>
<<elseif $selectedPerks.length < $perkSlots>>
<<replace "#perk-feedback">>
<span style="color:#ffaa55;">You still have unused perk slots ($selectedPerks.length / $perkSlots).</span>
<</replace>>
<<else>>
/* Apply all bonuses and penalties */
<<for _perk range $selectedPerks>>
<<set _data to setup.perks\[_perk\]>>
<<for _stat, _val range _data.bonuses>>
<<set State.variables\[_stat\] += _val>>
<</for>>
<</for>>

<<for _draw range $selectedDrawbacks>>
<<set _data to setup.drawbacks\[_draw\]>>
<<for _stat, _val range _data.penalties>>
<<set State.variables\[_stat\] += _val>>
<</for>>
<</for>>

<<set $perksConfirmed to true>>
<<goto "Next Passage">>
<</if>>
<</link>>

<<done>>
<<script>>
window.togglePerk = function(name) {
var perks = State.variables.selectedPerks;
var index = perks.indexOf(name);
var data = setup.perks[name];

if (index === -1) {
// Check incompatibilities
var blocked = false;
var reason = "";
if (data.incompatible) {
for (var i = 0; i < data.incompatible.length; i++) {
if (State.variables.selectedDrawbacks.includes(data.incompatible[i]) ||
State.variables.selectedPerks.includes(data.incompatible[i])) {
blocked = true;
reason = data.incompatible[i];
break;
}
}
}
if (blocked) {
$('#perk-feedback').html('<span style="color:#ff5555;">Incompatible with ' + reason + '.</span>');
$('#perk-' + name).prop('checked', false);
return;
}
if (perks.length >= State.variables.perkSlots) {
$('#perk-feedback').html('<span style="color:#ff5555;">No free perk slots remaining.</span>');
$('#perk-' + name).prop('checked', false);
return;
}
perks.push(name);
} else {
perks.splice(index, 1);
}

// Update description
var html = '<strong>' + name + '</strong><br>' + data.desc;
if (data.bonuses) {
html += '<div class="squad-bonuses"><strong>Bonuses:</strong><br>';
for (var s in data.bonuses) {
var v = data.bonuses[s];
html += s + ': ' + (v >= 0 ? '+' : '') + v + '<br>';
}
html += '</div>';
}
$('#perk-description').html(html);
$('#perk-feedback').html('Perks selected: ' + perks.length + ' / ' + State.variables.perkSlots);
};

window.toggleDrawback = function(name) {
var draws = State.variables.selectedDrawbacks;
var index = draws.indexOf(name);
var data = setup.drawbacks[name];

if (index === -1) {
// Check incompatibilities
var blocked = false;
var reason = "";
if (data.incompatible) {
for (var i = 0; i < data.incompatible.length; i++) {
if (State.variables.selectedPerks.includes(data.incompatible[i]) ||
State.variables.selectedDrawbacks.includes(data.incompatible[i])) {
blocked = true;
reason = data.incompatible[i];
break;
}
}
}
if (blocked) {
$('#perk-feedback').html('<span style="color:#ff5555;">Incompatible with ' + reason + '.</span>');
$('#drawback-' + name).prop('checked', false);
return;
}
draws.push(name);
State.variables.perkSlots += 1;
} else {
draws.splice(index, 1);
State.variables.perkSlots -= 1;
// Trim excess perks if needed
while (State.variables.selectedPerks.length > State.variables.perkSlots) {
var removed = State.variables.selectedPerks.pop();
$('#perk-' + removed).prop('checked', false);
}
}

var html = '<strong>' + name + '</strong><br>' + data.desc;
if (data.penalties) {
html += '<div class="squad-bonuses"><strong>Penalties:</strong><br>';
for (var s in data.penalties) {
var v = data.penalties[s];
html += s + ': ' + (v >= 0 ? '+' : '') + v + '<br>';
}
html += '</div>';
}
$('#drawback-description').html(html);
$('#perk-feedback').html('Perk slots: ' + State.variables.perkSlots + ' (drawbacks taken: ' + draws.length + ')');
};
<</script>>
<</done>>


r/twinegames • • 8d ago

Harlowe 3 Hiding hover text/tooltip

3 Upvotes

Hey there! I'm working on a Twine game in Harlowe 3.3.9 and I want to be able to disable/hide the text that appears next to the cursor when it hovers over a link in my game. I'm trying to immerse the player by simulating and old computer, but it doesn't feel as natural when every time you hover over a link text appears saying [[Passage x->Passage y]].

Ideally, I want to be able to type something into my stylesheet that does this for all of the links in my game.


r/twinegames • • 7d ago

News/Article/Tutorial Let's make a game! 528: Ruling elements (Twine Sugarcube)

Thumbnail
youtube.com
1 Upvotes

r/twinegames • • 8d ago

Game/Story Dominion of Darknes - 3rd most popular Twine game on itch.io

8 Upvotes

A friend of mine, who doesn't have a Reddit account, asked me to post this.

My game, the RPG/strategy title Dark Lord Simulator: Dominion of Darkness (adeptus7.itch.io/dominion), has just reached 3rd place on the list of the most popular games created with Twine and published on itch.io: itch.io/games/made-with-twine

Thank you so much to everyone who played, commented, and rated!

"Dominion of Darkness” is a strategy/RPG text-based game in which the player takes on the role of a Sauron-style Lord of Darkness with the goal of conquering the world. He will carry out his plans by making various decisions. He will build his army and send it into battles, weave intrigues and deceptions, create secret spy networks and sectarian cults, recruit agents and commanders, corrupt representatives of Free Peoples and sow discord among them, collect magical artifacts and perform sinister plots. Note – one game takes about 1 hour, but the premise is that the game can be approached several times, each time making different decisions, getting different results and discovering something new.

If anyone is interested in collaborating with me—whether on joint development or marketing (I can share my experience and channels useful for promoting games of this type) please get in touch at [marekzegarek77777@gmail.com](mailto:marekzegarek77777@gmail.com)


r/twinegames • • 9d ago

SugarCube 2 use a variable as span id used in replace

3 Upvotes

Hi!

I'd like to use a variable as a span id, that will be targeted by a replace. It doesn't work so far. Is it possible?

This works (without variable):

<span id="oi">Oi!!</span>
<<link "clicky!">><<replace "#oi">>ow<</replace>><</link>>

This doesn't (exact same but with a variable) ("private names aren't valid in this context"):

<<set $ouch to "ouch">>
<span id=$ouch>ouch</span>
<<link "clicky!">><<replace `#$ouch`>>ow<</replace>><</link>>

This doesn't either (same too but a different way to set the variable) ("no element matched selector"):

<<set $heyWord to "hey">>
<<set $hey to "#" + $heyWord>>
<span id=$heyWord>hey!!</span>
<<link "clicky!">><<replace $hey>>ow<</replace>><</link>>

This works, so I assume the issue is with the span and not with the replace:

<<set $wowWord to "wow">>
<<set $wow to "#" + $wowWord>>
<span id="wow">Wowwww...</span>
<<link "clicky!">><<replace $wow>>ow<</replace>><</link>>

Is there a solution?

(I'm trying to generate this block with a widget, and pass the widget the value of the var that will be used as span id; I could just type it all out every time I need it - and will if there's no other solution - but I was looking for a more convenient way to do it)


r/twinegames • • 10d ago

SugarCube 2 How do you handle passage-level state in SugarCube without it getting unmanageable?

4 Upvotes

I'm working on something where every choice can be gated on a variable ("only show this if the lamp is lit"), and at ~40 passages the list of conditions becomes impossible to keep in your head. Do you keep a state map? Name things in a convention? Or just accept that you can't see it and test your way through?

Also: does anything in Twine warn you when a gate can never open — i.e. no path to that passage satisfies its condition? That's the specific thing I keep getting wrong.


r/twinegames • • 10d ago

News/Article/Tutorial Let's make a game! 527: Playtesting (Sugarcube)

Thumbnail
youtube.com
1 Upvotes

r/twinegames • • 11d ago

General HTML/CSS/Web Favorite learning resource for JavaScript?

7 Upvotes

I'm new to making twine games. I've been comfortable with HTML and CSS for years, but struggle to get the fundamentals of JavaScript to stick. What's your favorite resource for gaining "literacy" in JavaScript? I want to be able to know how it works so I can understand its limitations and logic so I can creatively use it better.


r/twinegames • • 11d ago

SugarCube 2 JavaScript help.

2 Upvotes

I was working on creating a shopping bag in my game that would make it so the players items wouldn't magically appear in there home inventory if they bought more then there bag could hold. eventuallly I decided to remove that feature for now since it was giving me to many issues. now all of my JavaScript is broken. even in places that were at the top of the javaScript and nowhere near where I was working. the code say unexpected token } and setup.syncDayPart

at first it was saying there was a time code error so I tried fixing things here first.

setup.dayPart = ["morning", "afternoon", "evening", "night"];

setup.getDayPart = function (d) {

`if (!(d instanceof Date)) return 0;`

`const h = d.getHours();`

`if (h >= 6 && h < 12) return 0;   // morning`

`if (h >= 12 && h < 17) return 1;  // afternoon`

`if (h >= 17 && h < 21) return 2;  // evening`

`return 3;                         // night`

};

window.getDayName = function (d) {

`if (!(d instanceof Date)) return "Unknown";`

`return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][d.getDay()];`

};

window.formatGameDate = function (d) {

`if (!(d instanceof Date)) return "Invalid Date";`

`return d.toLocaleString("en-US", {`

    `weekday: "long",`

    `year: "numeric",`

    `month: "numeric",`

    `day: "numeric",`

    `hour: "numeric",`

    `minute: "2-digit"`

`});`

};

setup.syncDayPart = function () {

`if (!(State.variables.gameDate instanceof Date)) {`

    `State.variables.gameDate = new Date();`

`}`

`State.variables.gameTime = setup.getDayPart(State.variables.gameDate);`

};

this is where I was working which is right under the time code

setup.backpacks = {

hiking: {

id: "hiking",

name: "Hiking Pack",

img: "images/backpacks/hiking.png",

compartments: {

Shirts: { name: "Shirts", slots: 8 },

Pants: { name: "Pants", slots: 8 },

Bra: { name: "Bra", slots: 4 },

Panties: { name: "Panties", slots: 6 },

Socks: { name: "Socks", slots: 6 },

Shoes: { name: "Shoes", slots: 2 },

Glasses: { name: "Glasses", slots: 2 },

Hat: { name: "Hat", slots: 2 },

Gloves: { name: "Gloves", slots: 2 },

Pills: { name: "Pills", slots: 500 },

Boosters: { name: "Boosters", slots: 10 },

Toys: { name: "Toys", slots: 5 },

Jewelry: { name: "Jewelry", slots: 10 },

Firearm: { name: "Firearm", slots: 2 },

Items: { name: "Items", slots: 10 }

}

}

};

setup.items = {

shirt_white: { id: "shirt_white", name: "White Shirt", type: "Shirts", size: 1 },

pants_jeans: { id: "pants_jeans", name: "Jeans", type: "Pants", size: 1 },

bra_plain: { id: "bra_plain", name: "Plain Bra", type: "Bra", size: 1 },

panties_plain:{ id: "panties_plain",name: "Plain Panties",type: "Panties", size: 1 },

socks_white: { id: "socks_white", name: "White Socks", type: "Socks", size: 1 },

shoes_sneakers:{id:"shoes_sneakers",name:"Sneakers", type: "Shoes", size: 1 },

glasses_sun: { id: "glasses_sun", name: "Sunglasses", type: "Glasses", size: 1 },

hat_cap: { id: "hat_cap", name: "Cap", type: "Hat", size: 1 },

gloves_work: { id: "gloves_work", name: "Work Gloves", type: "Gloves", size: 1 },

"Pink Basic": { id: "Pink Basic", name: "Pink Basic", type: "pills", size: 1 },

"Basic Blue": { id: "Basic Blue", name: "Blue Basic", type: "pills", size: 1 },

"Pink Xtra Strength": { id: "Xtra Strength Pink", name: "Pink Xtra Strength", type: "pills", size: 1 },

"Xtra Strength Blue": { id: "Xtra Strength Blue", name: "Xtra Strength Blue", type: "pills", size: 1 },

"Weekend Pink": { id: "Pink Weekend", name: "Weekend Pink", type: "pills", size: 1 },

"Weekend Blue": { id: "Weekend Blue", name: "Blue Weekend", type: "pills", size: 1 },

"Pink Plus": { id: "Plus Pink", name: "Pink Plus", type: "pills", size: 1 },

"Blue Plus": { id: "Plus Blue", name: "Blue Plus", type: "pills", size: 1 },

"Pink Choice": { id: "Choice Pink", name: "Pink Choice", type: "pills", size: 1 },

"Choice Blue": { id: "Choice Blue", name: "Blue Choice", type: "pills", size: 1 },

"Breeder": { id: "Breeder", name: "Breeder", type: "pills", size: 1 },

"Oral": { id: "Oral", name: "Oral", type: "pills", size: 1 },

"Anal": { id: "Anal", name: "Anal", type: "pills", size: 1 },

"Heat": { id: "Heat", name: "Heat", type: "pills", size: 1 },

"Bimbo": { id: "Bimbo", name: "Bimbo", type: "pills", size: 1 },

"Bimbo Weekend": { id: "Bimbo Weekend", name: "Bimbo Weekend", type: "pills", size: 1 },

"Bimbo Week": { id: "Bimbo Week", name: "Bimbo Week", type: "pills", size: 1 },

"Bimbo Xtra Strength": { id: "Bimbo Xtra Strength", name: "Bimbo Xtra Strength", type: "pills", size: 1 },

"Bimbo Plus": { id: "Bimbo Plus", name: "Bimbo Plus", type: "pills", size: 1 },

"Resistance": { id: "Resistance", name: "Resistance", type: "pills", size: 1 },

"Cum-Cure": { id: "Cum-Cure", name: "Cum-Cure", type: "pills", size: 1 },

"Show-Off": { id: "Show-Off", name: "Show-Off", type: "pills", size: 1 },

booster_energy: { id: "booster_energy", name: "Energy Booster", type: "Boosters", size: 1 },

toy_basic: { id: "toy_basic", name: "Toy", type: "Toys", size: 1 },

ring_silver: { id: "ring_silver", name: "Silver Ring", type: "Jewelry", size: 1 },

pistol: { id: "pistol", name: "Pistol", type: "Firearm", size: 1 },

flashlight: { id: "flashlight", name: "Flashlight", type: "Items", size: 1 }

};

setup.makeEmptyPack = function (packId) {

var def = setup.backpacks[packId];

var pack = { id: packId, compartments: {} };

Object.keys(def.compartments).forEach(function (key) {

pack.compartments[key] = [];

});

return pack;

};

setup.usedSlots = function (list) {

if (!list) return 0;

return list.reduce(function (n, it) { return n + (it.size || 1); }, 0);

};

setup.canAddToComp = function (pack, comp, item) {

if (!pack || !pack.compartments || !pack.compartments[comp]) return false;

var def = setup.backpacks[pack.id];

if (!def || !def.compartments[comp]) return false;

var max = def.compartments[comp].slots;

return setup.usedSlots(pack.compartments[comp]) + (item.size || 1) <= max;

};

setup.addToStorage = function (itemId, qty) {

qty = qty || 1;

var storage = State.variables.storage;

var found = storage.find(function (it) { return it.id === itemId; });

if (found) found.qty += qty;

else storage.push({ id: itemId, qty: qty });

};

setup.takeFromStorage = function (itemId, qty) {

qty = qty || 1;

var storage = State.variables.storage;

var found = storage.find(function (it) { return it.id === itemId; });

if (!found || found.qty < qty) return false;

found.qty -= qty;

if (found.qty <= 0) {

State.variables.storage = storage.filter(function (it) { return it.id !== itemId; });

}

return true;

};


r/twinegames • • 11d ago

SugarCube 2 debugging / editing tool that autoplays the story and 1) prints a random run in order and 2) counts passages frequency over several runs

6 Upvotes

Hi!

Here is an editing / debugging tool for twine that:

- checks if your narration is fluid (by exporting all the text shown when playing one random run)
- quickly checks if you have loops or unreachable passages (by counting how many times we go to each passage over several randomized games)

https://github.com/Falano/Twine_AutoPlayerTool/

You need to 1) copy the code (from the .js file) in the 'Story Javascript' window in twine and start the game ('play' button), 2) then in the browser open the inspector (F12) and go to the console, and type: AutoPlayer.run() or AutoPlayer.run(5) , for example. With a number it prints passage titles and their frequency, without it prints the text of the passages in a linear way.

- don't hesitate to make suggestions if you see ways to make it better (I might or might not update it depending on how motivated I feel)
- don't hesitate to use it!

Expanded from base code by u/juipor, and used suggestions from u/HiEv and u/apeloverage

PS: I added the "tuto" flair as it falls into "useful stuff" even though it's not really a tuto. Hope it's the right flair, don't hesitate to change it if necessary, mods.


r/twinegames • • 13d ago

News/Article/Tutorial Let's make a game! 525: Charge or wander? (Sugarcube)

Thumbnail
youtube.com
2 Upvotes

r/twinegames • • 14d ago

Harlowe 3 Trying to keep variables consistently random.

Thumbnail
gallery
6 Upvotes

I'm making a very simple game for an assignment, and I want certain text in the story to constantly change.

However, I want each of these text items to, at any given time, be the same when looked at side by side.

The problem is that because Harlowe stores code as a variable, each instance of the variable is different to one another.

Any way to rectify this would be appreciated.


r/twinegames • • 15d ago

Harlowe 3 Stuck with line breaks for invisible code.

Thumbnail
gallery
5 Upvotes

I am trying to make the line breaks disappear from hidden code, once a user selection has been made.

You can see in the before/after screenshots that there are two sections, both with four possible choices. Selecting one from each section sets a variable and makes the rest of the choices disappear from view. However, I would like the 'invisible code' gap to disappear completely.

The (display:) command at the end of each line was the only way I could work out how to show the selectable options (via a separate passage), make the others options turn invisible and simultaneously set the variable.

 Maybe there is a more elegant way to do this?

What pronoun do you use?
[(link:"Miss")[(replace:?pronoun)(display:"Miss") ]
(link:"Mrs")[(replace:?pronoun)(display:"Mrs") ]
(link:"Mr")[(replace:?pronoun)(display:"Mr") ]
(link:"Mx")[(replace:?pronoun)(display:"Mx") ] ]<pronoun|
 
The physical feature that you are most self concious of is...
...[(link:"your feet being different sizes.")[(replace:?feature)(display:"feature-feet") ]
...(link:"the scar on your forehead that usually makes children think you are a boy wizard.")[(replace:?feature)(display:"feature-scar") ]
...(link:"your large Adam’s Apple.")[(replace:?feature)(display:"feature-apple") ]
...(link:"your strangely thin wrists.")[(replace:?feature)(display:"feature-wrists") ] ]<feature|
 
[[Next page->Next page test]]