Player APIs (BrightScript & Ja...
...
Object Reference
BrightScript Core Objects

roMessagePort

8min
a message port is the destination where messages (events) are sent see the explanation of object reference docid\ ylhbuax eqfa5sqfjukpn for more details you do not call these functions directly when using brightscript instead, use the wait() global functions docid\ nsjxffr7olfgdwgjfebme ifmessageport getmessage() as object returns the event object if available otherwise, invalid is returned in either case, this method returns immediately without waiting waitmessage(timeout as integer) as object waits until an event object is available or the specified amount of milliseconds have passed when an event object becomes available, it will be returned if the timeout is reached, invalid will be returned passing a zero timeout value instructs this method to wait indefinitely for a message you can also use the wait() global function to retrieve event objects over a specified interval the following two statements have the same effect msg = port waitmessage(timeout) msg = wait(timeout, port) postmessage(msg as object) as void peekmessage() as object returns the event object if available (or invalid if otherwise), but does not remove the event object from the message queue; a later call to getmessage() , waitmessage() , or peekmessage() will return the same event object setwatchdogtimeout(seconds as integer) as integer enables a watchdog timeout on the romessageport instance if passed a positive integer the watchdog will crash and reboot the player if the script does not call getmessage() or waitmessage() after the specified number of seconds (the timeout is blocked while the script waits on the message port) passing zero to this method disables the watchdog some brightscript operations (e g roassetrealizer realize() ) can take a long time to return in these cases, it may be better to use a short watchdog timeout in general but switch to a longer timeout before calling such operations the watchdog timeout only applies to its associated romessageport instance, so enabling the watchdog on one romessageport instance, then calling waitmessage() on another, may cause the watchdog to trigger unexpectedly the watchdog will not trigger while waiting on the brightscript debugger prompt deferwatchdog(seconds as integer) defers the watchdog timeout set by the setwatchdogtimeout() method passing an integer to this method defers the timeout for the specified number of seconds deferwatchdog() defers the watchdog timeout by the amount of seconds set in the setwatchdogtimeout() method calls to either deferwatchdog() method cannot cause the watchdog to trigger earlier than it already will for example, calling deferwatchdog(100) followed by deferwatchdog(10) will still cause the watchdog to trigger after 100 seconds ifenum reset() resets the position to the first element of enumeration next() as dynamic returns the typed value at the current position and increment position isnext() as boolean returns true if there is a next element isempty() as boolean returns true if there is not a next element