Board index FlightGear Development

Fixing mp chat messages

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Re: Fixing mp chat messages

Postby Hooray » Tue Jun 24, 2014 6:49 pm

apply your changes, next use git checkout -b topics/mp-chat-improvements
then, you can use git add filename1 filename2 etc to add all modified files, if in doubt, use git status to see an overview
next, use git commit -a -m "mp chat improvements by chrisb as per viewtopic.php?f=18&t=23344&p=213322#p212888"
now, you should have a corresponding commit in your history, to see for yourself, use git log
you can now push your changes to your remote branch on gitorious
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Fixing mp chat messages

Postby Philosopher » Tue Jun 24, 2014 6:50 pm

Oh, since you made a new clone, run your push command again, which should work. If it doesn't, add -f after push and try again. (Use -f with caution though, because you can lose commits or make other people's pulling much harder if they're using the same repo.)
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Fixing mp chat messages

Postby chrisb » Tue Jun 24, 2014 11:42 pm

I thought I had to create a clone on gitorious

$ git push -f git@gitorious.org:~chrisb/fg/chrisb-fgdata.git
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

fatal: protocol error: expected old/new/ref, got 'shallow 55754bd6f2bdca629a1150
e103f50fac28675687'
error: failed to push some refs to 'git@gitorious.org:~chrisb/fg/chrisb-fgdata.g
it'
chrisb
 
Posts: 136
Joined: Mon Oct 21, 2013 9:46 pm
Location: YLIL, YMML
Callsign: cnb123
Version: git
OS: Win7 64bit

Re: Fixing mp chat messages

Postby chrisb » Tue Jun 24, 2014 11:48 pm

I still get this "fatal protocol error"

Code: Select all
$ git checkout -b topics/mp-chat-improvements
Switched to a new branch 'topics/mp-chat-improvements'


Code: Select all
$ git add Nasal/multiplayer.nas Nasal/screen.nas gui/dialogs/multiplayer.xml
warning: LF will be replaced by CRLF in Nasal/multiplayer.nas.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Nasal/screen.nas.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in gui/dialogs/multiplayer.xml.
The file will have its original line endings in your working directory.


Code: Select all
$ git commit -a -m "mp chat improvements by chrisb as per viewtopic.php?f=18&t=
23344&p=213322#p212888"
[topics/mp-chat-improvements warning: LF will be replaced by CRLF in Nasal/multi
player.nas.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Nasal/screen.nas.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in gui/dialogs/multiplayer.xml.
The file will have its original line endings in your working directory.
5d35313] mp chat improvements by chrisb as per viewtopic.php?f=18&t=23344&p=2133
22#p212888
warning: LF will be replaced by CRLF in Nasal/multiplayer.nas.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Nasal/screen.nas.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in gui/dialogs/multiplayer.xml.
The file will have its original line endings in your working directory.
 3 files changed, 81 insertions(+), 10 deletions(-)


Code: Select all
$ git push git@gitorious.org:~chrisb/fg/chrisb-fgdata.git
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

fatal: protocol error: expected old/new/ref, got 'shallow 55754bd6f2bdca629a1150
e103f50fac28675687'
error: failed to push some refs to 'git@gitorious.org:~chrisb/fg/chrisb-fgdata.g
it'
chrisb
 
Posts: 136
Joined: Mon Oct 21, 2013 9:46 pm
Location: YLIL, YMML
Callsign: cnb123
Version: git
OS: Win7 64bit

Re: Fixing mp chat messages

Postby TheTom » Wed Jun 25, 2014 12:25 am

Seems like the git version of gitorious is too old to support from shallow clones. You will need a full clone before pushing: $ git fetch --unshallow
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

Re: Fixing mp chat messages

Postby Philosopher » Wed Jun 25, 2014 12:26 am

http://stackoverflow.com/questions/6802 ... 9#17937889

If this is too much work/bandwidth, just post a diff here and we can review/merge it.
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Fixing mp chat messages

Postby chrisb » Wed Jun 25, 2014 1:08 am

The /sim/sound/voices/enabled property I added in multiplsayer settings doesnt work
I found I needed to set it on launch

