How To Make an Adding Total

Jiangxi123
17 Nov 2018, 00:29

Hi, I am creating a gamebook and for each option the player chooses correctly, the game will add one point to the score. If the player chooses incorrectly, nothing happens.

How do I get the points to add up and show at the end of the game?


DarkLizerd
17 Nov 2018, 02:27

player.score=player.score +1
(for each correct answer..)
at the end...
msg ("Your score was: " + player.score)

This works for Quest...


Jiangxi123
17 Nov 2018, 13:22

Do I put them in curly braces?


DarkLizerd
18 Nov 2018, 20:49

In the room description... Yes...
IE:
Your score was: {player.score}


jmnevil54
22 Nov 2018, 15:55

To make it work, no, you don't have to put it in curly brackets. You take this, spaces included:

player.score = player.score + 1

And you put it either in rhe game's start script or the game's initialization script.