Room Descriptions Help

I would like to find out how to present players with a detailed room description when they first enter a room and upon reentering they only get a short brief unless they examine the room again. Is there a way to do this? I feel like I'm overlooking something simple. Thanks in advance.


K.V.
This is the bare bones text which displays as the short description.{once:

This text only displays once.  It is the extended part of the "verbose" room description.}

Or

{once:This is the long version.}{notfirst:This short version.}

thank you so much :-)


K.V.

No problem!

Glad to help!

Happy gaming!


I'm not certain this actually answered WACahMole's question (which is also my question, thus bumping an older thread, sorry!) - they asked how to have the long brief also appear when the room is examined again. I.e. have two descriptions, a short one (S) and a long one (L) so that the following happens:

(enter for the first time): L
(enter again later): S
(>look): L

Using {once:L} and {notfirst:S} sorts the first two points but doesn't work for using 'look' to reproduce the long description. Any ideas?

I guess we could override the look function to set room.visited to false immediately before running, and back to true immediately after running; but I dread to think what I might break by touching something as fundamental as 'look'!


If you use first time (on scripts ) . Then put first description on first time. On else, repeat first time. First time ( second go) put second description then on else put third description. (If you wish to put first time instead of third description then you can keep adding as many descriptions as you wish ) hope tis is not confusing. I can't do coding, and it works for me.


Thanks Father for the help, but that still doesn't allow me to get different behaviour for 'look' and for entering a room, I believe


Hi fogmike, as well as 'look' you also can make use of 'look at' if you have provided an object for the room. I agree that taking over 'look' is not a good idea. Perhaps it would help if you gave a specific example of what you are trying to achieve?


Only way I can see is to use a script for the description.

showfulldescription = Equal(game.pov.currentcommandpattern, look) or Equal(game.pov.currentcommandpattern, lookat)
firsttime {
  showfulldescription = true
}
if (showfulldescription) {
  msg ("You are in a bedroom. The carpet is brown. The curtains are brown. The sheets are brown. Even the lampshade is brown. You've never seen such a brown room in your life.")
}
else {
  msg ("You're in the brown room again")
}