Code: Select all
Parent: fcf18d70e20ef629d96367cd0907dae6178e1997 (canvas.gui: Draw tooltips on top of other windows/dialogs.)
Branch: topics/mp-chat-improvements
Follows: remove-ATCDCL
Precedes:

    mp chat improvements by chrisb as per viewtopic.php?f=18&t=23344&p=213322#p212888

---------------------------- Nasal/multiplayer.nas ----------------------------
index 7bf9dd2..a618ebe 100644
@@ -76,13 +76,16 @@ var chat_listener = func(n)
 # Message composition function, activated using the - key.
 var prefix = "Chat Message:";
 var input = "";
+var last_input = ""; #used to check EOM
 var kbdlistener = nil;
 
 var compose_message = func(msg = "")
 {
   input = prefix ~ msg;
   gui.popupTip(input, 1000000);
+  if (getprop("/sim/multiplay/slow-time") == "1") { setprop("/sim/speed-up", 0.01);  } #slow time
   
+  if (kbdlistener != nil) { removelistener(kbdlistener); kbdlistener = nil; }
   kbdlistener = setlistener("/devices/status/keyboard/event", func (event) {
     var key = event.getNode("key");
 
@@ -97,16 +100,30 @@ var compose_message = func(msg = "")
 
 var handle_key = func(key)
 {
-  if (key == `\n` or key == `\r`)
+  if (key == `\n` or key == `\r` or (last_input == "." and key == `.`)) #entering two .. counts as end of message
   {
     # CR/LF -> send the message
 
     # Trim off the prefix
+   if (input == prefix) { screen.log.write(getprop("/sim/messages/mp-plane")); } #repeat last received msg
     input = substr(input, size(prefix));
-    # Send the message and switch off the listener.
+   #does player want chat help
+   if (input == "?") {
+     screen.log.clear();
+       screen.log.write("Chat help
+A message ending in .. counts as an enter
+A blank message repeats the last message
+Time can be slowed while entering text");
+    } else {
+      # Send the message
       setprop("/sim/multiplay/chat", input);
+   }
+   #switch off the listener.
     removelistener(kbdlistener);
+   kbdlistener = nil;
     gui.popdown();
+    if (getprop("/sim/multiplay/slow-time") == "1") { setprop("/sim/speed-up", 1);  } #return to normal time
+
     return 1;
   }
   elsif (key == 8)
@@ -116,6 +133,7 @@ var handle_key = func(key)
     if (size(input) > size(prefix))
     {
       input = substr(input, 0, size(input) - 1);
+     last_input = "";
       gui.popupTip(input, 1000000);
     }
 
@@ -126,13 +144,16 @@ var handle_key = func(key)
   {
     # escape -> cancel
     removelistener(kbdlistener);
+   kbdlistener = nil;
     gui.popdown();
+    if (getprop("/sim/multiplay/slow-time") == "1") { setprop("/sim/speed-up", 1);  } #return to normal time
     return 1;
   }
   elsif ((key > 31) and (key < 128))
   {
     # Normal character - add it to the input
     input ~= chr(key);
+   last_input = chr(key);
    gui.popupTip(input, 1000000);
     return 1;
   }
@@ -537,5 +558,11 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
 
   # Call-back to ensure we see our own messages.
   setlistener("/sim/multiplay/chat", chat_listener);
-});
   
+   
+  setlistener("/sim/messages/mp-plane", func {
+   if (getprop("/sim/multiplay/tts_msgs") == "1" ) {
+     setprop("/sim/sound/voices/pilot", getprop("/sim/messages/mp-plane"));
+   }
+  });
+});
\ No newline at end of file

------------------------------- Nasal/screen.nas -------------------------------
index 1fbdc36..66c8672 100644
@@ -498,9 +498,9 @@ var msg_mp = func (n) {
    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.6, 0.4);
    else
-      screen.log.write(n.getValue(), 0.5, 0.0, 0.8);
+      screen.log.write(n.getValue(), 0.75, 0.5, 0.75);
 }
 
 var msg_repeat = func {
@@ -548,6 +548,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
             return;
          if ((var agl = getprop("/position/altitude-agl-ft")) != nil and agl > 100)
             return;
+         screen.log.bg = [0,0,0,0.5]; #Set dark transparent background
          screen.log.write("You are on runway " ~ rwy, 0.7, 1.0, 0.7);
       }, 1);
    }, 5);

