|
| 1 | +# Region Shows |
| 2 | + |
| 3 | +Region Shows allow you to have a show loop ambiently as long as players are inside a WorldGuard region. This is perfect for ambient effects. You must have WorldGuard installed on your server for this functionality to work. |
| 4 | + |
| 5 | +## Region Show Schemas |
| 6 | + |
| 7 | +Region Shows are controlled by YAML files called "Region Show Schemas." A Region Show Schema file may be placed anywhere in the show filesystem. Its file name must end with `_regionshowschema.yml` in order for the system to identify it as a Region Show Schema. |
| 8 | + |
| 9 | +For the rest of this article, we will consider the example of a Technician working on an attraction called `myProject`. They want to have an ambient effect in the queue of the attraction of an animatronic, called "wavyboi," to wave to guests who pass him by in the queue. |
| 10 | + |
| 11 | +The Technician decides makes a folder, `myProject/queue/waving_animatronic`, to house all the show files for the wavyboi effect. |
| 12 | + |
| 13 | + |
| 14 | +### Region Show Schema Example |
| 15 | +File: `myProject/queue/waving_animatronic/wavyboi_regionshowschema.yml` |
| 16 | +```yaml |
| 17 | +region: "myRegion" |
| 18 | +setup: 'myProject/queue/waving_animatronic/setup' |
| 19 | +loop: |
| 20 | + name: 'myProject/queue/waving_animatronic/loop' |
| 21 | + delay: 20 |
| 22 | +cleanup: 'myProject/queue/waving_animatronic/cleanup' |
| 23 | +``` |
| 24 | +
|
| 25 | +Region Show Schema files must end in `_regionshowschema.yml`. |
| 26 | +- `region` refers to the region that the region for which the show listener should be keeping track of player entrances/exits. |
| 27 | +- `setup` refers to the show that should be run when the first player enters `region` (i.e. when the number of players in `region` goes from 0 to 1). See [`setup` Show Example](/Technicians/RegionShows#setup-show-example) for more information. |
| 28 | +- `loop.name` refers to the show that should continue playing on loop as long as there are players `region`. See [`loop` Show Example](/Technicians/RegionShows#loop-show-example) for more information. |
| 29 | + - `loop.delay` exists because some commands take time to fully execute, and you don't want to have your `loop` show start over while a long-running command is still executing. We cover this more in [`loop` Show Example](/Technicians/RegionShows#loop-show-example). The `loop.delay` field is optional and defaults to `0`. If you don't a delay between instances of your loop show, your schema can look like: |
| 30 | +```yaml |
| 31 | +region: "myRegion" |
| 32 | +setup: 'myProject/queue/waving_animatronic/setup' |
| 33 | +loop: 'path/to/loopShow/that/doesnt/need/a/delay' |
| 34 | +cleanup: 'myProject/queue/waving_animatronic/cleanup' |
| 35 | +``` |
| 36 | +- `shows.cleanup` refers to the show that should be run when the last player leaves `region` (i.e. when the number of players in `region` goes from 1 to 0). See [`cleanup` Show Example](/Technicians/RegionShows#cleanup-show-example) for more information. |
| 37 | + |
| 38 | + |
| 39 | +### `setup` Show Example |
| 40 | +File: `myProject/queue/waving_animatronic/setup.yml` |
| 41 | +```yaml |
| 42 | +time0: |
| 43 | + - item: 'cmd' |
| 44 | + cmd: assave recall myProject/wavyboi |
| 45 | +``` |
| 46 | + |
| 47 | +In this setup show, an [`assave`](/Technicians/ArmorStandAnimations#saving-armor-stands) is run to spawn in our `wavyboi` animatronic. The setup show is the place to put any commands you want to be run prior to the core loop -- armor stand spawns, laser/spotlight "create-angle" commands, traincarts spawns, etc. |
| 48 | + |
| 49 | +### `loop` Show Example |
| 50 | +File: `myProject/queue/waving_animatronic/loop.yml` |
| 51 | +```yaml |
| 52 | +time0: |
| 53 | + - item: 'cmd' |
| 54 | + cmd: 'asa animatecycle wavyboi -166 53 1103 10 larm 0 0 20 10' |
| 55 | +``` |
| 56 | + |
| 57 | +In this loop show, we find an [asa animate](/Technicians/ArmorStandAnimations#animating-an-armor-stand) command to make our `wavyboi` wave. The loop show is the place to put all the actual "effect" commands that should be running on loop. |
| 58 | + |
| 59 | +Depending on the contents of your `loop` show, you might need to utilize the `loop.delay` field in the Region Show Schema file. This congfigurable `delay` (which is by default 0 ticks if you don't specify one) is the number of ticks the server should wait from the end of the `loop` show to when it should start another `loop` show. That is, after the final command of the `loop` show runs, should the server wait "extra" time before starting another copy of it? |
| 60 | + |
| 61 | +You'll notice that in our example, the `delay` was set to `20`. This is because on the last tick of the loop show, we run an `asa animatecycle` command whose animation takes `10` ticks. Since it's an `animatecycle` (see [Animating an Armor Stand](/Technicians/ArmorStandAnimations#animating-an-armor-stand)), it runs the animation in reverse as well, meaning that the entire command takes 20 ticks to run. We want to be sure that there are not multiple copies of the animation command running on top of each other, so we set `loop.delay` to 20 ticks to ensure that the server waits an adequate amount of time before running the loop show again. |
| 62 | + |
| 63 | +The `loop.delay` field is OPTIONAL, and will default to `0` ticks if not specified. This means that as soon as an instance of the `loop` show has completed, it will start another instance of itself on the next tick. |
| 64 | + |
| 65 | +### `cleanup` Show Example |
| 66 | +File: `myProject/queue/waving_animatronic/cleanup.yml` |
| 67 | +```yaml |
| 68 | +time0: |
| 69 | + - item: 'cmd' |
| 70 | + cmd: 'askill wavyboi -166 53 1102 10' |
| 71 | +``` |
| 72 | + |
| 73 | +In this cleanup show, we [`askill`](/Technicians/ArmorStandAnimations#killing-armor-stands) wavyboi. This important step ensures that we don't have duplicate copies of our armorstand sitting around ambiently, causing unnecessary load on clients who aren't in `region`. The cleanup show is where you should clean up after all your effects -- remove traincarts, kill armorstands, stop lasers/spotlights/etc. The cleanup show should set the stage for the `setup` show to be run again when next a player enters `region`. |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | +## Loading Region Shows |
| 78 | +Since region shows can be located in any show file directory, you need to run a command to "register" them so they start listening on their region. You can do that by the following: |
| 79 | + |
| 80 | +- `/loadregionshows <folderPath>` |
| 81 | + - `folderPath` should be the path to a folder in show filesystem -- for example, `myProject/queue/waving_animatronic`. The system will recursively walk through all subdirectories looking for files ending in `_regionshowschema.yml`, and interpret those as Region Show Schemas. |
| 82 | + - The command will spit out an error if there is a problem with your Region Show Schema *OR* if there is a problem parsing any of the show files that it references. |
| 83 | + |
| 84 | + - If you make a change to your `setup`, `loop`, or `cleanup` shows, you'll have to run `/loadregionshows <folderPath>` again to stop/reload the Schema in order for the changes in the shows to take effect. |
| 85 | + |
| 86 | +The `/regionshows` command will spit out a list of regions and their associated region show schemas, as well as what state they're in (`IDLE`, `SETUP`, `LOOP`, or `CLEANUP`). |
| 87 | + |
| 88 | +## "Un"Loading Region Shows |
| 89 | +If you want to turn off an existing region show, go into the Schema file and set `ignore: true` at the top of the file, like so: |
| 90 | +```yaml |
| 91 | +ignore: true |
| 92 | +region: "myRegion" |
| 93 | +setup: 'myProject/queue/waving_animatronic/setup' |
| 94 | +loop: 'path/to/loopShow/that/doesnt/need/a/delay' |
| 95 | +cleanup: 'myProject/queue/waving_animatronic/cleanup' |
| 96 | +``` |
| 97 | +Then run `/loadregionshows <folderPath>`. The Region Show Schema file will be ignored by the loader. |
| 98 | + |
| 99 | + |
| 100 | +## Advanced Region Show Schemas |
| 101 | +### What if I don't need a setup and cleanup show? |
| 102 | +You *do* still need to provide one in your schema. However, you can pass in a blank show file (literally, an empty `.yml` file) in the `setup` and/or `cleanup` fields if they aren't relevant to your usecase. |
| 103 | + |
| 104 | +On most servers, there should be an `Inf` folder in the main directory with a show file titled `Blank.yml` which you are recommended to use rather than creating multiple new blank files for whatever project you're working on. The syntax would be `Inf/Blank`. |
| 105 | + |
| 106 | + |
| 107 | +### Multiple Loop Shows with different Delays |
| 108 | +If you have several animations in a `region` that finish their animation cycles at different rates (for example, think of the first scene of *it's a small world*) and each require different delays, you can substitute your `loop` show string for a list of loop shows in your Schema like so: |
| 109 | +```yaml |
| 110 | +region: 'testregion' |
| 111 | +setup: 'path/to/setup' |
| 112 | +loop: |
| 113 | + - name: 'path/to/loop1' |
| 114 | + delay: 10 |
| 115 | + - name: 'path/to/loop2' |
| 116 | + delay: 20 |
| 117 | +cleanup: 'path/to/cleanup' |
| 118 | +``` |
| 119 | + |
| 120 | +### Setup Delay |
| 121 | +Sometimes, you might want to a delay between when your [`setup` show](/Technicians/RegionShows#setup-show-example) completes and when your [`loop` show](/Technicians/RegionShows#loop-show-example) starts looping. You can accomplish this in the Schema file very similarly to how you add a delay for your loop show: |
| 122 | +```yaml |
| 123 | +region: 'testregion' |
| 124 | +setup: |
| 125 | + name: 'path/to/setup' |
| 126 | + delay: 20 |
| 127 | +loop: 'path/to/loop' |
| 128 | +cleanup: 'path/to/cleanup' |
| 129 | +``` |
| 130 | +The setup delay is optional and will default to `0` ticks. |
| 131 | + |
0 commit comments