Object headache

OurJud
I'm having difficulty making an object stay where it is. If the player types 'take log book' when at the reception desk, I run a script which triggers the appearance of a security guard, effectively meaning the player doesn't get chance to physically take the log book.

I then have a system which has you tussling with the security man who who you bundle and lock into a back room.

If the player goes away from the desk and then returns, and types 'take log book' again, there is no security guard to stop him from doing so, but when I test this I get "I can't see that' on the second attempt.

I choose 'run script' on the inventory tab, rather than 'default response', and this is the script I'm using:

if (not GetBoolean(player, "security")) {
msg ("Just as you reach over the desk to grab the log book, a security man appears from around the corner.<br/><br/>\"Can I help you, sir?\" he asks firmly and with more than a little suspicion.<br/><br/>\"Yes,\" you say, trying to sound confident. \"I'd like my room key, please.\"<br/><br/>The man lifts a flap and steps behind the desk. \"What name is it?\" he asks.<br/>")
SetObjectFlagOn (player, "security")
MoveObject (log book, reception desk)
}
else if (GetBoolean(player, "security")) {
msg ("You reach over and grab the log book and flick through the list of residents. There are pages and pages. You toss it away impatiently.")
MoveObject (log book, reception desk)
}

What am I doing wrong?

OurJud
I've done some more testing, and after I take the log book for the first time, I can't even (l)ook at or e(x)amine it.

So the problem is the command 'take log book' - even though after I take it, it's not in my (i)nventory. I've tried every conceivable way to 'return' the object to the room, immediately after taking it, but none work.

The problem is, if I chose the default response and leave the check box for 'object can be taken' unchecked (so that it can't be taken) I can't then run a script. I'm just left with the default message or my own message.

jaynabonne
You move the log book to the reception desk. Unless that is some sort of surface or container, then the log book is no longer visible, and you can't take it. Is there some reason you're leaving it where it is? (I assume it's so you can't take it until the security guard has been defeated, but I wanted to be sure before I offered a solution.)

jaynabonne
Or is "reception desk" the room?

OurJud
Reception desk is set to 'room and/or object'.

And yes, trying to take it the first time is a trap to trigger the security guard. The log book is of no use to the player, hence my throwaway line if he tries to take it after the security guard has been locked in the back room.

[edit] I set 'reception desk' to a 'container' and made it a surface, but I still get the same problem.

jaynabonne
But is "reception desk" the room you're in?

OurJud
jaynabonne wrote:But is "reception desk" the room you're in?

Yes.

I think.

Wait.

Yes. The log book is an object in the 'reception desk' room/object, and it's on the log book inventory/take tab that I run the above script.

Even if I trigger the tussle with the security guard and then type 'take log book' without moving away from the desk, I still get "I can't see that."

The Pixie
OurJud wrote:Reception desk is set to 'room and/or object'.

All that does (I think) is change the tabs you see when you are editing the game. When the game is being played there is no difference between a room and an object (like, if you want a script to test which it is, I am not sure it is even possible).

The question is really is "Reception desk" the object the player is in, or another object within the object the player is in?

OurJud
The Pixie wrote:The question is really is "Reception desk" the object the player is in, or another object within the object the player is in?

Can't get my head around that. Sorry.

This is a transcript showing the issue.

You push the large double glass doors and walk into the lobby. Marble pillars and sparkling, highly poilished surfaces are everywhere. An unmanned reception desk lies on the west side of the lobby, while a large elevator is to the north.

Behind you lie the glass doors that lead back out to the street.

> w
You approach the desk for closer inpsection.

It's currently unmanned and on the wall to its back is a grid of small locked containers - presumably holding the room keys. The work area behind the desk is littered with papers and a large, leather-bound book titled 'Residents Log Book'.

The elevator is north. The lobby area is east.

> take log book
Just as you reach over the desk to grab the log book, a security man appears from around the corner.

"Can I help you, sir?" he asks firmly and with more than a little suspicion.

"Yes," you say, trying to sound confident. "I'd like my room key, please."

The man lifts a flap and steps behind the desk. "What name is it?" he asks.

> bla bla bla
The man becomes even more suspicious. "I'm afraid I'm going to have to ask you to leave, sir."

In desperation you pull out your gun and point it at his head. "Do as I tell you and you head stays on your shoulders."

The man freezes in fear.

You wave your gun at the wall of containers behind him. "I want the key to room 56!"

He nods, and reaches into his pocket, pulling out a small card which he swipes across the face of the container numbered 50-60. Visibly shaking, he fumbles through the collection of cards inside until he locates the one for room 56. He pulls it out and tosses it onto the desk in front of you.

> take card
You grab the keycard and force the security man into the office room behind reception, locking him inside.
The elevator is to the north. East will return you to the lobby area.

> take log book
I can't see that.

jaynabonne
If the player is in a room (e.g "reception"?) and there is an object named "reception desk" in that room, and the log book is a child of that reception desk, you'll only be able to see the log book if the reception desk is some sort of open container or surface. Otherwise, it will be hidden in the reception desk.

I don't know if you need to move it at all. If you're moving it to the reception desk to "undo" taking it, then you don't need to. If you provide a script to run on "take", then it overrides all default behavior, including the actual taking of the object. So you can just leave it alone; it will still be there - unless you're trying to hide it until the guard is dispatched.

jaynabonne
Regarding Pixie's question, we're struggling to understand your setup in the absence of actual code to look at. We don't know what "reception desk" is, what room this is, etc.

OurJud
jaynabonne wrote:If the player is in a room (e.g "reception"?) and there is an object named "reception desk" in that room, and the log book is a child of that reception desk...

Ah, so if I make the room the child, instead of the desk (or vice versa) is should work?

No scrap that. I have 'reception desk' set to 'object and/or room'.

I'm trying to understand what you're both saying, but why can I see and take the log book when I first approach the desk?? If I never move away from that room/object, then why can't I see/take the log book a second time?

The Pixie wrote:

"OurJud"

Reception desk is set to 'room and/or object'.


All that does (I think) is change the tabs you see when you are editing the game. When the game is being played there is no difference between a room and an object


As for why I've set it to 'room and/or object' I wanted to be able to use the 'look' function and have the option to create exits using the proper 'exits' tab.

jaynabonne
What is the name of the room the player is in where this takes place?
Is "reception desk" an object within the room?
Since moving the log book to the reception desk seems to hide it, it seems fairly clear that the log book's parent is not initially that object. One way to find out is to run your game, click on Debugger, find the log book under the "Objects" tab, click on it and find the "parent" attribute to see what it is initially.

We really need to know the context (setup) within which this script is running.

Given your last statement, it seems that "reception desk" is the room the player is in (since you want to have exits from it). But I'm still not sure. (Once again, it would make it so easy to just see your game file!)

OurJud
jaynabonne wrote:What is the name of the room the player is in where this takes place?
Is "reception desk" an object within the room?
Since moving the log book to the reception desk seems to hide it, it seems fairly clear that the log book's parent is not initially that object. One way to find out is to run your game, click on Debugger, find the log book under the "Objects" tab, click on it and find the "parent" attribute to see what it is initially.

The log book's parent is 'Object: reception desk'

Okay, I'll upload the file.

jaynabonne
First gander, you have this as well:

<ontake type="script">
SetObjectFlagOn (player, "security")
RemoveObject (log book)
</ontake>

OurJud
jaynabonne wrote:First gander, you have this as well:

<ontake type="script">
SetObjectFlagOn (player, "security")
RemoveObject (log book)
</ontake>

I can find that in my code, but God knows where it is in the UI.

I don't want to just remove it from the code, as without seeing it in the UI I don;t really know why it's there.

Found it. It's part of the attributes tab on 'log book', but I can't see where I've set it.

OurJud
That was it!

Thanks very much, both. I'll never stop marveling at how you dig these bugs out.

HegemonKhan
just in case you're interested in this (though I guess your issue has already been solved~fixed; when I started to read your op I thought you were asking about this, which I'm addressing in this post of mine) too:

for changing between 'able' and 'unable' for Boolean~Flag Attributes:

'take', 'drop', 'enabled', 'use', 'give', 'wear', etc etc etc

in scripting:

set (Object_name, "Attribute_name", Attribute_Value)

set (log_book, "take", false)
set (log_book, "take", true)

or

for making true: SetObjectFlagOn (Object_name, "Attribute_name")
for making false: SetObjectFlagOff (Object_name, "Attribute_name")

SetObjectFlagOn (log_book, "take")
SetObjectFlagOff (log_book, "take")

in code tagging:

<object name="Object_name">
<Attribute_name type="boolean">Value</Attribute_name>
</object>

// initially setting 'take' as 'false'
<object name="log_book">
<take type="boolean">false</take>
</object>

// or initially setting 'take' as 'true'
<object name="log_book">
<take type="boolean">true</take>
</object>

// when set as 'true', it is often in its shortened form
<object name="log_book">
<take />
</object>

<turnscript name="global_turnscript">
<enabled type="boolean">false</enabled>
</turnscript>

<turnscript name="global_turnscript">
<enabled type="boolean">true</enabled>
</turnscript>

// and its shortened form for being true
<turnscript name="global_turnscript">
<enabled />
</turnscript>

OurJud
It's happened again! How can I have been doing this so long and still not be able to understand??

I'm just trying to create a simple 'locked door' sequence, but I'm getting "I can't see that" again when I type 'open door' ??

This is the section of the game code for the sequence in question.

