Container - Help

Hi, In my game, I want to be able to put an object 'bottle' and only that one object into a container 'fridge'.

How does the 'Script to run when trying to add an object:' work?
I've tried
If object contains...
If object does not contain...

It's probably going to be so simple, but any help is appreciated


<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <dynamictemplate name="ObjectNotOpen">CapFirst(object.article) + " " + Conjugate(object, "be") + " not open."</dynamictemplate>
  <game name="Put the Bottle in the Fridge">
    <gameid>9fe3e622-3555-45c2-9b4b-03ca3fcd231c</gameid>
    <version>1.2</version>
    <firstpublished>2018</firstpublished>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <object name="refrigerator">
      <inherit name="editor_object" />
      <inherit name="container_closed" />
      <alt type="stringlist">
        <value>fridge</value>
      </alt>
      <feature_container />
      <addscript type="script">
        if (not object = bottle) {
          msg ("That doesn't belong in there.")
        }
        else {
          msg ("Done.")
          MoveObject (bottle, refrigerator)
        }
      </addscript>
      <take type="boolean">false</take>
      <takemsg>It's too big to tote around.</takemsg>
      <onopen type="script">
        door.isopen = true
      </onopen>
      <onclose type="script">
        door.isopen = false
      </onclose>
      <look><![CDATA[It is {either refrigerator.isopen:open|closed}.<br/>]]></look>
      <listchildren />
      <displayverbs type="stringlist">
        <value>Look at</value>
        <value>Open</value>
        <value>Close</value>
      </displayverbs>
    </object>
    <object name="bottle">
      <inherit name="editor_object" />
      <inherit name="openable" />
      <feature_container />
      <openscript type="script">
        msg ("It's already open, and the cap is missing.")
      </openscript>
      <closescript type="script">
        msg ("The cap is missing.")
      </closescript>
      <take />
      <inventoryverbs type="stringlist">
        <value>Look at</value>
        <value>Drop</value>
      </inventoryverbs>
    </object>
    <object name="door">
      <inherit name="editor_object" />
      <inherit name="openable" />
      <feature_container />
      <openscript type="script">
        refrigerator.isopen = true
        this.isopen = true
        msg ("Done.")
      </openscript>
      <closescript type="script">
        refrigerator.isopen = false
        this.isopen = false
        msg ("Done.")
      </closescript>
      <scenery />
      <look>It is {either door.isopen:open|closed}.</look>
      <takemsg>That apears to be part of the refrigerator.</takemsg>
      <displayverbs type="stringlist">
        <value>Look at</value>
        <value>Open</value>
        <value>Close</value>
      </displayverbs>
    </object>
    <object name="stick">
      <inherit name="editor_object" />
      <inventoryverbs type="stringlist">
        <value>Look at</value>
        <value>Drop</value>
      </inventoryverbs>
      <look>It's a perfectly normal stick.</look>
      <take />
    </object>
  </object>
</asl>

Thanks KV. I knew it had to be something as simple as that.

Just need to put the water/oil mixture into the bottle, freeze the water so you can get the oil, and then use the oil to lubricate the joints of the 'Metal Guru'.

Adventure writing is a mixture of both fun and scratching your head to make something work.


Log in to post a reply.

Support

Forums