How to delete all previous text except room description.
IzyaboiCallume
24 Oct 2020, 12:14I have an issue where if I type the same command over and over it would flood my screen with that action I took,
It would look something like this:
__
There is a pile of cookies here.
you pick it up
you pick it up
you pick it up
you pick it up
you pick it up
__
The player would then have to scroll all the way up to read the room description again which could get very tedious especially when the player loots a chest filled with items.
Is there a way for me to prevent this from happening? Maybe somehow delete previous commands/item descriptions without having to accidentally delete the room description. (please not that, in my game, the room's appearance can change, so I cant go with simply adding a script to print text and copy paste the room desctiption.)
IzyaboiCallume
24 Oct 2020, 12:27my main idea is this, if i press 'look at' on an object it would run this 3 scripts:
first it would clear the screen
then it would give the item description
then afterwards it would print the room's current description
i still dont know how i would achieve the third one tho, especially if the room description changes.
mrangel
24 Oct 2020, 14:56Are you looking at a way to do this for all commands, or just for look at?
In the case of lookat, it would be fairly simple to do. You could just put ClearScreen
at the beginning of the script, and ShowRoomDescription
at the end.
If you want to do the same for all commands, you could do that by modifying the core function HandleCommand
. I would suggest searching in the code for that function to find
if (not handled) {
StartTurnOutputSection
and change that to:
if (not handled) {
ClearScreen
ShowRoomDescription
StartTurnOutputSection
That way, when the player responds to a menu choice, the question will still be shown (which makes more sense), but when they enter a command, only the response to the current command appears.
Alternatively, you could do some fancy CSS magic. One way I've looked at is to have a turnscript which starts a new output section, runs the function ShowRoomDescription
, and then runs some simple javascript to capture the output and move it to a div with position: fixed
, replacing any current content of that div. This means that the room description is always at the top of the screen, but the output from other commands can scroll 'behind' it, and the description will update to reflect objects being taken or dropped.
(I used a slightly different version of this on my game 'Circus', although that doesn't work properly on the desktop player because it uses position: sticky
which isn't supported because desktop Quest runs a very old version of Chromium which doesn't support it)