Forum rules - please read before posting.

Run an action triggered by a document's "Close" button

Hi everyone,

Two weeks into learning AC, doing my best to make my first 2D game now.
I'm amazed at how much AC simplifies the task for non-coders and how well documented it is, but here's something I need a little help with, please.

I have a scroll in my inventory, which when right-clicked to examine, opens a document. So far so good. Now, I would like to be able to run an action, in this case a Play speech one, triggered when the document's "Close" button is clicked. I hope there is a simple and customisable way to do this as I plan to have several documents in the game.

Many thanks for any suggestions/solutions.

Comments

  • You can change your Close button's Click type property to Run Action List, and then assign an ActionList that uses a Menu: Change state Action to turn the menu off. This way, you can also incorporate other Actions (e.g. Dialogue: Play speech) to also run at this time.

    Presumably, you'll want to have different responses based on the Document that's being closed. You can do this with Variables.

    Create a new Global Variable of the type "Pop Up". Set the first value to "Do Nothing", and then give other values for each Document that you want to give a unique response for.

    Then, as part of the inventory item's Examine ActionList, use a Variable: Set Action to set this variable to an appropriate value.

    Going back to the ActionList that runs when the Close button is clicked, add a Variable: Pop Up switch Action to reroute the ActionList to run different Actions based on the value of this PopUp variable.

  • Thank you very much for the prompt, clear and detailed reply, @ChrisIceBox! It works like a charm. I now have three separate documents, each with a different comment on close. Loving it! :smiley:

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.