Skip to content

sendTEXT

Jason Watkins edited this page Apr 7, 2015 · 6 revisions

Sets a message that X-Plane will display on the screen.

Syntax

Language Signature
C short sendTEXT(struct xpcSocket sendfd, char* msg, int x, int y)
MATLAB function status = sendTEXT( msg, x, y, IP, port )
Java public void sendTEXT(String msg, int x, int y)
Python sendTEXT(msg, x, y)
Parameters

sendfd(C): The socket used to send the command.

msg: The string to display on the screen

x: The distance in pixels from the left edge of the screen to display the message.

y: The distance in pixels from the bottom edge of the screen to display the message.

IP (MATLAB): The hostname of the X-Plane server

port (MATLAB): The port on which the X-Plane server is listening

Remarks

The sendTEXT command only supports a single line of simple text. Newlines and other white-space characters besides space will result in undefined and unpredictable rendering of the string.

Exceptions

Error Code Exception Description
1 IOException The client is unable to send the command

Examples

C
#include "xplaneConnect.h"
sendfd = openUDP(49077, IP, PORT);
sendTEXT(sendfd, "Hello from C", -1, -1); // Display 'Hello from C' at the default location
closeUDP(sendfd);
MATLAB
import XPlaneConnect.*;
% Display 'Hello from MATLAB' 100 pixels from the left and bottom edges of the screen
status = sendTEXT('Hello from MATLAB', 100, 100);
Java
import gov.nasa.xpc.XPlaneConnect;
try(XPlaneConnect xpc = new XPlaneConnect())
{
    // Display 'Hello from Java' 100 pixels from the left edge of the screen and at the default height
    xpc.sendTEXT("Hello from Java", 100, -1);
}