Browser Messages

From TrainzOnline
Jump to: navigation, search

Browser messages are used to track the state of in game browsers. All messages are broadcast and Trainz supports multiple browsers so you need to be sure that any messages received are intended for your own browser, you can do this by checking that the message source is the same as your browser object. When intercepting a browser message in a wait() loop construct, make sure that you clear out the source field of your message variable before continuing, otherwise your message will still be referencing the browser which caused the message, and other scripts will be unable to close it.

  • Browser-Closed: is broadcast when the user clicks on the close button or presses the Escape key in any browser. Your script should respond by resetting the browser object to null.
  • Browser-URL: is broadcast when the user clicks on a link in a browser object. The message minor will be in the form live://linkname and should be used by your script to decide what action needs to be taken.
Personal tools