A Fix for Blank Messages containing Colored Names
I would like to propose a new standard.
Below is some code which makes it possible to send message, send question, and write to player logbook when an object has a colored name.
Why?
Color coding is very useful and ascetically pleasing. Following this new standard will benefit the community as a whole by opening up many new possibilities: ship organization, wing designation, hostile ships, abandoned ships, damaged ships, ships currently being boarded, etc.
The Proposal:
I propose that whenever anyone sends a message/question to their players, you add the proposed code immediately above all instances of send message, send question, or write to players logbook which send any objects name to the player. Wares, sectors, ships, etc. The extra work that it requires is only a few more lines of code and searching for "send message", "send question", and "write to player logbook".
[ external image ](.zip)
The Code:
Place above every send message, send question, and write to logbook using Exscriptor, '' [two apostrophes and a blank] cannot be input with the in-game SE. Please inform me of any other instances that this occurs.
Input: $name
Output: $name
append.to.your.code:
Code: Select all
* strip color
$escape.on = get global variable: name='color.escape.on'
if $escape.on != [TRUE]
send incoming message 'Color Escape Fix must be installed' to player: display it=[TRUE]
set global variable: name='plugin.dynamic.c.s.n' value=null
return null
end
$escape = get global variable: name='color.escape'
$find = find position of pattern $escape in $name
while $find > -1
$pattern = get substring of $name offset=$find length=2
$name2 = substitute in string $name: pattern $pattern with ''
$find = find position of pattern $escape in $name2
$pattern = get substring of $name2 offset=$find length=2
$name = substitute in string $name2: pattern $pattern with ''
$find = find position of pattern $escape in $name
end
T file:
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<language id="44">
<page id="7" title="Boardcomp. Sectornames" descr="Names of all sectors (spoken by Boardcomputer)" voice="yes">
<t id="1025002">A\033Bcquisition Repository\033X</t>
</page>
</language>
Code: Select all
load text: id=6874
$escape = get global variable: name='color.escape'
$name.orig = [PLAYERSHIP]->get name
$text = sprintf: pageid=7 textid=1025002, null, null, null, null, null
[PLAYERSHIP]->set name to $text
= wait 1000 ms
$name = [PLAYERSHIP]->get name
[PLAYERSHIP]->set name to $name.orig
$length = get length of string $name
$small = $length - 2
$escape = get substring of $name offset=$small length=1
set global variable: name='color.escape' value=$escape
set global variable: name='color.escape.on' value=[TRUE]
return null