Object Descriptions in Room

How do I get the object's description to appear in the room description while it's in the room? So it'd show up like this:

"(Room Description) The room is dark and covered in chalk drawings.

There's a gun lying on the floor."

Then if they pick up the gun, the description is no longer there. I know I could do a "If


You could use the inroomdescription of that object


Where do I find that on the program itself? Or is it script code I can put in the object's description?


It should be on the object's tab itself.
Hmm, maybe what I'm referring to was dropped in Quest 5.80.


Are you using the online or the desktop version of Quest?


Desktop version of Quest.


Look, as far as I know, if you use the automatic room descriptions, it will just put in the room description something like "You see a gun."

I think the best way doing it is changing the room description for a script. The first part of the script is a print massage with the first part of the room's description. Then you add an scrip checking IF Object RoomX contains Object Gun, THEN print "There is a gun on the floor."

I find it a far better way to control the way the descriptions get into the game.


Hello.

Honestly, Deckrect's advice is the way I'd handle it, but to use in-room descriptions for objects:


First, click on the game object the object tree. Then, click on the "Features" tab.

Then, check the box to select "In-room descriptions [...]".

image


After doing that, your objects will have a new "In-room description" option.

EDIT
Also, make the object scenery by checking the "Scenery" option.

I used the text processor to check if the object is scenery before printing the in-room description in this (updated) example.

image


image


That only works before it is picked up the first time, though.

image


Where do I find that on the program itself? Or is it script code I can put in the object's description?

On the game's Features tab there is a checkbox "In-room descriptions: additional text which each object contributes to a room description"

Once that is enabled, the object's Setup tab will have a space at the bottom for "In-room description".
This will be added to the end of the room description when the object is present, but it will not remove the object from the "You can see:" list. So if you don't want the object to be mentioned twice, you would need to either make it 'scenery', or turn off the objects list.

I've made a little modification that causes an object to be displayed only once, but this requires modifying some of the core functions so only works on the desktop editor.


Ah, posting at the same time :)


This is the way I'd advise a new Quest user handle Deckrect's advice:

If the gun object is actually gun and the current room name is actually room, set the scenery attribute on the gun object to true. (Don't worry, when it is picked up the first time, scenery will be changed to false; which also makes this only work before the gun is picked up for the first time.)

The room description:

The room is dark and covered in chalk drawings.{if gun.parent=room:{if gun.scenery:

There's a gun lying on the floor.}}

Screenshots:


image


image


But after taking the gun the first time, the magic is gone.

If you drop it again using this code, it will just go back to the defaults:

image


PS

If you want to get more complicated than this, you can make the game behave however you want. So, just say the word if you want to get down even funkier than any of the current examples will allow.


Ha!

I see I missed two posts by mrangel whilst playing with all of that code.

As he says, you can get a little bit more complicated if you wish and modify the objects list behavior.


I couldn't find anything in the docs explaining the in-room descriptions; so, I posted all the screenshots in that first example. (I only searched through the docs for 3 or 4 minutes. So, there may already be an existing one that I missed.)


In case you want to see it, this is how I'd modify two functions so that objects with "in room descriptions" are removed from the default "You can see:" list:

Click to show As usual, I've highlighted code I added in green, and code I replaced in blue.
  <function name="ShowRoomDescription">
    <![CDATA[
      if (GetBoolean (game, "suppressduplicateobjects")) {
        game.pov.objectsinroomdescription = NewObjectList()
      }
      showndescription = false
      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 = ""
            objectlist = RemoveSceneryObjects (GetDirectChildren (GetNonTransparentParent (game.pov.parent)))
            if (isDark) {
              objectlist = RemoveDarkObjects (objectlist)
            }
            if (GetBoolean (game, "suppressduplicateobjects") and ListCount(objectlist) > 0) {

              // Bodge to make it work if the description is after the object list, or there's no newline between them
              game.tempdictionary = game.textprocessor_seen
              if (not showndescription) {
                ProcessText (GetRoomDescription ())
              }
              else if (not desc = "") {
                ProcessText (desc)
              }
              game.textprocessor_seen = game.tempdictionary
              game.tempdictionary = null
              // I apologise for the ugliness of the bodge above. Feel free to remove it if you don't need it

              objectlist = ListExclude (objectlist, game.pov.objectsinroomdescription)
            }
            if (ListCount (objectlist) > 0) {
              objects = game.pov.parent.objectslistprefix + FormatList(objectlist, ", ", 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) {
            showndescription = true
            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)
          }
        }
      }
    ]]>
  </function>

<function name="ProcessTextCommand_Object" type="string" parameters="section, data">
    <![CDATA[
    objectname = Mid(section, 8)
    text = ""
    colon = Instr(objectname, ":")
    if (colon > 0) {
      text = Mid(objectname, colon + 1)
      objectname = Left(objectname, colon - 1)
    }
    object = ObjectForTextProcessor(objectname)
    if (object = null) {
      return ("@@@open@@@" + ProcessTextSection(section, data) + "@@@close@@@")
    }
    else {
      if (HasAttribute (game.pov, "objectsinroomdescription")) {
        list add (game.pov.objectsinroomdescription, object)
      }
      if (LengthOf(text) = 0) {
        text = SafeXML(GetDisplayAlias(object))
      }
      if (game.enablehyperlinks) {
        linkid = ProcessTextCommand_GetNextLinkId()
        colour = ""
        if (HasString(object, "linkcolour") and GetUIOption("UseGameColours") = "true") {
          colour = object.linkcolour
        }
        else {
          colour = GetLinkTextColour()
        }
        style = GetCurrentTextFormat(colour)
        return ("<a id=\"" + linkid + "\" style=\"" + style + "\" class=\"cmdlink elementmenu\" data-elementid=\"" + object.name + "\">" + text + "</a>")
      }
      else {
        return (text)
      }
    }
    ]]>
  </function>

Good! I thought I was dreaming about seeing that before.


Thank you so much! I hadn't realised I needed to enable it. :)


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

Support

Forums