I imagine you could override the look command.
(can you use or in a boolean assignment like that? I've seen some programming languages where 'and' and 'or' are only valid within an 'if' statement, which I never understood the logic for)

Alternative method:

player.changedparent => {
  if (HasInt(this, "ismoving")) {
    this.ismoving = this.ismoving + 1
  }
  else {
    this.ismoving = 1
  }
  if (game.pov = this) {
    if (IsDefined("oldvalue")) {
      OnEnterRoom(oldvalue)
    }
    else {
      OnEnterRoom(null)
    }
    if (game.gridmap) {
      MergePOVCoordinates
    }
  }
  this.ismoving = this.ismoving - 1
  this.hasbeenmoved = true
}

And then in your descriptions you can use {if player.ismoving>0:You're in a brown room} in combination with {once:...} to determine whether the description is being displayed because you entered a room or for some other reason.


(In case it isn't obvious, game.pov.currentcommandpattern contains a reference to the command currently being executed. You could also use StartsWith(LCase(LTrim(game.pov.currentcommand)), "look") to see if the command the player entered starts with "look")

I'm trying to answer quickly; so sorry if I made an error.


K.V.

INFOCOM style room descriptions

In an old-school text adventure:

Entering SUPERBRIEF or SHORT will not display any room descriptions (except for the room name, the objects list, and the exits list), even if you haven't visited the room.

Entering BRIEF will not display room descriptions in rooms you have visited before

Entering VERBOSE or LONG will display all room descriptions


This effects every room in the game, whether you enter a room or enter LOOK.


This can be accomplished in Quest with one line in the start script, three commands, and a modified ShowRoomDescription() function.

If you add the following to your game, there is no need to add any other code, not even to the rooms themselves.


  • The start script

game.autodescription_descriptionBak = game.autodescription_description


  • The commands
  <command name="brief_cmd">
    <pattern>brief</pattern>
    <script><![CDATA[
      if (not GetBoolean(game, "brief_descriptions")) {
        game.brief_descriptions = true
        game.autodescription_description = game.autodescription_descriptionBak
      }
      msg ("Room Descriptions is now in its \"brief\" printing mode, which gives long descriptions of places never before visited and short descriptions otherwise.<br/>")
    ]]></script>
  </command>
  <command name="superbrief_cmd">
    <pattern>superbrief;short</pattern>
    <script><![CDATA[
      game.autodescription_description = 0
      msg ("Room Descriptions is now in its \"superbrief\" mode, which always gives short descriptions of locations (even if you haven't been there before).<br/>")
    ]]></script>
  </command>
  <command name="verbose_cmd">
    <pattern>verbose;long</pattern>
    <script><![CDATA[
      game.autodescription_description = game.autodescription_descriptionBak
      game.brief_descriptions = false
      msg ("Room Descriptions is now in its \"verbose\" mode, which always gives long descriptions of locations (even if you've been there before).<br/>")
    ]]></script>
  </command>

  • The modified ShowRoomDescription() function
  <function name="ShowRoomDescription"><![CDATA[
// BEGIN FIRST ADDED BIT FOR THIS EXAMPLE
    if (GetBoolean(game,"brief_descriptions")) {
      if (game.pov.parent.visited) {
        game.autodescription_description = 0
      }
    }
// END OF FIRST ADDED BIT FOR THIS EXAMPLE
    isDark = CheckDarkness()
    if (isDark) {
      descriptionfield = "darkroomdescription"
    }
    else {
      descriptionfield = "description"
    }
    if (game.autodescription) {
      desc = ""
      for (i, 1, 4) {
        if (i = game.autodescription_youarein) {
          if (game.autodescription_youarein_useprefix) {
            youarein = game.pov.parent.descprefix
            desc = AddDescriptionLine (desc, youarein + " " + GetDisplayName(game.pov.parent) + ".")
          }
          else {
            desc = AddDescriptionLine (desc, "<b>" + CapFirst(GetDisplayName(game.pov.parent)) + "</b>")
          }
          if (game.autodescription_youarein_newline) {
            msg (desc + "<br/>")
            desc = ""
          }
        }
        if (i = game.autodescription_youcansee) {
          objects = FormatObjectList(game.pov.parent.objectslistprefix, GetNonTransparentParent(game.pov.parent), Template("And"), ".")
          desc = AddDescriptionLine(desc, objects)
          if (game.autodescription_youcansee_newline) {
            msg (desc + "<br/>")
            desc = ""
          }
        }
        if (i = game.autodescription_youcango) {
          exits = FormatExitList(game.pov.parent.exitslistprefix, GetExitsList(), Template("Or"), ".")
          desc = AddDescriptionLine(desc, exits)
          if (game.autodescription_youcango_newline) {
            msg (desc + "<br/>")
            desc = ""
          }
        }
        if (i = game.autodescription_description) {
          if (HasScript(game.pov.parent, descriptionfield)) {
            if (LengthOf(desc) > 0) {
              msg (desc)
              desc = ""
            }
            do (game.pov.parent, descriptionfield)
            if (game.autodescription_description_newline) {
              msg ("")
            }
          }
          else {
            desc = AddDescriptionLine(desc, GetRoomDescription())
            if (game.autodescription_description_newline) {
              msg (desc + "<br/>")
              desc = ""
            }
          }
        }
      }
      if (LengthOf(desc) > 0) {
        msg (desc)
      }
    }
    else {
      if (HasScript(game.pov.parent, descriptionfield)) {
        do (game.pov.parent, descriptionfield)
      }
      else {
        fulldesc = GetRoomDescription()
        if (LengthOf(fulldesc) > 0) {
          msg (fulldesc)
        }
      }
    }
// BEGIN SECOND ADDED BIT FOR THIS EXAMPLE
    if (GetBoolean(game,"brief_descriptions")) {
      game.autodescription_description = game.autodescription_descriptionBak
    }
// END OF SECOND ADDED BIT FOR THIS EXAMPLE
  ]]></function>

Example game's code:

<!--Saved by Quest 5.7.6606.27193-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Room Descriptions">
    <gameid>cdf9bb53-4c92-434e-af0f-1bbf6648000c</gameid>
    <version>1.0</version>
    <firstpublished>2018</firstpublished>
    <start type="script">
      game.autodescription_descriptionBak = game.autodescription_description
    </start>
    <description>Just an example with BRIEF, SUPERBRIEF, and VERBOSE commands to handle room descriptions.</description>
    <attr name="autodescription_description" type="int">2</attr>
    <attr name="autodescription_youcansee" type="int">3</attr>
    <attr name="autodescription_youcango" type="int">4</attr>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <description><![CDATA[Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?<br/>]]></description>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="north" to="second room">
      <inherit name="northdirection" />
    </exit>
    <object name="Steve">
      <inherit name="editor_object" />
      <inherit name="namedmale" />
      <look>He looks like a man.</look>
    </object>
  </object>
  <command name="brief_cmd">
    <pattern>brief</pattern>
    <script><![CDATA[
      if (not GetBoolean(game, "brief_descriptions")) {
        game.brief_descriptions = true
        game.autodescription_description = game.autodescription_descriptionBak
      }
      msg ("Room Descriptions is now in its \"brief\" printing mode, which gives long descriptions of places never before visited and short descriptions otherwise.<br/>")
    ]]></script>
  </command>
  <command name="superbrief_cmd">
    <pattern>superbrief;short</pattern>
    <script><![CDATA[
      game.autodescription_description = 0
      msg ("Room Descriptions is now in its \"superbrief\" mode, which always gives short descriptions of locations (even if you haven't been there before).<br/>")
    ]]></script>
  </command>
  <command name="verbose_cmd">
    <pattern>verbose;long</pattern>
    <script><![CDATA[
      game.autodescription_description = game.autodescription_descriptionBak
      game.brief_descriptions = false
      msg ("Room Descriptions is now in its \"verbose\" mode, which always gives long descriptions of locations (even if you've been there before).<br/>")
    ]]></script>
  </command>
  <object name="second room">
    <inherit name="editor_room" />
    <description><![CDATA[But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?<br/>]]></description>
    <exit alias="south" to="room">
      <inherit name="southdirection" />
    </exit>
    <object name="Amanda">
      <inherit name="editor_object" />
      <inherit name="namedfemale" />
      <look>She looks like a woman.</look>
    </object>
  </object>
  <function name="ShowRoomDescription"><![CDATA[
    if (GetBoolean(game,"brief_descriptions")) {
      if (game.pov.parent.visited) {
        game.autodescription_description = 0
      }
    }
    isDark = CheckDarkness()
    if (isDark) {
      descriptionfield = "darkroomdescription"
    }
    else {
      descriptionfield = "description"
    }
    if (game.autodescription) {
      desc = ""
      for (i, 1, 4) {
        if (i = game.autodescription_youarein) {
          if (game.autodescription_youarein_useprefix) {
            youarein = game.pov.parent.descprefix
            desc = AddDescriptionLine (desc, youarein + " " + GetDisplayName(game.pov.parent) + ".")
          }
          else {
            desc = AddDescriptionLine (desc, "<b>" + CapFirst(GetDisplayName(game.pov.parent)) + "</b>")
          }
          if (game.autodescription_youarein_newline) {
            msg (desc + "<br/>")
            desc = ""
          }
        }
        if (i = game.autodescription_youcansee) {
          objects = FormatObjectList(game.pov.parent.objectslistprefix, GetNonTransparentParent(game.pov.parent), Template("And"), ".")
          desc = AddDescriptionLine(desc, objects)
          if (game.autodescription_youcansee_newline) {
            msg (desc + "<br/>")
            desc = ""
          }
        }
        if (i = game.autodescription_youcango) {
          exits = FormatExitList(game.pov.parent.exitslistprefix, GetExitsList(), Template("Or"), ".")
          desc = AddDescriptionLine(desc, exits)
          if (game.autodescription_youcango_newline) {
            msg (desc + "<br/>")
            desc = ""
          }
        }
        if (i = game.autodescription_description) {
          if (HasScript(game.pov.parent, descriptionfield)) {
            if (LengthOf(desc) > 0) {
              msg (desc)
              desc = ""
            }
            do (game.pov.parent, descriptionfield)
            if (game.autodescription_description_newline) {
              msg ("")
            }
          }
          else {
            desc = AddDescriptionLine(desc, GetRoomDescription())
            if (game.autodescription_description_newline) {
              msg (desc + "<br/>")
              desc = ""
            }
          }
        }
      }
      if (LengthOf(desc) > 0) {
        msg (desc)
      }
    }
    else {
      if (HasScript(game.pov.parent, descriptionfield)) {
        do (game.pov.parent, descriptionfield)
      }
      else {
        fulldesc = GetRoomDescription()
        if (LengthOf(fulldesc) > 0) {
          msg (fulldesc)
        }
      }
    }
    if (GetBoolean(game,"brief_descriptions")) {
      game.autodescription_description = game.autodescription_descriptionBak
    }
  ]]></function>
</asl>

Play the example game:
http://textadventures.co.uk/games/view/tks44blfveebumw-i1lhlg/room-descriptions


UPDATE

I must have started writing this before mrangel posted his suggestion.

One of the awesome things about Quest is how many ways you can approach any given situation.


ANOTHER UPDATE

I just made myself a library to handle this.

Everyone is welcome to it:
http://textadventures.co.uk/forum/samples/topic/y-ykeodite2pubg28rd-_q/infocom-style-room-descriptions


I use firsttime descriptions if that helps.

firsttime print nothing, otherwise brief description--- and then make a detailed description in the "after entering room".

Anonynn.


Thank you all for the help! In particular KV - brief/verbose was exactly what I was looking to replicate. That's much appreciated!


K.V.

Your welcome!

I'm glad you asked about that, because I'm including this in all my games now!

Happy gaming!


I've adjusted my code according to mrangel's suggestion too - the player.changedparent script now also sets and unsets an 'ismoving' flag, and the ShowRoomDescription() function has this checked as an extra if statement before disabling the descriptions - aka the 'look' command will always display the room description regardless of verbosity setting.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums