Torque 3D - Script Manual: SimpleNetObject Class Reference

TorqueScript

Main   Class List   Namespace List   Online

SimpleNetObject Class Reference
[Networking]

A very simple example of a class derived from NetObject. More...

Inheritance diagram for SimpleNetObject:

List of all members.

Public Member Functions

void setMessage (string msg)
 Sets the internal message variable.

Detailed Description

A very simple example of a class derived from NetObject.

This object exists purely for instructional purposes. It is primarily geared toward developers that wish to understand the inner-working of Torque 3D's networking system. This is not intended for actual game development.

Example:
// On the server, create a new SimpleNetObject.  This is a ghost always
// object so it will be immediately ghosted to all connected clients.
$s = new SimpleNetObject();

// All connected clients will see the following in their console:
// 
// Got message: Hello World!
See also:
NetObject for a full breakdown of this example object

Member Function Documentation

void SimpleNetObject::setMessage ( string  msg  ) 

Sets the internal message variable.

SimpleNetObject is set up to automatically transmit this new message to all connected clients. It will appear in the clients' console.

Parameters:
msg The new message to send
Example:
// On the server, create a new SimpleNetObject.  This is a ghost always
// object so it will be immediately ghosted to all connected clients.
$s = new SimpleNetObject();

// All connected clients will see the following in their console:
// 
// Got message: Hello World!

// Now again on the server, change the message.  This will cause it to
// be sent to all connected clients.
$s.setMessage("A new message from me!");

// All connected clients will now see in their console:
// 
// Go message: A new message from me!


Copyright © GarageGames, LLC. All Rights Reserved.