Harlowe, Twine 2. I was hoping someone could help me work through what I'm trying to accomplish. I've read up on arrays and datamaps but don't yet have the full sense of all the possibilities of those two things.
I want to create a train timetable that as the player moves from passage to passage it reduces each train arrival time and when the first reaches zero, it's removed it from the list and a new one is added at the end of the list. Each train has a "time", "color", and a "direction".
I've written the following array that refreshes itself exactly how I'd like but since it's an array it only handles one set of the attributes I want: "time". Ideally the other attributes follow "time" as it counts down.
In a preceding passage I set:
Then this reduces the "time", moves the first index to the end when it reaches 0, and shifts the others down:
Datamaps seem the best way to manage the various attributes needed for each train, but as far as I've been able to figure they don't store their data in a particular order like arrays. Therefore I can't shift the indexes in the same way. Any thoughts or ideas?
I want to create a train timetable that as the player moves from passage to passage it reduces each train arrival time and when the first reaches zero, it's removed it from the list and a new one is added at the end of the list. Each train has a "time", "color", and a "direction".
I've written the following array that refreshes itself exactly how I'd like but since it's an array it only handles one set of the attributes I want: "time". Ideally the other attributes follow "time" as it counts down.
In a preceding passage I set:
(set: $time to (array: (random: 3,4),(random:6,7),(random:9,10))) [[Next|test]]
Then this reduces the "time", moves the first index to the end when it reaches 0, and shifts the others down:
(set: $time's 1st -= 1) (set: $time's 2nd -= 1) (set: $time's 3rd -= 1) (if: $time's 1st < 1)[(set: $time's 1st += (random: 9,10))(move: $time's 1st into $time's 4th)] (print: $time) [[Refresh|test]]
Datamaps seem the best way to manage the various attributes needed for each train, but as far as I've been able to figure they don't store their data in a particular order like arrays. Therefore I can't shift the indexes in the same way. Any thoughts or ideas?