0 votes
by (140 points)
edited by
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?

2 Answers

0 votes
by (6.2k points)

I'm sorry but I really don't understand your question. I think you're having trouble with getting the emails ordered based on when they were received. If the story is linear, and the emails are all received in the same order, then just do

(if: $email1 is true)[[[Open Email ->emial1]]
](if: $email2 is true)[[[Open Email ->emial2]]
](if: $email3 is true)[[[Open Email ->emial3]]
](if: $email4 is true)[[[Open Email ->emial4]]
](if: $email5 is true)[[[Open Email ->emial5]]
]

If the emails can be received in any order, then in some whenever an email is received, use this:

(if: $email1 is false)[(set: $email1 to '[insert what the email is about here]')](else:)[(if: $email2 is false)[(set: $email1 to '[insert what the email is about here]')](else:)[(if: $email3 is false)[(set: $email1 to '[insert what the email is about here]')]

And keep repeating that until you have 32 so that the email is set to a number. In the email passage do this:

(link: 'Open Email')[(if: $emial1 is 'dogEmail')[(goto: 'dogEmail')](else-if: $email1 is 'dubstepEmail')[(goto: 'dubestepEmail')]

On every email have an if statement for every email, and then copy and paste 31 times.

Sorry if this isn't what you were looking for, and this is rather messy and there's probably a better solution, so sorry.

0 votes
by (63.1k points)
Any time you're numbering variables, you're usually looking for an array. So I suggest making your emails into an array and then looping through them when you need to display them.
...