Modified Core Functions

Just being curious. Recently I've had cause to ask questions concerning modifying existing 'core' functions: See thread topics below.

http://textadventures.co.uk/forum/quest/topic/sndmg3rcdecgbayrcqx2ka/alphabetized-you-can-see-object-list

http://textadventures.co.uk/forum/quest/topic/50zn3-sb-usamdth9loohg/dark-room

I was just wondering if anyone else has modified 'core' functions, and if so, which ones and why?


I've considered redoing FormatObjectList so that it includes the Oxford comma on object lists of 3 or more. While I haven't actually done that, I have borrowed this function to create a customized function for an object list response (where I can use any object list in the game) and I did add the Oxford comma to that function.


I've considered redoing FormatObjectList so that it includes the Oxford comma on object lists of 3 or more. While I haven't actually done that, I have borrowed this function to create a customized function for an object list response (where I can use any object list in the game) and I did add the Oxford comma to that function.

I did that as well :)

My version of FormatObjectList now alphabetises the list, looks for a configuration attribute game.useoxfordcomma, and collapses items with the same alias into "three stones" or similar. Next task is playing around with javascript so that the pop-up verb menu on such multiple items will allow you to select how many (One by default; picking more than one passes a random selection of the objects using the parser's multiple flag).


Does it count if I abandoned a modified function and created two types instead?


I was using something like what you (DrAgon) ended up with here:

http://textadventures.co.uk/forum/quest/topic/50zn3-sb-usamdth9loohg/dark-room

...but, after two of my games with altered scripts were rendered "broken" * due to script changes in the recent build of Quest (not the release, mind you - just the current source on GitHub), I have decided to refrain from modifying functions as much as possible. (JS functions don't count (in my current rulebook), by the way.)

ANOTHER NOTE: This function (concerning the dark rooms) was not the straw that broke the camel's back. It still worked perfectly. The problem was that I couldn't pick anything up. It was easy to fix it, but, if I had that function in numerous games, it would have sucked a little bit. (This is not me complaining about updates, by the way. Updates: good! KV altering functions: bad!)

EDIT: I think I was only having problems because I was playing the .aslx file from the unreleased version of Quest. I bet it would have been fine if I were playing the .quest file, with all the functions and such intact.


Here are the two types I use to make my dark rooms react to light sources now:

  <type name="lightsourcetype">
    <changedlightstrength type="script"><![CDATA[
      if (this.lightstrength = "weak") {
        msg ("The light from "+GetDisplayNameLink(this, "verbslist")+" has receded.<br/>")
        isdark = CheckDarkness()
        if (isdark) {
          if (HasAttribute(game.pov.parent, "aliasDark")) {
            game.pov.parent.alias = game.pov.parent.aliasDark
          }
          ShowRoomDescription
          JS.updateLocation (GetDisplayName(game.pov.parent))
        }
      }
      if (this.lightstrength = "strong") {
        if (game.pov.parent.dark) {
          litSource = false
          foreach (o, ScopeReachable()) {
            // msg ("checking: "+o)
            if (HasAttribute(o, "lightstrength")) {
              // msg ("Found another light source: "+o)
              if (not o.lightstrength = "strong") {
                // msg (o+" is not STRONG")
              }
              else {
                // msg (o+" is STRONG")
                if (not this = o) {
                  litSource = true
                }
              }
            }
          }
          if (not litSource) {
            if (HasAttribute(game.pov.parent, "aliasLit")) {
              game.pov.parent.alias = game.pov.parent.aliasLit
            }
            ShowRoomDescription
            JS.updateLocation (CapFirst(GetDisplayName(game.pov.parent)))
          }
        }
      }
    ]]></changedlightstrength>
  </type>
  <type name="darkroomtype">
          <feature_startscript />
      <attr name="_initialise_" type="script">
        foreach (o, FilterByType(AllObjects(), "darkroomtype")) {
          o.aliasLit = GetDisplayName(o)
          o.aliasDark = "Darkness"
          o.usedefaultprefix = false
          if (o.dark) {
            o.alias = o.aliasDark
          }
        }
      </attr>
  </type>

I was just curious if other writers were modifying core functions. In the case of the 'dark room' for example, I was frustrated by the fact that if you entered a room that was dark, with no light source, how did you know you were in a hall or a kitchen for example. With the alphabetized object list, I just think it looks better with the objects listed in alphabetical order. I've also followed Pixie's tutorial and modified the 'Go' function to disable movement when the player is sat down or standing on something.
Currently I'm looking at modifying the 'DoDrop' function, so if you have specified a different 'dropdestination' for a room a message appears telling the adventurer what has happened to it, at the moment you just drop the object and it disappears; it'll be nice if your in a tree you get told 'You drop it. The [insert object name here] falls through the boughs of the tree and lies on the ground', as opposed to 'You drop it'.


Log in to post a reply.

Support

Forums