Paste #31464: Edit of P#31462 - Edit of P#31460 - Edit of P#31457 - Chat Channels Test

Date: 2016/03/11 14:52:29 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Chat_Channels:
  type: world
  events:
    on player chats:
      - determine passively cancelled
      - choose <player.flag[chat_channel]>:
        - case global:
          - announce format:GlobalChat_Format <c.message>
        - case local:
          - narrate format:LocalChat_Format <c.message> targets:<pl.location.find.players.within[20]>
        - case trade:
          - if <pl.location.cuboids.filter[contains[_town]].size.is[LESS].than[1]> {
            - narrate "<&4>You cannot use Trade Chat unless you are in a town."
            - queue clear
          }
          - narrate format:TradeChat_Format <c.message> targets:<pl.location.cuboids.filter[contains[_town]].get[1].list_players>
    on global command:
      - determine passively fulfilled
      - if <player.flag[chat_channel].is[==].to[global]> {
        - narrate "<&4>Your default channel is already Global Chat."
      } else {
        - narrate "<&3>Set your chat channel to <&8><&lb><&7>Global<&8><&rb>"
        - flag player chat_channel:global
      }
    on trade command:
      - determine passively fulfilled
      - if <player.flag[chat_channel].is[==].to[trade]> {
        - narrate "<&4>Your default channel is already Trade Chat."
      } else {
        - narrate "<&3>Set your chat channel to <&8><&lb><&5>Trade<&8><&rb>"
        - flag player chat_channel:trade
      }
    on local command:
      - determine passively fulfilled
      - if <player.flag[chat_channel].is[==].to[local]> {
        - narrate "<&4>Your default channel is already Local."
      } else {
        - narrate "<&3>Set your chat channel to <&2><&lb>Local<&rb>"
        - flag player chat_channel:local
      }
    on player joins:
      - if <player.has_flag[chat_channel].not> {
        - flag player chat_channel:local
      }

LocalChat_Format:
  type: format
  format: <&2><&lb><player.name><&rb><&co> <&f><text>
  format: <&2><&lb><player.name><&rb><&co> <&f><text>

GlobalChat_Format:
  type: format
  format: <&8><&lb><&7>Global<&8><&rb> <&8><&lb><player.name><&rb><&co> <&a><text>

TradeChat_Format:
  type: format
  format: <&8><&lb><&5><player.location.cuboids.filter[contains[_town]].get[1].before[_town].to_titlecase> Trade<&8><&rb> <&d><&lb><player.name><&rb><&co> <&b><text>