Logic Gadgets: Counter


Name of gadget Counter
Section Logic & Processing
Author LadylexUK, QuietlyWrong
Last updated 22 Feb 2019 [Beta]


Counts up to a given target value (or down from it) and sends a signal when it is full. This is used in combination with other gadgets (such as the timer and the calculator) and is especially useful for taking a pulse and producing a continuous signal (such as a button press). Any signal sent to the increase or decrease inputs will cause the counter to count up or down once, respectively, regardless of whether it is the shortest pulse or a prolonged button press.

Example Tutorial (adapted from Media Molecule)

  1. Stamp a counter
  2. Stamp a trigger zone
  3. Stamp a sound effect
  4. Stamp a basic puppet
  5. Connect detected on the trigger zone to increase count on the counter.
  6. The default maximum in the counter is 1. When the trigger zone is activated it will fill the counter. Connect Counter full to the power port on the sound effect.
  7. Play the level.
  8. Possess the puppet and run into the trigger zone.
  9. The sound effect should play.
  10. Now tweak the counter to set the maximum to 5.
  11. Play again, and this time note that the player has to enter the trigger zone 5 times before the sound effect is activated.

Tweak Menus

  1. Target Value
    1a. Input
    1b. Output
  2. Current Count
    2a. Input
    2b. Output
  3. Counter Full
    3b. Output
  4. Count Progress
    4b. Output
  5. Increase Count
    5a. Input
  6. Decrease Count
    6a. Input
  7. Reset Count
    7a. Input
  8. Power
  1. Target Value
    Use the slider to determine how many this counter will count to  (determine the full amount). The default is 1.You can alter this dynamically with the input, and the target value can be sent as a signal from the output.
  2. Current Count
    This slider shows the current value of the counter, up to the target value. You can set this so that the counter starts at a number that is not the default 0. The number can be sent as a signal from the output.
  3. Counter Full
    This is the main output of the gadget. A signal of 1 is sent when the counter is full, a 0 for any other amount. It ignores any additional counts past the maximum set in the gadget and continues to send 1 regardless of the actual count (unless the count reduces).
  4. Count Progress
    As an alternative to the “Current Count” output, this provides the current status of the counter as a fractional output, from 0 (zero) to 1 (target value). If you are building an on-screen display, for example, that indicates percentage completion, you should use this output because it will always range from 0 to 1, whereas the Current Count’s range might change as you add new objectives to your Dream.
  5. Increase Count
    Wire into here to add to the current counter value (for example from the controller sensor).
  6. Decrease Count
    Wire into here to reduce the current counter value.
  7. Reset Count
    This will set the count back to zero. You can wire the Counter Full output back into the reset for a continuous loop.
  8. Power
    This is where you can turn the gadget on/off

Lex Tips

A very useful gadget that you may use quite a lot. Use this to determine if an action has completed so that you set other actions in motion. Don’t forget to name your counter so you know what it is counting. Can also act as a boolean if you keep the number at 0 or 1 (though a Switch may be a better solution). Reset to get back to 0.

QuietlyWrong adds…

I can’t stress enough how important this gadget is for firing off ‘events’ in your Dream that should happen once and only once. I can’t count (no pun intended) the number of times I’ve had to sit through the same cut-scene or text pop-up or sound effect multiple times when the creator only meant for it to happen once. In the worst cases, players can rack up impossible scores by repeating an action they were only meant to do one time, like crossing the finish line in a race, if your logic doesn’t account for them doubling back and doing it again.

If you ever plan for something to happen once, or for it to be different the first time, always think to yourself: “I need a counter”. The first time that something happens, the counter is 0, which, with the right logic, can be made to allow action to take place, at which point you increment the counter and it is now fixed on 1, which you can use to prevent the action triggering again.

Useful Tutorials

Beginners Guide to Counters

How to make button presses power things on

Comments and Feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: