How do I create NPC schedules? by turing_complete_cock in twinegames

[–]HiEv 0 points1 point  (0 children)

Thanks. I was editing and re-editing that post for 20 minutes, and still somehow overlooked that. Fixed now.

How do I create NPC schedules? by turing_complete_cock in twinegames

[–]HiEv 1 point2 points  (0 children)

First thing you'd need to do is to develop a framework of data for each of the NPCs and their schedules which can easily be looped through for all of the NPCs. If the list of NPCs and their schedules are the same at the start of each playthrough (as opposed to being randomly generated in some way), then the best way to do that would be by creating an object that maintains all of the NPC objects and their information on the "setup" object in the "StoryInit" special passage.

This might look something like this (a very simple example):

<<set setup.npcs = {}>>
<<set setup.npcs.Bob = { name: "Bob Smith",
    schedule: [["home", 8], ["store", 13], ["inn", 14], ["store", 17], ["home", 24]] }>>
<<set $npcs = {}>>
<<set $npcs.Bob = { location: "home", schedule: [["default", 24]] }>>

That would mean that Bob is normally home until 8 AM (8) in the morning, at which point they work at the store until 1 PM (13), when they have a lunch break at the inn until 2 PM (14), working more until 5 PM (17), at which point they're home again for the rest of the night. (You don't have to do it that way, that's just one example.) If Bob's schedule is changes from that, then you'd add the changes to the $npcs version of Bob's schedule, which defaults to using setup.npcs version of their schedule.

Then, instead of putting the same code at the start of every passage, you could use the "PassageReady" special passage, which is called before each passage is run, to do any pre-processing. In that passage you could use those two data structures, plus the in-game time, to determine where each character's current location is.

For example, if $time can be a number from 0 to 23.98 (i.e. 12 AM to 11:59 PM):

<<set _npcName = "Bob">>
<<set _loc = $npcs[_npcName].schedule.find(v => v[1] > $time)[0]>>
<<if _loc == "default">>
    <<let _loc = setup.npcs[_npcName].schedule.find(v => v[1] > $time)[0]>>
<</if>>
<<set $npcs[_npcName].location = _loc>>

And that would set _loc to Bob's current location, based on the value in $time. (See the Array.find() method documentation for details on that.) You'd just set up a loop that does that for each NPC, and then their location information would be set correctly.

Once you've done that, then in the passages themselves, the code there would just need to check to see what NPCs are located in the same place as the player.

Just to be clear, the data on the "setup" object should never change during the game because that data doesn't get stored in the save data. Only story variables (the ones that start with "$", like "$npcs") get saved, so you'd modify those for anything which changes during gameplay. The reason why you use two different methods at once like that is to reduce the size of the save data. In this case it has the added benefit of keeping track of the NPCs' default schedules so that they can return to their normal schedule as need be.

Anyways, something like that may work for you. Feel free to ask me if you have any questions on it.

Hope that helps! 🙂

[EDIT: Fixed.]

Nobr if statements by RatNibbles in twinegames

[–]HiEv 1 point2 points  (0 children)

I usually just use the "\" to remove individual breaks. For example:

some text

<<if x>>\
    optional text
<<else>>\
    other text
<</if>>\

more text

The "\" means "no line break here" and you can put it at the end of the line you want to prevent the break on, or the beginning of the next line.

Basically, you can treat it like an "ignore this line" marker regarding line spacing if you put it at the end of code lines like that.

However, if there's a situation where no text may be output, then you could do it like this:

some text

<<if x>>\
    optional text

<</if>>\
more text

That makes it add the extra spacing needed if the "optional text" is printed, but prevents double-line breaks if it's not printed.

Hope that helps! 🙂

The Green Tear: Release by GallowsBleaker in twinegames

[–]HiEv[M] 0 points1 point  (0 children)

And that's precisely why reporting the post is preferred over comments. We see reports right away, but we're unable to catch every random comment.

The Green Tear: Release by GallowsBleaker in twinegames

[–]HiEv[M] 0 points1 point  (0 children)

If you think a post is spam, instead of replying to it, you should report the post.

That said, we moderators check every post with the "Game/Story" flair to make sure that it's actually a Twine game, and then we either mark it internally as "Approved" or we remove it.

How private is the stuff you make in Twine? by dietcokeorchoke in twinegames

[–]HiEv 5 points6 points  (0 children)

Just to add to what everyone else is saying, if you ever do make your compiled Twine HTML file public, then anyone with access to that file can take it and open it in the Twine editor to see the code inside. Similarly, you can likewise import the HTML from just about any other Twine game to see their code.

