Wikia

Freeciv

Watchlist Recent changes

User:Pepeto/Chat improvements ideas

< Pepeto

Contents

OverviewEdit

My idea is to add some escape sequences in the chat line to have a better-looking client and make fast analysis of the message you receive from the server. Those escape sequences would look like:

  • [color] ... [/color] abbreviation: [c] ... [/c]
This sequence would control with what color would be displayed the text contained between [color] and [/color].
Options:
  • foreground abbreviation: fg
  • background abbreviation: bg
Those options would take a string containing a color name (e.g. "red") or a html 24-bits style color #RRGGBB.
Example: [color foreground="white" background="black"]white on black[/color]white on black
  • [bold] ... [/bold] abbreviation: [b] ... [/b]
Example: [b]bold[/b]bold
  • [italic] ... [/italic] abbreviation: [i] ... [/i]
Example: [i]italic[/i]italic
  • [underline] ... [/underline] abbreviation: [u] ... [/u]
Example: [u]underline[/u]underline
  • [strike] ... [/strike] abbreviation: [s] ... [/s]
Example: [s]strike[/s]strike
  • [link] ... [/link] abbreviation: [l] ... [/l]
This sequence would allow to make clickable link. Note it could also exist in a single sequence.
Options
  • target abbreviation: tgt: controls what kind of target the link would point to (e.g. "tile", "city", "unit").
  • id: controls what id the link would point to (a tile index, a city id or a unit id).
  • x and y: instead of id, it would make a link from map coordinates.
Examples: [link target="tile" x=5 y=9](5, 9)[/link](5, 9)
[link target="tile" x=5 y=9 /] → (5, 9)

ImplementationEdit

VocabularyEdit

  • plain text: a plain text is a simple text which doesn't contain any escape sequence. It is like classical strings.
  • featured text: this a string, like the plain text. But it could include one or many escape sequences.
  • text tag: this is structure which indicate a particular transformation of a plain text. It contains the information about the transformation type (e.g. italic, color), the start and the of the transformation (in byte offsets).

Main functionsEdit

  • The function to separate the plain text from the tags would be named:
size_t featured_text_to_plain_text(const char *featured_text, char *plain_text, size_t plain_text_len, struct text_tag_list *tags);

It would takes as first argument a string containing escape sequences. plain_text and plain_text_len for the plain text output. tags, an optional list to store the tags. Basically, it would be call by the client chatline to display such strings. In 2.1, it could also be called by the server with NULL as last argument to send plain text to the old clients which wouldn't be able to handle the featured text.

Pages on Freeciv

Add a Page
572pages on
this wiki

Latest Photos

Add a Photo
573photos on this wiki
See more >

Recent Wiki Activity

See more >

Around Wikia's network

Random Wiki