Make object visable when LOOK AT

So I'm very new to quest and am trying to make a pillow (object, child of bed object) visable when I look at a bed. In the same room I have a cell door which has a small window that I'd like to make visable when examined. Thanks much!

Ps. Using quest offline


On the bed object in the editor you can change the Look At description to Run a script, this is on the Setup tab.
Click on the new Add Script button that appears and there is an option under the Object subject title named 'Make Object Visible', select that and choose the object that matches what you want.
The way to code this is:

MakeObjectVisible(Object Name)

K.V.

You could also make the bed a surface type of container, then select Hide children.. and List items when looked at.

This is basically what ShadowsEdge19 advised, only with more clicking and less coding:

image


image


image

Show Children when Looking

You are in a room.
You can see a bed.

> x pillow
I can't see that.

> x bed
Nothing out of the ordinary.
It contains a pillow.

> x pillow
Nothing out of the ordinary.


NOTE: With this setup, anyone re-playing that part of your game would be told "I can't see that" if they tried interacting with the pillow BEFORE viewing the bed.

In some cases (but definitely not most cases), it's better to make an object which is on a surface scenery (especially if it's a table), then use object.scenery = false after whatever trigger event occurs. That way, when the player is going through that part of the game again, they could just grab the pillow without fooling with the bed, but the pillow wouldn't be listed in the room description until either (a)the bed is examined or (b)the pillow is taken. (The game telling me that the pillow isn't on the bed until I've looked at the bed is one of those little things that bothers me for no good reason.)

The 'hide children' option makes the items on or in that object invisible.

And, if something is invisible, it may as well not be in the game at all.


Here's an example game where I've made the pillow scenery and the bed does NOT have 'Hide children until looked at' checked. (NOTE: It does have 'List items when looked at' checked.)

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Show Children when Looking">
    <gameid>d9ea8c92-ff84-401d-93a1-e0cf71a8e03e</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <object name="bed">
      <inherit name="editor_object" />
      <inherit name="surface" />
      <feature_container />
      <hidechildren type="boolean">false</hidechildren>
      <listchildren />
      <look type="script"><![CDATA[
        if (pillow.scenery) {
          pillow.scenery = false
        }
        msg ("It's a little messy, but that's nothing you can't handle.<br/>")
      ]]></look>
      <takemsg>You try to take the bed, but it's much too heavy for you to be moving it around all by yourself.</takemsg>
      <object name="pillow">
        <inherit name="editor_object" />
        <scenery />
        <look><![CDATA[It's your trusty, old pillow.  (You know you're supposed to replace those occasionally, right?)<br/>]]></look>
        <take />
      </object>
    </object>
  </object>
</asl>

Show Children when Looking

You are in a room.
You can see a bed.

> x pillow
It's your trusty, old pillow. (You know you're supposed to replace those occasionally, right?)

> look
You are in a room.
You can see a bed.

> get pillow
You pick it up.

> drop pillow
You drop it.

> l
You are in a room.
You can see a bed and a pillow.

> undo
Undo: l

> undo
Undo: drop pillow

> undo
Undo: get pillow

> l
You are in a room.
You can see a bed.

> x bed
It's a little messy, but that's nothing you can't handle.

It contains a pillow.

> l
You are in a room.
You can see a bed (on which there is a pillow).


That way makes sense (to me) during AND after the first play-through.


NEXT UP: NPCs who are carrying items the player needs to acquire.


Another well explained solution to a problem. Somebody get KV on commission!

kv = good explaination
if kv = good explaination
kv = good explaination + commission
msg (Check is in the mail)

Thanks KV!


K.V.

Just for kicks, let's make an NPC who is carrying something.

This is LONG, so I made it like a spoiler. You'll have to click to view it.

Click here to view: Just for kicks, let's make an NPC who is carrying something.

Setting up an NPC who is carrying an object the player needs. (This is just one of MANY ways to do this.)

image

I'm making sure to give him his alias right now, and setting him up as a named character (just because I always forget these two things if I don't do them first), then we'll move on and come back to this tab later.

