"If game.score"-script not working properly

chellkafka
16 May 2014, 17:02
So, there is a series of three rooms. And you can get +1 or -1 in each rooms depending on how you play. And I want if the player is in the third room and if his score is -2, that he gets a different response from when he has a different score. But for some reason I never get the different response.
I run a "Call function"-script after entering the room. The function is called "GetScore" and I set an if script in the function that takes the room and the score in account.
Any idea what's wrong?
Typing in "pullroom" sets the score to -2 and moves you to the third room.

jaynabonne
16 May 2014, 20:23
If I type "pullroom" from the beginning, it prints out "There is a lever. Please look around first and then pull it." That's what the code is saying to do. If it's 0, it will do one thing; else it will do the other, and the other is what it does for me.

At the beginning, the score is 1. When you type "pullroom", it moves the player to the "pull room" and then decreases the score by 3 to -2. Note that that is slightly different from what you said. You don't set the score to -2 and then move the player. You move the player and then set the score to -2. I'm not sure if that's the problem, as the score won't be -2 when you enter the room. It will still be 1. It doesn't become -2 until after the player movement is done.

chellkafka
17 May 2014, 07:15
ah, ok, thanks. I tried it moving the player 1 second after changing the score and now it works. thanks, didn't think that there needs to be a clear order for the scripts.