Light / Dark problem.

I've given myself a lot of work by making all my interiors dark - meaning the player needs to use his torch.

Before I explain the issue, let me say I know the game has built in light/dark scripts, but suffice to say I don't like them, so do things like this in my own special way.

Anyway, I want the room description to run when they use the torch, but although I've done this, the message about it being dark gets printed again, which obviously doesn't make sense.

This is the script I'm using on the torch:

msg ("You switch on the torch. The beam is good and strong.")
ShowRoomDescription

Then in each room I have:

if (GetBoolean(torch, "switchedon")) {
  firsttime {
    msg ("Room description")
  }
  otherwise {
    msg ("Subsequent visits room description")
  }
}
else {
  msg ("It's too dark to move.")
}

But when the player switches the torch on it says "It's too dark to move" and then prints out the room description. How do I avoid the 'too dark' message being printed when the player turns on the torch?


You really should learn to use the default scripts that come with Quest and then once you master them, start creating your own and your own flags.

From first glance and I could be wrong but you should make sure that your torch.object's lightstrength is set to "strong" and not "weak". If the lightsource is set to "weak" it will only illuminate exits (when placed on an exit) otherwise it won't do anything.

Second, make sure that the torch also sets each room "dark" false so Quest knows that you're setting the scripts to be light. For example...

if (GetBoolean(torch, "switchedon")) {
this.dark=False
firsttime {
msg ("Room description")
}
otherwise {
msg ("Subsequent visits room description")
}
}
else {
this.dark=True
msg ("It's too dark to move.")
}

Try that :)


[removed]


Thank you. The first of those works, except it's not throwing out the room description when they turn the torch on.

The second one throws errors.


Thank you again, but in actual fact your first theory was correct. I hadn't seen the is a light source tab on the torch object. If you enable this and set it to strong as you suggest, it handles the ShowRoomDescription itself, so I could remove mine from the use and switch tabs.

However, I now have another niggle. I'm using the following code to stop the player from moving if they try to do so when the torch is off, but it still allows them to move.

if (IsSwitchedOn(torch)) {
  firsttime {
    msg ("Room description")
  }
  otherwise {
    msg ("Room description")    
  }
}
else {
  msg ("You can't see a thing.")
  MoveObject (player, stairs5)
}

Where stairs5 is the name of the player's current location.

Why isn't this stopping the player from moving when the torch is switched off?

I can fix this by running the following script on the exit, instead of letting it move the player automatically:

if (IsSwitchedOn(torch)) {
  MoveObject (player, upstairs test)
}
else {
  msg ("You can't see a thing.")
}

But it would cut down a lot of work if I didn't have to do this on every exit that requires a light source.

Thinking about it, though, is there any harm in letting the player move about in the dark? The only response they're ever going to get while their torch is switched off is "You can't see a thing." so they're not going to get far anyway.


You're welcome. It might still be moving the player because you are physically moving them with the "MoveObject" codes. Without them, I don't think the player would be able to move in the darkness. Just a theory. You are basically over-riding the functionality of the darkness, aka "this.dark"

Also, if the rooms, or any surrounding rooms have any kind of lightsource near, or on their exit, it'll enable the player to move. Try to remove the MoveObject codes from one or two of the rooms and see if it stops them from moving.

Anonynn.


The move player scripts are on the exits, not the room. I've tried it without them and it still moves the player.

With the above scripts on the exits it works as it should.

I think the problem with the room script, is that the move script which is supposed to stop them from moving if they don;t have a light source, isn't working because I'm trying to move them to the room they're already in.


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

Support

Forums