<object name="floor 5">
<inherit name="editor_room" />
<description type="script"><![CDATA[
msg ("The elevator doors open and you step out into a long corridor, lined on both sides with five doors. The arctitect for this place was obviously a fan of minimalism, judging by the bareness of the walls.<br/><br/>Each door is made from solid wood, their only feature a series of thin grooved lines running from top to bottom. They're all chesnut in colour and finished to a very high standard.<br/><br/>You check the number on the first door - 51.<br/><br/>Number 56 is five doors to the north.")
]]></description>
<object name="door56">
<inherit name="openable" />
<description><![CDATA[You step up to the door. A vertical slot for swiping the keycard runs through the base plate of the door handle.<br/><br/>You hold your breath and place your ear to the door, unsure if you'd hear anything through such a thick slab of wood, even if the room <i>was</i> occupide.]]></description>
<look>Made from solid wood and dyed a dark chestnut colour.</look>
<feature_container />
<openscript type="script">
if (not GetBoolean(door56, "swiped")) {
msg ("The door's locked solid.")
}
else {
msg ("You push the door and slip into the apartment quietly.")
}
</openscript>
<alias>door</alias>
<closescript type="script">
msg ("You close the door.")
</closescript>
<drop type="boolean">false</drop>
<exit alias="south" to="floor 5">
<inherit name="southdirection" />
</exit>
<command>
<pattern>knock; knock on door; knock at door; knock again; knock on door again</pattern>
<script><![CDATA[
firsttime {
msg ("You rap three times on the door, trying to sound as inconpicuous as possible.<br/><br/>Several minutes pass without a response.")
}
otherwise {
msg ("You knock again, louder this time. Still no reply.")
}
]]></script>
</command>
<command>
<pattern>swipe card; swipe keycard; swipe key card; swipe key; use keycard; use card; use key</pattern>
<script>
SetObjectFlagOn (door56, "swiped")
msg ("A quick swipe of the card is accompanied by a high-piched beep and deep clunk as the lock mechanism disengages.")
</script>
</command>
<object name="room56">
<inherit name="editor_room" />
</object>
<exit alias="in" to="room56">
<inherit name="indirection" />
</exit>
</object>
<exit alias="north" to="door56">
<inherit name="northdirection" />
</exit>

Silver
Have you set 'door' as the alias for 'door56'?

jaynabonne
I took that room and dropped it into an empty game and put the player there, and when I type "open door", it says "The door's locked solid."

What do you type to see the problem?

jaynabonne
I did try to swipe the card, but that doesn't work because the command is attached to the door instead of the room. And since the player is not in the door, it doesn't kick in. When I moved the commands into "floor 5" instead, then I can swipe the card, knock on the door, etc. And after I swipe the card, I can open the door.

OurJud
Silver wrote:Have you set 'door' as the alias for 'door56'?

Yes.

jaynabonne wrote:I took that room and dropped it into an empty game and put the player there, and when I type "open door", it says "The door's locked solid."

What do you type to see the problem?

'open door'

jaynabonne wrote:I did try to swipe the card, but that doesn't work because the command is attached to the door instead of the room. And since the player is not in the door, it doesn't kick in. When I moved the commands into "floor 5" instead, then I can swipe the card, knock on the door, etc. And after I swipe the card, I can open the door.

Thanks, I'll see to that.

OurJud
Right just discovered something.

I start the sequence at the end of the corridor (titled 'floor5'). If I type 'open door' there, I get the correct message, but I have an exit leading north from 'floor5' to 'door56'. If I follow the exit to get to the door, and then type 'open door', that's when the commands fail.

So, the sequence works if I do it while in 'floor 5', but if I move north to 'door56' it doesn't work, but I don't understand why. The parent of 'door56' is 'floor 5', which explains why I need to be in 'floor 5' for the commands to work, but how do I get the player to move down the corridor and have the sequence work?

jaynabonne
If you're inside the door, you can't see it as "door". It's the room you're in, not an available object.

OurJud
jaynabonne wrote:If you're inside the door, you can't see it as "door". It's the room you're in, not an available object.

Yes, that makes sense, but how do I fix it?

Do I just 'move' the player to the door in the description, rather than setting it as an exit?

jaynabonne
Perhaps create another room which is "in front of door" and put the door in there? Or add another object with alias "door" to handle the opening, etc. Basically, you need another object somewhere. You're conflating "being near the door" with the door itself.

OurJud
jaynabonne wrote:Perhaps create another room which is "in front of door" and put the door in there? Or add another object with alias "door" to handle the opening, etc. Basically, you need another object somewhere. You're conflating "being near the door" with the door itself.

Thanks, Jay. I just did away with the exit leading to the door and moved the player there in the description for 'floor 5'.

It's really weird sometimes, especially if you have an imagination like mine, to remember that my 'virtual player' isn't actually walking down a corridor when I make an exit leading there. In my head, he's walked to the door, so then when I get 'I can't see that' on typing 'open door' it's hard for me to understand why :?

jaynabonne
I can understand that. :)

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

Support

Forums