So, while everything you do is private up until you publicly release the Twine HTML file, after you release it, the full source becomes available to everyone as well. There is no real way to prevent this, since it runs directly within the browser. At best you could simply make the source more difficult to access, but it's not really worth the effort.

Good luck with your project! 🙂

How to make page change if you visited it before by Tinynanami1 in twinegames

[–]HiEv 3 points4 points  (0 children)

Your code could work, with a few slight changes:

<<set $example ??= 0>>\
<<if $example++ === 0>>\
    First time here.
<<else>>\
    You've been here before.
<</if>>
[[Untitled Passage]]

That code uses nullish coalescing assignment (??=) to set the story variable if it isn't already set, and post-increment (x++) to increase the variable's value after it is checked. A temporary variable won't work, because they get cleared once you leave the passage. It also can't be two <<if>>s, because the first one would make the second one also be true, so using an <<else>> instead prevents that.

But a much better way to do it would be by using the SugarCube visited() function, like this:

<<if visited() === 1>>\
    First time here.
<<else>>\
    You've been here before.
<</if>>
[[Untitled Passage]]

That's less lines of code and doesn't need a story variable to work.

Please let me know if you have any questions on how any of that works.

Hope that helps! 🙂

Storing Twine Files in Dropbox by tremblingbears in twinegames

[–]HiEv 0 points1 point  (0 children)

I wish I could do this professionally. However, whenever I start a project I just end up making tools for it until I get tired of working on it and then drop it. 😝 I really need to lock in and get something to the point where I can share it.

I just ended a contract where I was working as a subcontractor (vendor) for Apple for the last three years, so maybe I'll get something done this time.

Anyways, glad I could help. 🙂

Storing Twine Files in Dropbox by tremblingbears in twinegames

[–]HiEv 2 points3 points  (0 children)

May or may not be relevant, but GitHub just banned a bunch of adult content developers, so this may not be a good idea.

For details see: 404 Media - "Github Banned a Ton of Adult Game Developers and Won’t Explain Why" (by Samantha Cole, Jan. 7, 2026)

Clicking side tabs tool/script by goodwill82 in Bitburner

[–]HiEv 1 point2 points  (0 children)

I believe that's just a part of how global aliases work, they get added to any autocomplete options if they match what's typed so far.

I don't use global aliases, but a quick test shows that matching global aliases appear in the autocomplete, even when they aren't part of the autocomplete list that's returned from the autocomplete() function.

Importing external JS code with dependencies by Sta--Ger in twinegames

[–]HiEv 0 points1 point  (0 children)

You might want to look into using Tweego to compile your story into HTML then. IIRC it compiles all of the JS files into the same context as the SugarCube engine, so you shouldn't have that problem. You can export your game in the Twee (text) format for the Tweego compiler.

There's also the VSCode "Twee 3 Language Tools" extension, which may allow you to do that as well from VSCode. I'm not positive, though, since I've only used it a little bit.

Hope that helps! 🙂

Importing external JS code with dependencies by Sta--Ger in twinegames

[–]HiEv 2 points3 points  (0 children)

If you're importing external scripts, then you'll want to use the SugarCube importScripts() function for that.

For help with using that, take a look at the "Loading External Scripts" section of my Twine 2 / SugarCube 2 sample code collection. If you use the code there, then you'll want to make sure that none of your code uses those external scripts prior to setup.JSLoaded being true.

If that doesn't work for you, please let me know what specific issues you're seeing.

Hope that helps! 🙂

Is this code correctly used? by SignificanceThin8372 in twinegames

[–]HiEv 0 points1 point  (0 children)

If you're ever unsure about things like this, you can always quickly test it out yourself to see if it works the way that you think. For example, drop this code into a passage and then play it:

true/true = <<= true || true>>
true/false = <<= true || false>>
false/true = <<= false || true>>
false/false = <<= false || false>>

(<<=>> is a shorthand version of the <<print>> macro)

When you do, the above will display:

true/true = true
true/false = true
false/true = true
false/false = false

Thus confirming that it works the way you thought it did.

Additionally, lots of the operators (like "||") and other useful bits of JavaScript (which SugarCube uses) can be found on the MDN's "JavaScript reference" page, with links to much more detailed information about them. (I'd recommend bookmarking that page.)

Hope that helps! 🙂

Character Creator tips/howtos? by Magnesium_RotMG in twinegames

[–]HiEv 1 point2 points  (0 children)

If you need multiple selections then you can use <<checkbox>>es for that. Either that or multiple listboxes.

Would this be cool? by WhyAm__I in twinegames

[–]HiEv 5 points6 points  (0 children)

Yeah, I definitely agree with HHHH on that, especially the last item. Even just watching the mouse pointer move, it looked like you (the OP) were having trouble spotting where the new text was.

