Date: 2014/06/05 20:32:22 UTC-07:00
Type: Denizen Script
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:
- ^flag player "hearsyourmessage:false"
- ^define closest '<player.location.find.players.within[4]>'
- ^define second '<player.location.find.players.within[10]>'
- ^define third '<player.location.find.players.within[40]>'
- ^define fourth '<player.location.find.players.within[200]>'
- ^foreach <%fourth%.flag[receivingchat]||false> { #for each player who doesnt have the receiving chat flag, do the folowwing
- ^define closest <def[closest].exclude[<player>]> # redefine %closest% as itself, but exclude the players referenced by the foreach
- ^define second <def[second].exclude[<player>]>
- ^define third <def[third].exclude[<player>]>
- ^define fourth <def[fourth].exclude[<player>]>
}
- ^if <%closest%.exclude[<player>].size> > 0 ^narrate '<player.flag[currentrank]> <&7><player.name> <&7>whispers, "<player.flag[lastchat]>".' t:<%closest%.exclude[<player>]>
- ^if <%second%.exclude[%closest%].size> > 0 ^narrate '<player.flag[currentrank]> <&7><player.name> <&7>says, "<player.flag[lastchat]>".' t:<%second%.exclude[%closest%]>
- ^if <%third%.exclude[%second%].size> > 0 ^narrate '<player.flag[currentrank]> <&7><player.name> <&7>yells, "<player.flag[lastchat]>".' t:<%third%.exclude[%second%]>
- ^if <%fourth%.exclude[%third%].size> > 0 ^narrate '<player.flag[currentrank]> <&7><player.name> <&7>is faintly heard saying, "<player.flag[lastchat]>".' t:<%fourth%.exclude[%third%]>
- ^narrate '<&7>You say, "<player.flag[lastchat]><&7>".'
- ^if <%fourth%.exclude[<player>].size> == 0 ^narrate "<&7>But no one hears you..."