Taunt-O-Matic features

From Hastur
Jump to: navigation, search

This article is imported from the Hastur wiki. See the import log for details. Warnings:

  • Possible markup errors.
  • Unknown plugins.

This page contains development notes for the Taunt-O-Matic. These will probably not make much sense to users, and perhaps not even to the developer...


<?plugin CreateToc ?>


Unicode Support

City of Heroes (and presumably City of Villains) can use unicode characters in speech and emotes. This works after a fashion in the 0.2 development version, but unicode characters have to be written as \x{266B}. This makes it difficult to edit long unicode text, such as Russian or Arabic speech.

Unicode in City of Heroes

City of Heroes can read bind files that use UTF8. Such files can not be edited with Wordpad or Notepad, probably because these Windows apps expect a Byte Order Mark (BOM). More accurately, these programs cannot display the non ASCII Unicode charcers properly since they are not UTF8 compatible. This makes it difficult but not impossible to edit keybind files since they can't display the special characters properly.


Unicode in Microsoft Applications

Some standard Windows applications, such as Notepad and Wordpad, can work with Unicode files. However, if a file is saved in Unicode format, it is saved in UCS2/UTF16 Little Endian with a Byte Order Marker of 0xFFFE. This BOM is not a valid Unicode character (which makes Perl cry) and all characters are two bytes wide.

A keybind file exported from City of Heroes, edited in Notepad and saved in Unicode format can not be read by the game. The presence of a BOM is probably not an issue, but the two byte wide characters probably is.


Unicode (UTF8) Editors

Editors which can work with UTF8 should be able to handle keybind files and non ASCII (multibyte) Unicode characters just fine. Any suggestions?

Byte Order Marks

I pulled this from some mailing list:

|------------------+-------------------------------|
| File begins with | Coding System                 |
|------------------+-------------------------------|
| fe ff            | big-endian Unicode (UTF-16)   |
|------------------+-------------------------------|
| ff fe            | little-endian Unicode         |
|                  | (UTF-16)                      |
|------------------+-------------------------------|
| 00 00 fe ff      | big-endian UCS-4              |
|------------------+-------------------------------|
| ff fe 00 00      | little-endian UCS-4           |
|------------------+-------------------------------|
| 0f fe ff         | UTR-6 (compressed Unicode)    |
|------------------+-------------------------------|
| ef bb bf         | UTF-8                         |
|------------------+-------------------------------|

The Taunt-O-matic should probably be able to handle the BOMs for UCS-2 (UTF-16) and UTF-8.

BOM Makes Perl Cry

The ":raw" input layer can be used to read text files as if they are binary. However, Unicode::String() gives a warning when it reads the BOM. The solution is probably to use a low level read for the first few bytes to detect a BOM, and then read the rest of the file as normal.

Miscellaneus

Badly formatted stuff below...

Misc notes for future releases.

Make sure options for root, data and save (output) directory options work as advertised.

Auto detection of files in UTF8 format. When saved by wordpad or notepad# in Windows, these have a magic cookie at the beginning of the file.

Backslash at end of line.

Warnings. Check that max length (possibly 255 chars).

New syntax for loops and variables to make it possible to mix several loops in a single bind:

Pasted from code so formatting needs to be fixed.

@random(STUFF)         always randomize data from STUFF
@loop(STUFF)           always use data from STUFF sequentially
@action(STUFF)         do files in stuff once, then stop.
@reset(STUFF)          resets all keys for which use data from STUFF
@action(1, 100, COUNT) create a loop using ${COUNT} as a varaible for
@loop(1, 100, COUNT)   create a loop using ${COUNT} as a varaible for
                       current key only. Always repeats? Used for such things
                       as creating unique
Option --tell -t send tell to user that loop is done.

@clear()               clear all existing keybinds. Use with caution!
@include(COMMON)
@include(MASTERMIND)
@include(ZOMBIE-BANTER)
@reload()              reload main bind file. No argument. Does not reset any
                       ongoing loops used with BIND.

define(VARIABLE, value)
${VARIABLE}            BASH style

LABEL:{
   Lines with data
}


WARNINGS:

- Implement warnings for missing data sources and undefined variables, etc
- Setup script to update configurastion file. Installation script to create
  shortcuts on desktop.





     part after colon (:) can be file name (no need to add .txt extension) or
     an inline data definiton if one is supplied in the hero data file.

     INLINE DATA

     Conceptually, this used a LABEL to name a DATA BLOCK. A data block is
     used instead of a file and always has higher priority. Assume that
     comments and witespace are stripped.

     # Random emote and afk text when in chat mode.

     F10   local @random(BATTLECRY) $$ emote @random(ATTACK)
     ENTER beginchat $$ emote {random: IDLE} $$ afk {random: TYPING}

     # By convention, inline data blocks are placed at the end of the file.

     BATTLECRY: {
       Let's get it on!
       It's clobbering time!
       It's punch o'clock!
       It's spanking time!
       Lights! Camera! Hot hero on villain action!
     }




     IDLE: {
       angry
       afk
       argue
       lecture
     }
     TYPING: {
       $name is chatting.
       Do not disturb
       Bored now...
       Typing.
       Thinking of something clever to say.
       About to make a fool of myself...
     }





    Nifty loop to cycle through any amount of dialogue loops.

    BANTER: {
      @bind(HOME, BANTER-1)
      @bind(HOME, BANTER-2)
      @bind(HOME, BANTER-3)
      @bind(HOME, BANTER-4)
      @bind(HOME, BANTER-5)
      @bind(HOME, BANTER-6)
      @bind(HOME, BANTER-7)
      @bind(HOME, BANTER-8)
      @bind(HOME, BANTER-9)
      @bind(HOME, BANTER-10)

    }

    DELETE bind HOME nop$$tell $name, Banter loops disable. Reload keybind file o start again.
    END    @loop(BANTER)

     USING SEVERAL LOOPS FOR THE SAME KEY

     CTRL+1 {bind: HOME: ZOMBIE-BANTER-1} \
        $$ tell $name, Press ${KEY} for banter
     CTRL+2 {bind: HOME: ZOMBIE-BANTER-2} $$
     CTRL+3 {bind: HOME: ZOMBIE-BANTER-3} $$ tell $name, Single zombie monologue

     @define(PET1, Rosencrantz)
     @define(PET2, Guildernstern)
     @define(ALL, Zombie)
     @define(CHANNEL, Private 1138) # Change to other name

Use bind to create, join and subscribe to channel. Use this for messages            ther than tells.

     PET-BANTER-1:{
       pet_say ${PET1}   <em welcome> If you cut us, do we not bleed?
       pet_say ${PET1}   If you tickle us, do we not laugh?
       pet_say ${PET1}   If you poison us, do we not die? $$
       pet_say ${PET2}   No.
     }

    PET-BANTER-2:{
       pet_say ${PET1} Brains...
       pet_say ${PET2} You watch too many movies.
       pet_say ${PET1} <em shrug> Sorry.
       pet_say ${PET2} Mind you, I am feeling rather peckish...
       pet_say ${ALL}  <em nod>
       pet_say ${ALL}  Brains...
     }

     DEFINED VARIABLES

     These VARIABLES are reserved and cannot be used as file names

     ${HERO}           Current hero, derived from file or directory name
     ${FILE}           Current datafile for use in @reload scripts
     ${KEY}            Current key for use in @bind:

     Varibles can also be defined by loops. They cannot be used outside of
     their current key.


     EXAMPLES

     ENTER emote {file:LECTURE} $$ beginchat $$ AFK {file:TYPING}
     PAGEUP {1..100:COUNT} tell $name, [Demo] ${HERO}-${COUNT} $$ demorecord scene-${HERO}-${COUNT}
     PAGEDOWN demostop

   - Put file load part of generated binds at start of bind. This makes it
     possible to use AFK text.





   - Suggest data structure (subject to revision and controlled by
     user configuration file).

     C:\COH\Base\Data\                    - Common data directory
     C:\COH\Base\Data\default.txt
     C:\COH\Base\Data\common.txt
     C:\COH\Base\Loop\                    - Loop data directory
     C:\COH\Base\Loop\joke.txt
     C:\COH\Base\Hero                     - Hero definition files
     C:\COH\Base\Hero\Atomic Ape.txt
     C:\COH\Base\Hero\Atomic Ape\joke.txt
     C:\COH\Base\Manual