1
0
Fork 0

- we prefer hyphens in property names to underscores

- save /sim/multiplayer/chat-display to autosave.xml
- remove trailing spaces
This commit is contained in:
mfranz 2007-08-01 19:37:51 +00:00
parent 0561fc2e1f
commit e092ee9abc
5 changed files with 26 additions and 25 deletions

View file

@ -11,15 +11,15 @@
var messages = {};
check_messages = func
{
{
var mp = props.globals.getNode("/ai/models").getChildren("multiplayer");
foreach (i; mp)
{
var lmsg = getprop(i.getPath() ~ "/sim/multiplay/chat");
var lcallsign = getprop(i.getPath() ~ "/callsign");
if ((lmsg != nil) and (lmsg != "") and (lcallsign != nil) and (lcallsign != ""))
{
#print("Call Sign: " ~ lcallsign);
@ -30,13 +30,13 @@ check_messages = func
{
# Indicate we've seen this message.
messages[lcallsign] = lmsg;
echo_message(lmsg, lcallsign);
echo_message(lmsg, lcallsign);
}
}
}
# Check for new messages every couple of seconds.
settimer(check_messages, 3);
settimer(check_messages, 3);
}
echo_message = func(msg, callsign)
@ -45,8 +45,8 @@ echo_message = func(msg, callsign)
{
msg = callsign ~ ": " ~ msg;
}
var ldisplay = getprop("/sim/multiplay/chat_display");
var ldisplay = getprop("/sim/multiplay/chat-display");
if ((ldisplay != nil) and (ldisplay == "1"))
{
@ -55,20 +55,20 @@ echo_message = func(msg, callsign)
}
# Add the chat to the chat history.
var lchat = getprop("/sim/multiplay/chat_history");
var lchat = getprop("/sim/multiplay/chat-history");
if (lchat == nil)
{
setprop("/sim/multiplay/chat_history", msg);
}
setprop("/sim/multiplay/chat-history", msg);
}
else
{
if (substr(lchat, size(lchat) -1, 1) != "\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_messages();
}, 1);

View file

@ -14,7 +14,7 @@
<stretch>true</stretch>
<halign>fill</halign>
<length>50</length>
<property>/sim/multiplay/chat_compose</property>
<property>/sim/multiplay/chat-compose</property>
</input>
<button>
@ -27,11 +27,11 @@
<binding>
<command>nasal</command>
<script>
var lchat = getprop("/sim/multiplay/chat_compose");
var lchat = getprop("/sim/multiplay/chat-compose");
if (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",
"dialog-name": "chat"}));
}
@ -59,7 +59,7 @@
<default>false</default>
<binding>
<command>dialog-show</command>
<dialog-name>chat_full</dialog-name>
<dialog-name>chat-full</dialog-name>
</binding>
<binding>
<command>dialog-close</command>

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<PropertyList>
<name>chat_full</name>
<name>chat-full</name>
<modal>false</modal>
<layout>vbox</layout>
@ -19,7 +19,7 @@
<live>true</live>
<wrap>true</wrap>
<editable>false</editable>
<property>/sim/multiplay/chat_history</property>
<property>/sim/multiplay/chat-history</property>
</textbox>
<text>
@ -35,7 +35,7 @@
<halign>fill</halign>
<length>50</length>
<pref-width>500</pref-width>
<property>/sim/multiplay/chat_compose</property>
<property>/sim/multiplay/chat-compose</property>
</input>
<button>
@ -48,13 +48,13 @@
<binding>
<command>nasal</command>
<script>
var lchat = getprop("/sim/multiplay/chat_compose");
var lchat = getprop("/sim/multiplay/chat-compose");
if (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",
"dialog-name": "chat_full"}));
"dialog-name": "chat-full"}));
}
</script>
</binding>

View file

@ -27,7 +27,7 @@
<checkbox>
<halign>left</halign>
<label>Show chat messages</label>
<property>/sim/multiplay/chat_display</property>
<property>/sim/multiplay/chat-display</property>
<binding>
<command>dialog-apply</command>
</binding>

View file

@ -464,6 +464,7 @@ Started September 2000 by David Megginson, david@megginson.com
<multiplay>
<chat type="string">Hello</chat>
<transmission-freq-hz type="string">118500000</transmission-freq-hz>
<chat-display type="bool" userarchive="y">true</chat-display>
</multiplay>
<user>