moving in a dark room in Quest

It looks like once you move to a dark room without a light source then none of the commands will work for the player. Is there a way to move out of the dark room, such as moving out of a dark cave into light.
It's also a problem if the touch runs out of battery power in the dark as the player can't change the battery. Putting the touch down then moving to another dark room also seems to stop game play as your in the dark so Quest won't respond to any commands by the player.


Is there a way to move out of the dark room, such as moving out of a dark cave into light.

The normal way to do this would be to make the exit a weak light source. Then it's bright enough to be seen in a dark room, but not bright enough to illuminate the rest of the room.

It's also a problem if the touch runs out of battery power in the dark as the player can't change the battery.

In most games that have a torch with limited battery, this is an intentional way to lose the game.
There are a couple of ways to change it depending on what you would like to happen in this case.

(one of my frustrations with the darkness system is that it doesn't account for checking the darkness level of a room other than the one where the player is. It's possible to work around this, but it's somewhat awkward. I've used a script before which renders exits visible if they lead to a room that isn't dark, but the code is pretty ugly. In another game, "Circus", I made a system where using the "go" command in a dark room causes the game to pick an exit at random; picking a non-compass exit (one of the ladders, or climbing into the dolphin tank) generates the response "You trip in the darkness and break your neck." instead)


Thanks mrangel.

At least I can use the weak light source exit. It will save the player from having to start over again.


One option I thought of was modifying the CheckDarkness function so that if the room is dark, it also checks all the current room's exits, and turns them into weak light sources if the room on the other side isn't dark. That would cover examples such as the player being able to find their way back to the room they just left their torch in; but it would need a little more code if, for example, the torch goes out when the player isn't present.


At the moment when their is a faint exit light you can still walk from a dark location into another dark location and once that happens all players commands are ignored.
What I would like to see if a way of preventing the player in a dark room from walking into another dark room by having the message "It's too dark to go in that direction" if the player tries to do this. Maybe there is a test to see if the player is in a dark room.

I don't know Quest well enought to find the CheckDarkness function.


At the moment when their is a faint exit light you can still walk from a dark location into another dark location

That's odd. Can you provide a test game to show this behaviour?
In a dark room, the player should be able to see only the illuminated exit, which presumably leads back into a lit area.

I don't know Quest well enought to find the CheckDarkness function.

I can't edit core functions on the web version, so can't really advise. Here's an alternate way to do it.

First, a function to check the darkness level of a room:

<function name="CheckDarknessForRoom" type="boolean" parameters="room">
  if (room = game.pov.parent) {
    level = CheckDarkness()
  }
  else if ((GetBoolean (room, "transparent") or GetBoolean (room, "isopen")) and HasObject (room, "parent")) {
    // If a torch goes out in a box, make sure we darken the containing room and not just the box
    level = CheckDarknessForRoom (room.parent) and GetBoolean (room, "dark")
  }
  else if (not GetBoolean (room, "dark")) {
    level = false
  }
  else {
    // Check for light sources
    level = true
    foreach (obj, ScopeVisibleForRoom(room)) {
      if (GetBoolean (obj, "lightsource") and GetString (obj, "lightstrength") = "strong") {
        level = false
      }
    }
  }
  if (not room.darklevel = level) {
    room.darklevel = level
    // the room has become dark or light; so change the lightsourceness of any exits leading here
    foreach (exit, AllExits()) {
      if (exit.to = room) {
        // don't mess around with doors that are lightsources anyway
        if (not HasBoolean (exit, "naturallightsource")) {
          exit.naturallightsource = GetBoolean (exit, "lightsource")
        }
        if (not HasString (exit, "lightstrength")) {
          exit.lightstrength = "weak"
        }
        exit.lightsource = level or exit.naturallightsource
      }
    }
  }
  return (room.level)
</function>

Then in the "roomenter" script of the game object (run whenever a player enters a room) you would do:

if (CheckDarkness()) {
  // we don't use ScopeExits() because that wouldn't check the ones that are currently dark
  foreach (exit, AllExits()) {
    if (exit.parent = game.pov.parent and HasObject (exit, "to")) {
      CheckDarknessForRoom (exit.to)
    }
  }
}

If you have a script which turns off or moves a lightsource when the player isn't in the room (such as a torch battery running out), you would also want to run CheckDarknessForRoom on its parent object. This means that if the player leaves their torch in an adjacent room and waits, the exit will no longer be illuminated when the torch goes out.

All off the top of my head, so my apologies for any errors there.


Thanks mrangel for the codes.

At the moment when their is a faint exit light you can still walk from a dark location into another dark location

That's odd. Can you provide a test game to show this behaviour?
In a dark room, the player should be able to see only the illuminated exit, which presumably leads back into a lit area.

In my adventure the only directions the player knows about are those included in the room text such as "The cave extends towards to west. There is a faint light in the east.". The panel that gives room directions is turned off so that the adventure looks like a text book.

I'll do some more experimenting on this to see what is possible.


Hi mrangel.

I did some testing using a test adventure and found that if you try to go to a direction that does not have a weak light source then you are told that "you can't go in that direction", so I'm not certain why my main adventure is not giving me that message and allowing me to go to another dark room in the cave. It may have something to do with the code you gave me to run at the start of the game go that I can type W, WEST, GO WEST, GO CAVE.
I've found with programming that if you change something in the code then it can cause problems elsewhere in the code.
I could have message "It's too dark to travel west" as the default dark room message to try and stop the player going into the another dark cave.
I might also be able to have a condition that if the player types W and is in the first dark room then I could have the code
if (game.pov.parent = Cave2) {
if (Cave1,dark) {
msg "You can't go in that direction
}
}


Hi mrangel.

It does not look like the 'W' word pattern script is going to work (see my previous post) as if I'm in other locations then I can't move west.
What I need is if condition does not pass then fall back on the default script for moving the player west.
The only other way that might work is to use the 'Before entering room' script for the dark location but then I would need a way in the script to stop the player from moving to the dark room.


It may have something to do with the code you gave me to run at the start of the game go that I can type W, WEST, GO WEST, GO CAVE

That shouldn't affect it.
Can you share your game so I can take a look at it? It shouldn't be too hard to figure out what is causing this problem.

What I need is if condition does not pass then fall back on the default script for moving the player west.

I believe I already showed how to do that in response to another question.

However, this is still a weird way to do it. Don't make another command without a good reason. If you just want to block off a particular exit, make that exit run a script instead of moving the player. Something like:

if (Cave1.darklevel) {
  msg ("It is too dark to find the path.")
}
else {
  MovePlayer (this.to)
}

Hi mrangel

How do I get my game to you?


Log in to post a reply.

Support

Forums