Object "It's already closed" even though it has never been opened.

Hi guys,

Something weird is going on in my game. I don't know if it's a glitch because another object(though a container) in the same room works fine.

Simple setup (so I thought), I'm trying to implement curtains in my game, when opened the player can see a window. Opening the curtains will reveal the window (make object visible), closing will make them invisible again.

The problem lies that the script to run to close the object never gets called and Quest 'thinks' the object 'is already closed'. Even after you open the curtains and look through the window for example, it never prints the message "You close the curtains" but instead it reads 'It's already closed.' when you click on 'close the curtains'.

I'm using Quest 5.8 and I am NOT using commands in my game (even disabled the command bar).

Created an object 'Curtains' -> Container Tab (openable/closeable) ticked 'can be opened' 'can be closed' ,but NOT Is open.

 <object name="Curtains">
      <inherit name="editor_object" />
      <inherit name="openable" />
      <feature_container />
      <useindividualverblist type="boolean">false</useindividualverblist>
      <usestandardverblist />
      <displayverbs type="stringlist">
        <value>Look at</value>
        <value>Open</value>
        <value>Close</value>
      </displayverbs>
      <openscript type="script">
        MakeObjectVisible (Window1)
        msg ("You open the Curtains and can see a {object:Window1:Window}.")
      </openscript>
      <closescript type="script">
        msg ("You close the Curtains.")
      </closescript>
    </object>

What am I doing wrong?


The open and close commands run the openscript and closescript script attributes instead of the default behaviour of marking the object as open or closed.

So when the player types "open curtains" it displays a message and makes the window visible, but doesn't actually make them open.

You want something like:

      <openscript type="script">
        MakeObjectVisible (Window1)
        msg ("You open the Curtains and can see a {object:Window1:Window}.")
        this.isopen = true
      </openscript>
      <closescript type="script">
        msg ("You close the Curtains.")
        this.isopen = false
      </closescript>

Once again, you've been a tremendous help. I looked for hours through the documentation and felt kind of stupid because I couldn't figure it out so I had to ask in the end :) Now I know how to do it and implement it in my game and there were numerous objects that had this issue. Now everything works flawlessly.

Really appreciate it,


No worries :)

The reason it works like this (in case it makes it easier to understand) is in order to enable things like locked containers. You could make a magic box that can only be opened at night, or a safe that requires you to set the dials to the right numbers before you open it. For something like that, you'd have an if statement in your openscript, to check for the conditions before changing the value of this.isopen.


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

Support

Forums