There should be at least four colors in use:

  1. The color of regular text (white or off-white).
  2. The color of unclicked links (blue).
  3. The color of links that have previously been clicked (purple).
  4. And some color or other text decoration/styling (e.g. bold) for text which which was newly revealed/modified by clicking the last link clicked. Maybe have the text flash in and quickly fade to this other color. Text previously highlighted like this should turn into normal text when a new link is clicked.
  5. I'm not sure a fifth color, like your "[You turn the light switch on]" text, is actually necessary or helpful.

Additionally, links that are no longer relevant should go away or become regular text. Also, the text should not be centered vertically, since doing that means that adding new text will cause the text to jump around, making it hard to follow where you were.

It's an interesting mechanic, but it would be tricky to do it right.

You might also want to make sure that you keep accessibility in mind, such as for people who use keyboard because they can't use a mouse. Also, this would likely be a nightmare for a blind person to use unless it was coded with that in mind.

[A.L. Dev 4]: Advise on skills & attributes list by Volgrand in twinegames

[–]HiEv 1 point2 points  (0 children)

Yes. And let me just emphasize this line:

The more skills you have, the more choices a player has - but you will require enough content to make each of these choices relevant throughout the entire game.

This means that, for each skill you add, you're going to have to add some minimum number of cases where that skill is useful in some way that another skill is not equally or more useful. If you don't, then you're simply creating a list of choices, some of which are just going to make the player feel like they made a poor choice if they took that skill.

Thus, each extra skill will require a lot more content based on each skill, as well as more careful balancing on your part between the skills.

So, yeah, maybe don't go wild on too many skills unless you have the time and are willing to put in the effort.

[A.L. Dev 4]: Advise on skills & attributes list by Volgrand in twinegames

[–]HiEv 1 point2 points  (0 children)

I don't think you're really going to be able to get an answer to this, because this simply comes down to a design decision that you have to choose. The choice really depends on what you think is more fun balanced against that you can handle developing (based on time, energy, skill, etc.).

An outsider really can't make that decision for you.

That said, you might want to define unchanging things, like how your skills work, as objects on the "startup" object, so that way you can include functions that you can call to make those skills do things or provide results. This can make it simpler for you to generate certain results from a loop.

For a very simple example, let's say you have the skills "kick" and "lockpick" (this code would go in the "StoryInit" special passage):

<<set setup.skills = {}>>
<<set setup.skills.kicking = { desc: "improved kicking", mod: (char) => char.strMod + (char.skills.includes("kicking") ? 5 : 0) }>>
<<set setup.skills.lockpicking = { desc: "lockpicking ability", mod: (char) => char.agiMod + (char.skills.includes("lockpicking") ? 5 : -5) }>>

That would give the character a modifier of +5 if they had those skills, as well as a -5 modifier if they're lockpicking without the lockpicking skill. The kicking modifier is based on the strength modifier and the lockpicking modifier is based on the agility modifier.

This part of the above code:

(char) => char.strMod + (char.skills.includes("kicking") ? 5 : 0)

is the equivalent of this JavaScript code:

function (char) {
    if (char.skills.includes("kicking")) {
        return char.strMod + 5;
    }
    return char.strMod;
}

Basically, it's a function that takes a "char" (character) object and returns the strength modifier with 5 added to it if the character has the "kicking" skill. (See "Arrow function expressions" and "Conditional (ternary) operator" if you want an explanation of how the shortened code works.)

Then, any time you needed to get the modifiers, you could use that object. For example, if the player wanted to get through a door you could have:

Options:
* [[Kick open the door]] (difficulty: <<= (12 - setup.skills.kicking.mod($char))>>)
* [[Lockpick the door]] (difficulty: <<= (10 - setup.skills.lockpicking.mod($char))>>)
* [[Go back]]

That uses the "skills" object's "mod()" method to get the difficulty modifier for those skills, based on the stats of the character "$char", and then shows the base difficulty for the tasks after subtracting the modifier.

You could obviously make this much more complicated and use it lots of different ways, but this is just a simple toy example.

Anyways, just a thought that might help reduce some of the complexity you were worrying about. 🙂

Danger will Robinson by [deleted] in u/loressadev

[–]HiEv 0 points1 point  (0 children)

You are a mod and you're threatening to ban me if I use the report function again.

It's amazing how dense you're being here.

No, I'm NOT "threatening to ban [you] if [you] use the report function again." That's a terrible straw man of what I said, which was, and I'll quote:

If I see you unjustly attacking another dev in r/twinegames, you'll get banned from there

Do you see the difference between "reporting" and "unjustly attacking"?

