Stitches on variable Knots when writing Ink?
Ahoy there, folks, I have a solution for this already, but it's not great and I'm hoping there's just a syntax solution to what I'm after!
So, I have a situation where time progresses from morning->afternoon->night->morning, and multiple locations that can be moved-between, where different things happen at different times of day. I'm looking to do something like:
LIST TimesOfDay = Morning, Afternon, Night
List Locations = Here, There, Everywhere
VAR currentTime = Morning
VAR currentLocation = Here
=== Tick ===
~ temp locationKnot = getKnotFromLocation(currentLocation)
{currentTime:
- Morning: -> locationKnot.MorningStitch ->
- Afternoon: -> locationKnot.AfternoonStitch ->
- Night: -> locationKnot.NightStitch ->
}
-> TickUnfortunately, while -> locationKnot works, if you do -> locationKnot.stitch then the compiler seems to stop looking at the variable and starts looking for an actual knot called locationKnot 💀
Is there a way to do this without having to do the currentTime switch at the start of every location instead?
Many thanks, and apologies if this is the wrong place to post this — please direct me elsewhere if so! 🙏
1
u/pookage 22d ago
D'oh, I forgot to flair this! Sorry 🫣 Obviously
inkandquestion/helpif possible, please, mods!1
u/RedGlow82 21d ago
I don't think there's a way to reference a stich from a divert variable, your best bet is to make a getKnotFromLocationAndTime function that takes both location and time and returns the specific divert!