I have a series of fictional emails the player can receive based on events in gameplay. I want to display links to said emails in the "order received." The output would look roughly like this:
[[Subject of Email 1->$Email1]]
[[Subject of Email 2->$Email2]]
[[Subject of Email 3->$Email3]]
And so forth. There are 32 of these emails total. (There are custom UI elements involved, so this can't be a straight list of links because there will be divs/accordions/etc applied.)
I have the text of each email in a separate passage currently: DynamicEmail1, DynamicEmail2, etc. I don't have the subject lines stored anywhere yet because I honestly don't know where best to put them.
Basically, what I need to do is:
1. When something happens to trigger an email, find the first variable that does not have anything stored in it (besides false). This suggests a loop of some kind.
2. Store the name of the passage, the subject line of that passage, and the current time, in that variable. I'm not sure whether to use an array, a datamap or just regular variables for this. The last of these would be the messiest, but easiest with the JavaScript I am using to trigger these events.
3. On the emails page, have the links print in order, as above. I don't know whether it is best/most possible to do this with a lot of (if: $email1 is not false) conditional statements -- there's a finite number, at least -- or to repeat through a loop and print links for everything that is not false.
However, I have no idea how to go about doing this, and it is very late in the game to convert everything to a different story format. I've gotten this to work in JavaScript but was wondering if there was a way in Harlowe. Where would I even start?