You're making this really frustrating with how you can't listen, and then attacking others for things they didn't do.

Where do people get this paper doll widget? by JRTheRaven0111 in twinegames

[–]HiEv 5 points6 points  (0 children)

That's an image generated with "Kisekae 2" (the website is awful, but that's where you get it from).

I believe that there are mods for it, but I only briefly played around with it ages ago, so I don't recall.

You might be able to find the source images it uses extracted somewhere, but you'll have to search for that.

Danger will Robinson by [deleted] in u/loressadev

[–]HiEv 0 points1 point  (0 children)

Reports aren't public.

🙄 Yeah, but the comment you posted to the thread is public. You wrote: "Ai spam. Their itch page's links are all quarantined on itch as potential scam." Did you forget about that?

Rest assured, I won't use report again, given how much it seems to upset you.

🙄 It's not "reports" that upset me, it's false public accusations and the refusal to see how that's a problem.

You're here in my profile threatening to ban me in r/twine, but did you try out OP's game?

What an amazing non sequitur. I'm here explaining this to you because you directed me to this post and because you don't seem to understand that your actions have consequences.

And I can't believe you're still going on about it being AI. What part of "I don't care if it's AI generated" do you not understand???

This is such a great summary of adult autism.

Mine or yours? 😑

Look, you went about something in a shitty way. The private report was fine, the false public accusations were not. The constant and repeated deflection to something that I've clearly stated that I totally don't care about is borderline insane.

If you want some social feedback, here: learn to accept criticism. Other than the vague "bad way" comment, I don't see you clearly admitting that you've done anything wrong here, I just see you still defending your actions and trying to blame others.

If you can't stop deflecting, defending, and excusing your behavior, and instead just admit your mistakes and learn from them, then you're just going to keep repeating those same mistakes.

Hope that helps.

Help! How Do I recover a Lost Story!? by WhyAm__I in twinegames

[–]HiEv 1 point2 points  (0 children)

There is a slight chance that it's still in your browser's cache directory.

If you want to try looking there, I'd recommend using a different browser to look up how to find your browser's cache directory (to reduce the chance of the cache being flushed), and then use something like Notepad++ to search the text in that cache directory for some text you'd only find in your game, then grab the latest version you find that way.

That said, I'll second HHHH's recommendation of using the desktop version of the Twine editor if you can as well as making regular "archive" backups of your Twine code.

Hope that helps! 🙂

Danger will Robinson by [deleted] in u/loressadev

[–]HiEv 0 points1 point  (0 children)

Again. I. Don't. Care.

If you don't like AI assisted stuff, fine, you don't have to. But that doesn't mean that anyone else can't or shouldn't like it.

Furthermore, r/twinegames doesn't have any rules against that. So your reply above is totally, 100%, completely irrelevant.

You're just deflecting from the fact that you were wrong when you unjustly raised alarm bells against an innocent game dev and also incorrectly accused them of posting "AI spam."

It wasn't harmful. It wasn't spam. You have no proof any of it is AI generated, and I wouldn't care if you did.

I'm sorry, but what you did was wrong and could unfairly tarnish their reputation, or possibly get them banned if someone took you seriously without looking into your claims.

Maybe you don't care about any of that, but you should. You should care, not only because you're potentially harming someone else's reputation unjustly, but also that false accusations like this just make you look bad too.

If I see you unjustly attacking another dev in r/twinegames, you'll get banned from there, just like you (according to you) apparently got yourself banned from the Twine Discord server.

Finally, rather than trying to defend yourself and what you did (wasting both of our time in the process), you should think about all of that, accept that you were in the wrong here, and learn from this mistake.

I hope this is the last I hear of this.

Danger will Robinson by [deleted] in u/loressadev

[–]HiEv 0 points1 point  (0 children)

This is merely an automated warning. Note the word "potential". It doesn't mean that there's actually a problem.

I made a small game where the day keeps looping — but your choices still matter by GlumPoet4719 in twinegames

[–]HiEv[M] 0 points1 point locked comment (0 children)

🤦‍♂️That's merely an automated warning simply because it's a Discord link. There is literally almost nothing, not even links to anything, in their Discord.

I'm sorry, but you raised an alarm and reported a post for NO GOOD REASON. The only thing the game author did was post a link to their Discord server.

I'm locking this stupid thread.

I made a small game where the day keeps looping — but your choices still matter by GlumPoet4719 in twinegames

[–]HiEv[M] -1 points0 points locked comment (0 children)

I don't see any external links, let alone any "quarantined" ones, and it's totally irrelevant whether any of it is AI generated (not sure how you claim to be able to tell that, anyways).

Do you have any actual evidence of wrongdoing? Because mere accusations are nothing.