1
0
Fork 0

Custom message highlighting

By setting the property /sim/multiplay/chat_highlight . Especially
useful to highlight messages directed to ATCs.
This commit is contained in:
Markus Pargmann 2012-03-16 22:55:57 +01:00 committed by Stuart Buchanan
parent 0920d46cac
commit fe68411d37

View file

@ -454,17 +454,7 @@ var fdm_init_listener = _setlistener("/sim/signals/fdm-initialized", func {
var search_name_in_msg = func(msg, call) {
##############################################################################
# functions that make use of the window class (and don't belong anywhere else)
##############################################################################
# highlights messages with the multiplayer callsign in the text
var msg_mp = func (n) {
if (!getprop("/sim/multiplay/chat-display"))
return;
var msg = string.lc(n.getValue());
var call = string.lc(getprop("/sim/multiplay/callsign"));
var matching = 0; var matching = 0;
var found = 0; var found = 0;
for(var i = 0; i < size(msg); i = i + 1) { for(var i = 0; i < size(msg); i = i + 1) {
@ -487,6 +477,22 @@ var msg_mp = func (n) {
} }
} }
if (found == 1 or matching == size(call)) if (found == 1 or matching == size(call))
return 1;
else
return 0;
}
##############################################################################
# functions that make use of the window class (and don't belong anywhere else)
##############################################################################
# highlights messages with the multiplayer callsign in the text
var msg_mp = func (n) {
if (!getprop("/sim/multiplay/chat-display"))
return;
var msg = string.lc(n.getValue());
var call = string.lc(getprop("/sim/multiplay/callsign"));
var highlight = getprop("/sim/multiplay/chat_highlight");
if (search_name_in_msg(msg, call) or (highlight != nil and search_name_in_msg(msg, string.lc(highlight))))
screen.log.write(n.getValue(), 1.0, 0.5, 0.5); screen.log.write(n.getValue(), 1.0, 0.5, 0.5);
else else
screen.log.write(n.getValue(), 0.5, 0.0, 0.8); screen.log.write(n.getValue(), 0.5, 0.0, 0.8);