Turn room descriptions on and off

Hey. Is there code to turn room descriptions on and off during play?
Thanks.


You could set the room description as a {once:.....} then you would only see the description on your first entry...


You can certainly due as DL suggests, or you can use a If to check for a set flag. It all depends on what you want to do. If the player is carrying a certain item, set flag and when they enter that room you can print description 1 and if not then description 2. Just a thought.


DL's and XM's suggestions are safest.

You could also do this to actually turn room descriptions on and off:


Add this line to the game's start script (IMPORTANT!):

// Backup the game's initial room description setting.
game.autodescription_description_backup = game.autodescription_description

To toggle off room descriptions:

// Turn off the room descriptions for the ENTIRE GAME.
game.autodescription_description = 0

To turn room descriptions back to the game's initial setting (this depends on the line added to the start script; the value is 4 by default, by the way):

game.autodescription_description = game.autodescription_description_backup 

To add to KV's reply, everything you set on the game object in the editor is an attribute on the game object. If you are using the desktop version, you can see them all listed on the Attributes tab. Some only get used when the game starts (many on the Display tab and all on the Interface tab), but the rest can be changed during play to change how your game goes.


Uh, K.V., I tried what you said, But I don't want to turn of descriptions right at the start.


Nevermind, I had automatically generate descriptions on, when I thought they were off...


I think your looking for something like this...
Add an ondescription attribute to the room, that is the same as the description attribute at beginning of game.
Then when you want to turn it off use:

room.description = 0

Then to turn it on use:

room.description = onroomdescription

If the room has objects that contain in room descriptions, this will not stop their descriptions from showing up.


"Add an ondescription attribute to the room"

How do I do this?


On the left side of quest you see a tree to hold rooms and objects.
click on the room in question
now on the main page of quest with all the tabs, click attributes
on the new page look at the box titled attributes, click add
A box will pop up asking for a name, type in onroomdescription
this will add the attribute.
Another box will appear under the attributes box that says string. it is a drop down box but the description you add under it will be a string so leave it saying string.
add the description you want the room to have. Just copy the one you use on the room tab under description.
these will be the same for now until you want to turn off the description.

obviously you want to turn on and off during game play.

use this line in your script to turn on

room.enter  = msg("{room.onroomdescription"}

that will print the onroomdescription after entering the room. Don't type room, type the name of the room you want.

NOTE: Newbie writing on the fly here so scripts may be faulty.

Somebody tell us if I'm even close here!


To toggle the ON/OFF settings of room descriptions, I simply insert one of the following two lines as needed:

Descriptions off:

SetObjectFlagOff (game, "autodescription")

Descriptions on:

SetObjectFlagOn(game, "autodescription")

Well, Proudly Humble's code worked.

Thanks!


Sweet!


My room descriptions still print after this: SetObjectFlagOff (game, "autodescription"), but it doesn't show the room name, exits lists, or objects list -- just the room description.

I believe I was confused as to what our purposes were, but, I see the post stating that Proudly Humble's code does what you want, so that is sweet.


For completion's sake:

There are four, individual attributes on the game during play which effect the order of each of these:

Displayed text Attribute name Default value (integer)
Room Name: autodescription_youarein 1
Exits List: autodescription_youcango 2
Objects List: autodescription_youcansee 3
Description: autodescription_description 4

You can set any one of these to 0 to turn them off during play.


Example:

// First, backup the current setting:
game.autodescription_description_backup = game.autodescription_description
// Now, change the value to 0, turning it off:
game.autodescription_description = 0

That turns off the actual room description (the text you enter under the description of the room).

To turn it back on:

// Check to see if the setting has been backed up.
if (HasAttribute(game, "autodescription_description_backup")){
  // The setting has been backed up, so we use that attribute to reset it.
  game.autodescription_description = game.autodescription_description_backup
}
else {
  // The setting has not been backed up, so we set it to Quest's default value.
  game.autodescription_description = 4
}
// Now, make sure it is on. If it is 0 at this point, set to Quest's default value.
if(autodescription_description = 0){
  //  It is still disabled, so set to Quest's default value.
  game.autodescription_description = 4
}
  

To turn off the exits list:

// First, backup the current setting:
game.autodescription_youcango_backup = game.autodescription_youcango
// Now, change the value to 0, turning it off:
game.autodescription_youcango = 0

I'd be leery of turning off the objects list, but I'm sure everyone can see how to manipulate it now.


To turn off everything which is automatically generated by Quest (the room name, the objects list, and the exits list, but NOT THE ROOM DESCRIPTIONS YOU HAVE ENTERED FOR ANY ROOMS):

I advise against this. If you disable the automatically generated Objects List, and the player drops something, that object will more than likely be lost forever unless the Places and Objects pane is visible.

game.autodescription = false

To turn them back on:

game.autodescription = true

Wait, if you can turn the auto descriptions back on, what's the problem? Why do you need to warn against it.

Also, I'm turning off the auto descriptions for cut scenes. I need the player to stay in place during important cut scenes in the new game I'm working on.

Nice information by the way! I figured it out eventually, but only after trying Proudly Humble's solution, and then reading your posts a second time.


Wait, if you can turn the auto descriptions back on, what's the problem?

I assume they are being turned off before entering a certain room, then being turned back on when exiting that same room.

