Background
You - the player - wake up in your bed after too much partying. The narrator recommends you GET UP and take care of the usual things you would do. So, you're going to go into the bathroom, to shower, perhaps use the toilet, brush teeth, shave, etc. But the room is dark, so you need to turn on the light. Only it doesn't work. That's not part of the game.
First, I present various parts of the code. I replaced Darkwarning because where there is a light switch, it would tell them to turn it on. In the game, where text appears IN UPPER CASE it's a hint to the player this is a recommended command. But where I expect the room to become visible, it does not.
Here is the relevant code:
Code: Select all
room your_bathroom "Bathroom"
{
sw_to your_corridor
out_to your_corridor
w_to your_room
in_to your_room
long_desc
"You are in your bathroom. You
can GO SW or OUT to
the hallway, GO IN or WEST to
your room."
is private , not light
}
lightswitch switch01
{
in your_bathroom
}
class lightswitch "light switch"
{
type lightswitch
nouns "light", "switch"
adjective "a"
is static, switchable, not switchedon, powered
breaker_num 200 ! no specific breaker
after
{
object DoSwitchOn, DoSwitchoff
{
local PP
PP = Parent(Player)
"Obj is ";
if object is not switchedon
"not ";
print "switched on. PP("; number pp; ")="; pp.name; \
" Loc("; number location; ")="; location.name
if location is not light
"(bef) location is not light"
else
"(bef) location is light"
if location is not light
location is light
else
location is not light
if location is not light
"(aft) location is not light"
else
"(aft) location is light"
DoLookAround
}
}
}
replace DarkWarning
{
! 2020-06-01 PR Check if there's a light switch in here
local i,pp
pp = Parent(Player)
for i in pp
{
if i.type = lightswitch
{
print "It's pitch black in here. "; \
CThe(player); " need"; MatchSubject(player); \
" to TURN ON LIGHT."
return
}
}
print CThe(player); " stumble"; MatchSubject(player); \
" around in the dark."
}
The extra message display is so I can see what is happening.
This is what happens when the game is played (transcript shortened for brevity):
Good evening, it is 9:41:52 p.m., on Monday, June 1, 2020.
Hello and welcome. Your objective is to get a book from the public library, any one in the region. [deleted]
The Librarian
A story of books (books? What are books?) And their acquisition.
[deleted]
Your room, lying on the bed
You awaken in your bed after a night of activities [deleted]
Anyway, since you're awake and not hung over, it probably wouldn't be a bad idea to GET UP and out of bed, and start the routine tasks you have to do when you first get up in the morning.
>get up
You have gotten out of bed and are standing in the middle of the room.
>look
Your room
This is your room'. From here, you can GO IN or EAST to the bathroom, .
The bed is here.
>east
It's pitch black in here. You need to TURN ON LIGHT.
>turn on light
Obj is switched on. PP(117)=Bathroom Loc(117)=Bathroom
(bef) location is not light
(aft) location is light
It's too dark to see anything.
>look
It's too dark to see anything.
>turn on light
Light switch's already turned on.
>turn off light
Obj is not switched on. PP(117)=Bathroom Loc(117)=Bathroom
(bef) location is light
(aft) location is not light
It's too dark to see anything.
>west
Your room
This is your room'. From here, you can GO IN or EAST to the bathroom, .
The bed is here.
>east
It's pitch black in here. You need to TURN ON LIGHT.
>turn on light
Obj is switched on. PP(117)=Bathroom Loc(117)=Bathroom
(bef) location is not light
(aft) location is light
It's too dark to see anything.
>w
Your room
This is your room'. From here, you can GO IN or EAST to the bathroom, .
The bed is here.
>e
Bathroom
You are in your bathroom. You can GO SW or OUT to the hallway, GO IN or WEST to your room.
Toilet, shower, sink, and light switch are here.
>
[/size]
So the thing is that if the bathroom is exited with the light on then re-entered, it works, but turning the light on and staying in the room does not work.
If you need more details, please ask. Thank you.