Follow your choices?

got a question:
how to continue a follow up choice in the next chapters?
like in the first chapter you got an option to ask someone on a date, if you choose yes how to do that only then you’ll have a date scene? or if you didn’t ask her then some other scene…

I am no programmer but I would set date true. Then you could use if date true then goto scene love.

Carrying any information beyond a single scene file will involve defining more variables in your mygame.js file (if it will only be used within the same file you may as well just use a *temp variable). There are then different ways you might implement this, of which the three most common might be:

  1. Have a specific variable for that character name. It could be a boolean (true / false) type, which you would *set to true when the date is set up / agreed to. In the next chapter, *if (that variable) is true, then the player sees the date scene. If it’s still false, it’s skipped.

  2. Alternatively, you could make the variable numeric to more easily track a longer-term relationship–in which case you would treat 0 as false (no date), 1 as true (date agreed), and 2+ for future relationship events / recording the current status with that character (e.g. set it to 2 if it was a bad date, 3 if a good date, 4 if you got laid . . . whatever. The aim would be to know how that character should react to the player, and vice-versa, should they meet again later in the story).

  3. If, however, the date / relationship with that character will only ever be a minor part of the story, with no ongoing relationship intended, then consider using just a ‘generic’ variable. You might call it “flag1”. You would use flag1 to record if the date is agreed to, but once past that point in the story (where the date takes place) you might then use flag1 for another, entirely unrelated, purpose–which is why you give it a ‘generic’ name of “flag1” rather than “date”. This system can save adding loads of limited-use variables to your mygame.js file, but it does mean you have to be careful to keep accurate track of what each such variable currently means in the story.