From room to room and back
tvisarl
06 Aug 2016, 15:46Hi, all!
Before starting on my "real" game, I am working on another simpler one which I use as a benchmark to find out how to cope with a number of "standard" situations. So, right now I am having this problem:
The player is in room A and he wants to go to room B. Naturally he clicks on the exit that goes from A to B.
At this moment (I deal with what follows in the "On Enter" script for room B) a NPC shouts "Hey, don't go there!". The player prefers to desist, and so I put him back in room A. (End of script)
And then room A's description is displayed twice. How can I avoid that? Actually I would prefer the description not to be displayed at all. Once would be OK (I have a workaround) but certainly not twice. Twice spoils everything.
Thanks,
Thierry
The Pixie
06 Aug 2016, 16:25I think I remember this coming up before.
When you move to another room, Quest notes that it needs to display the room description. Then is runs the OnEnter script and that moves the player back. As the player has moved, Quest again notes that it has to display the room description. once your script has finished, it can then finish its other tasks, which is to display the current room description, and then to display the current room description.
The conclusion was that moving the player in the room enter scripts is a bad idea. Could you do it in a scipt on the exit? That way you could avoid moving the player at all, and so no room descriptions.
tvisarl
07 Aug 2016, 08:44Thanks, Pixie. It would work, no doubt, but I have just noticed that you can edit an exit in such a way that it runs a script instead of moving the player automatically. That's the most flexible solution for me. Quest's power is really amazing.
The Pixie
07 Aug 2016, 09:45That is what I meant.
tvisarl
07 Aug 2016, 10:14Sorry, it had escaped me.

Proudly Humble
11 Aug 2016, 20:00I have discovered that things can get messy with room scripts since several different scripts can run in succession. Still, it's worth noting that you can temporarily turn off the room descriptions and turn them back on again. You just have to figure out where each code is necessary for your particular situation and put it into the appropriate script.
To turn off descriptions:
SetObjectFlagOff (game, "autodescription")
To turn descriptions back on
SetObjectFlagOn (game, "autodescription")
I realize that this isn't a simple solution to implement with your scenario. You may have to play around a bit to get them to function the way you want for your game, but if you have the time, you just might figure out where those codes need to be to make things run smoothly.
The Pixie
11 Aug 2016, 21:23All the settings you can change in the editor (and more besides) you can also change on the fly during the game - you just have to know the name of the attribute. Off-line, the attributes tab will tell you that.