- we prefer hyphens in property names to underscores
- save /sim/multiplayer/chat-display to autosave.xml - remove trailing spaces
This commit is contained in:
parent
0561fc2e1f
commit
e092ee9abc
5 changed files with 26 additions and 25 deletions
|
@ -11,15 +11,15 @@
|
||||||
var messages = {};
|
var messages = {};
|
||||||
|
|
||||||
check_messages = func
|
check_messages = func
|
||||||
{
|
{
|
||||||
|
|
||||||
var mp = props.globals.getNode("/ai/models").getChildren("multiplayer");
|
var mp = props.globals.getNode("/ai/models").getChildren("multiplayer");
|
||||||
|
|
||||||
foreach (i; mp)
|
foreach (i; mp)
|
||||||
{
|
{
|
||||||
var lmsg = getprop(i.getPath() ~ "/sim/multiplay/chat");
|
var lmsg = getprop(i.getPath() ~ "/sim/multiplay/chat");
|
||||||
var lcallsign = getprop(i.getPath() ~ "/callsign");
|
var lcallsign = getprop(i.getPath() ~ "/callsign");
|
||||||
|
|
||||||
if ((lmsg != nil) and (lmsg != "") and (lcallsign != nil) and (lcallsign != ""))
|
if ((lmsg != nil) and (lmsg != "") and (lcallsign != nil) and (lcallsign != ""))
|
||||||
{
|
{
|
||||||
#print("Call Sign: " ~ lcallsign);
|
#print("Call Sign: " ~ lcallsign);
|
||||||
|
@ -30,13 +30,13 @@ check_messages = func
|
||||||
{
|
{
|
||||||
# Indicate we've seen this message.
|
# Indicate we've seen this message.
|
||||||
messages[lcallsign] = lmsg;
|
messages[lcallsign] = lmsg;
|
||||||
echo_message(lmsg, lcallsign);
|
echo_message(lmsg, lcallsign);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for new messages every couple of seconds.
|
# Check for new messages every couple of seconds.
|
||||||
settimer(check_messages, 3);
|
settimer(check_messages, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo_message = func(msg, callsign)
|
echo_message = func(msg, callsign)
|
||||||
|
@ -45,8 +45,8 @@ echo_message = func(msg, callsign)
|
||||||
{
|
{
|
||||||
msg = callsign ~ ": " ~ msg;
|
msg = callsign ~ ": " ~ msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ldisplay = getprop("/sim/multiplay/chat_display");
|
var ldisplay = getprop("/sim/multiplay/chat-display");
|
||||||
|
|
||||||
if ((ldisplay != nil) and (ldisplay == "1"))
|
if ((ldisplay != nil) and (ldisplay == "1"))
|
||||||
{
|
{
|
||||||
|
@ -55,20 +55,20 @@ echo_message = func(msg, callsign)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add the chat to the chat history.
|
# Add the chat to the chat history.
|
||||||
var lchat = getprop("/sim/multiplay/chat_history");
|
var lchat = getprop("/sim/multiplay/chat-history");
|
||||||
|
|
||||||
if (lchat == nil)
|
if (lchat == nil)
|
||||||
{
|
{
|
||||||
setprop("/sim/multiplay/chat_history", msg);
|
setprop("/sim/multiplay/chat-history", msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (substr(lchat, size(lchat) -1, 1) != "\n")
|
if (substr(lchat, size(lchat) -1, 1) != "\n")
|
||||||
{
|
{
|
||||||
lchat = lchat ~ "\n";
|
lchat = lchat ~ "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
setprop("/sim/multiplay/chat_history", lchat ~ msg);
|
setprop("/sim/multiplay/chat-history", lchat ~ msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ settimer(func {
|
||||||
|
|
||||||
# check for new messages
|
# check for new messages
|
||||||
check_messages();
|
check_messages();
|
||||||
|
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<stretch>true</stretch>
|
<stretch>true</stretch>
|
||||||
<halign>fill</halign>
|
<halign>fill</halign>
|
||||||
<length>50</length>
|
<length>50</length>
|
||||||
<property>/sim/multiplay/chat_compose</property>
|
<property>/sim/multiplay/chat-compose</property>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
<button>
|
<button>
|
||||||
|
@ -27,11 +27,11 @@
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>
|
<script>
|
||||||
var lchat = getprop("/sim/multiplay/chat_compose");
|
var lchat = getprop("/sim/multiplay/chat-compose");
|
||||||
if (lchat != "")
|
if (lchat != "")
|
||||||
{
|
{
|
||||||
setprop("/sim/multiplay/chat", lchat);
|
setprop("/sim/multiplay/chat", lchat);
|
||||||
setprop("/sim/multiplay/chat_compose", "");
|
setprop("/sim/multiplay/chat-compose", "");
|
||||||
fgcommand("dialog-update", props.Node.new({"object-name": "compose",
|
fgcommand("dialog-update", props.Node.new({"object-name": "compose",
|
||||||
"dialog-name": "chat"}));
|
"dialog-name": "chat"}));
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
<default>false</default>
|
<default>false</default>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-show</command>
|
<command>dialog-show</command>
|
||||||
<dialog-name>chat_full</dialog-name>
|
<dialog-name>chat-full</dialog-name>
|
||||||
</binding>
|
</binding>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-close</command>
|
<command>dialog-close</command>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<PropertyList>
|
<PropertyList>
|
||||||
<name>chat_full</name>
|
<name>chat-full</name>
|
||||||
<modal>false</modal>
|
<modal>false</modal>
|
||||||
<layout>vbox</layout>
|
<layout>vbox</layout>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
<live>true</live>
|
<live>true</live>
|
||||||
<wrap>true</wrap>
|
<wrap>true</wrap>
|
||||||
<editable>false</editable>
|
<editable>false</editable>
|
||||||
<property>/sim/multiplay/chat_history</property>
|
<property>/sim/multiplay/chat-history</property>
|
||||||
</textbox>
|
</textbox>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
<halign>fill</halign>
|
<halign>fill</halign>
|
||||||
<length>50</length>
|
<length>50</length>
|
||||||
<pref-width>500</pref-width>
|
<pref-width>500</pref-width>
|
||||||
<property>/sim/multiplay/chat_compose</property>
|
<property>/sim/multiplay/chat-compose</property>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
<button>
|
<button>
|
||||||
|
@ -48,13 +48,13 @@
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>
|
<script>
|
||||||
var lchat = getprop("/sim/multiplay/chat_compose");
|
var lchat = getprop("/sim/multiplay/chat-compose");
|
||||||
if (lchat != "")
|
if (lchat != "")
|
||||||
{
|
{
|
||||||
setprop("/sim/multiplay/chat", lchat);
|
setprop("/sim/multiplay/chat", lchat);
|
||||||
setprop("/sim/multiplay/chat_compose", "");
|
setprop("/sim/multiplay/chat-compose", "");
|
||||||
fgcommand("dialog-update", props.Node.new({"object-name": "compose",
|
fgcommand("dialog-update", props.Node.new({"object-name": "compose",
|
||||||
"dialog-name": "chat_full"}));
|
"dialog-name": "chat-full"}));
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</binding>
|
</binding>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<checkbox>
|
<checkbox>
|
||||||
<halign>left</halign>
|
<halign>left</halign>
|
||||||
<label>Show chat messages</label>
|
<label>Show chat messages</label>
|
||||||
<property>/sim/multiplay/chat_display</property>
|
<property>/sim/multiplay/chat-display</property>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-apply</command>
|
<command>dialog-apply</command>
|
||||||
</binding>
|
</binding>
|
||||||
|
|
|
@ -464,6 +464,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
||||||
<multiplay>
|
<multiplay>
|
||||||
<chat type="string">Hello</chat>
|
<chat type="string">Hello</chat>
|
||||||
<transmission-freq-hz type="string">118500000</transmission-freq-hz>
|
<transmission-freq-hz type="string">118500000</transmission-freq-hz>
|
||||||
|
<chat-display type="bool" userarchive="y">true</chat-display>
|
||||||
</multiplay>
|
</multiplay>
|
||||||
|
|
||||||
<user>
|
<user>
|
||||||
|
|
Loading…
Add table
Reference in a new issue