How to reload room description?

ABCfred202
08 Oct 2021, 18:26

Basically the title, making a one room game that really needs the room description to be visible after everytime I interact with an object, if that makes sense? I can clear the screen but can't get the room text back up, was wondering how to solve it?


mrangel
08 Oct 2021, 23:38

You can show the description any time by using the function:

ShowRoomDescription

Alternatively, if you know a little HTML, you could output the room description in a fixed section, and then have a turnscript do something like:

StartNewOutputSection("currentdescription")
ShowRoomDescription()
EndOutputSection("currentdescription")
JS.eval("$('#roomdescription').empty().append($('.currentdescription'));$('.currentdescription').remove();")

I prefer this approach, which displays the room description at the top of the screen and updates it every turn, keeping it in view but allowing other stuff to scroll past it so the player can still scroll back if they want to check what they already tried. (For that example, it looks for a div with the id roomdescription and replaces its contents with the current description every turn).


Pertex
09 Oct 2021, 11:51

Nice idea, but does not work as described. It adds the description after the last turnoutput. And StartNewOutputSection must not have any parameter


iantommo
09 Oct 2021, 12:07

I believe in ROOM / Scripts / TURN SCRIPT is what you need to use.

Turn scripts - run after every turn the player takes in this room:


mrangel
09 Oct 2021, 14:03

Nice idea, but does not work as described. It adds the description after the last turnoutput. And StartNewOutputSection must not have any parameter

Sorry, careless mistake.

I assumed that StartNewOutputSection just passes its parameter to the similarly named javascript function, like all the other functions in that block of code.

Changing StartNewOutputSection ("currentdescription") to JS.StartOutputSection ("currentdescription") might be closer to working. It's a long time since I've done this (and the last time I did, I used sticky rather than fixed for the div; but otherwise it should be the same).