Give it a name

Try itThings that talk to each other

A script can only open a door if it knows which door you mean. So the door needs a name. In Splat Script, a name like that is called an ID.

An ID in a script

You have seen one ID already: {Hero}. The curly brackets mean "the thing with this name".

This code box holds a level's script. The level has a locked door in it, and the door's ID is Door.

Try it

  1. Press Play Play this script, under the little game. Find the door: it is the block standing in the hero's way.
  2. Click the little game, so the keys work.
  3. Press the up arrow key to make the hero jump.

The door opens. The script said open the {Door}, and the game knew which thing that was.

Give your own door an ID

Now make a door in level 2 of your game.

  1. Press Open your game here, in the builder below, and go to level 2.
  2. Press the Objects button Objects, on the left of the builder, and click Locks & keys.
  3. In its Brush settings, under A key or a lock?, choose Lock block.
  4. Click on your floor to place it. This is your door.
  5. Press Select Select, under the map, and click the lock block.
  6. In its panel, open the drawer called ID and script.
  7. Type Door in the ID box.

Your door now has a name. Any script in the level can point at it with {Door}.

This makes a new game in your Lab and opens the builder right here. It is free.

This section ticks itself when you press Play Play this script in the code box.

Press Play in the code box to finish this section.