Thanks for playing it and I'm glad you enjoyed it!
Honestly, the way I made the three different endings was very simple (and probably not the best way to do it). I made a "gameover" function that you could call from anywhere. The two NPCs each kept track of information that they needed in order to trigger their specific ending. For example, The Figure had a counter of how many times you talked to him and if you reached 4 times, he would call the "gameover" function. Same with The Clerk. For the player character, it had a bool called "bought_batteries" that was turned to true when you bought the batteries. If that variable was true when you clicked on the car, then the car would call the "gameover" function.
The "gameover" function took a few arguments about which ending was triggered (the name of the ending, etc). So when the Figure, Clerk, or car called "gameover", they would each pass different information specifically about their ending.
This way, it's very easy to add a fourth ending. Just create a new NPC or object, and when some criteria is met, that object calls "gameover" and passes in it's specific ending data. Then the "gameover" function shows the ending screen with the ending name it received.
Not sure if that all makes sense but I hope it's at least a little helpful! I'm happy to answer any other questions you've got too!