image

Now, let's give RH something to 'carry'.

image

image


Now, I'll add one more object, too. Just to have more than one.

image


Now, in this example, I'm going to make my NPC a transparent container. (You could get the same results using scope functions, but we'll keep things as simple as possible this go-round.)

image
image

Note the 'contents prefix', the 'list prefix' and all the checked (and unchecked) selections. (These will make a BIG difference during play!)


Now that we've made a person a container, we need to remove the nonsense verbs from its 'display verbs' lists:

We can't open or close RH. (This is NOT that kind of game!)

...but, by default, as soon as something is identified as a container (not a surface type, though), OPEN and CLOSE will be added to the object's verbs lists.

image

So, let's just delete them:

image


We can't take RH, so I left the 'inventory verbs' list alone.


Speaking of not being able to take him, let's add a take message to RH. (These games are supposed to make us laugh when we try to do silly things, after all!)

image


Now, that was a warm-up exercise.

Now it's time to add a script which handles what to do, depending on whether RH is carrying the objects or not.

image
image
image

NOTE: In the MoveObject line, I used 'this' as an expression. That's a little trick you can use most of the time when a command only references one object.


I set the spoon up differently, because there IS NO SPOON. (You've seen The Matrix, right?)


Okay, so now you can see the objects when you look at RH, and you can interact with them (although you can't take them, it will not say "I can't see that).

So, how do we ask an NPC for something?

The EASIEST way, is to set up and ASK... ABOUT... script on the NPC.

So, first we set the game up to handle ASK/TELL:

image


Then, go to the ASK/TELL tab that now appears on the NPC, and add a topic:

image
image

(NOTE: I only put 'pouch' instead of 'strange pouch'. You will see why in a moment.)

First, though, let's set up the response(s) for the pouch.
image

NOTE: I did NOT use the expression 'this' in this example, because the 'strange pouch' is not a known object when the player enters a command like this. The "pouch" is read as text, not an object. (In fact, to be safe, just use the object's name as much as possible, and disregard my earlier tip about using 'this'.)


Finally, since we can ask him about things now, we'll set up a couple more topics.

I won't bore you with the example for the spoon, but you may find this one interesting:

image

Now, if the player asks about something that includes 'game', 'author', or 'story', this response will be printed.

...and lastly, we add a response for when the player asks something we haven't set up (again, just for fun).

image

NOTE: You work TELL the same way, but this thread is about making things visible. (The rest of this post MAY be sort of off-topic. but not technically.)


Okay, let's see how the game plays now!


Whoops!

Forgot to set up the "Speak to" verb! (Just for completion's sake. If the player can't TALK TO him, they may not try to ask him anything.)

image

image


Okay, now let's see it in action:

image


NOTE: I still missed important, little things. For instance, I didn't set up a description for one thing the whole time! Whoops!

image


K.V.

Hey, thanks, FW! (You don't mind if I call you 'FW', do you?)


You can't take the bed in your examples? That's no fun :p
(Wondering if anyone else remembers a commercially released game where a glitch at one point allowed you to take a bed with you, and then you could sleep to recover HP in the middle of the final boss battle)

In the NPC example, did you disable put pouch in RH? Would be a bit weird if you could give it back to him and then have to ask for it if you want it again.


K.V.

did you disable put pouch in RH?

Uh...

...umm...

Well... if you went around taking stuff and giving it back, then trying to take it again... Yeah, RH would make you ask for it again in real life (were he a real pseudonym, ahem... NPC).

I'm just kidding, mrangel! That's a good point!

In fact, RH needs to be set up as 'exit only'. (This is NOT that kind of game! Bwahahaha! ( Your princess is ANOTHER castle!!!))


You can't take the bed in your examples? That's no fun :p

There will be a cot in my next example.

(Wondering if anyone else remembers a commercially released game where a glitch at one point allowed you to take a bed with you, and then you could sleep to recover HP in the middle of the final boss battle)

Ha! No. Sounds fun to do, though!


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

Support

Forums