| | 37 | & @CHATFORMAT |
|---|
| | 38 | @chatformat <object>[= <message>] |
|---|
| | 39 | |
|---|
| | 40 | The @chatformat attribute is evaluated when an object receives |
|---|
| | 41 | a channel message. The evaluated result, is displayed to the |
|---|
| | 42 | player, otherwise the default message is shown. A null result, |
|---|
| | 43 | as long as the attribute exists, shows nothing. |
|---|
| | 44 | |
|---|
| | 45 | Registers: |
|---|
| | 46 | %0: The 'type' of the message. It is a single character that |
|---|
| | 47 | will always be set: |
|---|
| | 48 | '"', ';' or ':' for say, semipose and pose, respectively. |
|---|
| | 49 | '|' for an @cemit. |
|---|
| | 50 | '@' for a "system" message - such as "Walker has connected." |
|---|
| | 51 | %1: The channel name. e.g: "Public" "Admin" "Softcode" |
|---|
| | 52 | %2: The message as typed (post-evaluation, if necessary) by the |
|---|
| | 53 | speaker. Be warned, though - If type is '@', then %2 will |
|---|
| | 54 | contain the entire message, and will include the name of |
|---|
| | 55 | the speaker that caused it. |
|---|
| | 56 | %3: The speaker name, unless channel is set NO_NAME. |
|---|
| | 57 | %4: The speaker's channel title, unless none is set, or the |
|---|
| | 58 | channel is NO_TITLE. |
|---|
| | 59 | %5: The original message. |
|---|
| | 60 | |
|---|
| | 61 | If The channel is NO_NAME, and the speaker either has no title or |
|---|
| | 62 | the channel is also set NO_TITLE, then %3 will be "Someone" |
|---|
| | 63 | |
|---|
| | 64 | (continued in help @chatformat2) |
|---|
| | 65 | See also: @chat, @pageformat, speak() |
|---|
| | 66 | & @CHATFORMAT2 |
|---|
| | 67 | Examples: |
|---|
| | 68 | |
|---|
| | 69 | Walker's preferred @chatformat, which strips all ansi out, wraps |
|---|
| | 70 | every line to your width and prefixes them with <ChannelName>: |
|---|
| | 71 | |
|---|
| | 72 | @chatformat me=<%1> [switch(%0,@,%2,edit(wrap(speak(&[if(%4,%4%b)]%3, |
|---|
| | 73 | %0[stripansi(%2)]),sub(width(%!),add(4,strlen(%1)))),%r,%r<%1>%b))] |
|---|
| | 74 | |
|---|
| | 75 | If you're on a system with chat_strip_quote set to "no", you might |
|---|
| | 76 | want to change the "%0%2" arg to speak() to '[switch(%0,",%2,%0%2)]' |
|---|
| | 77 | |
|---|
| | 78 | Suppose you want it just like the old version, but anytime somebody |
|---|
| | 79 | says your name, you want it all in red: |
|---|
| | 80 | |
|---|
| | 81 | @chatformat me=ansi(if(strmatch(%2,*[name(%!)]*),r,n),%5) |
|---|
| | 82 | |
|---|
| | 83 | (More examples in help @chatformat3) |
|---|
| | 84 | & @CHATFORMAT3 |
|---|
| | 85 | A popular feature in clients now available in PennMUSH directly: |
|---|
| | 86 | Let's suppose you want "Public" channel chatter to all be green, |
|---|
| | 87 | "Softcode" to be blue and "Admin" to be cyan. |
|---|
| | 88 | |
|---|
| | 89 | @chatformat me=ansi(switch(%1,Public,g,Softcode,b,Admin,c,n),%5) |
|---|
| | 90 | |
|---|
| | 91 | Maybe you dislike players who re-@name themselves a lot: |
|---|
| | 92 | |
|---|
| | 93 | &playernames me=#6061:Walker #7:Javelin #6388:Cheetah |
|---|
| | 94 | @chatformat me=<%1> [switch(%0,@,%2,speak(&[if(%4,%4%b)][firstof( |
|---|
| | 95 | after(grab(v(playernames),%#:*),:),%3)],%2))] |
|---|
| | 96 | |
|---|
| | 97 | Or you're writing a loggerbot, and you want to convert all channel |
|---|
| | 98 | input to HTML: |
|---|
| | 99 | |
|---|
| | 100 | @chatformat me=CHAT:%1:[edit(switch(%0,@,%2,speak(if(%4,%4%b)%3,%0%2)), |
|---|
| | 101 | &,&,<,<,>,>,%r,<BR>,%b%b,%b )] |
|---|
| | 102 | |
|---|
| | 103 | See also: @chat, @pageformat, speak() |
|---|