ExitDescriptions v1.0 Release - Give exits in-room descriptions just like objects!

ExitDescriptions v1.0

Online Playable Demo

v1.0 Download

If you're using the automatically-generated room description system in Quest (and why wouldn't you be), the list of exits look something like this:

You can go north, south, east, or west.

That seems a little bland. What if you wanted to say, "To the north you see a path leading towards a giant ferris wheel"?
Unfortunately, in Quest the only way to add flavor text to exits is to disable the exits list altogether and manually insert your exit list into the room description. But what if there was a better way, one that allowed you to describe an exit however you darn well please while still using the built-in room description system?

ExitDescriptions is a lightweight library that adds a tab to an exit's editor window, which allows you to add custom text to a room's description without the need to override or disable the built-in room description feature. The system is very similar to Quest's built-in object in-room descriptions, and when the two systems are used together you can really give the player a vibrant, detailed picture of their surroundings.

The system can handle any combination of exits in a room that have or don't have custom descriptions, handling exits without custom text the normal way. You can see how these situations are handled in the online demo, linked above. You can write flavor text for the important directions and ignore the mundane ones, no problem.

Installation
You install this like any other library. Like all custom libraries, this does not work with the web editor, so you'll need to be using desktop. Download the library from the link above and import it into your project. The load order does not matter as long as it is after the core libraries. Save and reload your project when prompted.

How to use
When you select an exit in the editor, a new tab labeled "Description" will appear. Simply enter the text you want to use to describe that exit into the text box. You can also leave it blank, and the exit will display the regular way (e.g. "You can go north"). If you don't want an exit to appear in the description at all, check the "Scenery" option in the exit's main editor tab.

Compatibility
ExitDescriptions is extremely lightweight, overriding only one core function, FormatExitList. Therefore it will be compatible with 99.99% of libraries. The only incompatibilities are libraries that also edit FormatExitList, and libraries that give exits the attribute inroomdescription.

By the way...
This probably should go without saying but I will put it here just in case. This library doesn't magically create scenery objects for you or allow players to interact with objects that are technically in a different room. So if, say, one of your exit descriptions happens to mention a ferris wheel, it might be a good idea to create a ferris wheel scenery object in case players try to interact with it.

Known Bugs
None so far :)

Planned Features
Please make suggestions below :)


It's a nice little library, but unfortunately, it disables the direction hyperlinks, and I quite like those! Whereas before 'you can go north' would allow the player to click on north and boom, now they're just text, regardless of whether or not a description was added.


Yep, that's unfortunately a side effect. Working on an update in the next few days, will update with an option to enable/disable.

In the meantime, the exit descriptions are text-processor enabled however so I suppose you could add the command links manually until I can get the update out.


That looks pretty neat.

This is how I'd add links

Probably not the most efficient way to do it.

  <function name="FormatExitList" type="string" parameters="preList, list, preFinal, postList">
    <![CDATA[
    result = ""
    // first, the ones with descriptions
    foreach (item, list) {
      linkedexits = NewObjectList()
      if (HasString (item, "inroomdescription")) {
        desc = item.inroomdescription
        if (IsRegexMatch ("\{.+\}", desc)) {
          game.text_processor_this = item
          desc =  ProcessTextSection (desc, QuickParams ("linked_exits", linkedexits))
        }
        if (not ListContains (linkedexits, item)) {
          if (GetBoolean (item, "inroomdescriptionlink")) {
            if (Instr (desc, item.alias) > 0) desc = Replace (desc, item.alias, "{exit:" + item.name + "}")
            else desc = "{exit:" + item.name + ":" + desc + "}"
            list add (linkedexits, item)
          }
          else if (GetBoolean (item, "nolonk")) {
            list add (linkedexits, item)
          }
        }
        result = result + desc + " "
      }
    }
    result = LTrim(result)
    list = ListExclude (list, linkedexits)

    // Process exits without descriptions
    listLength = ListCount(listFiltered)
    if (listLength > 0) {
      count = 0
      result = result + " " + preList + " "
      foreach (item, listFiltered) {
        result = result + item.alias
        count = count + 1
        if (count = listLength - 1) {
          result = result + " " + preFinal + " "
        }
        else if (count < listLength) {
          result = result + ", "
        }
      }
      result = result + postList
    }
    return (result)
  ]]>
  </function>

This also expects a slight change of the text processor's "{exit:" command; which I've been using for other things anyway. This basically causes the text processor to maintain a list of exits that it's generated a link to.

  <function name="ProcessTextCommand_Exit" type="string" parameters="section, data">
    <![CDATA[
    exitname = Mid(section, 6)
    // Was 'GetObject', which is silly. Should use the more appropriate function
    exit = ObjectForTextProcessor(exitname)
    if (exit = null) {
      return ("@@@[email protected]@@" + ProcessTextSection(section, data) + "@@@[email protected]@@")
    }
    else {
      // Makes a list of linked exits that the calling function can check
      if (not DictionaryContains (data, "linked_exits")) dictionary add (data, "linked_exits", NewObjectList())
      list add  (DictionaryItem (data, "linked_exits"), exit)
      verbs = GetDisplayVerbs(exit)
      alias = GetDisplayAlias(exit)
      command = LCase(StringListItem(verbs, 0)) + " " + alias
      style = GetCurrentLinkTextFormat()
      return ("<a style=\"" + style + "\" class=\"cmdlink exitlink\" data-elementid=\"" + exit.name + "\" data-command=\"" + command + "\">" + alias + "</a>")
    }
    ]]>
  </function>

(sorry to reply with code off the top of my head; my internet went down right after loading this page, so I'm not in a position to test it, upload the file somewhere, or do my job for a while. So thought it might be worth scribbling down the first thing that came to my mind)

This one provides some flexibility to your links:

  • The in-room description can be something like A dark tunnel leads {exit:this}. or There is a heavy {exit:this:oaken door} opposite the fireplace. (I figured making it work with 'this' would make it easier than messing about with named exits)
  • If it doesn't have an exit link in the description, setting the exit's inroomdescriptionlink attribute to true will create a link. Either linking the item's alias if it appears in the in-room description, or the whole description otherwise.
  • The list of exits without detailed descriptions will also include any that don't have a link in their description, unless they have the attribute nolink. I can see a few edge cases where this could be useful, and none where it would be a problem.
    • One example; A stone staircase in one corner leads {exit:up_staircase3:up} and {exit:this:down}. - allows the in-room description of one exit to mention another, so two exits can share a description.
  • I'll leave it to someone with library experience to add checkboxes for those two attributes, if necessary.

Log in to post a reply.

Support

Forums