So, if the player were to drop something in that room (and the Places and Objects pane wasn't displayed), nothing would ever print to let the player know that the object was in that room. Hence, the object could be lost forever, unless the player entered GET ALL in that room (or simply remembered dropping it there).


I'm turning off the auto descriptions for cut scenes. I need the player to stay in place during important cut scenes in the new game I'm working on.

I'd probably create a room for each cut scene, then do something to initiate the cut scene:

(revision 2)

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Cut Scenes">
    <gameid>6948c387-223a-4f55-b739-4c9a8b044eb0</gameid>
    <version>0.0.2</version>
    <firstpublished>2018</firstpublished>
    <start type="script"><![CDATA[
      msg ("<hr>Image from <a href='http://backtothefuture.wikia.com/wiki/File:BTTF-game-SS-09.jpg'>http://backtothefuture.wikia.com/wiki/File:BTTF-game-SS-09.jpg</a>.<hr>")
    ]]></start>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <object name="Flux Capacitor">
      <inherit name="editor_object" />
      <take />
      <ontake type="script">
        firsttime {
          lastroom = game.pov.parent
          MoveObject (game.pov, cutscene1)
          wait {
            MoveObject (game.pov, lastroom)
          }
        }
      </ontake>
      <look><![CDATA[<img width='100%' src='https://vignette.wikia.nocookie.net/bttf/images/b/b6/BTTF-game-SS-09.jpg/revision/latest/scale-to-width-down/300?cb=20101214205519'/>]]></look>
      <listalias><![CDATA[<hr/><img width='100%'  src='https://vignette.wikia.nocookie.net/bttf/images/b/b6/BTTF-game-SS-09.jpg/revision/latest/scale-to-width-down/300?cb=20101214205519'/>Flux Capacitor<hr/>]]></listalias>
    </object>
    <object name="large table">
      <inherit name="editor_object" />
      <inherit name="surface" />
      <takemsg>It's too big and heavy.</takemsg>
      <feature_container />
      <listchildren />
    </object>
  </object>
  <object name="cutscene1">
    <inherit name="editor_room" />
    <alias>Your House - November 5, 1955</alias>
    <description><![CDATA[You are in your bathroom.<br/><br/>You slip and fall, hitting your head on the sink and knocking yourself out.<br/><br/>When you awaken, you have a vision!  The Flux Capacitor!<br/><br/>You don't know what it can do, but you now know how to create it!]]></description>
    <beforeenter type="script">
      game.autodescription_youarein_useprefix = false
      JS.uiHide ("#gamePanes")
    </beforeenter>
    <onexit type="script">
      game.autodescription_youarein_useprefix = false
      JS.uiShow ("#gamePanes")
    </onexit>
    <usedefaultprefix type="boolean">false</usedefaultprefix>
  </object>
</asl>

Nice information by the way!

Thank ya', thank ya'.


I figured it out eventually, but only after trying Proudly Humble's solution, and then reading your posts a second time.

Look at you go!

You may end up being The Pixie's successor one day!


Well, of course you have to be careful when you change any setting like this, or else things may go wrong. But I'll have to admit, I was surprised to find out that setting game.autodescription to "false" prevented the "look" command from working properly. I'll make a mental note of that.

I've only used the method I suggested for myself to temporarily move the player from room A to room B, then back to room A, so as to prevent certain secondary scripts from triggering an unwanted domino effect (it's a lot easier than a bunch of "if" codes). For example:

  1. script is triggered
  2. autodescription is set to "false"
  3. player is moved to (empty) room B
  4. scripts run without accidentally triggering other scripts
  5. player is returned to room A
  6. autodescription set to "true"
  7. game resumes as normal

This method could be used for a cutscene if you wanted make it appear that the player never changes rooms. Whether or not this would be a good idea totally depends on what your intent is. As others have pointed out, there are probably other ways to accomplish what you want. But since my suggestion worked for you, I'm glad. Just be sure that autodescription is set back to "true" before the game resumes.


As a safeguard, you could do this:

When the script is triggered:

game.autodescription = false
if (not HasAttribute(drop, "scriptbackup")) {
  drop.scriptbackup = drop.script
}
drop.script => {
  msg ("You can't drop anything right now.")
}

Before resuming play:

game.autodescription = true
drop.script = drop.scriptbackup

It wasn't my intention to down your suggestion, by the way, PH.

I was just warning everyone about the danger of turning off the automatically generated objects list to save someone the troubles I ran into.

I know you probably know that already, but I want to be sure no one thinks I'm being unpleasant or anything.

(I only posted the big, red warning because I was posting the code, and I don't want anyone having problems because of something I've posted (without warning them about it first, ha-ha!).)


The look commands work for me.

The thing is, I mostly just want to disable the "exits are west" messages. When I am locking the exits, I don't want the player to try to be running off.

But everything is working fine.


It's fine, K.V. I certainly agree that the setting should be left alone unless it is reset to true before the player enters the next command, or if the potential consequences to the player dropping things are intentional.

I thought surely the look command would take care of the issue where players might "lose" items, so I opened up a file, changed the default setting of game.autodescription to false to see what might happen for myself if the setting remained false. As I expected, there were no room status messages per turn, but when I tried looking, I got a null result (no error messages, just no response). This proved your point of how things can go wrong when you play with this setting.


Personally, I am open to suggestions on what I can do differently.

Disabling the descriptions are simply an aesthetic change. I would like it if I can do all that without having to move the player to a different room, and then sending them back. I also want to keep the drop command. But I don't see a work around.


jmnevil54

I may have missed the point of what you want to do, but I think you want to keep the player in the room? The best way is to either lock all the exits or set them all to invisible. There is a brief instruction towards the end of this page, in the section "Room scripts".
http://docs.textadventures.co.uk/quest/exits.html


Log in to post a reply.

Support

Forums