Paste #5063: Chat Controller

Date: 2014/06/03 17:30:48 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Normal Chat:
    type: world
    events:
        on player chats:
        - if <player.flag[talkingallowed]> {
          - ^flag player lastchat:<context.message>
          - ^run localchatdisplayer
          }
          else {
            - if <player.flag[chatblockedreason]> != null {
              - ^narrate "<&7><player.flag[chatblockedreason]>"
              }
        - determine cancelled
'localchatdisplayer':
    type: task
    script:
        - ^narrate '<&7>You say, "<player.flag[lastchat]><&7>".'
        - flag player "hearsyourmessage:false"
        - foreach <l@location.find.players.within[<20.20>]> {
          - narrate '<player.flag[currentrank]> <&7><player.name> <&7>whispers, "<player.flag[lastchat]>".' t:<%value%>
          - flag player "hearsyourmessage:true"
          }
        - foreach <l@location.find.players.within[<1000.1000>]> {
          - narrate '<player.flag[currentrank]> <&7><player.name> <&7>says, "<player.flag[lastchat]>".' t:<%value%>
          - flag player "hearsyourmessage:true"
          }
        - foreach <l@location.find.players.within[<3000.3000>]> {
          - narrate '<player.flag[currentrank]> <&7><player.name> <&7>yells, "<player.flag[lastchat]>".' t:<%value%>
          - flag player "hearsyourmessage:true"
          }
        - foreach <l@location.find.players.within[<5000,5000>]> {
          - narrate '<player.flag[currentrank]> <&7><player.name> <&7>is heard in the distance saying, "<player.flag[lastchat]>".' t:<%value%>
          - flag player "hearsyourmessage:true"
          }
        - if <player.flag[hearsyourmessage]> == false narrate "<&7>No one hears you."