For some reason, whenever I try to move the player object, quest will print the description of the room twice. This also happens when I change the player object. I was just wondering if there is any way to fix this.
I had that issue before and got it fixed. I’ll dig through my code and try and find out why that happens and what I did to fix it. Until then...
Are you moving the player object twice? For example moving the player again within an enter or exit script; this can cause duplicate descriptions because the second move triggers another one before the first move finishes.
I don't believe that that is it @mrangel. I thought that was the problem at first also but I have tested it and found out that it is not.
Can you share the game so we can take a look at it?
What happens if you turn off automatically printing the room description? Does that make it appear once (in which case I'd assume you're manually calling ShowRoomDescription somewhere), or not at all?
Since the game is not yet finished, I'll message it to you privately.
I turned off "Automatically generate room descriptions" and then called the ShowRoomDescription function under "Script when entering a room". The room description was not printed.
I turned off "Automatically generate room descriptions" and then called the ShowRoomDescription function under "Script when entering a room"
I can't understand why you would do that.
I would expect that to show the room description twice, but skip the room name, "You can see:", "You can go:" and all the other automatically-generated stuff.
OK, I see your issue.
When you enter a room or change characters, Quest does the following:
So at the start, it does this for the first room
It's displaying twice because you're still in the middle of the "enter room" process for the creation room, and it will finish even if you're no longer in that room.
The easiest way to change
game.pov = player1
This doesn't automatically call OnEnterRoom after switching POV, but still does the other initialisation stuff. So the sequence becomes:
player1without running room entry
Hope that makes sense… I tried to explain why it's doing that rather than just giving a solution, because if you know why the problem occurs, you can avoid similar issues in future.
(Note: if you use this method later in the game when changing characters, you may have problems with the map.
ChangePOV basically does 3 things: changes the value of
game.pov, clears the map, and shows the room description. If the map had already been drawn you would also need to include the lines:
JS.Grid_ClearAllLayers () Grid_Redraw
or it might be easier if you avoid moving the player or changing POV from within a room enter/exit script)
Thanks a lot, the problem is completely solved and I feel like I understand what happened and will not make that mistake again.