Paste #2400: Word Replace v2

Date: 2014/03/03 07:22:23 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


# +--------
# | Word replacer 

"Word Replacer": 
    type: world 
    events: 
        on player chats: 
        # Check the place chat if in the groups specified, then determine the 
        # replaced text.
        - if <player.in_group[Members]> || <player.in_group[Helpers]>
          queue clear
          else determine '<proc[Modify Words].context[<context.message>]>'

"Modify Words": 
    type: procedure 
    definitions: words 
    script: 
    - define replacement %words%
    - foreach '<s@replacement texts.constant[replace]>' {
        - define word_to_replace <def[value].before[/]>
        - define replace_with <def[value].after[/]>
        - define replacement <def[replacement].replace[%word_to_replace%].with[%replace_with%]>
      }

    # Send back the final replacement
    - determine %replacement%


# Define the words you wish to replace in the 'replace' node below.
# Use the format 'word to replace/word to replace with', as seen in
# the following example.

replacement texts: 
    type: task

    replace: 
    - puttana/BIP 
    - troia/BIP
    - cazzo/BIP
    - figa/BIP
    - vagina/BIP
    - gay/BIP
    - frocio/BIP
    - lesbo/BIP
    - lesbica/BIP
    - dio/BIP
    - madonna/BIP
    - gesu/BIP