Using Open without making the object a container

Hi,

Do you know how I can implement an Open command for an object without making it a container? I just want to print a message saying it doesn't open.

I tried making it a container either:

  1. Closed with an 'on open message' defined and an 'on open script' that closed it again but you could put items into it which I didn't want (I wanted a message saying you couldn't).
  2. Open but then the 'on open message' doesn't work as the open command prints 'it is already open' but at least then I had a 'on inserting item' script that printed a warning and didn't allow objects to be put in it.

I just want to give a custom you message in both cases (open and put object in it).

Also, I have containers that work fine but when the container is on the ground and open the objects in it are listed as if they were on the ground. Is there an automatic way of getting it to say 'containing:

Thanks

Simon


Hmm… The container_base type includes a boolean attribute container which the "put" command checks before trying to put something in it. Oddly enough, open doesn't check that flag; it only checks the open and isopen flags.

So if you make it a closed container with either an openscript or onopen script to give a custom message when you try to open it, you can set the container attribute to false to make it "Not a container" as far as the put command is concerned.


I made it a closed container, set the on open to print a message and then unchecked the container chevkbox. I get the message when I do open but if I try to put an object into it I get a standard "The object is not open" message. Do you know how I can replace that message with a message that says you can't put anything into ti?

Thanks for your reply

Simon


I made it a closed container, set the on open to print a message and then unchecked the container chevkbox.

I assume you mean the checkbox on the features tab. That just shows/hides the container tab, it doesn't actually change any attributes.

If you're on the desktop version, I think you can go to the 'Attributes' tab to change container to false there. (Not sure about this, I've not got a Windows PC so I can only use the web editor)

On the web editor, you'd need to give the object an initialisation script (on the features tab), and make the script this.container = false


Yes I did mean the checkbox on the feature tab. I have now changed the container attribute to false. I get my open message correctly and if I put an item in it I get the generic 'You can't do that" message. If there is no way to replace that message with my own one then I think it will be OK.

Thanks for your help

Simon


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

Support

Forums