------------------------- gui/dialogs/multiplayer.xml -------------------------
index f753abf..0fad98a 100644
@@ -212,6 +212,49 @@
             <property>/sim/multiplay/txhost</property>
             <live>true</live>
         </text>
+      <hrule/>
+      <checkbox>
+            <row>6</row>
+            <col>1</col>
+            <colspan>2</colspan>
+            <halign>left</halign>
+            <name>slow-time</name>
+            <label>Slows time while entering a message</label>
+            <property>/sim/multiplay/slow-time</property>
+            <binding>
+                <command>dialog-apply</command>
+                <object-name>slow-time</object-name>
+            </binding>
+        </checkbox>
+      
+      <checkbox>
+            <row>7</row>
+            <col>1</col>
+            <colspan>2</colspan>
+            <halign>left</halign>
+            <name>enable_tts</name>
+            <label>(Enable TTS via cmd_line properties)</label>
+            <property>/sim/sound/voices/enabled</property>
+            <binding>
+                <command>dialog-apply</command>
+                <object-name>enable_tts</object-name>
+            </binding>
+        </checkbox>
+      
+      <checkbox>
+            <row>8</row>
+            <col>1</col>
+            <colspan>2</colspan>
+            <halign>left</halign>
+            <name>tts_msgs</name>
+            <label>Send all received mp messages immediately to TTS</label>
+            <property>/sim/multiplay/tts_msgs</property>
+            <binding>
+                <command>dialog-apply</command>
+                <object-name>tts_msgs</object-name>
+            </binding>
+        </checkbox>
+      
       </group>
 
     <!-- button area -->
Last edited by chrisb on Mon Oct 06, 2014 12:53 pm, edited 1 time in total.
chrisb
 
Posts: 136
Joined: Mon Oct 21, 2013 9:46 pm
Location: YLIL, YMML
Callsign: cnb123
Version: git
OS: Win7 64bit

Re: Fixing mp chat messages

Postby chrisb » Fri Jul 04, 2014 10:00 am

Is this patch not in a suitable format?
chrisb
 
Posts: 136
Joined: Mon Oct 21, 2013 9:46 pm
Location: YLIL, YMML
Callsign: cnb123
Version: git
OS: Win7 64bit

Re: Fixing mp chat messages

Postby Philosopher » Sun Jul 06, 2014 2:24 pm

Change this:
Code: Select all
if (getprop("/sim/multiplay/slow-time") == "1") { setprop("/sim/speed-up", 0.01);  } #slow time

to this (including similar things later):
Code: Select all
if (getprop("/sim/multiplay/slow-time")) setprop("/sim/speed-up", 0.01); # slow time

There's a few other issues (this is just a minor one I spotted), particularly in the fact that it will interfere with speed-up time (e.g. I hit 'a' to speed up, then start a message. It becomes very slow. I end the message. What does it become? Normal speed not the speed after I pressed 'a'.), but it generally looks good. Let input be a non-chr(), i.e. just key. Also, if you're introducing new properties, specify a default value and type in preferences.xml (e.g. false "bool").

P.S. It will be over a week before I can test or commit – better to ask someone else (James, Stuart, Tom... not sure who's active).
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Fixing mp chat messages

Postby chrisb » Mon Jul 07, 2014 3:31 pm

They are features I have I find exceptionally useful, they still need tweaking
Add another variable and return speed to previous speed would fix that speed issue
What do you mean with the "Let input be a non-chr(), i.e. just key."?
chrisb
 
Posts: 136
Joined: Mon Oct 21, 2013 9:46 pm
Location: YLIL, YMML
Callsign: cnb123
Version: git
OS: Win7 64bit

Previous

Return to Development

Who is online

Users browsing this forum: No registered users and 12 guests