Skip to content

Starting a zone from a chat message

Your event plugin already announces itself in chat:

KoTH * The Japan KoTH has begun!

SomaHider can read that announcement and start the zone by itself. There is nothing to connect between the two plugins. SomaHider simply watches chat go by, and when a message looks like the one you showed it, it starts or stops the zone.

Each zone can have two of these:

SettingWhat it does
start_on_chatThe message that starts the zone.
stop_on_chatThe message that stops it.

You do not have to write them by hand. SomaHider can build them from a real message.

Capture a message and turn it into a trigger

Section titled “Capture a message and turn it into a trigger”
  1. Start listening.

    /sh capture

    SomaHider now writes down every chat message for the next 60 seconds. Run /sh capture stop if you are done sooner.

  2. Make the message appear.

    Start your event, or wait for it to start on its own. Anything that goes through chat during the 60 seconds is caught.

  3. Look at what was caught.

    /sh capture list

    Every message is listed with a number in front of it. In game you can click a line directly and skip to the next step.

  4. Pick the line and the zone.

    /sh capture use 3 kothjapon start

    Read it as: take message number 3, and make it the thing that starts the zone kothjapon. Use stop at the end instead of start for the closing message.

That is it. The zone now starts whenever that message appears.

There is one catch. SomaHider saved the message exactly as it was, and event announcements usually contain a part that changes from one run to the next.

Take the closing message:

KoTH * The Japan KoTH is over. Fate wins the event.

Next week the winner will not be Fate, so the message will be slightly different and the zone will not stop. You need to tell SomaHider that this part can be anything.

Open zones.yml, find your zone, and replace the part that changes with .*:

zones.yml
zones:
kothjapon:
triggers:
start_on_chat: '&6&lKoTH &f* The &7Japan &fKoTH has begun!'
stop_on_chat: '&6&lKoTH &f* The &7Japan &fKoTH is over\. &6.* &fwins the event\.'

.* means “anything can be here”. The faction name became &6.*, so any winner matches now.

Then apply it:

/sh reload
/sh info kothjapon

The zone details include the triggers that are registered. If a trigger is missing here, SomaHider could not read it, and the reason is in the server log.

A trigger is compared against every chat message, and that includes messages players type themselves.

So if your trigger is a plain sentence with no colours in it, any player can copy that sentence into chat and start or stop your zone whenever they feel like it.

SomaHider warns you when this is the case:

zones.yml: zones.arena: triggers.start_on_chat has no color codes, any player could fire it from chat

The fix takes a second: keep at least one colour code from the original announcement in your trigger. In the example above, &6&lKoTH and &f are colour codes. Players cannot type colour codes into chat, so a trigger that contains one cannot be faked.

If you deleted them while editing, capture the message again and keep more of it this time.

A zone with always_on: true runs permanently, so there is nothing to start or stop. SomaHider ignores triggers on such a zone and says so in the log, and /sh capture use refuses it.