 TRS2006 Scripting & API Guide

Introduction

Introduction

This document is a mixed collection of reference material that should be of interest to TRS2006 3rd party content creators making scripted assets. It is not an artist's reference or guide (that is what the Content Creator's Guide if for), so the creation of meshes and animation etc. is not covered.

Knowledge and understanding of programming concepts is an almost essential prerequisite for almost everything presented in this reference. This is a technical reference, not a tutorial that holds your hand. We can't teach programming concepts - it is something the reader needs to acquire elsewhere.

The Auran Game Script (GS) compiler uses a syntax very similar to that of C/C++ and Java, so knowing either of these languages would be a big head start. Those who are not familiar with C/C++ or Java, but are familiar with another programming language such as Pascal, Modula-2 or Perl needn't feel totally left out as these are still languages with similar concepts and adapting to GS from them shouldn't be too difficult.

Bonus but not essential prerequisite knowledge includes an understanding of basic OO (object oriented) theory and concepts such as encapsulation, inheritance and polymorphism. In addition to that, an understanding the basic concepts of threads and callback functions will also be very advantageous.

Note:
The TRS2006 Session & Rules Guide contains plenty of useful information on how rules and objects work in the Trainz world and is recommended (but not compulsory) reading for anyone interested in making scripted assets.

The 4 major sections in this reference are:
  1. Auran Game Script Compiler
    About the language, syntax and features of the scripting language.

  2. Mini-browser HTML Reference
    Reference to HTML tags supported by the Trainz mini-browser.

  3. Class API Reference
    Detailed reference of all TRS2006 classes and methods offered to the script programmer.

  4. Asset Source
    The actual configuration and script source files used in various TRS2006 assets. This code is just placed here for the convenience of curious creators who are already familiar with Trainz scripts and want to learn more. This material is provided as-is and you are free to use it to construct your own assets.

The full content listing of this reference is:
  • Auran Game Script
    • The Language
      • Comments
      • Keywords
      • Identifiers
      • Constants
      • Types
      • Operators
      • Class Declaration
      • Function Declaration
      • Control Flow Statements
      • Grammar
    • The Compiler
    • Using Auran Game Script
    • Scripts in Trainz
  • Mini Browser HTML Reference
  • Class API Reference
    • Class API Reference
    • Class Hierarchy
    • Compound Members
  • Asset Source
    • Driver Commands
    • Industries
    • Interiors
    • Libraries
    • Rules
    • Vehicles

TRS2006 Scripting & API Guide
Copyright (C) 2002-2005 Auran Developments Pty Ltd. All Rights Reserved.


Auran Game Script

Introduction

Auran Game Script (GS) was written for use with the Trainz products, but with the intention for reuse in other Auran games. This document explains the syntax and features of the language. GS is a scripting language, with syntax similar to that of C and also Java. This document does not attempt to explain programming languages, but describes the syntax of GS in full. Any concepts in the language not commonly found in other languages are described in full.

Note:
Many of the code samples may not compile in your games version of the runtime, but they still represent the GS language features.
Sections
  • The Language
    • Comments
    • Keywords
    • Identifiers
    • Constants
    • Types
    • Operators
    • Class Declaration
    • Function Declaration
    • Control Flow Statements
    • Grammar
  • The Compiler
  • Using Auran GameScript
  • Scripts in Trainz
See also:
Class and Message Reference, Asset Source


The Language
[Auran Game Script]

The Language

The contents of this section are:
  • Comments
  • Keywords
  • Identifiers
  • Constants
  • Types
  • Operators
  • Class Declaration
  • Function Declaration
  • Control Flow Statements
  • Grammar


Comments
[The Language]

Comments

Comments are specified as they are in C/C++:

  // (double back slash) will comment to the end of line

  /*
    will comment
    blocks
   */

Note:
C-style block comments cannot be nested.


Keywords
[The Language]

Keywords

The keywords supported by GS are:
  • break
  • case
  • continue
  • default
  • if, else
  • for
  • goto
  • null
  • return
  • switch
  • while
  • and
  • or
  • true
  • false
  • void
  • bool
  • int
  • float
  • string
  • object
  • class
  • static
  • include
  • public
  • native
  • final
  • thread
  • game
  • size
  • isclass
  • inherited
  • copy
  • new
  • me
  • cast
  • wait
  • on
  • define


break
[Keywords]

Keyword break

A break statement will break execution from a for, wait, switch, or while statement. For example:

  int i;

  for(i = 0; i < 10; ++i)
  {
    if(i == 5)
      break;
  }

When i is equal to 5, execution will continue after the for loop and i is now 5 (the ++i does not execute on a break).


case
[Keywords]

Keyword case

The case statement is used in the switch control flow statement to declare an integer option. Syntax for case is:

  case CONSTANT_INT_EXPRESSION : statement

The following code will print the days of the week from Sunday to Saturday:

  int i;
  string dayOfWeek;

  for(i = 0; i < 6; ++i)
  {
    switch(i)
    {
      case 0 : dayOfWeek = "Sunday"; break;
      case 1 : dayOfWeek = "Monday"; break;
      case 2 : dayOfWeek = "Tuesday"; break;
      case 3 : dayOfWeek = "Wednesday"; break;
      case 4 : dayOfWeek = "Thursday"; break;
      case 5 : dayOfWeek = "Friday"; break;
      case 6 : dayOfWeek = "Saturday"; break;
      default :
      dayOfWeek = "ERROR";
    }

    Interface.Print(dayOfWeek);
  }


continue
[Keywords]

Keyword continue

continue will jump to the next iteration of a for, while or wait statement. For example:

  int i;

  for(i = 0; i < 10; ++i)
  {
    if(i == 5)
      continue;
    Interface.Print(i);
  }

The above code will print 0 to 4, skip 5 and then 6 to 9 (i.e. 0 1 2 3 4 6 7 8 9).


default
[Keywords]

Keyword default

default is used within a switch statement for the case when the switch value does not match any case. In the case example, dayOfWeek would be set to "ERROR" if i was not in the range of [0 - 6].


if, else
[Keywords]

Keyword if, else

The if and else keywords are used for logical control flow statements that evaluate Boolean expressions. For example:

  int i = Math.Rand(0, 3);

  if(i == 0)
  {
    Interface.Print("i is 0");
  }
  else if(i == 1)
  {
    Interface.Print("i is 1");
  }
  else
  {
    Interface.Print("i is 2");
  }

Note:
It is valid to have an if statement by itself. The if else and else statements are optional.


for
[Keywords]

Keyword for

for is a control flow loop statement. A for loop has 4 main parts and takes the form of for(A;B;C) D where:
  • A is the initializer, and is executed before the looping begins
  • B is the condition, looping will continue while B is true
  • C is the loop expression, and will be executed at the end of every loop
  • D is the body statement, and is expected every loop.
For example:

  int i = 5;
  for(; i > 0; --i)
  {
    Interface.Print(i);
  }

The above code will print 5 4 3 2 1.


goto
[Keywords]

Keyword goto

The goto statement will branch to a label statement. For example:

  int i = 5

  A: // label statement

  Interface.Print("hello");

  if(i--)
    goto A;

The above code will print hello 5 times.


null
[Keywords]

Keyword null

null is a non-initialized reference expression. Every reference that is not assigned to an object has the value null. For example:

  sting a;

  if(a == null)
  {
    Interface.Print("a is null");
  }

The above code will print a is null.


return
[Keywords]

Keyword return

return allows you to exit from a class method. For example:

  static class Foo
  {
    public int AddInts(int a, int b)
    {
      return a + b;
    }
  };

Foo.AddInts(10, 5) will return the value of 15.


switch
[Keywords]

Keyword switch

See the break example.


while
[Keywords]

Keyword while

while is a looping control flow statement and will loop while its expression is true. For example:

  int i = 5;
  while(i--)
  {
    Interface.Print(i);
  }

The above code will print 4 3 2 1 0.


and
[Keywords]

Keyword and

and is a logical and expression operator. It works according to the following rules:

  true  and true  = true
  true  and false = false
  false and true  = false
  false and false = false

For example, the following and expressions evaluate to true:

  (1 and 2)
  (true and true)
  (!0 and !false)
  ("a" and 3.4f)

and the following and expressions evaluate to false:

  (1 and 0)
  (true and false)
  ("a" and null)


or
[Keywords]

Keyword or

or is a logical or expression operator. It works according to the following rules:

  true  or true  = true
  true  or false = true
  false or true  = true
  false or false = false

For example, the following or expressions evaluate to true:

  (1 or 2)
  (true or true)
  (0 or !false)
  ("a" or 0.0)

and the following or expressions evaluate to false:

  (0 or !2)
  (!true or false)


true
[Keywords]

Keyword true

true is a constant Boolean expression. Boolean variables may only be either true or false.


false
[Keywords]

Keyword false

false is a constant Boolean expression. Boolean variables may only be either true or false.


void
[Keywords]

Keyword void

void is a null type used for methods that have no return values.


bool
[Keywords]

Keyword bool

bool is a variable type and may take the values true or false. For example:

  bool state = true;       // state = true
  bool state1 = (1 == 0);  // state1 = false


int
[Keywords]

Keyword int

int is a variable type. int variables are natural numbers and may take the values from the range of [-2147483647 - 2147483647].


float
[Keywords]

Keyword float

float is a variable type. float variables are real numbers (i.e. they have a decimal point) and may take values such as 4.32234f.


string
[Keywords]

Keyword string

string is a reference variable type. string variables have a few operators to make using strings easy. Some examples of string usage are:

  string a;  // a == null

  a = "Hello World";  // a == "Hello World"
  a = a + " Golf.";   // a == "Hello World Golf."
  a = "My " + a + " " + 400 + true;  // a = "My Hello World Golf. 400true"
  a = "apple";

  (a == "apple");  // evaluates to true

  int char = a[0];  // char = 'a'
  char = a[3];      // char = 'l'

  int len = a.size();  // len = 5

  string b = a[1,4];  // b = "ppl"
  b = a[,a.size()];   // b = "apple"
  b = a[1,];  // b = "pple"
  b = a[,3];  // b = "app"

  b = "Hello World";
  b[6,6] = "My ";  // b = "Hello My World"

Note:
The Str utility class provides some extra string functionality.


object
[Keywords]

Keyword object

object is a base class that may be used to store references to class objects.

  Foo myFoo = new Foo();
  object o = myFoo;

  o.isclass(Foo);  // evaluates to true.


class
[Keywords]

Keyword class

class is a class declarator. For example:

class Foo
{
  public int a, b = 7;
};

The above code declares a class named Foo with two public members, a and b. When a Foo object is created with new, all non-initialized members will by 0 or null. In this case, a is initialized to 0 and b is initialized to 7.


static
[Keywords]

Keyword static

static is a class specifier to denote that the class is a singleton. Static classes cannot be created using the new operator. Instead, to access a static class, scope its members or methods using the class name as follows:

  static class Foo
  {
    public int m_a = 4;
  };

  class X
  {
    void main()
    {
      Interface.Print(Foo.m_a);
    }
  }

The main() method above will print 4.


include
[Keywords]

Keyword include

include statements appear before any class declarations and include the contents of a script file. Although similar to the C include, but is not pre-processed like in C. The GS include directive simply adds all classes, members and methods to the symbol table.


public
[Keywords]

Keyword public

The public keyword is required for any class member or method that is to be accessed from outside of that class. public is a member or method specifier only.


native
[Keywords]

Keyword native

native is a method specifier that indicates the method is implemented with native code (i.e. not script code).


final
[Keywords]

Keyword final

final is a class or method specifier that stops users from isclass-ing, overriding the class or method respectively.


thread
[Keywords]

Keyword thread

thread is a method specifier. A thread is basically a path of execution through a program. A script always has a main thread and additional threads started and synchronized by the main thread. A thread consists of a stack and its blocking states.

Many threads may be running at the same time during the game. Up to 64 threads may be running on the same game object instance at a time.

Threaded methods may only be declared in classes extending the GameObject class.

  class Foo isclass GameObject
  {
    thread void PrintInts()
    {
      int a = 0;
      while(1)
      {
        Interface.Print("Thread PrintInts " + a++);
        Sleep(5);
      }
    }

    thread void PrintFloats()
    {
      float a = 0;
      while(1)
      {
        Interface.Print("Thread PrintFloats " + a++);
        Sleep(3);
      }
    }
  };

  static class Main
  {
    void main()
    {
      Foo myFoo = Router.GetGameObject("MyFoo");

      myFoo.PrintInts();    // This will start a PrintInts() thread on the myFoo object.
                            // Execution will continue here though.
      myFoo.PrintFloats();
    }
  };

The above code will produce the following output:

  Thread PrintInts 0
  Thread PrintFloats 0.0
  Thread PrintFloats 3.0
  Thread PrintInts 5
  Thread PrintFloats 6.0
  Thread PrintFloats 9.0
  Thread PrintInts 10
  Thread PrintFloats 12.0
  Thread PrintInts 15
  Thread PrintFloats 15.0


game
[Keywords]

Keyword game

game is a class specifier that indicates the class cannot be created using the new operator. Only game code may create an object of this class type.


size
[Keywords]

Keyword size

size is an operator used on strings and arrays. For example:

  int[] intArray = new int[5];

  Interface.Print(intArray.size()); // 5

Note:
The size count starts from 1, not the 0 index that is the first position in the array. The index of the last element in intArray is size() - 1, which is 4.


isclass
[Keywords]

Keyword isclass

See the object keyword example


inherited
[Keywords]

Keyword inherited

The inherited keyword provides a way of explicitly calling an overridden method in the parent class from within the overridden implementation of that method in a child class. For example:

class Parent
{
  public void Init(string arg1);
};

class Child isclass Parent
{
  public void Init(string arg1)
  {
    inherited(arg1);
  }
};

In the Child.Init() method, inherited will call the Parent.Init() method. The arguments for a function can be passed on after inherited in brackets like a normal function call.


copy
[Keywords]

Keyword copy

copy is an operator used on array types. For example:

  int[] intArray = new int[5];
  int[] anotherArray;

  anotherArray.copy(intArray);  // anotherArray will now be a duplicate of intArray.

Note:
This is not the same as saying anotherArray = intArray. Using the = operator on arrays just sets the reference, it does not duplicate the array like the copy operator does.


new
[Keywords]

Keyword new

new is an operator that may be used to create strings, arrays, arrays of strings and objects. For example:

  int[]    ia   = new int[5];     // create an array of 5 ints.
  float[]  fa   = new float[2];   // create an array of 2 floats
  string   s    = new string();   // creates a new empty string
  string[] sa   = new string[2];  // creates an array of 2 null strings
  Foo      foo  = new Foo();      // creates a new Foo object, iff Foo is not a game class
  Foo[]    fooa = new Foo[4];     // creates an array of null foo references.


me
[Keywords]

Keyword me

me is the same as the this keyword in C++. It refers to the current object. For example:

  static class Main
  {
    int a;

    void main()
    {
      me.a = 3;  // equivalent to a = 3
    }
  };


cast
[Keywords]

Keyword cast

cast is an operator used for object casting. This operator can be used for ints, floats, bools etc. The syntax is:

  cast<object> expression

Where object is the object being cast to and expression is the object being casted from. If the cast fails, null is result of the cast expression. This is a dynamic cast.


wait
[Keywords]

Keyword wait

wait is a control flow statement that blocks the current thread waiting for a message of a given type.

It is similar to a switch statement, in that it waits on multiple message types using the on statement. When a wait statement is executed, execution stops on the thread until one of the on conditions is met.

See the GameObject class for information on how to post and send messages.

  wait()
  {
    on "hello", "world" :
    {
      // code here will execute for any message "hello" "world" message
      continue;
    }
    on "hi", "there" :
    {
      // code here will execute for any message "hi" "there" message
      break;
    }
    on "hey", "" :
    {
      // code here will execute for any message with a major type of
      // "hey" this will break by default.
    }
  }


on
[Keywords]

Keyword on

See the wait keyword. The syntax for on is:

  on CONSTANT_STRING , CONSTANT_STRING : statement
  on CONSTANT_STRING , CONSTANT_STRING , object : statement

Where object may be a message reference. For example:

  Message msg;

  // execution on this thread will stop until a hello world message is
  // received.
  on "hello", "world", msg :
    Interface.Print((cast<GameObject> msg.src).GetName() + " sent the message");
    Interface.Print((cast<GameObject> msg.dst).GetName() + " got the message");


define
[Keywords]

Keyword define

define is used to declare a constant and is a member specifier. define variables must be initialized on declaration and cannot be changed in script code.

  define public int a = 7;


Identifiers
[The Language]

Identifiers

Identifiers are used for class names, function names, variable names and labels. They take the following form:

  DIGIT     [0-9]
  LETTER    [a-zA-Z_]

  IDENTIFIER {LETTER}({LETTER}|{DIGIT})*


Constants
[The Language]

Constants

Table of constant formats supported:

Type | Description
void | Only used to specify no return type for function declarations.
int | 32-bit signed integer type
float | 32-bit floating point value
bool | 32-bit Boolean, which is 0 (false) or not zero (true)
string | String reference type (a reference to a Jet PString)
object | Object, class reference type (may reference an in-game object)
int[] | integer array, reference type
float[] | float array, reference type
bool[] | Boolean array, reference type
string[] | string array, reference type
object[] | object array, reference type
public | Type specifier that may be used with any type to allow the type to be referenced from other classes.


Types
[The Language]

Types

The GS language supports the following types, all of which are 32-bit values:

Type | Format | Note
int | {DIGIT}+ | --
char | L?'(\\.|[^\\'])+' | Supports \r, \n, \t, \l, \a, \b, \\, \", \', \0
float | {DIGIT}*"."{DIGIT}+ | --
float | {DIGIT}+"."{DIGIT}* | --
string | L?\"(\\.|[^\\"])*\" | Supports \r, \n, \t, \l, \a, \b, \\, \", \', \0
int | 0[xX]{HEX}+ | Hex constant


Operators
[The Language]

Operators

The following table specifies the operators supported by the GS language. Note that the table below is in precedence order, where grouped operators (separated by blank lines) have equal precedence.

Operator | Description | Associativity | Types
() | expression grouping | left to right | --
[] | array indexing | left to right | array, string
[,] | array range indexing | left to right | array, string
. | dot (dereference) | left to right | reference
! | not | right to left | bool, reference, int, float
~ | bit inverse | right to left | int
++ | increment (pre and post) | right to left | int, float
-- | decrement (pre and post) | right to left | int, float
+ | unary plus | right to left | int, float
- | unary minus | right to left | int, float
(type) | type case | right to left | int, float, reference, bool
cast<class type> | object class cast | right to left | objects (class)
size | size | right to left | array, string
copy | copy | right to left | array, string
isclass | isclass | right to left | object
new | new | right to left | object, array, string
* | multiply | left to right | float, int
/ | divide | left to right | float, int
% | remainder | left to right | float, int
+ | addition | left to right | string (concat), float, int
- | subtract | left to right | float, int
< | shift left | left to right | int
> | shift right | left to right | int
< | less than | left to right | string, float, int, bool, reference, null
<= | less than or equal to | left to right | string, float, int, bool, reference, null
> | greater than | left to right | string, float, int, bool, reference, null
>= | greater than or equal to | left to right | string, float, int, bool, reference, null
== | equality | left to right | string, float, int, bool, reference, null
!= | not equality | left to right | string, float, int, bool, reference, null
& | bitwise and | left to right | int
^ | bitwise xor | left to right | int
| | bitwise or | left to right | int
and | logical and | left to right | all types
or | logical or | left to right | all types
= | assignment | right to left | all types
, | expression separation | left to right | --

The following sections describe in brief each of the operators. If an operation isn't examined below, then it works in GS the same way it does in C.

operator[]

Array index operator may be used on array and string types. This is a 0 based index, which means you may index from 0 to array.size() - 1.

  int[] myArray = new int[5];  // myArray is an array reference to an array of 5 ints
  int[] myNullArray;           // myNullArray hasn't been assigned to an array, it is a null reference.

  myArray[0] = 0;
  myArray[9] = 300;     // this will resize myArray to size 10
  int a = myArray[15];  // this will cause an exception, as the array has only 10 elements.

  string str = "hello";
  int c = str[1];  // c will equal 'e'

  str[2] = 'f';  // str will equal "heflo"

operator [,]

Array range index operator may be used with array and string types. The array range operator takes 2 values which are the lower and upper indexes. One of the two indexes may be empty. For example:

  array[,5] - this will index from 0 to 4
  array[3,] - this will index from 3 to (array.size() - 1)

The lower range is inclusive, the upper range is exclusive. This is to allow insertion when using the range operator as an l-value. For example:

  string a = "Hello World";
  string b = "My ";

  a[6,6] = b;  // a = "Hellow My World";

Other Operators

All arithmetic, logic and bitwise operators as per the C language.


Class Declaration
[The Language]

Class Declaration

Classes are declared using the class declaration keyword. Classes may be declared as static, in which case they may not be instantiated with the new operator, or from C code. Static classes are automatically instantiated as a singleton object when their compiled library file is required and may be referenced from any class. Here are a few class declaration examples:

static class system
{
  public int a = 7;
  public float b = 0.4;

  public native void Print(string str);
};

Declares a static class with 2 member variables 'a' and 'b'. Note that when the class is constructed, these variables will be assigned with the values 7 and 0.4 respectively. This is the only way global variables may be declared in GS. Note that to reference these variables, one would do the following:

  int i = system.a;

The system will get the global static system class, and access the variable a declared within it.

Inheritance

class Trigger
{
  public bool OnEnter(object o)
  {
  }

  public bool OnLeave(object o)
  {
  }
};

class DeathTrigger isclass Trigger
{
  public bool OnEnter(object o)
  {
    if(o.isclass(Player)
    {
      o.Die();
    }
  }
};

All class functions are virtual. GS supports multiple inheritance, but does not allow the same class type to be inherited more than once.


Function Declaration
[The Language]

Function Declaration

Functions must have a return type, even if there is no return type, void must be used. Function overloading may also be used, but, when calling a function, you must type cast parameters to the exact type for the correct function to be found as the compiler will not try to find the right function, but rather just builds a mangled name from the passed parameters to perform the search. The type specifies native and public may be used with functions. Prototypes are also allowed in the standard C format. Take the following example:

  public native object[] GetEnemiesWithin(float x, float y, float z, float radius);

Seen here is a function declaration stating that the game runtime will provide the function GetEnemiesWithin(float,float,float,float). Functions must be implemented within the class declaration.

Note:
Functions are also commonly referred to as methods.


Control Flow Statements
[The Language]

Control Flow Statements

The GS language supports 6 control flow statements, a for loop, a while, a switch statement, an if and else statement, goto statements and labels, and a new wait statement for implementing game state machines. Listed here are examples of each of the control flow statements.

  if ( expression ) statement
  if ( expression ) statement else statement
  while ( expression ) statement
  for ( assignment_expression assignment_expression expression ) statement
  for ( assignment_expression assignment_expression ) statement
  switch ( expression ) statement
  case constant_expression : statement
  default : statement
  goto identifier ;
  identifier :

The wait statement processes messages:

  Message msg;

  wait()
  {
    on "Trigger", "Enter", msg :
    {
    }
    on "Trigger", "Leave", msg :
    {
    }
  }


Grammar
[The Language]

GS Grammar

Statement | Grammar Definition
program | include_list class_declaration_list
program | class_declaration_list
include_list | include_declaration
include_list | include_list include_declaration
include_declaration | KEYWORD_INCLUDE include_file
include_file | CONSTANT_STRING
class_declaration_list | class_declaration
class_declaration_list | class_declaration_list class_declaration
class_declaration | KEYWORD_CLASS identifier "{" declaration_list "}" ";"
class_declaration | KEYWORD_CLASS identifier KEYWORD_ISCLASS class_list "{" declaration_list "}" ";"
class_declaration | declaration_specifiers KEYWORD_CLASS identifier "{" declaration_list "}" ";"
class_declaration | declaration_specifiers KEYWORD_CLASS identifier KEYWORD_ISCLASS class_list "{" declaration_list "}" ";"
class_list | identifier
class_list | class_list "," identifier
declaration_list | declaration
declaration_list | declaration_list declaration
declaration | function_declaration
declaration | function_prototype_declaration
declaration | variable_declaration_list
declaration | declaration_specifiers function_declaration
declaration | declaration_specifiers function_prototype_declaration
declaration | declaration_specifiers variable_declaration_list
declaration_specifiers | declaration_specifier
declaration_specifiers | declaration_specifiers declaration_specifier
declaration_specifier | KEYWORD_PUBLIC
declaration_specifier | KEYWORD_NATIVE
declaration_specifier | KEYWORD_FINAL
declaration_specifier | KEYWORD_THREAD
declaration_specifier | KEYWORD_STATIC
declaration_specifier | KEYWORD_GAME
function_prototype_declaration | type_specifier identifier "(" ")" ";"
function_prototype_declaration | type_specifier identifier "(" KEYWORD_VOID ")" ";"
function_prototype_declaration | type_specifier identifier "(" parameter_list ")" ";"
function_declaration | type_specifier identifier "(" ")" compound_statement
function_declaration | type_specifier identifier "(" KEYWORD_VOID ")" compound_statement
function_declaration | type_specifier identifier "(" parameter_list ")" compound_statement
variable_declaration_list | type_specifier declarator_list ";"
declarator_list | declarator
declarator_list | declarator_list "," declarator
declarator | identifier
declarator | identifier "=" constant_expression
type_specifier | primitive_type
type_specifier | primitive_type SYMBOL_OP_DIM
type_specifier | identifier
type_specifier | identifier SYMBOL_OP_DIM
primitive_type | KEYWORD_VOID
primitive_type | KEYWORD_BOOL
primitive_type | KEYWORD_INT
primitive_type | KEYWORD_FLOAT
primitive_type | KEYWORD_STRING
primitive_type | KEYWORD_OBJECT
parameter_list | parameter
parameter_list | parameter_list "," parameter
parameter | type_specifier identifier
compound_statement | "{" "}"
compound_statement | "{" statement_list "}"
statement_list | statement
statement_list | statement_list statement
statement | variable_declaration_list
statement | labeled_statement
statement | compound_statement
statement | expression_statement
statement | selection_statement
statement | iteration_statement
statement | jump_statement
labeled_statement | identifier ":" statement
labeled_statement | KEYWORD_CASE constant_expression ":" statement
labeled_statement | KEYWORD_DEFAULT ":" statement
labeled_statement | KEYWORD_ON constant "," constant ":" statement
labeled_statement | KEYWORD_ON constant "," constant "," unary_expression ":" statement
expression_statement | ";"
expression_statement | expression ";"
selection_statement | KEYWORD_IF "(" expression ")" statement
selection_statement | KEYWORD_IF "(" expression ")" statement KEYWORD_ELSE statement
selection_statement | KEYWORD_SWITCH "(" expression ")" compound_statement
selection_statement | KEYWORD_WAIT "(" ")" compound_statement
iteration_statement | KEYWORD_WHILE "(" expression ")" statement
iteration_statement | KEYWORD_FOR "(" expression_statement expression_statement ")" statement
iteration_statement | KEYWORD_FOR "(" expression_statement expression_statement expression ")" statement
jump_statement | KEYWORD_GOTO identifier ";"
jump_statement | KEYWORD_CONTINUE ";"
jump_statement | KEYWORD_BREAK ";"
jump_statement | KEYWORD_RETURN ";"
jump_statement | KEYWORD_RETURN expression ";"
constant_expression | logical_or_expression
expression | assignment_expression
expression | expression "," assignment_expression
assignment_expression | logical_or_expression
assignment_expression | unary_expression "=" assignment_expression
logical_or_expression | logical_and_expression
logical_or_expression | logical_or_expression KEYWORD_OR logical_and_expression
logical_and_expression | inclusive_or_expression
logical_and_expression | logical_and_expression KEYWORD_AND inclusive_or_expression
inclusive_or_expression | exclusive_or_expression
inclusive_or_expression | inclusive_or_expression "|" exclusive_or_expression
exclusive_or_expression | and_expression
exclusive_or_expression | exclusive_or_expression "^" and_expression
and_expression | equality_expression
and_expression | and_expression "&" equality_expression
equality_expression | relational_expression
equality_expression | equality_expression "==" relational_expression
equality_expression | equality_expression "!=" relational_expression
relational_expression | shift_expression
relational_expression | relational_expression "<" shift_expression
relational_expression | relational_expression ">" shift_expression
relational_expression | relational_expression "<=" shift_expression
relational_expression | relational_expression ">=" shift_expression
shift_expression | additive_expression
shift_expression | shift_expression "<" additive_expression
shift_expression | shift_expression ">" additive_expression
additive_expression | multiplicative_expression
additive_expression | additive_expression "+" multiplicative_expression
additive_expression | additive_expression "-" multiplicative_expression
multiplicative_expression | cast_expression
multiplicative_expression | multiplicative_expression "*" cast_expression
multiplicative_expression | multiplicative_expression "/" cast_expression
multiplicative_expression | multiplicative_expression "%" cast_expression
cast_expression | unary_expression
cast_expression | "(" primitive_type ")" cast_expression
cast_expression | "(" primitive_type SYMBOL_OP_DIM ")" cast_expression
cast_expression | KEYWORD_CAST "<" type_specifier ">" cast_expression
unary_expression | postfix_expression
unary_expression | "++" unary_expression
unary_expression | "--" unary_expression
unary_expression | unary_operator cast_expression
unary_operator | "+"
unary_operator | "-"
unary_operator | "~"
unary_operator | "!"
postfix_expression | primary_expression
postfix_expression | postfix_expression "[" "," assignment_expression "]"
postfix_expression | postfix_expression "[" assignment_expression "," "]"
postfix_expression | postfix_expression "[" assignment_expression "," assignment_expression "]"
postfix_expression | postfix_expression "[" assignment_expression "]"
postfix_expression | postfix_expression "(" ")"
postfix_expression | postfix_expression "(" argument_expression_list ")"
postfix_expression | postfix_expression "." identifier
postfix_expression | postfix_expression "++"
postfix_expression | postfix_expression "--"
postfix_expression | postfix_expression "." KEYWORD_SIZE "(" ")"
postfix_expression | postfix_expression "." KEYWORD_ISCLASS "(" identifier ")"
postfix_expression | postfix_expression "." KEYWORD_COPY "(" assignment_expression ")"
argument_expression_list | assignment_expression
argument_expression_list | argument_expression_list "," assignment_expression
primary_expression | identifier
primary_expression | KEYWORD_ME
primary_expression | KEYWORD_NULL
primary_expression | constant
primary_expression | new_expression
primary_expression | "(" expression ")"
new_expression | KEYWORD_NEW primitive_type "(" ")"
new_expression | KEYWORD_NEW primitive_type "(" argument_expression_list ")"
new_expression | KEYWORD_NEW primitive_type "[" expression "]"
new_expression | KEYWORD_NEW identifier "(" ")"
new_expression | KEYWORD_NEW identifier "(" argument_expression_list ")"
new_expression | KEYWORD_NEW identifier "[" expression "]"
identifier | IDENTIFIER
constant | CONSTANT_HEX
constant | CONSTANT_INT
constant | CONSTANT_CHAR
constant | CONSTANT_FLOAT
constant | CONSTANT_STRING
constant | KEYWORD_TRUE
constant | KEYWORD_FALSE


The Compiler
[Auran Game Script]

The Basics

The Auran GS compiler will take a game script .gs file as input and convert it to a Game Script Library .gsl file. Game script libraries may be loaded by the GS runtime environment such that classes declared within the library may be instantiated and have their threads executed. When a .gsl library is loaded, it must also load any other libraries that were required for its compilation. For example, if a script "player.gs" includes the script "system.gs", then both libraries must be present for a player class to be created.

The GS compiler creates a unique ID for each .gsl created. This unique id is the 32-bit CRC of the source file, followed by the 32-bit CRC of the script filename. This is a 64-bit unique identifier (hopefully unique) used to mark a library, such that it may be loaded by other libraries at runtime. A library stores its dependencies by a unique ID.

Compiler Switches

To view the compiler switches, simply run GS (gsc.exe in the \Trainz\bin directory) with no parameters.

  AURAN GameScript Compiler V1.00
   - gsc returns number of compile errors
   - gsc <option> <option>..
     where <option> is one of the following

  <-d> print documentation, u might wanna pipe it to a text document =)
  <-s> silent
  <-bfilename> dump the build info (compile log) to file
  <-ppathname> output path
  <-ofilename> output library filename
  <filename> input source file
  <-ipathname> additional include path
  memory level on game script compiler shutdown is 0


Using Auran GameScript
[Auran Game Script]

Using Auran GameScript

Auran Game Script (GS) is a game control scripting language. For the most part, Auran GS is similar to C/C++ or JAVA. It lacks a few of the features common to these languages but has a few other features as well. The following list is a few of the differences between Auran GS and C/C++:
  • has no pointers, but has references like Java.
  • is interpreted. GS compiles to byte code in a .gsl library.
  • uses Object Oriented language features.
  • does not support operator overloading
  • has a string class
  • does not have a character (char) type
  • has a dynamic cast in the following format: cast<Type> expr
  • does not support constructors or destructors.
  • allows assignments to members within the class declaration.
  • has threading support (thread function specifier)
  • has messages and allows threads to block on messages
Auran GS runtime libraries have a C++ game object class GSGameObject. Any object that allows scripting support within the game must derive this class. From the scripting side of things, the equivalent class is GameObject and exists in the standard GS library file gs.gs which can be found in the \Trainz\scripts directory. GameObject provides native scripting support of the following:
  • Sending and posting of game messages (IPC). Messages have a major and minor string type.
  • Adding script function handlers to message types. (AddHandler())
  • Sleeping the thread for time intervals.
Each GameObject resides in the game router (GSRouter). The standard library gs.gs also provides a static router class that allows the scripter to get a reference to a game object by unique name or by unique id.

Game objects cannot be created from the scripting using the new operator. However, if the game creates a game object, the scripting function void main(void) is started if main has the thread specifier. Thread specifiers will cause a runtime exception if they are called on an object not isclass-ing GameObject. To start a new thread on a game object, simply make the call to the threaded function. execution will continue in the current thread, and on the next update of the game object, the new thread will begin execution.

Receiving messages within a game object is done either by a message handler or by the blocking on or wait statement. wait() allows the scripter to block on multiple messages by using multiple on statements. Following is an example. It is assumed that the game will create 2 game objects and class them to Object1 and Object2. Object2 instance will be named to "GameObject2".

include "gs.gs"
include "interface.gs"

game class Object1 isclass GameObject
{
  GameObject object2 = null;

  thread void Thread1()
  {
    int i = 10;

    //
    // loop and send 10 messages
    //
    while(i--)
    {
      Sleep(.74f);
      PostMessage(object2, "Tock", "Tick", 0.);
    }
  }

  thread void main()
  {
    //
    // get the instance of an Object2 class game object created by the
    // game for this example.
    //
    object2 = Router.GetGameObject("GameObject2");

    //
    // start thread 1
    //
    Thread1();

    int i = 10;

    //
    // loop and send 10 messages
    //
    while(i--)
    {
      Sleep(1.0f);
      PostMessage(object2, "Tick", "Tock", 0.);
    }
    PostMessage(object2, "Kill", "Yourself", 0.);
  }

};

game class Object2 isclass GameObject
{
  thread void main()
  {
    Message msg;
    bool done = false;

    while(!done)
    {
      wait()
      {
        on "Tock", "Tick", msg :
        {
          Interface.Print("Tock, Tick message from class " +
                          (cast<GameObject> msg.src).GetName());
        }
        on "Tick", "Tock", msg :
        {
          Interface.Print("Tick, Tock message from class " +
                          (cast<GameObject> msg.src).GetName());
        }
        on "Kill", "Yourself", msg :
        {
          Interface.Print("Tick, Tock message from class " +
                          (cast<GameObject> msg.src).GetName());
          done = true;
        }
      }
    }
  }

};

The above example will have 2 threads running on object1 and 1 thread running on object2. Each thread on object1 will send 10 messages to object2, which will receive them and display the messages.


Scripts in Trainz
[Auran Game Script]

Scripts in Trainz

The new session-based model of activity development in TRS2004 requires a different approach to script coding. Although this new approach to coding independent asset scripts may initially very different from the single entry-point of a Scenario and possibly even more difficult to learn and master, the flexibility asset scripts provide with the session model make the move worthwhile.

What is an Asset Script?

An asset script is an independent code segment used to control the behavior of a Trainz asset. Scripts can be thought of as conductors that tell an asset such as in industry or vehicle how to behave in the Trainz game environment.

By having scripts attached to assets rather than a large chunk of script code defining a linear scenario, the scripted assets can be re-used across different sessions. Through this reuse, it is possible for a non-programmer to make use of existing scripted assets to create their own session. Putting code into a linear scenario locks that code down and makes it much less portable than asset script code.

Defining a Script
Script code is defined in a .gs source file that is to be located in the same directory as the asset the script is associated with. So Trainz knows where to find the script source, the configuration of the asset must specify the script file and the main class in that file with the script and class configuration item.

The script item defines the name of the .gs source file for the asset while class is the name of the main script class. This class must be a GameObject-derived class in the source file specified by script, however other classes can be defined in addition to the main script class in the source file.

Which class your script class inherits from depends on the type of asset you are scripting. For example, in an industry script, a class that inherits Industry would be used. Generally speaking, a script can be written for any asset that has a GameObject defined for it. As a general guide, here is a table of parent classes and the type of asset they correspond to:

Asset Type | Asset Kind | Parent Class | Alternate Parent Class
Bogey (for a vehicle) | "bogey" | Bogey | --
Cabin (loco interior) | "interior" | Cabin | DefaultLocomotiveCabin, DefaultSteamCabin
Driver character | "drivercharacter" | DriverCharacter | --
Driver command | "drivercommand" | DriverCommand | --
Industry | "industry" | Industry | BaseIndustry, GenericIndustry, GenericPassengerStation
Level crossing | "mocrossing" | Crossing | --
Library | "library" | Library | --
Rule (in a session) | "behavior" | ScenarioBehavior | ConditionalScenarioBehavior
Scenario | "activity" | Scenario | --
Signal | "mosignal" | Signal | --
Speed sign | "mospeedboard" | Trackside | --
Track mark | "trackmark" | TrackMark | --
Trigger | "trigger" | Trigger | --
Turntable | "turntable" | Turntable | --
Vehicle (rolling stock) | "traincar" | Vehicle | Locomotive

Most of these classes have specific implementation requirements the programmer needs in their own asset. Any special considerations needed like methods that need to be implemented is covered in the description for that class.

The alternate classes provide extra functionality you can use for your asset of that type. These classes are derived from the main class used for that asset type so your script class is still ultimately derived from the correct class for that asset type.

Note:
Not all asset types can have their own attached script. Only certain kinds of asset support scripts.
Rule Scripts
Rule scripts can be considered as being a special type of script because of their relationship with a session. Rules are just like any other script except that rather than being attached to a specific asset like an industry or vehicle, they are unattached independent assets in their own right.

How a rule script operates and the type of configuration data it has that is configurable through Surveyor depends on how the rule is implemented.

Library assets are also another type of asset that is mostly a scripted module.

Compiling and Debugging Scripts
In TRS2006, there is no need to compile the script source files manually as Trainz handles this automatically when started. However, the script programmer may want to compile their source file to check for errors before launching Trainz for convenience to verify their code is free of syntax errors. If an attempt to use an asset with a broken un-compilable script is made, an error message will pop-up and that asset's script functionality cannot be used until Trainz has been quit from and restarted after the script has been repaired .

To compile a .gs source file manually to see if it is compilable and error free, ensure the \Trainz\bin directory is in the current path and enter gsc -c <filename> at the command prompt when in the directory of the asset (i.e. where the script source file is located). The gsc.exe program will compile the .gs file into a .gsl byte code file. If there are any errors in the .gs file, they will be printed out along with the corresponding line numbers.

Note:
Compiler error messages can be vague and confusing, but this is a reality of software development and most compilers. It is through experience you get better at dealing with this problem.
Keep in mind that just because a script compiles, that in itself does not guarantee the script will work trouble free - there is the possibility of bugs, even if the code has no syntax errors. Looking at the log file (\Trainz\JetLog.txt) and strategic placement of output statements like Interface.Log() would be a good place to start debugging if a script is misbehaving.

Note:
DO NOT attempt to compile or play around with the Trainz .gs files located in the \Trainz\scripts directory or the .gsl files in \Trainz\libraries. You will be breaking your installation of Trainz and this is something we WILL NOT support.

Script World Model

Programming scripts for assets to be used in a session requires a different approach to coding compared to the old scenario model.

One major difference is that in a session, there is no single definitive script entry point function like there is in scenarios. Scenarios required a programmer-defined Scenario class with a main() function that was the single entry point, much like the main() function in C/C++. Having separate scripts running in the Trainz world can be initially confusion as it isn't so clear where to start out scripting.

In the Trainz Game Script environment, instances of objects representing Trainz assets like vehicles and industries are created. If a script is provided for an asset, Trainz creates an instance of the script's class. This object will now exist in the Trainz world and be able to send/receive messages and interact with other game objects.

Note:
Multiple instances of a script class can exist, which is why it is very important to understand the difference between a class and an object, which is an instance of a class.
When launching a session, Trainz calls the Init() function on all objects. It is from here that the programmer can do any initialization tasks as well as start a thread to manage the asset and give the script object a form of 'persistent existence' if needed.

Using a thread to run an object isn't always needed. Although for industries, this would generally be the case, defining a thread in a vehicle script would not be very smart as for every vehicle of a particular type that does use a script thread and is placed on the route, a thread would be created and this has the potential to create tens and even hundreds of threads. As scripting languages like GS are interpreted, there is a performance over-head. However, because call back functions are provided for various assets, script threads can be kept under control.

Above: Simplified view of game objects operating in the Trainz environment.

As shown in the diagram above, script game objects (as well as regular game objects) can operate together in the Trainz environment. This can be through messages and function calls as well as other techniques like message handler functions.

In this simplified example, all the objects communicate with each other through the Trainz router. The industry and rule objects all have threads while the vehicle's custom scripted activity is activated through call-back functions.


Mini-browser HTML Reference

Trainz Mini-browser HTML Reference

The HTML tags supported in TRS2006 by the mini-browser in alphabetical order are:

Tag | Description
<a></a> | Images/text inside this are clickable links.
<b></b> | All text between these tags will be displayed in bold.
<body></body> | Defines the main body of HTML code in the page.
<br> | Starts a new line. Useful for breaking up paragraphs or ensuring an image doesn't have text trailing it.
<font></font> | Change the appearance of enclosed text (color, type face, size etc.)
<html></html> | Defines the scope of the page. All tags in the page must be placed between a pair of </html> tags.
<i></i> | All text between these tags will be displayed in italics.
<img> | Puts the specified image in this page.
<nowrap></nowrap> | Do not perform any word-wrapping on enclosed text.
<p></p> | All text between these tags will be displayed as a paragraph.
<table></table> | Defines a table. Used in conjunction with the <td> and <tr> tags.
<td></td> | A cell in a table.
<tr></tr> | A row in a table.
<u></u> | All text between these tags will be displayed as underlined text.

Note:
As well as this selection of basic tags, there are also two special Trainz tags, <trainz-object> and <trainz-text>, which are examined at the bottom of this page.
Keep in mind that the Trainz mini-browser is a simple browser that supports a very limited set of basic HTML tags and is not a fully functional complete browser that can do everything. Fancy web browser features like JavaScript, Java, Flash etc. are not supported.

The subsequent sections below describe the features that some of the tags listed above support in further detail.

HTML Page
The <html> and <body> tags are used to define the scope of the HTML page. The actual body of the page is to be placed between the <body> and </body> tags, which are wrapped in a pair of <html> and </html> tags.

Options available to the <body> tag that allow the appearance of the page to be defined are listed in the table below:

Paramater | Value | Description
bgcolor | #RRGGBB | Background color of the page. Use a 24-bit RGB color value specified in hexadecimal digits.
text | #RRGGBB | Default color of all text in the page. Use a 24-bit RGB value.
background | filename | Filename of the image to use for the background of the page.
leftmargin | integer | Width of left margin in pixels.
rightmargin | integer | Width of top margin in pixels.
marginwidth | integer | Width of left and right margins in pixels.
marginheight | integer | Width of top and bottom margins in pixels.
topmargin | integer | Width of top and bottom margins in pixels.
scale | integer | Width of page in pixels.

An example of how a HTML page should be defined is:

<html>
  <body bgcolor="#ffffff" text="#000000" marginheight=0 leftmargin=50 rightmargin=50 background="bg.gif">
    Contents of the HTML page go here!
  </body>
</html>

Note:
There is no need for either <head> or <title> tags as they are not supported by the mini-browser.
Tables
The <table> tag is used to define a table. The rows and columns are defined by using <tr> and <td> tags within the table definition that is terminated by using the </table> close tag.

The parameters that can be used to define the properties and appearance of a table are:

Parameter | Value | Description
bgcolor | #RRGGBB | Background color of the table. Use a 24-bit RGB (red, green & blue) color value specified as a sequence of three 2-digit hexadecimal digits.
border | integer | Thickness of table border in pixels.
width | integer | Width of the table. Can either be a percentage value that defines the table width relative to the page or a pixel width.
height | integer | Height of table. Can either be a percentage value that defines the table width relative to the page or a pixel width.
cellpadding | integer | Padding to surround each table cell. Specified in pixels.
cellspacing | integer | Space to leave between all table cells. Specified in pixels.

The <tr> tag defines a row in a table. Within a <tr> tag, individual cells (which define the columns) are defined with <td> tags.

Parameter | Value | Description
height | integer | Height of row in pixels.

The <td> tag defines a cell in within a row. The amount of cells in a row defines is what makes up the columns of the table. The Trainz mini-browser supports the following options for the <td> tag:

Parameter | Value | Description
width | integer | Width of cell. Can be either in pixels or as a percentage relative to total table width.
bgcolor | #RRGGBB | Background color of the table cell. Use a 24-bit RGB color value specified in hexadecimal digits.
colspan | integer | Amount of table columns this table cell is to span.

All supported tags that deal with text, links and images can be used within a table cell. It is even possible to define an entire new sub-table within a table cell.

An example of a complete table with rows and columns using a variety of tag options is:

  <table bgcolor="#000000" border=0 cellpadding=2 cellspacing=2 width=60%>
    <tr>
      <td> <img src="icon.jpg"> </td>
      <td> <b> Table Title </b> </td>
    </tr>
    <tr>
      <td bgcolor=#f2f2ff> <i> Maximum Load: </i> </td>
      <td> 500 </td>
    </tr>
    <tr>
      <td> <i> Current Load: </i> </td>
      <td> 300 </td>
    </tr>
    <tr>
      <td colspan=2> <img src="footer.tga"> </td>
    </tr>
  </table>

Font
The <font> tag is used to change the appearance of the text contained in it before the </font> closing tag. Options supported that allow text to be changed are:

Parameter | Value | Description
color | #RRGGBB | Color of the font. Use a 24-bit RGB color value specified in hexadecimal digits.
size | integer | Point size of font.
face | typeface name | Trainz supports any installed True Type font, however installed fonts available vary across different versions of Windows, so either stick to something safe like "arial" or do your homework and make sure the font you use is installed across Windows 98, Windows 2000 and Windows XP.

For example:

  <font color="#ff0000" size=4 face="arial">
    This text will be displayed in red at a point size of 4 in the arial typeface. <br>
    <b> Same font format, but in bold now! </b>
  </font>

Links
The <a> tag allows text and images to be clickable links that can be processed by script code. The way Trainz handles URLs in links is different from that of normal HTML and is closely to how messages in script code work. The options that define a Trainz link are:

Parameter | Value | Description
href | URL string | URL the link refers to. %Trainz URLs are different - see description below.
tooltip | string name | Text to display when cursor is hovering above the link.

The URL string must be in the form of "live://<link name>" where <link name> is the name of link. Dealing with user clicks on links is an issue for script programmers. For further details on how URLs are processed, see the Browser class.

Images
To display a graphical bitmapped image, the <img> tag is used. Formats supported include .jpg, .bmp and .tga. Use of an alpha channel is only supported with 32-bit .tga files. An image can be clickable and encapsulated in a <a href="URL..."> link. To specify what to use for the image and how to display it, the following options are supported:

Parameter | Value | Description
src | string | Localized filename of the image to display.
kuid | KUID string | KUID of the asset to display the icon of.
width | integer | Width in pixels to display the image in.
height | integer | Height in pixels to display the image in.
mouseover | string | Filename of image to display when the mouse cursor is above the image.

When using the src parameter to specify the image file to use, do not use a full path. Use a localized file name instead. Trainz will use the asset passed into either LoadHTMLString() or LoadHTMLFile() to determine where to find the image file. A quick example that uses the mouseover option is:

<a href="live://setbutton">
  <img src="button.jpg" mouseover="button-hilite.jpg" width=250 height=100>
</a>

As an alternative to img, the kuid option is provided. It allows the icon associated with the asset of the specified KUID to be displayed. This parameter must be specified in the KUID string format. For example, the following HTML code will display the icon for the coal product (which is a 64x64 .tga file specified in the coal product's configuration.

  <img kuid="KUID:44179:60013" width=64 height=64><br>

Trainz relies on the KUID being valid as well as the corresponding asset having an icon associated with it to be able to display an image when this option is used. The kuid parameter is obviously not standard HTML and is for use in TRS2006 only.

Special Trainz Tags

In addition to the basic HTML tags supported, TRS2006 also has two special tags of its own, <trainz-object> and <trainz-text>. They allow basic dynamic content to be used in a HTML page such that the page doesn't need to be reloaded to have content updated.

Trainz Object Items
The <trainz-object> tag allows special objects the user can interact with to be placed in a HTML page. Such objects include a graphical dial or a text-entry box. Options this tag supports are:

Parameter | Value | Description
style | string | Type of graphical control. Use dial or text-line.
width | integer | Pixel width of area to display object in.
height | integer | Pixel height of area to display object in.
id | string | Name of this object in the browser.
texture | filename | Filename of texture for the object.
min | float | Maximum value of control.
max | float | Minimum value of control.
valmin | float | Maximum possible value the object can be.
valmax | float | Maximum possible value the object can be.
step | integer | Steps in this element control.
clickstep | integer | Amount of steps per click
value | float | Default value the object is to be in.

For example, the dial in DCC mode for Driver is defined as:

  <a href="live://dial/dcc" tooltip="Speed control">
    <trainz-object style=dial
                   width=100
                   height=100
                   id="dcc"
                   texture="newdriver/dcc/dcc_controller.tga"
                   min=0.1
                   max=0.9
                   valmin=-1.0
                   valmax=1.0
                   step=0
                   clickstep=1
                   value=0.5></trainz-object>
  </a>

The above HTML code means that whenever the dial is clicked on, a URL message is sent for a scriptlet to process. The dial will move as well and when the script receives the URL message, it will then be able to read the value of the control and use that to set the throttle of the train.

The GetElementProperty() and SetElementProperty() methods in the Browser class allow the properties of a Trainz object item to be read and set.

Trainz Text Items
The <trainz-text> tag is used for updateable text in a HTML page that can be altered without needing to reload a new altered page. Options used by this tag are:

Parameter | Value | Description
id | string | Name this Trainz text item is identified by.
text | string | Default text displayed by the Trainz text item.

The text options specifies the default text that is displayed for the text item when the page is initially created. Once the page is loaded, a script can call Browser.SetTrainzText() and change, thus allowing dynamic text in a page that can be changed easily and efficiently by scriptlet code.

An example of a Trainz text item is the speed indicator in Driver which is defined as:

  <trainz-text id="speed" text="0 kph"></trainz-text>

For further details on Trainz text items, see the Browser.SetTrainzText() method description.

See also:
Browser, PropertyObject.GetDescriptionHTML()


Class API Reference

Class API Reference

This is the class API reference section. You can view either browse the classes in alphabetical order in the Class API Reference section or alternatively, the classes can be browsed by hierarchy (inheritance) in the Class Hierarchy section. The Compound Members section allows for all class members to be viewed in alphabetical order.

API Sections

  • Class API Reference
  • Class Hierarchy
  • Compound Members
See also:
Asset Source, Auran Game Script


Class API Reference
[Class API Reference]

Class API Reference

All of the classes that make up the Trainz API listed in alphabetical order are:

  • AiHornMsg
  • AITrainScope
  • Asset
  • AssetCheckListHandler
  • BaseIndustry
  • BaseIndustryInfo
  • BasePortal
  • Bogey
  • Browser
  • BrowserInterface
  • Buildable
  • Cabin
  • CabinControl
  • CabinControlSetting
  • CabinData
  • CheckBoxHandler
  • CheckListGroupHandler
  • CheckListPropertyHandler
  • Command
  • ConditionalScenarioBehavior
  • ConfigAssetGroupHandler
  • ConfigAssetHandler
  • ConsistHelperInfo
  • ConsistListHelper
  • Constructors
  • ControlSettingsManager
  • Crossing
  • CustomCommand
  • DefaultLocomotiveCabin
  • DefaultSteamCabin
  • DefaultSteamCabinData
  • DriverCharacter
  • DriverCommand
  • DriverCommands
  • DriverScheduleCommand
  • DriversInfo
  • EnumeratedAssetHandler
  • EnumeratedGameObjectHandler
  • EnumeratedMultiPropertyHandler
  • EnumeratedPropertyHandler
  • Flags
  • GameObject
  • GenericBoolHandler
  • GenericIndustry
  • GenericIntNumberHandler
  • GenericListHandler
  • GenericPassengerStation
  • GenericStringHandler
  • GSObject
  • GSTrackSearch
  • HTMLPropertyGroup
  • HTMLPropertyHandler
  • HTMLWindow
  • Industry
  • IndustryProcessInfo
  • IndustryProductInfo
  • IndustryProductInfoCollection
  • IndustryProductInfoComplete
  • IndustryProductInfoProcess
  • IndustryProductInfoQueues
  • IndustryProductInfoTracks
  • IndustryTrainController
  • Interface
  • InterfaceAlert
  • InterfaceObjective
  • IPICProcess
  • IPICQueue
  • IPICTrack
  • ITCTrainCommand
  • Junction
  • JunctionBase
  • JunctionBaseGameObject
  • JunctionPermitInfo
  • KUID
  • KUIDList
  • Library
  • LinkedData
  • LinkedList
  • LoadHelperInfo
  • LoadingReport
  • Locomotive
  • Log
  • LogScope
  • MapObject
  • Math
  • Menu
  • MeshObject
  • Message
  • ModuleScript
  • Navigate
  • NumberValueInt
  • OnlineAccess
  • OnlineGroup
  • PassengerStationInfo
  • Permit
  • ProductFilter
  • ProductQueue
  • PropertyBrowser
  • PropertyObject
  • PropertyValue
  • RadioButtonGroupHandler
  • RadioButtonListHandler
  • Requirement
  • ResourceRequirement
  • Router
  • Scenario
  • ScenarioBehavior
  • ScenarioStringTable
  • ScenarioSupport
  • SceneryWithTrack
  • Schedule
  • ScheduleHistoryRec
  • ShuntTrack
  • Signal
  • SignalBehaviour
  • Soup
  • SpecificVehiclesInfo
  • StationBehaviour
  • Str
  • StringTable
  • Timetable
  • TimetableState
  • Track
  • TrackLoadInfo
  • TrackMark
  • Trackside
  • Train
  • TrainHelperInfo
  • TrainTimetable
  • TrainTimetableItem
  • TrainUtil
  • Trainz
  • TrainzGameObject
  • Trigger
  • Turntable
  • Vehicle
  • VehicleDescriptor
  • VehicleTypesInfo
  • VHIDriversInfo
  • VHISpecificVehiclesInfo
  • VHIVehicleTypesInfo
  • World
  • World1
See also:
Class Hierarchy


AiHornMsg Class Reference

Inheritance diagram for AiHornMsg:

CustomCommand List of all members.

Public Methods

bool Execute (Train train, int px, int py, int pz)
Method called by the scheduler.

Detailed Description

Custom schedule command that sends a message to a train to blast its horn.

See also:
Command, CustomCommand, Schedule

The documentation for this class was generated from the following file:
  • common.gs


AITrainScope Class Reference

List of all members.

Detailed Description

This class is used privately and internally by Train and is not a Trainz API class intended for general use.

WARNING: THIS CLASS IS NOT TO BE USED OR RELIED ON.

The documentation for this class was generated from the following file:
  • train.gs


Asset Class Reference

Inheritance diagram for Asset:

GSObject List of all members.

Public Methods

public native KUID | GetKUID (void)
public native string | GetLocalisedName (void)
public native KUID | LookupKUIDTable (string kuidTableAssetName)
public native StringTable | GetStringTable (void)
public native Soup | GetConfigSoup (void)
public native Asset | FindAsset (string kuidTableAssetName)
public string | GetName (void)
Obsolete, use GetLocalisedName() instead.

public native KUIDList | GetDependencyList (void)

Detailed Description

An asset interface class.

Assets have a KUID, name, configuration data and string table. Various interface methods are provided to allow access to basic asset information.

See also:
KUID, KUIDList, TrainzGameObject.GetAsset(), ProductFilter, ProductQueue, StringTable

Member Function Documentation

public native Asset Asset.FindAsset ( string kuidTableAssetName )

Finds an asset by its name in the kuid-table container section of this asset's configuration.

Note:
This method performs the equivalent of World.FindAsset(Asset.LookupKUIDTable(name)).
Parameters:
kuidTableAssetName Name of the asset to get a handle to as defined in the kuid-table of this asset.
Returns :
Returns the asset of named by kuidTableAssetName if possible, null otherwise.

public native Soup Asset.GetConfigSoup ( void )

Gets the soup configuration database of this asset.

Returns :
Returns the Soup object that defines the configuration data for this asset.

public native KUIDList Asset.GetDependencyList ( void )

Get a list of the known dependencies for this asset.

This method partially relies on the information in the asset's kuid-table (located in the it configuration via CCP)). If this information is not correct, then the list returned by this function won't be correct.

Returns :
Returns a list containing the KUIDs from the kuid-table section of this asset's configuration.

public native KUID Asset.GetKUID ( void )

Gets the KUID of this asset.

Returns :
Returns the KUID of this asset.

public native string Asset.GetLocalisedName ( void )

Gets the human-readable name of this asset.

Returns :
Returns the name of this asset that is user-friendly and readable.

public native StringTable Asset.GetStringTable ( void )

Gets the string table of this asset.

An asset can have a StringTable in its configuration that consists of a collection of named string elements. The returned StringTable object provides methods to easily access these strings.

Returns :
Returns the StringTable of this asset.

public native KUID Asset.LookupKUIDTable ( string kuidTableAssetName )

Gets the KUID of the named item in this asset's kuid-table.

In the configuration of an asset, there might be a kuid-table container section that defines convenient names to correspond to the KUIDs of other assets.

For example, tag in an asset's kuid-table could be defined as having the name "coal" and a KUID of <KUID:44179:60013>, which is the KUID for the coal product type. This means you can now use "coal" for the kuidTableAssetName parameter in this method and it will return the associated KUID.

Note that this method will only succeed if the asset this object refers to has a matching entry in its kuid-table and won't work on other assets that don't have that entry.

Parameters:
kuidTableAssetName Name of the item in the kuid-table of this Asset to get the KUID of.
Returns :
Returns the named KUID from this asset's kuid-table if successful, null otherwise.

The documentation for this class was generated from the following file:
  • asset.gs


AssetCheckListHandler Class Reference

Inheritance diagram for AssetCheckListHandler:

ConfigAssetHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public int | GetAssetIndex (Asset asset)
public void | Init (Asset asset, string newConfigPrefix)
public string | GetAssetType (void)
public Asset | GetSettingAsset (int index)
public Asset[] | GetSettingAssets (bool checked)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Detailed Description

A config asset handler that provides a list of selectable checkboxes for all assets of a particular type.

This handler is similar to CheckListPropertyHandler as it manages a collection of bool properties via a checklist interface, but this class is specifically made to provide a list of assets with checkboxes. This provides us with a handler that allows the selection of certain assets of a particular type.

As this config handler builds up the checkbox items list automatically, the string table requirements are very minimal and simple:

String Name | Description
"<config-prefix>-asset-type" | Type of asset to populate the list with assets from. Must be an asset type that World.GetAssetList() recognizes. Some common types are "behavior" (rules), "drivercommand", "html-asset", "industry", "product", "product-category", "scenery" and "traincar" (vehicle). See the Content Creators Guide (CCG) for a more complete list of the asset types Trainz supports.
"<config-prefix>-display-name" | Optional display text to be shown before the list.
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

The only essential string table requirement for this config handler is the "<config-prefix>-asset-type" string so the handler knows what type of asset to compile a list of types from. If a valid type is not provided in this string table item, this handler WILL NOT work.

Note:
Different Trainz installations have different assets installed. When this handler saves its properties, it saves the state of each checkbox and the KUID of the asset represents. When loading properties the existence of the loaded KUID is checked and if it doesn't exist, that asset will be ignored when re-initializing the handler.
The Enable/Disable Driver Commands rule makes use of this class to select driver command assets. Its string table settings for this handler with a config prefix of "driver-cmd-list" are:

String Name | Contents
"driver-cmd-list-asset-type" | "drivercommand"
"driver-cmd-list-display-name" | ""
"driver-cmd-list-html-prefix" | "<tr><td width=4></td><td><font color=#000000>"
"driver-cmd-list-html-sufix" | "</font></td></tr></table>"

See also:
ConfigAssetHandler, CheckBoxHandler, RadioButtonListHandler, CheckListPropertyHandler, CheckListGroupHandler, EnumeratedAssetHandler, GenericBoolHandler, GenericStringHandler

Member Function Documentation

public int AssetCheckListHandler.GetAssetIndex ( Asset asset )

Gets the property index number to the given asset.

This method allows the index to the bool property of the given asset to be obtained.

Parameters:
asset Asset to get the index of in this handler.
Returns :
If asset is present in this property handler, the index to it is returned. Otherwise null is returned if asset is invalid or is of a different type then this handler is configured for.

public string AssetCheckListHandler.GetAssetType ( void ) [inline]

Gets the type of asset this handler has been setup to work with.

This method returns the type string read from the "<config-prefix>-asset-type" string table entry during initialization. It does not verify that the type string is a valid type or anything else, just returns it.

Returns :
Returns the type of assets this config handler has been setup to work with. If this handler is being used correctly, the returned string will be one of the Asset kind elements that Trainz supports.

public string AssetCheckListHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from ConfigAssetHandler.

public Soup AssetCheckListHandler.GetProperties ( ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from ConfigAssetHandler.

public string AssetCheckListHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public Asset AssetCheckListHandler.GetSettingAsset ( int index ) [inline]

Gets the asset in this handler from the given index.

Parameters:
index Item number of Asset to get the value of.
Note:
The indexing of assets may vary across different installations, so always check the returned asset.
Returns :
Returns the asset specified by index if it exists, false otherwise.

public Asset [] AssetCheckListHandler.GetSettingAssets ( bool checked ) [inline]

Gets all of the assets that are checked (or unchecked) in this handler.

Parameters:
checked State of the checkbox bool property required for an asset to be included.
Returns :
Returns an array of assets that have their checkboxes bool property set to the state specified by checked.

public void AssetCheckListHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

public void AssetCheckListHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

public void AssetCheckListHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from ConfigAssetHandler.

public void AssetCheckListHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


BaseIndustry Class Reference

Inheritance diagram for BaseIndustry:

Industry GenericPassengerStation List of all members.

Public Methods

public string[] | GetProductNameList (ProductQueue queue)
thread void | ViewDetails (void)
void | PerformStoppedLoad (Vehicle vehicle, string triggerName)
void | PerformMovingLoad (Vehicle vehicle, string triggerName)
bool | PerformMassStoppedLoad (Vehicle vehicle, string triggerName)
bool | TriggerSupportsStoppedLoad (Vehicle vehicle, string triggerName)
bool | TriggerSupportsMovingLoad (Vehicle vehicle, string triggerName)
bool | TriggerSupportsMassMovingLoad (Vehicle vehicle, string triggerName)
bool | TriggerSupportsMassStoppedLoad (Vehicle vehicle, string triggerName)
thread void | ThreadPerformStoppedLoad (Vehicle vehicle, string triggerName)
thread void | ThreadPerformMovingLoad (Vehicle vehicle, string triggerName)
thread void | ThreadPerformMassStoppedLoad (Vehicle vehicle, string triggerName)
thread void | PerformInnerEnterMoving (Vehicle vehicle, string triggerName)
void | PerformInnerEnterStop (Vehicle vehicle)
thread void | PerformStopped (Vehicle vehicle, string triggerName)
thread void | PerformMassStopped (Vehicle vehicle, string triggerName)
void | PerformStoppedNoTrigger (Vehicle vehicle)
thread void | BaseIndustryMain (void)
bool | HandleTrainLoadCommand (Train train)
bool | HandleTrainUnloadCommand (Train train)
public bool | HandleTrain (Train train, string loadCommand)
public void | Init (void)
public void | SetQueueInitialCount (ProductQueue queue, Asset asset, int newValue)
public void | AddAssetToIndustryProductInfo (Asset asset, string queueName, string processName, bool isInput, bool showInViewDetails, bool showInSurveyorProperties)
public void | AddAssetToIndustryProductInfo (string assetName, string queueName, string processName, bool isInput, bool showInViewDetails, bool showInSurveyorProperties)
public void | AddAssetToIndustryProductInfo (Asset asset, string queueName, string processName, bool isInput, bool showInViewDetails)
public void | AddAssetToIndustryProductInfo (string assetName, string queueName, string processName, bool isInput, bool showInViewDetails)
public void | AddAssetToIndustryProductInfo (string assetName, string queueName, string processName, bool isInput)
public void | AddAssetToIndustryProductInfo (Asset asset, string queueName, string processName, bool isInput)
public void | AppendProductList (Asset[] productList)
thread void | ThreadEndPipeAnimation (Vehicle vehicle)
public float | BeginUnload (LoadingReport report)
public float | GetUnloadTime (LoadingReport report)
public float | EndUnload (LoadingReport report)
public float | BeginLoad (LoadingReport report)
public float | GetLoadTime (LoadingReport report)
public float | EndLoad (LoadingReport report)
public void | NotifyProcessFinished (string processName)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)

Public Attributes

IndustryTrainController itc
Lists vehicles/trains that are currently under loading/unloading commands.

Browser info
Browser for displaying ViewDetails() request.

public float | m_trainLoadingSpeed = 3.0f
Speed for product loading/unloading when a train is under control of the industry train controller.

public IndustryProductInfoCollection | industryProductInfoCollection = new IndustryProductInfoCollection()
Information object that allows tracking of industry products and their associated assets, queues and tracks etc.

string | pipeName
Name of the pipe animation to use when loading/unloading liquid products.

bool | usePipeAnimation
Indicates if this industry does use the pipe animation. If so, extra time is allowed for loading/unloading.

Detailed Description

A generic industry base class.

This class provides generic industry functionality that script programmers can re-use and extend so they can have their industries up and running quickly. This class can't run a custom user-created industry on its own - it needs various methods implemented. However, what this class does provide is a framework that does handle the more complex parts of an industry like trigger message programming.

Examples of this class being used can be seen in the script source of the following industries:

  • Coal Mine
  • Container Station
  • Forestry
  • Hyde Pulp Mill
  • Lumber Mill
  • Multiple Industry
  • Multiple Industry New
  • Oil Field
  • Oil Refinery
  • Power Station
  • Steam Filling Station
See also:
BaseIndustryInfo, IndustryProductInfoCollection, IndustryProductInfoComplete, IndustryProcessInfo, IndustryProductInfo, IndustryTrainController, GenericIndustry

Member Function Documentation

public void BaseIndustry.AddAssetToIndustryProductInfo | ( | Asset | asset,
 |  | string | queueName,
 |  | string | processName,
 |  | bool | isInput
 | ) | [inline]

Allows a product to be added as being valid input/output for the named process.

Parameters:
asset | Product asset to add to the process.
queueName | Name of queue in this industry that the process is to use for the input/output of the product.
processName | Name of the industry process that is to produce/consume the product.
isInput | Specifies if queueName is an input queue (true) or output queue (false) when used by the process.

public void BaseIndustry.AddAssetToIndustryProductInfo | ( | string | assetName,
 |  | string | queueName,
 |  | string | processName,
 |  | bool | isInput
 | ) | [inline]

Allows a product to be added as being valid input/output for the named process.

Parameters:
assetName | Name of product asset to add to the process.
queueName | Name of queue in this industry that the process is to use for the input/output of the product.
processName | Name of the industry process that is to produce/consume the product.
isInput | Specifies if queueName is an input queue (true) or output queue (false) when used by the process.

public void BaseIndustry.AddAssetToIndustryProductInfo | ( | string | assetName,
 |  | string | queueName,
 |  | string | processName,
 |  | bool | isInput,
 |  | bool | showInViewDetails
 | ) | [inline]

Allows a product to be added as being valid input/output for the named process.

Parameters:
assetName | Name of product asset to add to the process.
queueName | Name of queue in this industry that the process is to use for the input/output of the product.
processName | Name of the industry process that is to produce/consume the product.
isInput | Specifies if queueName is an input queue (true) or output queue (false) when used by the process.
showInViewDetails | Specifies if details of this product capability should be displayed in the browser window when the user requests details of the industry.

public void BaseIndustry.AddAssetToIndustryProductInfo | ( | Asset | asset,
 |  | string | queueName,
 |  | string | processName,
 |  | bool | isInput,
 |  | bool | showInViewDetails
 | ) | [inline]

Allows a product to be added as being valid input/output for the named process.

Parameters:
asset | Product asset to add to the process.
queueName | Name of queue in this industry that the process is to use for the input/output of the product.
processName | Name of the industry process that is to produce/consume the product.
isInput | Specifies if queueName is an input queue (true) or output queue (false) when used by the process.
showInViewDetails | Specifies if details of this product capability should be displayed in the browser window when the user requests details of the industry.

public void BaseIndustry.AddAssetToIndustryProductInfo | ( | string | assetName,
 |  | string | queueName,
 |  | string | processName,
 |  | bool | isInput,
 |  | bool | showInViewDetails,
 |  | bool | showInSurveyorProperties
 | ) | [inline]

Allows a product to be added as being valid input/output for the named process.

Parameters:
assetName | Name of product asset to add to the process.
queueName | Name of queue in this industry that the process is to use for the input/output of the product.
processName | Name of the industry process that is to produce/consume the product.
isInput | Specifies if queueName is an input queue (true) or output queue (false) when used by the process.
showInViewDetails | Specifies if details of this product capability should be displayed in the browser window when the user requests details of the industry.
showInSurveyorProperties | Specifies if details of this product capability should be displayed in the properties window of this industry.

public void BaseIndustry.AddAssetToIndustryProductInfo | ( | Asset | asset,
 |  | string | queueName,
 |  | string | processName,
 |  | bool | isInput,
 |  | bool | showInViewDetails,
 |  | bool | showInSurveyorProperties
 | ) | [inline]

Allows a product to be added as being valid input/output for the named process.

Parameters:
asset | Product asset to add to the process.
queueName | Name of queue in this industry that the process is to use for the input/output of the product.
processName | Name of the industry process that is to produce/consume the product.
isInput | Specifies if queueName is an input queue (true) or output queue (false) when used by the process.
showInViewDetails | Specifies if details of this product capability should be displayed in the browser window when the user requests details of the industry.
showInSurveyorProperties | Specifies if details of this product capability should be displayed in the properties window of this industry.

public void BaseIndustry.AppendProductList ( Asset productList[] ) [inline]

Adds any products that this industry is currently capable of consuming/producing to the end of the given list.

This methods appends all of the products that this industry allows into productList that are not already in the productList.

Parameters:
productList List of products to append the products of this industry to.

Reimplemented from Industry.

thread void BaseIndustry.BaseIndustryMain ( void ) [inline]

Generic main industry operating thread.

This thread is started by the Init() method when the industry game object is created to manage the industry. It can be thought of as the conductor that makes the industry run. Once started, it cycles through a wait statement indefinitely waiting for messages to process and act on.

Messages processed by this thread are:

Major | Minor
"GenericIndustry" | "LoadComplete"
"GenericIndustry" | "ProcessComplete"
"Object" | "Stopped"
"Object" | "Leave"
"Object" | "InnerEnter"
"MapObject" | "View-Details"
"Browser-Closed" | ""

Depending on what message is received, this method will call methods within this class to handle the required task.

public float BaseIndustry.BeginLoad ( LoadingReport report ) [inline]

Called by Vehicle.LoadProduct() before the loading takes place.

This method overrides Industry.BeginLoad() so that the pipe animation is taken care if needed and extra time is returned to allow for it. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of unloading operation.
Returns :
Returns 30.0 to allow for the pipe animation to start if needed, 0.0 otherwise.

Reimplemented from Industry.

public float BaseIndustry.BeginUnload ( LoadingReport report ) [inline]

Called by Vehicle.UnloadProduct() before the unloading takes place.

This method overrides Industry.BeginLoad() so that the pipe animation is taken care if needed and extra time is returned to allow for it. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of unloading operation.
Returns :
Returns 30.0 to allow for the pipe animation to start if needed, 0.0 otherwise.

Reimplemented from Industry.

public float BaseIndustry.EndLoad ( LoadingReport report ) [inline]

Ends the pipe animation if needed.

This method is overrides Industry.EndLoad() to ensure that ThreadEndPipeAnimation() is called at the end of an unloading operation as well as returning the appropriate amount of time to for the animation. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of unloading operation.
Returns :
Returns 4.5 to allow for the pipe animation to end if needed, 0.0 otherwise.

Reimplemented from Industry.

public float BaseIndustry.EndUnload ( LoadingReport report ) [inline]

Ends the pipe animation if needed.

This method is overrides Industry.EndUnload() to ensure that ThreadEndPipeAnimation() is called at the end of an unloading operation as well as returning the appropriate amount of time to allow for the animation. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of unloading operation.
Returns :
Returns 4.0 to allow for the pipe animation to end if needed, 0.0 otherwise.

Reimplemented from Industry.

public float BaseIndustry.GetLoadTime ( LoadingReport report ) [inline]

Called by Vehicle.LoadProduct() to determine how long the loading operation is to take.

This method is overrides Industry.GetLoadTime() to ensure that the appropriate amount of time is returned if the pipe animation is being used for loading. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of loading operation.
Returns :
Returns 2.0 to allow for the pipe loading if needed, 0.0 otherwise.

Reimplemented from Industry.

public string [] BaseIndustry.GetProductNameList ( ProductQueue queue )

Gets the names of the products that the given queue in this industry can contain.

Parameters:
queue Queue to get the products names for.
Returns :
Returns an array of strings containing the asset names of the products that queue is able to contain.

public Soup BaseIndustry.GetProperties ( void ) [inline]

Instructs this PropertyObject to put all of its current properties into a database to be returned.

This method is used to save the properties of a PropertyObject into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

When overriding this method to handle your own properties, always call through to the overridden parent by using inherited like this:

     public Soup GetProperties(void)
     {
       // start out with parent class properties
       Soup retSoup = inherited();

       // add your own properties to retSoup here...

       // return the complete properties database
       return retSoup;
     }

In the PropertyObject implementation, if a property handler is attached to this object and it has been set to have its properties saved, that handler's GetProperties() method will be called.

Note:
It is possible that in future versions of Trainz, parent methods like this one may have their implementation modified. By not calling through to the overridden parent, you risk your assets NOT WORKING in a future version of Trainz.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
HTMLPropertyHandler.GetProperties(), HTMLPropertyHandler.GetSavesProperties()

Reimplemented from PropertyObject.

public float BaseIndustry.GetUnloadTime ( LoadingReport report ) [inline]

Called by Vehicle.UnloadProduct() to determine how long the unloading operation is to take.

This method is overrides Industry.GetUnloadTime() to ensure that the appropriate amount of time is returned if the pipe animation is being used for loading. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of loading operation.
Returns :
Returns 2.0 to allow for the pipe loading if needed, 0.0 otherwise.

Reimplemented from Industry.

public bool BaseIndustry.HandleTrain | ( | Train | train,
 |  | string | loadCommand
 | ) | [inline]

Called by the Load and astSrcDriveCmdLoad Unload driver commands to initiate loading/unloading of a train.

This is an implementation of Industry.HandleTrain() that allows for both generic loading and unloading operations to be performed. It will call and return the results of either HandleTrainLoadCommand() or HandleTrainUnloadCommand(), depending on what loadCommand is set to.

Parameters:
train | Train to control and perform the command on. Must be in an industry trigger.
loadCommand | String indicating what type of driver command that is calling this method. See Load and Unload Driver Command Strings for details.
Returns :
Returns true if the train is in a trigger and the command was performed successfully, false otherwise.
See also:
Industry.HandleTrain(), Buildable.IsTrainInTriggers(), Load and Unload Driver Command Strings

Reimplemented from Industry.

bool BaseIndustry.HandleTrainLoadCommand ( Train train ) [inline]

Called by HandleTrain() to drive a train that is not under user control through the industry to be loaded.

This method ensures the train is driven through the industry when not under user control so it can be loaded. Actual loading is handled by BaseIndustryMain() as it detects vehicles on triggers.

Parameters:
train Train to control and drive through the industry to unload.
Returns :
Always returns true.

bool BaseIndustry.HandleTrainUnloadCommand ( Train train ) [inline]

Called by HandleTrain() to drive a train not under user control through the industry to be unloaded.

This method ensures the train is driven through the industry when not under user control so it can be unloaded. Actual loading is handled by BaseIndustryMain() as it detects vehicles on triggers.

Parameters:
train Train to control and drive through the industry to unload.
Returns :
Always returns true.

public void BaseIndustry.Init ( void ) [inline]

Initialization method that launches the main industry thread.

If provided, Trainz calls the Init() method when it creates the game object. Usually the script programmer would define an Init() method themselves to handle the initialization of data members and possibly even start a thread to manage the object.

The implementation in this class initializes the itc object and then starts the BaseIndustryMain() thread is started. This thread will handle the messaging required to 'run' an industry.

Reimplemented from MeshObject.

public void BaseIndustry.NotifyProcessFinished ( string processName ) [inline]

Called by Trainz once when a process is ready to stop running.

This method is overridden from Industry.NotifyProcessFinished() so that a message of type ("GenericIndustry", "ProcessComplete") is sent from this object to itself whenever a process finishes.

Parameters:
processName Name of process that has stopped.

Reimplemented from Industry.

thread void BaseIndustry.PerformInnerEnterMoving | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Perform a load/unload operation on a moving vehicle.

This method is called by BaseIndustryMain() to load/unload a moving vehicle that has entered an industry trigger. If this industry supports mass loading/unloading when moving, ThreadPerformMovingLoad() will be called to handle all the vehicles in a mass load/unload operation. Otherwise PerformMovingLoad() will be called just to process vehicle.

If the train that vehicle is in is under a script control, a message of type ("HandleTrain", "Release") is sent to the train once the loading/unloading has been completed.

Parameters:
vehicle | Vehicle that has entered the trigger,
triggerName | Name of the trigger being entered.

void BaseIndustry.PerformInnerEnterStop ( Vehicle vehicle ) [inline]

Stops a moving train so a vehicle can be loaded/unloaded.

This method is called by BaseIndustryMain() when a vehicle has entered a trigger but the trigger doesn't support loading/unloading while moving yet it supports loading/unloading while stopped and the vehicle is not under user control. It stops the train vehicle is attached to and as a result, BaseIndustryMain() will detect the vehicle stopping on the on the trigger and react appropriately.

Parameters:
vehicle Vehicle to stop the train of if needed.

thread void BaseIndustry.PerformMassStopped | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Attempts to perform a mass load/unload on the entire stopped train.

If this industry supports mass stopped loading/unloading as reported TriggerSupportsStoppedLoad() when called from BaseIndustryMain(), this method is called to handle the entire mass stopped load/unload. Not only will vehicle be loaded/unloaded, but also the entire train. The ThreadPerformMassStoppedLoad() method will be called to handle this.

Parameters:
vehicle | Vehicle that has entered the trigger,
triggerName | Name of the scenery trigger being entered.

bool BaseIndustry.PerformMassStoppedLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) |

Called by ThreadPerformMassStoppedLoad() to perform a stopped load/unload across an entire train.

This method iterates through all of the vehicles in the train that vehicle belongs to and calls ThreadPerformStoppedLoad() on each one such that an attempt to load/unload the entire train in one go is attempted.

Parameters:
vehicle | Vehicle in the train to perform a mass stopped load/unload on.
triggerName | Name of the scenery trigger where loading is to take place.
Returns :
Always returns true.
See also:
Vehicle.GetMyTrain(), Train.GetVehicles()

Reimplemented in GenericPassengerStation.

void BaseIndustry.PerformMovingLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Called by either PerformStopped() or ThreadPerformMovingLoad() to load/unload a vehicle while it is moving.

This method has an empty implementation and must be implemented by the script programmer if they want their industry to load/unload a moving vehicle. No user implementation is needed if the industry concerned doesn't support the loading/unloading of moving vehicles.

Parameters:
vehicle | Vehicle to load while moving over triggerName.
triggerName | Name of the scenery trigger where loading is to take place.

thread void BaseIndustry.PerformStopped | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Perform a load/unload operation on a moving vehicle.

This method is called by BaseIndustryMain() to load/unload a vehicle that has stopped on a scenery trigger. It will stop the train if necessary and call PerformStoppedLoad() to handle the actual transfer of products (which must be user-implemented if they want their industry to load/unload stopped vehicles). If the train that vehicle is in is under script control, a message of type ("HandleTrain", "Release") is sent to the train once the loading/unloading has been completed.

Parameters:
vehicle | Vehicle that has entered the trigger,
triggerName | Name of the scenery trigger being entered.

void BaseIndustry.PerformStoppedLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Called by either PerformStopped() or ThreadPerformStoppedLoad() to load/unload a vehicle when it has stopped.

This method has an empty implementation and must be implemented by the script programmer if they want their industry to load/unload a stopped vehicle. No user implementation is needed if the industry concerned doesn't support the loading/unloading of stopped vehicles or a mass stopped load.

Parameters:
vehicle | Vehicle to load when stopped on triggerName.
triggerName | Name of the scenery trigger where loading is to take place.

void BaseIndustry.PerformStoppedNoTrigger ( Vehicle vehicle ) [inline]

Starts moving a stopped train in this industry that isn't user controlled.

This method is called by BaseIndustryMain() to start moving a train not under user control that has a vehicle stopped outside an industry trigger. It will set the train to keep driving so that the vehicle will eventually encounter a trigger.

Parameters:
vehicle Vehicle that is stopped yet not on a trigger.

public void BaseIndustry.SetProperties ( Soup soup ) [inline]

Instructs this PropertyObject to initialize its properties from the given database.

If the database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

When overriding this method to handle your own properties, always call through to the overridden parent by using inherited like this:

     public void SetProperties(Soup soup)
     {
       // call overridden parent with soup passed up to it
       inherited(soup);

       // your initialization goes here...
     }

In the PropertyObject implementation, if a property handler is attached to this object and it has been set to have its properties saved, that handler's SetProperties() method will be called.

Note:
It is possible that in future versions of Trainz, parent methods like this one may have their implementation modified. By not calling through to the overridden parent, you will ill be running the risk of having your assets NOT WORKING in a future version of Trainz.
Parameters:
soup Database to initialize this property object with.
See also:
HTMLPropertyHandler.SetProperties(), HTMLPropertyHandler.GetSavesProperties()

Reimplemented from PropertyObject.

Reimplemented in GenericPassengerStation.

public void BaseIndustry.SetQueueInitialCount | ( | ProductQueue | queue,
 |  | Asset | asset,
 |  | int | newValue
 | ) | [inline]

Sets the initial count of the given queue such that it contains a set amount of a particular product.

Note:
DestroyAllProducts() is called on queue so any current contents will be destroyed.
Parameters:
queue | Queue in this industry to set the initial count of.
asset | Type of asset queue is to contain.
newValue | Amount of products of type asset that queue is to have as its initial default.
See also:
ProductQueue.DestroyAllProducts(), ProductQueue.CreateProduct(), MapObject.GetQueues()

thread void BaseIndustry.ThreadEndPipeAnimation ( Vehicle vehicle ) [inline]

Plays the pipe retraction animation on the given vehicle.

Note:
This method was written to work with the GATX Oil Tanker vehicle and it is not going to work unless the vehicle has two attachment points named "pipe-attachment-left" and "pipe-attachment-right". The retractable pipe is a separate asset that is attached to the vehicle.
Parameters:
vehicle Vehicle to end the animation on.

thread void BaseIndustry.ThreadPerformMassStoppedLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Called by PerformMassStopped() to perform a mass stopped load/unload on the given vehicles.

This method is called by PerformMassStopped() to allow for vehicle being part of a train that a mass stopped load/unload is being attempted on. It will call PerformMassStoppedLoad() to handle the vehicle. If this is successful, a ("HandleTrain", "Release") message is posted vehicle's train along with a ("GenericIndustry", "LoadComplete") message to this industry for BaseIndustryMain() to process.

Parameters:
vehicle | Vehicle to forward on to PerformMassStoppedLoad() for loading/unloading.
triggerName | Name of the scenery trigger to forward on to PerformMassStoppedLoad().

thread void BaseIndustry.ThreadPerformMovingLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Called by PerformInnerEnterMoving() to perform a moving load/unload on a vehicle.

This method is called by PerformInnerEnterMoving() to load/unload a moving vehicle. It will call PerformMovingLoad() to handle the vehicle and post a message to this industry of type ("GenericIndustry", "LoadComplete") for BaseIndustryMain() to process before ending.

Parameters:
vehicle | Vehicle to forward on to PerformMovingLoad() for loading/unloading.
triggerName | Name of the scenery trigger to forward on to PerformMovingLoad().

thread void BaseIndustry.ThreadPerformStoppedLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Called by PerformMassStoppedLoad() to load/unload a vehicle.

This method is called by PerformMassStoppedLoad() for each vehicle in the train to perform a mass stopped load/unload. It will call PerformStoppedLoad() to handle the vehicle and post a message to this industry of type ("GenericIndustry", "LoadComplete") for BaseIndustryMain() to process before ending.

Parameters:
vehicle | Vehicle to forward on to PerformMassStoppedLoad() for loading/unloading.
triggerName | Name of the scenery trigger to forward on to PerformMassStoppedLoad().

bool BaseIndustry.TriggerSupportsMassMovingLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Determines if the given vehicle (and its train) can have a mass load/unload performed while moving over the named scenery trigger.

This method is called by BaseIndustryMain() and PerformInnerEnterMoving() to determine if triggerName allows vehicle and all of the vehicles in its train to be mass loaded/unloaded in one hit while moving (hence the term mass). If so, then PerformInnerEnterMoving() will attempt to load/unload all vehicles in vehicle's train via ThreadPerformMovingLoad().

Note:
If no mass loading/unloading while moving is supported on any of your industry triggers, then you don't need to implement this method as the default return value of false is sufficient.
Parameters:
vehicle | Vehicle that has recently entered/stopped on the scenery trigger.
triggerName | Name of the scenery trigger to check for support of mass loading/unloading while moving.
Returns :
Returns true if this industry supports mass loading/unloading when vehicle is moving over triggerName, false otherwise.

bool BaseIndustry.TriggerSupportsMassStoppedLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Determines if the given vehicle (and its train) can have a mass load/unload performed while stopped on the named scenery trigger.

This method is called by BaseIndustryMain() to determine if triggerName allows vehicle and all of the vehicles in its train to be loaded/unloaded in one hit when stopped (hence the term mass). If so, then PerformMassStopped() is called by BaseIndustryMain() to handle the mass stopped load/unload.

A good example of a mass stopped load/unload situation would be a passenger station as generally, all coaches are stopped along the platform and will have passengers boarding and disembarking at once. The loading/unloading of a train on a per vehicle basis may be ideal for an ore dump in a mine but probably isn't a very good way to run a passenger service. The GenericPassengerStation class, which is derived from BaseIndustry, uses mass stopped loading/unloading for passengers.

Note:
If no mass loading/unloading while stopped is supported on any of your industry triggers, then you don't need to implement this method as the default return value of false is sufficient.
Parameters:
vehicle | Vehicle that has recently entered/stopped on the scenery trigger.
triggerName | Name of the scenery trigger to check for support of mass loading/unloading while stopped.
Returns :
Returns true if this industry supports mass loading/unloading when vehicle is stopped on triggerName, false otherwise.

bool BaseIndustry.TriggerSupportsMovingLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Determines if the given vehicle can be loaded/unloaded at the named scenery trigger while moving.

This method is called by BaseIndustryMain() to determine if triggerName allows vehicle to be loaded/unloaded on it while moving. As the BaseIndustry implementation always returns b> false, the script programmer needs to write their own implementation if they want any loading/unloading while moving to happen on a trigger in their industry.

Note:
If no loading/unloading while moving is supported on any of your industry triggers, then you don't need to implement this method as the default return value of false is sufficient.
Parameters:
vehicle | Vehicle that has recently entered/stopped on the scenery trigger.
triggerName | Name of the scenery trigger to check for support of loading/unloading with a moving vehicle.
Returns :
Returns true if triggerName supports loading from vehicle while moving, false otherwise.

bool BaseIndustry.TriggerSupportsStoppedLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Determines if the given vehicle can be loaded/unloaded at the named scenery trigger while stopped.

This method is called by BaseIndustryMain() to determine if triggerName allows vehicle to be loaded/unloaded on it while stopped. As the BaseIndustry implementation always returns false, the script programmer needs to write their own implementation if they want any loading/unloading while stopped to happen on a trigger in their industry.

Note:
If no loading/unloading while stopped is supported on any of your industry triggers, then you don't need to implement this method as the default return value of false is sufficient.
Parameters:
vehicle | Vehicle that has recently entered/stopped on the scenery trigger.
triggerName | Name of the scenery trigger to check for support of loading/unloading with a stopped vehicle.
Returns :
Returns true if triggerName supports loading from vehicle while stopped, false otherwise.

thread void BaseIndustry.ViewDetails ( void ) [inline]

Display details about this industry in a Browser window.

This method is called by BaseIndustryMain() when a ("MapObject", "View-Details") message is received. The default implementation provide in this class is empty and does nothing and it is intended that the scriptlet programmer implements this method to display industry information in the info browser if desired.

BaseIndustryMain() also waits for messages of type ("Browser-Closed", "") so it can reset info to null when the user closes the browser window. So that the main thread can keep processing messages while the user is reading the browser window, ViewDetails() runs on a thread of its own.

Note:
The HTMLWindow class provides several handy utility methods that can be used to construct HTML code that describes an industry.
See also:
Browser

The documentation for this class was generated from the following file:
  • BaseIndustry.gs


BaseIndustryInfo Class Reference

Inheritance diagram for BaseIndustryInfo:

HTMLPropertyHandler List of all members.

Public Methods

public string | GetDescriptionHTML (void)
Industry this handler is associated with.

public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)

Detailed Description

Property handler for the BaseIndustry class.

This class is a property handler for BaseIndustry that allows industry attributes like queues, products and processes to be set through the industry's properties window.

Note:
This class has only recently become a subclass of HTMLPropertyHandler, and does not yet support prefix naming.
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\BaseIndustryInfo.gs script file. Extensive comments were done for this class but due it since being converted to a property handler and the transfer of the actual data to the IndustryProductInfoComplete class, the comments in the source file are out of date. It is best to rely on the actual script implementation and not the main method comments in the source file.
See also:
BaseIndustry, IndustryProductInfoComplete, IndustryProductInfoCollection

Member Function Documentation

public string BaseIndustryInfo.GetDescriptionHTML ( void ) [inline]

Industry this handler is associated with.

Gets a description of this industry as a HTML page to be displayed to a Surveyor properties window.

This method overrides PropertyObject.GetDescriptionHTML() so that all the processes along with the products they consume and produce are listed such that the initial value and consumption/production rate can be edited for every single process through property links.

Returns :
Returns a HTML description of this industry listing all the processes and their respective consumption and production rates and initial defaults.

Reimplemented from HTMLPropertyHandler.

public string BaseIndustryInfo.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string BaseIndustryInfo.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string BaseIndustryInfo.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public void BaseIndustryInfo.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • BaseIndustryInfo.gs


BasePortal Class Reference

Inheritance diagram for BasePortal:

Industry List of all members.

Detailed Description

A parent class for the portal assets.

This class is a parent class for the portal assets. It is not part of the API and its implementation is fully visible in the \Trainz\scripts\BasePortal.gs file. The portal source code is also provided.

See also:
Portal Asset Source, BaseIndustry, GenericIndustry

The documentation for this class was generated from the following file:
  • BasePortal.gs


Bogey Class Reference

Inheritance diagram for Bogey:

MeshObject List of all members.

Detailed Description

A bogey (truck in American terminology) on a vehicle.

This class represents a bogey on a vehicle and you can obtain a list of a vehicle's bogies by calling Vehicle.GetBogeyList(). There are no Bogey-specific methods at this time.

See also:
Vehicle.GetBogeyList()

The documentation for this class was generated from the following file:
  • Bogey.gs


Browser Class Reference

Inheritance diagram for Browser:

GameObject List of all members.

Public Methods

public native void | SetParam (int paramID, string str)
public native void | LoadHTMLString (string htmlData)
Deprecated, use LoadHTMLString(Asset,string) instead.

public native void | LoadHTMLString (Asset asset, string htmlData)
public native void | LoadHTMLFile (Asset asset, string relativePath)
public native Asset | GetAsset (void)
public native void | SetCloseEnabled (bool enabled)
public native void | SetScrollEnabled (bool enabled)
public native void | SetWindowStyle (int style)
public native void | SetWindowRect (int left, int top, int right, int bottom)
public native int | GetWindowTop (void)
public native int | GetWindowLeft (void)
public native int | GetWindowRight (void)
public native int | GetWindowBottom (void)
public native void | SetWindowTop (int top)
public native void | SetWindowLeft (int left)
public native void | SetWindowRight (int right)
public native void | SetWindowBottom (int bottom)
public void | SetWindowWidth (int width)
public void | SetWindowHeight (int height)
public void | SetWindowSize (int width, int height)
public void | SetWindowPosition (int left, int top)
public int | GetWindowWidth (void)
public int | GetWindowHeight (void)
public native void | SetWindowVisible (bool visible)
public native bool | GetWindowVisible (void)
public native void | SetWindowGrow (int minWidth, int minHeight, int maxWidth, int maxHeight)
public native void | SetElementProperty (string elementID, string propertyID, string value)
public native string | GetElementProperty (string elementID, string propertyID)
public native void | SetTrainzText (string id, string text)
public native void | SetElementObjectProperty (string elementID, string propertyID, object value)
public native void | LoadHTMLFile (string localFilename)
Deprecated, use LoadHTMLFile(Asset,string) instead.

public native void | BringToFront (void)
Brings this Browser window to the front of other browsers on the screen.

public native void | ResetScrollBar (void)
Resets the scroll bar to the top of the browser window.

Public Attributes

Browser Window Styles

Different border states a browser can have.

See also:
Browser.SetWindowStyle()

public define int | STYLE_NO_FRAME = 0
Browser without frame (i.e. not in a bordered window).

public define int | STYLE_DEFAULT = 1
Default browser style. This is defined by Trainz itself and usually means the browser window will have a framed border if this style is chosen.

public define int | STYLE_TOOLTIP = 2
Browser with no frame that the user can't interact with the window of.

Detailed Description

A HTML browser window. This is Trainz's mini-browser.

A Browser object is created to display a window of HTML text on screen. With TRS2004, the ability to display multiple browsers is supported. To create a new Browser, use the Constructors.NewBrowser() method. Than use one of the loading methods such as LoadHTMLString() in this class to get the Browser object to display a HTML page.

Keep in mind that this is a simple browser that supports a very limited amount of basic HTML tags and is not a fully functional complete browser that can do everything. No extra fancy web browser features like JavaScript, Java, Flash etc. are supported by this class or Trainz.

Messages that are generated by a Browser object are:
Major | Minor | Source | Destination
"Browser-URL" | URL | browser object | broadcast
"Browser-Closed" | null | browser object | broadcast

When a URL in the HTML code displayed by a browser is clicked, a message with a major type of "Browser-URL" is broadcasted with the minor type being the URL clicked on. A URL is defined by using the <a href="URL"< tag and must be in the form of "live://<link name>" where <link name> is the name of link. The message minor type will include the full URL with the "live://" prefix.

Note:
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 continue to reference the browser which caused the message, and other scripts will be unable to close it.
It is worth noting that there is a special type of URL for the properties used by PropertyObject. A property URL must be in the format of "live://property/<propertyname>" where <propertyname> is the name of the property that the URL refers to. Property links allow property values to be clickable and thus edited by the user. See the PropertyObject.GetDescriptionHTML() method for further details.

Note:
The "live://" prefix to the URL string MUST be used if the link is to be able to have a "Browser-URL" message generated when clicked on. This is a proprietary Trainz URL format and not part of standard HTML.
When the user closes the browser window by either clicking on the close button or pressing the Esc key, a message with a major type of "Browser-Closed" message is broadcasted. Usually, the Browser object would be reset to null so the browser window on the screen will disappear.

In the method descriptions for this class, you will see pixel coordinates are commonly referred to. Pixel coordinates operate on a 2D (x, y) Cartesian coordinate system where (0,0) is the top left corner of the display and (x resolution - 1, y resolution - 1) is the bottom right corner.

See also:
BrowserInterface, GameObject, Interface, Menu, StringTable, Constructors.NewBrowser(), GenericIndustry.ViewDetails(), PropertyObject.GetDescriptionHTML(), Mini-browser HTML Reference

Member Function Documentation

public native Asset Browser.GetAsset ( void )

Returns the Asset from which this browser is loading local images and links.

Note:
The Asset may be null, and will match the Asset passed into LoadHTMLString() or LoadHTMLFile().

public native string Browser.GetElementProperty | ( | string | elementID,
 |  | string | propertyID
 | ) |

Gets the value of the specified property in the named element of this browser.

Parameters:
elementID | Element to get a property value from.
propertyID | Property in the element to get the value of.
Returns :
Returns the value of the specified property value if it exists, null otherwise.
See also:
HTML Tags Reference

public native int Browser.GetWindowBottom ( void )

Gets the location of the bottom of this browser window.

Returns :
Returns the location of the bottom of this browser window as a y-axis pixel coordinate.

public int Browser.GetWindowHeight ( void )

Gets the height of this browser window in pixels.

Returns :
Returns the height of this browser window in pixels.

public native int Browser.GetWindowLeft ( void )

Gets the location of the left side of this browser window.

Returns :
Returns the location of the left side of this browser window as a x-axis pixel coordinate.

public native int Browser.GetWindowRight ( void )

Gets the location of the right side of this browser window.

Returns :
Returns the location of the right side of this browser window as a x-axis pixel coordinate.

public native int Browser.GetWindowTop ( void )

Gets the location of the top of this browser window.

Returns :
Returns the location of the top of this browser window as a y-axis pixel coordinate.

public native bool Browser.GetWindowVisible ( void )

Determines if this browser window is visible.

Returns :
Returns true if this browser window is visible, false otherwise.

public int Browser.GetWindowWidth ( void )

Gets the width of this browser window in pixels.

Returns :
Returns the width of this browser window in pixels.

public native void Browser.LoadHTMLFile | ( | Asset | asset,
 |  | string | relativePath
 | ) |

Loads HTML code into the browser from a file.

Parameters:
asset | Asset where images and other links can be found.
relativePath | Name of the HTML file to load.

public native void Browser.LoadHTMLString | ( | Asset | asset,
 |  | string | htmlData
 | ) |

Loads HTML code into the browser from the given string.

Loads images and other relative links relative to the specified asset's directory.

Parameters:
asset | Asset where images and other links can be found.
htmlData | String containing HTML code.

public native void Browser.SetCloseEnabled ( bool enabled )

Enables/disables the closing of this browser window.

Preventing the use from being able to close the browser can be used to keep the browser visible and to make sure they actually read the instructions or are confronted with their mistakes.

Parameters:
enabled Flag indicating whether to enable closing of this browser (true) or disable (false).

public native void Browser.SetElementObjectProperty | ( | string | elementID,
 |  | string | propertyID,
 |  | object | value
 | ) |

Sets the property of the named object element in this browser to the given object.

This method is used to assign an object value to the property contained in an element that is in the HTML page this Browser is currently loaded with.

An element in a HTML page is usually a something like a text entry box, dial or button defined by a <trainz-object> tag. Each element has multiple properties in it and this method allows those property items to be set by name.

Parameters:
elementID | Name of element to set the property of.
propertyID | Property in the element to set. Properties the <trainz-object> tag supports can be used.
value | Object the is the value the property will be assigned.
See also:
HTML Reference

public native void Browser.SetElementProperty | ( | string | elementID,
 |  | string | propertyID,
 |  | string | value
 | ) |

Sets the property of the named element in this browser to the given value.

This method is used to set the value of a property contained in an element that is in the HTML page this Browser is currently loaded with.

An element in a HTML page is usually a something like a text entry box, dial or button defined by a <trainz-object> tag. Each element has multiple properties in it and this method allows those property items to be set by name.

Parameters:
elementID | Name of element to set a property of.
propertyID | Property in the element to set. Any property the <trainz-object> tag supports can be used.
value | Value to set the property to.
See also:
HTML Tags Reference

public native void Browser.SetParam | ( | int | paramID,
 |  | string | str
 | ) |

Sets the specified parameter to the given value.

The parameter specified by paramID, which is identified in HTML code by "$<paramID>", will be substituted with str in the HTML code. This works the same way as a parameter in a StringTable string does.

Parameters:
paramID | Number of the parameter to substitute.
str | String to substitute when the parameter specified by paramID is found in HTML code.

public native void Browser.SetScrollEnabled ( bool enabled )

Enables/disables the scrolling of this browser window.

When scrolling is disabled, no scrollbars will appear on the window, even if the HTML content does not all fit.

Note:
SetWindowStyle() modifies this setting.

public native void Browser.SetTrainzText | ( | string | id,
 |  | string | text
 | ) |

Sets the named Trainz text item in this browser to the given string.

Trainz text is a way of providing updateable text in a HTML page without having to reload the page. Multiple Trainz text items can be used in a single page and they are defined by using the <trainz-text> tag. For example, the following HTML code defines the current speed of the train in Driver for the Speed and Time HUD panel:

<trainz-text id="speed" text="0 kph"></trainz-text>

The id option of the tag is used to specify the name of the Trainz text item while text is the default text displayed for the item that can be changed by this method.

Parameters:
id | ID name of the Trainz text item to set.
text | String to apply to the text item specified by id.
See also:
HTML Reference

public native void Browser.SetWindowBottom ( int bottom )

Sets the position of the bottom of this browser window.

Parameters:
bottom Bottom y-axis pixel position.

public native void Browser.SetWindowGrow | ( | int | minWidth,
 |  | int | minHeight,
 |  | int | maxWidth,
 |  | int | maxHeight
 | ) |

Sets the minimum and maximum sizes to which the user can resize this window to.

Call this method after setting the window's size as that will lock the growth to the size of the window such that it can be shrunk but not expanded beyond its initial size.

Parameters:
minWidth | Minimum window width in pixels.
minHeight | Minimum window height in pixels.
maxWidth | Maximum window width in pixels.
maxHeight | Maximum window height in pixels.

public void Browser.SetWindowHeight ( int height )

Sets the height of this browser window.

Parameters:
height Height in pixels to set this browser window to.

public native void Browser.SetWindowLeft ( int left )

Sets the position of the left side of this browser window.

Parameters:
left Left side x-axis pixel position.

public void Browser.SetWindowPosition | ( | int | left,
 |  | int | top
 | ) |

Sets the window's screen position using pixel coordinates.

Sets the position of the browser in pixel coordinates. The top left corner of the browser is where the position is set from.

Parameters:
left | Position of the left side of the browser window (x-axis pixel coordinate).
top | Position of the top of the browser window (y-axis pixel coordinate).

public native void Browser.SetWindowRect | ( | int | left,
 |  | int | top,
 |  | int | right,
 |  | int | bottom
 | ) |

Sets the rectangle dimensions of this browser window using pixel coordinates.

Parameters:
left | Left x-axis pixel coordinate.
top | Top y-axis pixel coordinate.
right | Right x-axis pixel coordinate.
bottom | Bottom y-axis pixel coordinate.

public native void Browser.SetWindowRight ( int right )

Sets the position of the right side of this browser window.

Parameters:
right Right side x-axis pixel position.

public void Browser.SetWindowSize | ( | int | width,
 |  | int | height
 | ) |

Sets the height and width of this browser.

Parameters:
width | Width in pixels to set this browser window to.
height | Height in pixels to set this browser window to.

public native void Browser.SetWindowStyle ( int style )

Sets the style of window used by this browser (either with or without a frame).

Parameters:
style Style to set the browser to. See the Browser Window Styles section for details.
See also:
Browser Window Styles

public native void Browser.SetWindowTop ( int top )

Sets the position of the top of this browser window.

Parameters:
top Top y-axis pixel position.

public native void Browser.SetWindowVisible ( bool visible )

Hides or shows this browser window.

Parameters:
visible If true, browser is shown, false to hide.

public void Browser.SetWindowWidth ( int width )

Sets the width of this browser window.

Parameters:
width Width in pixels to set this browser window to.

The documentation for this class was generated from the following file:
  • browser.gs


BrowserInterface Class Reference

List of all members.

Public Methods

public native Browser | CreateBrowser (void)
Deprecated, use Constructors.NewBrowser() instead.

public native void | SetOverlayColor (float red, float green, float blue, float alpha, float morphTime)
public native void | SetSaveAllowed (bool saveAllowed)
public void | FadeScreen (GameObject runningThread, float red, float green, float blue, float alpha, float time)
public native string | Quote (string a_str)

Detailed Description

Interface that allows a browser to be created as well as basic screen controls.

See also:
Browser, Interface, Constructors.NewBrowser()

Member Function Documentation

public void BrowserInterface.FadeScreen | ( | GameObject | runningThread,
 |  | float | red,
 |  | float | green,
 |  | float | blue,
 |  | float | alpha,
 |  | float | time
 | ) | [inline]

Fades the screen out and back in again according to the given color and time parameters.

Parameters:
runningThread | GameObject where thread that called this method is.
red | Red value of color to fade out to.
green | Green value of color to fade out to.
blue | Blue value of color to fade out to.
alpha | Alpha value of layer faded to (transparency).
time | Duration of fading. This value will be split equally into three sections for fade out, idle and fade in.

public native string BrowserInterface.Quote ( string a_str )

Quotes the given string.

Parameters:
a_str String to quote.
Returns :
Returns a quoted string.

public native void BrowserInterface.SetOverlayColor | ( | float | red,
 |  | float | green,
 |  | float | blue,
 |  | float | alpha,
 |  | float | morphTime
 | ) |

Sets the color of an overlay and transitions to that overlay over the given time.

Parameters:
red | Red value of overlay color.
green | Green value of overlay color.
blue | Blue value of overlay color.
alpha | Alpha setting of overlay (transparency).
morphTime | Duration of fading to the new overlay.

public native void BrowserInterface.SetSaveAllowed ( bool saveAllowed )

Enables/disables game saving on a scenario.

Parameters:
saveAllowed Flag indicating whether to allow save (true) or not (false).

The documentation for this class was generated from the following file:
  • browser.gs


Buildable Class Reference

Inheritance diagram for Buildable:

SceneryWithTrack Industry BaseIndustry BasePortal GenericIndustry GenericPassengerStation List of all members.

Public Methods

public native int | GetBuildingState (void)
public native float | GetBuildingProgress (void)
public native void | SetBuildingState (int state)
public native void | SetBuildingProgress (float progress)
public native void | SetBuildingPaused (bool paused)
public native bool | StartBuild (void)
public native bool | CancelBuild (void)
public native void | EnableUserStartBuild (bool enable)
public native void | EnableUserCancelBuild (bool enable)

Public Attributes

Buildable Object States

Different states a buildable object can be in.

See also:
Buildable.GetBuildingState(), Buildable.SetBuildingState()

public define int | STATE_POTENTIAL = 0
Object has potential to build.

public define int | STATE_BUILDING = 1
Object is currently in a building (in progress) state.

public define int | STATE_COMPLETE = 2
Building is complete.

Detailed Description

Interface for an object that is buildable with building states and progress level.

At this stage in Trainz, the building states are not really used. This class is mainly a parent class for Industry.

Messages used with a Buildable object are:
Major | Minor | Source | Destination
"Build" | "Started" | -- | buildable object
"Build" | "Cancelled" | -- | buildable object
"Build" | "Completed" | -- | buildable object

See also:
Industry, SceneryWithTrack, Train.GetLastVisitedBuildable(), Crossing, Turntable

Member Function Documentation

public native bool Buildable.CancelBuild ( void )

Cancel building.

Returns :
Returns true if the build was cancelled, false otherwise.

public native void Buildable.EnableUserCancelBuild ( bool enable )

Allow/disallow the user to cancel the building process.

Parameters:
enable If true, the user will be able to cancel the build, false to deny cancellation by the user.

public native void Buildable.EnableUserStartBuild ( bool enable )

Allow/disallow the user to start the building process.

Parameters:
enable If true, the user will be able to start the build, false to deny starting by the user.

public native float Buildable.GetBuildingProgress ( void )

Gets the current progress of this buildable object.

Returns :
Returns the current progress of the building.

public native int Buildable.GetBuildingState ( void )

Gets the current state of this buildable object.

Returns :
Returns the current built state of this game object. See the Buildable Object States section for details.

public native void Buildable.SetBuildingPaused ( bool paused )

Sets the paused state of this building.

Parameters:
paused If true, the building process will be paused, false to unpause.

public native void Buildable.SetBuildingProgress ( float progress )

Sets the progress rate of this building

Parameters:
progress Rate of progress of the building.

public native void Buildable.SetBuildingState ( int state )

Sets the state of this buildable object.

Parameters:
state Building state to set this object to. See the Buildable Object States section for details.

public native bool Buildable.StartBuild ( void )

Start building.

Returns :
Returns true if build was started, false otherwise.

The documentation for this class was generated from the following file:
  • buildable.gs


Cabin Class Reference

Inheritance diagram for Cabin:

MeshObject DefaultLocomotiveCabin DefaultSteamCabin List of all members.

Public Methods

public native CabinControl[] | GetControls (void)
public native CabinControl | GetNamedControl (string name)
public native GameObject | GetParentObject (void)
public native bool | IsActive (void)
public native bool | FireAddCoal (void)
public native void | SetCabLightIntensity (float intensity)
public void | Init (void)
public void | Attach (GameObject obj)
public void | Update (void)
public void | UserPressKey (string s)
public void | UserSetControl (CabinControl control, float value)

Detailed Description

An interface to a cabin.

This class is the interface class used for cabins/interior assets in Trainz. From the scripting perspective, a Cabin is mainly a collection of cabin controls. What controls the cabin has depends on the configuration of the asset.

If a cabin asset is to have custom scripted features, it's script class will need to be derived from this one.

The types of controls a cabin has is largely locomotive specific hence this class is the interface and not a cabin implementation. The DefaultLocomotiveCabin and DefaultSteamCabin classes provide a basic default Cabin implementation that can be used for diesels/electrics and steam locos respectively.

The source code for the Bigsteam Interior (UP Big Boy), UP DD40 and QR PB15 interiors are included with this documentation.

See also:
CabinControl, DefaultLocomotiveCabin, DefaultSteamCabin, GameObject, Locomotive, CabinControlSetting, ControlSettingsManager

Member Function Documentation

public void Cabin.Attach ( GameObject obj ) [inline]

Attaches this cabin to a game object (i.e. a Locomotive).

This method is called by Trainz when it is about to either attach or detach this cabin to an object.

Because a cabin is destroyed when it is no longer needed and re-created by Trainz later on if needed again, this method is where you should restore the cabin control settings. A Locomotive object has a cache of cabin control settings that can be saved to when the cabin is updated. However the programmer needs to update and make use of cabin settings in their implementation of this method (and possibly Update() as well).

Parameters:
obj Game object to attach this cabin to (usually a Locomotive).
Note:
Both the DefaultLocomotiveCabin and DefaultSteamCabin cabins contain good example implementations of this method.
See also:
Locomotive.GetCabinData()

Reimplemented in DefaultLocomotiveCabin, and DefaultSteamCabin.

public native bool Cabin.FireAddCoal ( void )

Adds coal to the firebox.

Returns :
Returns true if coal is successfully added to the firebox, false otherwise.

public native CabinControl [] Cabin.GetControls ( void )

Gets the controls in this cabin.

Returns :
Returns the controls in this cabin as an array.

public native CabinControl Cabin.GetNamedControl ( string name )

Gets a cabin control by name.

Parameters:
name Name of the cabin control to get.
Returns :
Returns the cabin control specified by name if it exists, null otherwise.

public native GameObject Cabin.GetParentObject ( void )

Gets the parent game object of this cabin (i.e. the Locomotive)

Returns :
Returns the parent GameObject that this cabin is attached to (usually a Locomotive), null otherwise.

public void Cabin.Init ( void ) [inline]

Initializes this Cabin object.

This method is called by Trainz when it creates a new Cabin object. Usually it would initialize all the controls the cabin has.

The implementation in the Cabin class is empty. Override to perform any custom initialization.

Note:
Both the DefaultLocomotiveCabin and DefaultSteamCabin cabins contain good example implementations of this method.

Reimplemented from MeshObject.

Reimplemented in DefaultLocomotiveCabin, and DefaultSteamCabin.

public native bool Cabin.IsActive ( void )

Determines if this cabin is active.

Returns :
Returns true if this cabin is active, false if inactive.

public native void Cabin.SetCabLightIntensity ( float intensity )

Sets the intensity of lighting in this cabin.

This method acts as a dimmer for the in-cab lighting. Be warned that this is in-game lighting, not physically realistic lighting. Also, this method affects the "fire light" in steam interiors.

Parameters:
intensity Level of cabin lighting intensity. This is a normalized value in the range of [0.0 - 1.0]. 0.0 is black, regardless of the background lighting levels and higher values mean a brighter cab.

public void Cabin.Update ( void ) [inline]

Cabin update method.

Called by Trainz to update this cabin object. This implementation is empty so the script programmer must implement it if they want their cabin's controls to be updated.

If you want to keep the controls in the cabin up to date and to accurately reflect the current state of the locomotive, you will need to perform those updates from an overridden implementation of this method. It is mostly a case of querying the current status of the host locomotive's state and applying them to the matching control. For example, the speedometer in the cab would need to be updated based on the loco's current velocity.

Note:
Both the DefaultLocomotiveCabin and DefaultSteamCabin cabins contain good example implementations of this method.

Reimplemented in DefaultLocomotiveCabin, and DefaultSteamCabin.

public void Cabin.UserPressKey ( string s ) [inline]

Called when user has pressed a key in this cabin.

The default Cabin implementation does not handle any keystrokes. You must do so in your own overridden implementation.

Parameters:
s Name of the key user has pressed. This is a name for the keystroke, not the actual key.

Reimplemented in DefaultLocomotiveCabin, and DefaultSteamCabin.

public void Cabin.UserSetControl | ( | CabinControl | control,
 |  | float | value
 | ) | [inline]

Called when user sets a cabin control.

Parameters:
control | Control that user has set.
value | Value control is set to.

Reimplemented in DefaultLocomotiveCabin, and DefaultSteamCabin.

The documentation for this class was generated from the following file:
  • Cabin.gs


CabinControl Class Reference

Inheritance diagram for CabinControl:

GameObject List of all members.

Public Methods

public native string | GetName (void)
public native float | GetValue (void)
public native bool | IsVisible (void)
public native bool | IsLocked (void)
public native float | GetMinimum (void)
public native float | GetMaximum (void)
public native void | SetValue (float value)
public native void | SetVisible (bool visible)
public native void | SetLocked (bool locked)
public native void | SetText (string text)
public native void | SetUserLimits (float min, float max)
public native void | SetNamedValue (string name, float value)

Detailed Description

A control in a cabin.

Class that represents a control in a Cabin. Interface methods to access the control's name, value/setting, visibility and value range are provided. The Cabin.GetControls() method provides a list of controls in a cabin.

See also:
Cabin, DefaultSteamCabinData, DefaultLocomotiveCabin, GameObject, Locomotive, CabinControlSetting, ControlSettingsManager

Member Function Documentation

public native float CabinControl.GetMaximum ( void )

Gets the maximum possible value for this control.

Returns :
Returns the maximum possible value for this control.

public native float CabinControl.GetMinimum ( void )

Gets the minimum possible value for this control.

Returns :
Returns the minimum possible value for this control.

public native string CabinControl.GetName ( void )

Gets name of this object.

Returns :
Returns the name of this object.

Reimplemented from GameObject.

public native float CabinControl.GetValue ( void )

Gets the current setting value of this control.

Returns :
Returns the current value of this control.

public native bool CabinControl.IsLocked ( void )

Determines if this control is locked.

Returns :
Returns true if this control is locked, false otherwise.

public native bool CabinControl.IsVisible ( void )

Determines if this control is visible.

Returns :
Returns true if this control is visible, false otherwise.

public native void CabinControl.SetLocked ( bool locked )

Locks/unlocks this control.

Parameters:
locked Locked state for this control. If true, the control is locked, otherwise false to unlock it.

public native void CabinControl.SetNamedValue | ( | string | name,
 |  | float | value
 | ) |

Sets the named control value.

Parameters:
name | Name of the value to set.
value | Actual value.

public native void CabinControl.SetText ( string text )

Sets descriptive text for this control.

Parameters:
text String of descriptive text for this control.

public native void CabinControl.SetUserLimits | ( | float | min,
 |  | float | max
 | ) |

NOT IMPLEMENTED, DO NOT USE!

Sets the limits range of values for this control.

Parameters:
min | Minimum allowable value setting for this control.
max | Maximum allowable value setting for this control.

public native void CabinControl.SetValue ( float value )

Sets the value for this control.

Parameters:
value New value to set this control to.

public native void CabinControl.SetVisible ( bool visible )

Sets the visible state of this control.

Parameters:
visible If true, this control will be set to a visible state, false to make it invisible.

The documentation for this class was generated from the following file:
  • Cabin.gs


CabinControlSetting Class Reference

List of all members.

Public Attributes

public string | ctrl_name
Name of the cabin control.

public float | ctrl_value
Value of the cabin control.

Detailed Description

Describes the sate of a cabin control in simple format.

This class describes a cabin control's state in a simple format for use in the ControlSettingsManager class.

See also:
ControlSettingsManager, CabinControl, CabinData

The documentation for this class was generated from the following file:
  • Cabin.gs


CabinData Class Reference

Inheritance diagram for CabinData:

DefaultSteamCabinData

Detailed Description

CabinData is custom storage used by the Cabin and Locomotive classes.

When a Cabin of a locomotive is not being used (i.e. the camera is focused on another vehicle), that Cabin is destroyed for reasons of game efficiency. As a result, the settings of the various CabinControls in the Cabin will be at their default positions when the player returns to that cabin because Trainz is re-creating that cabin for them.

The basic controls in the cabin can be reset by querying the host Locomotive easily enough but custom controls will have to be reset from somewhere and this is what the CabinData class is useful for.

A Locomotive has a CabinData object and it is the responsibility of the Cabin script to ensure the cabin data of the locomotive it is attached to is kept updated. The Cabin script can also refer back to the loco's cabin data to configure itself. The Cabin class and the examples mentioned below show how the Cabin should be scripted in more detail.

CabinData is an empty class and is used as a type for the parameters of the Locomotive methods. It is up to the programmer of the locomotive script to create their own CabinData-derived class suitable for their locomotive. An example of a CabinData-derived object and a cabin that uses it is the DefaultSteamCabinData and DefaultSteamCabin classes. The full implementation of these two classes can be found in the \Trainz\scripts\DefaultSteamCabin.gs script file. The DD40 Interior cabin interior asset also provides a good demonstration of how to use this class.

See also:
Cabin, CabinControl, Locomotive.GetCabinData(), Locomotive.SetCabinData(), DefaultLocomotiveCabin, DefaultSteamCabinData

The documentation for this class was generated from the following file:
  • locomotive.gs


CheckBoxHandler Class Reference

Inheritance diagram for CheckBoxHandler:

GenericBoolHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public string | GetDescriptionHTML (void)

Detailed Description

Variation of GenericBoolHandler that is an on/off checkbox.

This handler manages a Boolean value in exactly the same way as its parent GenericBoolHandler does with the only difference being that a checkbox is used in the properties window.

This class does not require the true/false string table items its parent does. Instead, all you need is a descriptive string to display along side the checkbox. The checkbox image itself is handled by the class and is not something that needs to be provided.

The string table items supported by this handler are:

String Name | Description
"<config-prefix>-html-checkbox" | Text to display alongside the checkbox.
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

As with GenericBoolHandler, the both the "<config-prefix>-html-prefix" and "<config-prefix>-html-sufix" string items are optional, although if present the GetDescriptionHTML() implementation of this class will use them to wrap the generated HTML code up in.

The CheckBoxHandler class is used by the following rules:

  • Consist Check
  • Vehicle Physics
  • Disabled HUD Icon Notification
  • Driver Command Check
  • Multiple Junction Alignment Check
  • Wait for Camera View Mode
  • Wait for Click on HUD Icon
  • Wait for Derailment
  • Wait for Driver On/Off Train
  • Wait for HTML Pages
  • Wait on Minimap Screen/Main Screen
  • Wait on Train Stop/Start
  • Wait on Waybill Screen/Main Screen
See also:
ConfigAssetHandler, GenericBoolHandler, AssetCheckListHandler, CheckListPropertyHandler, CheckListGroupHandler, EnumeratedAssetHandler, GenericStringHandler

Member Function Documentation

public string CheckBoxHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from GenericBoolHandler.

public void CheckBoxHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from GenericBoolHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


CheckListGroupHandler Class Reference

Inheritance diagram for CheckListGroupHandler:

ConfigAssetGroupHandler RadioButtonGroupHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public void | Init (Asset asset, string newConfigPrefix)
public void | AddHandler (HTMLPropertyHandler handler, string subPrefix)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Detailed Description

A checklist of items where each item is a child handler.

This config handler is a group handler that has a selectable checkbox for each child handler. It works in a similar way to CheckListPropertyHandler but instead relies on the child handler to provide content to go beside the checkbox.

Apart from the child handler's HTML page being place adjacent to a checkbox this handler class creates, the checkboxes don't affect the child handlers and vice versa - they are separate entities. Interface methods are provided with this class so the state of the checkbox can be queried but what the programmer decides to use the checkbox value is entirely up to them.

The checkboxes are a mechanism for a sub handler to be easily selected/deselected. What selecting or deselecting a particular sub handler may actually mean is up to the programmer. It is assumed that as they are creating and adding the sub handlers, they know actually know what these sub handlers do.

Due to the more complex nature of a group handler having sub handlers, this config handler class is trickier to setup and use then the basic CheckListPropertyHandler class is. The string table requirements for this class are:

String Name | Description
"<config-prefix>-display-name" | Display name to be above the list.
"<config-prefix>-html-between-items" | HTML code placed between each checkbox and child handler in this group handler's properties window. Useful for adding a line break or divider bar.
"<config-prefix>-<item-name>" | Optional title for the child handler. If included, this text will be placed next to the checkbox and above the child handler with a prefix of "<item-name>".
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

For example here are the string table items from the Set Camera rule where the config prefix is "set-camera":

String Name | Contents
"set-camera-display-name" | "Perform the following operations on the in-game camera:<br>"
"set-camera-html-between-items" | "<br>"
"set-camera-item-cameratarget" | "null"
"set-camera-item-cameramode" | "null"
"set-camera-item-cameraflags" | "null"
"set-camera-html-prefix" | "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=3></td><td><font color=#000000>"
"set-camera-html-sufix" | "</font></td></tr></table>"

Note that the "set-camera-item-X" strings correspond to the 3 sub handlers used by the Set Camera rule with this class.

This handler is also used by Display HTML Pages rule.

Useful interface methods provided with this class are:

  • public void AddItem (string itemName, bool setting)
  • public bool GetSetting (int index)
  • public bool[] GetSettings ()
  • public string GetSettingName (int index)
  • public string[] GetSettingNames ()
  • public string[] GetSettingNames (bool checked)
  • public string GetSettingDisplayName (int index)
  • public HTMLPropertyHandler GetItemSubHandler (int index)
Note:
CheckListGroupHandler was mainly written as a utility class for use in the TRS2006 session rules. It is not part of the core Trainz API and is not fully documented. Those who are interested in how this class works can see all the full implementation in the \Trainz\scripts\ListItemPropertyHandler.gs script file.
See also:
CheckListPropertyHandler, RadioButtonGroupHandler, RadioButtonListHandler, ConfigAssetGroupHandler, AssetCheckListHandler, CheckBoxHandler, EnumeratedPropertyHandler, GenericStringHandler

Member Function Documentation

public void CheckListGroupHandler.AddHandler | ( | HTMLPropertyHandler | handler,
 |  | string | subPrefix
 | ) | [inline]

Adds the given property handler to this group handler.

Note:
A specific property handler object instance should not be used as a sub handler for more than one particular group handler. Doing so is at your own risk.
Parameters:
handler | New sub handler to add to this group.
subPrefix | Prefix to identify the sub handler by. This string will be prefixed with the existing prefix of handler so its actual prefix is updated in the process of being added to this group.

Reimplemented from HTMLPropertyGroup.

public string CheckListGroupHandler.GetDescriptionHTML ( void ) [inline]

Gets a HTML description of this group handler based on all of the child handlers.

Overridden from HTMLPropertyHandler.GetDescriptionHTML() to get the HTML description of each child handler in this group for inclusion in the returned description.

Returns :
Returns a HTML description built up by gathering the descriptions of all of the child handlers.

Reimplemented from ConfigAssetGroupHandler.

public Soup CheckListGroupHandler.GetProperties ( ) [inline]

Gets this handler's properties in a database.

Overridden from HTMLPropertyHandler.GetProperties() to save the properties of all sub handlers and then return a Soup containing a sub-database for each sub handler obtained by calling the sub handlers GetProperties() method.

Returns :
Returns a Soup database containing the saved properties of this group handler and its sub handlers.

Reimplemented from ConfigAssetGroupHandler.

Reimplemented in RadioButtonGroupHandler.

public string CheckListGroupHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

Overridden from HTMLPropertyHandler.GetPropertyType() to get the type of the named property from the appropriate child handler.

Parameters:
propertyID Name of the property to get the type of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyType() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public void CheckListGroupHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset group handler.

When a config group asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Note that calling this method does not do anything to any sub-handlers. It is recommended that Init() is called on the ConfigAssetGroupHandler before any sub-handlers are added.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetGroupHandler.

Reimplemented in RadioButtonGroupHandler, and RadioButtonGroupHandler.

public void CheckListGroupHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset group handler.

When a config group asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Note that calling this method does not do anything to any sub-handlers. It is recommended that Init() is called on the ConfigAssetGroupHandler before any sub-handlers are added.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetGroupHandler.

Reimplemented in RadioButtonGroupHandler, and RadioButtonGroupHandler.

public void CheckListGroupHandler.SetProperties ( Soup soup ) [inline]

Initializes this handler's properties from the given database.

Overridden from HTMLPropertyHandler.SetProperties() to initialize all of the sub handlers from the given Soup database. The HTMLPropertyGroup implementation of this method assumes the sub handlers have already been added to the group handler - it only initializes existing sub handlers and generally isn't meant to create new sub handlers itself (although you can do that in your own overridden implementation if you really want to).

Parameters:
soup Database of property values to initialize this handler with. Sub-databases in side this soup will be used to initialize each sub-handler.

Reimplemented from ConfigAssetGroupHandler.

Reimplemented in RadioButtonGroupHandler.

public void CheckListGroupHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the value of the named property.

Overridden from HTMLPropertyHandler.SetPropertyValue() to set the value of the named property on the appropriate child handler.

Parameters:
propertyID | Name of the property to set the value of. This should be a full property string with group handler and sub handler prefixes.
value | Value to set the property to.

Reimplemented from HTMLPropertyGroup.

Reimplemented in RadioButtonGroupHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


CheckListPropertyHandler Class Reference

Inheritance diagram for CheckListPropertyHandler:

ConfigAssetHandler RadioButtonListHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public void | AddItem (string itemName, bool setting)
public bool | SetItem (int itemIndex, bool itemChecked)
public void | SetAll (bool checked)
public int | CountItems ()
public bool | GetSetting (int index)
public bool[] | GetSettings (void)
public int | GetSettingsAsFlags (void)
public string | GetSettingName (int index)
public string[] | GetSettingNames (void)
public string[] | GetSettingNames (bool checked)
public string | GetSettingDisplayName (int index)
public bool | ItemExists (int index)
public int | ItemExists (string itemName)
public int | ItemExistsChecked (string itemName, bool checkState)
public void | Init (Asset asset, string newConfigPrefix)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Detailed Description

A config asset handler that manages a list of Boolean properties where each property has a checkbox to set it.

This class is similar to CheckBoxHandler in the way it uses a checkbox and adjacent text to allow a bool property value to be set, but instead of just one checkbox, it allows multiple checkboxes to be managed by the one handler, avoiding the need to use multiple CheckBoxHandler objects in a group handler.

This config asset handler has a bool property value for each checkbox it contains. The name for a bool checkbox property takes the form of "itemSetting/$N" where $N is the index to the desired property value.

The amount of checkbox Boolean properties this handler has is based on how many sequential string table items matching a specific format appear in the host asset's string table. When Init(Asset,string) is called, it will start looking for a string table item named "<config-prefix>-item0" with 0 being the starting point. It progressively keeps going looking for "<config-prefix>-item1" and so on until it can't find any further string table elements in that sequence.

Each of these "<config-prefix>-item$N" string table elements should contain what is known as the reference string. The reference string is appended to the end of the config prefix string to find out the descriptive display text for that particular checkbox item.

The string table requires for this config asset handler are listed in this table:

String Name | Description
"<config-prefix>-display-name" | Display text to be shown before the list.
"<config-prefix>-item$N" | Reference name for the $Nth item.
"<config-prefix>-item-<reference-name>" | Full name displayed next to the check box where <reference name> is the Xth item's reference name as defined in "-itemX".
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

For this config asset handler to work, it is essential that the item strings start from 0, are in an unbroken linear order and each one has matching reference string.

The "<config-prefix>-display-name" string is an optional title/header that is placed above the list of checkboxes by this class' GetDescriptionHTML() implementation if included. The same applies to both the "<config-prefix>-html-prefix" and "<config-prefix>-html-sufix" string items which will be used to wrap the generated HTML code up in if they are included.

As an example, here are string table elements for a list of checkboxes taken from the Enable Disable HUD Icons rule that defines a list of 4 checkboxes representing the four camera icons from the Driver interface. The config prefix is "panel-camera-controls".

String Name | Contents
"panel-camera-controls-display-name" | "Camera Controls:"
"panel-camera-controls-item0" | "cab_View"
"panel-camera-controls-item1" | "chase_View"
"panel-camera-controls-item2" | "tracking_View"
"panel-camera-controls-item3" | "free_roaming_View"
"panel-camera-controls-item-cab_View" | "Cab View"
"panel-camera-controls-item-chase_View" | "Chase View"
"panel-camera-controls-item-tracking_View" | "Tracking View"
"panel-camera-controls-item-free_roaming_View" | "Free Roaming"
"panel-camera-controls-html-prefix" | "<table cellpadding=0 cellspacing=0><tr><td width=3></td><td><font color=#000000>"
"panel-camera-controls-html-sufix" | "</font></td></tr></table>"

The CheckListPropertyHandler class is also used by the following rules:

  • Disabled HUD Icon Notification
  • Minimap Options
  • Set Camera
  • Set HTML Pages
See also:
ConfigAssetHandler, CheckBoxHandler, RadioButtonListHandler, AssetCheckListHandler, CheckListGroupHandler, EnumeratedAssetHandler, GenericBoolHandler, GenericStringHandler

Member Function Documentation

public void CheckListPropertyHandler.AddItem | ( | string | itemName,
 |  | bool | setting
 | ) |

Adds a new bool checkbox property to this handler.

Note:
This method was mainly written for internal use by Init(Asset,string) when it initializes this handler. Playing with it after the handler has been initialized is not recommended.
Parameters:
itemName | Display text that will be displayed alongside the new checkbox property.
setting | Setting that the new checkbox property will initially have.

Reimplemented in RadioButtonListHandler, and RadioButtonListHandler.

public int CheckListPropertyHandler.CountItems ( )

Gets the amount of bool property items in this handler.

Returns :
Returns the amount of bool property items in this handler.

public string CheckListPropertyHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from ConfigAssetHandler.

Reimplemented in RadioButtonListHandler.

public Soup CheckListPropertyHandler.GetProperties ( ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from ConfigAssetHandler.

Reimplemented in RadioButtonListHandler.

public string CheckListPropertyHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public bool CheckListPropertyHandler.GetSetting ( int index )

Gets the state of a bool check property by its item index.

Parameters:
index Item number of bool property to get the value of.
Returns :
Returns the state of the bool property as specified by index.

public string CheckListPropertyHandler.GetSettingDisplayName ( int index )

Gets the full display name of the specified bool checkbox property.

Parameters:
index Item number of the bool property to get the display name of.
Returns :
Returns the display name of the bool checkbox property specified by index if it exists, an empty string ("") otherwise.

public string CheckListPropertyHandler.GetSettingName ( int index )

Gets the reference name of the bool checkbox property specified by index.

Parameters:
index Item number of the bool property to get the reference name of.
Returns :
Returns the reference name of the bool checkbox property specified by index if it exists, an empty string ("") otherwise.

public string [] CheckListPropertyHandler.GetSettingNames ( bool checked )

Gets the reference names for all of the bool checkbox properties in this handler that match the given setting.

Parameters:
checked Status of the checkbox properties required for inclusion on the returned list.
Returns :
Returns all of the reference names of bool checkbox properties that match the state as specified in checked. If no bool properties match checked the array will be empty.

public string [] CheckListPropertyHandler.GetSettingNames ( void ) [inline]

Gets the reference names for all of the bool checkbox properties in this handler.

Returns :
Returns all of the reference names in an array of strings.

public bool [] CheckListPropertyHandler.GetSettings ( void ) [inline]

Gets the state of all the bool checkbox properties as an array of bool values.

Returns :
Returns the state of all the bool checkbox properties as an array of bool values.

public int CheckListPropertyHandler.GetSettingsAsFlags ( void )

Gets the state of all the bool checkbox properties as an integer bit set.

Note:
As Trainz GS only supports 32-bit integer values, this method is not suitable for checkbox lists with more than 32 items.
Returns :
Returns the state of all bool property values in a integer as a bit set.
See also:
Flags

public void CheckListPropertyHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

Reimplemented in RadioButtonListHandler, and RadioButtonListHandler.

public void CheckListPropertyHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

Reimplemented in RadioButtonListHandler, and RadioButtonListHandler.

public int CheckListPropertyHandler.ItemExists ( string itemName )

Determines if a bool checkbox property of the given name exists in this handler.

Parameters:
itemName Reference name of the item to verify the existence of.
Returns :
Returns the index of the bool property that matches itemName if it exists, -1 otherwise.

public bool CheckListPropertyHandler.ItemExists ( int index ) [inline]

Determines if the bool checkbox property specified by index exists in this handler.

Parameters:
index Item number of the bool property to verify the existence of.
Returns :
Returns true if the bool checkbox property specified by index exists in this handler, false otherwise.

public int CheckListPropertyHandler.ItemExistsChecked | ( | string | itemName,
 |  | bool | checkState
 | ) |

Determines if a bool checkbox property of the given name and state exists in this handler.

Parameters:
itemName | Reference name of the item to verify the existence of.
checkState | State that the bool property specified by itemName should be in.
Returns :
Returns the index of the bool property that matches itemName if it exists and its state matches checkState, -1 otherwise.

public void CheckListPropertyHandler.SetAll ( bool checked )

Sets all the checkbox bool properties of this handler to the given state.

Parameters:
checked Status to apply to all checkbox property items. If true, they will all be checked, false to have all of them unchecked.

public bool CheckListPropertyHandler.SetItem | ( | int | itemIndex,
 |  | bool | itemChecked
 | ) |

Sets the state of the indexed checkbox bool property.

Parameters:
itemIndex | Index of bool property set.
itemChecked | State to set the checkbox specified by itemIndex to.

public void CheckListPropertyHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from ConfigAssetHandler.

Reimplemented in RadioButtonListHandler.

public void CheckListPropertyHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

Reimplemented in RadioButtonListHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


Command Class Reference

List of all members.

Public Attributes

public int | command
Type of schedule command.

public int | ca
Multi-purpose integer command parameter (not always used).

public int | cb
Multi-purpose integer command parameter (not always used).

public int | cc
Multi-purpose integer command parameter (not always used).

public float | cd
Multi-purpose floating point command parameter (not always used).

public CustomCommand | custom
Custom command with user-provided function to execute.

public object | obj
Object related to this command. Could be a Track, Signal or Junction for example.

public string | major
Major type string for the message sent when this command executes.

public string | minor
Minor type string for the message sent when this command executes.

Detailed Description

A command in a schedule.

A Command object is used within the Schedule and contains all the information required by the train to execute a command.

See also:
CustomCommand, DriverCommand, DriverScheduleCommand, Schedule, Command Types

The documentation for this class was generated from the following file:
  • schedule.gs


ConditionalScenarioBehavior Class Reference

Inheritance diagram for ConditionalScenarioBehavior:

ScenarioBehavior List of all members.

Public Methods

void | PauseChildren (void)
void | ResetChildren (void)
void | UpdateChildren (Message notUsed)
bool | GetConditionResult (void)
void | ExecuteRule (void)
thread void | ThreadPollCondition (void)
public void | Init (Asset p_self)
public void | Pause (bool paused)
void | UnpauseChildren (void)
public void | SetProperties (Soup soup)

Public Attributes

bool | m_pollingBehavior = false
bool | m_pollingThreadRunning = false
bool | m_saveLoadRestart = false

Detailed Description

A conditional rule behavior template class that includes child rule support.

This class provides conditional behavior extensions for session rules and basic management of child rules that make it easier for the programmer to create a rule.

There are two different modes a ConditionalScenarioBehavior-derived rule can operate in: polled and un-polled.

Polled Mode
In polled mode, the rule runs a polling thread that waits for something to happen/reach a certain state. When the required event has happened, all child rules will be started and once they have all finished, this parent rule will complete itself.

A conditional rule that runs in polled mode is made by overriding Init() and implementing GetConditionResult(). The Init() method needs to be overridden so that the m_pollingBehavior flag can be set to true. Further details on this are in the Init() method's description.

GetConditionResult() will be used by the polling thread to determine if the conditions required for the rule to be 'activated' are met. When GetConditionResult() does return true, all of the child rules (if any) are started. Once the child rules have completed, this rule will complete itself.

Un-polled Mode
When not running in polled mode, a conditional behavior rule behaves as a simple 'use-once action' rule where once un-paused, GetConditionResult() is called to do the rule's work. If it returns true, the child rules will be run through to completion and this rule will complete itself. If GetConditionResult() returns false, the rule will just complete itself without doing anything else.

Examples
All of the following rules use the ConditionalScenarioBehavior class:

  • Consist Check
  • Resource Check
  • Trigger Check
  • Variable Check
  • Disabled HUD Icon Notification
  • Driver Command Check
  • Multiple Junction Alignment Check
  • Multiple Resource Check
  • Wait for Camera View Mode
  • Wait for Click on HUD Icon
  • Wait for Derailment
  • Wait for Driver On/Off Train
  • Wait for HTML Pages
  • Wait on Minimap Screen/Main Screen
  • Wait on Train Stop/Start
  • Wait on Waybill Screen/Main Screen
See also:
ScenarioBehavior

Member Function Documentation

void ConditionalScenarioBehavior.ExecuteRule ( void )

Gets this rule up and running.

This method is called by Pause() if the rule is being un-paused to get the rule running.

If polling behavior is enabled for this conditional rule, the ThreadPollCondition() is called to start the main polling thread.

If polling behavior is not enabled and this rule's conditions are satisfied (i.e. GetConditionResult() returns true), all child rules will be reset with ResetChildren() and started by calling UpdateChildren().

Otherwise, the child rules will be paused by calling PauseChildren() and this rule completes itself by calling SetComplete(true).

bool ConditionalScenarioBehavior.GetConditionResult ( void )

Action/verification method that must be implemented by the programmer to make a conditional rule.

This is the method of the conditional rule that the script programmer must implement. What this method does is largely up to the programmer. Depending on whether this rule is running in polled mode or not determines how you will go about programming this method.

If the conditional rule is running in polled mode, then ThreadPollCondition() will keep calling this method every second to see if the rule's conditions are satisfied. Your implementation should return b> true if the conditions of your rule have been satisfied so ThreadPollCondition() knows when it can move on and run the child rules etc.

If the conditional rule is not running in polled mode, this method will be called by ExecuteRule() just once to perform the rule's required actions. If true is returned (i.e. the actions were successful), the child rules will be run. Otherwise this rule will be completed without doing anything further.

Returns :
Should return true if the rule's conditions are satisfied, false otherwise.

public void ConditionalScenarioBehavior.Init ( Asset p_self ) [inline]

Main rule initialization method.

This method adds a handler to this object that will update all child rules (if any) when there has been a change on any one of them. UpdateChildren() is the handler method used for this update.

If you want your conditional rule to support polling behavior, you will need to override this method and set the m_pollingBehavior flag to true. Make sure to call through to the overridden parent method with the inherit keyword as shown in the code example below:

     public void Init(Asset p_self)
     {
       inherited(p_self);

       m_pollingBehavior =<b> true</b>;
     }

If your rule is to have polling behavior and you want it to work with saved sessions, you will also need to set m_saveLoadRestart flag to true.

The Init() method is also where you should add any property handlers to your rule so it is configurable in the Surveyor Edit Session window.

Parameters:
p_self Asset this rule is based on.

Reimplemented from TrainzGameObject.

public void ConditionalScenarioBehavior.Pause ( bool paused ) [inline]

Pause/un-pause this conditional behavior rule.

If paused does not differ from the previous paused state of this rule, this method will return straight away without doing anything. Otherwise a change of pause state has occurred and this method will react.

If paused is true (i.e. this rule is being paused from a previously un-paused state), PauseChildren() will be called to pause any child rules.

If paused is false (i.e. this rule is being un-paused from a previously paused state), ExecuteRule() is called to go ahead and do get this rule running.

Parameters:
paused Paused state this rule is being switched to.

Reimplemented from ScenarioBehavior.

void ConditionalScenarioBehavior.PauseChildren ( void )

Pauses all of the child rules.

This method pauses all of the child rules by calling Pause(true) on each one.

Note:
Use UnpauseChildren() to un-pause the child rules.

void ConditionalScenarioBehavior.ResetChildren ( void )

Resets all of the child rules.

This method iterates through all the child rules and calls Reset() on each one.

public void ConditionalScenarioBehavior.SetProperties ( Soup soup ) [inline]

Sets the properties of this rule from the given database and gets the rule running again if needed.

In Trainz when a saved session is loaded, the Pause() method of a rule does not get called - only Init() and SetProperties(). When the rule's state is saved along with the session, its GetProperties() method will save the state of the rule's flags. When the saved session is loaded, ScenarioBehavior.SetProperties() will restore the flags to their saved state but won't restart the rule's threads or change the paused state. This means that if you want your rule to work as normal after it is restored during the loading if a saved session, you must specifically allow for this situation via your Init() and SetProperties() methods.

This method automatically handles the restarting of the rule if needed if the m_saveLoadRestart flag is set to true. This flag isn't true by default, so if you want to take advantage of this feature, you must ensure that it is set to true in your Init() method.

If this SetProperties() method is called and m_saveLoadRestart is true, it will call ExecuteRule() to get the rule running again. ExecuteRule() has safe guards in it such that even if this SetProperties() call is not part of a saved session being restored, it won't do anything erratic like start multiple threads or cause this rule to do something it has already done.

Parameters:
soup Soup database of saved properties to initialize this rule with.

Reimplemented from ScenarioBehavior.

thread void ConditionalScenarioBehavior.ThreadPollCondition ( void )

Main polling thread.

Thread that runs the rule if polling mode is enabled. It will call GetConditionResult() result every second until GetConditionResult() returns b> true. From there, the child rules will be started and once complete, this thread will complete itself.

This rule will complete once the child rules have complete themselves.

void ConditionalScenarioBehavior.UnpauseChildren ( void ) [inline]

Un-pauses all of our child rules.

This method un-pauses all of the child rules by calling Pause(false) on each one.

Note:
Use PauseChildren() to pause the child rules.

void ConditionalScenarioBehavior.UpdateChildren ( Message notUsed )

Updates the child rules.

This method is used to handle and update the child rules.

When called, if this rule is not complete or paused, any child rule that hasn't been run will be started. If the child rules have completed, this method will complete this rule.

Parameters:
notUsed Dummy argument that serves no purpose.

Member Data Documentation

bool ConditionalScenarioBehavior.m_pollingBehavior = false

Indicates whether this rule has polling behavior or not.

Set this member to true in your overridden Init() or SetProperties() method to enable polling behavior in your rule. See the main class description for more details on polling behavior.

bool ConditionalScenarioBehavior.m_pollingThreadRunning = false

Flag that indicates if the ThreadPollCondition() method is running or not.

This data member is for internal use only. Use it to determine if the polling thread is running but DO NOT play around with or set this value yourself unless you really know what you are doing!

bool ConditionalScenarioBehavior.m_saveLoadRestart = false

Indicates that SetProperties() is to re-start the main thread if needed

Allows your rule to be more save/load capable. See SetProperties() for further details.

The documentation for this class was generated from the following file:
  • ConditionalScenarioBehavior.gs


ConfigAssetGroupHandler Class Reference

Inheritance diagram for ConfigAssetGroupHandler:

HTMLPropertyGroup CheckListGroupHandler GenericListHandler RadioButtonGroupHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public string | GetConfigPrefix ()
Gets the config prefix of this config group asset handler.

public Asset | GetHostAsset ()
Gets the host Asset of this config group asset handler.

public StringTable | GetStringTable (void)
Gets the StringTable of the host Asset.

public string | GetDescriptionHTML (void)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)
public PropertyValue | GetPropertyAttribute (string propertyID, string attribute)
public void | SetPropertyAttribute (string propertyID, string attribute, PropertyValue value)

Detailed Description

A group version of ConfigAssetHandler.

This class is very similar to ConfigAssetHandler except that it allows for a group of sub-handlers. The main reasons for this class' existence is to provide the HTMLPropertyGroup capabilities in a class that also has the features of ConfigAssetHandler. As ConfigAssetHandler inherits directly from HTMLPropertyHandler, it isn't really suitable for being a group handler - hence the need for this class.

A ConfigAssetGroupHandler can contain any property handler and isn't restricted to handlers from the config asset family of classes (i.e. anything derived from either ConfigAssetHandler or this class). If however you are going to add a config asset derived handler to this group handler, it should be initialized before it is added. Like HTMLPropertyGroup, this class assumes the sub-handlers provided have already been initialized and are ready for use.

See also:
ConfigAssetHandler, HTMLPropertyGroup, CheckListGroupHandler, GenericListHandler, RadioButtonGroupHandler

Member Function Documentation

public string ConfigAssetGroupHandler.GetDescriptionHTML ( void ) [inline]

Gets a HTML description of this group handler based on all of the child handlers.

Overridden from HTMLPropertyHandler.GetDescriptionHTML() to get the HTML description of each child handler in this group for inclusion in the returned description.

Returns :
Returns a HTML description built up by gathering the descriptions of all of the child handlers.

Reimplemented from HTMLPropertyGroup.

Reimplemented in CheckListGroupHandler, and GenericListHandler.

public Soup ConfigAssetGroupHandler.GetProperties ( ) [inline]

Gets this handler's properties in a database.

Overridden from HTMLPropertyHandler.GetProperties() to save the properties of all sub handlers and then return a Soup containing a sub-database for each sub handler obtained by calling the sub handlers GetProperties() method.

Returns :
Returns a Soup database containing the saved properties of this group handler and its sub handlers.

Reimplemented from HTMLPropertyGroup.

Reimplemented in CheckListGroupHandler, RadioButtonGroupHandler, and GenericListHandler.

public PropertyValue ConfigAssetGroupHandler.GetPropertyAttribute | ( | string | propertyID,
 |  | string | attribute
 | ) | [inline]

Gets the attributes of the named property.

Overridden from HTMLPropertyHandler.GetPropertyAttribute() to get the attributes of the named property from the appropriate sub handler.

Parameters:
propertyID | Name of the property to get the attributes of. This should be a full property string with group handler and sub handler prefixes.
attribute | Attribute field.
Returns :
Returns whatever the sub handler's GetPropertyAttribute() method does, a PropertyValue that is of type NULL_TYPE otherwise.

Reimplemented from HTMLPropertyGroup.

public void ConfigAssetGroupHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset group handler.

When a config group asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Note that calling this method does not do anything to any sub-handlers. It is recommended that Init() is called on the ConfigAssetGroupHandler before any sub-handlers are added.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented in CheckListGroupHandler, CheckListGroupHandler, RadioButtonGroupHandler, RadioButtonGroupHandler, GenericListHandler, and GenericListHandler.

public void ConfigAssetGroupHandler.SetProperties ( Soup soup ) [inline]

Initializes this handler's properties from the given database.

Overridden from HTMLPropertyHandler.SetProperties() to initialize all of the sub handlers from the given Soup database. The HTMLPropertyGroup implementation of this method assumes the sub handlers have already been added to the group handler - it only initializes existing sub handlers and generally isn't meant to create new sub handlers itself (although you can do that in your own overridden implementation if you really want to).

Parameters:
soup Database of property values to initialize this handler with. Sub-databases in side this soup will be used to initialize each sub-handler.

Reimplemented from HTMLPropertyGroup.

Reimplemented in CheckListGroupHandler, RadioButtonGroupHandler, and GenericListHandler.

public void ConfigAssetGroupHandler.SetPropertyAttribute | ( | string | propertyID,
 |  | string | attribute,
 |  | PropertyValue | value
 | ) | [inline]

Sets the attributes of the named property.

Overridden from HTMLPropertyHandler.SetPropertyAttribute() to set the attributes of the named property in the appropriate sub handler.

Parameters:
propertyID | Name of the property to set the attribute of.
attribute | Attribute field.
value | Value to apply the property.

Reimplemented from HTMLPropertyGroup.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


ConfigAssetHandler Class Reference

Inheritance diagram for ConfigAssetHandler:

HTMLPropertyHandler AssetCheckListHandler CheckListPropertyHandler EnumeratedAssetHandler EnumeratedGameObjectHandler EnumeratedPropertyHandler GenericBoolHandler GenericIntNumberHandler GenericStringHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public string | GetConfigPrefix (void)
Gets the config prefix of this config asset handler.

public Asset | GetHostAsset (void)
Gets the host Asset of this config asset handler.

public StringTable | GetStringTable (void)
Gets the StringTable of the host asset.

public string | GetDescriptionHTML (void)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Detailed Description

A generic handler class that can be used to build handlers that initialize themselves from an Asset's string table.

There are two main data members in this class: the host asset and the config prefix. The host asset can be any Asset and is used to access a StringTable. The config prefix will be prefixed to a property name when accessing information from the string table. Generally a string table item will take the following form:

  • "<config-prefix>-<property-name>"
Note that there is variation of this general convention for specific purposes. This mainly happens in the various child classes and will be noted where applicable.

Once a config handler has been created, its Init() method needs to be called, otherwise this handler is of little use. Both the host asset and config prefix are set through the Init(Asset,string) method.

For the ConfigAssetHandler class, the following two optional string table items are checked for:

  • "<config-prefix>-html-prefix"
  • "<config-prefix>-html-sufix"
These two strings are simply HTML wrappers to apply to the properties page generated by GetDescriptionHTML(). Although the minimal ConfigAssetHandler implementation of GetDescriptionHTML() uses these two string values if they exist, you should not call through to this method this method in your own child class GetDescriptionHTML(). Instead, use the m_htmlPrefix and m_htmlSufix string variables yourself to build the properties page as desired.

Note that both GetProperties() & SetProperties() allow for the host asset and config prefix to be saved/loaded. However it should always be the case that these two important values are set through the Init() method. If these members are already initialized by Init(), SetProperties() will not overwrite the fresh values Init() has set.

This class works on the basis that the user takes some care and in most cases, will assume that the host asset is initialized properly. Checks are not done every living moment of this class, although there are some checks such as during initialization or the saving and loading of properties.

If your ConfigAssetHandler-derived child class is not quite working, check the Trainz log file (\Trainz\JetLog.txt) for clues.

Note:
ConfigAssetHandler and its associated child classes were mainly written as utility classes for use in the TRS2006 session rules. These classes are not part of the API or fully documented and are included for your convenience. Those who are interested can see all the class definitions and implementations in the \Trainz\scripts\ListItemPropertyHandler.gs file. Also of interest is the source code of the TRS2006 rules, many of which contain usage examples of the config asset handler family of classes.
See also:
PropertyObject.SetPropertyHandler(), HTMLPropertyGroup.AddHandler(), AssetCheckListHandler, ConfigAssetGroupHandler, CheckBoxHandler, CheckListPropertyHandler, EnumeratedAssetHandler, EnumeratedGameObjectHandler, EnumeratedMultiPropertyHandler, EnumeratedPropertyHandler, GenericBoolHandler, GenericIntNumberHandler, GenericStringHandler, RadioButtonListHandler

Member Function Documentation

public string ConfigAssetHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from HTMLPropertyHandler.

Reimplemented in GenericStringHandler, GenericIntNumberHandler, GenericBoolHandler, CheckBoxHandler, CheckListPropertyHandler, AssetCheckListHandler, RadioButtonListHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, and EnumeratedGameObjectHandler.

public Soup ConfigAssetHandler.GetProperties ( ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from HTMLPropertyHandler.

Reimplemented in GenericStringHandler, GenericIntNumberHandler, GenericBoolHandler, CheckListPropertyHandler, AssetCheckListHandler, RadioButtonListHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, and EnumeratedGameObjectHandler.

public void ConfigAssetHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented in GenericStringHandler, GenericIntNumberHandler, GenericBoolHandler, CheckBoxHandler, CheckListPropertyHandler, CheckListPropertyHandler, AssetCheckListHandler, AssetCheckListHandler, RadioButtonListHandler, RadioButtonListHandler, EnumeratedPropertyHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, EnumeratedAssetHandler, and EnumeratedGameObjectHandler.

public void ConfigAssetHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from HTMLPropertyHandler.

Reimplemented in GenericStringHandler, GenericIntNumberHandler, GenericBoolHandler, CheckListPropertyHandler, AssetCheckListHandler, RadioButtonListHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, and EnumeratedGameObjectHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


ConsistHelperInfo Class Reference

Inheritance diagram for ConsistHelperInfo:

HTMLPropertyHandler List of all members.

Public Methods

public string | GetDescriptionHTML (void)
public void | RefreshBrowser (Browser browser)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public string | GetPropertyValue (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)

Public Attributes

public VehicleDescriptor[] | vehicles = new VehicleDescriptor[0]
Array of vehicles in this consist.

bool | showInConsistMenu = true
Visibility in consist menu. This is mostly a legacy issue and not really relevant in TRS2006.

bool | couplingMask = true
Coupling mask of entire consist.

bool | decouplingMask = true
Decoupling mask of entire consist.

bool | handbrake = false
Handbrake status.

Detailed Description

Property handler that allows a train consist to be constructed and maintained.

Allows definition of a particular consist. Contains a list of vehicles where each vehicle item allows for selection of the following:

  • vehicle asset (KUID)
  • vehicle amount (amount of vehicles of this type in a row)
  • direction (forward/reverse - relative to train's forward direction)
Note:
This class was mainly written for use in the portal assets and is not a core Trainz API class.
See also:
ConsistListHelper, LoadHelperInfo, VehicleDescriptor, HTMLPropertyHandler, TrainHelperInfo

Member Function Documentation

public string ConsistHelperInfo.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from HTMLPropertyHandler.

public Soup ConsistHelperInfo.GetProperties ( void ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from HTMLPropertyHandler.

public string ConsistHelperInfo.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string [] ConsistHelperInfo.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from HTMLPropertyHandler.

public string ConsistHelperInfo.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string ConsistHelperInfo.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public string ConsistHelperInfo.GetPropertyValue ( string propertyID ) [inline]

Gets the value of the named property as a string.

This method is called by PropertyObject.GetPropertyValue() to get the value of the named property.

Parameters:
propertyID Property to get the value of.
Returns :
Returns the value of propertyID as a string (convert if necessary). The HTMLPropertyHandler implementation will always return an empty string.
See also:
PropertyObject.GetPropertyValue()

Reimplemented from HTMLPropertyHandler.

public void ConsistHelperInfo.RefreshBrowser ( Browser browser ) [inline]

Refreshes the given browser with the properties of this handler.

Parameters:
browser Browser to update.
See also:
PropertyObject.PropertyBrowserRefresh()

Reimplemented from HTMLPropertyHandler.

public void ConsistHelperInfo.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from HTMLPropertyHandler.

public void ConsistHelperInfo.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • ConsistHelperInfo.gs


ConsistListHelper Class Reference

Inheritance diagram for ConsistListHelper:

HTMLPropertyGroup List of all members.

Public Methods

public string | GetDescriptionHTML (void)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string | GetPropertyType (string propertyID)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)

Detailed Description

A group handler that allows multiple consist definitions.

This handler is an extension of HTMLPropertyGroup that allows consist definitions based on ConsistHelperInfo class to be managed.

Note:
This class was mainly written for use in the portal assets and is not a core Trainz API class.
See also:
ConsistHelperInfo, VehicleDescriptor, HTMLPropertyGroup, TrainHelperInfo

Member Function Documentation

public string ConsistListHelper.GetDescriptionHTML ( void ) [inline]

Gets a HTML description of this group handler based on all of the child handlers.

Overridden from HTMLPropertyHandler.GetDescriptionHTML() to get the HTML description of each child handler in this group for inclusion in the returned description.

Returns :
Returns a HTML description built up by gathering the descriptions of all of the child handlers.

Reimplemented from HTMLPropertyGroup.

public Soup ConsistListHelper.GetProperties ( void ) [inline]

Gets this handler's properties in a database.

Overridden from HTMLPropertyHandler.GetProperties() to save the properties of all sub handlers and then return a Soup containing a sub-database for each sub handler obtained by calling the sub handlers GetProperties() method.

Returns :
Returns a Soup database containing the saved properties of this group handler and its sub handlers.

Reimplemented from HTMLPropertyGroup.

public string ConsistListHelper.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

Overridden from HTMLPropertyHandler.GetPropertyType() to get the type of the named property from the appropriate child handler.

Parameters:
propertyID Name of the property to get the type of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyType() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public void ConsistListHelper.SetProperties ( Soup soup ) [inline]

Initializes this handler's properties from the given database.

Overridden from HTMLPropertyHandler.SetProperties() to initialize all of the sub handlers from the given Soup database. The HTMLPropertyGroup implementation of this method assumes the sub handlers have already been added to the group handler - it only initializes existing sub handlers and generally isn't meant to create new sub handlers itself (although you can do that in your own overridden implementation if you really want to).

Parameters:
soup Database of property values to initialize this handler with. Sub-databases in side this soup will be used to initialize each sub-handler.

Reimplemented from HTMLPropertyGroup.

public void ConsistListHelper.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the value of the named property.

Overridden from HTMLPropertyHandler.SetPropertyValue() to set the value of the named property on the appropriate child handler.

Parameters:
propertyID | Name of the property to set the value of. This should be a full property string with group handler and sub handler prefixes.
value | Value to set the property to.

Reimplemented from HTMLPropertyGroup.

The documentation for this class was generated from the following file:
  • ConsistListHelper.gs


Constructors Class Reference

List of all members.

Public Methods

public native Soup | NewSoup (void)
public native ProductFilter | NewProductFilter (void)
public native Browser | NewBrowser (void)
public native Menu | NewMenu (void)
public native DriverCommands | NewDriverCommands (void)
public native StringTable | GetTrainzStrings (void)
public native Asset | GetTrainzAsset (void)
public native DriverCommand | NewDriverCommand (Asset commandAsset)
public native KUIDList | NewKUIDList (void)

Detailed Description

This static class allows us to create instances 'new' a game class from within a script.

This class provides methods to create new Browser, DriverCommand, DriverCommands, KUIDList, Menu, ProductFilter and Soup objects.

The reason for having this class is that a new game class being created from within the script is not normally allowed by the GS language. However this may change in future versions of the script system.

See also:
Browser, DriverCommand, DriverCommands, KUIDList, Menu, ProductFilter, Soup

Member Function Documentation

public native Asset Constructors.GetTrainzAsset ( void )

Gets the global Trainz Asset.

Note:
This method is not really intended for use by script programmers. It is mainly used by the built-in classes.
Returns :
Returns the global Trainz Asset.

public native StringTable Constructors.GetTrainzStrings ( void )

Gets the global Trainz StringTable.

Note:
This method is not really intended for use by script programmers. It is mainly used by the built-in classes.
Returns :
Returns the global Trainz StringTable.

public native Browser Constructors.NewBrowser ( void )

Constructs a new Browser object.

Returns :
Returns a new Browser object.

public native DriverCommand Constructors.NewDriverCommand ( Asset commandAsset )

Constructs a driver command instance from the specified Asset.

This method does not add a new command to the list of available driver commands (as seen in World.GetDriverCommandList()) but simply creates a script instance for private use.

Returns :
Returns a new DriverCommand for private use.

public native DriverCommands Constructors.NewDriverCommands ( void )

Constructs an empty DriverCommands list.

Returns :
Returns a new and empty DriverCommands list.

public native KUIDList Constructors.NewKUIDList ( void )

Constructs an empty and unlocked KUIDList object.

Returns :
Returns a new KUIDList object.

public native Menu Constructors.NewMenu ( void )

Constructs and return an empty Menu object.

Note:
The menu returned is for setup purposes only, this method does not create a visual representation of the menu.
Returns :
Returns a new empty Menu object.

public native ProductFilter Constructors.NewProductFilter ( void )

Constructs an empty and unlocked ProductFilter object.

Returns :
Returns a new ProductFilter object.

public native Soup Constructors.NewSoup ( void )

Constructs an empty and unlocked Soup object.

Returns :
Returns a new Soup object.

The documentation for this class was generated from the following file:
  • Constructors.gs


ControlSettingsManager Class Reference

List of all members.

Public Methods

public int | FindIndex (string nameTest)
public void | AddControl (string name, float value)
public void | UpdateCabin (Cabin cabinToUpdate)

Public Attributes

public CabinControlSetting[] | controlSettings = new CabinControlSetting[0]
The control settings this class manages.

Detailed Description

Manager for a set of cabin control settings.

This utility class manages a collection of simplified cabin control settings and includes the functionality to automatically update a cabin via the UpdateCabin() method. Use is not compulsory but it can automate tasks related to saving & loading the position of a cabin's controls.

The DefaultSteamCabin class as seen in the \Trainz\scripts\DefaultSteamCabin.gs file makes use of this class.

Note:
More details about the saving and loading of cabin data can be found in the description of the CabinData class.
See also:
CabinControlSetting, Cabin, CabinControl, CabinData, DefaultSteamCabin

Member Function Documentation

public void ControlSettingsManager.AddControl | ( | string | name,
 |  | float | value
 | ) | [inline]

Adds the specified control to this manager's list.

Parameters:
name | Name of the control. If a control of this name already exists, its setting will be overwritten with value.
value | Value of the control.

public int ControlSettingsManager.FindIndex ( string nameTest ) [inline]

Finds the index to a control setting by name.

Parameters:
nameTest Name of the control to get the index to.
Returns :
Returns the index to the control setting specified by nameTest that is suitable for use with the controlSettings array if such a control setting exists, -1 otherwise.

public void ControlSettingsManager.UpdateCabin ( Cabin cabinToUpdate ) [inline]

Updates the controls of the given Cabin based on the specifications of this control manager's list.

This method cycles through this manager's controls list and if an actual cabin control from cabinToUpdate is found that matches the name of a control setting in this manager, the value of the control from cabinToUpdate will be updated.

Parameters:
cabinToUpdate Cabin to update the controls of.
See also:
Cabin.GetControls(), CabinControl.SetValue()

The documentation for this class was generated from the following file:
  • Cabin.gs


Crossing Class Reference

Inheritance diagram for Crossing:

SceneryWithTrack List of all members.

Public Methods

public native void | SetCrossingState (int crossingState)
public native int | GetCrossingState (void)
public native void | SetCrossingAutomatic (bool automatic)
public native bool | GetCrossingAutomatic (void)
public native bool | GetCrossingHasNearbyTrain (void)

Public Attributes

Crossing States

Different states a Crossing can be in.

The two main states a crossing can be in are CROSSING_STATE_OPEN and CROSSING_STATE_CLOSED. CROSSING_STATE_CLOSING and CROSSING_STATE_OPENING are temporary transitional states used to indicate the crossing is switching between the two main states.

See also:
Crossing.GetCrossingState(), Crossing.SetCrossingState()

public define int | CROSSING_STATE_OPEN = 0
Crossing is open, Carz are free to travel across this crossing.

public define int | CROSSING_STATE_CLOSING = 1
Crossing closing, Carz will not enter this crossing.

public define int | CROSSING_STATE_CLOSED = 2
Crossing is closed, Carz will not enter this crossing.

public define int | CROSSING_STATE_OPENING = 3
Crossing in process of opening up, Carz will not enter this crossing until it is open.

Detailed Description

Crossing class. An interface to operate a crossing is provided.

By default a crossing is automatically controlled by Trainz. When a Train is within 200 meters of the crossing, it will be closed and the Carz won't cross the track. The crossing will go back to an open state where the Carz can cross the track once there are no trains within 200 meters of any of the crossing.

This class allows a crossing asset with custom scripted behavior to be created so the default behavior described above can be disabled and a script can take control the crossing as the programmer desires. For example, triggers at varying distances could be used to activate the crossing so you can get around the default 200 meter boundary. This does however mean that you will need to find a way to get your crossing configured to monitor the desired triggers and react to trains accordingly.

To get a reference to a crossing item on the map, use Router.GetGameObject(string) and cast to this class. Make sure it has been named in Surveyor first.

Not all of the messages SceneryWithTrack supports apply to crossings. Messages supported by this class are:

Major | Minor | Source | Destination | Description
"Object" | "Enter" | crossing | crossing | Train has entered this crossing's activation area.
"Object" | "Leave" | crossing | crossing | Train has left this crossing (i.e. last vehicle has exited activation area).

See also:
Industry, SceneryWithTrack, Turntable, Train

Member Function Documentation

public native bool Crossing.GetCrossingAutomatic ( void )

Determines if this crossing is being automatically run by Trainz or under manual script control.

Returns :
Returns true if this crossing is operating in an automatic, game controlled mode, false otherwise.

public native bool Crossing.GetCrossingHasNearbyTrain ( void )

Determines if there are any trains nearby and within range of this crossing.

Returns :
Returns true if a Train is nearby to this crossing.

public native int Crossing.GetCrossingState ( void )

Gets the current state of this crossing.

Note that if this crossing is in automatic mode, its state can change after this method has been called.

Returns :
Returns the current state of this crossing.

public native void Crossing.SetCrossingAutomatic ( bool automatic )

Sets whether this crossing will change states automatically in response to trains.

Parameters:
automatic Use true to make this crossing behave automatically, false to disregard trains and be controlled by script code (i.e. using SetCrossingState() to change the state of the crossing manually).

public native void Crossing.SetCrossingState ( int crossingState )

Sets the state of this crossing.

This method allows the crossing's current state to be explicitly changed via a script. Before setting the state of a crossing manually with this method, the automatic mode of the crossing needs to set to false via SetCrossingAutomatic().

Parameters:
crossingState State to set the crossing to. Use one of the crossing states values for this parameter.
See also:
Crossing States

The documentation for this class was generated from the following file:
  • Crossing.gs


CustomCommand Class Reference

Inheritance diagram for CustomCommand:

AiHornMsg List of all members.

Public Methods

public bool Execute (Train train, int px, int py, int pz)

Detailed Description

Custom command for a train schedule.

CustomCommand allows you to define your own custom schedule commands. To do this, inherit this class and override the Execute() method. Use Schedule.Custom(CustomCommand) or Schedule.Custom(CustomCommand,int,int,int) to add a custom command to a schedule.

See also:
Command, DriverCommand, DriverScheduleCommand, Schedule

Member Function Documentation

public bool CustomCommand.Execute | ( | Train | train,
 |  | int | px,
 |  | int | py,
 |  | int | pz
 | ) | [inline]

Called by a train object when running the schedule.

Parameters:
train | Train the schedule is running on.
px | Handy parameter. User implementation can use this for any purpose.
py | Another spare handy parameter.
pz | Another spare handy parameter.
Sets these parameters when adding a custom command to the schedule.

Returns :
User implementation should return true on success, false otherwise.

Reimplemented in AiHornMsg.

The documentation for this class was generated from the following file:
  • schedule.gs


DefaultLocomotiveCabin Class Reference

Inheritance diagram for DefaultLocomotiveCabin:

Cabin List of all members.

Public Methods

public void | Init (void)
public void | Attach (GameObject obj)
public float | GetPressureParam (string param)
public void | Update (void)
void | UserSetControl (CabinControl control, float value)
void | UserPressKey (string s)

Public Attributes

Locomotive loco
Locomotive this cabin is attached to.

Locomotive Cabin Controls

Cabin controls for the levers and gauges in a generic diesel or electric locomotive cab.

These object references provide access to the gauge/lever instruments in the cabin of a diesel or electric loco. They are initialized and associated with their controls by the Init() method and used throughout this class to manage the cab.

See also:
DefaultLocomotiveCabin.Init()

CabinControl speedometer
Speed indicator.

CabinControl main_reservoir_needle
Main reservoir needle.

CabinControl brake_cylinder0_needle
Brake cylinder needle 0.

CabinControl brake_cylinder1_needle
Brake cylinder needle 1.

CabinControl no3_pipe_needle
Number 3 pipe needle.

CabinControl brake_pipe_needle
Brake pipe needle.

CabinControl equaliser_needle
Equalizer needle.

CabinControl flow_needle
Flow needle.

CabinControl ampmeter_needle0
Amp meter needle 0.

CabinControl ampmeter_needle1
Amp meter needle 1.

CabinControl throttle_lever
Throttle lever.

CabinControl reverser_lever
Reverser lever.

CabinControl train_brake_lever
Brake lever for entire train.

CabinControl train_lapbrake_lever
Train lap-brake lever.

CabinControl loco_brake_lever
Brake lever for loco brakes only.

CabinControl dynamic_brake_lever
Dynamic brake lever.

CabinControl wheelslip_light
Wheel slip indicator light.

CabinControl horn_rope
Rope to blow horn with.

CabinControl pantograph_lever
Pantograph control lever.

CabinControl light_switch
Locomotive light switch.

Detailed Description

A default locomotive cabin suitable for both diesel and electric locos.

This Cabin-derived class provides the framework for building a generic locomotive cabin as it already contains many generic levers and controls common to diesel and electric locos.

Although documented, the real details of this class manages the controls of a steam loco cabin can be found in the implementations that can seen in the \Trainz\scripts\DefaultLocomotiveCabin.gs script file.

To get this class working with your own cabin, little implementation is required. You will to write your own overridden methods if you want your cabin to have fancy custom controls that this cabin doesn't have.

See the UP DD40 cabin for an example of a cabin built with this class.

See also:
Cabin, CabinControl, DefaultSteamCabin, Locomotive

Member Function Documentation

public void DefaultLocomotiveCabin.Attach ( GameObject obj ) [inline]

Attaches this cabin to a game object (i.e. a Locomotive).

This method is called by Trainz when it is about to either attach or detach this cabin to an object.

Because a cabin is destroyed when it is no longer needed and re-created by Trainz later on if needed again, this method is where you should restore the cabin control settings. A Locomotive object has a cache of cabin control settings that can be saved to when the cabin is updated. However the programmer needs to update and make use of cabin settings in their implementation of this method (and possibly Update() as well).

Parameters:
obj Game object to attach this cabin to (usually a Locomotive).
Note:
Both the DefaultLocomotiveCabin and DefaultSteamCabin cabins contain good example implementations of this method.
See also:
Locomotive.GetCabinData()

Reimplemented from Cabin.

public float DefaultLocomotiveCabin.GetPressureParam ( string param ) [inline]

Used by Update() in pressure calculations.

The default locomotive configuration uses kPa to describe pressure dial ranges. This method converts from g/m^3 into kPa-above-atmospheric.

Parameters:
param Name of the engine parameter to convert.

public void DefaultLocomotiveCabin.Init ( void ) [inline]

Initializes all of the controls in this cabin.

This method makes sure all of the cabin controls in this cab are initialized and ready for use by script code throughout this class.

See also:
Locomotive Cabin Controls

Reimplemented from Cabin.

public void DefaultLocomotiveCabin.Update ( void ) [inline]

Called to update the cabin.

The DefaultLocomotiveCabin implementation of this method updates the controls of this cabin so they correspond to the loco this cabin is attached to.

Reimplemented from Cabin.

void DefaultLocomotiveCabin.UserPressKey ( string s ) [inline]

Called when user has pressed a key in this cabin.

The default Cabin implementation does not handle any keystrokes. You must do so in your own overridden implementation.

Parameters:
s Name of the key user has pressed. This is a name for the keystroke, not the actual key.

Reimplemented from Cabin.

void DefaultLocomotiveCabin.UserSetControl | ( | CabinControl | control,
 |  | float | value
 | ) | [inline]

Called by Trainz when the user sets a cabin control.

This method updates the loco this Cabin is attached so it (the loco) can respond to one of the cabin controls being manipulated.

Parameters:
control | Control that user has set.
value | Value control is set to.

Reimplemented from Cabin.

The documentation for this class was generated from the following file:
  • DefaultLocomotiveCabin.gs


DefaultSteamCabin Class Reference

Inheritance diagram for DefaultSteamCabin:

Cabin List of all members.

Public Methods

public void | UpdateCabinFromSavedData (CabinData cd)
public DefaultSteamCabinData | CreateCabinSavedData (void)
void | FiremanShovelCoal (void)
Instructs the fireman to shovel coal.

void | AnimateFiremanShovelCoal (void)
Animation support method used by FiremanShovelCoal().

void | FiremanWave (void)
Instructs the fireman to wave out the window.

void | AnimateFiremanWave (void)
Animation support method used by FiremanWave().

public void | Init (void)
public void | Attach (GameObject obj)
public float | GetPressureParam (string param)
public void | Update (void)
void | UserSetControl (CabinControl p_control, float p_value)
void | UserPressKey (string s)

Public Attributes

Locomotive loco
Locomotive this cabin is attached to.

Steam Cabin Needles

Cabin controls for the needles in a steam locomotive cab.

These object references provide access to the needle/gauge instruments in the cabin of a steam loco. They are initialized and associated with their controls by the Init() method and used throughout this class to manage the cab.

See also:
DefaultSteamCabin.Init(), Steam Cabin Levers, Miscellaneous Steam Cabin Controls

CabinControl speedometer
Speedometer.

CabinControl main_reservoir_needle
Main reservoir.

CabinControl brake_cylinder0_needle
Brake cylinder 1.

CabinControl brake_cylinder1_needle
Brake cylinder 2.

CabinControl no3_pipe_needle
Pipe needle.

CabinControl brake_pipe_needle
Brake pipe.

CabinControl equaliser_needle
Equaliser.

CabinControl flow_needle
Flow.

CabinControl waterGlassLeft_dial
Left water glass.

CabinControl waterGlassRight_dial
Right water glass.

CabinControl firebox
Fire box.

CabinControl boiler_needle
Boiler needle 1.

CabinControl boiler_needle1
Boiler needle 2.

Steam Cabin Levers

Cabin controls for the levers in a steam locomotive cab.

These object references provide access to the control levers in the cabin of a steam loco. They are initialized and associated with their controls by the Init() method and used throughout this class to manage the cab.

See also:
DefaultSteamCabin.Init(), Steam Cabin Needles, Miscellaneous Steam Cabin Controls

CabinControl reverser_lever
Reverser lever.

CabinControl train_brake_lever
Train brakes.

CabinControl train_lapbrake_lever
Train lap brakes.

CabinControl loco_brake_lever
Loco brakes.

CabinControl horn_rope
Whistle rope.

CabinControl light_switch
Light switch.

CabinControl regulator_lever
Regulator/throttle lever.

CabinControl fire_plates
Fire plates.

CabinControl waterInjector0
Water injector 1.

CabinControl waterInjector1
Water injector 2.

CabinControl blower_lever
Blower lever.

Miscellaneous Steam Cabin Controls

Miscellaneous controls and items in the steam loco cab.

These object references provide access to some of the various miscellaneous items found in the cabin of a steam loco. They are initialized and associated with their controls by the Init() method and used throughout this class to manage the cab.

See also:
DefaultSteamCabin.Init(), Steam Cabin Needles, Steam Cabin Levers

CabinControl left_window
Left window.

CabinControl right_window
Right window.

CabinControl left_sliding_window
Left sliding window.

CabinControl right_sliding_window
Right sliding window.

CabinControl seat0
Seat 1.

CabinControl seat1
Seat 2.

CabinControl sanding_lever
Sanding lever.

CabinControl whistle_lever
Whistle lever.

CabinControl blowdown_lever
Blowdown lever.

Detailed Description

A generic cabin suitable for use in a steam locomotive.

This Cabin-derived class provides the framework for building a steam locomotive cabin as it already contains many generic levers and controls steam locos have.

Although documented, the real details of this class manages the controls of a steam loco cabin can be found in the implementations that can seen in the \Trainz\scripts\DefaultSteamCabinData.gs script file.

To get this class working with your own steam cabin, little implementation is required. You will however need to write your own overridden methods if you want your cabin to have fancy custom controls that this cabin doesn't have.

See the Bigsteam (UP Big Boy) and QR PB15 asset source for examples of interiors built with this class.

See also:
DefaultSteamCabinData, DefaultLocomotiveCabin, Locomotive, CabinData

Member Function Documentation

public void DefaultSteamCabin.Attach ( GameObject obj ) [inline]

Attach this cabin to a game object (i.e. a locomotive).

This overridden method ensures that the settings of the cabin's controls are restored from the loco's cabin data so the cabin appears in the same state it was when the user left. The UpdateCabinFromSavedData() method will be called to do this.

Parameters:
obj Game object to attach this cabin to (usually a Locomotive).

Reimplemented from Cabin.

public DefaultSteamCabinData DefaultSteamCabin.CreateCabinSavedData ( void )

Gets the state of this cabin's controls in simple object for saving.

On first creating the cabin, this method is called to create an appropriate scratch storage space for cabin control settings. The returned object will be used by Attach() to save the control settings to the loco with Locomotive.SetCabinData().

Returns :
Returns a DefaultCabinData object which contains the settings of all of this cabin's controls in a simplified format.
See also:
DefaultSteamCabinData, Locomotive.SetCabinData()

public float DefaultSteamCabin.GetPressureParam ( string param ) [inline]

Used by Update() in pressure calculations.

The default locomotive configuration uses kPa to describe pressure dial ranges. This method converts from g/m^3 into kPa-above-atmospheric.

Parameters:
param Name of the engine parameter to convert.
See also:
Locomotive.GetEngineParam()

public void DefaultSteamCabin.Init ( void ) [inline]

Initializes all of the controls in this cabin.

This method makes sure all of the cabin control references from the miscellaneous, cabin levers and needles collections are initialized for use by script code throughout this class.

See also:
Miscellaneous Steam Cabin Controls, Steam Cabin Levers, Steam Cabin Needles

Reimplemented from Cabin.

public void DefaultSteamCabin.Update ( void ) [inline]

Called by Trainz to update the cabin.

The DefaultSteamCabin implementation of this method updates the controls of this cabin so they correspond to the loco this cabin is attached to. The loco's cabin data is also updated from this method so the loco has a cached copy of this cabin's settings that can be retrieved by Attach() to re-initialize the cabin.

Reimplemented from Cabin.

public void DefaultSteamCabin.UpdateCabinFromSavedData ( CabinData cd )

Updates this cabin's controls from the given cabin data.

This method is called by Attach() when the cabin has been re-created to reset the control and dial positions to match the user's previous selections.

Parameters:
cd Cabin data to reset the controls of this cabin with.
See also:
DefaultSteamCabinData, Locomotive.GetCabinData()

void DefaultSteamCabin.UserPressKey ( string s ) [inline]

Called by Trainz when user has pressed a key in this cabin.

The DefaultSteamCabin implementation of this method is responsible for animating the fireman and updating the steam loco-specific controls.

Parameters:
s Name of the key user has pressed. This is a name for the keystroke, not the actual key.

Reimplemented from Cabin.

void DefaultSteamCabin.UserSetControl | ( | CabinControl | p_control,
 |  | float | p_value
 | ) | [inline]

Called by Trainz when the user sets a cabin control.

This method updates the loco this Cabin is attached so it (the loco) can respond to p_control being manipulated by the user.

Parameters:
p_control | Control that the user has set.
p_value | Value that p_control is set to.

Reimplemented from Cabin.

The documentation for this class was generated from the following file:
  • DefaultSteamCabin.gs


DefaultSteamCabinData Class Reference

Inheritance diagram for DefaultSteamCabinData:

CabinData List of all members.

Public Attributes

public float | fire_plates_val
Fire plates setting.

public float | left_window_val
Left side cabin window.

public float | right_window_val
Right side cabin window.

public float | left_sliding_window_val
Left side sliding cabin window.

public float | right_sliding_window_val
Right side sliding cabin window.

public float | seat0_val
Movable seat 1.

public float | seat1_val
Movable seat 2.

public float | sanding_lever_val
Sanding lever.

public float | whistle_lever_val
Whistle lever.

public float | regulator_lever_val
Regulator/throttle lever.

public float | blowdown_lever_val
Blowdown lever.

public bool | fireboxDoorOpen
Firebox door open/close state.

public ControlSettingsManager | ctrlManager = new ControlSettingsManager()
Extra controls.

Detailed Description

Cabin data for the DefaultSteamCabin.

This class provides simplified storage for the values of the various controls that are particular to a generic steam locomotive. It is used by the DefaultSteamCabin class to save the state of its steam-specific controls to the Locomotive so that when the cabin is destroyed and later re-created, it's controls will be in the same state the user left them in.

See also:
DefaultSteamCabin, Cabin, CabinData, Locomotive.GetCabinData()

The documentation for this class was generated from the following file:
  • DefaultSteamCabin.gs


DriverCharacter Class Reference

Inheritance diagram for DriverCharacter:

ModuleScript List of all members.

Public Methods

public native void | ReissueLastCommand (void)
Issues the previous command for this driver to follow.

public native void | IssueNextCommand (void)
Issues the next command for this driver to follow.

public native void | SetLocation (GameObject location)
public native GameObject | GetLocation (void)
public native string | GetLocalisedName (void)
public native void | SetLocalisedName (string name)
public void | DriverIssueSchedule (void)
public Train | GetTrain (void)
public native DriverCommands | GetDriverCommands (void)
public native void | SetDriverCommands (DriverCommands driverCommands)
public native void | SetDriverCommandFilter (KUID[] allowedCommands)
public native KUID[] | GetDriverCommandFilter (void)
public void | Init (Asset self)
public bool | IsRunningCommand (void)
public native void | SetRunningCommands (bool enable)
public void | DriverTakeJunction (Junction junction, int direction)
public void | DriverVisitScenery (string sceneryName)
public void | DriverVisitTrackMark (TrackMark trackMark)
public void | DriverThroughTrackMark (TrackMark trackMark)
public void | DriverVisitTrack (Track track)
public void | DriverCoupleVehicle (Vehicle vehicle)
public void | DriverTurnAround (void)
public void | DriverCompleteJunctions (void)
public void | DriverCustomCommand (CustomCommand cmd)
public void | DriverSetAllowCoupling (bool allowCoupling, Train limitTrain)
public void | DriverBeginIssueSchedule (void)
Called when Trainz is about to issue a new schedule to reset any existing partially-issued schedule.

public void | DriverDriveForever (void)
public native void | AddDriverScheduleCommand (DriverScheduleCommand cmd)
public native bool | NavigateToIndustry (Industry industry, string attachedTrackName)
public native bool | NavigateToVehicle (Vehicle vehicle)
public native bool | NavigateToVehicle (Vehicle vehicle, bool directionRelativeToVehicle)
public native bool | NavigateToTrackside (Trackside trackside)
public native bool | NavigateThroughTrackside (Trackside trackside)
public void | NotifyUser (int msg)

Public Attributes

Driver Stuck States

Stuck states a driver can be in.

See also:
DriverCharacter.NotifyUser()

public define int | TRAIN_IS_STUCK = 1
This driver's train is stuck.

public define int | TRAIN_NOT_STUCK = 2
This driver's train is not stuck.

Detailed Description

A driver character is a driver asset that can be attached to a Vehicle and drive the Train by following a schedule.

For each driver character asset found, Trainz creates a DriverCharacter object that is now part of the list of drivers in World. Drivers can be added and removed from World through the World.AddDriverCharacter() and World.RemoveDriverCharacter() methods. A list of all drivers that currently exist in the Trainz world can be obtained by calling World.GetDriverCharacterList().

Messages sent from a DriverCharacter game object are:
Major | Minor | Source | Destination | Description
"DriverCharacter" | "LeftTrain" | driver | broadcast | Driver has left a locomotive.
"DriverCharacter" | "BoardedTrain" | driver | broadcast | Driver has been assigned to a locomotive.
"DriverCharacter" | "Created" | driver | broadcast | Driver has been newly created.

See also:
DriverCommands, DriverCommand, DriverScheduleCommand, Schedule, Locomotive.SetHasDriver(), Train.GetActiveDriver(), World.AddDriverCharacter(), World.GetDriverCharacterList(), World.RemoveDriverCharacter()

Member Function Documentation

public native void DriverCharacter.AddDriverScheduleCommand ( DriverScheduleCommand cmd )

Adds the given driver schedule command to this driver's schedule.

Parameters:
cmd Driver schedule command to add.

public void DriverCharacter.DriverCompleteJunctions ( void ) [inline]

Adds a command to this driver's schedule telling it to complete all junctions.

See also:
Schedule.CompleteJunctions()

public void DriverCharacter.DriverCoupleVehicle ( Vehicle vehicle ) [inline]

Adds a command to this driver's schedule telling it to couple up with the given target vehicle.

Parameters:
vehicle Target vehicle to couple up with.
See also:
Schedule.CoupleVehicle()

public void DriverCharacter.DriverCustomCommand ( CustomCommand cmd ) [inline]

Adds the given custom command to this driver's schedule.

Parameters:
cmd Custom command to add to this driver's schedule.
See also:
Schedule.Custom()

public void DriverCharacter.DriverDriveForever ( void ) [inline]

Adds a command to this driver's schedule telling the driver to keep driving on forever.

See also:
Schedule.DriveForever()

public void DriverCharacter.DriverIssueSchedule ( void )

Stops the trains current schedule to this driver's schedule is ready to run.

If the train this driver is on is already running a schedule, that schedule will be stopped so this driver's schedule can be started.

See also:
Train.IsScheduleRunning(), Train.StopSchedule()

public void DriverCharacter.DriverSetAllowCoupling | ( | bool | allowCoupling,
 |  | Train | limitTrain
 | ) | [inline]

Allows/disallows this driver from coupling to another train.

Parameters:
allowCoupling | Flag indicating if coupling by this driver is allowable (true) or not (false).
limitTrain | Train to limit coupling to.

public void DriverCharacter.DriverTakeJunction | ( | Junction | junction,
 |  | int | direction
 | ) | [inline]

Adds a command to this driver's schedule telling it to take the train through the given junction in the specified direction.

Parameters:
junction | Junction to take the train through. Use Router.GetGameObject() to get a reference to a junction by name.
direction | Direction to take through junction. See Junction States for details.
See also:
Schedule.TakeJunction()

public void DriverCharacter.DriverThroughTrackMark ( TrackMark trackMark ) [inline]

Adds a command to this driver's schedule telling it to take the train to the given TrackMark but NOT stop.

Parameters:
trackMark TrackMark to drive to.

public void DriverCharacter.DriverTurnAround ( void ) [inline]

Adds a commands to this driver's schedule telling it to complete all junctions and then to change the conceptual direction of the train (i.e. forward is now reverse).

See also:
Schedule.CompleteJunctions(), Schedule.ReverseTrain()

public void DriverCharacter.DriverVisitScenery ( string sceneryName ) [inline]

Adds a command to this driver's schedule telling it to take the train to the given scenery object and stop.

Parameters:
sceneryName Name of the scenery object to drive to. Must be a Buildable object (or any type that inherits from Buildable such as Industry).
See also:
Schedule.StopAtScenery()

public void DriverCharacter.DriverVisitTrack ( Track track ) [inline]

Adds a command to this driver's schedule telling it to take the train through the given track.

Parameters:
track Track to get a permit for.
See also:
Schedule.TakeTrackPermit()

public void DriverCharacter.DriverVisitTrackMark ( TrackMark trackMark ) [inline]

Adds a command to this driver's schedule telling it to take the train to the given TrackMark and stop.

Parameters:
trackMark Track mark to drive to.
See also:
Schedule.StopAtScenery()

public native KUID [] DriverCharacter.GetDriverCommandFilter ( void )

Gets the KUIDs of the driver commands the user is allowed to use with this DriverCharacter.

Returns :
Returns a copy of the command limitations as specified in SetDriverCommandFilter().

public native DriverCommands DriverCharacter.GetDriverCommands ( void )

Gets the current schedule of driver commands.

Returns :
Returns the DriverCommands object for this driver character which has the current commands schedule.

public native string DriverCharacter.GetLocalisedName ( void )

Gets the localised name of this driver asset.

Note:
The localised name may be different from the unique name provided by GameObject.GetName().
Returns :
Returns the localised name of this driver character's asset.

public native GameObject DriverCharacter.GetLocation ( void )

Gets the Vehicle this driver character is currently attached to.

Returns :
Returns the Vehicle game object this driver is currently attached to, null otherwise.

public Train DriverCharacter.GetTrain ( void ) [inline]

Gets the train that this driver is currently active on.

Returns :
Returns the train on which this driver is active, otherwise null if this driver isn't active on any train.

public void DriverCharacter.Init ( Asset self ) [inline]

Initialize this driver character.

This method is called by Trainz to initialize this driver character. When called, a thread to run a Schedule for the driver character will be started.

Parameters:
self Driver character asset.

Reimplemented from TrainzGameObject.

public bool DriverCharacter.IsRunningCommand ( void ) [inline]

Determines if this driver is currently executing a command.

Returns :
Returns true if this driver is running a command, false otherwise.

public native bool DriverCharacter.NavigateThroughTrackside ( Trackside trackside )

Instructs this driver character to take its train through the given Trackside object.

This method is the same as NavigateToTrackside() except that it won't slow down as it reaches the destination. It was intended for the Drive Via Trackmark command.

Note:
This method is restricted to types of trackside object that have trigger behaviour. Currently only TrackMark objects supported, although other types will be added in the future.
Parameters:
trackside Track side item to navigate through to.
Returns :
Returns true if successful, false otherwise.

public native bool DriverCharacter.NavigateToIndustry | ( | Industry | industry,
 |  | string | attachedTrackName
 | ) |

Instructs this driver character to take its train to the specified track on the given industry.

Parameters:
industry | Industry to drive to.
attachedTrackName | Name of destination track in industry to drive to.
Returns :
Returns true if successful added to this driver's schedule, false otherwise.

public native bool DriverCharacter.NavigateToTrackside ( Trackside trackside )

Instructs this driver character to take its train to the given Trackside object.

Note:
This method is restricted to types of trackside object that have trigger behaviour. Currently only TrackMark objects supported, although other types will be added in the future.
Parameters:
trackside Track side item to navigate to.
Returns :
Returns true if successful, false otherwise.

public native bool DriverCharacter.NavigateToVehicle | ( | Vehicle | vehicle,
 |  | bool | directionRelativeToVehicle
 | ) |

Instructs this driver character to couple up with the given vehicle from a set direction.

This command will only succeed if the target vehicle is not running a schedule and isn't moving. As well as that, both the train this driver character is attached to and vehicle must permit coupling. It is also expected that the front or back of vehicle that this drivers train is being instructed to couple with is not already coupled to another vehicle.

Parameters:
vehicle | Target vehicle to couple up with.
directionRelativeToVehicle | Defines which end of vehicle this driver's train couples to. Use true to couple to the front of vehicle, false for the back.
Returns :
Returns true if successful, false otherwise.

public native bool DriverCharacter.NavigateToVehicle ( Vehicle vehicle )

Instructs this driver character to couple up with the given vehicle.

This command will only succeed if the target vehicle is not running a schedule and isn't moving. As well as that, both the train this driver character is attached to and vehicle must permit coupling.

Parameters:
vehicle Target vehicle to couple up with.
Returns :
Returns true if successful added to this driver's schedule, false otherwise.

public void DriverCharacter.NotifyUser ( int msg ) [inline]

Notifies the user through the Trainz interface if this train is stuck or not.

If msg is equal to TRAIN_IS_STUCK, the alert image appears in the driver character's icon in Driver so the user knows. Otherwise if msg is TRAIN_NOT_STUCK, then the alert icon will be turned off.

This method may be overridden to play an appropriate radio message for example. Just make sure to call through to the parent method with the inherited keyword.

Parameters:
msg Stuck state this driver is in.
See also:
Driver Stuck States

public native void DriverCharacter.SetDriverCommandFilter ( KUID allowedCommands[] )

Restricts the commands the user can access for this DriverCharacter.

Note:
Restrictions applied by this method do not affect any existing commands already queued.
Parameters:
allowedCommands Array of KUIDs of driver commands that this driver will have available in its right-click menu. If null, this driver will allow all available commands. If an empty array is provided, no driver commands will be available.

public native void DriverCharacter.SetDriverCommands ( DriverCommands driverCommands )

Sets this driver to use the specified DriverCommands object as its commands schedule.

Parameters:
driverCommands Schedule of driver commands for this driver character to perform.

public native void DriverCharacter.SetLocalisedName ( string name )

Sets the localised name for this driver asset.

Parameters:
name Localised name that this driver asset now has.

public native void DriverCharacter.SetLocation ( GameObject location )

Sets the Vehicle this driver character is currently attached to.

A driver character can only be attached to one object at any one time so if it is already attached to another object, calling this method removes it from whatever it is currently attached to.

Parameters:
location Object to attach this driver character to. Must be of type Vehicle or a class derived from Vehicle such as Locomotive.

public native void DriverCharacter.SetRunningCommands ( bool enable )

Enable or disable the running of commands on the schedule by this driver character.

Parameters:
enable Flag indicating whether to enable (true) or disable (false) the running of commands by this driver.

The documentation for this class was generated from the following file:
  • DriverCharacter.gs


DriverCommand Class Reference

Inheritance diagram for DriverCommand:

GameObject List of all members.

Public Methods

public void | Init (Asset asset)
public Asset | GetAsset (void)
public void | AddCommandMenuItem (DriverCharacter driver, Menu menu)
public DriverScheduleCommand | CreateScheduleCommand (DriverCharacter driver, Soup soup)
public DriverCommands | GetDriverCommands (Message commandMessage)

Detailed Description

Base class for a driver command asset.

This is the parent class that all driver command assets are to inherit from. The DriverCommand class is responsible for providing the contents of the command for the right-click menu in Driver and creating a DriverScheduleCommand object so the driver character can run the command.

The DriverCommand script should generally add a DriverScheduleCommand to the DriverCharacter's schedule if its menu item is chosen. This action may be delayed by something such as bringing up a Browser window. See Menu for details on the notification of chosen items.

The DriverScheduleCommand is the doing part of a driver command asset. An instance of a DriverScheduleCommand object is created and given to a driver character to perform. The implementation of the DriverScheduleCommand methods will dictate what the command actually does, hence all driver command assets require a DriverScheduleCommand-derived class as well.

All of the Auran provided driver commands contain an example implementation of this class as well as an accompanying DriverScheduleCommand-derived class.

See also:
CustomCommand, DriverCharacter, DriverScheduleCommand, GameObject, World.AddDriverCommand(), World.FindDriverCommand(), World.GetDriverCommandList(), World.RemoveDriverCommand()

Member Function Documentation

public void DriverCommand.AddCommandMenuItem | ( | DriverCharacter | driver,
 |  | Menu | menu
 | ) |

Adds this command as a menu item for a driver character.

It is up to the script programmer to decide if they even want to their command to appear on a driver character's menu. If desired, more than one menu item can be added to menu as well as sub-menus to these menu items. However, creating deep menu hierarchies is generally discouraged.

As an example, consider this implementation from the Load command:

     public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
     {
       StringTable strTable = GetAsset().GetStringTable();

       if (!driver or driver.GetTrain())
         menu.AddItem(strTable.GetString("driver_command_load"), me, "LoadProduct", "Load");
     }

Note how a message of type ("LoadProduct", "Load") is sent to this DriverCommand when the menu item is clicked. It will be up to this DriverCommand object to listen out for such messages. The best way is to add a handler method in Init() for the type of Menu message being used.

Parameters:
driver | Driver to add to this command menu item to.
menu | Driver's menu to add item(s) for this command to.
See also:
Menu.AddItem(), Menu.AddSubmenu()

public DriverScheduleCommand DriverCommand.CreateScheduleCommand | ( | DriverCharacter | driver,
 |  | Soup | soup
 | ) |

Creates and initializes an appropriate DriverScheduleCommand object for this command.

This method is called by Trainz to create a DriverScheduleCommand object for this command to use on the given driver character's schedule. It should create the appropriate DriverScheduleCommand object and call its Init() and SetProperties() methods.

The code sample below comes from the Load command.

     DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
     {
       RunaroundScheduleCommand cmd = new RunaroundScheduleCommand();
       cmd.Init(driver, me);
       cmd.SetProperties(soup);
       cmd.SetParent(me);
       return cast<DriverScheduleCommand>cmd;
     }

In the case of the Load command, one of its own internal methods calls CreateScheduleCommand(). See the Init() method description for further details on what happens to get things running.

Parameters:
driver | Driver character we are creating a DriverScheduleCommand object for.
soup | Soup database to initialize the returned object with. Trainz will
Note:
This method MUST NOT add the new DriverScheduleCommand object to the driver character's schedule.
Returns :
Returns a DriverScheduleCommand object that will be used by a driver character to run this command. This returned object is a unique instance that will be used by driver.
See also:
DriverScheduleCommand.Init(), DriverScheduleCommand.SetProperties()

public Asset DriverCommand.GetAsset ( void )

Gets the asset of this driver command.

Returns :
Returns the asset of this driver command.

public DriverCommands DriverCommand.GetDriverCommands ( Message commandMessage ) [inline]

Gets the driver commands schedule for the driver character that sent the given message.

This method is a helper method that can be called to get the DriverCommands object based on the given message. It is expected that commandMessage originates from a DriverCharacter via a Menu selection. See the Load() example method in the description of Init() for a demonstration of this method.

Parameters:
commandMessage Message that originates from a driver character menu click. The message source should be a DriverCharacter object.
Returns :
Returns the driver commands schedule of the DriverCharacter that was the source of compoundMessage.
See also:
DriverCharacter.GetDriverCommands()

public void DriverCommand.Init ( Asset asset )

Initialization method. Called by Trainz when a new driver command is created.

It is up to the programmer to do any initialization tasks required here as well ensuring this parent method is called when overridden. This can be done by using the inherited keyword.

So that your DriverCommand can respond to Menu items being selected, it is recommended that you add a handler for the menu message your command uses (as defined by your AddCommandMenuItem() implementation). An example, here is the Init() method from the Load command:

     public void Init(Asset asset)
     {
       inherited(asset);
       AddHandler(me, "LoadProduct", null, "Load");
     }

In this example, the method named Load() is being set as the method in the class to be called when any message with a major type of "LoadProduct" is received.

Load() is a locally defined method and its implementation is shown here:

     void Load(Message msg)
     {
       DriverCommands commands = GetDriverCommands(msg);
       DriverCharacter driver = cast<DriverCharacter>(msg.src);

       // schedule our command
       Soup soup = Constructors.NewSoup();
       LoadScheduleCommand cmd = cast<LoadScheduleCommand> CreateScheduleCommand(driver, soup);
       commands.AddDriverScheduleCommand(cmd);
     }

Note how Load() constructs a new Soup and passes it on to CreateScheduleCommand() along with the driver character (which is extracted from the message source). Once CreateScheduleCommand() has created and initialized the schedule command object, Load() adds it to the driver's command schedule. This is the approach we use to create driver command asset scripts in Trainz.

Remember that there are further examples included for all of our driver commands.

Parameters:
asset Driver command asset being initialized.
See also:
GameObject.AddHandler()

The documentation for this class was generated from the following file:
  • DriverCommand.gs


DriverCommands Class Reference

Inheritance diagram for DriverCommands:

GameObject List of all members.

Public Methods

public native void | AddDriverScheduleCommand (DriverScheduleCommand cmd)
public native DriverScheduleCommand[] | GetDriverScheduleCommands (void)
public native void | ClearDriverScheduleCommands (void)
Removes all the commands from this schedule and empties it out.

public native bool | GetDriverScheduleRepeat (void)
public native void | SetDriverScheduleRepeat (bool repeat)
public native void | ProceedToNextCommand (void)
public Soup | GetProperties (void)
public void | SetProperties (Soup soup)
public void | AppendDependencies (KUIDList io_dependencies)

Detailed Description

A schedule of driver commands for a driver character to run through.

This class groups together a list of DriverScheduleCommand objects for a DriverCharacter to use. A DriverCharacter has a DriverCommands object as its schedule of 'things to do'.

It is a DriverCommand object that creates and adds a DriverScheduleCommand to the DriverCommands object of the DriverCharacter that is going to run that command.

See also:
DriverCommand, DriverScheduleCommand, DriverCharacter, DriverCharacter.GetDriverCommands(), Constructors.NewDriverCommands()

Member Function Documentation

public native void DriverCommands.AddDriverScheduleCommand ( DriverScheduleCommand cmd )

Adds the given driver schedule command to this schedule.

Parameters:
cmd Driver schedule command to add.

public void DriverCommands.AppendDependencies ( KUIDList io_dependencies )

Appends the KUIDs of the commands in this schedule to the given list.

Each DriverCommands object contains its own variety of driver commands and this method allows you to get the KUIDs of the commands it currently uses.

Parameters:
io_dependencies KUIDList to add dependencies of this collection of schedule commands to.

public native DriverScheduleCommand [] DriverCommands.GetDriverScheduleCommands ( void )

Gets a list of all of the driver schedule commands this schedule currently has.

Note:
Modifying the returned array will not affect the DriverCommands list, however modifying the individual schedule commands in it will!
Returns :
Returns an array containing the list of driver schedule commands this schedule has.

public native bool DriverCommands.GetDriverScheduleRepeat ( void )

Determines if this schedule is to run its commands in a continuous repeat cycle.

Returns :
Returns true if this schedule of commands is set to operate in repeat cycle, false otherwise.

public Soup DriverCommands.GetProperties ( void )

Gets a Soup representation of this schedule of commands.

Note:
Each DriverScheduleCommand will need to be able to save its configuration to Soup with an appropriate GetProperties() implementation.
Returns :
Returns a Soup database of this schedule including all schedule commands as sub-Soups.
See also:
DriverScheduleCommand.GetProperties()

public native void DriverCommands.ProceedToNextCommand ( void )

Moves this schedule along to the next command in its list.

If this DriverCommands schedule is set to repeat, this method will move along to the next command with the previous one being moved to the end of the list. Otherwise the previous command will disappear as we move on to the next one.

public native void DriverCommands.SetDriverScheduleRepeat ( bool repeat )

Enables/disables the repeat cycle mode of this schedule.

Parameters:
repeat If true, this schedule will be run by the driver continuously such that he/she will simply continue running by going back to the first command once the final command is done. Otherwise use false for the driver to process the commands as a linear list where each command disappears once finished and when the commands list is empty, the driver will sit idle.

public void DriverCommands.SetProperties ( Soup soup )

Initialise this schedule as specified in the given Soup.

Note:
Each DriverScheduleCommand will need to be able to initialize itself from a Soup with an appropriate SetProperties() implementation.
Parameters:
soup Soup database to initialize this schedule and its commands with.
See also:
DriverScheduleCommand.SetProperties()

The documentation for this class was generated from the following file:
  • DriverCommands.gs


DriverScheduleCommand Class Reference

List of all members.

Public Methods

public void | Init (DriverCharacter driver, DriverCommand parent)
public bool | BeginExecute (DriverCharacter driver)
public bool | UpdateExecute (DriverCharacter driver)
public bool | FailExecute (DriverCharacter driver)
public bool | EndExecute (DriverCharacter driver)
public object | GetIcon (void)
public string | GetTooltip (void)
public DriverCommand | GetDriverCommand (void)
public DriverCharacter | GetDriverCharacter (void)
public void | SetDriverCharacter (DriverCharacter driver)
public Soup | GetProperties (void)
public void | SetProperties (Soup soup)
public Asset | GetAsset (void)

Detailed Description

A schedule command that a driver can follow.

This class handles the actual driving of the train for its parent DriverCommand in a DriverCharacter's schedule. A DriverCommand object is responsible for creating a DriverScheduleCommand and placing it on the driver's list.

All of the Auran provided driver commands contain example implementations of this class.

See also:
CustomCommand, DriverCommand, DriverCommands, DriverCharacter, Schedule, World, DriverCommand.CreateScheduleCommand(), DriverCharacter.AddDriverScheduleCommand(), DriverCharacter.AddDriverScheduleCommand()

Member Function Documentation

public bool DriverScheduleCommand.BeginExecute ( DriverCharacter driver )

Begin executing this driver command on the given driver character.

This method is called once the parent command is reached in the driver's schedule. After it returns, this object is removed from the start of the driver's schedule.

It is up to the script programmer to implement this method for their own custom commands as the default DriverScheduleCommand implementation does nothing except return false.

If this method does return false, EndExecute() won't be called.

Note:
This method is called by the game so it MUST NOT block (i.e. don't wait on messages). However, you may call threaded functions.
Parameters:
driver Driver character that this command is to be executed on.
Returns :
Returns true if the command has started to execute, false to indicate that the command has failed to start.

public bool DriverScheduleCommand.EndExecute ( DriverCharacter driver )

Stops executing this driver schedule command on the given driver character.

This method will be called exactly once after each call to BeginExecute() that results in true. It won't be called if after a call to BeginExecute() that has returned false. EndExecute() will always be called BEFORE the next call to BeginExecute() on a given driver.

Generally BeginExecute() will set up a train schedule for the driver. EndExecute() is called by Trainz when this driver command schedule stops. If no schedule is setup, EndExecute() will be called immediately after BeginExecute().

The default DriverScheduleCommand implementation of this method always returns true, so an overridden version is not essential. But generally it would be advisable to do so.

Note:
This function is called by the game so it MUST NOT block (i.e. don't wait on messages). However, you may call threaded functions.
Parameters:
driver Driver character that this command has ended on.
Returns :
Returns false to indicate that the command was not successfully completed.

public bool DriverScheduleCommand.FailExecute ( DriverCharacter driver )

Notify this driver command that the train schedule failed on the given driver character.

Note:
This method is called by the game so it MUST NOT block (i.e. don't wait on messages). However, you may call threaded functions.
Parameters:
driver Driver character that this command is to be executed on.
Returns :
Returns true if the command has continued, or false to indicate that the command is complete (or has failed).

public Asset DriverScheduleCommand.GetAsset ( void ) [inline]

Gets the asset of the parent DriverCommand this driver schedule command is attached to.

Returns :
Returns the asset of the parent DriverCommand.
See also:
DriverCommand.GetAsset()

public DriverCharacter DriverScheduleCommand.GetDriverCharacter ( void )

Gets the DriverCharacter that this driver schedule command is attached to.

Returns :
Returns the DriverCharacter that this driver schedule command is attached to.

public DriverCommand DriverScheduleCommand.GetDriverCommand ( void )

Gets the parent DriverCommand this driver schedule command is attached to.

Returns :
Returns the parent driver command.

public object DriverScheduleCommand.GetIcon ( void )

Called by Trainz to determine the display icon for this command.

The default DriverScheduleCommand implementation always returns null, so the script programmer must override this method if they want an icon on the driver's list for this command.

Returns :
Can return any MapObject-derived object and that object's icon will be used for this driver schedule command, null otherwise.

public Soup DriverScheduleCommand.GetProperties ( void )

Gets the properties (if any) of this driver schedule command.

The default DriverScheduleCommand implementation of this method always returns an empty Soup database. The script programmer must provide their own overridden version if they want command properties to be saved.

This method is mainly used by the host DriverCommands object to save the state of each schedule command it has.

Note:
Feel free to override, but ALWAYS call through to the base method. Use the inherited keyword to explicitly invoke the overridden method from the parent class.
Returns :
Returns an empty Soup database.
See also:
DriverCommands.GetProperties()

public string DriverScheduleCommand.GetTooltip ( void )

Gets the toltip text for this driver schedule command.

This method is called by Trainz to provide tooltip text when the user has the cursor hovering above the icon of this driver schedule command on the driver character's command list that appears across the bottom of the Driver interface.

Returns :
Returns a tooltip for this particular driver schedule rule instance. The default implementation in DriverScheduleCommand always returns an empty string ("").

public void DriverScheduleCommand.Init | ( | DriverCharacter | driver,
 |  | DriverCommand | parent
 | ) |

Called by a DriverCommand object to construct this DriverScheduleCommand.

You can override this method to perform your own initialization, but you must call this parent Init() method as well, otherwise essential initialization won't occur. Use the inherited keyword to explicitly call it from your own overridden implementation.

Parameters:
driver | Driver character this driver schedule command is to run on.
parent | Parent DriverCommand that is creating this driver schedule command.
See also:
DriverCommand.CreateScheduleCommand()

public void DriverScheduleCommand.SetDriverCharacter ( DriverCharacter driver )

Assigns this driver schedule command to the specified driver.

Parameters:
driver Driver character to assign this schedule command to.

public void DriverScheduleCommand.SetProperties ( Soup soup )

Uses the given Soup database to initializes the properties (if any) of this command.

The default DriverScheduleCommand implementation of this method does nothing. The script programmer must provide their own overridden version if they want their command to be able to initialize itself from a properties database.

This method is used by the host DriverCommands object to initialize this schedule command from saved Soup data. It is also used to initialize a newly created DriverScheduleCommand object from within a DriverCommand.

Note:
Feel free to override, but ALWAYS call through to the base method. Use the inherited keyword to explicitly invoke the overridden method from the parent class.
Parameters:
soup Database to initialize this driver schedule command with.
See also:
DriverCommands.SetProperties(), DriverCommand.CreateScheduleCommand()

public bool DriverScheduleCommand.UpdateExecute ( DriverCharacter driver )

Update execution of this driver command on the given driver character.

Note:
This method is called by the game so it MUST NOT block (i.e. don't wait on messages). However, you may call threaded functions.
Parameters:
driver Driver character that this command is to be executed on.
Returns :
Returns true if the command is in progress, or false to indicate that the command is complete (or has failed).

The documentation for this class was generated from the following file:
  • DriverScheduleCommand.gs


DriversInfo Class Reference

Inheritance diagram for DriversInfo:

SpecificVehiclesInfo List of all members.

Public Methods

public string[] | GetPropertyElementList (string propertyID)
public bool | DoesMatch (Train train)
public bool | DoesMatchAnd (Train train)
public bool | DoesMatchAndExlcude (Train train)

Detailed Description

Property handler that defines a list of specific driver character asset types to filter.

This child class variation of SpecificVehiclesInfo filters drivers based on the type they are (i.e. the Asset they are an instance of). As DriverCharacter objects are not available from within Surveyor for a property handler to be configured with, we have to filter drivers based on the asset that they are an instance of.

Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be seen in the \Trainz\scripts\TrainHelperInfo.gs script file.
See also:
SpecificVehiclesInfo, VehicleTypesInfo, TrainHelperInfo, VHIDriversInfo, DriverCharacter

Member Function Documentation

public bool DriversInfo.DoesMatch ( Train train ) [inline]

Determines if the active driver of the given train has the same name as one of the driver types this handler has.

This method is used by TrainHelperInfo.DoesMatch() for the driver character part of the train filter. It is public and can also be called by any script code and used alone if desired.

Parameters:
train Train to find the active driver of in this handler's list.
Returns :
Returns true if the name of the active driver in train matches one of the driver asset types in this handler's list. If the a match can't be found or train doesn't have a driver, false is returned.
See also:
TrainHelperInfo.DoesMatch(), SpecificVehiclesInfo.DoesMatch(), VehicleTypesInfo.DoesMatch()

Reimplemented from SpecificVehiclesInfo.

public bool DriversInfo.DoesMatchAnd ( Train train ) [inline]

This method is not relevant to DriversInfo.

This method was meant to be used for vehicles and isn't really needed or suitable for use with a driver character. The DriversInfo implementation of this method simply passes train on to DoesMatch() and returns the results.

Returns :
Returns the results of DoesMatch(train).
See also:
VehicleTypesInfo.DoesMatchAnd(), SpecificVehiclesInfo.DoesMatchAnd()

Reimplemented from SpecificVehiclesInfo.

public bool DriversInfo.DoesMatchAndExlcude ( Train train ) [inline]

This method is not relevant to DriversInfo.

This method was meant to be used for vehicles and isn't really needed or suitable for use with a driver character. The DriversInfo implementation of this method always returns true.

Returns :
Always returns true.
See also:
VehicleTypesInfo.DoesMatchAndExlcude(), SpecificVehiclesInfo.DoesMatchAndExlcude()

Reimplemented from SpecificVehiclesInfo.

public string [] DriversInfo.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from SpecificVehiclesInfo.

The documentation for this class was generated from the following file:
  • TrainHelperInfo.gs


EnumeratedAssetHandler Class Reference

Inheritance diagram for EnumeratedAssetHandler:

ConfigAssetHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public void | Init (Asset asset, string newConfigPrefix)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string | GetPropertyValue (string propertyID)
public string[] | GetPropertyElementList (string propertyID)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Detailed Description

A config asset handler that manages a property item that can be one of any installed Asset of a particular kind/type.

This class manages a single property that can be selected from an enumeration of installed assets of particular kind/type.

For this class to work properly, the following string table entries are required:

String Name | Description
"<config-prefix>-asset-type" | Type of asset to enumerate from. Must be a valid Trainz asset that World.GetAssetList() recognizes.
"<config-prefix>-blank-string" | Blank string to display when no asset is selected.
"<config-prefix>-asset-html-property" | String where chosen asset is displayed. This string must have a parameter of $0 for the asset selection URL to be placed in.
"<config-prefix>-name-selectedAsset" | Text name to describe the type of asset. This will be displayed as the title name in the list selection box where the asset is chosen.
"<config-prefix>-desc-selectedAsset" | Description text of asset type being selected. Will appear as a tooltip in the list selection box.
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

Note:
If your asset uses this handler, keep in mind it might be run on other Trainz installations that may not have the asset the handler has been saved with installed. This is a situation you should always allow for.
The EnumeratedAssetHandler class is used by the Driver Command Check rule with a config prefix of "driver-char" as shown in the table below:

String Name | Contents
"driver-char-asset-type" | "drivercharacter"
"driver-char-asset-html-property" | "Driver character to watch the commands list of: $0"
"driver-char-blank-string" | "<i>click to select</i>"
"driver-char-name-assetname" | "Drivers"
"driver-char-desc-assetname" | "Driver Characters"
"driver-char-html-prefix" | "<table cellpadding=0 cellspacing=0><tr><td width=3></td><td><font color=#000000>"
"driver-char-html-sufix" | "</font></td></tr></table>"

Useful interface methods provided with this class are:

  • public string GetAssetType ()
  • public string GetAssetName ()
  • public Asset GetSelectedAssetRef ()
  • public Asset GetAssetByIndex (int index)
  • public Asset GetAssetByName (string assetName)
  • public void SetAsset (Asset newAsset)
  • public void SetAssetType (string newType)
Note:
EnumeratedAssetHandler was mainly written as a utility class for use in the TRS2006 session rules. It is not part of the core Trainz API and is not fully documented. Those who are interested in how this class works can see all the full implementation in the \Trainz\scripts\ListItemPropertyHandler.gs script file.
See also:
EnumeratedPropertyHandler, EnumeratedGameObjectHandler, EnumeratedMultiPropertyHandler, AssetCheckListHandler, CheckListPropertyHandler, GenericBoolHandler, GenericStringHandler, GenericListHandler, RadioButtonListHandler, RadioButtonGroupHandler

Member Function Documentation

public string EnumeratedAssetHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from ConfigAssetHandler.

public Soup EnumeratedAssetHandler.GetProperties ( ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from ConfigAssetHandler.

public string EnumeratedAssetHandler.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string [] EnumeratedAssetHandler.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from HTMLPropertyHandler.

public string EnumeratedAssetHandler.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string EnumeratedAssetHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public string EnumeratedAssetHandler.GetPropertyValue ( string propertyID ) [inline]

Gets the value of the named property as a string.

This method is called by PropertyObject.GetPropertyValue() to get the value of the named property.

Parameters:
propertyID Property to get the value of.
Returns :
Returns the value of propertyID as a string (convert if necessary). The HTMLPropertyHandler implementation will always return an empty string.
See also:
PropertyObject.GetPropertyValue()

Reimplemented from HTMLPropertyHandler.

public void EnumeratedAssetHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

public void EnumeratedAssetHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

public void EnumeratedAssetHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from ConfigAssetHandler.

public void EnumeratedAssetHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


EnumeratedGameObjectHandler Class Reference

Inheritance diagram for EnumeratedGameObjectHandler:

ConfigAssetHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Detailed Description

A config asset handler that manages a property item that can be any one of an enumeration of game objects of a particular type.

This class manages a single property that can be selected from an enumeration of game objects of a particular kind/type.

For this class to work properly, the following string table entries are required:

String Name | Description
"<config-prefix>-object-type" | Type of game object this handler is to deal with. Allowed types are "behavior", "industry", "junction", "signal", "trackmark", "traincar" and "trigger".
"<config-prefix>-object-html-property" | HTML code to present this property handler in. Parameter $0 is where current game object will be inserted with a hyperlink.
"<config-prefix>-blank-string" | Blank string text to use as a hyperlink for when no game object is currently selected. This string MUST be included, otherwise there will be nothing to click on to select an actual game object!
"<config-prefix>-name-gameObjectName" | Readable name for game object (title for the list selection box).
"<config-prefix>-desc-gameObjectName" | Description of game object name (tool-tip in list selection box).
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

Note:
If your asset uses this handler, keep in mind it might be run on other Trainz installations that may not have the game object this handler has been saved present. This is a situation you should always allow for.
The EnumeratedGameObjectHandler class is used by the Wait for Camera View Mode rule with a config prefix of "wait-object-target" as shown in the table below:

String Name | Contents
"wait-object-target-object-type" | "traincar"
"wait-object-target-object-html-property" | "$0"
"wait-object-target-blank-string" | "<i>click to select</i>"
"wait-object-target-name-gameobjectname" | "Target Vehicle"
"wait-object-target-desc-gameobjectname" | "Vehicle camera is to focus on"
"wait-object-target-html-prefix" | "<font color=#000000>"
"wait-object-target-html-sufix" | "</font>"

Useful interface methods provided with this class are:

  • public string GetObjectType ()
  • public string GetObjectName ()
  • public string GetObjectNameFull ()
  • public GameObject GetGameObject ()
Note:
EnumeratedGameObjectHandler was mainly written as a utility class for use in the TRS2006 session rules. It is not part of the core Trainz API and is not fully documented. Those who are interested in how this class works can see all the full implementation in the \Trainz\scripts\ListItemPropertyHandler.gs script file.
See also:
EnumeratedAssetHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, AssetCheckListHandler, CheckListPropertyHandler, GenericBoolHandler, GenericStringHandler, GenericListHandler, RadioButtonListHandler, RadioButtonGroupHandler

Member Function Documentation

public string EnumeratedGameObjectHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from ConfigAssetHandler.

public Soup EnumeratedGameObjectHandler.GetProperties ( ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from ConfigAssetHandler.

public string EnumeratedGameObjectHandler.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string [] EnumeratedGameObjectHandler.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from HTMLPropertyHandler.

public string EnumeratedGameObjectHandler.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string EnumeratedGameObjectHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public void EnumeratedGameObjectHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

public void EnumeratedGameObjectHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from ConfigAssetHandler.

public void EnumeratedGameObjectHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


EnumeratedMultiPropertyHandler Class Reference

Inheritance diagram for EnumeratedMultiPropertyHandler:

EnumeratedPropertyHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public void | Init (Asset asset, string newConfigPrefix)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Detailed Description

Config asset handler that manages an enumerated property where each value of the enumeration has its own set of enumerated sub items.

This class inherits the enumerated property functionality from EnumeratedPropertyHandler and extends it such that each item in the enumeration (the major type) has its own enumerated collection of sub-items. The currently selected item from the major type will determine what range of items will be available to be selected for the sub-type.

The config string table requirements for this class are much trickier than most of the other config asset handler classes, so refer to the example listed further below if this initial table is too confusing.

String Name | Description
"<config-prefix>-html-property" | HTML text for presenting this handler's settings which has two string parameters, one for type ($0) and the other for the sub-type ($1). These string parameters can be placed in any order so you can have the major type property first or the sub-type property first.
"<config-prefix>-blank-string" | Blank string for when a major/sub type isn't selected.
"<config-prefix>-empty-sub-list" | Blank string for when a major type isn't selected and user tries to select a sub type anyway.
"<config-prefix>-name-itemName" | Display name for major type (in general - non specific).
"<config-prefix>-desc-itemName" | Tooltip description for major type.
"<config-prefix>-name-subName" | Display name for minor type (in general - non specific).
"<config-prefix>-desc-subName" | Tooltip description for minor type. Applies to all sub type enumerations, so use something general and non-sepcific.
"-item$N"> | Reference name of the Nth item of the major type. The item count must start from 0 and increase in a linear order. There must be a string table entry for each item entry like this.
"<reference-name $N>" | Full user-friendly name for item $N of the major type. The full name of this string table entry is defined by the reference name as specified in the "<config-prefix>-item$N" string.
"<reference-name $N>-item$X" | Reference name of the $Xth sub item for the $Nth item of the major type. As with the major type items, sub items are defined in a linear order. The must be an enumerated set of sub items defined for each major type item. Each enumerated sub-type collection can have a different amount of items.
"<reference-name $N>-tiem$X" | Full user friendly name for the sub-item specified by the "<reference-name $N>-item$X" string. This will be the readable name for the $Xth sub-item of the $Nth major type.
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

As an example, consider the Wait For Click on HUD Icon rule that allows the user to select an particular icon from one of the HUD panels. We have several HUD panels, each with its own unique set of icons and which fits in with this handler nicely. The handler's major type is an enumeration of the HUD panels while each panel item has its own collection of icons enumerated as sub-types. With a config prefix of "wait-panel-icon", the string table elements for the Wait For Click on HUD Icon rule are:

String Name | Contents
"wait-panel-icon-html-property" | "Wait for a click on the $1 icon on the $0 HUD panel."
"wait-panel-icon-blank-string" | "<i>click to select</i>"
"wait-panel-icon-empty-sub-list" | "Choose a HUD panel first!"
"wait-panel-icon-html-prefix" | "<table border='0' cellspacing='0' cellpadding='0'><tr><td width=4></td><td><font color=#000000>"
"wait-panel-icon-html-sufix" | "</font></td></tr></table>"
"wait-panel-icon-name-itemname" | "HUD Panel"
"wait-panel-icon-desc-itemname" | "HUD Panel to flash icon on"
"wait-panel-icon-name-subitem" | "Icon"
"wait-panel-icon-desc-subitem" | "Icon to wait for a click on"
"wait-panel-icon-item0" | "panel-bottom-right"
"wait-panel-icon-item1" | "panel-camera-controls"
"wait-panel-icon-item2" | "panel-dcc-controls"
"panel-bottom-right" | "Bottom Right Menu"
"panel-camera-controls" | "Camera Controls"
"panel-dcc-controls" | "DCC Controls"
"panel-bottom-right-item0" | "btn/message"
"panel-bottom-right-item1" | "btn/minimap"
"panel-bottom-right-item2" | "btn/commodities"
"panel-bottom-right-item3" | "btn/decouple"
"panel-bottom-right-item4" | "btn/waybills"
"panel-bottom-right-item5" | "btn/schedule"
"panel-bottom-right-item6" | "btn/help"
"panel-bottom-right-item-btn/message" | "Messages"
"panel-bottom-right-item-btn/minimap" | "Map"
"panel-bottom-right-item-btn/commodities" | "Commodities"
"panel-bottom-right-item-btn/decouple" | "Decoupling"
"panel-bottom-right-item-btn/waybills" | "Waybill"
"panel-bottom-right-item-btn/schedule" | "View Schedule"
"panel-bottom-right-item-btn/help" | "View Driver Help"
"panel-camera-controls-item0" | "view-0/"
"panel-camera-controls-item1" | "view-1/"
"panel-camera-controls-item2" | "view-2/"
"panel-camera-controls-item3" | "view-3/"
"panel-camera-controls-item-view-0/" | "Cab View"
"panel-camera-controls-item-view-1/" | "External View"
"panel-camera-controls-item-view-2/" | "Tracking View"
"panel-camera-controls-item-view-3/" | "Free Roaming"
"panel-dcc-controls-item0" | "dial/dcc"
"panel-dcc-controls-item1" | "button/pants"
"panel-dcc-controls-item2" | "button/lights"
"panel-dcc-controls-item3" | "button/horn"
"panel-dcc-controls-item4" | "button/stop"
"panel-dcc-controls-item-dial/dcc" | "Speed Dial"
"panel-dcc-controls-item-button/pants" | "Pantographs"
"panel-dcc-controls-item-button/lights" | "Lights"
"panel-dcc-controls-item-button/horn" | "Horn"
"panel-dcc-controls-item-button/stop" | "Stop"

Pay particular attention to how the enumerations of sub-items are defined for each item in the major type enumeration.

The EnumeratedMultiPropertyHandler class is also used by the Flash HUD Icon rule.

Useful interface methods provided with this class are:

  • public string GetSubItem ()
  • public string GetSubItemFull ()
  • public bool IsSubEnumSet ()
As well as that, the following methods inherited from EnumeratedPropertyHandler are also applicable to this class:
  • public int GetItemIndex ()
  • public int GetItemCount ()
  • public string GetItem ()
  • public string GetItem (int index)
  • public string[] GetItems ()
  • public string GetItemFull ()
  • public bool IsEnumSet ()
Note:
EnumeratedMultiPropertyHandler was mainly written as a utility class for use in the TRS2006 session rules. It is not part of the core Trainz API and is not fully documented. Those who are interested in how this class works can see all the full implementation in the \Trainz\scripts\ListItemPropertyHandler.gs script file.
See also:
EnumeratedPropertyHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, AssetCheckListHandler, CheckListPropertyHandler, GenericBoolHandler, GenericStringHandler, GenericListHandler, RadioButtonListHandler, RadioButtonGroupHandler

Member Function Documentation

public string EnumeratedMultiPropertyHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from EnumeratedPropertyHandler.

public Soup EnumeratedMultiPropertyHandler.GetProperties ( ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from EnumeratedPropertyHandler.

public string EnumeratedMultiPropertyHandler.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from EnumeratedPropertyHandler.

public string [] EnumeratedMultiPropertyHandler.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from EnumeratedPropertyHandler.

public string EnumeratedMultiPropertyHandler.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from EnumeratedPropertyHandler.

public string EnumeratedMultiPropertyHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from EnumeratedPropertyHandler.

public void EnumeratedMultiPropertyHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from EnumeratedPropertyHandler.

public void EnumeratedMultiPropertyHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from EnumeratedPropertyHandler.

public void EnumeratedMultiPropertyHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from EnumeratedPropertyHandler.

public void EnumeratedMultiPropertyHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from EnumeratedPropertyHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


EnumeratedPropertyHandler Class Reference

Inheritance diagram for EnumeratedPropertyHandler:

ConfigAssetHandler EnumeratedMultiPropertyHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public void | Init (Asset asset, string newConfigPrefix)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Detailed Description

A config asset handler that manages a property item that can be one of many possible enumerated values.

This class manages a single property that can be one of any number of possible enumerated values as specified in the host asset's string table. This particular property has the name of "itemName" but what range of values it can be is entirely dependent on the configuration.

For this class to work properly, the string table requirements are:

String Name | Description
"<config-prefix>-html-property" | HTML code to present this handler's current setting in. String parameter $0 is where the item is inserted wrapped as a URL.
"<config-prefix>-blank-string" | Blank string for when there is no chosen item.
"<config-prefix>-item$N" | Reference name of the Nth item. The item count must start from 0 and increase in a linear order. This handler can determine how many items there are to enumerate and will stop when the linear order ends. There must be a be string table entry for each item entry like this.
"<reference-name $N>" | Full user-friendly name for item $N. The full name of this string table entry is defined by the reference string which is specified in the "<config-prefix>-item$N" string. See the example below if this is getting too confusing ;)
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

For example, here are the string table items from the Multiple Junction Align Check rule where the config prefix is "multi-junc-setting":

String Name | Contents
"multi-junc-setting-html-property" | "Junction state is: $0"
"multi-junc-setting-blank-string" | "<i>click to select</i>"
"multi-junc-setting-item0" | "multi-junc-setting-left"
"multi-junc-setting-item1" | "multi-junc-setting-center"
"multi-junc-setting-item2" | "multi-junc-setting-right"
"multi-junc-setting-item3" | "multi-junc-setting-any"
"multi-junc-setting-left" | "Left"
"multi-junc-setting-center" | "Center"
"multi-junc-setting-right" | "Right"
"multi-junc-setting-any" | "Any"
"multi-junc-setting-html-prefix" | "<font color=#000000>"
"multi-junc-setting-html-sufix" | "</font>"

In this particular case, an enumeration of 4 possible junction states is defined so the handler provides a way to select what state a junction should be in.

The EnumeratedPropertyHandler class is also used by the following rules:

  • Set Camera
  • Set Junctions
  • Show/Hide HUD Panel
  • Wait for Camera View Mode
Useful interface methods provided with this class are:
  • public int GetItemIndex ()
  • public int GetItemCount ()
  • public string GetItem ()
  • public string GetItem (int index)
  • public string[] GetItems ()
  • public string GetItemFull ()
  • public bool IsEnumSet ()
Note:
EnumeratedPropertyHandler was mainly written as a utility class for use in the TRS2006 session rules. It is not part of the core Trainz API and is not fully documented. Those who are interested in how this class works can see all the full implementation in the \Trainz\scripts\ListItemPropertyHandler.gs script file.
See also:
EnumeratedMultiPropertyHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, AssetCheckListHandler, CheckListPropertyHandler, GenericBoolHandler, GenericStringHandler, GenericListHandler, RadioButtonListHandler, RadioButtonGroupHandler

Member Function Documentation

public string EnumeratedPropertyHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from ConfigAssetHandler.

Reimplemented in EnumeratedMultiPropertyHandler.

public Soup EnumeratedPropertyHandler.GetProperties ( ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from ConfigAssetHandler.

Reimplemented in EnumeratedMultiPropertyHandler.

public string EnumeratedPropertyHandler.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

Reimplemented in EnumeratedMultiPropertyHandler.

public string [] EnumeratedPropertyHandler.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from HTMLPropertyHandler.

Reimplemented in EnumeratedMultiPropertyHandler.

public string EnumeratedPropertyHandler.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

Reimplemented in EnumeratedMultiPropertyHandler.

public string EnumeratedPropertyHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

Reimplemented in EnumeratedMultiPropertyHandler.

public void EnumeratedPropertyHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

Reimplemented in EnumeratedMultiPropertyHandler, and EnumeratedMultiPropertyHandler.

public void EnumeratedPropertyHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

Reimplemented in EnumeratedMultiPropertyHandler, and EnumeratedMultiPropertyHandler.

public void EnumeratedPropertyHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from ConfigAssetHandler.

Reimplemented in EnumeratedMultiPropertyHandler.

public void EnumeratedPropertyHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

Reimplemented in EnumeratedMultiPropertyHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


Flags Class Reference

List of all members.

Public Methods

public bool | Test (int flags, int mask)
public bool | TestAny (int flags, int mask)
public bool | Test (int flags, int mask, int options)

Detailed Description

Flag handling utility class.

This static class provides methods to test a set of flags against a flag mask. Flag sets in the GS language are 32-bit integers. Although the bits in the 32-bit integer can be easily checked and manipulated using logical operators, this can be tricky for those with limited programming experience, hence this class.

What the bits in a flag set represent is up to the programmer to decide. There are however several places in the Trainz classes where a pre-defined set of flags is defined for a specific purpose such as the Behavior State flags in the ScenarioBehavior class.

As well as flag constants located throughout the Trainz API, there also status/mode constants which look similar to flags but serve a different purpose. Unlike a flag set that can act as a collection of multiple Boolean values, a status/mode value can only be one thing at a time. This class is for flags and wasn't intended for status/mode values as they can be easily checked with a simple if statement.

See also:
Behavior State Flags, Camera View Modes, Camera Flags, Coupler Flags, Vehicle Side Flags, Vehicle Types

Member Function Documentation

public bool Flags.Test | ( | int | flags,
 |  | int | mask,
 |  | int | options
 | ) |

Compares two flag sets against each other through a filter mask.

This method compares two sets of flags against each other using AND logic after both have been masked, thus allowing the selective testing of only certain flags.

As an example, this Test() call will evaluate to true if the PAUSED and DOES_COMPLETE flags of both scenarioBehavior1 and scenarioBehavior2 are set. This is because the mask argument is being used to only have those two flags compared - other flags will not be considered.

     Flags.Test(scenarioBehavior1.GetStateFlags(),
                ScenarioBehavior.PAUSED | ScenarioBehavior.WAS_COMPLETE,
                scenarioBehavior2.GetStateFlags());
Parameters:
flags | Flag set to test.
mask | Mask to apply to both flags and options before comparison.
options | Other flag set to compare against flags.
Returns :
Returns true if flags and options are equal after both have been masked, false otherwise.

public bool Flags.Test | ( | int | flags,
 |  | int | mask
 | ) |

Tests the given flags against a mask.

This method uses AND logic when testing the flags against the mask so all flags need to match to get a true result.

As an example, the following Test() call will evaluate to true if the vehicle is a tender with an interior (an odd unlikely combination, but makes for an interesting example):

     Flags.TestAny(vehicle.GetVehicleTypeFlags(), Vehicle.TYPE_TENDER | Vehicle.TYPE_HAS_INTERIOR);
Parameters:
flags | Flag set to test.
mask | Mask to compare against flags with.
Returns :
Returns true if all of the flags in flags match the corresponding flag in mask, false otherwise.

public bool Flags.TestAny | ( | int | flags,
 |  | int | mask
 | ) |

Tests all of the flags against a mask.

This method uses OR logic when testing the flags against the mask so only one flag needs to match to get a true result.

As an example, this TestAny() call will evaluate to true if the vehicle is either a locomotive or tender:

     Flags.TestAny(vehicle.GetVehicleTypeFlags(), Vehicle.TYPE_LOCOMOTIVE | Vehicle.TYPE_TENDER);
Parameters:
flags | Flag set to test.
mask | Mask to compare against flags with.
Returns :
Returns true if any one of the flags in flags matches its corresponding flag in mask, false otherwise.

The documentation for this class was generated from the following file:
  • Flags.gs


GameObject Class Reference

Inheritance diagram for GameObject:

GSObject Browser CabinControl DriverCommand DriverCommands JunctionBaseGameObject OnlineAccess OnlineGroup Scenario Track Train TrainzGameObject List of all members.

Public Methods

public native void | SendMessage (GameObject dst, string major, string minor)
public native void | PostMessage (GameObject dst, string major, string minor, float seconds)
public native void | ClearMessages (string major, string minor)
public native void | AddHandler (GameObject target, string major, string minor, string handler)
public native void | Sniff (GameObject target, string major, string minor, bool state)
public native void | Sleep (float seconds)
public native int | GetId ()
public native string | GetName ()
public native void | Exception (string reason)

Public Attributes

public object | extension
A reference to an unknown object for user extension data.

Detailed Description

Base class for any object that requires messaging.

GameObject is the base class for any object that requires messaging and threading support. GameObjects are placed in the games object table (Router). You cannot create a GameObject using new from a script. All game objects are created by the game. Each game object has a unique ID (see GetId()) and many also have a unique name. GameObject instances are often referred to as a 'node' because they represent a message node in the game message Router.

See also:
Message, PropertyObject, Router, TrainzGameObject, World

Member Function Documentation

public native void GameObject.AddHandler | ( | GameObject | target,
 |  | string | major,
 |  | string | minor,
 |  | string | handler
 | ) |

Adds a message handler to this game object such that it will be called whenever the target GameObject receives a message of the specified major and minor type.

The minor string may be null or an empty string. This means any minor type handlers must have a void return type and a single parameter which is of type Message.

Parameters:
target | Target object.
major | Message major type to listen for.
minor | Message minor type to listen for. If null or an empty string, all messages that match major will be seen regardless of what the minor type is.
handler | Name of the method to call in target when a message of type (major,minor) is sent to this object.

public native void GameObject.ClearMessages | ( | string | major,
 |  | string | minor
 | ) |

Clears all messages of the specified type from this object that are outstanding via PostMessage().

Parameters:
major | Major type of messages to clear.
minor | Minor type of messages to clear.

public native void GameObject.Exception ( string reason )

Causes the current thread to give an exception.

Parameters:
reason Description why the exception was given.

public native int GameObject.GetId ( )

Gets this object node's unique ID.

Note:
The ID of a GameObject is not to be confused with the KUID of an asset.
Returns :
Returns the unique ID of this game object.

public native string GameObject.GetName ( )

Gets this object node's unique name.

Returns :
Returns the unique name of this game object.

Reimplemented in CabinControl.

public native void GameObject.PostMessage | ( | GameObject | dst,
 |  | string | major,
 |  | string | minor,
 |  | float | seconds
 | ) |

Posts a message of the specified major and minor type to the given destination object.

Parameters:
dst | Destination object.
major | Message major type.
minor | Message minor type.
seconds | Amount of seconds to delay before the message is sent. If 0.0, the message will be sent straight away on the next game update.

public native void GameObject.SendMessage | ( | GameObject | dst,
 |  | string | major,
 |  | string | minor
 | ) |

Sends a message of given major and minor type to a destination object immediately.

The message will be sent immediately without delay.

Parameters:
dst | Destination object to send the message to.
major | Message major type.
minor | Message minor type.

public native void GameObject.Sleep ( float seconds )

Cause this process to pause for a given number of seconds.

Parameters:
seconds Amount of time in seconds to the process is to pause for.

public native void GameObject.Sniff | ( | GameObject | target,
 |  | string | major,
 |  | string | minor,
 |  | bool | state
 | ) |

Add a message handler to the target game object such that it will send us all messages it receives of the specified major and minor type.

Parameters:
target | Object to add a message handler to.
major | Message major type to listen for.
minor | Message minor type to listen for. If null or an empty string, all messages that match major will be seen regardless of what the minor type is.
state | On/off state of the handle. Use true to enable the handler or false to disable.

The documentation for this class was generated from the following file:
  • gs.gs


GenericBoolHandler Class Reference

Inheritance diagram for GenericBoolHandler:

ConfigAssetHandler CheckBoxHandler List of all members.

Public Methods

public bool | GetBoolValue (void)
public void | SetBoolValue (bool newBoolValue)
public string | GetBoolDisplayValue (void)
public void | Init (Asset asset, string newConfigPrefix)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)
public void | SetPropertyAttribute (string propertyID, string attribute, PropertyValue value)
public PropertyValue | GetPropertyAttribute (string propertyID, string attribute)

Detailed Description

A generic Boolean property handler that can be configured from a host asset's string table.

This class is a handler for a single Boolean value and provides a properties interface that alternates between two different text strings when a link within the string is clicked. The only property in this handler is the "boolValue" property.

The string table items supported by this handler are:

String Name | Description
"<config-prefix>-html-property-true" | HTML string for when this handler is true.
"<config-prefix>-html-property-false" | HTML string for when this handler is false.
"<config-prefix>-html-bool-true" | Descriptive text of bool property when true.
"<config-prefix>-html-bool-false" | Descriptive text of bool property when false.
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

For this handler to work, it is essential that the first two string table items listed above are included and that both of have two string parameters ($0 and $1). The first ($0) will be where the link to change the Boolean value begins and will be of the form "<a href=live://property/prefix/boolValue>" while the second parameter is where the closing "</a>" tag is inserted. What text is used in and around this parameters is entirely up to the author of the asset and there are no real restrictions.

Note:
DO NOT place these two string parameters out of order (i.e. putting $1 before $0) as it will cause messy and corrupted links to be generated in the properties window.
The optional "<config-prefix>-html-bool-true" and "<config-prefix>-html-bool-false" strings are used as descriptive text for the current state of the bool property. They are meant to be free of HTML formatting tags making the text suitable for purposes like logging. You only need to provide these strings if you are using the GetBoolDisplayValue() method.

Both the "<config-prefix>-html-prefix" and "<config-prefix>-html-sufix" string items are optional, although if present the GetDescriptionHTML() implementation of this class will use them to wrap the generated HTML code up in.

For example here are the string table items from the Wait for Driver On/Off Train rule where the config prefix is "wait-driver-onoff":

String Name | Contents
"wait-driver-onoff-html-property-true" | "Wait for a driver character to get $0on$1 a train that matches the following criteria:"
"wait-driver-onoff-html-property-false" | "Wait for a driver character to get $0off$1 a train that matches the following criteria:"
"wait-driver-onoff-html-bool-true" | "on"
"wait-driver-onoff-html-bool-false" | "off"
"wait-driver-onoff-html-prefix" | "<table cellspacing=0 cellpadding=0><tr><td width=4></td><td><font color=#000000>"
"wait-driver-onoff-html-sufix" | "</font></td></tr></table>"

The GenericBoolHandler class is also used by the following rules:

  • Disabled HUD Icon Notification
  • Driver Main Menu Options
  • Enable/Disable Driver Commands
  • Enable/Disable HUD Icons
  • Multiple Junction Alignment Check
  • Set Coupler Masks
  • Set HTML Pages
  • Set Junctions
  • Show/Hide Minimap
  • Wait on Minimap Screen/Main Screen
  • Wait on Train Stop/Start
  • Wait on Waybill Screen/Main Screen
See also:
ConfigAssetHandler, CheckBoxHandler, AssetCheckListHandler, CheckListPropertyHandler, EnumeratedAssetHandler, GenericStringHandler

Member Function Documentation

public string GenericBoolHandler.GetBoolDisplayValue ( void )

Gets the descriptive display value for the bool property based on its current state.

Returns :
This method returns either the contents of the "<config-prefix>-html-bool-true" or "<config-prefix>-html-bool-false" string table items depending on the current state of the bool property. If the string item can't be found, an empty string is returned.

public bool GenericBoolHandler.GetBoolValue ( void ) [inline]

Gets the bool value this handler manages.

Returns :
Returns the bool value this handler manages.

public string GenericBoolHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from ConfigAssetHandler.

Reimplemented in CheckBoxHandler.

public Soup GenericBoolHandler.GetProperties ( ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from ConfigAssetHandler.

public PropertyValue GenericBoolHandler.GetPropertyAttribute | ( | string | propertyID,
 |  | string | attribute
 | ) | [inline]

Gets the attributes of the named property.

This method is provided as a mechanism for the properties of a handler to be accessed externally. Implementing it is not required as it isn't called by a host PropertyObject. How it is used is entirely up to the programmer making the handler.

Parameters:
propertyID | Name of the property to get the attributes of.
attribute | Attribute field. How this string value is interpreted is entirely up to the programmer implementing this method.
Returns :
Should return a PropertyValue object containing the requested attributes of the named property. The default top-level implementation returns a PropertyValue that is of type NULL_TYPE.

Reimplemented from HTMLPropertyHandler.

public string GenericBoolHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public void GenericBoolHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

Reimplemented in CheckBoxHandler.

public void GenericBoolHandler.SetBoolValue ( bool newBoolValue ) [inline]

Sets the value of the bool this handler manages.

Parameters:
newBoolValue New setting for this handler's bool value.

public void GenericBoolHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from ConfigAssetHandler.

public void GenericBoolHandler.SetPropertyAttribute | ( | string | propertyID,
 |  | string | attribute,
 |  | PropertyValue | value
 | ) | [inline]

Sets the attribute of the named property.

This method is provided as a mechanism for the properties of a handler to be accessed externally. Implementing it is not required as it isn't called by a host PropertyObject. How it is used is entirely up to the programmer making the handler.

Parameters:
propertyID | Name of the property to set the attribute of.
attribute | Attribute field. How this string value is used is entirely up to the programmer implementing this method.
value | Value to apply the property. Like attribute, how this parameter is dealt with is up to the programmer.

Reimplemented from HTMLPropertyHandler.

public void GenericBoolHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


GenericIndustry Class Reference

Inheritance diagram for GenericIndustry:

Industry List of all members.

Public Methods

thread void | ViewDetails (void)
void | PerformStoppedLoad (Vehicle vehicle, string triggerName)
void | PerformMovingLoad (Vehicle vehicle, string triggerName)
bool | TriggerSupportsStoppedLoad (Vehicle vehicle, string triggerName)
bool | TriggerSupportsMovingLoad (Vehicle vehicle, string triggerName)
thread void | PerformInnerEnterMoving (Vehicle vehicle, string triggerName)
void | PerformInnerEnterStop (Vehicle vehicle)
thread void | PerformStopped (Vehicle vehicle, string triggerName)
void | PerformStoppedNoTrigger (Vehicle vehicle)
thread void | GenericIndustryMain (void)
bool | HandleTrainLoadCommand (Train train)
bool | HandleTrainUnloadCommand (Train train)
public bool | HandleTrain (Train train, string loadCommand)
public void | Init (void)
public void | SetQueueInitialCount (ProductQueue queue, Asset asset, int newValue)
public void | AddAssetToIndustryProductInfo (string assetName, string queueName, string processName, bool isInput, bool showInViewDetails)
public void | AddAssetToIndustryProductInfo (string assetName, string queueName, string processName, bool isInput)
public string | GetDescriptionHTML (void)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, int value)
public void | AppendProductList (Asset[] productList)
thread void | ThreadEndPipeAnimation (Vehicle vehicle)
public float | BeginUnload (LoadingReport report)
public float | GetUnloadTime (LoadingReport report)
public float | EndUnload (LoadingReport report)
public float | BeginLoad (LoadingReport report)
public float | GetLoadTime (LoadingReport report)
public float | EndLoad (LoadingReport report)

Public Attributes

IndustryTrainController itc
Lists vehicles/trains that are currently under loading/unloading commands.

Browser info
Browser for displaying ViewDetails() request.

public IndustryProductInfo[] | industryProductList
Array describing all of the products this industry can input and output. See IndustryProductInfo for details.

string | pipeName
Name of the pipe animation to use when loading/unloading liquid products.

bool | usePipeAnimation
Indicates if this industry does use the pipe animation. If so, extra time is allowed for loading/unloading.

Detailed Description

A generic industry class.

This class provides the generic industry functionality that script programmers can re-use and extend so they can have their industries up and running quickly. This class can't run a custom user-created industry on its own - it needs various methods implemented. However, what this class does provide is a framework that does handle the more complex parts of an industry like trigger message programming.

Note:
Although this class still works and is supported, almost all of the Auran provided industries now use the newer BaseIndustry class.
See also:
IndustryProcessInfo, IndustryProductInfo, IndustryTrainController, BaseIndustry, ProductQueue

Member Function Documentation

public void GenericIndustry.AddAssetToIndustryProductInfo | ( | string | assetName,
 |  | string | queueName,
 |  | string | processName,
 |  | bool | isInput
 | ) | [inline]

Allows a product to be added as being valid input/output for the named process.

Parameters:
assetName | Name of product asset to add to the process.
queueName | Name of queue in this industry that the process is to use for the input/output of the product.
processName | Name of the industry process that is to produce/consume the product.
isInput | Specifies if queueName is an input queue (true) or output queue (false) when used by the process.
See also:
IndustryProductInfo, Asset.FindAsset(), Industry.GetQueue()

public void GenericIndustry.AddAssetToIndustryProductInfo | ( | string | assetName,
 |  | string | queueName,
 |  | string | processName,
 |  | bool | isInput,
 |  | bool | showInViewDetails
 | ) | [inline]

Allows a product to be added as being valid input/output for the named process.

Parameters:
assetName | Name of product asset to add to the process.
queueName | Name of queue in this industry that the process is to use for the input/output of the product.
processName | Name of the industry process that is to produce/consume the product.
isInput | Specifies if queueName is an input queue (true) or output queue (false) when used by the process.
showInViewDetails | Specifies if details of this product capability should be displayed in the browser window when the user requests details of the industry.
See also:
IndustryProductInfo, Asset.FindAsset(), Industry.GetQueue()

public void GenericIndustry.AppendProductList ( Asset productList[] ) [inline]

Adds any products that this industry is currently capable of consuming/producing to the end of the given list.

This methods appends all of the products from industryProductList into productList that are not already in the productList.

Parameters:
productList List of products to append the products of this industry to.

Reimplemented from Industry.

public float GenericIndustry.BeginLoad ( LoadingReport report ) [inline]

Called by Vehicle.LoadProduct() before the loading takes place.

This method overrides Industry.BeginLoad() so that the pipe animation is taken care if needed and extra time is returned to allow for it. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of unloading operation.
Returns :
Returns 30.0 to allow for the pipe animation to start if needed, 0.0 otherwise.

Reimplemented from Industry.

public float GenericIndustry.BeginUnload ( LoadingReport report ) [inline]

Called by Vehicle.UnloadProduct() before the unloading takes place.

This method overrides Industry.BeginLoad() so that the pipe animation is taken care if needed and extra time is returned to allow for it. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of unloading operation.
Returns :
Returns 30.0 to allow for the pipe animation to start if needed, 0.0 otherwise.

Reimplemented from Industry.

public float GenericIndustry.EndLoad ( LoadingReport report ) [inline]

Ends the pipe animation if needed.

This method is overrides Industry.EndLoad() to ensure that ThreadEndPipeAnimation() is called at the end of an unloading operation as well as returning the appropriate amount of time to allow for the animation. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of unloading operation.
Returns :
Returns 4.5 to allow for the pipe animation to end if needed, 0.0 otherwise.

Reimplemented from Industry.

public float GenericIndustry.EndUnload ( LoadingReport report ) [inline]

Ends the pipe animation if needed.

This method is overrides Industry.EndUnload() to ensure that ThreadEndPipeAnimation() is called at the end of an unloading operation as well as returning the appropriate amount of time to allow for the animation. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of unloading operation.
Returns :
Returns 4.0 to allow for the pipe animation to end if needed, 0.0 otherwise.

Reimplemented from Industry.

thread void GenericIndustry.GenericIndustryMain ( void ) [inline]

Generic main industry operating thread.

This thread is started by the Init() method when the industry game object is created to manage the industry. It can be thought of as the conductor that makes the industry run. Once started, it cycles through a wait statement indefinitely waiting for messages to process and act on.

Messages processed by this thread are:

  • ("Object", "Stopped")
  • ("Object", "Leave")
  • ("Object", "InnerEnter")
  • ("MapObject", "View-Details")
  • ("Browser-Closed", "")
Depending on what message is received, this method will call methods within this class to handle the required task.

public string GenericIndustry.GetDescriptionHTML ( void ) [inline]

Gets a description of this industry as a HTML page to be displayed to the user in the Surveyor Rule Editor.

This method overrides PropertyObject.GetDescriptionHTML() so that all the processes along with the products they consume and produce are listed such that the initial value and consumption/production rate can be edited for every single process through property links.

Returns :
Returns a HTML description of this industry listing all the processes and their respective consumption and production rates and initial defaults.

Reimplemented from PropertyObject.

public float GenericIndustry.GetLoadTime ( LoadingReport report ) [inline]

Called by Vehicle.LoadProduct() to determine how long the loading operation is to take.

This method is overrides Industry.GetLoadTime() to ensure that the appropriate amount of time is returned if the pipe animation is being used for loading. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of loading operation.
Returns :
Returns 2.0 to allow for the pipe loading if needed, 0.0 otherwise.

Reimplemented from Industry.

public string GenericIndustry.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description of a product asset as specified in the given property name.

Parameters:
propertyID Name of the property to get a readable description for. Must be prefixed with "input-amount/", "output-amount/", or "initial-count/" followed by the index of the product in industryProductList to get the description of.
Returns :
If "initial-count/" is requested, the string "Initial Amount of <name>" is returned, where <name> is the localised name of the product asset requested.

When "input-amount/" or "output-amount/", one of two possible strings is returned, either "Amount of <name> to consume" or "Amount of <name> to produce", depending on the isInput flag for the indexed product.

An empty string will be returned otherwise.
See also:
Asset.GetLocalisedName()

Reimplemented from PropertyObject.

public string GenericIndustry.GetPropertyName ( string propertyID ) [inline]

Gets a readable name of a product asset as specified in the given property name.

Parameters:
propertyID Name of the property to get a readable name for. Must be prefixed with "input-amount/", "output-amount/", or "initial-count/" followed by the index of the asset in industryProductList to get the name of.
Returns :
Returns the string "Amount of <name>" where <name> is the localised name of the product asset requested if a valid asset for it can be found, an empty string otherwise.
See also:
Asset.GetLocalisedName()

Reimplemented from PropertyObject.

public string GenericIndustry.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

Parameters:
propertyID Name of the property to get the type for. Must be prefixed with "input-amount/", "output-amount/" or "initial-count/" followed by a valid index value for the industryProductList array.
Returns :
If propertyID refers to a valid property for this industry (i.e. correct prefix name and array index), "int,0,<queue size>,10" is returned. This indicates that the indicating that the property value is an integer in the range of 0 to its queue's maximum size and edited in increments of 10. An empty string will be returned otherwise.
See also:
ProductQueue.GetQueueSize()

Reimplemented from PropertyObject.

public float GenericIndustry.GetUnloadTime ( LoadingReport report ) [inline]

Called by Vehicle.UnloadProduct() to determine how long the unloading operation is to take.

This method is overrides Industry.GetUnloadTime() to ensure that the appropriate amount of time is returned if the pipe animation is being used for loading. This will only be done if the usePipeAnimation flag is set.

Parameters:
report Progress report of loading operation.
Returns :
Returns 2.0 to allow for the pipe loading if needed, 0.0 otherwise.

Reimplemented from Industry.

public bool GenericIndustry.HandleTrain | ( | Train | train,
 |  | string | loadCommand
 | ) | [inline]

Called by the Load and astSrcDriveCmdLoad Unload driver commands to initiate loading/unloading of a train.

This is an implementation of Industry.HandleTrain() that allows for both generic loading and unloading operations to be performed. It will call and return the results of either HandleTrainLoadCommand() or HandleTrainUnloadCommand(), depending on what loadCommand is set to.

Parameters:
train | Train to control and perform the command on. Must be in an industry trigger.
loadCommand | String indicating what type of driver command that is calling this method. See Load and Unload Driver Command Strings for details.
Returns :
Returns true if the train is in a trigger and the command was performed successfully, false otherwise.
See also:
Industry.HandleTrain(), Buildable.IsTrainInTriggers(), Load and Unload Driver Command Strings

Reimplemented from Industry.

bool GenericIndustry.HandleTrainLoadCommand ( Train train ) [inline]

Called by HandleTrain() to drive a train not under user control through the industry to be loaded.

This method ensures the train is driven through the industry when not under user control so it can be loaded. Actual loading is handled by GenericIndustryMain() as it detects vehicles on triggers.

Parameters:
train Train to control and drive through the industry to unload.
Returns :
Always returns true.

bool GenericIndustry.HandleTrainUnloadCommand ( Train train ) [inline]

Called by HandleTrain() to drive a train not under user control through the industry to be unloaded.

This method ensures the train is driven through the industry when not under user control so it can be unloaded. Actual loading is handled by GenericIndustryMain() as it detects vehicles on triggers.

Parameters:
train Train to control and drive through the industry to unload.
Returns :
Always returns true.

public void GenericIndustry.Init ( void ) [inline]

Initialization method that launches the main industry thread.

If provided, Trainz calls the Init() method when it creates the game object. Usually the programmer would define an Init() method themselves to handle the initialization of data members and possibly even start a thread to manage the object.

The implementation in this class initializes the itc object and then starts the GenericIndustryMain() thread is started. This thread will handle the messaging required to 'run' an industry.

Reimplemented from MeshObject.

thread void GenericIndustry.PerformInnerEnterMoving | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Perform a load/unload operation on a moving vehicle.

This method is called by GenericIndustryMain() to load/unload a moving vehicle that has entered an industry trigger. It will call PerformMovingLoad() to handle the actual transfer of products (which must be user-implemented if they want their industry to load/unload moving vehicles). If the train that vehicle is in is under a script control, a message of type ("HandleTrain", "Release") is sent to the train one the loading/unloading has been completed.

Parameters:
vehicle | Vehicle that has entered the trigger.
triggerName | Name of the industry trigger that vehicle entered.

void GenericIndustry.PerformInnerEnterStop ( Vehicle vehicle ) [inline]

Stops a moving train so a vehicle can be loaded/unloaded.

This method is called by GenericIndustryMain() when a vehicle has entered a trigger but the trigger doesn't support loading/unloading while moving yet it supports loading/unloading while stopped and the vehicle is not under user control. It stops the train vehicle is attached to and as a result, GenericIndustryMain() will detect the vehicle stopping on the trigger and react appropriately.

Parameters:
vehicle Vehicle to stop the train of if needed.

void GenericIndustry.PerformMovingLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Called by PerformStopped() to load/unload a vehicle while it is moving.

This method has an empty implementation and must be implemented by the script programmer if they want their industry to load/unload a moving vehicle. No user implementation is needed if the industry concerned doesn't support the loading/unloading of moving vehicles.

Parameters:
vehicle | Vehicle to load while moving over triggerName.
triggerName | Name of the trigger where loading is to take place.

thread void GenericIndustry.PerformStopped | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Perform a load/unload operation on a moving vehicle.

This method is called by GenericIndustryMain() to load/unload a vehicle that has stopped on an industry trigger. It will call stop the train if necessary and call PerformStoppedLoad() to handle the actual transfer of products (which must be user-implemented if they want their industry to load/unload stopped vehicles). If the train that vehicle is from happens to be under script control, a message of type ("HandleTrain", "Release") is sent to the train once the loading/unloading has been completed.

Parameters:
vehicle | Vehicle that has entered the trigger.
triggerName | Name of the industry trigger vehicle has just entered.

void GenericIndustry.PerformStoppedLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Called by PerformStopped() to load/unload a vehicle when it has stopped.

This method has an empty implementation and must be implemented by the script programmer if they want their industry to load/unload a stopped vehicle. No user implementation is needed if the industry concerned doesn't support the loading/unloading of stopped vehicles.

Parameters:
vehicle | Vehicle to load when stopped on triggerName.
triggerName | Name of the trigger where loading is to take place.

void GenericIndustry.PerformStoppedNoTrigger ( Vehicle vehicle ) [inline]

Starts moving a stopped train in this industry that isn't user controlled.

This method is called by GenericIndustryMain() to start moving a train not under user control that has a vehicle stopped outside an industry trigger. It will set the train to keep driving so that the vehicle will eventually encounter a trigger.

Parameters:
vehicle Vehicle that is stopped yet not on a trigger.

public void GenericIndustry.SetPropertyValue | ( | string | propertyID,
 |  | int | value
 | ) | [inline]

Sets the value of the named property to the given int.

The are three types of properties in a GenericIndustry object:

  • output amount
  • input amount
  • initial count
The properties are used to refer to a quantity of products for an industry process' input/output requirements of a certain product. All of these properties are integer values and a set of these properties is used for each member of the industryProductList. This means these properties are present for each product that this industry supports.

The properties string will be prefixed with "input-amount/", "output-amount/" or "initial-count/" and after the slash, a number that corresponds an index in the industryProductList array is required. For example, "initial-count/2" refers to the initial count of the product in the 3rd position of industryProductList.

If propetyID is "initial-count/<x>", the initial count of the queue in position x of industryProductList will have its initial count set to value through SetQueueInitialCount().

When propertyID is "input-amount/<x>", the input amount per cycle for the product transfer described by industryProductList is set to value by calling Industry.SetProcessInput(). The same applies for "input-amount/<x>" except the output amount per cycle will be set to value by calling Industry.SetProcessOutput() instead.

Parameters:
propertyID | Name of the property to set the value of. See method description just above for details on GenericIndustry properties and what they are used for.
value | Value to set the property named by propertyID to. GetPropertyType() will provide a valid range of properties.
See also:
Industry.SetProcessInput(), Industry.SetProcessOutput()

Reimplemented from PropertyObject.

public void GenericIndustry.SetQueueInitialCount | ( | ProductQueue | queue,
 |  | Asset | asset,
 |  | int | newValue
 | ) | [inline]

Sets the initial count of the given queue such that it contains a set amount of a particular product.

Note:
DestroyAllProducts() is called on queue so any current contents will be destroyed.
Parameters:
queue | Queue in this industry to set the initial count of.
asset | Type of asset queue is to contain.
newValue | Amount of products of type asset that queue is to have as its initial default.
See also:
ProductQueue.DestroyAllProducts(), ProductQueue.CreateProduct(), MapObject.GetQueues()

thread void GenericIndustry.ThreadEndPipeAnimation ( Vehicle vehicle ) [inline]

Plays the pipe retraction animation.

Parameters:
vehicle Vehicle to end the animation on.

bool GenericIndustry.TriggerSupportsMovingLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Determines if the given vehicle can be loaded/unloaded at the specified trigger while moving.

This method is called by GenericIndustryMain() to determine if triggerName allows vehicle to be loaded/unloaded on it while moving. As the GenericIndustry implementation always returns false, the script programmer needs to write their own overridden version if they want any loading/unloading while moving to happen on a trigger in their industry.

Note:
If no loading/unloading while moving is supported on any of your industry triggers, then you don't need to implement this method as the default return value of false is sufficient.
Parameters:
vehicle | Vehicle that has recently entered/stopped on the trigger.
triggerName | Name of the trigger to check for support of loading/unloading with a moving vehicle.
Returns :
Returns true if triggerName supports loading from vehicle while moving, false otherwise.

bool GenericIndustry.TriggerSupportsStoppedLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Determines if the given vehicle can be loaded/unloaded at the specified trigger while stopped.

This method is called by GenericIndustryMain() to determine if triggerName allows vehicle to be loaded/unloaded on it while stopped. As the GenericIndustry implementation always returns false, the script programmer needs to write their own overridden version if they want any loading/unloading while stopped to happen on a trigger in their industry.

Note:
If no loading/unloading while stopped is supported on any of your industry triggers, then you don't need to implement this method as the default return value of false is sufficient.
Parameters:
vehicle | Vehicle that has recently entered/stopped on the trigger.
triggerName | Name of the trigger to check for support of loading/unloading with a stopped vehicle.
Returns :
Returns true if triggerName supports loading from vehicle while stopped, false otherwise.

thread void GenericIndustry.ViewDetails ( void ) [inline]

Display details about this industry in a Browser window.

This method is called by GenericIndustryMain() when a ("MapObject", "View-Details") message is received. The default implementation provide in this class is empty and does nothing and it is intended that the script programmer implements this method to display industry information in the info browser if desired.

GenericIndustryMain() also waits for messages of type ("Browser-Closed", "") so it can reset info to null when the user closes the browser window. So that the main thread can keep processing messages while the user is reading the browser window, ViewDetails() runs on a thread of its own.

Note:
The HTMLWindow class provides several handy utility methods that can be used to construct HTML code that describes an industry.
See also:
Browser, HTMLWindow

The documentation for this class was generated from the following file:
  • GenericIndustry.gs


GenericIntNumberHandler Class Reference

Inheritance diagram for GenericIntNumberHandler:

ConfigAssetHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public string | GetPropertyValue (string propertyID)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)

Detailed Description

A config asset handler that manages multiple integer properties.

This handler was initially written for a TRS2006 rule but the rule feature planned was scrapped, hence this class is not currently implemented or functional. Using this class IS NOT supported or recommended.

See also:
NumberValueInt, GenericStringHandler

Member Function Documentation

public string GenericIntNumberHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from ConfigAssetHandler.

public Soup GenericIntNumberHandler.GetProperties ( void ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from ConfigAssetHandler.

public string GenericIntNumberHandler.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string GenericIntNumberHandler.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string GenericIntNumberHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public string GenericIntNumberHandler.GetPropertyValue ( string propertyID ) [inline]

Gets the value of the named property as a string.

This method is called by PropertyObject.GetPropertyValue() to get the value of the named property.

Parameters:
propertyID Property to get the value of.
Returns :
Returns the value of propertyID as a string (convert if necessary). The HTMLPropertyHandler implementation will always return an empty string.
See also:
PropertyObject.GetPropertyValue()

Reimplemented from HTMLPropertyHandler.

public void GenericIntNumberHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

public void GenericIntNumberHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from ConfigAssetHandler.

public void GenericIntNumberHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


GenericListHandler Class Reference

Inheritance diagram for GenericListHandler:

ConfigAssetGroupHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public void | Init (Asset asset, string newConfigPrefix)
public string[] | GetPropertyElementList (string propertyID)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Detailed Description

A generic editable add/remove list handler where list items are sub-handlers in this grouping.

This class is a config handler class that allows a list handler where child handlers are list items to be constructed. GenericListHandler does not work on its own and must be inherited from. This is a complex and tricky class to use, so be careful and read the implementation to understand what is going on.

The config string table items this class supports are:

String Name | Description
"<config-prefix>-description" | Text placed above the table to describe things. Optional if you don't want titles/text stuff above your list.
"<config-prefix>-add" | Text used in link to add an item to the list.
"<config-prefix>-name-add" | Name of list to select items from.
"<config-prefix>-desc-add" | Description (tooltip) for list where items are selected from.
"<config-prefix>-add-all" | Description text for the link that adds all possible items to the list. If this string entry is empty or not provided, then there will be no link to add everything - keep in mind that not all lists would even be suited for this, so use with caution.
"<config-prefix>-delete-all" | Description text for the link that deletes all list items. If this string entry is empty or not provided, there will be no delete all link provided (which in many cases is probably not a bad idea).
"<config-prefix>-delete" | Text used for the delete link next to each list item.
"<config-prefix>-column0" | Title of 1st column of the list.
"<config-prefix>-columnX" | Title of Xth column of the list. How many of these column entries there are dictates how many columns wide the list table is. Numbering must be linear and sequential starting from 0.
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

As will as the string table requirements, you must also override the ConstructHandlers() method in your own child class. ConstructHandlers() is called by SetProperties() to re-create the child handlers (list items in this handler) before it will initialize them.

The GenericListHandler class is used by the Set Junctions rule with a config prefix of "set-junctions" as shown in the table below:

String Name | Contents
"set-junctions-display-name" | "Set the following junctions to a specific state:<br>"
"set-junctions-html-prefix" | "<table border='0' cellspacing='0' cellpadding='0'><tr height=1><td colspan=2></td></tr><tr><td width=4></td><td><font color=#000000>"
"set-junctions-html-sufix" | "</font></td></tr></table><br><br>"
"set-junctions-html-table-row-odd" | "bgcolor=#CCCCAA22"
"set-junctions-html-table-row-even" | "bgcolor=#CCCCAA44"
"set-junctions-html-property" | "$0"
"set-junctions-blank-string" | "<i>click to select</i>"
"set-junctions-add" | "Add Junction"
"set-junctions-name-add" | "Junctions"
"set-junctions-desc-add" | "Junction to add to the list"
"set-junctions-add-all" | "Add All"
"set-junctions-add-all-tooltip" | "Adds all junctions on the map to the list"
"set-junctions-delete-all" | "Delete All"
"set-junctions-delete-all-tooltip" | "Deletes all junction from the list"
"set-junctions-column0" | "<font color=#000000><i>Junction</i></font> "
"set-junctions-column1" | "<font color=#000000><i>Setting</i></font> "
"set-junctions-column2" | "<font color=#000000><i>Locked</i></font> "
"set-junctions-delete" | "<font color=#000000>Remove</font>"

Note that Set Junctions has its own GenericListHandler-derived (JunctionListHandler) class as will as a handler class (JunctionListItem) that is used for junction list items. You will need to define an item handler to go with your GenericListHandler-derived class so the "<\td><td>" tags can be inserted between table cells.

This list handler class is used by the following rules:

  • Display HTML Pages
  • Driver Command Check
  • Multiple Junction Alignment Check
  • Multiple Resource Check
  • Set Coupler Masks
Useful interface methods provided with this class are:
  • public void AddItem (string itemDisplayName)
  • public void RemoveItem (string itemName)
  • public HTMLPropertyHandler GetItem (int index)
  • public int CountHandlers ()
  • public int CountItems ()
  • void ConstructHandlers (Soup listItemsSoup)
Note:
GenericListHandler was mainly written as a utility class for use in the TRS2006 session rules. It is not part of the core Trainz API and is not fully documented. Those who are interested in how this class works can see all the full implementation in the \Trainz\scripts\ListItemPropertyHandler.gs script file.
See also:
AssetCheckListHandler, CheckListPropertyHandler, RadioButtonListHandler, RadioButtonGroupHandler, EnumeratedPropertyHandler, EnumeratedGameObjectHandler, GenericBoolHandler, GenericStringHandler

Member Function Documentation

public string GenericListHandler.GetDescriptionHTML ( void ) [inline]

Gets a HTML description of this group handler based on all of the child handlers.

Overridden from HTMLPropertyHandler.GetDescriptionHTML() to get the HTML description of each child handler in this group for inclusion in the returned description.

Returns :
Returns a HTML description built up by gathering the descriptions of all of the child handlers.

Reimplemented from ConfigAssetGroupHandler.

public Soup GenericListHandler.GetProperties ( ) [inline]

Gets this handler's properties in a database.

Overridden from HTMLPropertyHandler.GetProperties() to save the properties of all sub handlers and then return a Soup containing a sub-database for each sub handler obtained by calling the sub handlers GetProperties() method.

Returns :
Returns a Soup database containing the saved properties of this group handler and its sub handlers.

Reimplemented from ConfigAssetGroupHandler.

public string GenericListHandler.GetPropertyDescription ( string propertyID ) [inline]

Gets a description for the named property.

Overridden from HTMLPropertyHandler.GetPropertyDescription() to get the property name from the appropriate child handler.

Parameters:
propertyID Name of the property to get the description of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyDescription() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public string [] GenericListHandler.GetPropertyElementList ( string propertyID ) [inline]

Gets the elements list for the named list property.

Overridden from HTMLPropertyHandler.GetPropertyElementList() to get the elements list for the named list property.

Parameters:
propertyID Name of the property to get the element list of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyElementList() method does, an empty string array otherwise.

Reimplemented from HTMLPropertyGroup.

public string [] GenericListHandler.GetPropertyElementList ( string propertyID )

Gets the elements list for the named list property.

Overridden from HTMLPropertyHandler.GetPropertyElementList() to get the elements list for the named list property.

Parameters:
propertyID Name of the property to get the element list of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyElementList() method does, an empty string array otherwise.

Reimplemented from HTMLPropertyGroup.

public string GenericListHandler.GetPropertyName ( string propertyID ) [inline]

Gets a descriptive name for the given property.

Overridden from HTMLPropertyHandler.GetPropertyName() to get the property name from the appropriate child handler.

Parameters:
propertyID Name of the property to get the descriptive name of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyName() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public string GenericListHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

Overridden from HTMLPropertyHandler.GetPropertyType() to get the type of the named property from the appropriate child handler.

Parameters:
propertyID Name of the property to get the type of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyType() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public void GenericListHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset group handler.

When a config group asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Note that calling this method does not do anything to any sub-handlers. It is recommended that Init() is called on the ConfigAssetGroupHandler before any sub-handlers are added.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetGroupHandler.

public void GenericListHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset group handler.

When a config group asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Note that calling this method does not do anything to any sub-handlers. It is recommended that Init() is called on the ConfigAssetGroupHandler before any sub-handlers are added.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetGroupHandler.

public void GenericListHandler.SetProperties ( Soup soup ) [inline]

Initializes this handler's properties from the given database.

Overridden from HTMLPropertyHandler.SetProperties() to initialize all of the sub handlers from the given Soup database. The HTMLPropertyGroup implementation of this method assumes the sub handlers have already been added to the group handler - it only initializes existing sub handlers and generally isn't meant to create new sub handlers itself (although you can do that in your own overridden implementation if you really want to).

Parameters:
soup Database of property values to initialize this handler with. Sub-databases in side this soup will be used to initialize each sub-handler.

Reimplemented from ConfigAssetGroupHandler.

public void GenericListHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the value of the named property.

Overridden from HTMLPropertyHandler.SetPropertyValue() to set the value of the named property on the appropriate child handler.

Parameters:
propertyID | Name of the property to set the value of. This should be a full property string with group handler and sub handler prefixes.
value | Value to set the property to.

Reimplemented from HTMLPropertyGroup.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


GenericPassengerStation Class Reference

Inheritance diagram for GenericPassengerStation:

BaseIndustry List of all members.

Public Methods

public void | UpdateStationParameters (void)
Update the station process parameters from the platform handler 'time-of-day graph' settings.

void | GetTrackAndSide (Vehicle vehicle, string triggerName, TrackLoadInfo retInfo)
void | PerformProductLoadAndUnload (ProductQueue queue, Train train, int action, TrackLoadInfo info)
bool | PerformMassStoppedLoad (Vehicle vehicle, string triggerName)
void | EnablePassengerSpawn (bool enable)
void | InitPassengerStation (int platformCount)
public thread void | StationMain (void)
public void | SetProperties (Soup soup)

Public Attributes

public PassengerStationInfo[] | psi
Property handlers, one for each platform.

public int | m_platformCount = 0
Amount of platforms this station has.

Passenger Station Actions

Passenger Station Actions

These constants define the different types of loading/unloading actions that can occur in a GenericPassengerStation.

See also:
GenericPassengerStation.PerformProductLoadAndUnload()

define int | ACTION_NOTHING = 0
No passenger action.

define int | ACTION_LOADING = 1
Passengers are boarding (being loaded to) the train.

define int | ACTION_UNLOADING = 2
Passengers are disembarking (unloading from) the train.

Detailed Description

A generic passenger station class that can be used to build functional stations easily.

This industry class provides the framework needed to easily make a generic passenger station with one or more platforms. Passenger loading/unloading and the properties interface are all handled automatically by this class such that not too much work needs to be done by the creator of a station asset to get their station to work in the Trainz World.

For a station to work with this generic class, it must have two industry processes and two product queues for each platform. A platform in a station has an index value associated with it such that the first platform has an index of 0 and the second one has an index of 1 etc.

For each platform, the following processes are required (where x is the platform index):

  • "passenger_spawn_x"
  • "passenger_delete_x"
As well as the two processes, the following two queues are required to for a platform as well:
  • "passengers_off_x"
  • "passengers_on_x"
The "passengers_off_x" queue is where disembarked passengers are placed on platform x and deleted by the "passenger_delete_x" process. The "passenger_spawn" process creates new passengers for the "passengers_on_x" queue to board a train.

For your station to make use of this class to automatically handle its loading and disembarking of passengers, the following four methods need to be implemented in your own station:

  • Init(void)
  • GetTrackAndSide()
  • TriggerSupportsMassStoppedLoad()
  • AppendDriverDestinations()
For the Init() method, you must tell the script how many platforms the station has with InitPassengerStation() and then call StationMain() to start station's thread. An example Init() method is provided below:

   public void Init(void)
   {
     inherited();

     InitPassengerStation(2);

     StationMain();
   }

Note how the parent method is called through to with the inherited keyword. You should ALWAYS do this to ensure initialization tasks in overridden methods are performed.

The GetTrackAndSide() method will be used by the generic passenger station script to determine which side of a Vehicle that the doors will open on. How to go about implementing that method is examined in its description.

TriggerSupportsMassStoppedLoad() is a BaseIndustry method used to determine if an industry (which a station technically is from the script point of view) supports mass stopped loading for a Vehicle on the named scenery trigger. For passenger stations, mass stopped loading is used to transfer passengers between stopped vehicles and the platform, hence this method must return true if the given vehicle is on scenery triggers near the platform.

   bool TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName)
   {
     bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();

     if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_e")
     {
       int direction = vehicle.GetRelationToTrack(me, "track_0");
       if (!vehicleToTrain)
         direction = -direction;

       if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_0_e")
         return<b> true</b>;

       if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_0_a")
         return<b> true</b>;
     }

     if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_b" or triggerName == "trigger_track_0_c" or triggerName == "trigger_track_0_d" or triggerName == "trigger_track_0_e")
     {
       if (vehicle.GetMyTrain().IsStopped())
         return<b> true</b>;
     }

     return<b> false</b>;
   }

Note how in the above code if the vehicle is in either the first ("trigger_track_0_a") or last ("trigger_track_0_e") scenery trigger and is facing a particular direction, true is returned without verifying that the train has stopped. This is because that vehicle is about to enter the inner scenery triggers. If the vehicle is in a train that has stopped in any of the scenery triggers along the platform, true is returned. Any other situation results in false.

AppendDriverDestinations() is an Industry method used to determine different destination tracks for a train in that industry for use by the Drive To driver command. For a station based on this class, a destinations for each platform is required. Here is an example implementation for a station with two platforms:

   public void AppendDriverDestinations(string[] destNames, string[] destTracks)
   {
     destNames[destNames.size()]   = "Platform 1";
     destTracks[destTracks.size()] = "track_0";

     destNames[destNames.size()]   = "Platform 2";
     destTracks[destTracks.size()] = "track_1";
   }

Note that the code above has been kept simple for demonstration purpose. You should ideally use string table entries from your asset's string table for things like the platform names as this makes localisation of assets much easier.

This class is used to provide passenger functionality for the following stations:

  • Airport
  • Brick Station Large
  • Brick Station Medium
  • Brick Station Medium2
  • Brick Station Small
  • Seaport
  • Small Station
The full script source code is included for all of the above stations and provide plenty of implementation examples.

See also:
PassengerStationInfo, TrackLoadInfo, GenericIndustry

Member Function Documentation

void GenericPassengerStation.EnablePassengerSpawn ( bool enable ) [inline]

Enable or disable the passenger spawning processes for each platform of this station.

This private method allows the passenger spawning processes for each platform of the station to be switched on or off.

Parameters:
enable Use true to enable passenger spawning, false to disable.

void GenericPassengerStation.GetTrackAndSide | ( | Vehicle | vehicle,
 |  | string | triggerName,
 |  | TrackLoadInfo | retInfo
 | ) | [inline]

Determines which side of the given vehicle passengers will board and disembark from.

This method is used by the station script to determine which track, platform and side vehicle passengers will board and disembark from.

This is one of the four methods that MUST be implemented for and the reason a custom implementation is that each station's platform(s), track and scenery trigger is going to be very specific to the station.

When implementing this method, the programmer needs to set the trackName, trainLeftSide and platformIndex members of the retInfo parameter. How these values are filled needs to be determined based on the vehicle and triggerName.

An example implementation for a station with two platforms is provided below:

     void GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo)
     {
       if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_b" or triggerName == "trigger_track_one_c")
       {
         retInfo.trackName = "track_one";
         retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) != Vehicle.DIRECTION_BACKWARD) == vehicle.GetDirectionRelativeToTrain();
         retInfo.platformIndex = 0;
       }
       else if (triggerName == "trigger_track_two_a" or triggerName == "trigger_track_two_b" or triggerName == "trigger_track_two_c")
       {
         retInfo.trackName = "track_two";
         retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) == Vehicle.DIRECTION_BACKWARD) == vehicle.GetDirectionRelativeToTrain();
         retInfo.platformIndex = 1;
       }
     }

Note how the vehicle's direction relative to the track is checked, hence the programmer needs to understand the direction of their station's track pieces.

If an implementation is not provided for this method, a script exception will be thrown.

Parameters:
vehicle | Vehicle to find the side of.
triggerName | Name of scenery trigger where loading/unloading is to take place.
retInfo | Return parameter that this method must setup with details of the track name, vehicle side and platform index number.

void GenericPassengerStation.InitPassengerStation ( int platformCount ) [inline]

Passenger station initialization method.

This method creates the property handlers and data members needed to manage a station with platformCount amount of platforms. For the generic passenger station to work, you MUST CALL this method from your Init() implementation as described in the main description of this class.

Parameters:
platformCount Amount of platforms this station is to have.

bool GenericPassengerStation.PerformMassStoppedLoad | ( | Vehicle | vehicle,
 |  | string | triggerName
 | ) | [inline]

Performs the transfer of passengers between this station and the given vehicle.

This method is overridden from BaseIndustry to provide automatic handling of passenger transfer for all platforms of this station. As it is fully implemented in GenericPassengerStation, it is not something you need to worry about for your own station. However those who are curious can find the full implementation of this method in the \Trainz\scripts\GenericPassengerStation.gs script file.

Support for animated passenger carriage doors is required, however the vehicle must have its animations named "left-passenger-door" and "right-passenger-door".

Parameters:
vehicle | Vehicle that is to be loaded/unloaded.
triggerName | Name of the trigger where loading/unloading is to take place. The GetTrackAndSide() implementation will need to determine which platform corresponds to this trigger and the side of vehicle to open the doors on.

Reimplemented from BaseIndustry.

void GenericPassengerStation.PerformProductLoadAndUnload | ( | ProductQueue | queue,
 |  | Train | train,
 |  | int | action,
 |  | TrackLoadInfo | info
 | ) | [inline]

Transfers passengers between a train and a platform on this station.

This method is called by PerformMassStoppedLoad() to transfer passengers between queue and train. As it is fully implemented in GenericPassengerStation, it is not something you need to worry about for your own station. However those who are curious can find the full implementation of this method in the \Trainz\scripts\GenericPassengerStation.gs script file.

Parameters:
queue | Passenger product queue for the platform that the passengers are going to be transferred to/from.
train | Train that the passengers will get on/off from.
action | Defines whether this method is to board (ACTION_LOADING) or disembark (ACTION_UNLOADING) passengers. Note that there are separate queues for boarding and leaving passengers so this method would be called more than once.
info | Defines the side of the train, track and platform that this boarding/disembarking is to happen on.

public void GenericPassengerStation.SetProperties ( Soup soup ) [inline]

Instructs this PropertyObject to initialize its properties from the given database.

If the database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

When overriding this method to handle your own properties, always call through to the overridden parent by using inherited like this:

     public void SetProperties(Soup soup)
     {
       // call overridden parent with soup passed up to it
       inherited(soup);

       // your initialization goes here...
     }

In the PropertyObject implementation, if a property handler is attached to this object and it has been set to have its properties saved, that handler's SetProperties() method will be called.

Note:
It is possible that in future versions of Trainz, parent methods like this one may have their implementation modified. By not calling through to the overridden parent, you will ill be running the risk of having your assets NOT WORKING in a future version of Trainz.
Parameters:
soup Database to initialize this property object with.
See also:
HTMLPropertyHandler.SetProperties(), HTMLPropertyHandler.GetSavesProperties()

Reimplemented from BaseIndustry.

public thread void GenericPassengerStation.StationMain ( void ) [inline]

Main passenger station thread.

This thread is responsible for updating the various station parameters as the session progresses.

For the generic passenger station to work, you MUST CALL this method from your Init() implementation as described in the main description of this class.

The documentation for this class was generated from the following file:
  • GenericPassengerStation.gs


GenericStringHandler Class Reference

Inheritance diagram for GenericStringHandler:

ConfigAssetHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public void | Init (Asset asset, string newConfigPrefix, int newStringCount)
public int | GetStringCount (void)
public string | GetStringValue (int valueIndex)
public string | GetStringDisplayValue (int valueIndex)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public string | GetPropertyValue (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)

Detailed Description

A config asset handler that manages multiple string properties.

This handler manages a list of string property values. Although the amount of strings this handler can have is customizable, once created the amount of strings is set and cannot be changed unless the object is re-initialized.

This class varies from other config asset handler classes as it is not initialized through the Init() method. Instead, you must call Init(Asset,string,int) method where you specify how many strings you want the handler to manage.

This config handler has a property for each string it contains. The property name for a string takes the form of "string/$N" where $N is the index to the desired string.

The string table items supported by this config asset handler are:

String Name | Description
"<config-prefix>-display-X" | Template string to display various strings of this handler in the properties window where 'X' is the total amount of strings. There must be string parameters from $0 through to $X for each string this handler has. These parameters can be placed within the string in any order and surrounding by other text as desired.
"<config-prefix>-blank-$N" | Default value used to represent a blank, un-initialized $Nth [0-X] string. Having such a default place holder for each string in the handler is essential, otherwise a property link to click on and change the string value cannot be provided.
"<config-prefix>-name-string/$N" | Name to describe the $Nth string [0-X] in a text entry box when setting it.
"<config-prefix>-desc-string/$N" | Text description used as a tooltip to describe what the $Nth string property represents in the text entry box. Optional but advised.
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

For this config asset handler to work, it is essential that the first string table item listed above is included along with a "<config-prefix>-blank-$N" item for each string property the handler is to have.

Having a "<config-prefix>-name-string/$N" and "<config-prefix>-desc-string/$N" values for each string property is optional but strongly recommended if you want your properties window to be user friendly.

Both the "<config-prefix>-html-prefix" and "<config-prefix>-html-sufix" string items are optional, although if present the GetDescriptionHTML() implementation of this class will use them to wrap the generated HTML code up in.

Note:
GenericStringHandler is not very tolerant of bad string table configurations. They must be match the specifications above and correspond to the amount of string properties you specify when initializing the GenericStringHandler object with its Init(Asset,string,int) method.
As an example, here are some string table items from the Wait for HTML Pages rule. This particular configuration is used for a GenericStringHandler that has one string property so a HTML page name can be used in the rule's configuration properties.

String Name | Contents
"wait-page-open-display-1" | "open the page named $0"
"wait-page-open-blank-0" | "index"
"wait-page-open-name-string/0" | "HTML page name"
"wait-page-open-desc-string/0" | "Name of HTML page without the .html extension"
"wait-page-open-html-prefix" | "<font color=#000000>"
"wait-page-open-html-sufix" | "</font>"

This handler is also used by Set HTML Pages rule.

See also:
ConfigAssetHandler, CheckBoxHandler, AssetCheckListHandler, CheckListPropertyHandler, EnumeratedAssetHandler, GenericBoolHandler, GenericIntNumberHandler

Member Function Documentation

public string GenericStringHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from ConfigAssetHandler.

public Soup GenericStringHandler.GetProperties ( void ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from ConfigAssetHandler.

public string GenericStringHandler.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string GenericStringHandler.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string GenericStringHandler.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public string GenericStringHandler.GetPropertyValue ( string propertyID ) [inline]

Gets the value of the named property as a string.

This method is called by PropertyObject.GetPropertyValue() to get the value of the named property.

Parameters:
propertyID Property to get the value of.
Returns :
Returns the value of propertyID as a string (convert if necessary). The HTMLPropertyHandler implementation will always return an empty string.
See also:
PropertyObject.GetPropertyValue()

Reimplemented from HTMLPropertyHandler.

public int GenericStringHandler.GetStringCount ( void ) [inline]

Gets the amount of string properties this handler has.

Note:
The amount of strings is set on initialization and can't be changed unless you re-initialize the GenericStringHandler object.
Returns :
Returns the amount of string properties this handler has.

public string GenericStringHandler.GetStringDisplayValue ( int valueIndex )

Gets the display value of the specified string by index.

This method is intended to be used for interface displays where a more presentable form of the string property is required.

Parameters:
valueIndex Index to the string property.
Returns :
Returns the contents of the string property specified by valueIndex. If the string isn't already set to something, the default blank value for that string as specified in the "<config-prefix>-blank-<index>" string table entry of the host asset will be returned. If this default blank value can't be found or valueIndex refers to an invalid string, "null" (as a 4 character string, not a null reference) is returned.

public string GenericStringHandler.GetStringValue ( int valueIndex )

Gets the contents of the specified string property by index.

Parameters:
valueIndex Index of the string property to get the current
Returns :
Returns the contents of the string property specified by valueIndex. If the string isn't already set to something, a blank string of "" is returned. If valueIndex doesn't refer to a valid string property

public void GenericStringHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix,
 |  | int | newStringCount
 | ) |

Variation of Init() with an extra parameter to specify the amount of strings this handler is to have.

This variation of Init() MUST used for a GenericStringHandler as the handler needs to know how many property strings it is going to have on initialization. This also applies to any child classes.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
newStringCount | Amount of string properties this handler will have.

public void GenericStringHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from ConfigAssetHandler.

public void GenericStringHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from ConfigAssetHandler.

public void GenericStringHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


GSObject Class Reference

Inheritance diagram for GSObject:

Asset GameObject HTMLPropertyHandler IndustryTrainController KUID KUIDList LoadingReport Menu Permit ProductFilter ProductQueue Soup StringTable TrainTimetable

Detailed Description

A generic empty parent class.

The GSObject class is an empty class with no methods or data members. It is used as a generic parent class so that a variety of other classes can all be used as parameters to a function.

Quite a few Trainz classes now fall under the GSObject hierarchy. Classes that directly inherit from GSObject are:

  • Asset
  • GameObject
  • HTMLPropertyHandler
  • IndustryTrainController
  • KUID
  • KUIDList
  • LoadingReport
  • Menu
  • Permit
  • ProductFilter
  • ProductQueue
  • Soup
  • StringTable
  • TrainTimetable
Any child class of the classes listed above can also be considered a GSObject. When accessing a GSObject from a parameter, be sure to cast the object to the class you want to use and then verify that cast object before use.

Currently there is only one major usage of GSObject in the Trainz API and that is as a generic object parameter array for the Library.LibraryCall() method.

See also:
Library.LibraryCall()

The documentation for this class was generated from the following file:
  • gs.gs


GSTrackSearch Class Reference

List of all members.

Public Methods

public native MapObject | SearchNext (void)
public native MapObject | GetMapObject (void)
public native float | GetDistance (void)
public native bool | GetFacingRelativeToSearchDirection (void)

Detailed Description

Interface class to search a length of track for Trackside items.

The GSTrackSearch class provides an interface to access trackside items along a track in a certain direction from an existing source trackside item. A GSTrackSearch object can be obtained by calling the BeginTrackSearch() method on the Trackside item that you want to start your search from.

The SearchNext() and GetMapObject() methods are provided to get a reference to a discovered Trackside object. The reference returned by these methods can be cast to a Trackside child classes to find out if that item is in fact a Signal or a Junction for instance. As the script code doesn't know what the next item will be, always verify the cast.

See also:
Trackside, Trackside.BeginTrackSearch()

Member Function Documentation

public native float GSTrackSearch.GetDistance ( void )

Gets the distance from the start of this search to the current item.

Returns :
Returns the distance in meters along the track from the Trackside item this search was started from to the current Trackside item.

public native bool GSTrackSearch.GetFacingRelativeToSearchDirection ( void )

Gets the direction of the current item relative to the direction of the search.

This method indicates the direction of the current Trackside item of this search relative to the direction of the search. It does not indicate the direction of the current item relative to the track's direction or the direction of the Trackside item that the search was started from.

Returns :
Returns true if the current Trackside item's orientation is in the same direction of the search, false otherwise if the item is facing against the search.

public native MapObject GSTrackSearch.GetMapObject ( void )

Gets the current Trackside item that this search is at.

Returns :
Returns the current Trackside item that this search is at, null otherwise.

public native MapObject GSTrackSearch.SearchNext ( void )

Moves this search along to the next Trackside item and returns it.

The SearchNext() method moves the search along to the next Trackside item and returns it (if any). As this method provides a way to move the search along, it can be thought of as an iterator to access the next item.

The scope of a track search is limited and can only go so far. Therefore if the end of the line is encountered or there is an obstacle like a junction set against the path of the search, then the search will end. A null return value indicates the search can't go any further, so always the returned reference for this. Level crossings and turntables will also block the search from going any further.

Returns :
Returns the next Trackside item if possible, null otherwise.

The documentation for this class was generated from the following file:
  • GSTrackSearch.gs


HTMLPropertyGroup Class Reference

Inheritance diagram for HTMLPropertyGroup:

HTMLPropertyHandler ConfigAssetGroupHandler ConsistListHelper TrainHelperInfo VehicleHelperInfo CheckListGroupHandler GenericListHandler RadioButtonGroupHandler List of all members.

Public Methods

public void | AddHandler (HTMLPropertyHandler handler, string subPrefix)
public void | RemoveHandler (HTMLPropertyHandler handler)
public void | LogHandlers (void)
Logs useful information about all sub handlers in this group handler to the \Trainz\JetLog.txt log file.

public string | GetDescriptionHTML (void)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public string | GetPropertyValue (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public void | SetPropertyAttribute (string propertyID, string attribute, PropertyValue value)
public PropertyValue | GetPropertyAttribute (string propertyID, string attribute)
public void | RefreshBrowser (Browser browser)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)
public void | SetPrefix (string prefix)
HTMLPropertyHandler | FindHandler (string propertyID)
public string | GetDescriptionHTML (void)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public string | GetPropertyValue (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public void | SetPropertyAttribute (string propertyID, string attribute, PropertyValue value)
public PropertyValue | GetPropertyAttribute (string propertyID, string attribute)
public void | RefreshBrowser (Browser browser)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)
public void | SetPrefix (string prefix)

Detailed Description

A group property handler.

This class manages multiple property handlers allowing the different handlers to be combined and used as one. As this class is derived from HTMLPropertyHandler, it has the same interface as a a regular property handler and can be assigned to a PropertyObject like a regular handler. This allows us to use more than one property handler for an object. As a result, it is easier to combine and reuse handlers as required for different property objects.

As any handler derived from HTMLPropertyHandler can be added as a sub handler, it is possible to create a hierarchy of handlers by adding an existing group handler such that it becomes a sub handler.

The group handler works by simply passing on the various property handler function calls to the appropriate child handler equivalent. It identifies each child handler by extending their prefix, so be careful to ensure two child handles don't have the same prefix.

See also:
HTMLPropertyHandler, PropertyObject, PropertyValue

Member Function Documentation

public void HTMLPropertyGroup.AddHandler | ( | HTMLPropertyHandler | handler,
 |  | string | subPrefix
 | ) |

Adds the given property handler to this group handler.

Note:
A specific property handler object instance should not be used as a sub handler for more than one particular group handler. Doing so is at your own risk.
Parameters:
handler | New sub handler to add to this group.
subPrefix | Prefix to identify the sub handler by. This string will be prefixed with the existing prefix of handler so its actual prefix is updated in the process of being added to this group.

Reimplemented in CheckListGroupHandler.

HTMLPropertyHandler HTMLPropertyGroup.FindHandler ( string propertyID )

Internal private method that allows a sub handler to be found by name.

Parameters:
propertyID Prefix of the sub handler to search for.
Returns :
Returns the requested sub handler if it exists in this group, null otherwise.

public string HTMLPropertyGroup.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConsistListHelper, ConfigAssetGroupHandler, CheckListGroupHandler, GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public string HTMLPropertyGroup.GetDescriptionHTML ( void )

Gets a HTML description of this group handler based on all of the child handlers.

Overridden from HTMLPropertyHandler.GetDescriptionHTML() to get the HTML description of each child handler in this group for inclusion in the returned description.

Returns :
Returns a HTML description built up by gathering the descriptions of all of the child handlers.

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConsistListHelper, ConfigAssetGroupHandler, CheckListGroupHandler, GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public Soup HTMLPropertyGroup.GetProperties ( void ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConsistListHelper, ConfigAssetGroupHandler, CheckListGroupHandler, RadioButtonGroupHandler, GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public Soup HTMLPropertyGroup.GetProperties ( void )

Gets this handler's properties in a database.

Overridden from HTMLPropertyHandler.GetProperties() to save the properties of all sub handlers and then return a Soup containing a sub-database for each sub handler obtained by calling the sub handlers GetProperties() method.

Returns :
Returns a Soup database containing the saved properties of this group handler and its sub handlers.

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConsistListHelper, ConfigAssetGroupHandler, CheckListGroupHandler, RadioButtonGroupHandler, GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public PropertyValue HTMLPropertyGroup.GetPropertyAttribute | ( | string | propertyID,
 |  | string | attribute
 | ) | [inline]

Gets the attributes of the named property.

This method is provided as a mechanism for the properties of a handler to be accessed externally. Implementing it is not required as it isn't called by a host PropertyObject. How it is used is entirely up to the programmer making the handler.

Parameters:
propertyID | Name of the property to get the attributes of.
attribute | Attribute field. How this string value is interpreted is entirely up to the programmer implementing this method.
Returns :
Should return a PropertyValue object containing the requested attributes of the named property. The default top-level implementation returns a PropertyValue that is of type NULL_TYPE.

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConfigAssetGroupHandler.

public PropertyValue HTMLPropertyGroup.GetPropertyAttribute | ( | string | propertyID,
 |  | string | attribute
 | ) |

Gets the attributes of the named property.

Overridden from HTMLPropertyHandler.GetPropertyAttribute() to get the attributes of the named property from the appropriate sub handler.

Parameters:
propertyID | Name of the property to get the attributes of. This should be a full property string with group handler and sub handler prefixes.
attribute | Attribute field.
Returns :
Returns whatever the sub handler's GetPropertyAttribute() method does, a PropertyValue that is of type NULL_TYPE otherwise.

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConfigAssetGroupHandler.

public string HTMLPropertyGroup.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

Reimplemented in GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public string HTMLPropertyGroup.GetPropertyDescription ( string propertyID )

Gets a description for the named property.

Overridden from HTMLPropertyHandler.GetPropertyDescription() to get the property name from the appropriate child handler.

Parameters:
propertyID Name of the property to get the description of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyDescription() method does, "null" otherwise.

Reimplemented from HTMLPropertyHandler.

Reimplemented in GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public string [] HTMLPropertyGroup.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from HTMLPropertyHandler.

Reimplemented in GenericListHandler, and GenericListHandler.

public string [] HTMLPropertyGroup.GetPropertyElementList ( string propertyID )

Gets the elements list for the named list property.

Overridden from HTMLPropertyHandler.GetPropertyElementList() to get the elements list for the named list property.

Parameters:
propertyID Name of the property to get the element list of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyElementList() method does, an empty string array otherwise.

Reimplemented from HTMLPropertyHandler.

Reimplemented in GenericListHandler, and GenericListHandler.

public string HTMLPropertyGroup.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

Reimplemented in GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public string HTMLPropertyGroup.GetPropertyName ( string propertyID )

Gets a descriptive name for the given property.

Overridden from HTMLPropertyHandler.GetPropertyName() to get the property name from the appropriate child handler.

Parameters:
propertyID Name of the property to get the descriptive name of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyName() method does, "null" otherwise.

Reimplemented from HTMLPropertyHandler.

Reimplemented in GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public string HTMLPropertyGroup.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConsistListHelper, CheckListGroupHandler, GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public string HTMLPropertyGroup.GetPropertyType ( string propertyID )

Gets the type of the named property.

Overridden from HTMLPropertyHandler.GetPropertyType() to get the type of the named property from the appropriate child handler.

Parameters:
propertyID Name of the property to get the type of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyType() method does, "null" otherwise.

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConsistListHelper, CheckListGroupHandler, GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public string HTMLPropertyGroup.GetPropertyValue ( string propertyID ) [inline]

Gets the value of the named property as a string.

This method is called by PropertyObject.GetPropertyValue() to get the value of the named property.

Parameters:
propertyID Property to get the value of.
Returns :
Returns the value of propertyID as a string (convert if necessary). The HTMLPropertyHandler implementation will always return an empty string.
See also:
PropertyObject.GetPropertyValue()

Reimplemented from HTMLPropertyHandler.

public string HTMLPropertyGroup.GetPropertyValue ( string propertyID )

Gets the value of the named property.

Overridden from HTMLPropertyHandler.GetPropertyValue() to get the value of the named property as a string from the appropriate child handler.

Parameters:
propertyID Name of the property to get the value of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyValue() method does, an empty string ("") otherwise.

Reimplemented from HTMLPropertyHandler.

public void HTMLPropertyGroup.RefreshBrowser ( Browser browser ) [inline]

Refreshes the given browser with the properties of this handler.

Parameters:
browser Browser to update.
See also:
PropertyObject.PropertyBrowserRefresh()

Reimplemented from HTMLPropertyHandler.

public void HTMLPropertyGroup.RefreshBrowser ( Browser browser )

Refreshes the given browser with the properties of this handler.

Overridden from HTMLPropertyHandler.RefreshBrowser() to refresh a browser with the HTML from all of the sub handlers.

Parameters:
browser Browser to refresh.

Reimplemented from HTMLPropertyHandler.

public void HTMLPropertyGroup.RemoveHandler ( HTMLPropertyHandler handler )

Removes the given sub handler from this group.

Parameters:
handler Handler to remove from this group handler. If it isn't a member of this group, nothing will be done by this method.

public void HTMLPropertyGroup.SetPrefix ( string prefix ) [inline]

Sets the prefix of this property handler.

All property handlers have a prefix string. The prefix string is what the handler will prefix all of its property reference names with. If a PropertyObject only contain a basic handler that isn't a group handler then you can get away without setting the prefix string.

For the sake of making your handler more versatile and easier to use, you should always strip the prefix of a property string in your implementations of the various methods in this handler. HTMLPropertyHandler includes internal prefix utility methods to do this for you.

For example, here is a simple GetPropertyValue() implementation that strips the prefix off propertyID to determine the property name on its own:

     public string GetPropertyValue(string propertyID)
     {
       string property = PropStripPrefix(propertyID, "");
       if (property == "propertyName")
       {
         // property name verified, so return whatever the property's value is as a string...
       }

       return inherited(propertyID);
     }

Although it is not compulsory to have a prefix in a handler, it is recommended. It is most definitely recommended that you always strip the prefix from a property argument as is done in the above code sample. Even if the prefix is blank, this code will still cope without any trouble.

Parameters:
prefix Prefix string to use with this handler.

Reimplemented from HTMLPropertyHandler.

public void HTMLPropertyGroup.SetPrefix ( string prefix )

Sets the prefix of this handler.

Overridden from HTMLPropertyHandler.SetPrefix() to set the prefix of this handler as well as the sub handlers. The new prefix value will not only be applied to this handler but it will also replace the current on each sub-handler. This works on the basis that all sub handlers have their group handler's prefix before their own prefix.

Parameters:
prefix Prefix to apply this group handler and its sub handlers.

Reimplemented from HTMLPropertyHandler.

public void HTMLPropertyGroup.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConsistListHelper, ConfigAssetGroupHandler, CheckListGroupHandler, RadioButtonGroupHandler, GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public void HTMLPropertyGroup.SetProperties ( Soup soup )

Initializes this handler's properties from the given database.

Overridden from HTMLPropertyHandler.SetProperties() to initialize all of the sub handlers from the given Soup database. The HTMLPropertyGroup implementation of this method assumes the sub handlers have already been added to the group handler - it only initializes existing sub handlers and generally isn't meant to create new sub handlers itself (although you can do that in your own overridden implementation if you really want to).

Parameters:
soup Database of property values to initialize this handler with. Sub-databases in side this soup will be used to initialize each sub-handler.

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConsistListHelper, ConfigAssetGroupHandler, CheckListGroupHandler, RadioButtonGroupHandler, GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public void HTMLPropertyGroup.SetPropertyAttribute | ( | string | propertyID,
 |  | string | attribute,
 |  | PropertyValue | value
 | ) | [inline]

Sets the attribute of the named property.

This method is provided as a mechanism for the properties of a handler to be accessed externally. Implementing it is not required as it isn't called by a host PropertyObject. How it is used is entirely up to the programmer making the handler.

Parameters:
propertyID | Name of the property to set the attribute of.
attribute | Attribute field. How this string value is used is entirely up to the programmer implementing this method.
value | Value to apply the property. Like attribute, how this parameter is dealt with is up to the programmer.

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConfigAssetGroupHandler.

public void HTMLPropertyGroup.SetPropertyAttribute | ( | string | propertyID,
 |  | string | attribute,
 |  | PropertyValue | value
 | ) |

Sets the attributes of the named property.

Overridden from HTMLPropertyHandler.SetPropertyAttribute() to set the attributes of the named property in the appropriate sub handler.

Parameters:
propertyID | Name of the property to set the attribute of.
attribute | Attribute field.
value | Value to apply the property.

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConfigAssetGroupHandler.

public void HTMLPropertyGroup.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConsistListHelper, CheckListGroupHandler, RadioButtonGroupHandler, GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

public void HTMLPropertyGroup.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) |

Sets the value of the named property.

Overridden from HTMLPropertyHandler.SetPropertyValue() to set the value of the named property on the appropriate child handler.

Parameters:
propertyID | Name of the property to set the value of. This should be a full property string with group handler and sub handler prefixes.
value | Value to set the property to.

Reimplemented from HTMLPropertyHandler.

Reimplemented in ConsistListHelper, CheckListGroupHandler, RadioButtonGroupHandler, GenericListHandler, TrainHelperInfo, and VehicleHelperInfo.

The documentation for this class was generated from the following file:
  • HTMLPropertyHandler.gs


HTMLPropertyHandler Class Reference

Inheritance diagram for HTMLPropertyHandler:

GSObject BaseIndustryInfo ConfigAssetHandler ConsistHelperInfo HTMLPropertyGroup LoadHelperInfo PassengerStationInfo SpecificVehiclesInfo VHISpecificVehiclesInfo List of all members.

Public Methods

public void | SetPrefix (string prefix)
public string | GetPrefix (void)
public string | Prop (string propertyName)
public string | Link (string propertyName)
public string | HREF (string propertyName)
bool | PropMatchesPrefix (string propertyName, string prefix)
string | PropStripPrefix (string propertyName, string prefix)
public string | GetDescriptionHTML (void)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public string | GetPropertyValue (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public void | SetPropertyAttribute (string propertyID, string attribute, PropertyValue value)
public PropertyValue | GetPropertyAttribute (string propertyID, string attribute)
public void | RefreshBrowser (Browser browser)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)
public void | SetSavesProperties (bool saveProperties)
public bool | GetSavesProperties (void)

Detailed Description

A HTML property handler.

Takes over the role of handling HTML properties form the PropertyObject class.

To allow property objects to have properties that can be shared and more easily reused with other property objects, Trainz now has property handlers.

Previously properties were handled by overriding the various methods of the PropertyObject class for each individual class that had properties. The main limitation with this approach to property handling was that the properties code is locked down to that class and couldn't be reused very easily.

With property handlers, a property object has a property handler assigned to it to manage its properties. Because the property handler is a separate entity that can be attached to any property object, property-handling code is now much more portable.

The HTMLPropertyHandler class defines the interface for a property handler and you create you own handler by implementing its methods in the same way you would implement the various PropertyObject methods.

The methods you override in HTMLPropertyHandler in most cases have identical PropertyObject equivalents and are to be implemented in the same way.

The methods to implement in your own property handler class are:

  • GetDescriptionHTML()
  • GetPropertyDescription()
  • GetPropertyName()
  • GetPropertyType()
  • GetPropertyValue()
  • GetPropertyElementList()
  • SetPropertyValue()
  • RefreshBrowser()
  • GetProperties()
  • SetProperties()
As with PropertyObject, the implemented methods are not called by the script programmer. In the case of HTMLPropertyHandler, it is PropertyObject's equivalent methods that will call the handler methods automatically.

Sometimes a method doesn't have to be implemented and generally if you don't implement something you should have, the parent HTMLPropertyHandler method will put a message in the log file that is available once you exit Trainz (\Trainz\JetLog.txt).

See also:
PropertyValue, PropertyObject, HTMLPropertyGroup

Member Function Documentation

public string HTMLPropertyHandler.GetDescriptionHTML ( void )

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented in BaseIndustryInfo, LoadHelperInfo, ConsistHelperInfo, ConsistListHelper, HTMLPropertyGroup, HTMLPropertyGroup, ConfigAssetHandler, ConfigAssetGroupHandler, GenericStringHandler, GenericIntNumberHandler, GenericBoolHandler, CheckBoxHandler, CheckListPropertyHandler, AssetCheckListHandler, RadioButtonListHandler, CheckListGroupHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, EnumeratedGameObjectHandler, GenericListHandler, PassengerStationInfo, PassengerStationInfo, SpecificVehiclesInfo, TrainHelperInfo, VHISpecificVehiclesInfo, and VehicleHelperInfo.

public string HTMLPropertyHandler.GetPrefix ( void )

Gets the prefix string of this property handler.

Returns :
Returns the prefix of this property handler. An empty string (the default prefix) will be returned if a prefix hasn't been set for this handler.

public Soup HTMLPropertyHandler.GetProperties ( void )

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented in LoadHelperInfo, ConsistHelperInfo, ConsistListHelper, HTMLPropertyGroup, HTMLPropertyGroup, ConfigAssetHandler, ConfigAssetGroupHandler, GenericStringHandler, GenericIntNumberHandler, GenericBoolHandler, CheckListPropertyHandler, AssetCheckListHandler, RadioButtonListHandler, CheckListGroupHandler, RadioButtonGroupHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, EnumeratedGameObjectHandler, GenericListHandler, PassengerStationInfo, PassengerStationInfo, SpecificVehiclesInfo, TrainHelperInfo, VHISpecificVehiclesInfo, and VehicleHelperInfo.

public PropertyValue HTMLPropertyHandler.GetPropertyAttribute | ( | string | propertyID,
 |  | string | attribute
 | ) |

Gets the attributes of the named property.

This method is provided as a mechanism for the properties of a handler to be accessed externally. Implementing it is not required as it isn't called by a host PropertyObject. How it is used is entirely up to the programmer making the handler.

Parameters:
propertyID | Name of the property to get the attributes of.
attribute | Attribute field. How this string value is interpreted is entirely up to the programmer implementing this method.
Returns :
Should return a PropertyValue object containing the requested attributes of the named property. The default top-level implementation returns a PropertyValue that is of type NULL_TYPE.

Reimplemented in HTMLPropertyGroup, HTMLPropertyGroup, ConfigAssetGroupHandler, and GenericBoolHandler.

public string HTMLPropertyHandler.GetPropertyDescription ( string propertyID )

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented in BaseIndustryInfo, LoadHelperInfo, ConsistHelperInfo, HTMLPropertyGroup, HTMLPropertyGroup, GenericStringHandler, GenericIntNumberHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, EnumeratedGameObjectHandler, GenericListHandler, PassengerStationInfo, PassengerStationInfo, SpecificVehiclesInfo, TrainHelperInfo, VHISpecificVehiclesInfo, and VehicleHelperInfo.

public string [] HTMLPropertyHandler.GetPropertyElementList ( string propertyID )

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented in LoadHelperInfo, ConsistHelperInfo, HTMLPropertyGroup, HTMLPropertyGroup, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, EnumeratedGameObjectHandler, GenericListHandler, GenericListHandler, PassengerStationInfo, PassengerStationInfo, SpecificVehiclesInfo, VehicleTypesInfo, DriversInfo, VHISpecificVehiclesInfo, VHIVehicleTypesInfo, and VHIDriversInfo.

public string HTMLPropertyHandler.GetPropertyName ( string propertyID )

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented in BaseIndustryInfo, LoadHelperInfo, ConsistHelperInfo, HTMLPropertyGroup, HTMLPropertyGroup, GenericStringHandler, GenericIntNumberHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, EnumeratedGameObjectHandler, GenericListHandler, PassengerStationInfo, PassengerStationInfo, SpecificVehiclesInfo, TrainHelperInfo, VHISpecificVehiclesInfo, and VehicleHelperInfo.

public string HTMLPropertyHandler.GetPropertyType ( string propertyID )

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented in BaseIndustryInfo, LoadHelperInfo, ConsistHelperInfo, ConsistListHelper, HTMLPropertyGroup, HTMLPropertyGroup, GenericStringHandler, GenericIntNumberHandler, GenericBoolHandler, CheckListPropertyHandler, AssetCheckListHandler, CheckListGroupHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, EnumeratedGameObjectHandler, GenericListHandler, PassengerStationInfo, PassengerStationInfo, SpecificVehiclesInfo, TrainHelperInfo, VHISpecificVehiclesInfo, and VehicleHelperInfo.

public string HTMLPropertyHandler.GetPropertyValue ( string propertyID )

Gets the value of the named property as a string.

This method is called by PropertyObject.GetPropertyValue() to get the value of the named property.

Parameters:
propertyID Property to get the value of.
Returns :
Returns the value of propertyID as a string (convert if necessary). The HTMLPropertyHandler implementation will always return an empty string.
See also:
PropertyObject.GetPropertyValue()

Reimplemented in ConsistHelperInfo, HTMLPropertyGroup, HTMLPropertyGroup, GenericStringHandler, GenericIntNumberHandler, EnumeratedAssetHandler, PassengerStationInfo, and PassengerStationInfo.

public bool HTMLPropertyHandler.GetSavesProperties ( void )

Determines if this handler will save its properties.

Returns :
Returns true if this handler will save its properties when the host PropertyObject is saving, false otherwise.
See also:
PropertyObject.GetProperties(), PropertyObject.SetProperties()

public string HTMLPropertyHandler.HREF ( string propertyName )

Gets a HTML hyperlink for the named property.

This method is used to generate an appropriate URL for the given property name. The returned HTML code can be used as a property link in the HTML page returned by GetDescriptionHTML(). Note that you will need to close the link with </a> yourself.

Parameters:
propertyName Name of the property to put into a hyperlink without the prefix.
Returns :
Returns the URL for the property specified by propertyName in a <a href=> tag that takes the form of "<a href='live://property/" + GetPrefix() + propertyName + "'>".

public string HTMLPropertyHandler.Link ( string propertyName )

Puts the named property into a URL value with prefix.

This method is used to generate an appropriate URL for the given property name. The returned URL string can be used with the <a href=> tag in the HTML page returned by GetDescriptionHTML().

Parameters:
propertyName Name of the property to generate a URL for.
Returns :
Returns a URL string that takes the form of "live://property/" + GetPrefix() + propertyName.

public string HTMLPropertyHandler.Prop ( string propertyName )

Gets the named property merged with the prefix of this handler.

Parameters:
propertyName Name of the property to get merged with the prefix.
Returns :
Returns a string that is equivalent to GetPrefix() + propertyName.

bool HTMLPropertyHandler.PropMatchesPrefix | ( | string | propertyName,
 |  | string | prefix
 | ) |

Determines if the given property string is already prefixed.

This method determines if a property string is already prefixed. It can also be used to validate a properties name without having to split a string and remove the prefix.

Parameters:
propertyName | Name of the property to check for the existence of a prefix in.
prefix | Additional extra prefix to append to the current prefix for testing purposes. Use a blank string if not needed.
Returns :
Returns true if propertyName is prefixed with the equivalent of this handler's prefix with prefix just after it, false otherwise.

string HTMLPropertyHandler.PropStripPrefix | ( | string | propertyName,
 |  | string | prefix
 | ) |

Strips the given property string of its prefix.

This method allows the a property string to be stripped of its prefix making it easier to verify the contents of a propertyID parameter. For example:

     public string GetPropertyValue(string propertyID)
     {
       string property = PropStripPrefix(propertyID, "");
       if (property == "propertyName")
       {
         // property name verified, so return whatever the property's value is as a string...
       }

       return inherited(propertyID);
     }

The above code sample means the property being queried is easier to check as we don't need to worry about what the prefix might be when trying to determine the property. Remember that prefixes vary, property names don't (well they shouldn't once the handler is fully implemented).

Parameters:
propertyName | Property string to strip the prefix from.
prefix | Additional extra prefix to append to the current prefix that may also need to be stripped. Use a blank string if not needed.
Returns :
Returns a new version of propertyName with the current prefix and prefix removed from the start of it. It is assumed that the caller knows what they are doing and propertyName is big enough to handle the combined prefix being stripped from it.

public void HTMLPropertyHandler.RefreshBrowser ( Browser browser )

Refreshes the given browser with the properties of this handler.

Parameters:
browser Browser to update.
See also:
PropertyObject.PropertyBrowserRefresh()

Reimplemented in ConsistHelperInfo, HTMLPropertyGroup, and HTMLPropertyGroup.

public void HTMLPropertyHandler.SetPrefix ( string prefix )

Sets the prefix of this property handler.

All property handlers have a prefix string. The prefix string is what the handler will prefix all of its property reference names with. If a PropertyObject only contain a basic handler that isn't a group handler then you can get away without setting the prefix string.

For the sake of making your handler more versatile and easier to use, you should always strip the prefix of a property string in your implementations of the various methods in this handler. HTMLPropertyHandler includes internal prefix utility methods to do this for you.

For example, here is a simple GetPropertyValue() implementation that strips the prefix off propertyID to determine the property name on its own:

     public string GetPropertyValue(string propertyID)
     {
       string property = PropStripPrefix(propertyID, "");
       if (property == "propertyName")
       {
         // property name verified, so return whatever the property's value is as a string...
       }

       return inherited(propertyID);
     }

Although it is not compulsory to have a prefix in a handler, it is recommended. It is most definitely recommended that you always strip the prefix from a property argument as is done in the above code sample. Even if the prefix is blank, this code will still cope without any trouble.

Parameters:
prefix Prefix string to use with this handler.

Reimplemented in HTMLPropertyGroup, and HTMLPropertyGroup.

public void HTMLPropertyHandler.SetProperties ( Soup soup )

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented in LoadHelperInfo, ConsistHelperInfo, ConsistListHelper, HTMLPropertyGroup, HTMLPropertyGroup, ConfigAssetHandler, ConfigAssetGroupHandler, GenericStringHandler, GenericIntNumberHandler, GenericBoolHandler, CheckListPropertyHandler, AssetCheckListHandler, RadioButtonListHandler, CheckListGroupHandler, RadioButtonGroupHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, EnumeratedGameObjectHandler, GenericListHandler, PassengerStationInfo, PassengerStationInfo, SpecificVehiclesInfo, TrainHelperInfo, VHISpecificVehiclesInfo, and VehicleHelperInfo.

public void HTMLPropertyHandler.SetPropertyAttribute | ( | string | propertyID,
 |  | string | attribute,
 |  | PropertyValue | value
 | ) |

Sets the attribute of the named property.

This method is provided as a mechanism for the properties of a handler to be accessed externally. Implementing it is not required as it isn't called by a host PropertyObject. How it is used is entirely up to the programmer making the handler.

Parameters:
propertyID | Name of the property to set the attribute of.
attribute | Attribute field. How this string value is used is entirely up to the programmer implementing this method.
value | Value to apply the property. Like attribute, how this parameter is dealt with is up to the programmer.

Reimplemented in HTMLPropertyGroup, HTMLPropertyGroup, ConfigAssetGroupHandler, and GenericBoolHandler.

public void HTMLPropertyHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) |

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented in BaseIndustryInfo, LoadHelperInfo, ConsistHelperInfo, ConsistListHelper, HTMLPropertyGroup, HTMLPropertyGroup, GenericStringHandler, GenericIntNumberHandler, GenericBoolHandler, CheckListPropertyHandler, AssetCheckListHandler, RadioButtonListHandler, CheckListGroupHandler, RadioButtonGroupHandler, EnumeratedPropertyHandler, EnumeratedMultiPropertyHandler, EnumeratedAssetHandler, EnumeratedGameObjectHandler, GenericListHandler, PassengerStationInfo, PassengerStationInfo, SpecificVehiclesInfo, TrainHelperInfo, VHISpecificVehiclesInfo, and VehicleHelperInfo.

public void HTMLPropertyHandler.SetSavesProperties ( bool saveProperties )

Instructs this handler whether to save its properties.

If the handler is set to save properties, then the host PropertyObject will use the handler's GetProperties() and SetProperties() methods when saving and loading.

Parameters:
saveProperties If true, handler properties are saved. Use false to get the host PropertyObject to not save the properties of this handler.
See also:
PropertyObject.GetProperties(), PropertyObject.SetProperties()

The documentation for this class was generated from the following file:
  • HTMLPropertyHandler.gs


HTMLWindow Class Reference

List of all members.

Detailed Description

Utility class with methods to generate HTML code suitable for use in the Trainz.

This static class provides many methods to generate HTML code that can be used in the Browser and property window. In most case, these methods return a string with HTML code in it. All methods are implemented in the \Trainz\scripts\common.gs script file and can be viewed for those who are curious to what the methods actually do.

As well as generic HTML methods, several methods are defined that are specifically used by the BaseIndustry class to generate HTML for an industry's properties window.

Link methods:

  • public string StartLink (string link, string tooltip, string extraParams)
  • public string StartLink (string link, string tooltip)
  • public string StartLink (string link)
  • public string EndLink ()
  • public string MakeLink (string link, string text, string tooltip, string extraParams)
  • public string MakeLink (string link, string text, string tooltip)
  • public string MakeLink (string link, string text)
Image methods:
  • public string MakeImage (string image, bool isKuid, int width, int height, string image_over, string extraParams)
  • public string MakeImage (string image, bool isKuid, int width, int height, string image_over)
  • public string MakeImage (string image, bool isKuid, int width, int height)
  • public string MakeImage (string image)
  • public string MakeImage (string image, bool isKuid)
  • public string MakeImage (string image, bool isKuid, int width)
Font formatting methods:
  • public string MakeBold (string text)
  • public string MakeItalic (string text)
  • public string MakeFontSizeTiny (string text)
  • public string MakeFontSizeSmall (string text)
  • public string MakeFontSizeMedium (string text)
  • public string MakeFontSizeLarge (string text)
  • public string StartFontColor (string fontColor)
  • public string StartFontColorBlack ()
  • public string StartFontColorWhite ()
  • public string EndFontColor ()
  • public string MakeFontColor (string text, string fontColor)
  • public string MakeFontColorBlack (string text)
  • public string MakeFontColorWhite (string text)
Table methods:
  • public string StartTable (string extraParams)
  • public string StartTable ()
  • public string EndTable ()
Table cell and row methods:
  • public string StartRow (string extraParams)
  • public string StartRow ()
  • public string EndRow ()
  • public string StartCell (string extraParams)
  • public string StartCell ()
  • public string EndCell ()
  • public string MakeCell (string text, string extraParams)
  • public string MakeCell (string text)
  • public string MakeSpacerCell (int width)
  • public string MakeRow (string text, string extraParams)
  • public string MakeRow (string text)
  • public string MakeTable (string text, string extraParams)
  • public string MakeTable (string text)
Time conversion methods:
  • public string GetFloatAsTimeString (float time)
  • public float GetTimeStringAsFloat (string time)
  • public string PadZerosOnFront (string value, int maxSize)
  • public string GetCleanTimeString (string time)
  • public string GetCleanFloatString (float val)
  • public int GetSecondsFromFloat (float time)
  • public int GetMinutesFromFloat (float time)
  • public int GetHoursFromFloat (float time)
String and number conversion methods:
  • public float ConvertUnitsToValue (float units, float mass, string format)
  • public float ConvertValueToUnits (float other, float mass, string format)
  • public string UnitsToString (float units, float mass, string format)
  • public float StringToUnits (string str, string format)
Button and page formatting methods:
  • public string RadioButton (string urlString, bool active)
  • public string CheckBox (string urlString, bool active)
  • public string HelpButton (string urlString)
  • public string StartIndent (int width)
  • public string EndIndent ()
  • public string StartBorder (string extraParams)
  • public string EndBorder ()
See also:
Browser, BaseIndustry, PropertyObject, TrainUtil

The documentation for this class was generated from the following file:
  • common.gs


Industry Class Reference

Inheritance diagram for Industry:

Buildable BaseIndustry BasePortal GenericIndustry GenericPassengerStation List of all members.

Public Methods

public native string[] | GetProcessNameList (void)
public native bool | GetProcessStarted (string processName)
public native bool | GetProcessEnabled (string processName)
public native void | SetProcessEnabled (string processName, bool enabled)
public native float | GetProcessDuration (string processName)
public native void | SetProcessDuration (string processName, float processDuration)
public native void | ClearProcess (string processName)
public native void | SetProcessInput (string processName, ProductQueue queue, Asset product, int amount)
public native int | GetProcessInput (string processName, ProductQueue queue, Asset product)
public native void | SetProcessOutput (string processName, ProductQueue queue, Asset product, int amount)
public native int | GetProcessOutput (string processName, ProductQueue queue, Asset product)
public native ProductQueue | GetProcessIOQueue (string processName, bool wantInput, int ioIndex)
public native Asset | GetProcessIOProduct (string processName, bool wantInput, int ioIndex)
public native int | GetProcessIOAmount (string processName, bool wantInput, int ioIndex)
public void | AppendProductList (Asset[] productList)
public void | AppendDriverDestinations (string[] destNames, string[] destTracks)
public bool | HasTrack (string track)
public native void | PerformProcessStarted (string processName)
public native void | PerformProcessCancelled (string processName)
public native void | PerformProcessFinished (string processName)
public native bool | PerformProcessInput (string processName)
public native void | PerformProcessOutput (string processName)
public void | NotifyProcessStarted (string processName)
public void | NotifyProcessFinished (string processName)
public Requirement[] | GetRequirements (void)
public float | BeginUnload (LoadingReport report)
public float | GetUnloadTime (LoadingReport report)
public float | EndUnload (LoadingReport report)
public float | BeginLoad (LoadingReport report)
public float | GetLoadTime (LoadingReport report)
public float | EndLoad (LoadingReport report)
public bool | HandleTrain (Train train, string loadCommand)
public LoadingReport | CreateLoadingReport (ProductQueue srcIndustryQueue, int amountLoad)
public LoadingReport | CreateUnloadingReport (ProductQueue dstIndustryQueue, int amountToUnload)

Public Attributes

Load and Unload Driver Command Strings

String constants indicating the type of driver command that is calling HandleTrain().

See also:
Industry.HandleTrain()

public define string | LOAD_COMMAND = "load"
Load driver command.

public define string | UNLOAD_COMMAND = "unload"
Unload driver command.

Detailed Description

An industry map object.

Industries are a special type of map object that can have track, triggers, processes and be used to transfer products to and from vehicles.

Messages delivered to an Industry game object are:
Major | Minor | Source | Destination
"Process-Start" | process name | industry | industry
"Process-Stop" | process name | industry | industry

See also:
Buildable, GenericIndustry, BaseIndustry, SceneryWithTrack, IndustryTrainController, ProductQueue, Vehicle, World.GetIndustryList(), Train.GetLastVisitedIndustry()

Member Function Documentation

public void Industry.AppendDriverDestinations | ( | string | destNames[],
 |  | string | destTracks[]
 | ) | [inline]

Provides destinations for use of this industry's entry on the Drive To sub-menu.

If the scriptlet programmer wants their industry to appear in the Drive To command with destinations to send drivers to listed on a sub-menu, this method must be implemented. Both a human-readable name for the sub-menu and the name of the actual destination track must be provided.

Two arrays are passed in as return arguments, one for the readable names and the other for the track names. The indexes of each these arrays must correspond directly to each other. For example, if destNames[2] is "Log Pickup", than destTracks[2] must be the name of the track where the log pickup is.

Note:
You don't have to worry about allocating memory for the arrays as GS allows you to simply go ahead and place data in an array, even for positions that aren't explicitly allocated for.
Parameters:
destNames | Array of human-readable, localized names of destinations. These will be displayed on a sub-menu, so be mindful of how long the names are.
destTracks | Array of attached-track names as per the industry's config.txt file. Must contain the same number of entries as the destNames array.

public void Industry.AppendProductList ( Asset productList[] ) [inline]

Adds any products that this industry is currently capable of producing to the end of the given list.

Note:
To append something to the end of an array, use size() as the index value (i.e. productList[productList.size()]).
Parameters:
productList List of products to add to. Check first to make sure you're not adding a product that already exists in this list.

Reimplemented in BaseIndustry, and GenericIndustry.

public float Industry.BeginLoad ( LoadingReport report )

Called by Vehicle.LoadProduct() before the loading has taken place.

Parameters:
report Progress report of loading operation.
Returns :
Returns the minimum time in seconds this stage should run for.

Reimplemented in BaseIndustry, and GenericIndustry.

public float Industry.BeginUnload ( LoadingReport report )

Called by Vehicle.UnloadProduct() before the unloading takes place.

Parameters:
report Progress report of unloading operation.
Returns :
Returns the minimum time in seconds this stage should run for.

Reimplemented in BaseIndustry, and GenericIndustry.

public native void Industry.ClearProcess ( string processName )

Clears ALL process inputs and outputs for the named process.

Parameters:
processName Name of the process to totally clear the input and output of.

public LoadingReport Industry.CreateLoadingReport | ( | ProductQueue | srcIndustryQueue,
 |  | int | amountLoad
 | ) | [inline]

Creates a report describing a loading operation from a queue in this industry.

Parameters:
srcIndustryQueue | Industry source queue to load from.
amountLoad | Desired amount to load from the source queue.
Note:
This method generates a report but doesn't perform any actual loading.
Returns :
Returns a newly created LoadingReport object describing a loading operation with this industry.

public LoadingReport Industry.CreateUnloadingReport | ( | ProductQueue | dstIndustryQueue,
 |  | int | amountToUnload
 | ) | [inline]

Creates a report describing an unloading operation for a queue in this industry.

Parameters:
dstIndustryQueue | Industry destination queue to unload to.
amountToUnload | Desired amount to unload to the destination queue.
Note:
This method generates a report but doesn't perform any actual unloading.
Returns :
Returns a newly created LoadingReport object describing an unloading operation with this industry.

public float Industry.EndLoad ( LoadingReport report )

Called by Vehicle.LoadProduct() after the loading has taken place.

Parameters:
report Progress report of loading operation.
Returns :
Returns the minimum time in seconds this stage should run for.

Reimplemented in BaseIndustry, and GenericIndustry.

public float Industry.EndUnload ( LoadingReport report )

Called by Vehicle.UnloadProduct() after the unloading has taken place.

Parameters:
report Progress report of unloading operation.
Returns :
Returns the minimum time in seconds this stage should run for.

Reimplemented in BaseIndustry, and GenericIndustry.

public float Industry.GetLoadTime ( LoadingReport report )

Called by Vehicle.LoadProduct() to determine how long the load operation should take.

Parameters:
report Progress report of loading operation.
Returns :
Returns the minimum time in seconds this stage should run for.

Reimplemented in BaseIndustry, and GenericIndustry.

public native float Industry.GetProcessDuration ( string processName )

Gets the duration of the named process in seconds.

Parameters:
processName Name of process to get.
Returns :
Returns the duration of processName in seconds if successful.

public native bool Industry.GetProcessEnabled ( string processName )

Determines if the named process is enabled.

Parameters:
processName Name of the process to check
Returns :
Returns true if the process specified by processName is enabled, false otherwise.

public native int Industry.GetProcessInput | ( | string | processName,
 |  | ProductQueue | queue,
 |  | Asset | product
 | ) |

Gets the input rate of a process per cycle for the given queue and product.

Parameters:
processName | Name of the process to get the input rate for.
queue | Name of the input queue.
product | Product type to get input rate of in queue from processName.
Returns :
Returns the amount of product instances consumed by processName from queue per process cycle.

public native int Industry.GetProcessIOAmount | ( | string | processName,
 |  | bool | wantInput,
 |  | int | ioIndex
 | ) |

Gets the amount of products a process consumes/produces per cycle for a specific queue.

Parameters:
processName | Name of the process.
wantInput | Use true to specify an input queue, false for an output queue.
ioIndex | Index of the input or output queue to examine. Use 0 for the 1st queue and so on.
Returns :
Returns the amount of products consumed/produced per cycle by the process for the specified queue if possible, 0 otherwise.

public native Asset Industry.GetProcessIOProduct | ( | string | processName,
 |  | bool | wantInput,
 |  | int | ioIndex
 | ) |

Gets the product in the specified queue from the named process.

Parameters:
processName | Name of the process.
wantInput | Use true to specify an input queue, false for an output queue.
ioIndex | Index of the input or output queue to get the product of. Use 0 for the 1st queue and so on.
Returns :
Returns the product in the specified queue if possible, null otherwise.

public native ProductQueue Industry.GetProcessIOQueue | ( | string | processName,
 |  | bool | wantInput,
 |  | int | ioIndex
 | ) |

Gets the specified input/output queue from the named process.

Parameters:
processName | Name of the process to get the queue from.
wantInput | Use true to specify an input queue, false for an output queue.
ioIndex | Index of the input or output queue to get. Use 0 for the 1st queue and so on.
Returns :
Returns the requested queue if possible, null otherwise.

public native string [] Industry.GetProcessNameList ( void )

Gets the names of all of the processes this industry has.

Returns :
Returns an array of strings containing the names of all processes in this industry.

public native int Industry.GetProcessOutput | ( | string | processName,
 |  | ProductQueue | queue,
 |  | Asset | product
 | ) |

Gets the output rate of a process per cycle for the given queue and product.

Parameters:
processName | Name of the process to get the output rate for.
queue | Name of the output queue.
product | Product type to get output rate of in queue from processName.
Returns :
Returns the amount of product instances produced by processName into queue per process cycle.

public native bool Industry.GetProcessStarted ( string processName )

Determines if the named process has started.

Parameters:
processName Name of the process to check.
Returns :
Returns true if the process specified by processName has started, false otherwise.

public Requirement [] Industry.GetRequirements ( void ) [inline]

Gets the requirements of this industry.

This method is called by Trainz to determine the product requirements of an industry so a waybill listing can be generated for display to the user. As this default implementation in Industry only returns an empty array, the scriptlet programmer must implement their own overridden version if they want their industry to provide requirements data for waybills.

Returns :
Returns an array of requirements this industry has. The default Industry class implementation returns an empty array.
See also:
ResourceRequirement

public float Industry.GetUnloadTime ( LoadingReport report )

Called by Vehicle.UnloadProduct() to determine how long the unload operation should take.

Parameters:
report Progress report of unloading operation.
Returns :
Returns the minimum time in seconds this stage should run for.

Reimplemented in BaseIndustry, and GenericIndustry.

public bool Industry.HandleTrain | ( | Train | train,
 |  | string | loadCommand
 | ) |

Called by the Load and Unload driver commands to initiate loading/unloading of a train.

This method is called from within a DriverCharacter schedule and is permitted to control the train (i.e. stop it. move it etc.). It only drives the train and does not do any actual loading/unloading.

Parameters:
train | Train to control and guide through this industry.
loadCommand | String indicating what type of driver command that is calling this method. See Load and Unload Driver Command Strings for details.
Returns :
Returns true if successful or if the loading/unloading is handled in another ongoing thread, false otherwise on failure. The default Industry implementation always returns false.

Reimplemented in BaseIndustry, and GenericIndustry.

public bool Industry.HasTrack ( string track )

Determines if the named track exists in this industry.

Parameters:
track Name of track to verify existence of.
Returns :
Returns true if track exists in this industry, false otherwise.
See also:
Buildable.GetAttachedTrack()

public void Industry.NotifyProcessFinished ( string processName ) [inline]

Called by Trainz once when a process is ready to stop running.

You may override this function to provide custom behavior, however, you MUST call the PerformProcessOutput() and PerformProcessFinished() methods as demonstrated here. The call to these methods may be delayed for animation purposes, but it must happen.

Note:
As this is not a threaded function, you must not use sleep() or wait().
Parameters:
processName Name of process that has stopped.

Reimplemented in BaseIndustry.

public void Industry.NotifyProcessStarted ( string processName ) [inline]

Called by Trainz when a process is ready to start.

You may override this function to provide custom behavior, however, you MUST call the PerformProcessInput(), PerformProcessStarted() and PerformProcessCancelled() functions as demonstrated here. The call to these functions may be delayed for animation purposes, but it must happen.

You are guaranteed that PerformProcessInput() will succeed if you call it immediately in this function, however we do not currently guarantee that it will succeed if you delay before calling it. For this reason, you should handle failure as demonstrated here (and animate accordingly if necessary).

You should not use PerformProcessCancelled() for other reasons.

Note:
As this is not a threaded function, you must not use sleep() or wait().
Parameters:
processName Name of the process that is ready to start.

public native void Industry.PerformProcessCancelled ( string processName )

Lets Trainz know that it should abort the named process.

Parameters:
processName Name of process to abort running.

public native void Industry.PerformProcessFinished ( string processName )

Lets Trainz know that it may complete the named process.

Parameters:
processName Name of process to complete.

public native bool Industry.PerformProcessInput ( string processName )

Lets Trainz know that it should perform inputs of for the named process now.

Note:
This method MUST be called exactly ONCE after each call to NotifyProcessStarted(). Don't call it if PerformProcessCancelled() is called first.
Parameters:
processName Name of process to perform inputs on.
Returns :
Returns true if process inputs were performed successfully, false otherwise.

public native void Industry.PerformProcessOutput ( string processName )

Lets Trainz know that it should perform outputs for the named process now.

Note:
This method MUST be called exactly ONCE after each call to NotifyProcessStarted(). Don't call it if PerformProcessCancelled() is called first.
Parameters:
processName Name of process to perform outputs on.
Returns :
Returns true if process outputs were performed successfully, false otherwise.

public native void Industry.PerformProcessStarted ( string processName )

Lets Trainz know that it may start running the named process.

Parameters:
processName Name of process to start running.

public native void Industry.SetProcessDuration | ( | string | processName,
 |  | float | processDuration
 | ) |

Sets the duration of the named process in seconds.

Parameters:
processName | Name of process to set duration of.
processDuration | New duration for process in seconds.

public native void Industry.SetProcessEnabled | ( | string | processName,
 |  | bool | enabled
 | ) |

Enables/disables the named process.

Parameters:
processName | Name of the process to enable/disable.
enabled | If true, the process will be enabled, false to disable.

public native void Industry.SetProcessInput | ( | string | processName,
 |  | ProductQueue | queue,
 |  | Asset | product,
 |  | int | amount
 | ) |

Modify the input requirements for the specified process.

Using this method will override any existing requirements that match the arguments that the process already has (i.e. set previously through this method or in the industry's configurartion).

Parameters:
processName | Name of the process to modify input requirements for.
queue | Name of the input queue to adjust.
product | Product type to accept as input into queue.
amount | Amount of products output to queue in a process cycle. If 0, input requirements specified for processName will be removed.

public native void Industry.SetProcessOutput | ( | string | processName,
 |  | ProductQueue | queue,
 |  | Asset | product,
 |  | int | amount
 | ) |

Modify the output requirements for the specified process.

Using this method will override any existing requirements that match the arguments that the process already has (i.e. set previously through this method or in the industry's configurartion).

Parameters:
processName | Name of the process to modify output requirements for.
queue | Name of the output queue to adjust.
product | Product type to produce as output into queue.
amount | Amount of products output to queue in a process cycle. If 0, output requirements specified for processName will be removed.

The documentation for this class was generated from the following file:
  • industry.gs


IndustryProcessInfo Class Reference

List of all members.

Public Methods

public void | Init (void)

Public Attributes

public string | processName
Name of the industry process this object is counting the input and output of.

public int | assets_produce
Amount of different types of products the process produces.

public int | assets_consume
Amount of different types of products the process consumes.

Detailed Description

Describes the amount of different products and industry process consumes and produces.

This class allows the amount of different product types an industry can both consume and produce. Mainly used by GenericIndustry.GetDescriptionHTML().

See also:
IndustryProductInfo, GenericIndustry.GetDescriptionHTML(), Industry.GetProcessInput(), Industry.GetProcessOutput(), Industry.GetProcessNameList()

Member Function Documentation

public void IndustryProcessInfo.Init ( void ) [inline]

Initialization method.

Note:
This method is called to initialize this object with default values. Currently this implementation is empty, but this may change in the future, so always explicitly call this Init() method if overridden in a child class.

The documentation for this class was generated from the following file:
  • GenericIndustry.gs


IndustryProductInfo Class Reference

List of all members.

Public Methods

public void | Init (void)

Public Attributes

public Asset | asset
Type of product this object is describing the input/output of.

public ProductQueue | queue
Queue that the process uses for input/output of the product.

public bool | isInput
Specifies if queue is an input queue (true) or output queue (false) for the process.

public string | processName
Name of the industry process.

public bool | showInViewDetails
Specifies if this input/output info is to be displayed in a browser window.

Detailed Description

Describes the input/output of an industry process on a queue for a certain product type.

This class allows the input/output of an industry process to be specified. It only covers the input/output of a certain product type on a single product queue for that particular process. As an industry process is able to handle multiple input and output queues as well as different product types on a single queue, it could take quite a few IndustryProductInfo instances to fully describe the input/output capabilities of a process.

See also:
IndustryProcessInfo, GenericIndustry.AddAssetToIndustryProductInfo(), GenericIndustry.industryProductList, Industry.GetProcessNameList(), Industry.GetProcessInput(), Industry.GetProcessOutput(), MapObject.GetQueue()

Member Function Documentation

public void IndustryProductInfo.Init ( void ) [inline]

Initialization method.

Note:
This method is called to initialize this object with default values. Currently this implementation is empty, but this may change in the future, so always explicitly call this Init() method if overridden in a child class.

The documentation for this class was generated from the following file:
  • GenericIndustry.gs


IndustryProductInfoCollection Class Reference

List of all members.

Public Attributes

IPICTrack[] m_tracks
Tracks that the host industry has.

IPICQueue[] m_queues
Tracks that the host industry has.

IPICProcess[] m_processes
Processes that the host industry has.

BaseIndustry m_industry
Host industry of this product collection object.

Detailed Description

Defines a collection of industry product transfers and their associated assets, queues and tracks.

This class is used by BaseIndustry and Vehicle to define a collection of product transfers in terms of the type of products being used and the associated processes, queues and tracks involved. It can be initialized from a given BaseIndustry or Vehicle object and also allows the product transfers of the collection to be added and tweaked through the properties interface of the host object.

Useful interface methods of this class are:

  • public void Init (BaseIndustry industry)
  • public void Init (Vehicle vehicle)
  • public void InitFromAsset ()
  • public BaseIndustry GetIndustry ()
  • public Vehicle GetVehicle ()
  • public IndustryProductInfoComplete AddProduct (string product, string vehicle)
  • public IndustryProductInfoComplete AddProduct (Asset product, Vehicle vehicle)
  • public void AddQueueToProduct (Asset product, ProductQueue queue)
  • public IndustryProductInfoComplete AccessProductInfo (int index)
  • public bool DoesProductHaveTrack (Asset asset, string trackName)
  • public int GetProductIndexFromAsset (Asset asset)
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\IndustryProductInfoCollection.gs script file.
See also:
IPICTrack, IPICProcess, IPICQueue, IndustryProductInfoComplete, BaseIndustry.industryProductInfoCollection, BaseIndustryInfo, ProductQueue

The documentation for this class was generated from the following file:
  • IndustryProductInfoCollection.gs


IndustryProductInfoComplete Class Reference

List of all members.

Public Attributes

public IndustryProductInfoProcess[] | processes
Industry processes.

public IndustryProductInfoTracks[] | tracks
Industry tracks.

public IndustryProductInfoQueues[] | queues
Industry queues involved in this transfer.

Detailed Description

Information class that defines a product transfer in a BaseIndustry or Vehicle.

This class is used by IndustryProductInfoCollection to define a single product transfer. This transfer is defined using the following bits of information:

  • Product being transferred
  • Type of vehicle the transfer happens with
  • Quantity of products per vehicle
  • Industry queues involved with the transfer
  • Industry tracks where it happens
  • Industry processes affected by the transfer
Useful interface methods of this class are:
  • public void Init (IndustryProductInfoCollection ipic)
  • public Asset GetProduct ()
  • public void SetProduct (Asset product)
  • public KUID GetVehicleKUID ()
  • public void SetVehicleKUID (KUID kuid)
  • public int GetDisplayType ()
  • public void SetDisplayType (int type)
  • public int GetPerVehicleAmount ()
  • public void SetPerVehicleAmount (int amount)
  • public void AddProductTrack (string trackName, string mode, ProductQueue queue)
  • public IPICQueue GetIPICQueueByIndex (int index)
  • public IndustryProductInfoQueues GetRelationshipToQueue (IPICQueue queue);
  • public void RemoveQueue (IPICQueue queue)
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\IndustryProductInfoComplete.gs script file.
See also:
IndustryProductInfoCollection, IndustryProductInfoProcess, IndustryProductInfoTracks, IndustryProductInfoQueues, IPICTrack, IPICProcess, IPICQueue, BaseIndustryInfo, ProductQueue

The documentation for this class was generated from the following file:
  • IndustryProductInfoComplete.gs


IndustryProductInfoProcess Class Reference

List of all members.

Detailed Description

Information class that describes an industry process and its various attributes.

This class defines a process in an industry. It is mainly used by the IndustryProductInfoComplete class and provides a more comprehensive interface than its IPICProcess cousin.

Useful interface methods of this class are:

  • public void Init (IndustryProductInfoComplete product, IPICProcess process)
  • public IndustryProductInfoComplete GetIPICProduct ()
  • public IPICProcess GetIPICProcess ()
  • public string GetProcessName ()
  • public IndustryProductInfoQueues GetInputIPIQ ()
  • public void SetInputIPIQ (IndustryProductInfoQueues ipiq)
  • public IPICQueue GetInputQueue ()
  • public void SetInputQueue (IPICQueue queue)
  • public IndustryProductInfoQueues GetOutputIPIQ ()
  • public void SetOutputIPIQ (IndustryProductInfoQueues ipiq)
  • public IPICQueue GetOutputQueue ()
  • public void SetOutputQueue (IPICQueue queue)
  • public bool GetProcessEnabled ()
  • public void SetProcessEnabled (bool enabled)
  • public float GetProcessDuration ()
  • public void SetProcessDuration (float duration)
  • public int GetInputAmount ()
  • public void SetInputAmount (int amount)
  • public int GetOutputAmount ()
  • public void SetOutputAmount (int amount)
  • public bool DoesUseInput ()
  • public bool DoesUseOutput ()
  • public bool DoesAnything ()
  • public bool DoesUseInputForSurveyor ()
  • public bool DoesUseOutputForSurveyor ()
  • public bool DoesAnythingForSurveyor ()
  • public Asset GetProduct ()
  • public bool GetUiIsExpanded (bool isInput)
  • public void SetUiIsExpanded (bool isInput, bool expanded)
  • public bool GetVisibleInSurveyor (bool isInput)
  • public void SetVisibleInSurveyor (bool isInput, bool visible)
  • public bool GetVisibleInViewDetails (bool isInput)
  • public void SetVisibleInViewDetails (bool isInput, bool visible)
  • public bool GetVisibleInViewDetailsProcessList (bool isInput)
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\IndustryProductInfoProcess.gs script file.
See also:
IndustryProductInfoComplete, IndustryProductInfoQueues, IndustryProductInfoTracks, IPICProcess, IndustryProductInfoCollection, Industry.GetProcessNameList()

The documentation for this class was generated from the following file:
  • IndustryProductInfoProcess.gs


IndustryProductInfoQueues Class Reference

List of all members.

Detailed Description

Information class that describes a product queue and its waybill requirements.

This class defines a queue in an industry where a product transfer can take place. It is mainly used by the IndustryProductInfoComplete class.

Useful interface methods of this class are:

  • public void Init (IndustryProductInfoComplete product, IPICQueue queue)
  • public IPICQueue GetIPICQueue ()
  • public ProductQueue GetProductQueue ()
  • public IndustryProductInfoComplete GetIPICProduct ()
  • public int GetInitialAmount ()
  • public void SetInitialAmount (int amount)
  • public int GetQueueSize ()
  • public void SetQueueSize (int amount)
  • public int GetQueueWaybillRemain ()
  • public void SetQueueWaybillRemain (int waybillRemain)
  • public int GetQueueWaybillIssuePercent ()
  • public void SetQueueWaybillIssuePercent (int issuePercent)
  • public void ResetAssetToInitialAmount ()
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\IndustryProductInfoQueues.gs script file.
See also:
IndustryProductInfoComplete, IndustryProductInfoProcess, IndustryProductInfoTracks, IPICQueue, IndustryProductInfoCollection, MapObject.GetQueues()

The documentation for this class was generated from the following file:
  • IndustryProductInfoQueues.gs


IndustryProductInfoTracks Class Reference

List of all members.

Detailed Description

Information class that describes a piece of track an in industry.

This class defines a piece of track in an industry where a product transfer can take place. It is mainly used by the IndustryProductInfoComplete class.

Useful interface methods of this class are:

  • public void Init (IndustryProductInfoComplete product, IPICTrack track)
  • public IPICTrack GetIPICTrack ()
  • public string GetTrackName ()
  • public IndustryProductInfoComplete GetIPICProduct ()
  • public IndustryProductInfoQueues GetIPIQ ()
  • public void SetIPIQ (IndustryProductInfoQueues ipiq)
  • public IPICQueue GetIPICQueue ()
  • public void SetIPICQueue (IPICQueue queue)
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\IndustryProductInfoTracks.gs script file.
See also:
IndustryProductInfoComplete, IndustryProductInfoProcess, IndustryProductInfoQueues, IPICTrack, IndustryProductInfoCollection, SceneryWithTrack.GetAttachedTrack()

The documentation for this class was generated from the following file:
  • IndustryProductInfoTracks.gs


IndustryTrainController Class Reference

Inheritance diagram for IndustryTrainController:

GSObject List of all members.

Public Methods

public void | SetTrainCommand (Train train, string command)
public void | ClearTrainCommand (Train train)
public string | GetTrainCommand (Train train)
public bool | IsTrainCommand (Train train, string command)
public bool | AddVehicle (Vehicle v, bool allowDuplication)
public bool | RemoveVehicle (Vehicle v)
public bool | IsControllingTrain (Train train)
public void | ReSendStoppedMessages (Industry industry)
public int | CountVehicles ()
public bool | IsControllingVehicle (Vehicle vehicle)
public bool | IsAlreadyAdded (Vehicle vehicle)
public int | CountVehiclesNotAdded (Train train)
public bool | ShouldIgnoreVehicle (Vehicle vehicle)
public bool | AddTrain (Train train)
public void | SetTrainSpeed (Train train, float speed)
public void | SetVehicleSpeed (Vehicle v, float speed)
public void | AddVehicleLock (Vehicle v)
public void | RemoveVehicleLock (Vehicle v)
public bool | IsTrainLocked (Train train)
public bool | IsLockedVehicle (Vehicle vehicle)
public bool | RemoveAllUnlockedVehicles (Train train)

Public Attributes

ITCTrainCommand[] m_trainCommands
List of trains and the commands they will execute in this industry controller.

Detailed Description

Class that provides tracking capabilities for an Industry to manage and keep track of vehicles.

An instance of this class is usually declared in a host industry and the Industry object uses it to track vehicles as they enter and leave the industry. It has an internal array that lists vehicles currently under its control. This list can be modified and queried through the various methods of this class.

Vehicles under control of a controller can also be locked which means that they are busy and shouldn't be moved. They can be locked more than once as well.

A Train is considered to be under the control of an industry if any one of its vehicles is currently being managed by this controller. Both the BaseIndustry and GenericIndustry classes make use of this class.

See also:
BaseIndustry, GenericIndustry, Industry, Train, Vehicle

Member Function Documentation

public bool IndustryTrainController.AddTrain ( Train train ) [inline]

Adds all vehicles in the given train to this controller.

This method calls AddVehicle() for every vehicle in the train.

Parameters:
train Train to add all of the vehicles from to this controller.
Returns :
Returns true if this controller wasn't already controlling train, false otherwise.

public bool IndustryTrainController.AddVehicle | ( | Vehicle | v,
 |  | bool | allowDuplication
 | ) |

Called when the given vehicle has entered an industry trigger.

Parameters:
v | Vehicle to add to this industry controller as it has entered an industry trigger.
allowDuplication | If true, v will be added to this controller once for each call to this method and removed once for each call to RemoveVehicle(). This would probably be suitable for normal usage in most cases. If false, v will be added only once to this controller, regardless of how many times the function is called with that vehicle. This means it will only be removed once on the first call to RemoveVehicle().
Returns :
Returns true if v is the first vehicle of in its train to enter the industry, false otherwise.

public void IndustryTrainController.AddVehicleLock ( Vehicle v ) [inline]

Increment the lock count of the given vehicle.

Note:
RemoveVehicleLock() must be called EXACTLY once per every AddVehicleLock() call for a given vehicle.
Parameters:
v Vehicle to decrement the lock count of.

public void IndustryTrainController.ClearTrainCommand ( Train train ) [inline]

Removes the command that the given train was to execute from this controller.

Parameters:
train Train that this controller is to remove the command from if possible.

public int IndustryTrainController.CountVehicles ( )

Gets the amount of vehicles in this controller (including duplicates).

Returns :
Returns the amount of vehicles in this controller (including duplicates).

public int IndustryTrainController.CountVehiclesNotAdded ( Train train ) [inline]

Finds out how many vehicles from the given Train are not in this controller.

Note:
If the vehicle has been added to this controller more than once, the duplicate times it has been found won't be considered. This is a utility method needed for a scenry script and not really something that is as general purpose as other methods in this class.
Returns :
Returns the number of vehicles in train that are not in this controller's list of tracked vehicles.

public string IndustryTrainController.GetTrainCommand ( Train train ) [inline]

Gets name of the command the given train is to execute in this industry controller.

Parameters:
train Train to get the command name of.
Returns :
Returns the name of the command which the train is to execute, which will usually be one of the industry load/unload strings. Otherwise an empty string ("") will be returned if no command has been locked in for train (i.e. it may not even be under this controller's watch).

public bool IndustryTrainController.IsAlreadyAdded ( Vehicle vehicle ) [inline]

Determines if the given vehicle is already in this controller.

This method differs from IsControllingVehicle() in that it determines whether or not vehicle is within this controller's internal list without regard to whether the train or vehicles in that train are under control of this industry. This means if the train is under industry control yet vehicle hasn't been added, false will be returned.

Parameters:
vehicle Vehicle to check for in this controller.
Returns :
Returns true if vehicle is already in this controller at least once, false otherwise even if the train vehicle belongs to is under industry control.

public bool IndustryTrainController.IsControllingTrain ( Train train )

Determines if the given train is under the control of this industry train controller.

A train is considered to be under the control if any one of its vehicles is being tracked by this controller.

Parameters:
train Train to check for.
Returns :
Returns true if train is under the control of this industry train controller, false otherwise.

public bool IndustryTrainController.IsControllingVehicle ( Vehicle vehicle ) [inline]

Determines of the given vehicle is under the control of this industry train controller.

Parameters:
vehicle Vehicle to check for being under control.
Returns :
Returns true if vehicle is under the control of this controller, false otherwise.

public bool IndustryTrainController.IsLockedVehicle ( Vehicle vehicle ) [inline]

Determines if the given vehicle is locked into this controller (i.e. under its control).

If a vehicle is locked by a controller, this indicates it is busy and shouldn't be moved.

Parameters:
vehicle Vehicle to check.
Returns :
Returns true if vehicle has a lock count greater than 0. false otherwise if the lock count of vehicle is 0.

public bool IndustryTrainController.IsTrainCommand | ( | Train | train,
 |  | string | command
 | ) | [inline]

Determines if the given train is running the named command.

Parameters:
train | Train to verify the command of in this controller.
command | Name of the industry controller command. This will usually be one of the industry load/unload strings.
Returns :
Returns true if train is to execute command in this controller's industry, false otherwise.

public bool IndustryTrainController.IsTrainLocked ( Train train ) [inline]

Determines if any of the vehicles in the given Train are locked by this controller.

If any one of the vehicles in train has a lock count greater than 0, then it is locked by this controller. This indicates that the train is busy and shouldn't be moved.

Parameters:
train Train to check the vehicles of.
Returns :
Returns true of any of the vehicles in train are locked by this industry controller, false otherwise if no vehicles are locked.

public bool IndustryTrainController.RemoveAllUnlockedVehicles ( Train train ) [inline]

Removes all unlocked vehicles of the given train from this controller.

Parameters:
train Train to get vehicles to unlock from.
Returns :
Returns true if all vehicles in train been removed from this controller successfully, otherwise false if some of the vehicles are still locked.

public bool IndustryTrainController.RemoveVehicle ( Vehicle v )

Removes the given vehicle from being under control of this controller.

Parameters:
v Vehicle to remove from this controller.
Returns :
Returns true if v is the last one in its train, false otherwise.

public void IndustryTrainController.RemoveVehicleLock ( Vehicle v ) [inline]

Decrement the lock count of the given vehicle.

Note:
This method will throw a script exception if called incorrectly on a vehicle without a matching AddVehicleLock() call (i.e. a lock count of 0).
Parameters:
v Vehicle to decrement this controller's lock count of.

public void IndustryTrainController.ReSendStoppedMessages ( Industry industry )

Tells the given industry that all vehicles in this controller have stopped in it.

Sends message of type ("Object", "Stopped") from all vehicles under the watch of this controller to the given industry.

Parameters:
industry Industry to send ("Object", "Stopped") messages to from each vehicle.

public void IndustryTrainController.SetTrainCommand | ( | Train | train,
 |  | string | command
 | ) | [inline]

Sets the command that the given train is to execute under this controller.

This method locks in train as being able to perform the named command in this industry controller.

Parameters:
train | Train to lock in a command for in this controller.
command | Name of the industry controller command train is to be locked in for in this controller. This will usually be one of the industry load/unload strings.

public void IndustryTrainController.SetTrainSpeed | ( | Train | train,
 |  | float | speed
 | ) | [inline]

Sets the speed for the given train.

Note:
The given train MUST be under the control of this industry controller. DO NOT read the implementation code of this method and assume that this warning is incorrect. The code may be changed in the future.
Parameters:
train | Train to set the speed of. MUST be under the control of this controller, otherwise undefined behavior will occur - which is a Bad Thing(tm).
speed | Speed to set train to in KPH (kilometers per hour).

public void IndustryTrainController.SetVehicleSpeed | ( | Vehicle | v,
 |  | float | speed
 | ) | [inline]

Sets the speed for the given vehicle's train.

Note:
The given train MUST be under the control of this industry controller. DO NOT read the implementation code of this method and assume that this warning is incorrect. The code may be changed in the future.
Parameters:
v | Vehicle to of the train to set the speed of. This vehicle MUST be under the control of this controller, otherwise undefined behavior will occur - which is a bad thing.
speed | Speed to set the train to.

public bool IndustryTrainController.ShouldIgnoreVehicle ( Vehicle vehicle ) [inline]

Determines if the given vehicle has already been processed and thus ignored.

Parameters:
vehicle Vehicle to check.
Returns :
Returns false if vehicle is still in this controller or if no vehicles from vehicle's train are in this controller. If vehicle's train is under the control of this industry controller yet vehicle isn't, true is returned.

The documentation for this class was generated from the following file:
  • IndustryTrainController.gs


Interface Class Reference

List of all members.

Public Methods

public native void | Log (string msg)
public native void | Print (string msg)
public native void | SetObjective (string msg, string iconTexture)
public native void | SetAlert (string msg, string iconTexture, float duration, int colour)
public native void | ShowObjective (bool state)
public native void | ShowDriverButtonMenu (bool state)
public native void | HighlightButtonBarElement (int buttonIndex, bool state)
public native void | SetObjectiveIcon (string iconTexture)
public native void | SetScore (string msg)
public void | AdjustScore (int delta)
public native void | ShowOnScreenHelp (bool show)
public native void | SetHelperIconScale (float scale)
public native void | SetResults (string msg)
public int | GetScore ()
public void | LogResult (string msg)
public void | ResetResults ()
Clears the result log.

public native int | GetDisplayWidth (void)
public native int | GetDisplayHeight (void)
public native void | SetTooltip (Browser tooltip)
public native bool | GetMetricMode (void)
public native void | SetMetricMode (bool useMetric)
public native void | WarnObsolete (string warning)
public native void | Exception (string message)
public native void | LogCallStack (string msg)
public native void | SetMapView (bool visible)
public native bool | GetMapView (void)
public native void | SetDecoupleMode (bool enabled)
public native bool | GetDecoupleMode (void)
public void | SetWaybillWindowVisible (bool visible)
public bool | GetWaybillWindowVisible (void)
public native void | SetMessageWindowVisible (bool visible)
public native bool | GetMessageWindowVisible (void)
public native bool | HasUnseenMessages (void)
public native bool | GetInterfaceVisible (void)
public native bool | GetObjectiveBarVisible (void)
public native void | SetObjectiveBarVisible (bool visible)
public native void | SetElementProperty (string elementID, string propertyID, string value)
public native string | GetElementProperty (string elementID, string propertyID)
public native string | GetTimeStamp (void)

Public Attributes

RGB Color Constants

Pre-defined 24-bit RGB (red, green and blue) color values.

See also:
Interface.SetAlert(), InterfaceAlert.colour

public define int | Colour_Red = 0xFF0000
Color definition for red as a RGB value.

public define int | Colour_Green = 0x00FF00
Color definition for green as a RGB value.

public define int | Colour_Blue = 0x0000FF
Color definition for blue as a RGB value.

public define int | Colour_Yellow = 0xFFFF20
Color definition for yellow as a RGB value.

public define int | Colour_Cyan = 0xB0C0FF
Color definition for cyan as a RGB value.

public define int | Colour_White = 0xFFFFFF
Color definition for white as a RGB value.

public define int | Colour_Black = 0x000000
Color definition for black as a RGB value.

Button Element Indexes

Indexes to the 7 buttons of the Driver Menu.

These values refer to the 7 buttons on the Driver Menu as described in sections 9.14 and 12.5.2 of the TRS2006 Expanded Manual.

See also:
Interface.HighlightButtonBarElement()

public define int | ButtonBar_Element_Close = 0
Close/Exit button.

public define int | ButtonBar_Element_Pause = 1
Pause button.

public define int | ButtonBar_Element_Save = 2
Save button.

public define int | ButtonBar_Element_Performance = 3
Performance Settings button.

public define int | ButtonBar_Element_MetricImp = 4
Imperial/Metric button.

public define int | ButtonBar_Element_Find = 5
Find button.

public define int | ButtonBar_Element_Help = 6
On Screen Help button.

Detailed Description

Interface provides Trainz scripts with simple user-interface control.

See also:
Browser, BrowserInterface, InterfaceAlert, InterfaceObjective

Member Function Documentation

public void Interface.AdjustScore ( int delta )

Adjusts the score by the given delta amount.

Parameters:
delta Amount to adjust score by. Negative value will cause score to be reduced.

public native void Interface.Exception ( string message )

Causes an exception to occur in the execution of game script code.

This method allows an exception to be explicitly invoked in the execution of game script code. It is not something you should do unless there is a major failure as it will disrupt the user.

Parameters:
message Message to be displayed (and logged) when the exception occurs.

public native bool Interface.GetDecoupleMode ( void )

Gets the decouple mode of the Driver interface.

The decouple mode can be enabled/disabled when the user clicks on the decouple icon located on the Driver button bar or presses 'Ctrl + D'. When the interface is in decouple mode, the decouple icon will be highlighted.

Returns :
Returns true if the Driver interface is in decouple mode, false otherwise.

public native int Interface.GetDisplayHeight ( void )

Gets the pixel height of the display window Trainz is running in.

Returns :
Returns the pixel height of the display area (y-axis).

public native int Interface.GetDisplayWidth ( void )

Gets the pixel width of the display area Trainz is running in.

Returns :
Returns the pixel width of the display area (x-axis).

public native string Interface.GetElementProperty | ( | string | elementID,
 |  | string | propertyID
 | ) |

Gets the value of specified property from the named element in the interface.

Parameters:
elementID | Element to get a property value from.
propertyID | Property in the element to get the value of.
Returns :
Returns the value of the specified property value if it exists, null otherwise.
See also:
SetElementProperty(), Browser.SetElementProperty()

public native bool Interface.GetInterfaceVisible ( void )

Determines if the Driver interface is visible.

The entire interface in Driver can be toggled between invisible and visible by pressing the 'F5' key.

Returns :
Returns true if the entire Driver interface is visible, false when invisible.

public native bool Interface.GetMapView ( void )

Determines if the map view window is displayed.

The user can show/hide the map view window by pressing 'M' or 'Ctrl + M' on the keyboard.

Returns :
Returns true if the map mode view window is displayed, false otherwise.

public native bool Interface.GetMessageWindowVisible ( void )

Determines if the message window in Driver is visible.

Returns :
Returns true if the message window in Driver (located at the top-center of the screen) is visible, false otherwise.

public native bool Interface.GetMetricMode ( void )

Gets the current metric/imperial mode of the interface.

Returns :
Returns true if in metric mode, false if in imperial mode.
See also:
Measurement Conversion Multipliers

public native bool Interface.GetObjectiveBarVisible ( void )

Determines if the Driver objective bar is visible.

The Driver objective bar can be toggled between invisible and visible by pressing the 'F6' key.

Returns :
Returns true if the Driver objective bar is visible, false otherwise.

public int Interface.GetScore ( )

Gets the current score.

Returns :
Returns the current score.

public native string Interface.GetTimeStamp ( void )

Gets a real-time timestamp in integer seconds.

Returns :
Return the current time represented as seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time (UTC). Note that the return value is a string as GS does not support any extended integer types.
See also:
World.GetSeconds()

public bool Interface.GetWaybillWindowVisible ( void )

Determines if the waybill window is displayed.

Returns :
Returns true if the waybill window is displayed, false otherwise.

public native bool Interface.HasUnseenMessages ( void )

Determines if there are any unseen messages in the Driver message window.

There are unseen messages if the message window is invisible yet has received new messages. This is indicated visually to the user by the highlighted microphone icon on the Driver button bar.

Returns :
Returns true if there are any unseen messages, false otherwise.

public native void Interface.HighlightButtonBarElement | ( | int | buttonIndex,
 |  | bool | state
 | ) |

Turns highlighting for a button on the Driver Menu either on or off.

This method allows a button on the Driver Menu found in the top left corner of the screen to be highlighted as if the mouse cursor was hovering above that button as well as being restored back to normal state. Note that the Driver Menu is not always visible, but you can explicitly show it with ShowDriverButtonMenu();

Parameters:
buttonIndex | Index of button to perform state change on as defined in the Button Element Indexes constants.
state | If true, the button specified in buttonIndex is highlighted, false to set the button to a regular un-highlighted state.

public native void Interface.Log ( string msg )

Prints a line of text to the \Trainz\JetLog.txt log file.

Parameters:
msg String to print to the log file.
See also:
Router.Info()

public native void Interface.LogCallStack ( string msg )

Logs the current call stack.

Generates a log of the current call stack and places it in the \Trainz\JetLog.txt file.

Parameters:
msg String containing a message to be included with the call stack log.

public void Interface.LogResult ( string msg )

Adds a result to the result log.

Parameters:
msg Message for result log.

public native void Interface.Print ( string msg )

Prints a line of text to the Driver in-game message display.

This is typically used for non-vital event notifications.

Parameters:
msg String to print on the in-game message display.

public native void Interface.SetAlert | ( | string | msg,
 |  | string | iconTexture,
 |  | float | duration,
 |  | int | colour
 | ) |

Displays an alert message and icon in the objective panel.

The objective text is restored after the given duration in seconds.

Parameters:
msg | Text for alert message.
iconTexture | Icon for alert. Use a blank string for no icon.
duration | Duration the alert is displayed for in seconds.
colour | Color of alert text. Can be a 24-bit RGB (red, green and blue) value or use one of predefined RGB color constants.
See also:
RGB Color Constants

public native void Interface.SetDecoupleMode ( bool enabled )

Sets the decouple mode of the Driver interface.

The decouple mode can be enabled/disabled when the user clicks on the decouple icon located on the Driver button bar or presses 'Ctrl + D'. When the interface is in decouple mode, the decouple icon will be highlighted.

Parameters:
enabled Use true to enable decouple mode, false to disable.

public native void Interface.SetElementProperty | ( | string | elementID,
 |  | string | propertyID,
 |  | string | value
 | ) |

Sets the specified property of the named element in the interface.

This method is used to modify element properties of browser windows in the Trainz interface such as the Minimap.

Parameters:
elementID | Element to set the property of.
propertyID | Property in the element to set.
value | Value to set the property to.
See also:
GetElementProperty()

public native void Interface.SetHelperIconScale ( float scale )

Control the scale of on-screen help icons.

This allows the modification of the scale of junction icons, etc.

Parameters:
scale Scaling value between 0.5f (50%) and 1.0f (100%) for the icon sizes.

public native void Interface.SetMapView ( bool visible )

Shows/hides the map mode view window.

The user can show/hide the map view window by pressing 'M' or 'Ctrl + M' on the keyboard.

Parameters:
visible Use true to show the map mode view window, false to hide.

public native void Interface.SetMessageWindowVisible ( bool visible )

Shows/hides the waybill window in Driver.

Parameters:
visible Use true to show the message window, false to hide.

public native void Interface.SetMetricMode ( bool useMetric )

Sets the metric/imperial mode of the interface.

Note:
When this method is called and the metric/imperial mode is changed, a message of type ("Interface-Event", "Set-Metric-Mode") is broadcasted.
Parameters:
useMetric Set to true for metric, false for imperial.
See also:
Measurement Conversion Multipliers

public native void Interface.SetObjective | ( | string | msg,
 |  | string | iconTexture
 | ) |

Specify text instructions and icon for the current objective.

This method will cause the driver 'objective panel' to become visible. User can hide/show the panel at their discretion.

Parameters:
msg | Text for objective message.
iconTexture | Icon to display with the objective. Use an empty string or null for no icon.

public native void Interface.SetObjectiveBarVisible ( bool visible )

Shows/hides the objective bar in Driver.

The Driver objective bar can be toggled between invisible and visible by pressing the 'F6' key.

Parameters:
visible Use true to show the Driver objective bar, false to hide.

public native void Interface.SetObjectiveIcon ( string iconTexture )

Sets the icon displayed next to the objective text.

Parameters:
iconTexture Name of image file to use as the icon. Must be a 32x32 .tga image. Use an empty string or null to have no icon displayed (this will get rid of the previous one if any).

public native void Interface.SetResults ( string msg )

Specify results of a scenario.

This method will change the activities menu to the results screen and fill out the results box with the given string. The results will be visible when the user closes the activity module.

Parameters:
msg String to display in results box.

public native void Interface.SetScore ( string msg )

Enable/disable the display of activity-specific time-remaining/score string in the activity bar.

Parameters:
msg Message to display with time/score in activity bar.

public native void Interface.SetTooltip ( Browser tooltip )

Sets the tooltip that should follow the mouse around.

This method specifies that tooltip should assume tooltip-like behavior (i.e. follow the mouse around etc.). Any existing tooltip will be replaced.

Parameters:
tooltip Tooltip to follow the mouse. If this Browser is released, it will be removed automatically. If null, the current tooltip will be removed.

public void Interface.SetWaybillWindowVisible ( bool visible )

Shows/hides the waybill window in Driver.

Parameters:
visible Use true to show the waybill window, false to hide.

public native void Interface.ShowDriverButtonMenu ( bool state )

Shows or hides the Driver Main Menu Bar )top left corner).

The menu may already be visible if the user has recently moved the cursor to the top left region of the screen.

Note:
Showing and hiding is not immediate, there may be a delay before it slides on/off.
Parameters:
state If true, the button menu is shown, false to hide.

public native void Interface.ShowObjective ( bool state )

Shows/hides the objective panel.

Parameters:
state If true, the objective panel is shown, false to hide.

public native void Interface.ShowOnScreenHelp ( bool show )

Enable/disable on-screen help.

This method performs the same function as the Show On-screen Help menu item in Driver which is used to bring up elevated names on map objects such as junctions.

Parameters:
show If true, on-screen help is enabled, false to disable.

public native void Interface.WarnObsolete ( string warning )

Generates a runtime warning that a given function or usage is obsolete.

The warning goes to the JetLog.txt file and is not visible to the casual user within Trainz. Only one warning is generated for any given warning string.

Parameters:
warning Message to log. This will only appear the first time this method is called for that message.

The documentation for this class was generated from the following file:
  • interface.gs


InterfaceAlert Class Reference

List of all members.

Public Methods

public void | Alert (string alertEx)

Public Attributes

public string | alert
Alert message string.

public string | icon
Name of icon file.

public string | log
Message to place in log file.

public string | wav
Name of audio file played when alert is activated.

public float | time = 10.0f
Duration of the alert in seconds. Default of 10.0 but can be changed.

public int | colour = Interface.Colour_Black
public int | score
Alert score value.

Detailed Description

An interface alert.

See also:
Interface, Interface.SetAlert(), InterfaceObjective

Member Function Documentation

public void InterfaceAlert.Alert ( string alertEx ) [inline]

Executes this alert.

Parameters:
alertEx Text to concatenate to the alert message string.

Member Data Documentation

public int InterfaceAlert.colour = Interface.Colour_Black

Color of text as a 24-bit RGB (red, green and blue) value. Is black by default but can be changed.

See also:
RGB Color Constants

The documentation for this class was generated from the following file:
  • interface.gs


InterfaceObjective Class Reference

List of all members.

Public Methods

public void | Objective (string objectiveEx)

Public Attributes

public string | objective
Objective message string.

public string | icon
Name of icon file.

public string | log
Message to place in log file.

public string | wav
Name of audio file played when objective is activated.

public int | score
Objective score value.

Detailed Description

An interface objective.

See also:
Interface, Interface.SetObjective(), InterfaceAlert

Member Function Documentation

public void InterfaceObjective.Objective ( string objectiveEx ) [inline]

Executes this objective.

Parameters:
objectiveEx Text to concatenate to the objective message string.
See also:
Interface.AdjustScore(), Interface.SetObjectionIcon()

The documentation for this class was generated from the following file:
  • interface.gs


IPICProcess Class Reference

List of all members.

Detailed Description

Information class that describes an industry process and its attributes.

This class defines a process in an industry. It is mainly used by the IndustryProductInfoCollection class.

Useful interface methods of this class are:

  • public void Init (IndustryProductInfoCollection ipic, string processName)
  • public bool GetEnabled ()
  • public void SetEnabled (bool enabled)
  • public float GetDuration ()
  • public void SetDuration (float duration)
  • public string GetProcessName ()
  • public IndustryProductInfoCollection GetIndustryProductInfoCollection ()
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\IPICProcess.gs script file.
See also:
IndustryProductInfoCollection, IndustryProductInfoProcess, IPICQueue, IPICTrack, IndustryProductInfoComplete, Industry.GetProcessNameList()

The documentation for this class was generated from the following file:
  • IPICProcess.gs


IPICQueue Class Reference

List of all members.

Detailed Description

Information class that describes a product queue and its waybill requirements.

This class defines a queue in an industry where a product transfer can take place. It is mainly used by the IndustryProductInfoCollection class.

Useful interface methods of this class are:

  • public void Init (IndustryProductInfoCollection ipic, ProductQueue queue)
  • public int GetSize ()
  • public void SetSize (int asize)
  • public int GetWaybillRemain ()
  • public void SetWaybillRemain (int waybillRemain)
  • public int GetWaybillIssuePercent ()
  • public void SetWaybillIssuePercent (int issuePercent)
  • public IndustryProductInfoQueues[] GetRelatedProducts ()
  • public IndustryProductInfoCollection GetIndustryProductInfoCollection ()
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\IPICQueue.gs script file.
See also:
IndustryProductInfoCollection, IndustryProductInfoQueues, IPICProcess, IPICTrack, IndustryProductInfoComplete, MapObject.GetQueues()

The documentation for this class was generated from the following file:
  • IPICQueue.gs


IPICTrack Class Reference

List of all members.

Detailed Description

Information class that describes a piece of track an in industry.

This class defines a piece of track in an industry where a product transfer can take place. It is mainly used by the IndustryProductInfoCollection class.

Useful interface methods of this class are:

  • public void Init (IndustryProductInfoCollection ipic, string trackName)
  • public string GetTrackName ()
  • public IndustryProductInfoCollection GetIndustryProductInfoCollection ()
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\IPICTrack.gs script file.
See also:
IndustryProductInfoCollection, IndustryProductInfoTracks, IPICProcess, IPICQueue, IndustryProductInfoComplete, SceneryWithTrack.GetAttachedTrack()

The documentation for this class was generated from the following file:
  • IPICTrack.gs


ITCTrainCommand Class Reference

List of all members.

Public Attributes

public Train | train
Train that running the command.

public string | command

Detailed Description

Defines a Train and the type of command it is to perform in this industry.

This class is used by IndustryTrainController to keep track of the different trains and the command it is going to use in the host industry.

See also:
IndustryTrainController, IndustryTrainController.m_trainCommands, Load and Unload Driver Command Strings

Member Data Documentation

public string ITCTrainCommand.command

Name of the command that the train is to perform in this industry.

Use either Industry.LOAD_COMMAND or Industry.UNLOAD_COMMAND when setting this data member.

The documentation for this class was generated from the following file:
  • IndustryTrainController.gs


Junction Class Reference

Inheritance diagram for Junction:

Trackside JunctionBase List of all members.

Detailed Description

Junction class provides control over the Junction map objects.

Junctions placed in Surveyor can be accessed in script code by calling Router.GetGameObject("junctionName") and casting the returned reference to Junction.

This interface methods to control and obtain information about the status of a Junction can be found in the JunctionBase parent class. Other functionality generic to trackside items can be found in the Trackside class, which Junction also inherits from.

Messages used by a Junction object are:

Major | Minor | Source | Destination
"Junction" | "Toggled" | junction | broadcast
"Junction" | "InnerEnter" | junction | train
"Junction" | "Enter" | junction | train
"Junction" | "Stopped" | junction | train
"Junction" | "InnerLeave" | junction | train
"Junction" | "Leave" | junction | train
"Object" | "InnerEnter" | train | junction
"Object" | "Enter" | train | junction
"Object" | "Stopped" | train | junction
"Object" | "InnerLeave" | train | junction
"Object" | "Leave" | train | junction

See also:
Signal, Track, TrackMark, Trackside, Trigger, Navigate.LockJunction()

The documentation for this class was generated from the following file:
  • junction.gs


JunctionBase Class Reference

Inheritance diagram for JunctionBase:

Junction JunctionBaseGameObject List of all members.

Public Methods

public native bool | SetDirection (int direction)
public native int | GetDirection (void)
public native void | AllowManualControl (bool allow)
public native bool | GetManualControl ()
public native Permit | RequestPermit (GameObject obj)
public native Permit | RequestTrackPermit (GameObject obj, int direction)
public native bool | SwitchForTrain (Train train, int dstDirection)
public native int | GetDirectionToTrain (Train train)
public native MapObject | GetMapObject (void)
public native GameObject | GetGameObject (void)
public string | GetDebugString (void)
public native bool | JunctionReEnter (int nodeId)
public native bool | JunctionInnerReEnter (int nodeId)

Public Attributes

Junction States

Possible states a junction can be switched to.

See also:
JunctionBase.GetDirection(), JunctionBase.GetDirectionToTrain(), JunctionBase.RequestTrackPermit(), JunctionBase.SetDirection(), JunctionBase.SwitchForTrain(), Navigate.LockJunction()

public define int | DIRECTION_LEFT = 0
Left junction direction state.

public define int | DIRECTION_FORWARD = 1
Forward junction direction state.

public define int | DIRECTION_RIGHT = 2
Right junction direction state.

public define int | DIRECTION_BACKWARD = -1
Backward junction direction state.

public define int | DIRECTION_NONE = 3
Junction not in any state.

Detailed Description

A top-level junction interface class.

This class is a top level interface for a junction on a route in Trainz. The methods provided here apply to both junctions created with track splines and levers and fixed track junctions.

Junctions made from track splines and a trackside lever item are represented by the Junction class which is derived from this class as well as Trackside. Hence these spline junctions have the JunctionBase interface along with the behaviors of a Trackside object.

Fixed track junctions do not have all the features of a Trackside object and should not be expected to.

Messages used by a JunctionBase object are:

Major | Minor | Source | Destination
"Junction" | "InnerEnter" | junction | train
"Junction" | "Enter" | junction | train
"Junction" | "Stopped" | junction | train
"Junction" | "InnerLeave" | junction | train
"Junction" | "Leave" | junction | train
"Junction" | "Toggled" | junction | broadcast
"Object" | "InnerEnter" | train | junction
"Object" | "Enter" | train | junction
"Object" | "Stopped" | train | junction
"Object" | "InnerLeave" | train | junction
"Object" | "Leave" | train | junction

See also:
Junction, JunctionBaseGameObject, SceneryWithTrack.GetAttachedJunctions()

Member Function Documentation

public native void JunctionBase.AllowManualControl ( bool allow )

Allows/disallows the user from changing this junction's setting by clicking on it.

Parameters:
allow If true, the user is allowed to change this junction, otherwise false and the user won't be able to change this junction.

public string JunctionBase.GetDebugString ( void ) [inline]

Gets a string that describes the MapObject associated with this junction.

Returns :
Returns a string that contains the node ID and name of the MapObject associated with this junction. If successful, the returned string will include the node ID and name of the MapObject. Otherwise in error string will be returned instead.

public native int JunctionBase.GetDirection ( void )

Gets the current direction of this junction.

Returns :
Returns the direction of this junction as seen from its single track end.
See also:
Junction States

public native int JunctionBase.GetDirectionToTrain ( Train train )

Gets the direction of this junction relative to the given train from the single-track end.

Parameters:
train Train to get the relative direction of to this junction. The train must be within a reasonable range (currently 15 track stretches) of this junction.
Returns :
Returns the direction of this junction as seen from its single track end relative to train.
See also:
Junction States

public native GameObject JunctionBase.GetGameObject ( void )

Gets the GameObject associated with this junction.

Note:
The returned GameObject may or may not be equivalent to the MapObject, and may or may not be equivalent to this JunctionBase. Always cast to be sure.
Returns :
Returns the GameObject associated with this junction.

public native bool JunctionBase.GetManualControl ( )

Determines if the user is allowed to change this junction.

Returns :
Returns true if manual control of this junction by the user is allowed, false otherwise.

public native MapObject JunctionBase.GetMapObject ( void )

Gets the MapObject associated with this junction.

Note:
More than one junction may be associated with the same MapObject.
Returns :
Returns the MapObject associated with this junction. The returned MapObject may not necessarily be a Trackside object, so always cast to be sure. A null reference is returned in the case of failure.

public native bool JunctionBase.JunctionInnerReEnter ( int nodeId )

Sends a new ("Junction", "InnerEnter") message to this junction from the specified train.

This method exists so a JunctionBase child class that doesn't inherit from the Trackside/Junction hierarchy can still have inner re-enter capabilities.

Parameters:
nodeId Train's node ID that may be found by using GetId().
Returns :
Returns true if the train identified by nodeId is in the junction and the message was sent, false otherwise.
See also:
Trackside.InnerReEnter()

public native bool JunctionBase.JunctionReEnter ( int nodeId )

Sends a new ("Junction", "Enter") message to this junction from the specified train.

This method exists so a JunctionBase child class that doesn't inherit from the Trackside/Junction hierarchy can still have re-enter capabilities.

Parameters:
nodeId Train's node ID that may be found by using GetId().
Returns :
Returns true if the train identified by nodeId is in the junction and the message was sent, false otherwise.
See also:
Trackside.ReEnter()

public native Permit JunctionBase.RequestPermit ( GameObject obj )

Request a permit to control this junction.

Only one such permit is granted at a time. See Permit for more details on permits.

Parameters:
obj Object requesting the permit.
Returns :
Returns a Permit for obj to control this junction. The permit may not necessarily be granted.

public native Permit JunctionBase.RequestTrackPermit | ( | GameObject | obj,
 |  | int | direction
 | ) |

Request a permit to drive on the track which is in direction from this junction.

Note:
Only one such permit is granted at a time. See Permit for more details on permits.
Parameters:
obj | Object requesting the permit.
direction | Direction from the junction where the track to get a permit for is. Use one of the junction state constants for this argument.
Returns :
Returns a Permit for obj to control the specified track. The permit may not necessarily be granted.
See also:
Permit, Track, Junction States

public native bool JunctionBase.SetDirection ( int direction )

Sets this junction toward the specified direction.

Parameters:
direction Direction to set the junction to as seen from the single track end of the junction. Use one of the junction state constants for this argument.
Note:
This method assumes you already have a permit, or don't care about permits.
Returns :
Returns true if successful or false if the junction direction was unchanged or the desired direction could not be reached (e.g. DIRECTION_FORWARD, which is not supported by all junctions).
See also:
Permit, Navigate.LockJunction(), Junction States

public native bool JunctionBase.SwitchForTrain | ( | Train | train,
 |  | int | dstDirection
 | ) |

Changes this junction such that the given train can cross it in the specified direction.

Note:
This method assumes you already have a permit, or don't care about permits.
Parameters:
train | Train that is to cross the junction.
dstDirection | Direction from this junction that the train is to travel through to. Must be on the opposite side of this junction that the train is. Use one of the junction state constants for this argument.
Returns :
Returns true if successful, false otherwise. Prior to TRS2004, this method would throw an exception on failure instead of returning false.
See also:
Junction States

The documentation for this class was generated from the following file:
  • JunctionBase.gs


JunctionBaseGameObject Class Reference

Inheritance diagram for JunctionBaseGameObject:

JunctionBase GameObject List of all members.

Detailed Description

Wrapper class for an object which derives from JunctionBase and GameObject. FOR INTERNAL USE ONLY.

Note:
A JunctionBaseGameObject does not have the exact same behavior of a Trackside derived Junction or even the behavior of a MapObject.
See also:
Junction, JunctionBase, MapObject

The documentation for this class was generated from the following file:
  • JunctionBase.gs


JunctionPermitInfo Class Reference

List of all members.

Detailed Description

This class is used privately and internally by Train and is not a Trainz API class intended for general use.

WARNING: THIS CLASS IS NOT TO BE USED OR RELIED ON.

The documentation for this class was generated from the following file:
  • train.gs


KUID Class Reference

Inheritance diagram for KUID:

GSObject List of all members.

Public Methods

public native string | GetName (void)
public native string | GetHTMLString (void)
public native string | GetLogString (void)

Detailed Description

KUID represents a single Asset (of any type).

A KUID object is not to be confused as an instance of an asset. For example, a particular locomotive could be used several times in a consist. The locomotives in the consist are instances of the same asset and all refer back to the same KUID.

It is possible to refer to a KUID by name. For example, "Locomotive class F7 - NYC" may be represented as a KUID.

Note:
An asset's KUID MUST be unique.
See also:
Asset, Asset.GetKUID(), Asset.LookupKUIDTable(), GameObject, Soup.GetNamedTagAsKUID(), KUIDList

Member Function Documentation

public native string KUID.GetHTMLString ( void )

Gets the encoding of this KUID for use as a parameter in a mini-browser tag.

Note:
Do NOT rely on the format or contents of the returned string, it will change with future versions of Trainz.
Returns :
Returns this KUID as a string in the format of "<KUID:user id:asset number>".

public native string KUID.GetLogString ( void )

Gets a human-readable form of this KUID for use in error logs, etc.

Note:
Do NOT rely on the format or contents of the returned string, it will change with future versions of Trainz.

public native string KUID.GetName ( void )

Gets the human-readable name of the asset of this KUID.

Returns :
Returns the name of the asset this KUID represents.

The documentation for this class was generated from the following file:
  • kuid.gs


KUIDList Class Reference

Inheritance diagram for KUIDList:

GSObject List of all members.

Public Methods

public native int | CountKUIDs (void)
public native void | AddKUID (KUID kuid)
public native void | RemoveKUID (KUID kuid)
public native bool | HasKUID (KUID kuid)
public native KUID | GetIndexedKUID (int index)
public native void | Copy (KUIDList from)
public native void | Clear (void)
Clears out this list so that it is empty.

public native bool | IsLocked (void)

Detailed Description

A list of KUID objects.

Note:
A KUIDList cannot be created with new. Instead you must either use Constructors.NewKUIDList() to create a new list or get a list from a method such as Asset.GetDependencyList().
See also:
KUID, Asset.GetDependencyList(), Constructors.NewKUIDList(), ScenarioBehavior.AppendDependencies()

Member Function Documentation

public native void KUIDList.AddKUID ( KUID kuid )

Adds the given KUID object to this list.

Parameters:
kuid KUID to add to this list. A null value will result in this method not doing anything.
Note:
If this list is locked, than the KUID can't be added so this method will simply return without doing anything.

public native void KUIDList.Copy ( KUIDList from )

Initializes this list to be a copy of the given one.

Parameters:
from Other list to initialize this one with.
Note:
To create a new KUIDList, you must use the Constructors.NewKUIDList() method.

public native int KUIDList.CountKUIDs ( void )

Returns the number of KUIDs in this list.

Returns :
The number of KUIDs in this list.

public native KUID KUIDList.GetIndexedKUID ( int index )

Gets the specified KUID from by its list index number.

Parameters:
index Index position of the KUID in this list.
Returns :
Returns the KUID specified by index if it exists, null otherwise.

public native bool KUIDList.HasKUID ( KUID kuid )

Determines if the given KUID is present in this list.

Parameters:
kuid KUID to check for the existence of in this list.
Returns :
Returns true if kuid already exists in this list, false otherwise.

public native bool KUIDList.IsLocked ( void )

Determines if this list is locked (i.e. read only).

Returns :
Returns true if this list is locked, false otherwise.

public native void KUIDList.RemoveKUID ( KUID kuid )

Removes the given KUID object from this list.

Parameters:
kuid KUID to remove from this list. A null value will result in this method not doing anything.
Note:
If this list is locked, you can't remove a KUID from it and this method will simply return without having done anything.

The documentation for this class was generated from the following file:
  • KUIDList.gs


Library Class Reference

Inheritance diagram for Library:

TrainzGameObject List of all members.

Public Methods

public Soup | GetProperties (void)
public void | SetProperties (Soup soup)
public string | LibraryCall (string function, string[] stringParam, GSObject[] objectParam)
native OnlineAccess | GetOnlineAccess (void)

Detailed Description

Parent and interface class for Library asset.

A library is a self-contained code module asset that the script of any other asset can access and use the features of. It is this class that provides the interface for a library asset.

Library assets allow 3rd party content creators to create easily re-usable code libraries. The benefit of using library assets is that you can have a re-usable code module that any script can access without having to duplicate a source file into the directory of each asset that needs it.

The other use for Library in TRS2006 is that a Library class is the only way you can get an OnlineAccess object to access Planet Auran services from a Trainz script. See the GetOnlineAccess() method's description for further details.

Defining a Library Asset
To define a library asset, not very much is needed. The only essential tags are kind (which is set to "library" automatically when you create a new library asset in CCP) along with the script and class entries that tell Trainz what the source code file and Library-derived class that define this library are.

Using a Library Asset
Using a library asset is a little more complex thin simply including a .gs file. You cannot include the library asset's .gs file and just start using it. Instead, you must somehow get a reference to an instance of the Library asset.

For this to happen, the script code using the library needs to know that library asset's KUID. This is done by putting an entry for the KUID of the library asset in the kuid-table section of the asset's configuration.

To get a reference to a library asset so its functionality can be used, World.GetLibrary() is the method you use to get the library by KUID. Once you have that, you can use LibraryCall() to make calls to the library. For example:

     // get handle to the utility library
     KUID utilLibKUID = me.GetAsset().LookupKUIDTable("util-library");
     Library  utilLib = World.GetLibrary(utilLibKUID);

     // do something with the yak library
     if (utilLib)
     {
       Interface.Log("Successfully loaded library: 'util-library '!");

       utilLib.LibraryCall("YakOn", null, null);

       Sleep(20.0);

       string paramStrArr = new string[1];
       paramStrArr[0] = "Funny";

       utilLib.LibraryCall("ChangeYakMode", paramStrArr, null);
     }
     else
     {
       Interface.Log("Error, failed to load library asset 'util-lib'!");
     }

Once the reference to the library has been obtained and verified, it is now safe to start calling its LibraryCall() method to access library functionality.

The Library object itself is created by Trainz when you first use it. Only one instance of it is created. Any further calls to library from the asset script that first used it will be processed by the same Library instance, as will calls from other assets using the same library. This means you can reliably expect different scripts to all deal with the one library.

Support for a Library to save and load properties is provided with SetProperties() and GetProperties() methods that work in the same way their PropertyObject equivalents do. Just keep in mind there will only be one set of properties loaded/saved for a Library asset as only once instance of it exists.

See also:
World.GetLibrary()

Member Function Documentation

native OnlineAccess Library.GetOnlineAccess ( void )

Private method for library to get OnlineAccess object keyed to itself.

This is method is the mechanism used to access Planet Auran via an OnlineAccess object from a script.

Script programmers should be careful not to allow other classes access to the OnlineAccess structure, either directly or indirectly, in order to prevent asset spoofing.

It is only through this private method that you can obtain an OnlineAccess object, hence your online access must be done with a Library asset.

Returns :
Returns an OnlineAccess object allowing access to Planet Auran services when online.
See also:
OnlineAccess

public Soup Library.GetProperties ( void )

Gets the properties of this library as a database.

See the PropertyObject.GetProperties() method description for further explanation and general discussion of how a method like this should be implemented.

Note:
It is possible that in future versions of Trainz, parent methods like this one may have their implementation modified and by not calling it from an overridden method, you run the risk of your assets NOT WORKING in a future version of Trainz.
Returns :
Returns the properties of this library object as a Soup database.

public string Library.LibraryCall | ( | string | function,
 |  | string | stringParam[],
 |  | GSObject | objectParam[]
 | ) |

Library call function.

This method provides a virtual function call and can be thought of as being the RPC function of a library asset. It is through this method that all library calls are to go and it must be overridden if you want your library to do anything.

How the arguments are used and processed to determine what to do is something left to the library author to decide on. This means that any external code using your library would need to use the function arguments as your implementation requires. If your library is going to be available for use by others, then you would need to specify and document how your LibraryCall() method requires arguments

The name of the library call is specified in the function argument while parameters for the library calls are provided for through the stringParam and objectParam arguments.

It is worth taking special note of how objectParam is an array of GSObject references. GSObject is an empty generic parent class that various other Trainz classes inherit from, so a large variety of objects can be passed in through that parameter.

It is recommended that caution is taken when processing the arguments in your implementation of this method, especially if your library asset is intended for use by other content creators as you have no control over how they may use (or abuse!) your library.

Some guidelines to follow if you want your library to be robust and bullet proof are:

  • Never assume the arguments are valid. When processing the arguments, make sure they are not null before using them. There is no need however to check an argument you don't use.
  • Make sure the elements in the parameter arrays exist before trying to use them. This can be done by verifying the size of array and making sure the element is not null.
  • If using the objectParam argument, cast the array item to the type you are expecting and verify the cast. There are no guarantees of what the object might be. A cast will be needed to access the objects anyway as GSObject has no methods or data members. If the cast failed, the object the cast was assigned to will be null.
Here is an example implementation that although fairly useless functionality wise, does provide a demonstration of how you might structure your own implementation:

     public string LibraryCall(string function, string[] stringParam, GSObject[] objectParam)
     {
       if (function == "YakOn")
       {
         // do something to enable the fun of Yak mode...
         if (stringParam and stringParam.size() and objectParam and objectParam.size())
         {
           if (stringParam[0] == "Vehicle")
           {
             Vehicle vehicle = cast<Vehicle> GSObject[0];
             if (vehicle)
             {
               Interface.Print("YakOn: Valid vehicle '" + vehicle.GetName() + "' found'");
               return "YakOn:ok:vehicle";
             }
             return "YakOn:bad:invalid vehicle object";
           }
           return "YakOn:bad:unknown object type '" + stringParam[0] + "'";
         }
         return "YakOn:bad:stringParam array null/too small";
       }
       if (function == "YakOff")
       {
         // do something to get rid of that annoying Yak stuff...
         if (stringParam and stringParam.size())
         {
           if (stringParam[0] and stringParam[1]) // we need two valid string parameters
           {
             Interface.Print("YakOff: Two param strings are: '" + stringParam[0] +
                             "' and: '" + stringParam[1] + "'");
             return "YakOff:ok";
           }
           return "YakOff:bad:empty string parameters!";
         }
         return "YakOff:bad:stringParam array null/too small";
       }

       // otherwise, do whatever parent function does
       return inherited(function, stringParam, objectParam);
     }

LibraryCall() may not be the most efficient way to handle a library function call and may seem rather crude, but this is a temporary measure that will be replaced with a more elegant direct-call interface in a future versions of Trainz. This library call mechanism however will still remain supported so existing library assets are not broken.

Parameters:
function | Name of the virtual function call.
stringParam | Array of string parameters.
objectParam | Array of object parameters.
Returns :
Returns a string that acts as a generic library call return value. How this return string is to be used is up to the library creator.

public void Library.SetProperties ( Soup soup )

Sets the properties of this library from a database.

See the PropertyObject.SetProperties() method description for further explanation and general discussion of how a method like this should be implemented.

Note:
It is possible that in future versions of Trainz, parent methods like this one may have their implementation modified and by not calling it from an overridden method, you are running the risk of having your assets NOT WORKING in a future version of Trainz.
Parameters:
soup Database to initialize this library with.

The documentation for this class was generated from the following file:
  • Library.gs


LinkedData Class Reference

List of all members.

Public Attributes

public string | text
Text data for this node. User-defined.

public int | index
Index value of item in the list.

public GSObject | gsobject
Object reference for this list item.

Detailed Description

A node in a generic linked list.

This class is used by the LinkedList class as a generic item. It contains a GSObject data member so it can be used to contain a reference to a large variety of Trainz objects. What it may be used to store in the LinkedList is up to the programmer.

See also:
LinkedList

The documentation for this class was generated from the following file:
  • common.gs


LinkedList Class Reference

List of all members.

Detailed Description

A simple generic linked list class.

This generic linked list contains a list of LinkedData objects. Methods to add items to the list and sort them are provided.

Public interface methods for this class are:

  • public void Init ()
  • public void Sort ()
  • public void Add (LinkedData ld)
  • public void Add (LinkedData ld, bool unique)
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\common.gs script file.
See also:
LinkedData

The documentation for this class was generated from the following file:
  • common.gs


LoadHelperInfo Class Reference

Inheritance diagram for LoadHelperInfo:

HTMLPropertyHandler List of all members.

Public Methods

public string | GetDescriptionHTML (void)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Public Attributes

public string | queueName = ""
Name of product the queue.

public KUID | productKUID
KUID of product being used/to use.

public int | amount = 0
Amount of products in the load.

Detailed Description

Describes a product queue and its contents.

This class describes a load on a MapObject (i.e. Vehicle/Industry) in terms of product type, queue name and queue size. This class is mainly used by VehicleDescriptor to keep track of the loads a vehicle it is describing has.

See also:
VehicleDescriptor, ConsistListHelper, Industry, Vehicle, ProductQueue

Member Function Documentation

public string LoadHelperInfo.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from HTMLPropertyHandler.

public Soup LoadHelperInfo.GetProperties ( ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from HTMLPropertyHandler.

public string LoadHelperInfo.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string [] LoadHelperInfo.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from HTMLPropertyHandler.

public string LoadHelperInfo.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string LoadHelperInfo.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public void LoadHelperInfo.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from HTMLPropertyHandler.

public void LoadHelperInfo.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • ConsistHelperInfo.gs


LoadingReport Class Reference

Inheritance diagram for LoadingReport:

GSObject List of all members.

Public Methods

public void | Clear (void)
Clears out this report.

public Vehicle | GetSrcVehicle (void)
public Vehicle | GetDstVehicle (void)
public Industry | GetSrcIndustry (void)
public Industry | GetDstIndustry (void)

Public Attributes

public GameObject | src
Source object where the product is transferred from.

public GameObject | dst
Destination object where the product is transferred to.

public ProductQueue | srcQueue
Source queue in src of product transfer.

public ProductQueue | dstQueue
Destination queue in dst of product transfer.

public int | amount
Amount of products actually loaded/unloaded.

public int | desiredAmount
Amount of products desired to be loaded/unloaded.

public int | sideFlags
Vehicle Side Flags

Defines which side/s of a vehicle a report is referring to.

public define int | LEFT_SIDE = 1
Left side.

public define int | RIGHT_SIDE = 2
Right side.

public define int | TOP_SIDE = 4
Top side.

public define int | BOTTOM_SIDE = 8
Bottom side.

Detailed Description

Report of a loading operation.

This class is used as a parameter to for the LoadProduct() and UnloadProduct() call-back methods in Vehicle to describe the transfer of product happening between the vehicle and the Industry that called these methods.

The various public data members of this class describe a desired transfer of product that the vehicle should attempt to perform when called on.

See also:
Industry, ProductQueue, Vehicle, Vehicle.LoadProduct(), Vehicle.UnloadProduct()

Member Function Documentation

public Industry LoadingReport.GetDstIndustry ( void )

Gets the destination industry where the product/s are unloaded to.

Returns :
Returns the destination industry.

public Vehicle LoadingReport.GetDstVehicle ( void )

Gets the destination vehicle where the product/s are loaded to.

Returns :
Returns the destination vehicle.

public Industry LoadingReport.GetSrcIndustry ( void )

Gets the source industry where the product/s are loaded from.

Returns :
Returns the source industry.

public Vehicle LoadingReport.GetSrcVehicle ( void )

Gets the source vehicle where the product/s are unloaded from.

Returns :
Returns the source vehicle.

Member Data Documentation

public int LoadingReport.sideFlags

Variable that dictates which side(s) of a vehicle the loading operation took place on.

When one (and only one) of either the source or destination (for the products) is a vehicle, this variable will provide details on which side of the vehicle was loaded from.

See also:
Vehicle Side Flags

The documentation for this class was generated from the following file:
  • LoadingReport.gs


Locomotive Class Reference

Inheritance diagram for Locomotive:

Vehicle List of all members.

Public Methods

public native void | SetBrokenThrottle (bool broken)
public native void | SetBrokenReverser (bool broken)
public native void | SetCompressorEfficiency (float efficiency)
public native void | SetHasDriver (bool hasDriver)
public native float | GetEngineSetting (string p_settingName)
public native void | SetEngineSetting (string p_settingName, float p_value)
public CabinData | GetCabinData (void)
public void | SetCabinData (CabinData data)

Detailed Description

Locomotive is an instance of a loco (a special type of Vehicle).

See also:
Cabin, Cabin.GetParentObject(), CabinData, CabinControl, DefaultLocomotiveCabin, DriverCharacter, Train, Vehicle,

Member Function Documentation

public CabinData Locomotive.GetCabinData ( void )

Gets the cabin data of this locomotive.

The cabin data refers to an internal private CabinData object in this class that represents the state of the cabin's controls. The internal CabinData object of a Locomotive is usually maintained by the Cabin.Attach() and Cabin.Update() methods of the Cabin script.

Returns :
Returns the cabin data of this loco.

public native float Locomotive.GetEngineSetting ( string p_settingName )

Gets the value of the named engine setting.

Parameters:
p_settingName Setting to get the value of. See SetEngineSetting() for details of available engine settings.
Returns :
Returns the value of the engine setting named by p_settingName if possible.

public native void Locomotive.SetBrokenReverser ( bool broken )

Disable/enable the reverser lever's effect on the loco.

Note:
When broken, the reverser lever can still be used by the player, it just won't affect the loco.
Parameters:
broken If true the reverser lever will be broken and unable to affect the locomotive. Use false to enable.

public native void Locomotive.SetBrokenThrottle ( bool broken )

Disable/enable the throttle lever's effect on the loco.

Note:
When broken, the throttle lever can still be used by the player, it just won't affect the loco.
Parameters:
broken If true the throttle lever will be broken and unable to affect the locomotive. Use false to enable it.

public void Locomotive.SetCabinData ( CabinData data )

Sets this locomotive's cabin data.

Note:
See GetCabinData() and CabinData for more details on cabin data.
Parameters:
data Cabin data for this locomotive.

public native void Locomotive.SetCompressorEfficiency ( float efficiency )

Sets the efficiency of this locomotive's compressor.

Parameters:
efficiency Efficiency of compressor in the range of [0.0 - 1.0] where 0.0 is complete failure and 1.0 is normal.

public native void Locomotive.SetEngineSetting | ( | string | p_settingName,
 |  | float | p_value
 | ) |

Sets the value of the named engine setting.

Engine setting strings you can use with this method are:

  • "dynamic-brake"
  • "headlight"
  • "injector"
  • "loco-auto-brake"
  • "pantograph"
  • "regulator"
  • "reverser"
  • "steam-blower"
  • "throttle"
  • "train-auto-brake"
  • "train-lap-brake"
These strings correspond to engine properties as described elsewhere in documents such as the Content Creation Guide (CCG). Some apply to steam locomotives only.
Parameters:
p_settingName | Name of the setting to change.
p_value | Value to change the setting to.

public native void Locomotive.SetHasDriver ( bool hasDriver )

Sets this locomotive as having a driver.

Note:
Only one loco in a train may have a driver. If you attempt to place a driver in this loco, any other driver on the train will be removed. The consist name/id will always stay with the driver.
Parameters:
hasDriver Driver state for this locomotive. If true, it has a driver, otherwise false for no driver.
See also:
Train.GetActiveDriver(), DriverCharacter.SetLocation()

The documentation for this class was generated from the following file:
  • locomotive.gs


Log Class Reference

List of all members.

Detailed Description

Log provides Trainz scripts with logging capabilities and a scope/stack view.

This class facilitates the logging of information about functions to the \Trainz\JetLog.txt file. It is mainly a utility class that makes logging easier with basic scope/stack support.

Public interface methods provided with this class are:

  • public void DetailLogEnable ()
  • public void DetailLogDisable ()
  • public bool DetailLogIsEnabled ()
  • public void DetailLogStart (string sFunction, string sClass);
  • public void DetailLog (string msg)
  • public void DetailLogEnd ()
  • public void DetailWatchFunctionStart (string sFunction, string sClass);
  • public void DetailWatchFunctionEnd (string sFunction, string sClass);
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\log.gs script file.
See also:
Interface.Log(), LogScope

The documentation for this class was generated from the following file:
  • log.gs


LogScope Class Reference

List of all members.

Public Attributes

public string | className
Name of the class being logged.

public string | functionName
Name of the method/function being logged.

public int | level
Level of logging.

Detailed Description

An item being logged.

This class defines an item to be logged for the Log class.

See also:
Interface.Log(), Log

The documentation for this class was generated from the following file:
  • log.gs


MapObject Class Reference

Inheritance diagram for MapObject:

MeshObject SceneryWithTrack Trackside Buildable Crossing Turntable Junction Signal TrackMark Trigger Vehicle List of all members.

Public Methods

public native ProductQueue | GetQueue (string queueName)
public native ProductQueue[] | GetQueues (void)
public native string | GetLocalisedName (void)
public native void | PlaySoundScriptEvent (string soundName)
public native void | StopSoundScriptEvent (string soundName)

Detailed Description

A map object with product queues.

This class extends MeshObject to include product queues. A MapObject can have a number of product queues and they are defined in the queues section of the config.txt file for the asset.

Major | Minor | Destination
"MapObject" | "View-Details" | Object that the details have been requested of.

The ("MapObject", "View-Details") message is sent to a MapObject instance when the user right-clicks on the object and selects View Details from the pop-up menu. What happens when this message is received is left to the script programmer. It is recommended that something about the object's current state is displayed in a Browser window. The GenericIndustry class provides a demonstration of this.

See also:
Asset, Buildable, GameObject, GenericIndustry, Industry, MeshObject, ProductQueue, Trackside

Member Function Documentation

public native string MapObject.GetLocalisedName ( void )

Gets the localized name of this map object.

Note:
The localized name may be different from the unique name provided by GameObject.GetName().
Returns :
Returns the localized name of this map object.

public native ProductQueue MapObject.GetQueue ( string queueName )

Gets a product queue by name.

Parameters:
queueName Name of the product queue to get.
Returns :
Returns the product queue named queueName if possible, null otherwise.

public native ProductQueue [] MapObject.GetQueues ( void )

Gets a list of the product queues this map object has.

Returns :
Returns an array of ProductQueue objects. If there are no queues, an empty array will be returned.

public native void MapObject.PlaySoundScriptEvent ( string soundName )

Plays the specified sound event from the asset's SoundScript.

SoundScripts are defined as sub-containers in the soundscript container of the asset's configuration. For details on creating assets with SoundScripts, see the TRS2006 Content Creators Guide.

This method will start playing the sound. Depending on the SoundScript configuration, the sound will either be played just once or played continuously in a looping cycle such that StopSoundScriptEvent() will need to be called to stop it.

Parameters:
soundName Name of the sound event to start playing. The name is defined in the trigger tag of the SoundScript sub-container.

public native void MapObject.StopSoundScriptEvent ( string soundName )

Stops the specified sound event from the asset's SoundScript.

Parameters:
soundName Name of the sound event to stop playing. See PlaySoundScriptEvent() for details on sound event name details.

The documentation for this class was generated from the following file:
  • MapObject.gs


Math Class Reference

List of all members.

Public Methods

public native float | Rand (float p_lower, float p_upper)
public native int | Rand (int p_lower, int p_upper)
public native float | Sqrt (float p_v)
public int | Abs (int p_v)
public float | Fabs (float p_v)
public float | Fmax (float a0, float a1)
public float | Fmin (float a0, float a1)

Detailed Description

Static class with various mathematical utility methods.

See also:
Str

Member Function Documentation

public int Math.Abs ( int p_v ) [inline]

Gets the absolute value of the given integer.

Parameters:
p_v Integer to get the absolute value of.
Returns :
Returns the absolute value of p_v.

public float Math.Fabs ( float p_v ) [inline]

Gets the absolute value of the given floating point.

Parameters:
p_v Number to get the absolute value of.
Returns :
Returns the absolute value of p_v.

public float Math.Fmax | ( | float | a0,
 |  | float | a1
 | ) | [inline]

Gets the greater of the two given floating point values.

Parameters:
a0 | First value.
a1 | Second value.
Returns :
Returns the greater of a0 and a1.

public float Math.Fmin | ( | float | a0,
 |  | float | a1
 | ) | [inline]

Gets the greater of the two given integer values.

Parameters:
a0 | First value.
a1 | Second value.
Returns :
Returns the greater of a0 and a1.

public native int Math.Rand | ( | int | p_lower,
 |  | int | p_upper
 | ) |

Returns a random number between the two given values.

Parameters:
p_lower | Lower limit for random value.
p_upper | Upper limit for random value.
Returns :
Returns a random integer value between the ranges of p_lower and p_upper.

public native float Math.Rand | ( | float | p_lower,
 |  | float | p_upper
 | ) |

Returns a random number between the two given values.

Parameters:
p_lower | Lower limit for random value.
p_upper | Upper limit for random value.
Returns :
Returns a random floating point value between the ranges of p_lower and p_upper.

public native float Math.Sqrt ( float p_v )

Gets the square root of the given floating point value.

Parameters:
p_v Value to get the square root of.
Returns :
Returns the square root of p_v.

The documentation for this class was generated from the following file:
  • gs.gs


Menu Class Reference

Inheritance diagram for Menu:

GSObject List of all members.

Public Methods

public native void | AddItem (string name, GameObject dstObject, string major, string minor)
public native void | AddSubmenu (string name, Menu submenu)
public native int | CountItems (void)
public native void | SubdivideItems (bool forceSorting)
public void | SubdivideItems (void)
Legacy support method, use SubdivideItems(bool) instead.

Detailed Description

A menu.

A menu is a list of items that can selected by the user with the mouse cursor. Menus can be constructed in hierarchies so a menu item could open up a sub-menu of its own. Sub-menus can also have sub-menus of their own as well. Menu items can have messages sent when clicked on.

This class is mostly used for constructing sub-menus of driver command actions. See DriverCommand.AddCommandMenuItem() for details.

See also:
Constructors.NewMenu(), DriverCommand.AddCommandMenuItem(), Industry.AppendDriverDestinations()

Member Function Documentation

public native void Menu.AddItem | ( | string | name,
 |  | GameObject | dstObject,
 |  | string | major,
 |  | string | minor
 | ) |

Adds a menu item to the end of this menu.

The dstObject parameter must be specified and will be sent a message of type (major, minor) in the event that this item is chosen.

Parameters:
name | Name for the object on the menu.
dstObject | Object to add to the end of this menu. This parameter MUST be specified.
major | Major type of the message to send to dstObject if selected on this menu.
minor | Minor type of the message.

public native void Menu.AddSubmenu | ( | string | name,
 |  | Menu | submenu
 | ) |

Adds a submenu item to the end of this menu.

Parameters:
name | Name of the new submenu.
submenu | The sub-menu to add. If null or an empty menu, nothing will be added to this menu.

public native int Menu.CountItems ( void )

Gets the amount of items in this menu (including submenus).

Returns :
Return the total number of items in this menu (including submenus).

public native void Menu.SubdivideItems ( bool forceSorting )

Subdivides the menu items into several separate sub-menus.

This method splits items on the menu into groups based on alphabetical order and places them into submenus. Subdividing the menu allows larger menus that normally wouldn't fit on the screen to be accommodated.

If the menu fits on the screen as it currently is, then this method won't subdivide the menu as there is no need to. Whether a menu fits on the screen is dependent on the current resolution as well as the amount of menu items.

Parameters:
forceSorting If true, this method will sort the items even if subdivision is not performed.

The documentation for this class was generated from the following file:
  • Menu.gs


MeshObject Class Reference

Inheritance diagram for MeshObject:

PropertyObject TrainzGameObject Bogey Cabin MapObject DefaultLocomotiveCabin DefaultSteamCabin SceneryWithTrack Trackside Buildable Crossing Turntable Junction Signal TrackMark Trigger Vehicle List of all members.

Public Methods

public void | Init (void)
public void | Init (Asset asset)
public native bool | HasMesh (string p_meshName)
public native void | SetMeshAnimationState (string p_meshName, bool p_state)
public native void | SetMeshAnimationFrame (string p_meshName, float p_frame)
public native void | SetMeshAnimationFrame (string p_meshName, float p_frame, float interpTime)
public native float | GetMeshAnimationFrame (string p_meshName)
public native float | GetMeshAnimationFrameCount (string p_meshName)
public native void | StartMeshAnimationLoop (string p_meshName)
public native void | StopMeshAnimation (string p_meshName)
public native void | SetMeshAnimationSpeed (string p_meshName, float p_speed)
public native MeshObject | SetFXAttachment (string effectName, Asset asset)
public native MeshObject | GetFXAttachment (string effectName)
public native void | SetFXAnimationState (string effectName, bool state)
public native void | SetFXTextureReplacement (string effectName, Asset textureGroupAsset, int textureIndex)
public native void | SetFXCoronaTexture (string effectName, Asset textureAsset)
public native void | SetFXNameText (string effectName, string text)
public native void | SetMeshVisible (string meshName, bool visible, float fadeDuration)
public native void | SetMesh (string meshName, float fadeDuration)
public void | Init (Asset asset)

Detailed Description

A mesh object with animation and particle support.

This class is a base class for Asset-based game objects that have meshes, animation and particles. Interface methods to deal with meshes, animation and particles are provided so things like showing/hiding a mesh, attaching a mesh to an attachment point or starting/stopping an animation can be done from a script.

For animation, Trainz uses key frames with interpolation. This means an intermediate animation frame is calculated dynamically to be-in-synch with the game's framerate. Further information about meshes, animations and particles can be found in the TRS2006 Content Creators guide.

Note:
GS is only an interpreted scripting language intended to be used as a way to monitor and react to events in the Trainz world, not perform sophisticated real-time animation tasks. Using a script to start an animation in response to an event in a thread is reasonable is not usage. However trying to control animation tightly down to intervals in the millisecond and will most likely provide unsatisfactory results.
MeshObject Messages

Major | Minor | Source | Destination
"Animation-Event" | event name | mesh object | mesh object
"pfx" | +/-particle number | anywhere | object to set particles of

When a message with a major type of "Animation-Event" is received, the name of the animation event that has occurred is used as the minor type. The event name is defined in the .kin animation event file and is not to be confused with the name of the mesh or animation.

The "pfx" message is used to activate/deactivate the particles. Which particles to activate or deactivate is specified in the minor string of the message. By sending a message like this to an object, the script programmer can control the particle effects however they want. This minor string is a list of numbers specifying the particle effects to activate or deactivate. For each particle number in the string, a prefix of either '+' or '-' is needed where the plus symbol activates the particle while minus deactivates it. For example:

     SendMessage(me, "pfx", "+0+1+2");      // Activates particle effects 0, 1 and 2.
     SendMessage(me, "pfx", "-0+2-4-5+6");  // Deactivates particle effects 0, 4 & 5 and activates particle effects 2 & 6.
     SendMessage(me, "pfx", "-0-1-2");      // Deactivates particle effects 0, 1 and 2.

Note:
In addition to GameObject.SendMessage(), both the GameObject.PostMessage() and Router.PostMessage() methods can be used to send "pfx" messages to an object to activate or deactivate particle effects.
See also:
Asset, GameObject, PropertyObject, TrainzGameObject, Bogey, Cabin, MapObject, SceneryWithTrack, Trackside

Member Function Documentation

public native MeshObject MeshObject.GetFXAttachment ( string effectName )

Gets the mesh attached to the named effect.

Parameters:
effectName Name of the effect to get the attached object of.
Returns :
Returns the object attached to effectName if it exists, null otherwise.

public native float MeshObject.GetMeshAnimationFrame ( string p_meshName )

Gets the current animation frame of the named mesh.

Parameters:
p_meshName Name of the mesh to get the animation frame of.
Returns :
Returns the current frame position of the specified mesh.

public native float MeshObject.GetMeshAnimationFrameCount ( string p_meshName )

Gets the number of animation frames in the named mesh.

Parameters:
p_meshName Name of the mesh to get the number of animation frames in.
Returns :
Returns the number of frames in p_meshName.

public native bool MeshObject.HasMesh ( string p_meshName )

Determines if the named mesh exists in this object.

Parameters:
p_meshName Name of the mesh to look for in this object.
Returns :
Returns true if p_meshName exists, false otherwise.

public void MeshObject.Init ( Asset asset ) [inline]

Initialization method. Called by Trainz when the object is first created.

It is up to the script programmer to do any initialization tasks required here as well as ensuring a thread is started if the object is to exist in a persistent state that can monitor and respond to message for example.

Note:
You will see that some derived classes have both an Init() and Init(Asset) method. There isn't much difference between them except one gets the Asset as a parameter. It is recommended that you use the Init(Asset) version whenever you can.
Note:
When overriding this base Init() method, you must call it explicitly by using the inherited keyword in the overridden implementation.
Note:
As Init() is called from native Trainz code, you cannot CANNOT Sleep() or wait() in an Init() method. However, Init() can start threaded methods that are allowed to sleep and process messages.
Parameters:
asset Trainz asset this object is based on.
See also:
MeshObject.Init()

Reimplemented from TrainzGameObject.

public void MeshObject.Init ( Asset asset )

Initialization method. Called by Trainz when the object is first created.

It is up to the script programmer to do any initialization tasks required here as well as ensuring a thread is started if the object is to exist in a persistent state that can monitor and respond to message for example.

Note:
You will see that some derived classes have both an Init() and Init(Asset) method. There isn't much difference between them except one gets the Asset as a parameter. It is recommended that you use the Init(Asset) version whenever you can.
Note:
When overriding this base Init() method, you must call it explicitly by using the inherited keyword in the overridden implementation.
Note:
As Init() is called from native Trainz code, you cannot CANNOT Sleep() or wait() in an Init() method. However, Init() can start threaded methods that are allowed to sleep and process messages.
Parameters:
asset Trainz asset this object is based on.
See also:
MeshObject.Init()

Reimplemented from TrainzGameObject.

public void MeshObject.Init ( void ) [inline]

Called by Trainz to initialize this object.

When creating an instance of a game object, Trainz looks for an Init() method. If it finds one, that method will be called.

It is best used to initialize data members and start threads to run the object. If overridden in a class of your own, always ensure that the overridden Init() in the parent class is explicitly called, otherwise you may run into problems. Use the inherited keyword to call an overridden parent method.

For example, Train.Init() does a lot of Train-specific initialization and if an overridden Init() method in a class derived from Train neglects to call Train.Init(), essential initialization won't happen and the train would not behave as expected. The same applies to GenericIndustry.Init() as well.

There is also an Init(Asset) method. It is preferred that you use the Init(Asset) method in preference to this one. This Init() method (i.e. no Asset parameter) is still supported for backward compatibility.

Note:
As Init() is called from native Trainz code, you cannot CANNOT Sleep() or wait() in an Init() method. However, Init() can start threaded methods that are allowed to sleep and process messages.
See also:
TrainzGameObject.Init(), ScenarioBehavior.Init(), SetProperties()

Reimplemented in BaseIndustry, Cabin, DefaultLocomotiveCabin, DefaultSteamCabin, GenericIndustry, and Vehicle.

public native void MeshObject.SetFXAnimationState | ( | string | effectName,
 |  | bool | state
 | ) |

Sets the animation state of the named effect.

Parameters:
effectName | Effect to set the animation state of.
state | State to set animation effect to. If true, the effect is started in its animation loop, false to stop it.

public native MeshObject MeshObject.SetFXAttachment | ( | string | effectName,
 |  | Asset | asset
 | ) |

Creates a new object of the given asset type and attaches it to the named

Any object already attached will be removed first.

Parameters:
effectName | Name of the particle effect to attach asset to.
asset | Asset to attach to effectName. If null, the existing asset attached to effectName will be removed and nothing new will be added.
Returns :
Returns asset as a MeshObject.

public native void MeshObject.SetFXCoronaTexture | ( | string | effectName,
 |  | Asset | textureAsset
 | ) |

Modify the texture of the named corona.

Parameters:
effectName | Name of the corona effect to set the texture for.
textureAsset | Specifies the texture asset. Use null to switch off the corona.

public native void MeshObject.SetFXNameText | ( | string | effectName,
 |  | string | text
 | ) |

Sets the effect name text for the specified corona.

Parameters:
effectName | Name of the corona effect to set the effect name of.
text | Name to set the effect text of effectName to.

public native void MeshObject.SetFXTextureReplacement | ( | string | effectName,
 |  | Asset | textureGroupAsset,
 |  | int | textureIndex
 | ) |

Sets the specified texture onto the named effect.

Parameters:
effectName | Name of the effect to set a texture for,
textureGroupAsset | Must be a texture-group asset. Use null to disable the effect.
textureIndex | Specifies which texture to use from the group.

public native void MeshObject.SetMesh | ( | string | meshName,
 |  | float | fadeDuration
 | ) |

Sets the specified mesh as visible and all other meshes as invisible.

Parameters:
meshName | Name of the mesh to set as visible.
fadeDuration | Specifies the duration in seconds over which the visibility will transition. An instantaneous transition will occur if fadeDuration is zero.

public native void MeshObject.SetMeshAnimationFrame | ( | string | p_meshName,
 |  | float | p_frame,
 |  | float | interpTime
 | ) |

Sets the named mesh to the specified animation frame.

Parameters:
p_meshName | Name of the mesh to set the animation frame of.
p_frame | Frame to set the mesh to.
interpTime | Duration (seconds) over which to move to the specified frame.

public native void MeshObject.SetMeshAnimationFrame | ( | string | p_meshName,
 |  | float | p_frame
 | ) |

Sets the named mesh to the specified animation frame.

Parameters:
p_meshName | Name of the mesh to set the animation frame of.
p_frame | Frame to set the mesh to.

public native void MeshObject.SetMeshAnimationSpeed | ( | string | p_meshName,
 |  | float | p_speed
 | ) |

Sets the animation speed of the named mesh in this object.

Parameters:
p_meshName | Name of mesh to set animation speed of.
p_speed | Factor to adjust animation speed by, compared to the original. For example, 1.0 for normal speed, 0.5 for half speed or 2.0 for double speed. Use a negative value to have the animation played backwards in reverse.

public native void MeshObject.SetMeshAnimationState | ( | string | p_meshName,
 |  | bool | p_state
 | ) |

Sets the animation state of the named mesh.

Parameters:
p_meshName | Name of the mesh to set the animation state of.
p_state | State to set the animation to. true plays through to the end frame of the animation. false plays through to the start frame of the animation.

public native void MeshObject.SetMeshVisible | ( | string | meshName,
 |  | bool | visible,
 |  | float | fadeDuration
 | ) |

Sets the visibility of the specified mesh.

Parameters:
meshName | Name of the mesh to set the visibility of.
visible | Visibility status. Use true for visible and false for invisible.
fadeDuration | Specifies the duration in seconds over which the visibility will transition. An instantaneous transition will occur if fadeDuration is zero (0.0).

public native void MeshObject.StartMeshAnimationLoop ( string p_meshName )

Plays the animation of the named mesh loop (i.e. replayed continuously).

Parameters:
p_meshName Name of the mesh to start animating.
Note:
An animation can be played backwards by using a negative animation speed set through the SetMeshAnimationSpeed() method.

public native void MeshObject.StopMeshAnimation ( string p_meshName )

Stops animating the named mesh.

Parameters:
p_meshName Name of mesh to stop the animation of.

The documentation for this class was generated from the following file:
  • MeshObject.gs


Message Class Reference

List of all members.

Public Attributes

public string | major
Major message type.

public string | minor
Minor message type.

public object | src
Source object.

public object | dst
Destination object.

Detailed Description

An object message.

WARNING: Do not alter this class - the ordering and size are hard coded!

See also:
GameObject, Router, GameObject.SendMessage(), GameObject.SendMessage(), Router.PostMessage()

The documentation for this class was generated from the following file:
  • gs.gs


ModuleScript Class Reference

Inheritance diagram for ModuleScript:

TrainzGameObject DriverCharacter List of all members.

Detailed Description

A module script.

This class IS NOT intended for general public use by script programmers. Using it in anyway IS NOT supported.

See also:
Asset, DriverCharacter, GameObject, TrainzGameObject

The documentation for this class was generated from the following file:
  • ModuleScript.gs


Navigate Class Reference

List of all members.

Public Methods

public bool | SetSignal (string signal, int state, string reason)
public bool | LockJunction (string junction, int direction, bool manualControl)
public bool | Station (GameObject runningThread, Train train, string stationName, string warningTrigger, string stationTrigger, string overrunTrigger, string backwardsTrigger, StationBehaviour behaviour, float waitMin, float waitMax)
public bool | Signal (GameObject runningThread, Train train, string signalName, string reason, string announce, float delay, string onAnnouncement, SignalBehaviour behaviour)
public bool | OnTrigger (GameObject runningThread, Train train, string triggerName, int stage)
public bool | OnJunction (GameObject runningThread, Train train, string junctionName, int stage)

Public Attributes

StationBehaviour | defaultStationBehaviour = new StationBehaviour()
Default StationBehaviour object for when user does not provide their on in Station().

SignalBehaviour | defaultSignalBehaviour = new SignalBehaviour()
Default SignalBehaviour object for when one is not provided by the user in Signal().

Train Trigger Events

Values that define what type of event a train has caused in relation to a trigger.

See also:
Navigate.OnTrigger()

public define int | TRIGGER_ENTER = 0
Train has entered the trigger.

public define int | TRIGGER_STOPPED = 1
Train has stopped in the trigger.

public define int | TRIGGER_LEAVE = 2
Train has left the trigger.

Train Junction Events

Values that define what type of event a train has caused in relation to a junction.

The train will enter the junction when it is 150 meters away from the junction and will inner-enter the junction when it reaches the actual junction.

See also:
Navigate.OnJunction()

public define int | JUNCTION_ENTER = 0
Train has entered the junction.

public define int | JUNCTION_INNERENTER = 1
Train has entered the inner region of the junction.

public define int | JUNCTION_STOPPED = 2
Train has stopped on the junction.

public define int | JUNCTION_INNERLEAVE = 3
Train has left the inner area of the junction.

public define int | JUNCTION_LEAVE = 4
Train has left the junction totally.

Detailed Description

The Navigate class has a few functions that make building scenarios a little easier.

See also:
Junction, Signal, SignalBehaviour, StationBehaviour,

Member Function Documentation

public bool Navigate.LockJunction | ( | string | junction,
 |  | int | direction,
 |  | bool | manualControl
 | ) | [inline]

Changes a named junction to the given direction with the option of locking it.

Parameters:
junction | Name of the junction to change.
direction | Direction to set the junction to. Use one of the junction state constants for this argument.
manualControl | Flag to enable (true) or disable (false) the user from changing the junction themselves manually.
Returns :
Returns true if successful, false otherwise (i.e. junction doesn't exist).
See also:
JunctionBase.AllowManualControl(), JunctionBase.SetDirection(), JunctionBase.GetDirection(), Junction States

public bool Navigate.OnJunction | ( | GameObject | runningThread,
 |  | Train | train,
 |  | string | junctionName,
 |  | int | stage
 | ) | [inline]

Waits until a train has reached the desired junction.

Parameters:
runningThread | Thread that this method was called from.
train | Train that has to reach this junction.
junctionName | Name of the junction.
stage | Junction action the train has to satisfy for this method to return. Use one of the train junction event constants.
Returns :
Returns true when the train has satisfied the stage criteria, otherwise false in the case of an error.
See also:
Train Junction Events

public bool Navigate.OnTrigger | ( | GameObject | runningThread,
 |  | Train | train,
 |  | string | triggerName,
 |  | int | stage
 | ) | [inline]

Waits until a train has reached the desired trigger.

Parameters:
runningThread | Thread that this method was called from.
train | The train that has to reach the trigger.
triggerName | Name of the trigger that train is to reach.
stage | Trigger action the train has to satisfy for this method to return. Use one of the train trigger event constants for this argument.
Returns :
Returns true when the train satisfies the trigger event specified by stage, false in the case of error.

public bool Navigate.SetSignal | ( | string | signal,
 |  | int | state,
 |  | string | reason
 | ) | [inline]

Sets the state of the named signal.

Parameters:
signal | Name of the signal to set the state of.
state | Desired state of the signal.
reason | Reason for signal state (mouse-over appearance for curious user).
Returns :
Returns true if successful, false otherwise.

public bool Navigate.Signal | ( | GameObject | runningThread,
 |  | Train | train,
 |  | string | signalName,
 |  | string | reason,
 |  | string | announce,
 |  | float | delay,
 |  | string | onAnnouncement,
 |  | SignalBehaviour | behaviour
 | ) | [inline]

Navigates a train through a signal. The signal will be set to red.

Parameters:
runningThread | Thread that this method was called from.
train | Train that has to stop at the signal.
signalName | Name of the signal to be navigated.
reason | Signal reason text (mouse-over for user).
announce | If not null, will be announced to the timetable after delay seconds.
delay | Delay in seconds to wait for before posting messages.
onAnnouncement | Timetable announcement that will be waited on before setting the signal back to automatic.
behaviour | Signal behavior definition. If null, a default will be used.
Returns :
Returns true the signal is successfully navigated, false otherwise.

public bool Navigate.Station | ( | GameObject | runningThread,
 |  | Train | train,
 |  | string | stationName,
 |  | string | warningTrigger,
 |  | string | stationTrigger,
 |  | string | overrunTrigger,
 |  | string | backwardsTrigger,
 |  | StationBehaviour | behaviour,
 |  | float | waitMin,
 |  | float | waitMax
 | ) | [inline]

Navigates a train through a station stop.

Parameters:
runningThread | Thread that this method was called from.
train | Train that has to stop at the station.
stationName | Name of the station to stop at (for display purposes only).
warningTrigger | Name of the trigger you for the station reminder objective (may be null).
stationTrigger | Name of the trigger at the station. The train is to stop in this trigger.
overrunTrigger | Name of the trigger, that upon reaching a station overrun object will be set (may be null).
backwardsTrigger | Name of trigger behind the train, that upon reaching, a 'wrong way' message will be set (may be null).
behaviour | A StationBehaviour class that defines various properties of the station. If null, defaults will be applied.
waitMin | Minimum time to wait after stopping at the station before clearance to proceed is granted.
waitMax | Maximum time to wait after stopping at the station before clearance to proceed is granted.
Returns :
Returns true when the station stop cycle is complete. If stationTrigger, train or runningThread are null, false will be returned as this method can't work if these parameters are not set.

The documentation for this class was generated from the following file:
  • navigate.gs


NumberValueInt Class Reference

List of all members.

Detailed Description

Container class for an integer property.

This class was written to be used with the GenericIntNumberHandler class to store an integer value along with the accompanying properties of a minimum and maximum value plus increments level. Because GenericIntNumberHandler was never fully implemented, this class does not really get used right now.

See also:
GenericIntNumberHandler

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


OnlineAccess Class Reference

Inheritance diagram for OnlineAccess:

GameObject List of all members.

Public Methods

public native void | Connect (void)
public native int | GetStatus (void)
public native void | Disconnect (void)
Cancel an in-progress connection attempt started by Connect(), or disconnect the current session.

public native string | GetUsername (void)
public native int | SetLocalData (string key, Soup data)
public native int | GetLocalData (string key, Soup data)
public native int | PostMessage (string destUsername, Soup data)
public native int | CollectMessage (string o_sourceUsername, Soup o_data)
public native OnlineGroup | CreateGroup (void)
public native OnlineGroup | OpenGroup (string onlineGroupCookie)
public native int | PostOfflineMessage (Soup data)
public native int | CollectOfflineMessage (Soup o_data)

Public Attributes

Connection Status Modes

Connection Status Modes

These constants define the different states an OnlineAccess object can be in as reported by OnlineAccess.GetStatus().

See also:
OnlineAccess.GetStatus()

public define int | MODE_DISABLED = 0
User has not enabled online play.

public define int | MODE_OFFLINE = 1
Connection attempt has not been made.

public define int | MODE_FAILED = 2
Most recent connection attempt failed.

public define int | MODE_AUTH_FAILED = 3
Authorization failure - user details are not valid.

public define int | MODE_DENIED_LOCAL = 4
User did not permit this script to gain online access.

public define int | MODE_INTERRUPTED = 5
Existing connection has been disrupted.

public define int | MODE_CONNECTING = 6
Connection attempt in progress.

public define int | MODE_ONLINE = 7
Connected successfully.

Operation Result States

Operation Result States

These constants are used to indicate the result of message/data transfer as returned by the various methods in the OnlineAccess class.

See also:
OnlineAccess.GetLocalData(), OnlineAccess.SetLocalData(), OnlineAccess.CollectMessage(), OnlineAccess.PostMessage(), OnlineAccess.PostOfflineMessage(), OnlineAccess.CollectOfflineMessage()

public define int | RESULT_OK = 0
Operation successful.

public define int | RESULT_CONNECTION_FAILED = 1
Attempt failed due to connection error.

public define int | RESULT_DENIED_LOCAL = 2
Permission was denied by the user.

public define int | RESULT_DENIED_REMOTE = 3
Permission was denied by Planet Auran.

public define int | RESULT_FLOOD = 4
Permission denied due to excess send rate.

public define int | RESULT_OVERFLOW = 5
The request was too large (or the destination "mailbox" is full).

public define int | RESULT_NO_DATA = 6
No result data was available for this request.

Detailed Description

An interface class that allows online connectivity with other Trainz users via Planet Auran.

Objects of this class provide an instance of network access, with associated rights. You must ensure to protect your scripts such that other scripts cannot trivially gain access to your OnlineAccess instance, including indirect access via calling your methods. Only one OnlineAccess instance is provided for any given requesting Asset. Multiple requests from scripts of the same Asset will return the same OnlineAccess instance. When an OnlineAccess instance is completely released, it will automatically disconnect.

Notes:

  • Only one client login per Planet Auran profile will be accepted. An attempt from a second client to log in with the same profile will result in the first client being disconnected. However, multiple OnlineAccess objects can be connected on the same client simultaneously. Bandwidth limits, etc. are applied on a per-client basis.
  • Trainz may request permission from the local user for some operations. The exact messages presented to the user is implementation-specific. DO NOT attempt to rely on the timing or presentation of these messages. Handle the status codes appropriately in all cases.
  • Key names within the data soups should be kept short. Namespacing is provided by the use of the Asset keying of messages, so it is generally not necessary to use large key names. Smaller key names allow for more data to be sent in the limited bandwidth available.
  • It is only from within a Library script that you can create an OnlineAccess object. Any other non-library script will have to call through to your library to access information exchanged via the online features of this class. How your library handles external requests is dependent on what implementation of Library.LibraryCall() you provide.
  • The Online Chat rule makes use of OnlineAccess functionality. The script code that manages the online access for iTrainz Chat can be found in the \Trainz\scripts\OAChat.gs script file.
Messages used by this class are:

Major | Minor | Source | Destination | Description
"OnlineAccess" | "ReceiveMessage" | -- | OnlineAccess | This message is sent to the OnlineAccess instance in response to a client calling PostMessage() to send data to the local client. Messages sent while a client is offline are delivered when a matching OnlineAccess instance is constructed. After receiving this notification, the script must respond by calling CollectMessage() When multiple messages become available simultaneously, only one notification may be sent.
"OnlineAccess" | "StatusChange" | -- | OnlineAccess | This message is sent to the OnlineAccess instance when its network status has changed. The GetStatus() method should be used to determine the new status.

See also: Library.GetOnlineAccess(), OnlineGroup

Member Function Documentation

public native int OnlineAccess.CollectMessage | ( | string | o_sourceUsername,
 |  | Soup | o_data
 | ) |

Collects a received network message.

This method retrieves a queued message and returns it in o_data and o_sourceUsername. It should only be called in response to the script receiving a ("OnlineAccess", "ReceiveMessage") message. If a queued message is not collected prior to releasing the OnlineAccess object, it is discarded.

Parameters:
o_sourceUsername | Username to collect message from.
o_data | Message data will be placed in this database.
Returns :
Returns one of the operation result values indicating the result of this function call.

public native int OnlineAccess.CollectOfflineMessage ( Soup o_data )

Retrieves an offline data message.

Offline data support method. Use of this method is not currently recommended.

Parameters:
o_data Retrieved offline data placed in this parameter.
Returns :
Returns one of the operation result values indicating the result of this function call.

public native void OnlineAccess.Connect ( void )

Starts a background attempt to connect to Planet Auran.

This method begins a background connection attempt. GetStatus() can be queried to determine the ongoing status of the connection attempt. Calls made to Connect() while a connection attempt is in progress, or an existing connection is active, will have no effect.

Note:
For this method to work, internet connectivity is required and the Trainz installation must be correctly configured for the user's Planet Auran account.

public native OnlineGroup OnlineAccess.CreateGroup ( void )

Creates a new group on the Planet Auran servers.

Returns :
Returns an OnlineGroup instance, which refers to a new group on the Planet Auran servers, otherwise null if one cannot be created.
See also:
OnlineGroup.GetStatus()

public native int OnlineAccess.GetLocalData | ( | string | key,
 |  | Soup | data
 | ) |

Gets the local data from this user's local profile storage.

Read data from the user's local profile storage. This does not require an active network connection.

Parameters:
key | Key to identify which data is to be read.
data | Soup database to place local data into.
Returns :
Returns one of the Operation Result values indicating the result of this function call.

public native int OnlineAccess.GetStatus ( void )

Gets the current connection status.

This method allows the connection status of an OnlineAccess object to be queried so the script can determine if Connect() for example is making any progress in connecting to Planet Auran.

Note:
When the connection status changes, a message of type ("OnlineAccess", "StatusChange") is sent to this object.
Note:
The connection status can be changed by the game code at any time, so don't rely on this method as a one-off call to determine the connection status as it will inevitably change (i.e. keep calling this method to get updates when a ("OnlineAccess", "StatusChange") message is received.
Returns :
Returns the current connection status as one of the connection status values.

public native string OnlineAccess.GetUsername ( void )

Gets the Planet Auran username for the current user.

At the moment, only one Planet Auran profile can be registered for a given version of Trainz.

Returns :
Returns the Planet Auran Username for the current user. If no Planet Auran username is available, an empty string ("") is returned.

public native OnlineGroup OnlineAccess.OpenGroup ( string onlineGroupCookie )

Opens up an online group.

Parameters:
onlineGroupCookie If the specified cookie is not valid, the group will enter STATUS_CLOSED.
Returns :
Returns an OnlineGroup instance which refers to an existing group on the Planet Auran servers. Otherwise null if a group matching onlineGroupCookie could not be found.
See also:
OnlineGroup.GetOnlineGroupCookie()

public native int OnlineAccess.PostMessage | ( | string | destUsername,
 |  | Soup | data
 | ) |

Posts a message to the specified user.

Posts data to the specified user. Will not overwrite any existing data.

This method allows data to be sent to both offline and online users. When the recipient user is online and has a matching OnlineAccess instance, a message of type ("OnlineAccess", "ReceiveMessage") will be generated to notify their OnlineAccess object of the received message. From there, CollectMessage() can be called to get the data received.

The sender of the message (i.e. the caller of this function) is not notified of successfully delivery; the result status returned by this method only reflects the success of the 'send' operation.

This method will fail if data is too large or if it is called too frequently. It will also fail if the destination user's Planet Auran storage is too full to accept remote data.

Note:
A network message sent by this method is not to be confused with the Trainz GS object messages, even though a object message is used indicate the arrival of a new network message.
Parameters:
destUsername | Username to send message to.
data | Message data.
Returns :
Returns one of the Operation Result values indicating the result of this function call.

public native int OnlineAccess.PostOfflineMessage ( Soup data )

Posts an offline data message.

Offline data support method. Use of this method is not currently recommended.

Parameters:
data Data for the offline message.
Returns :
Returns one of the operation result values indicating the result of this function call.

public native int OnlineAccess.SetLocalData | ( | string | key,
 |  | Soup | data
 | ) |

Writes data to the user's local profile storage.

Write data to the user's local profile storage. This method does not require an active network connection. Overwrites any existing data with a matching access and key.

Parameters:
key | Key to identify the written data with.
data | Data to place in local profile.
Returns :
Returns one of the Operation Result values indicating the result of this function call.

The documentation for this class was generated from the following file:
  • OnlineAccess.gs


OnlineGroup Class Reference

Inheritance diagram for OnlineGroup:

GameObject List of all members.

Public Methods

public native void | Connect (void)
public native void | Disconnect (void)
Cancels an in-progress connection attempt started by Connect(), or disconnect a current session.

public native int | GetStatus (void)
public native string | GetOnlineGroupCookie (void)
public native void | AddUser (string profilename)
public native void | RemoveUser (string profilename)
public native int | CountUsers (void)
public native string | GetIndexedUser (int index)
public native int | FindUser (string profilename)
public bool | HasUser (string profilename)
public native int | GetUserStatus (int index)
public int | GetUserStatus (string profilename)

Public Attributes

Group Status Modes

Group User Status Modes

These constant values define the status of a particular user in this group as reported by OnlineGroup.GetUserStatus(string) or OnlineGroup.GetUserStatus(int).

See also:
OnlineGroup.GetUserStatus(string), OnlineGroup.GetUserStatus(int)

public define int | USER_STATUS_UNKNOWN = 0
Specified user is not a member of this group, or local user is offline.

public define int | USER_STATUS_OFFLINE = 1
User is offline.

public define int | USER_STATUS_ONLINE = 2
User is online but does not have this group open.

public define int | USER_STATUS_INSIDE = 3
User is online and has this group open.

public define int | USER_STATUS_INVALID = 4
Requested user does not exist.

Group Connection Status

Group Connection Status

Connection status of the group as reported by OnlineGroup.GetStatus().

See also:
OnlineGroup.GetStatus()

public define int | STATUS_OFFLINE = 0
Local user is not currently online.

public define int | STATUS_CONNECTING = 1
Attempting a connection to this group on the Planet Auran server.

public define int | STATUS_OPEN = 2
Connected to this group on the Planet Auran server.

public define int | STATUS_CLOSED = 3
Planet Auran server has marked this group as closed.

Detailed Description

An online grouping of Planet Auran users.

This class provides management features for a group of Planet Auran users. A group like this is created by calling OnlineAccess.CreateGroup() or you can join an existing one by calling OnlineAccess.OpenGroup().

Messages used by this class are:
Major | Minor | Source | Destination | Description
"OnlineGroup" | "UsersChange" | -- | online group | This message is sent to the OnlineGroup instance in response to a user being added or removed from the group, or having their status change (local changes may not cause notification.)
"OnlineGroup" | "StatusChange" | -- | online group | This message is sent to the OnlineGroup when a network status change has occurred.

These messages are indicators of something happening in the group. You will need to have your own thread to wait for these messages and use the interface methods of this class to find out what is happening in the group.

Note:
Most of the user management methods in this class require the group to be STATUS_OPEN, otherwise they may have no effect.
Note:
The Online Chat rule makes use of OnlineAccess and OnlineGroup functionality. The script code that manages the grouping for iTrainz Chat can be found in the \Trainz\scripts\OAChat.gs script file.
See also:
OnlineAccess, OnlineAccess.CreateGroup(), OnlineAccess.OpenGroup()

Member Function Documentation

public native void OnlineGroup.AddUser ( string profilename )

Adds the named user to this online group.

Request that the specified user be added to this OnlineGroup. There may be a delay between issuing the request and the user being added.

Parameters:
profilename Planet Auran username of used to add to this group.

public native void OnlineGroup.Connect ( void )

Attempt to connect to this group on the Planet Auran server.

Attempt to connect to this group on the Planet Auran server. If this OnlineGroup instance is in STATUS_CLOSED, this call will initiate an asynchronous connection attempt to the group.

If the connection attempt is successful, this OnlineGroup instance will be moved to STATUS_OPEN.

If the Planet Auran server cannot be contacted, this OnlineGroup instance will be moved to STATUS_OFFLINE. If the group is not available or has been closed, this OnlineGroup instance will be moved to STATUS_CLOSED.

If this OnlineGroup instance is already in STATUS_OPEN or STATUS_CONNECTING, this call has no effect.

Note:
When a change of status has occurred, this group object will receive a message of type ("OnlineGroup", "StatusChange"). You can then query the current status by calling GetStatus().

public native int OnlineGroup.CountUsers ( void )

Gets the amount of users currently in this group.

Returns :
Returns the number of users currently in this group.

public native int OnlineGroup.FindUser ( string profilename )

Finds the index of the named user.

Note:
The mapping between a user's index and profile name may change as users are added and removed from the group.
Parameters:
profilename Planet Auran profile name of user to find the index of in this group.
Returns :
Returns the index for the named user, or -1 if the user is not a member of this group.

public native string OnlineGroup.GetIndexedUser ( int index )

Gets the profile name of a group member by index.

Parameters:
index Index of user to get the name of. Must be in the range of [0 <= index < CountUsers()].
Returns :
Returns the profile name of the indexed user if possible, an empty string otherwise.

public native string OnlineGroup.GetOnlineGroupCookie ( void )

Gets the cookie string for this online group.

The cookie string is appropriate for passing to OnlineAccess.OpenGroup().

Note:
Cookies used in online access groups are not edible.
Returns :
Returns a cookie for this group. If this OnlineGroup instance is STATUS_CLOSED, an empty string is returned.

public native int OnlineGroup.GetStatus ( void )

Gets the current status of this OnlineGroup instance.

Note:
A message of type ("OnlineGroup", "StatusChange") is sent to this OnlineGroup object when the status of the group changes.
Returns :
Returns the one of the group connection status values indicating the current status of this OnlineGroup instance.

public int OnlineGroup.GetUserStatus ( string profilename ) [inline]

Gets the current status of the named user.

Parameters:
profilename Planet Auran profile name of user to get status of.
Returns :
Returns one of the user status modes indicating the status of the user specified by profilename if they exist in this group, USER_STATUS_UNKNOWN otherwise.

public native int OnlineGroup.GetUserStatus ( int index )

Gets the current status of the specified user in this group.

Parameters:
index User index value (obtained via FindUser()).
Returns :
Returns one of the user status modes indicating the status of the user specified by index if they exist in this group, USER_STATUS_UNKNOWN otherwise.

public bool OnlineGroup.HasUser ( string profilename ) [inline]

Determines if the named user is currently a member of this group.

Parameters:
profilename Planet Auran profile name of user to look for in this group.
Returns :
Returns true if the specified user is currently in this group, false otherwise.

public native void OnlineGroup.RemoveUser ( string profilename )

Removes the named user from this online group.

Request that the specified user be removed from this OnlineGroup. There may be a delay between issuing the request and the user being removed.

Parameters:
profilename Planet Auran profile name of user to remove.

The documentation for this class was generated from the following file:
  • OnlineGroup.gs


PassengerStationInfo Class Reference

Inheritance diagram for PassengerStationInfo:

HTMLPropertyHandler List of all members.

Public Methods

public void | SetProperties (Soup soup)
public Soup | GetProperties (void)
public string | GetDescriptionHTML (void)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public string | GetPropertyValue (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public string | GetDescriptionHTML (void)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public string | GetPropertyValue (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)

Detailed Description

Property handler for use by the GenericPassengerStation class.

This property handler defines the properties for a single platform in a passenger station. A GenericPassengerStation object contains one of these handlers for each platform it has.

Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be found in the \Trainz\scripts\PassengerStationInfo.gs script file.
See also:
GenericPassengerStation, GenericPassengerStation.InitPassengerStation()

Member Function Documentation

public string PassengerStationInfo.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from HTMLPropertyHandler.

public string PassengerStationInfo.GetDescriptionHTML ( void )

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from HTMLPropertyHandler.

public Soup PassengerStationInfo.GetProperties ( void ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from HTMLPropertyHandler.

public Soup PassengerStationInfo.GetProperties ( void )

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from HTMLPropertyHandler.

public string PassengerStationInfo.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string PassengerStationInfo.GetPropertyDescription ( string propertyID )

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string [] PassengerStationInfo.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from HTMLPropertyHandler.

public string [] PassengerStationInfo.GetPropertyElementList ( string propertyID )

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from HTMLPropertyHandler.

public string PassengerStationInfo.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string PassengerStationInfo.GetPropertyName ( string propertyID )

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string PassengerStationInfo.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public string PassengerStationInfo.GetPropertyType ( string propertyID )

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public string PassengerStationInfo.GetPropertyValue ( string propertyID ) [inline]

Gets the value of the named property as a string.

This method is called by PropertyObject.GetPropertyValue() to get the value of the named property.

Parameters:
propertyID Property to get the value of.
Returns :
Returns the value of propertyID as a string (convert if necessary). The HTMLPropertyHandler implementation will always return an empty string.
See also:
PropertyObject.GetPropertyValue()

Reimplemented from HTMLPropertyHandler.

public string PassengerStationInfo.GetPropertyValue ( string propertyID )

Gets the value of the named property as a string.

This method is called by PropertyObject.GetPropertyValue() to get the value of the named property.

Parameters:
propertyID Property to get the value of.
Returns :
Returns the value of propertyID as a string (convert if necessary). The HTMLPropertyHandler implementation will always return an empty string.
See also:
PropertyObject.GetPropertyValue()

Reimplemented from HTMLPropertyHandler.

public void PassengerStationInfo.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from HTMLPropertyHandler.

public void PassengerStationInfo.SetProperties ( Soup soup )

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from HTMLPropertyHandler.

public void PassengerStationInfo.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

public void PassengerStationInfo.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) |

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • PassengerStationInfo.gs


Permit Class Reference

Inheritance diagram for Permit:

GSObject List of all members.

Public Methods

public native int | GetState (void)
public native void | Release (void)
public bool | IsGranted (void)
public bool | WasGranted (void)
public bool | IsReleased (void)
public native bool | IsForSameObjectAs (Permit other)
public native bool | HasSamePermissionsAs (Permit other)
public native object | GetObjectBase (void)
public GameObject | GetObject (void)
public string | GetDebugString (void)
public native void | SetOwnerObject (GameObject obj)

Public Attributes

Permit States

States that a permit can be in.

See also:
Permit.IsGranted(), Permit.IsReleased(), Permit.WasGranted()

public define int | STATE_REQUESTING = 0
Permit has yet to be granted.

public define int | STATE_GRANTED = 1
Permit has been granted.

public define int | STATE_RELEASED = 2
Permit has been released.

Detailed Description

Permit provides a way of requesting control of a game object resource such as a Track or Junction.

Permits are acquired by requesting them from various game objects. Some objects may only give out one permit at a time, others may give multiple permits with certain conditions. For example, a track could permit several trains travelling in the same direction.

Permits are used to stop scripts from 'fighting' over resources in situations such as:

  • Two trains want to go opposite directions down a single line; or
  • Two trains want to go through the same junction.
When a request is made, a permit is always returned, however it is not automatically granted. Instead, you have to wait for the permit to reach a 'granted' state. You can determine when a permit has been granted by:

  1. Performing a wait() on a message of type ("Permit", "Granted"). Just make sure you check that it is YOUR permit that was granted. You can do this by just calling WasGranted() on your permit after receiving the message. The message is sent to the GameObject passed in to the RequestPermit methods such as Junction.RequestPermit() or Track.RequestPermitForTrain().
  1. Regularly checking IsGranted() which will return true after the Permit is Granted. DO NOT use IsGranted() continuously to wait because it just wastes CPU time - but there may be other uses for this method, such as if we want to request a permit now for use in the future, and don't want to have to listen to the ("Permit", "Granted") message all the time.
Permits are released automatically. When no more references to a particular Permit remain, it is automatically released. So you generally don't need to call Release().

Permits can be in one of three states:

  1. REQUESTING
  2. GRANTED
  3. RELEASED
A permit is initially in the REQUESTING state. When the permit is granted, it moves to the GRANTED state. When Release() is called, or the permit is revoked, the permit moves to the RELEASED state (A permit can be forced directly to a RELEASED state from REQUESTING.) A permit can never be re-requested, you must obtain a new permit. Permits are only revoked in exceptional circumstances, but you don't normally need to deal with this.

See also:
GameObject, Junction.RequestTrackPermit(), Track.RequestPermitForTrain(), Trackside.RequestTrackPermit(), Train

Member Function Documentation

public string Permit.GetDebugString ( void ) [inline]

Gets a debug string containing the node ID of the object that this permit is for.

Returns :
If this permit currently corresponds to an existing GameObject, the ID of the object will be returned in a string that takes the form of "<gameobject:ID>". Otherwise, the string "<unknown>" will be returned.

public GameObject Permit.GetObject ( void ) [inline]

Gets the GameObject that this permit is after permission for.

Returns :
Returns the GameObject to which this permit corresponds to if successful, otherwise null if this permit doesn't correspond to a current GameObject.

public native object Permit.GetObjectBase ( void )

Gets the object that this permit is after permission for.

Returns :
Returns the object to which this permit corresponds to if successful, null otherwise. As this method's return type is object which doesn't refer to a particular class, it must be cast and verified before further usage.

public native int Permit.GetState ( void )

Gets the current state of this permit.

Returns :
Returns one of the permit states constants indicating the current state of this permit.

public native bool Permit.HasSamePermissionsAs ( Permit other )

Determines if the given permit has the same permissions and host object as this one does.

Parameters:
other Other permit to compare against this one.
Returns :
Returns true if this permit has the same permissions as other. Otherwise false is returned if this permit is not for the same object as other or any other reason.

public native bool Permit.IsForSameObjectAs ( Permit other )

Determines if the given permit and this permit are both after permission for the same GameObject.

This method allows the detection of cases where two permits are requested/held which would cause a deadlock situation.

Parameters:
other Other object to check for conflict with.
Returns :
Returns true if this permit and other are both for the same game object (i.e. a track block or a junction), false otherwise.

public bool Permit.IsGranted ( void ) [inline]

Determines if this permit is currently granted.

Returns :
Returns true if the permit is currently granted. Otherwise false if it hasn't been granted or has been released.

public bool Permit.IsReleased ( void ) [inline]

Determines if this permit has been released.

Returns :
Returns true if this permit has been released, false otherwise.

public native void Permit.Release ( void )

Releases this permit.

If this permit has not yet been granted, than the request it made will be cancelled.

public native void Permit.SetOwnerObject ( GameObject obj )

Sets the owner of this permit to the given game object.

Changes the owner object to the specified game object. If this permit is already granted, another ("Permit", "Granted").message is sent to the new owner of obj.

Parameters:
obj Object to assign this permit to.

public bool Permit.WasGranted ( void ) [inline]

Determines if this permit is granted or has been released.

Returns :
Returns true if the permit is currently granted or has been released (even if it was never granted but has a released state). Otherwise false if it has not been granted or released.

The documentation for this class was generated from the following file:
  • permit.gs


ProductFilter Class Reference

Inheritance diagram for ProductFilter:

GSObject List of all members.

Public Methods

public native void | Clear (void)
Clear out this filter so it is empty.

public native void | CopyFilter (ProductFilter filter)
public native void | AppendFilter (ProductFilter filter)
public native ProductFilter | IntersectFilter (ProductFilter filter)
public native void | AddProduct (Asset product)
public native void | RemoveProduct (Asset product)
public native void | AddProductCategory (Asset productCategory)
public native void | RemoveProductCategory (Asset productCategory)
public native bool | DoesAcceptProduct (Asset product)
public native bool | DoesAcceptProductCategory (Asset productCategory)
public native Asset[] | GetProducts (void)
public native Asset[] | GetProductCategories (void)
public native bool | IsLocked (void)
public void | AddSoup (Soup soup)
public Soup | GetAsSoup (void)
public bool | IsEmpty (void)

Detailed Description

Implements the filtering of products by Product asset or Product Category asset.

Products that are not listed in the filter, and whose Product Category is not listed, are not accepted by this filter.

Note:
Both products and product categories can be represented by an Asset object.
See also:
Asset, ProductQueue, Constructors.NewProductFilter()

Member Function Documentation

public native void ProductFilter.AddProduct ( Asset product )

Adds the given product to this filter.

Parameters:
product Product to add to this filter.

public native void ProductFilter.AddProductCategory ( Asset productCategory )

Adds the given product category to this filter.

Parameters:
productCategory Product category to add to this filter.

public void ProductFilter.AddSoup ( Soup soup )

Adds the filter properties from the given Soup to this filter.

Parameters:
soup Soup with products and product categories to be added to this filter. This soup should be in the same format as that returned by GetAsSoup().

public native void ProductFilter.AppendFilter ( ProductFilter filter )

Appends products and categories from another filter to this one.

In order to use this method, this filter must not be locked.

Parameters:
filter Other filter to append to this one.

public native void ProductFilter.CopyFilter ( ProductFilter filter )

Makes this filter a copy of the specified filter.

This filter must not be locked. The locked attribute of the specified filter is not copied.

Parameters:
filter Filter to clone properties from.

public native bool ProductFilter.DoesAcceptProduct ( Asset product )

Determines if this filter can accept the given product.

Parameters:
product Product to check against this filter.
Returns :
Returns true if this filter can accept product, false otherwise.

public native bool ProductFilter.DoesAcceptProductCategory ( Asset productCategory )

Determines if this filter accepts products from the given category.

Parameters:
productCategory Product category to check against this filter accepts.
Returns :
Returns true if this filter accepts products from productCategory, false otherwise.

public Soup ProductFilter.GetAsSoup ( void )

Gets the settings of this product filter as a Soup database.

The returned Soup contains two sub-Soup databases named "ProductFilter.Products" and "ProductFilter.Categories". The products sub-database contains the KUIDs of all the products this filter currently allows where the tags of the KUIDs are named numerically starting from "0". The categories sub-database is arranged in the same way except it contains the KUIDs of allowable product categories.

Returns :
Returns the settings of this product filter as a Soup object.

public native Asset [] ProductFilter.GetProductCategories ( void )

Gets the product categories that are accepted by this filter.

Returns :
Returns an array of product categories accepted by this filter.

public native Asset [] ProductFilter.GetProducts ( void )

Gets the products that are accepted by this filter.

Returns :
Returns an array of products that this filter accepts.

public native ProductFilter ProductFilter.IntersectFilter ( ProductFilter filter )

Creates a filter that intersects between the given filter and this one.

Parameters:
filter Filter to generate an intersection with.
Returns :
Returns the intersection of the filter argument and this one.

public bool ProductFilter.IsEmpty ( void )

Determines if this filter is empty with no categories or products.

Returns :
Returns true if this filter is empty with no categories or products, false otherwise.

public native bool ProductFilter.IsLocked ( void )

Determines if this filter is locked.

Returns :
Returns true if this filter is locked, false otherwise.

public native void ProductFilter.RemoveProduct ( Asset product )

Removes the given product from this filter.

Parameters:
product Product to remove from this filter.

public native void ProductFilter.RemoveProductCategory ( Asset productCategory )

Remove the given product category from this filter.

Parameters:
productCategory Product category to remove from this filter.

The documentation for this class was generated from the following file:
  • ProductFilter.gs


ProductQueue Class Reference

Inheritance diagram for ProductQueue:

GSObject List of all members.

Public Methods

public native int | GetQueueSize (void)
public native void | SetQueueSize (int queueSize)
public native int | GetQueueSpace (void)
public int | GetQueueCount (void)
public native string | GetQueueName (void)
public native int | CountProductMatching (ProductFilter filter)
public native int | TransferProductFrom (ProductQueue fromQueue, ProductFilter matchingFilter, int maximumToTransfer, bool performTransfer)
public native int | DestroyProductMatching (ProductFilter filter, int maximumToDestroy)
public native int | CreateProduct (Asset product, int maximumToAdd)
public native ProductFilter | GetProductFilter (void)
public native void | SetProductFilter (ProductFilter filter)
public native Asset[] | GetProductList (void)
public native Asset | GetProductCategory (void)
public int | DestroyAllProducts (void)

Detailed Description

A queue of products.

A product queue is not an asset in itself, rather other assets can have queues contained in them. Any asset that uses a class derived from MapObject can have queues. This includes Industry and Vehicle for example.

See also:
Asset, Industry, LoadingReport, MapObject, MapObject.GetQueues(), ProductFilter, Vehicle

Member Function Documentation

public native int ProductQueue.CountProductMatching ( ProductFilter filter )

Gets the amount of products in this queue that match the given filter.

Parameters:
filter Filter that specified products to include in the count. If null, all products will be included.
Returns :
Returns the amount of products in this queue that match filter.

public native int ProductQueue.CreateProduct | ( | Asset | product,
 |  | int | maximumToAdd
 | ) |

Creates the specified amount of the given product for this queue.

If there isn't enough room in the queue, it will be filled up with as many products as possible and the actual amount added will be returned.

Parameters:
product | Type of product to create.
maximumToAdd | Maximum amount of the product to add.
Returns :
Returns the actual amount of products created.

public int ProductQueue.DestroyAllProducts ( void )

Removes all products from this queue making it empty.

Returns :
Returns the amount of products removed.

public native int ProductQueue.DestroyProductMatching | ( | ProductFilter | filter,
 |  | int | maximumToDestroy
 | ) |

Remove products from this queue using a filter.

Parameters:
filter | Filter that defines what products to remove. If null, all products will be matched.
maximumToDestroy | Maximum amount of the products that can be destroyed.
Returns :
Returns the amount of products destroyed.

public native Asset ProductQueue.GetProductCategory ( void )

Gets the product category that is currently in this queue.

Returns :
Returns the product category that is currently present in this queue, null if there are no products present.

public native ProductFilter ProductQueue.GetProductFilter ( void )

Gets the product filter as defined in this queue's asset configuration.

Returns :
Returns the ProductFilter as defined in the configuration. This filter will be returned in a locked state as it is defined as part of the asset.

public native Asset [] ProductQueue.GetProductList ( void )

Gets the list of product types that are currently present in this queue.

Returns :
Returns an array of product types that are currently present in this queue.

public int ProductQueue.GetQueueCount ( void )

Gets the amount of product items in this queue.

Returns :
Return the total amount of products currently in this queue.

public native string ProductQueue.GetQueueName ( void )

Gets the name of this queue.

Gets the text name of this queue as defined in the asset's configuration.

Returns :
Returns the name of this queue.

public native int ProductQueue.GetQueueSize ( void )

Gets the maximum size of this queue.

The size limits the maximum value of the queue's count (i.e. how many products it can contain when full).

Returns :
Return this queue's size as specified in the asset's configuration.

public native int ProductQueue.GetQueueSpace ( void )

Gets the amount of space left in this queue (i.e. GetQueueSize() - GetQueueCount()).

Returns :
Returns the amount of space left in this queue

public native void ProductQueue.SetProductFilter ( ProductFilter filter )

Sets the product filter for this queue to a copy of the specified filter.

This method will set the filter parameter object to be a clone of this queue's filter.

Parameters:
filter ProductFilter to copy to.

public native void ProductQueue.SetQueueSize ( int queueSize )

Sets the maximum size of this queue.

This method allows the maximum queue size to be changed dynamically from script code.

Parameters:
queueSize Maximum amount of products this queue can hold.

public native int ProductQueue.TransferProductFrom | ( | ProductQueue | fromQueue,
 |  | ProductFilter | matchingFilter,
 |  | int | maximumToTransfer,
 |  | bool | performTransfer
 | ) |

Transfer products from the given queue to this queue.

Only products matching the specified filter are transferred. A null filter matches all products. No more than maximumToTransfer products are transferred.

Parameters:
fromQueue | Queue to transfer products from.
matchingFilter | Filter to apply to fromQueue for the transfer.
maximumToTransfer | Maximum amount of product items allowed to be transferred.
performTransfer | Flag indicating whether to perform the actual transfer. If false, the transfer isn't carried out but the correct results are still returned.
Returns :
Returns the actual amount of product transferred.

The documentation for this class was generated from the following file:
  • ProductQueue.gs


PropertyBrowser Class Reference

List of all members.

Detailed Description

Class that manages a Browser with a HTMLPropertyHandler.

This class allows a HTML property handler to be used to produce and refresh the contents of a Browser window so the handlers are not restricted to just PropertyObject-derived classes.

Interface methods of this class are:

  • public void Init (Browser browser, HTMLPropertyHandler handler)
  • public void SetPropertyHandler (HTMLPropertyHandler handler)
  • public HTMLPropertyHandler GetPropertyHandler ()
  • public void SetBrowser (Browser browser)
  • public Browser GetBrowser ()
  • public void Refresh ()
  • public bool HandleLink (string link)
Note:
This class is very limited at this point in time. It won't correctly support editable properties and should only be used for display purposes and for "link" properties.
See also:
Browser, HTMLPropertyHandler

The documentation for this class was generated from the following file:
  • PropertyBrowser.gs


PropertyObject Class Reference

Inheritance diagram for PropertyObject:

MeshObject ScenarioBehavior Bogey Cabin MapObject ConditionalScenarioBehavior DefaultLocomotiveCabin DefaultSteamCabin SceneryWithTrack Trackside Buildable Crossing Turntable Junction Signal TrackMark Trigger Vehicle List of all members.

Public Methods

public void | SetProperties (Soup soup)
public Soup | GetProperties (void)
public string | GetDescriptionHTML (void)
public string[] | GetPropertyElementList (string propertyID)
void | SetPropertySelectedElementList (string propertyID, string[] elements)
string | GetPropertyName (string propertyID)
string | GetPropertyDescription (string propertyID)
string | GetPropertyType (string propertyID)
public string | GetPropertyValue (string propertyID)
void | SetPropertyValue (string propertyID, string value, int index)
void | SetPropertyValue (string propertyID, string value)
void | SetPropertyValue (string propertyID, float value)
void | SetPropertyValue (string propertyID, int value)
void | LinkPropertyValue (string propertyID)
public void | PropertyBrowserRefresh (Browser browser)
public void | SetPropertyHandler (HTMLPropertyHandler handler)
public HTMLPropertyHandler | GetPropertyHandler (void)

Detailed Description

An interface for an object with data properties.

This class provides an abstract interface that allows an object to have properties that can be saved or loaded with a session and edited by the user through a browser window in Surveyor.

To give a class properties, it must inherit from this class (or a derived child class such as ScenarioBehavior or MeshObject).

A property is a virtual data member in the sense that it is something that only exists by name as far the interface methods of the class are concerned. As this is a high-level interface class, it has no properties itself, rather only a variety of methods that Trainz calls to access properties.

Note:
See GetPropertyType() for further details on the type of properties supported.
All properties are referred to in the methods by name. How the actually property is handled is left to the programmer to do in their own overridden method implementation. The idea is that the derived class will have normal data members and the property interface methods act as a translation layer between the abstract property names and the actual data being used.

To elaborate further, this uniform interface means that when Trainz is saving a session, it asks each object to save its respective state into a Soup database. Trainz won't know what your object needs to save but it does know that it can request an object's state in a database for storage. So in that sense, Trainz is relying on the script programmer to have given careful thought to how they construct their asset.

Depending on circumstances, not all methods have to be implemented (all do have minimal default implementations in this class). For example, you don't need to override GetDescriptionHTML() if you don't want the object to have editable properties in Surveyor or GetPropertyElementList() if there are no list-selection properties.

Note that with the introduction of property handlers (described below), there is no longer a need to override PropertyObject methods to support properties.

Property Handlers
A property handler is attached to a property object to manage that property object's properties. Because the property handler is a separate entity from the property object, the actual script code that deals with properties is more portable and not tied down to a specific PropertyObject derived class.

PropertyObject retains backward compatibility so no existing assets will be affected by the added handler support. However care must be taken if you are overriding PropertyObject methods and a handler is being used with your object. The reason being is that PropertyObject's parent method implementations check for the a handler and pass the call onto the handler for processing if one is available.

As a result, if you have overridden these methods in your PropertyObject-derived class and a handler is attached to the property object, that handler won't be used unless you either call its methods from your own overridden PropertyObject methods or call the parent PropertyObject method with the inherited keyword.

Generally, it would be less troublesome and error prone if you either stick to just overriding PropertyObject methods for your property handling or switched over to using handlers exclusively.

A handler can be assigned to a PropertyObject by calling its SetPropertyHandler() method. More details about property handlers can be found in the HTMLPropertyHandler class documentation.

See also:
Asset, HTMLPropertyHandler, HTMLPropertyGroup, MeshObject, ScenarioBehavior, Soup

Member Function Documentation

public string PropertyObject.GetDescriptionHTML ( void )

Gets a description of this PropertyObject as a HTML page.

This method is called by Trainz from Surveyor to get the properties of the object as HTML code for display in a Browser window.

In the default PropertyObject implementation, if a property handler is present the handler's GetDescriptionHTML() method is called to get the properties as a HTML page. Otherwise an empty string will be returned.

Property link URLs should be in the form of "live://property/foobar" where foobar is the non-localized name of the property. When one of these links is clicked on, Trainz will call LinkPropertyValue(), which must be implemented if the link is to be acted on. Note that properties used in URLs must be of type link.

Returns :
Returns a HTML description of the PropertyObject to be displayed to the user in the Surveyor Rules Editor. Properties should appear as links and summarize the current setting so that the user can edit them.
Note:
To aid in localization, any text should be extracted from the PropertyObject's asset's StringTable and not included in script code as a literal string.
See also:
Browser, HTMLPropertyHandler.GetDescriptionHTML()

Reimplemented in GenericIndustry, and Vehicle.

public Soup PropertyObject.GetProperties ( void )

Instructs this PropertyObject to put all of its current properties into a database to be returned.

This method is used to save the properties of a PropertyObject into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

When overriding this method to handle your own properties, always call through to the overridden parent by using inherited like this:

     public Soup GetProperties(void)
     {
       // start out with parent class properties
       Soup retSoup = inherited();

       // add your own properties to retSoup here...

       // return the complete properties database
       return retSoup;
     }

In the PropertyObject implementation, if a property handler is attached to this object and it has been set to have its properties saved, that handler's GetProperties() method will be called.

Note:
It is possible that in future versions of Trainz, parent methods like this one may have their implementation modified. By not calling through to the overridden parent, you risk your assets NOT WORKING in a future version of Trainz.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
HTMLPropertyHandler.GetProperties(), HTMLPropertyHandler.GetSavesProperties()

Reimplemented in BaseIndustry, ScenarioBehavior, ScenarioBehavior, and Vehicle.

string PropertyObject.GetPropertyDescription ( string propertyID )

Gets the localized description text for the named property.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will return what the handler's GetPropertyDescription() method does. Otherwise, a generic description will be returned as a default.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Returns the localized description text for propertyID.
See also:
HTMLPropertyHandler.GetPropertyDescription()

Reimplemented in GenericIndustry, and Vehicle.

public string [] PropertyObject.GetPropertyElementList ( string propertyID )

Gets a list of elements the user can select for the named property.

This method is called to get the list of elements for the named property. Trainz will rely on it to get the elements if a property is of type "list", as returned by GetPropertyType(), so it can then display them in a pop-up window for user selection.

The script programmer is free to fill the returned elements array from the current game environment and can create this dynamically if necessary (e.g. a list of industries in the current route). Remember that these elements will be presented to the user in a pop-up selection box, so be mindful of making them human-friendly and not too wide.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will return what the handler's GetPropertyElementList() method does. Otherwise, an empty list will be returned as a default.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that list the elements in propertyID.
See also:
HTMLPropertyHandler.GetPropertyElementList()

Reimplemented in Vehicle.

public HTMLPropertyHandler PropertyObject.GetPropertyHandler ( void )

Gets the current property handler of this object.

Returns :
Returns this property object's handler, null otherwise.

string PropertyObject.GetPropertyName ( string propertyID )

Gets the localized human-readable name of the specified property.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will return what the handler's GetPropertyName() method does. Otherwise, a generic name will be returned as a default.

Parameters:
propertyID Name of the property to get the readable name for.
Returns :
Returns a human-readable name for propertyID.
See also:
HTMLPropertyHandler.GetPropertyName()

Reimplemented in GenericIndustry, and Vehicle.

string PropertyObject.GetPropertyType ( string propertyID )

Gets the type of the named property.

This method is used by Trainz to determine the type of the named property. It is a method that needs to be overridden in a child class to handle whatever properties that class has.

The type of a property is defined as a string describing what type of data the property holds as well as extra information about the range, size and increment count (depending on the property type). Property types supported include string, float, int, list and link. The returned string must be prefixed with one of these type names.

You can optionally include the minimum and maximum range of the value for string, float and int types and the increment level for float and int types. The list type has one optional parameter that may be 0 or 1 to disable or enable sorting of elements.

For example:
Type String | Description
"string,0,200" | A string that can be 0 through to 200 characters in length.
"float,0,20,0.2" | Float value in the range of [0.0 - 20.0] with incremental steps of 0.2.
"int,0,50,2" | Integer value in the range of [0 - 50] with incremental steps of 2.
"list,1" | List type with sorting of added elements.
"link" | No extra options required.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Returns a string describing the type of propertyID. The default PropertyObject implementation will either return whatever the handler provides or "null" (not to be confused with a null value) if there is no handler.
See also:
HTMLPropertyHandler.GetPropertyType()

Reimplemented in GenericIndustry, and Vehicle.

public string PropertyObject.GetPropertyValue ( string propertyID )

Gets the value of the named property as a string.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will return what the handler's GetPropertyValue() method does. Otherwise, an empty string will be returned as a default.

Parameters:
propertyID Name of the property to get the value of as a string.
Returns :
Returns the value of propertyID as a string. Convert the result to float or int if required.
See also:
HTMLPropertyHandler.GetPropertyValue()

Reimplemented in Vehicle.

void PropertyObject.LinkPropertyValue ( string propertyID )

Call-back method for when the named property of type link is clicked on.

This method is called by Trainz if a property of type link (as determined by GetPropertyType()) is clicked on in a URL from the HTML page returned by GetDescriptionHTML().

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will call the handler's SetPropertyValue() method to handle the link.

Parameters:
propertyID Name of the property clicked on.
See also:
HTMLPropertyHandler.SetPropertyValue()

Reimplemented in Vehicle.

public void PropertyObject.PropertyBrowserRefresh ( Browser browser )

Called when the game wishes to refresh the property view in the specified browser.

This method updates the browser with the HTML code provided by GetDescriptionHTML(). The property handler's RefreshBrowser() method will be used if a handler is present.

Parameters:
browser Browser to place refreshed property view in.
See also:
HTMLPropertyHandler.RefreshBrowser()

public void PropertyObject.SetProperties ( Soup soup )

Instructs this PropertyObject to initialize its properties from the given database.

If the database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

When overriding this method to handle your own properties, always call through to the overridden parent by using inherited like this:

     public void SetProperties(Soup soup)
     {
       // call overridden parent with soup passed up to it
       inherited(soup);

       // your initialization goes here...
     }

In the PropertyObject implementation, if a property handler is attached to this object and it has been set to have its properties saved, that handler's SetProperties() method will be called.

Note:
It is possible that in future versions of Trainz, parent methods like this one may have their implementation modified. By not calling through to the overridden parent, you will ill be running the risk of having your assets NOT WORKING in a future version of Trainz.
Parameters:
soup Database to initialize this property object with.
See also:
HTMLPropertyHandler.SetProperties(), HTMLPropertyHandler.GetSavesProperties()

Reimplemented in BaseIndustry, ConditionalScenarioBehavior, GenericPassengerStation, ScenarioBehavior, ScenarioBehavior, and Vehicle.

public void PropertyObject.SetPropertyHandler ( HTMLPropertyHandler handler )

Sets the property handler for this property object.

When a handler is present in a property object, the various property methods of this class will automatically call through to the property handler's methods to handle the properties. Hence we have the property handler taking over the role of handling properties for a property object.

If there is no property handler assigned to this object, it will rely on its own property methods to handle properties. This is how backward compatibility is maintained with older classes written before property handlers were introduced.

By setting a property handler, the current handler will be over-written by the new one.

Parameters:
handler Property handler to assign to this property object. The handler object should already be initialized and created for the specific use of the host property object. Use null to specify no handler.

void PropertyObject.SetPropertySelectedElementList | ( | string | propertyID,
 |  | string | elements[]
 | ) |

Obsolete method.

THIS METHOD WAS NEVER IMPLEMENTED AND IS OBSOLETE. DO NOT CALL IT. IT MAY BE REMOVED.

void PropertyObject.SetPropertyValue | ( | string | propertyID,
 |  | int | value
 | ) |

Sets the value of the named property to given int.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will call the handler's SetPropertyValue() method to set the property.

Parameters:
propertyID | Name of the property to set the value of.
value | Value to set the property named by propertyID to.
See also:
HTMLPropertyHandler.SetPropertyValue()

Reimplemented in GenericIndustry, and Vehicle.

void PropertyObject.SetPropertyValue | ( | string | propertyID,
 |  | float | value
 | ) |

Sets the value of the named property to given float.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will call the handler's SetPropertyValue() method to set the property.

Parameters:
propertyID | Name of the property to set the value of.
value | Value to set the property named by propertyID to.
See also:
HTMLPropertyHandler.SetPropertyValue()

void PropertyObject.SetPropertyValue | ( | string | propertyID,
 |  | string | value
 | ) |

Sets the value of the named property to the given string.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will call the handler's SetPropertyValue() method to set the property.

Parameters:
propertyID | Name of the property to set the value of.
value | String to set the value of the property named by propertyID to.
See also:
HTMLPropertyHandler.SetPropertyValue()

Reimplemented in Vehicle.

void PropertyObject.SetPropertyValue | ( | string | propertyID,
 |  | string | value,
 |  | int | index
 | ) |

Sets the value of the named property.

This method is called when a list property item is changed.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will call the handler's SetPropertyValue() method to set the property.

Parameters:
propertyID | Name of the list property to set the value of.
value | String to set the property's value to.
index | Index of item from the list to set.
Note:
For compatibility, SetPropertyValue(string,string,int) should call SetPropertyValue(string,string).
See also:
HTMLPropertyHandler.SetPropertyValue()

Reimplemented in Vehicle.

The documentation for this class was generated from the following file:
  • PropertyObject.gs


PropertyValue Class Reference

List of all members.

Public Methods

public int | GetType (void)
public int | AsInt (void)
public float | AsFloat (void)
public string | AsString (void)
public bool | AsBool (void)
public int | GetIndex (void)
public void | Set (void)
Sets this property to a null value.

public void | Set (int val)
public void | Set (float val)
public void | Set (string val)
public void | Set (string val, int index)
public void | Set (bool val)

Public Attributes

Property Types

Different types that a property value can be.

See also:
PropertyValue.GetType()

public define int | NULL_TYPE = 0
Null property value.

public define int | INT_TYPE = 1
Integer property value.

public define int | FLOAT_TYPE = 2
Floating point property value.

public define int | STRING_TYPE = 3
String property value.

public define int | INDEX_TYPE = 4
Value is an index to a list item.

public define int | BOOL_TYPE = 5
Boolean value.

Detailed Description

A generic property value.

This class describes a property as used by a property handler in terms of its type and value. Supported types include null values, integers, floating point numbers, strings, list indices and bools.

See also:
HTMLPropertyHandler, HTMLPropertyHandler.SetPropertyValue(), HTMLPropertyHandler.GetPropertyAttribute(), HTMLPropertyHandler.SetPropertyAttribute()

Member Function Documentation

public bool PropertyValue.AsBool ( void )

Gets the value of this property as a bool.

Returns :
Returns the value of this property as a bool if the property is of type BOOL_TYPE. If the property is a STRING_TYPE and the string value is "TRUE", "true", "True" or "1", true is returned. If the property is of type INT_TYPE and value is equal to 1, true is returned. In any other circumstance, false will be returned.

public float PropertyValue.AsFloat ( void )

Gets the value of this property as a float.

Returns :
Returns the value of this property as a float. A value of 0.0 will be returned if the property is not of type FLOAT_TYPE.

public int PropertyValue.AsInt ( void )

Gets the value of this property as an int.

Returns :
Returns the value of this property as an int. A value of 0 will be returned if the property is not of type INT_TYPE.

public string PropertyValue.AsString ( void )

Gets the value of this property as a string.

Returns :
Returns the value of this property in a string. An empty string will be returned if the property is not of type STRING_TYPE or INDEX_TYPE.

public int PropertyValue.GetIndex ( void )

Gets the value of this property as an index.

Returns :
Returns the value of this property as an index if the property is of type INDEX_TYPE, 0 otherwise.

public int PropertyValue.GetType ( void )

Gets the type of this property.

Returns :
Returns one of the property type values.

public void PropertyValue.Set ( bool val )

Sets the value of this property to the given bool.

Parameters:
val Boolean value to set this property to.

public void PropertyValue.Set | ( | string | val,
 |  | int | index
 | ) |

Sets the value of this property to the given index value.

Parameters:
val | Value to set this property to.
index | Index value for this property.

public void PropertyValue.Set ( string val )

Sets the value of this property to the given string.

Parameters:
val Value to set this property to.

public void PropertyValue.Set ( float val )

Sets the value of this property to the given float.

Parameters:
val Value to set this property to.

public void PropertyValue.Set ( int val )

Sets the value of this property to the given int.

Parameters:
val Value to set this property to.

The documentation for this class was generated from the following file:
  • HTMLPropertyHandler.gs


RadioButtonGroupHandler Class Reference

Inheritance diagram for RadioButtonGroupHandler:

CheckListGroupHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public void | Init (Asset asset, string newConfigPrefix)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Detailed Description

A config asset handler that provides selection of a child handler with radio buttons.

This config handler is a group handler that has a selectable radio button for each child handler. It works in a similar way to RadioButtonListHandler but instead relies on the child handler to provide content to go beside the checkbox. Is designed to be generic to the point where any handler class could be a selectable item.

Apart from the child handler's HTML page being place adjacent to the radio button this handler class creates, the radio buttons don't affect the child handlers and vice versa - they are separate entities. Interface methods are provided with this class so the state of a radio button can be queried.

This class is derived from CheckListGroupHandler and is configured from a host string table in an almost identical way:

String Name | Description
"<config-prefix>-display-name" | Display name to be above the list.
"<config-prefix>-html-between-items" | HTML code placed between each radio button and child handler in this group handler's properties window. Useful for adding a line break or divider bar for example.
"<config-prefix>-<item-name>" | Optional title for the child handler. If included, this text will be placed next to the radio button and above the child handler with a prefix of "<item-name>".
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

For example here are the string table items from the Message Popup rule where the config prefix is "popup-selection":

String Name | Contents
"popup-selection-display-name" | "Create a pop-up message box window from:"
"popup-selection-html-between-items" | " "
"popup-selection-item-msgboxasset" | "null"
"popup-selection-item-msgboxtext" | "null"
"popup-selection-html-prefix" | "<font color=#000000>"
"popup-selection-html-sufix" | "</font>"

Note that the "popup-selection-item-X" strings correspond to the two sub handlers used by the Message Popup rule with this class.

This handler is also used by the following rules:

  • Flash HUD Icon
  • Flash HUD Panel
  • Set Camera
  • Set HTML Pages
  • Wait HTML Pages
Useful interface methods provided with this class are:
  • public void AddItem (string itemName, bool setting) (overridden from CheckListGroupHandler)
  • public HTMLPropertyHandler GetSelectedSubHandler ()
  • public void ResetButtons ()
As well as that, the following methods inherited from CheckListGroupHandler are also applicable to this class:
  • public bool GetSetting (int index)
  • public bool[] GetSettings ()
  • public string GetSettingName (int index)
  • public string[] GetSettingNames ()
  • public string[] GetSettingNames (bool checked)
  • public string GetSettingDisplayName (int index)
  • public HTMLPropertyHandler GetItemSubHandler (int index)
Note:
RadioButtonGroupHandler was mainly written as a utility class for use in the TRS2006 session rules. It is not part of the core Trainz API and is not fully documented. Those who are interested in how this class works can see all the full implementation in the \Trainz\scripts\ListItemPropertyHandler.gs script file.
See also:
RadioButtonListHandler, CheckListGroupHandler, CheckListPropertyHandler, ConfigAssetGroupHandler, AssetCheckListHandler, CheckBoxHandler, EnumeratedPropertyHandler, GenericStringHandler

Member Function Documentation

public Soup RadioButtonGroupHandler.GetProperties ( ) [inline]

Gets this handler's properties in a database.

Overridden from HTMLPropertyHandler.GetProperties() to save the properties of all sub handlers and then return a Soup containing a sub-database for each sub handler obtained by calling the sub handlers GetProperties() method.

Returns :
Returns a Soup database containing the saved properties of this group handler and its sub handlers.

Reimplemented from CheckListGroupHandler.

public void RadioButtonGroupHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset group handler.

When a config group asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Note that calling this method does not do anything to any sub-handlers. It is recommended that Init() is called on the ConfigAssetGroupHandler before any sub-handlers are added.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from CheckListGroupHandler.

public void RadioButtonGroupHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset group handler.

When a config group asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Note that calling this method does not do anything to any sub-handlers. It is recommended that Init() is called on the ConfigAssetGroupHandler before any sub-handlers are added.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from CheckListGroupHandler.

public void RadioButtonGroupHandler.SetProperties ( Soup soup ) [inline]

Initializes this handler's properties from the given database.

Overridden from HTMLPropertyHandler.SetProperties() to initialize all of the sub handlers from the given Soup database. The HTMLPropertyGroup implementation of this method assumes the sub handlers have already been added to the group handler - it only initializes existing sub handlers and generally isn't meant to create new sub handlers itself (although you can do that in your own overridden implementation if you really want to).

Parameters:
soup Database of property values to initialize this handler with. Sub-databases in side this soup will be used to initialize each sub-handler.

Reimplemented from CheckListGroupHandler.

public void RadioButtonGroupHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the value of the named property.

Overridden from HTMLPropertyHandler.SetPropertyValue() to set the value of the named property on the appropriate child handler.

Parameters:
propertyID | Name of the property to set the value of. This should be a full property string with group handler and sub handler prefixes.
value | Value to set the property to.

Reimplemented from CheckListGroupHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


RadioButtonListHandler Class Reference

Inheritance diagram for RadioButtonListHandler:

CheckListPropertyHandler List of all members.

Public Methods

public void | Init (Asset asset, string newConfigPrefix)
public void | AddItem (string itemName, bool setting)
public void | ResetButtons (void)
public void | Init (Asset asset, string newConfigPrefix)
public void | AddItem (string itemName, bool setting)
public string | GetDescriptionHTML (void)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public Soup | GetProperties ()
public void | SetProperties (Soup soup)

Public Attributes

int | m_currentSelection = 0
Index to currently selected radio button item.

Detailed Description

A config asset handler that manages a list of text items with radio buttons.

This handler provides a list of text items where each one has an adjacent radio button and only one can be selected at a time (which is how radio buttons generally behavior in GUI environments). This means selecting one item results in the currently selected item becoming de-selected.

The key property of this handler is a current selection value that refers to the index of the currently selected radio button item. This is the only property value that this handler saves/loads. The text items are read from the string table each time the handler is created.

This class is derived from CheckListPropertyHandler and is configured from a host string table in an almost identical way:

String Name | Description
"<config-prefix>-display-name" | Display text to be shown before the list.
"<config-prefix>-item$N" | Reference name for the $Nth item.
"<config-prefix>-item-<reference-name>" | Full name displayed next to the radio button where <reference name> is the Xth item's reference name as defined in "<config-prefix>-itemX".
"<config-prefix>-html-prefix" | HTML code inserted at the start of the properties page.
"<config-prefix>-html-sufix" | HTML code inserted at the end of the properties page.

The listing of items to use next to each radio button for example is identical to that of CheckListPropertyHandler where you have the "<config-prefix>-item$N" strings in a numbered sequence and each one of these strings contains the reference name for that item. The actual text for the item is found by using the reference name appended to the end of the config prefix.

The currently selected item can be obtained by using CheckListPropertyHandler methods such as GetSettingNames(bool). As this class only has one item selected at once, GetSettingNames(bool) can be relied on to return an array with just one string in it that will be the name of the currently selected item for example.

No assets currently use this handler class, but as a simple example here is a list of string table entries that when used with this handler will allow a junction direction setting to be selected. The config prefix is "junc-mode".

String Name | Contents
"junc-mode-display-name" | "Change junction direction to: "
"junc-mode-item0" | "left"
"junc-mode-item1" | "center"
"junc-mode-item2" | "right"
"junc-mode-item-left" | "Left"
"junc-mode-item-center" | "Center (3-way junctions only)"
"junc-mode-item-left" | "Right"

See also:
ConfigAssetHandler, CheckBoxHandler, CheckListPropertyHandler, CheckListGroupHandler, RadioButtonGroupHandler, AssetCheckListHandler, EnumeratedAssetHandler, GenericStringHandler

Member Function Documentation

public void RadioButtonListHandler.AddItem | ( | string | itemName,
 |  | bool | setting
 | ) | [inline]

Adds a new bool checkbox property to this handler.

Note:
This method was mainly written for internal use by Init(Asset,string) when it initializes this handler. Playing with it after the handler has been initialized is not recommended.
Parameters:
itemName | Display text that will be displayed alongside the new checkbox property.
setting | Setting that the new checkbox property will initially have.

Reimplemented from CheckListPropertyHandler.

public void RadioButtonListHandler.AddItem | ( | string | itemName,
 |  | bool | setting
 | ) |

Adds the given item to the list of radio buttons this handler has.

This method is overridden in RadioButtonListHandler so that every time a new item is added, the radio buttons are reset with ResetButtons() if needed. The buttons will only be reset if setting is true as only one item in a radio button list can be selected.

Note:
This method was mainly written for internal use by Init(Asset,string) when it initializes this handler. Playing with it after the handler has been initialized is not recommended.
Parameters:
itemName | Display text that will be displayed alongside the new radio button property.
setting | On/off state of the radio button. If true, the radio button for this item is selected and all of the other radio buttons will be reset.

Reimplemented from CheckListPropertyHandler.

public string RadioButtonListHandler.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from CheckListPropertyHandler.

public Soup RadioButtonListHandler.GetProperties ( ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from CheckListPropertyHandler.

public void RadioButtonListHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) | [inline]

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from CheckListPropertyHandler.

public void RadioButtonListHandler.Init | ( | Asset | asset,
 |  | string | newConfigPrefix
 | ) |

Initializes this config asset handler.

When a config asset handler of any type is created, it must be initialized by calling this method before anything else is done with the handler such as attaching it to a PropertyObject-derived class or group handler.

Parameters:
asset | Host Asset with StringTable for use by this handler to get configuration and text data.
newConfigPrefix | The string that will be prefixed on all string table elements this handler accesses. See the main class description above for details of what strings this class may require.
Note:
There are various other Init() methods seen in the config asset handler class definitions but they are generally to be avoided as they are not fully tested. If you do use them, make sure you read the implementation code and understand what is going on.

Reimplemented from CheckListPropertyHandler.

public void RadioButtonListHandler.ResetButtons ( void )

Resets the radio buttons of this handler such that all are false except the currently selected one.

This is a handy method to call whenever a new radio button item is added or selected to ensure the list of radio buttons only has one item selected.

public void RadioButtonListHandler.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from CheckListPropertyHandler.

public void RadioButtonListHandler.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from CheckListPropertyHandler.

The documentation for this class was generated from the following file:
  • ListItemPropertyHandler.gs


Requirement Class Reference

Inheritance diagram for Requirement:

ResourceRequirement List of all members.

Public Attributes

public Requirement cause
The cause of this requirement.

Detailed Description

Base class for ResourceRequirement.

See also:
Industry.GetRequirements(), ScenarioBehavior.GetRequirements(), ResourceRequirement

The documentation for this class was generated from the following file:
  • Requirement.gs


ResourceRequirement Class Reference

Inheritance diagram for ResourceRequirement:

Requirement List of all members.

Public Methods

public Asset | GetResource (void)
public int | GetAmount (void)
public GameObject | GetDst (void)
public ProductQueue | GetDstQueue (void)

Public Attributes

Requirements Data

These data members define the properties of a requirement.

See also:
ResourceRequirement.GetAmount(), ResourceRequirement.GetDst(), ResourceRequirement.GetDstQueue(), ResourceRequirement.GetResource()

public Asset | resource
Resource required for destination queue.

public int | amount
Amount of resources required. Can be negative to indicate that a resource is to be taken away rather than dropped off.

public GameObject | dst
Destination game object where the queue is.

public ProductQueue | dstQueue
Destination queue for resource. Use null if no destination is needed.

Detailed Description

A resource requirement

This class defines a requirement to either bring a resource to an input queue or to remove a resource from an output queue. Currently, both industries and rules can have requirements. The data in a requirement is used by Trainz to generate waybills.

See also:
ProductFilter, ProductQueue, Requirement, Industry.GetRequirements(), ScenarioBehavior.GetRequirements()

Member Function Documentation

public int ResourceRequirement.GetAmount ( void )

Gets the amount of resources this requirement needs.

Returns :
Returns the amount of resources this requirement needs.

public GameObject ResourceRequirement.GetDst ( void )

Gets the destination object this requirement is attached to (i.e. the object this requirement is defined to fulfil).

Returns :
Returns the destination this requirement is attached to.

public ProductQueue ResourceRequirement.GetDstQueue ( void )

Gets the destination queue for this requirement.

Returns :
Returns the destination queue for this requirement.

public Asset ResourceRequirement.GetResource ( void )

Gets the resource that this requirement needs.

Returns :
Returns the resource this requirement needs.

The documentation for this class was generated from the following file:
  • Requirement.gs


Router Class Reference

List of all members.

Public Methods

public native GameObject | GetGameObject (int uniqueId)
public native GameObject | GetGameObject (string uniqueName)
public native void | PostMessage (int srcNodeId, int dstNodeId, string major, string minor, float delay)
public native void | Info ()

Public Attributes

public define int | MESSAGE_BROADCAST = 0
Broadcast message ID. All objects in the router will receive a broadcast message.

Detailed Description

Routes messages between game objects.

See also:
GameObject, Message

Member Function Documentation

public native GameObject Router.GetGameObject ( string uniqueName )

Gets the game object for the given unique name.

Parameters:
uniqueName Unique name of object to find.
Returns :
Returns the object as described by uniqueName if possible, null otherwise.

public native GameObject Router.GetGameObject ( int uniqueId )

Gets the game object for the given unique ID.

Parameters:
uniqueId Unique ID of object to find.
Returns :
Returns the game object that matches uniqueId, null otherwise.

public native void Router.Info ( )

Logs current router information.

This information will be in the \Trainz\JetLog.txt file. Such data can be useful for debugging scripts and scenarios.

See also:
Interface.Log()

public native void Router.PostMessage | ( | int | srcNodeId,
 |  | int | dstNodeId,
 |  | string | major,
 |  | string | minor,
 |  | float | delay
 | ) |

Post a message through the router.

This method allows code that isn't part of a GameObject thread to post a message. As such, a source for the message must also be provided well as the usual major/minor types and destination.

Parameters:
srcNodeId | ID of source object that the message is to come from.
dstNodeId | ID of destination object that the message is to be delivered to. Use MESSAGE_BROADCAST for a message that will be broadcasted to all objects.
major | Major type of message to post.
minor | Minor type of message to post.
delay | Delay in seconds to wait before posting the message.

The documentation for this class was generated from the following file:
  • gs.gs


Scenario Class Reference

Inheritance diagram for Scenario:

GameObject List of all members.

Public Methods

bool | Load (string data)
string | Save ()
thread void | main (void)
void | TrainOverSpeed (int trainId)
void | TrainOverAdvisorySpeed (int trainId)
void | TrainDerailed (int trainId)
void | TrainCollided (int trainId)
void | TrainSpeedingFine ()
void | TrainBadCouple (int vehicleId)
thread void | Monitor ()

Detailed Description

Scenario is a simple "monitor" class.

Use Scenario instead of GameObject and you may easily monitor events such as derailments and speeding etc.

Note:
In TRS2004, the camera must be focused on an object such as a Train, Vehicle or MapObject by the scenario script as TRS2004 will not focus the camera automatically. To do this, use one of the various World.SetCamera() methods from the World class during scenario initialization.
See also:
GameObject, ScenarioSupport, World, World1

Member Function Documentation

bool Scenario.Load ( string data ) [inline]

Called by Trainz before main() is executed.

This method is called before the scenario's main() function is called and is usually used to do any preparation work for the scenario like creating consists or setting junctions.

Note:
You CANNOT Sleep() or wait() in this function.
Parameters:
data Load data that may be used to store save game points etc.
Returns :
Returns true if successful, false otherwise. User implementation must follow this convention so Trainz knows whether or not there was any failure.

thread void Scenario.main ( void ) [inline]

Called by Trainz after Load() is executed.

This is the main entry point method of the scenario. Override this method as a starting point to get your scenario running.

thread void Scenario.Monitor ( ) [inline]

A thread for policing your scenario.

This thread looks out events such as speeding, derailments and collisions etc. and calls the various methods in this class based on what events it has detected. All of these methods can be implemented in the script programmer's scenario class (which inherits from this one) and their implementations will be called as needed by this thread - assuming it has been started of course.

Methods called by this thread are:

  • TrainOverSpeed()
  • TrainOverAdvisorySpeed()
  • TrainDerailed()
  • TrainCollided()
  • TrainSpeedingFine()
  • TrainBadCouple()
To kill this thread, post a message of type ("Scenario", "KillMonitor") message to this object.

To play a 2D sound, send a message of type ("Play2DSound", <sound file>) message to this object where <sound file> is the name of the .wav sound file to play.

string Scenario.Save ( ) [inline]

Called by Trainz when the user saves the game.

This function is called by Trainz in a scenario if the user saves the game.

You may notify the user of save checkpoints using the Interface.SetAlert() function.

Returns :
Returns a string that can be used by Load() to re-create the scenario in a state similar to what it was saved in.

void Scenario.TrainBadCouple ( int vehicleId ) [inline]

Called be Monitor() every time a vehicle couples at a speed greater than 7kph.

Override this function to be notified every time a coupling speed greater than 7kph has occurred.

Note:
When a fast coupling operation has occurred. this function will actually be called twice - once for each vehicle involved in the bad coupling operation. This is because a bad coupling operation involves two different vehicles being coupled together at speed.
Parameters:
vehicleId Node ID of the vehicle that was coupled at speed. Use this ID with Router.GetGameObject() to get a reference to the vehicle.

void Scenario.TrainCollided ( int trainId ) [inline]

Called by Monitor() when a train vehicle collision has occurred.

Override this function to be notified when a train vehicle collision occurs.

Parameters:
trainId Node ID of the train involved in the collision. Use this ID with Router.GetGameObject() to get a reference to the train.

void Scenario.TrainDerailed ( int trainId ) [inline]

Called by Monitor() when a train has derailed.

Override this function to be notified when a train vehicle derails.

Parameters:
trainId Node ID of the train that has derailed vehicles. Use this ID with Router.GetGameObject() to get a reference to the train.
See also:
Train.Derail()

void Scenario.TrainOverAdvisorySpeed ( int trainId ) [inline]

Called by Monitor() when a train is over the advisory speed limits.

Override this function to be notified when a train breaks the advisory speed limit.

Parameters:
trainId Node ID of the train that is over the advisory speed limit. Use this ID with Router.GetGameObject() to get a reference to the train.
See also:
Train.SetAdvisoryLimit()

void Scenario.TrainOverSpeed ( int trainId ) [inline]

Called by Monitor() when a train speeds.

Override this function to be notified and perform custom actions when a train speeds.

Parameters:
trainId Node ID of the train that is speeding. Use this ID with Router.GetGameObject() to get a reference to the train.

void Scenario.TrainSpeedingFine ( ) [inline]

Called by Monitor() when a train is over its floating speed limit.

Override this function to be notified every second a train is over its floating speed limit.

See also:
Train.SetFloatingLimit()

The documentation for this class was generated from the following file:
  • scenario.gs


ScenarioBehavior Class Reference

Inheritance diagram for ScenarioBehavior:

TrainzGameObject PropertyObject ConditionalScenarioBehavior List of all members.

Public Methods

public void | Pause (bool pause)
public int | GetStateFlags (void)
public void | SetComplete (bool isComplete)
public bool | IsComplete (void)
public bool | WasComplete (void)
public bool | IsPaused (void)
void | SetStateFlags (int flags, bool set)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)
public Requirement[] | GetRequirements (void)
public native ScenarioBehavior[] | GetChildBehaviors (void)
public native ScenarioBehavior | GetParentBehavior (void)
public void | Reset (void)
public string | GetDescription (void)
public void | AppendDependencies (KUIDList io_dependencies)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)

Public Attributes

Behavior State Flags

Flags describing the current state of a behavior.

See also:
ScenarioBehavior.GetStateFlags(), ScenarioBehavior.IsComplete(), ScenarioBehavior.IsPaused(), ScenarioBehavior.Reset(), ScenarioBehavior.SetComplete(), ScenarioBehavior.WasComplete()

public define int | NONE = 0
No other flags set.

public define int | PAUSED = 1
This behavior is currently paused.

public define int | COMPLETE = 2
This behavior is complete.

public define int | WAS_COMPLETE = 4
This behavior was complete some time previously.

public define int | DOES_COMPLETE = 8
This behavior is capable of reaching a COMPLETE state.

Detailed Description

An independent scripted scenario behavior (i.e. session rule).

The ScenarioBehavior class is the base class for a rule scriptlet. Rules are configurable scripted behaviors that can be added to a session in Surveyor. A session has its own property settings for each included rule.

The idea is that the session will pass in its custom data to the rule when it launches and the rule will be able to use that configuration data to do something useful for the session. The scope of what rule scriptlet can do is not very restrictive and very much left to the script programmer to do what they want.

Rule scripts differ from other scripted assets in that they do not have a specific game world item associated with them like a mesh for example. Rather, they exist as independent assets that consist of only script code and an icon. That being said, a rule script is considered an asset in its own right as it has a name, type and KUID like all other Trainz assets do.

The TRS2006 Sessions & Rules Guide (which will be released sometime late 2005) provides a comprehensive overview of how rules behave in a session as well as details on the Auran-authored rules. Understanding the flowcharts and logic of the various rules will be highly beneficial to those wishing to write their own rule scripts. Also note that the source code for all of the Auran rules is provided with this documentation.

See also:
ConditionalScenarioBehavior, PropertyObject, World.CreateBehavior(), World.GetBehaviors()

Member Function Documentation

public void ScenarioBehavior.AppendDependencies ( KUIDList io_dependencies )

Gets any asset dependencies that are specific to this rule instance.

This method is called by Trainz to determine the asset dependencies of this rule. Specifically, this is for listing dependencies on KUIDs that are stored within the session's saved properties data, as Trainz has no other way to know of these dependencies.

Parameters:
io_dependencies List of KUIDs to append this rule's dependencies to. You should add to this list and not replace/overwrite existing list items it may have.
See also:
KUIDList.AddKUID()

public native ScenarioBehavior [] ScenarioBehavior.GetChildBehaviors ( void )

Gets the child behaviors under this one (i.e. the ones immediately below this one in the Surveyor Rules Editor.

Returns :
Returns an array of this behavior's child behaviors.

public string ScenarioBehavior.GetDescription ( void )

Gets a short text description of this rule behavior.

This method is called by Trainz to get a piece of descriptive text of this particular rule instance to display next to the rule's icon in the Surveyor Edit Session window. A basic default implementation is provided but you will need to provide your own implementation if you want anything fancier like a rule description generated from the rule's configuration.

Returns :
The default ScenarioBehavior implementation of this method returns whatever the string table item named "description" for this rule's asset has, otherwise a blank string ("") is returned.

public native ScenarioBehavior ScenarioBehavior.GetParentBehavior ( void )

Gets the parent behavior of this behavior.

Returns :
Returns the parent behavior if any or null if this is a top-level behavior.

public Soup ScenarioBehavior.GetProperties ( void ) [inline]

Instructs this PropertyObject to put all of its current properties into a database to be returned.

This method is used to save the properties of a PropertyObject into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

When overriding this method to handle your own properties, always call through to the overridden parent by using inherited like this:

     public Soup GetProperties(void)
     {
       // start out with parent class properties
       Soup retSoup = inherited();

       // add your own properties to retSoup here...

       // return the complete properties database
       return retSoup;
     }

In the PropertyObject implementation, if a property handler is attached to this object and it has been set to have its properties saved, that handler's GetProperties() method will be called.

Note:
It is possible that in future versions of Trainz, parent methods like this one may have their implementation modified. By not calling through to the overridden parent, you risk your assets NOT WORKING in a future version of Trainz.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
HTMLPropertyHandler.GetProperties(), HTMLPropertyHandler.GetSavesProperties()

Reimplemented from PropertyObject.

public Soup ScenarioBehavior.GetProperties ( void )

Gets the current properties database of this behavior object.

This method is generally used in order to save a behavior as a session rule in Surveyor. ScenarioBehavior has it's own implementation so that the behavior's state flags can be saved in the returned database.

When saving the properties in custom behavior classes, the scriptlet programmer must explicitly call this ScenarioBehavior method so that the current behavior state flags can be saved and returned along with the other custom properties. This is done by using the inherited keyword. For example:

     public Soup GetProperties(void)
     {
       Soup soup = inherited();  // call overridden ScenarioBehavior.GetProperties()

       soup.SetNamedTag("MyCustomBehavior.dataproperty1", dataMember1);

       return soup;
     }

Note how inherited handles the return value of a called overridden method. As the flag settings are now in soup, we can now add our own data and return it.

Returns :
Returns a private descriptor for the current properties in use by this behavior.

Reimplemented from PropertyObject.

public Requirement [] ScenarioBehavior.GetRequirements ( void ) [inline]

Gets the requirements of this behavior.

This method is called by Trainz to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user. As this default implementation in ScenarioBehavior only returns an empty array, the scriptlet programmer must implement their own overridden version if they want their behavior rule to provide requirements data for waybills.

Note:
This method shouldn't be called on a ScenarioBehavior object that is paused.
Returns :
Returns an array of requirements this industry has. The default ScenarioBehavior class implementation returns an empty array.
See also:
ResourceRequirement

public int ScenarioBehavior.GetStateFlags ( void ) [inline]

Gets the current state flags of this behavior object.

Returns :
Returns the current state flags of this behavior.
See also:
Behavior State Flags

public bool ScenarioBehavior.IsComplete ( void )

Gets the completed state of the behavior.

Returns :
Returns true if this behavior is complete (i.e. the COMPLETE flag is set), false otherwise.

public bool ScenarioBehavior.IsPaused ( void ) [inline]

Determines if this behavior is paused.

Returns :
Returns true if this behavior is paused (i.e. the WAS_COMPLETE flag is set), false otherwise.

public void ScenarioBehavior.Pause ( bool pause ) [inline]

Pause or un-pause this behavior.

This method is called by Trainz to update the rule on its paused state and the programmer can implement their own version as needed. A behavior may be paused when Trainz is shutting down the session for instance.

It is through Pause() that the rule's actions are initiated. For instance, the rule is un-paused as the session is launched in Driver. From there, you can start a thread or call a method to perform what actions you want your rule to have.

Note:
As Pause() is called from native Trainz code, you CANNOT Sleep(), wait() or send messages in this method. This is why PostMessage() has to be used instead if a message needs to be sent.
Parameters:
pause Use true to pause this behavior, false to un-pause (start) it.

Reimplemented in ConditionalScenarioBehavior.

public void ScenarioBehavior.Reset ( void )

Called to completely reset this behavior.

This method clears the COMPLETE and WAS_COMPLETE flags.

public void ScenarioBehavior.SetComplete ( bool isComplete )

Sets the complete state of this behavior.

Parameters:
isComplete If true, the COMPLETE flag is set to indicate this behavior is complete.

public void ScenarioBehavior.SetProperties ( Soup soup ) [inline]

Instructs this PropertyObject to initialize its properties from the given database.

If the database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

When overriding this method to handle your own properties, always call through to the overridden parent by using inherited like this:

     public void SetProperties(Soup soup)
     {
       // call overridden parent with soup passed up to it
       inherited(soup);

       // your initialization goes here...
     }

In the PropertyObject implementation, if a property handler is attached to this object and it has been set to have its properties saved, that handler's SetProperties() method will be called.

Note:
It is possible that in future versions of Trainz, parent methods like this one may have their implementation modified. By not calling through to the overridden parent, you will ill be running the risk of having your assets NOT WORKING in a future version of Trainz.
Parameters:
soup Database to initialize this property object with.
See also:
HTMLPropertyHandler.SetProperties(), HTMLPropertyHandler.GetSavesProperties()

Reimplemented from PropertyObject.

Reimplemented in ConditionalScenarioBehavior.

public void ScenarioBehavior.SetProperties ( Soup soup )

Instructs this behavior object to re-initialize its data properties with the given database.

This method is called by Trainz to initialize a rule with custom data from a session. ScenarioBehavior has it's own implementation so that the behavior's state flags can be initialized from the database.

When initializing the properties in custom behavior classes, the scriptlet programmer must explicitly call this ScenarioBehavior method so that the saved behavior state flags in soup can be used to initialize the behavior. This is done by using the inherited keyword, for example:

     public void SetProperties(Soup soup)
     {
       inherited(soup);  // call overridden ScenarioBehavior.SetProperties()

       dataMember1 = soup.GetNamedTagAsInt("MyCustomBehavior.dataproperty1");
     }

Note how inherited accepts the arguments for the overridden method it is calling.

Parameters:
soup Database to initialize this behavior object with.

Reimplemented from PropertyObject.

Reimplemented in ConditionalScenarioBehavior.

void ScenarioBehavior.SetStateFlags | ( | int | flags,
 |  | bool | set
 | ) |

Sets the state of the specified flags for this behavior.

Parameters:
flags | State to set the flags to. Use the behavior state flags for this argument.
set | If true, the flags specified in the flags argument will be set, false to disabled them (i.e. switch off).
See also:
Behavior State Flags

public bool ScenarioBehavior.WasComplete ( void )

Gets the was-complete state of this behavior.

Returns :
Returns true if this behavior was complete (i.e. the WAS_COMPLETE flag is set), false otherwise.

The documentation for this class was generated from the following file:
  • ScenarioBehavior.gs


ScenarioStringTable Class Reference

List of all members.

Public Methods

public native StringTable Get ()

Detailed Description

ScenarioStringTable provides short-hand access to the current scenario's string table.

Note:
Because this class is scenario-specific, only use it when running a scenario!
See also:
Scenario, StringTable

Member Function Documentation

public native StringTable ScenarioStringTable.Get ( )

Gets the string table for the current scenario.

Returns :
Returns the string table for the current scenario.

The documentation for this class was generated from the following file:
  • stringtable.gs


ScenarioSupport Class Reference

List of all members.

Public Methods

public void | DoInstructions (void)
public thread void | ManageBrowser (void)
void | SelectCabinDCC (Train train)

Public Attributes

public bool | dccMode = true
Current control mode, true for DDC, false for Cabin Control. Is DCC by dafault.

Detailed Description

Some functionality common to scenarios.

This class is provided for backward compatibility and support of the UTC Scenarios and use is not really encouraged.

See also:
Browser, HTMLWindow, TrainUtil

Member Function Documentation

public void ScenarioSupport.DoInstructions ( void )

Load up HTML window on screen and display the clipboard instruction page.

Note:
It is assumed that an instructions.html file exists in the scenario's folder.

public thread void ScenarioSupport.ManageBrowser ( void )

Monitoring thread for instructions keystroke.

This thread that watches out for the script objectives keystroke message and displays the objectives sheet when the k key is pressed.

Note:
It is the responsibility of the script programmer to start this thread.

void ScenarioSupport.SelectCabinDCC ( Train train )

Select Cabin/DCC mode for the given train through a pop-up browser window.

Note:
This is a legacy method for scenario support. Use the Control Mode rule in a session to provide user-selection of the control mode.
Parameters:
train Train to select the control mode for.

The documentation for this class was generated from the following file:
  • common.gs


SceneryWithTrack Class Reference

Inheritance diagram for SceneryWithTrack:

MapObject Buildable Crossing Turntable Industry BaseIndustry BasePortal GenericIndustry GenericPassengerStation List of all members.

Public Methods

public native bool | ReEnter (int nodeId)
public native bool | InnerReEnter (int nodeId)
public native string | FindTriggerContainingNode (int nodeId, bool onlyInnerTrigger)
public native Track | GetTriggerTrack (string triggerName)
public native Track | GetAttachedTrack (string trackName)
public native JunctionBase[] | GetAttachedJunctions (void)
public void | InnerReEnterTrain (Train train)
public native bool | IsTrainInTriggers (Train train, bool onlyCheckInnerRadius)

Detailed Description

Parent class for scenery objects that have track such as industries and crossings.

Note:
The track in a scenery object as triggers, but these are not to be confused with regular trackside triggers. Scenery triggers and their attributes (name, radius etc.) are defined as part of the asset's configuration and cannot be altered or moved in Surveyor.
Messages used with a SceneryWithTrack object are:

Major | Minor | Source | Destination
"SceneryTrigger" | "Enter" | scenery with track | vehicle
"SceneryTrigger" | "InnerEnter" | scenery with track | vehicle
"SceneryTrigger" | "Stopped" | scenery with track | vehicle
"SceneryTrigger" | "InnerLeave" | scenery with track | vehicle
"SceneryTrigger" | "Leave" | scenery with track | vehicle
"Object" | "Enter" | vehicle | scenery with track
"Object" | "InnerEnter" | vehicle | scenery with track
"Object" | "Stopped" | vehicle | scenery with track
"Object" | "InnerLeave" | vehicle | scenery with track
"Object" | "Leave" | vehicle | scenery with track

See also:
Buildable, Crossing, Turntable, Industry, MapObject, JunctionBase

Member Function Documentation

public native string SceneryWithTrack.FindTriggerContainingNode | ( | int | nodeId,
 |  | bool | onlyInnerTrigger
 | ) |

Finds the name of the scenery trigger that has the specified object in it.

Parameters:
nodeId | Node ID of object to find (a vehicle for example). Use GetId() on the object to get its node ID.
onlyInnerTrigger | If true, the trigger name is returned only if the object is in the inner area of the trigger, otherwise the trigger name will be returned if the object is within 150 meters of the trigger.
Returns :
Returns the name of the scenery trigger the object specified by nodeId is within. Note that this is a scenery trigger, not a trackside Trigger.

public native JunctionBase [] SceneryWithTrack.GetAttachedJunctions ( void )

Gets the junctions attached to this scenery item.

Returns :
Returns a list of junctions that are attached to this scenery item.

public native Track SceneryWithTrack.GetAttachedTrack ( string trackName )

Gets the named track segment from this scenery object.

Parameters:
trackName Name of the track segment to get.
Returns :
Returns a Track object if the one specified by trackName exists, null otherwise.

public native Track SceneryWithTrack.GetTriggerTrack ( string triggerName )

Gets the track segment that the named scenery trigger is on.

Note:
A script exception will be thrown if a scenery trigger by the name of triggerName is not present in this scenery item.
Parameters:
triggerName Name of the trigger to get the track of.
Returns :
Returns the Track which has been specified for the named trigger. If triggerName does not specify a track, null is returned.

public native bool SceneryWithTrack.InnerReEnter ( int nodeId )

Causes the specified node to inner re-enter this scenery object.

Even if the object that nodeId represents is already in this scenery object, it will still be inner re-entered (i.e. not the default region defined by a 150 meter radius). As a result, a message of type ("Object", "InnerEnter") will be sent to this object from the nodeId object.

Parameters:
nodeId Node ID of object that re-enters this scenery object (usually a Vehicle). Use GetId() on the object to get its node ID.

public void SceneryWithTrack.InnerReEnterTrain ( Train train ) [inline]

Calls InnerReEnter() on all of the vehicles in the given train.

Parameters:
train Train to inner re-enter all the vehicles of.

public native bool SceneryWithTrack.IsTrainInTriggers | ( | Train | train,
 |  | bool | onlyCheckInnerRadius
 | ) |

Determines if any part of the given train is within any of this scenery item's triggers.

Parameters:
train | Train to check presence of.
onlyCheckInnerRadius | If true, train will only be checked for on the inner areas of the triggers, as defined by the trigger's radius. Otherwise false and the outer region of the triggers is used, which is defined by a radius of 150 meters.
Returns :
Returns true if train is on any of this scenery object's triggers, false otherwise.

public native bool SceneryWithTrack.ReEnter ( int nodeId )

Causes the specified node to re-enter this scenery object.

Even if the object that nodeId represents is already in this scenery object, it will still be re-entered. As a result, a message of type ("Object", "Enter") will be sent to this object from the nodeId object.

Parameters:
nodeId Node ID of object that re-enters this scenery object (usually a Vehicle). Use GetId() on the object to get its node ID.

The documentation for this class was generated from the following file:
  • SceneryWithTrack.gs


Schedule Class Reference

List of all members.

Public Methods

public bool | TakeJunction (string junctionName, int direction)
public bool | TakeTrackPermit (Track track)
public bool | CompleteJunctions ()
public bool | StopAtTrigger (string triggerName, float time)
public bool | OnTrigger (string triggerName, bool enter)
public bool | ReverseTrain (void)
public bool | StopTrain (float time)
public bool | DeleteTrain ()
public bool | PostMessage (int srcId, int dstId, string major, string minor, float time)
public bool | Announce (string state)
public bool | OnAnnounce (string state)
public bool | SetSignal (string signal, int state, string reason)
public bool | ResetTimetable ()
public bool | Custom (CustomCommand custom, int px, int py, int pz)
public bool | Custom (CustomCommand custom)
public void | Reset ()
Resets the schedule such that it has no commands and is now empty.

public bool | CoupleVehicle (Vehicle vehicle)
public bool | TakeJunction (JunctionBase junction, int direction)
public bool | StopAtScenery (string sceneryName)
public bool | StopAtTrackMark (TrackMark trackMark)
public bool | DriveThroughTrackMark (TrackMark trackMark)
public bool | DriveForever (void)

Public Attributes

public Command[] | commands = new Command[0]
Array of commands that make up this schedule.

public bool | releasePermitsWhenComplete = true
public bool | signalPassedAtDanger = false
Flag that indicates if the Train is currently handling a SPAD (Signal Passed at Red).

public DriverCharacter | notifyDriver
Driver character to notify if this schedule is stalled for long periods.

public bool | allowCoupling = false
Flag to enable/disable coupling on the train this schedule is running on.

public Train | limitCouplingTo
Train to limit coupling to.

Command Types

Types of commands that can be used in a schedule.

See also:
Command.command

public define int | CMD_TAKE_JUNCTION = 1
Command type for TakeJunction().

public define int | CMD_COMPLETE_JUNCTIONS = 2
Command type for CompleteJunctions().

public define int | CMD_STOP_AT_TRIGGER = 3
Command type for StopAtTrigger().

public define int | CMD_ON_TRIGGER = 4
Command type for OnTrigger().

public define int | CMD_REVERSE_TRAIN = 5
Command type for ReverseTrain().

public define int | CMD_STOP_TRAIN = 6
Command type for StopTrain().

public define int | CMD_DELETE_TRAIN = 7
Command type for DeleteTrain().

public define int | CMD_POST_MESSAGE = 8
Command type for PostMessage().

public define int | CMD_ANNOUNCE = 9
Command type for Announce().

public define int | CMD_ON_ANNOUNCEMENT = 10
Command type for OnAnnouncement().

public define int | CMD_SET_SIGNAL = 11
Command type for SetSignal().

public define int | CMD_RESET_TIMETABLE = 12
Command type for ResetTimetable().

public define int | CMD_CUSTOM = 13
Command type for Custom().

public define int | CMD_STOP_AT_SCENERY = 14
Command type for StopAtScenery().

public define int | CMD_DRIVE_FOREVER = 15
Command type for DriveForever().

public define int | CMD_TAKE_TRACK_PERMIT = 16
Command type for TakeTrackPermit().

public define int | CMD_COUPLE_VEHICLE = 17
Command type for CoupleVehicle().

public define int | CMD_STOP_AT_TRACKMARK = 18
Command type for StopAtTrackMark().

public define int | CMD_DRIVE_THROUGH_TRACKMARK = 19
Command type for DriveThroughTrackMark().

Detailed Description

Manages a list of commands in a train.

This class manages a list of commands for a Train. Use the methods in the schedule class to build a list of instructions/commands for your train.

A Schedule object lets you build a list of commands for a train (e.g. TakeJunction(), StopAtTrigger() etc.). You can also add your own custom commands by creating your own CustomCommand-derived class. Note that the custom commands will run in the Train.RunSchedule() thread.

Messages used by a Train that relate to its running of a Schedule are:
Major | Minor | Source | Destination
"Schedule" | "Complete" | train | broadcast
"Schedule" | "Abort" | train | train
"Schedule" | "Touch" | train | train

See also:
Command, CustomCommand, DriverCharacter, DriverCommands, DriverCommand, Train.RunSchedule()

Member Function Documentation

public bool Schedule.Announce ( string state )

Call Announce() on the static Timetable object. The train will then continue the schedule.

Returns :
Returns true if the command was successfully added to the schedule, false otherwise.
See also:
Timetable.Announce()

public bool Schedule.CompleteJunctions ( )

Place the train in autopilot mode and wait until it is has cleared all junctions that TakeJunction() has been called for.

Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.CoupleVehicle ( Vehicle vehicle ) [inline]

Drives the train to couple up with the given target vehicle.

This command does not drive the train to the vehicle, it is assumed the vehicle is located nearby and no junctions need to be navigated through. It will only succeed if the target vehicle is not running a schedule and isn't moving. As well as that, both the train the schedule is running on and vehicle must permit coupling.

Parameters:
vehicle Target vehicle to couple up with.
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.Custom ( CustomCommand custom )

Adds a custom command to the schedule.

Parameters:
custom Custom command to call Execute() on.
Returns :
Return true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.Custom | ( | CustomCommand | custom,
 |  | int | px,
 |  | int | py,
 |  | int | pz
 | ) |

Adds a custom command to the schedule.

Parameters:
custom | Custom command to call CustomCommand.Execute() on.
px | Argument to pass on to Execute()'s px parameter.
py | Argument to pass on to Execute()'s py parameter.
pz | Argument to pass on to Execute()'s pz parameter.
Returns :
Return true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.DeleteTrain ( )

Deletes this train, and in effect, stop the schedule.

Note:
There is no point in putting any more schedule commands after a delete.
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.DriveForever ( void ) [inline]

Adds a command to the schedule telling the train to keep driving forever.

Returns :
Always returns true.

public bool Schedule.DriveThroughTrackMark ( TrackMark trackMark ) [inline]

Stops the train at the specified trackside object.

Parameters:
trackMark Name of the scenery object to drive to. Must be a Buildable object (or any type that inherits from Buildable such as Industry).
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.OnAnnounce ( string state )

Wait for the named announcement from the static Timetable object.

Parameters:
state Timetable state to wait on an announcement from.
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.
See also:
Timetable.OnAnnouncement()

public bool Schedule.OnTrigger | ( | string | triggerName,
 |  | bool | enter
 | ) |

Place the train in autopilot mode and wait till it enters/leaves the specified trigger.

Parameters:
triggerName | Name of the trigger.
enter | If true, this command waits until the train enters the trigger and if false, the command waits for the train leaves the trigger.
Note:
You should not call this method if the train is required to pass through any junctions to reach the trigger. Use TakeJunction() for each junction the train is to pass through before reaching the trigger.
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.
See also:
Trigger, Navigate.OnTrigger()

public bool Schedule.PostMessage | ( | int | srcId,
 |  | int | dstId,
 |  | string | major,
 |  | string | minor,
 |  | float | time
 | ) |

Post a message of the specified type from srcId to dstId.

This method takes the same parameters as Router.PostMessage(). It will post the message and then continue the schedule.

Parameters:
srcId | Node ID of source object. Use GetId() on the object to get its node ID.
dstId | Node ID of destination object.
major | Message major type.
minor | Message minor type.
time | Amount of time to delay in seconds before sending the message.
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.ResetTimetable ( )

Reset the static timetable class.

Returns :
Returns true if the command was successfully added to the schedule, false otherwise.
See also:
Timetable.Reset()

public bool Schedule.ReverseTrain ( void )

Calls Turnaround() on the train, then continues the schedule.

Returns :
Returns true if the command was successfully added to the schedule, false otherwise.
See also:
Train.Turnaround()

public bool Schedule.SetSignal | ( | string | signal,
 |  | int | state,
 |  | string | reason
 | ) |

Set the signal state for the given named signal object.

Parameters:
signal | Name of signal object to set the state of.
state | State to set the signal to.
reason | Reason for signal state (mouse-over text appears).
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.StopAtScenery ( string sceneryName ) [inline]

Stops the train at the named scenery object.

Parameters:
sceneryName Name of the scenery object to drive to. Must be a Buildable object (or any type that inherits from Buildable such as Industry).
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.StopAtTrackMark ( TrackMark trackMark ) [inline]

Stops the train at the specified trackside object.

Parameters:
trackMark Name of the scenery object to drive to. Must be a Buildable object (or any type that inherits from Buildable such as Industry).
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.StopAtTrigger | ( | string | triggerName,
 |  | float | time
 | ) |

Place the train in autopilot mode and wait till it receives the ("Trigger", "Enter") message for the named trigger.

When the train reaches the trigger, it will stop, and then wait for time seconds. The schedule will then continue.

Parameters:
triggerName | Name of the trigger object.
time | Number of seconds to stall at the trigger for.
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.StopTrain ( float time )

Stop the train for the given amount of time. This is effectively a waiting command.

Parameters:
time Amount of time to stop for in seconds.
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

public bool Schedule.TakeJunction | ( | JunctionBase | junction,
 |  | int | direction
 | ) | [inline]

Place the train in autopilot mode through the given junction.

When the train reaches the given junction, it will wait until it is permitted on the track on the other side of the junction in the given direction. Once the train is permitted on the track, it will request permission for the junction. This is when the next command in the schedule will be executed.

Note:
When using this method, you MUST specify EVERY junction the train will encounter along your desired route. THIS IS IMPORTANT!
Note:
This method is for all junctions derived from JunctionBase, not just Trackside-derived junctions based on the Junction class.
Parameters:
junction | Junction to take the train through.
direction | Junction direction to take. Use one of the Junction States from the JunctionBase class for this parameter.
Returns :
Returns true if the command was successfully added to the schedule. false otherwise.

public bool Schedule.TakeJunction | ( | string | junctionName,
 |  | int | direction
 | ) |

Place the train in autopilot mode through the named junction.

When the train reaches the named junction, it will wait until it is permitted on the track on the other side of the junction in the given direction. Once the train is permitted on the track, it will request permission for the junction. This is when the next command in the schedule will be executed.

Note:
When using this method, you MUST specify EVERY junction the train will encounter along your desired route. THIS IS IMPORTANT!
Note:
This method is only for junctions of type Junction that are of the Trackside variety. Use TakeJunction(JunctionBase,int) for non-Trackside junctions.
Parameters:
junctionName | Name of the junction object.
direction | Junction direction to take. Use one of the Junction States from the JunctionBase class for this parameter.
Returns :
Returns true if the command was successfully added to the schedule. false otherwise.

public bool Schedule.TakeTrackPermit ( Track track )

Place train in autopilot mode through the given track.

Parameters:
track Track to get a permit for.
Returns :
Returns true if the command was successfully added to the schedule, false otherwise.

Member Data Documentation

public bool Schedule.releasePermitsWhenComplete = true

Flag that when set, ensures permits used during this schedule are released.

Note:
Setting this variable to false can significantly improve the schedule behavior. It's not really advisable for this value to be true unless absolutely necessary.
See also:
Permit.Release()

The documentation for this class was generated from the following file:
  • schedule.gs


ScheduleHistoryRec Class Reference

List of all members.

Detailed Description

This class is used privately and internally by Train and is not a Trainz API class intended for general use.

WARNING: THIS CLASS IS NOT TO BE USED OR RELIED ON.

The documentation for this class was generated from the following file:
  • train.gs


ShuntTrack Class Reference

List of all members.

Public Attributes

public Vehicle | vehicle
Vehicle to watch.

public Trigger | trigger
Trigger where the vehicle should be dropped off at.

public string | name
Readable user-friendly name for the vehicle.

Detailed Description

Tracking item used in shunting so a trigger and name can be associated with a vehicle.

See also:
TrainUtil

The documentation for this class was generated from the following file:
  • common.gs


Signal Class Reference

Inheritance diagram for Signal:

Trackside List of all members.

Public Methods

public native void | SetSignalState (int state, string reason)
public native void | LightSignal (bool show)
public native void | SetSignalStateEx (int state, string reason)
public native bool | GetSignalLit (void)

Public Attributes

Signal States

Defines the possible states for a track side signal.

For more complex states, the Extended Signal States are used.

See also:
Trackside.GetSignalState(), Signal.SetSignalState()

public define int | GREEN = 2
Signal is green (clear state).

public define int | YELLOW = 1
Signal is yellow (caution state).

public define int | RED = 0
Signal is red (stop state).

public define int | AUTOMATIC = -1
Signal state is automatically handled by Trainz.

Extended Signal States

Values specifying an extended signal state.

These are extra signal states for more specialist purposes that are defined in addition to the standard signal states.

Note:
Not all signals may necessarily support the extended signal states.
See also:
Trackside.GetSignalStateEx(), Signal.SetSignalStateEx()

public define int | EX_STOP = 0
Extended stop state. Signal is red.

public define int | EX_STOP_THEN_CONTINUE = 1
Alternative for stop - asset specific.

public define int | EX_CAUTION_LEFT = 2
The next junction is left and the next signal is red.

public define int | EX_CAUTION_RIGHT = 3
The next junction is right and the next signal is red.

public define int | EX_CAUTION = 4
The next signal is red.

public define int | EX_ADVANCE_CAUTION_LEFT = 11
The next junction is left and the next signal is yellow.

public define int | EX_ADVANCE_CAUTION_RIGHT = 12
The next junction is right and the next signal is yellow.

public define int | EX_ADVANCE_CAUTION = 7
The next signal is yellow.

public define int | EX_PROCEED_LEFT = 5
The next junction is left and the next signal is green.

public define int | EX_PROCEED_RIGHT = 6
The next junction is right and the next signal is green.

public define int | EX_PROCEED = 8
Extended proceed state. Signal is green.

public define int | EX_SLOW = 9
Proceed at slow speed.

public define int | EX_MEDIUM = 10
Proceed at medium speed.

Detailed Description

Provides control over track side signal objects.

Signals placed in Surveyor can be accessed in script code by calling Router.GetGameObject("signalName") and casting the returned reference to Signal.

Note:
The methods to get a signal's state are GetSignalState() and GetSignalStateEx() from the parent Trackside class.
Messages related to signals are:
Major | Minor | Source | Destination
"Signal" | "StateChanged" | signal | broadcast
"Train" | "Entered red signal" | signal | train
"Train" | "Entered red signal notify" | train | broadcast

See also:
Junction, TrackMark, Trigger, Trackside, Vehicle, Navigate.Signal(), SignalBehaviour, Trackside.GetSignalState(), Trackside.GetSignalStateEx()

Member Function Documentation

public native bool Signal.GetSignalLit ( void )

Determines if this signal is currently lit.

Returns :
Returns true if the signal is lit, false otherwise.

public native void Signal.LightSignal ( bool show )

Set the emissive state of the signal bulbs.

Note:
AI trains will still read the signal state, even if it is switched off.
Parameters:
show If true, the signal flare is switched on, otherwise false to turn it off.

public native void Signal.SetSignalState | ( | int | state,
 |  | string | reason
 | ) |

Set the signal state and its 'mouse over' reason.

Parameters:
state | One of the signal state values to set this signal to.
reason | Reason string to be displayed when a mouse cursor is placed over the signal.
See also:
Trackside.GetSignalState()

public native void Signal.SetSignalStateEx | ( | int | state,
 |  | string | reason
 | ) |

Set the extended state of this signal and its 'mouse over' reason.

Note:
Only certain signal assets support the extended signal functionality.
Parameters:
state | One of the extended signal state values to set this signal to.
reason | Reason string to be displayed when a mouse cursor is placed over the signal.
See also:
Trackside.GetSignalStateEx()

The documentation for this class was generated from the following file:
  • signal.gs


SignalBehaviour Class Reference

List of all members.

Public Methods

public void | SetDefaults ()
Initialize data members of this SignalBehaviour object to their default values.

Public Attributes

public InterfaceObjective | warning = new InterfaceObjective()
Warning to display in the interface as train approaches the signal.

public InterfaceAlert | runred = new InterfaceAlert()
Alert to display in the interface when a train runs past a red signal.

public InterfaceObjective | done = new InterfaceObjective()
Objective to display in the interface when a train has successfully navigated through the signal.

public bool | lockControlsOnRed = true
Flag indicating if controls of the train should be locked as the train passes a red signal (true) or not (false).

Detailed Description

Class that allows signals to have unique navigation properties.

See also:
Navigate.Signal(), StationBehaviour

The documentation for this class was generated from the following file:
  • navigate.gs


Soup Class Reference

Inheritance diagram for Soup:

GSObject List of all members.

Public Methods

public native int | CountTags (void)
public native string | GetNamedTag (string name)
public native Soup | GetNamedSoup (string name)
public native string | GetIndexedTagName (int index)
public native int | GetIndexForNamedTag (string name)
public native KUID | GetNamedTagAsKUID (string name)
public native int | GetNamedTagAsInt (string name)
public native int | GetNamedTagAsInt (string name, int defaultValue)
public native float | GetNamedTagAsFloat (string name)
public native void | RemoveNamedTag (string name)
public native void | SetNamedTag (string name, string value)
public native void | SetNamedTag (string name, float value)
public native void | SetNamedTag (string name, int value)
public native void | SetNamedTag (string name, KUID value)
public void | SetNamedTag (string name, bool value)
public bool | GetNamedTagAsBool (string name)
public bool | GetNamedTagAsBool (string name, bool defaultValue)
public native void | SetNamedSoup (string name, Soup value)
public native void | Copy (Soup value)
public native void | Clear (void)
Clears out this database so it is empty with no tags or data.

public native bool | IsLocked (void)

Detailed Description

Storage database for property settings.

The soup class is a database of items and is used in various places around Trainz as a way to load and save data. The most common usage would be in objects based on PropertyObject where Trainz calls the GetProperties() and SetProperties() methods to save and load object information.

All data items in the Soup are identified by the by a tag name. Items of different types are supported including floating point numbers, integers, strings, KUIDs and even a sub-database within the database (effectively allowing for a tree hierarchy of nested Soup databases).

See also:
Asset, KUID, PropertyObject, HTMLPropertyHandler

Member Function Documentation

public native void Soup.Copy ( Soup value )

Initializes this database to be a copy of the given one.

Parameters:
value Other database to initialize this one with.

public native int Soup.CountTags ( void )

Gets the amount of tags in this database.

Returns :
Returns the amount of tags in this database. This includes tags of other databases contained within this one.

public native string Soup.GetIndexedTagName ( int index )

Gets the name of the tag in this database for the given index.

Parameters:
index Index of the tag to get the name of.
Returns :
Returns the tag name that corresponds to index.

public native int Soup.GetIndexForNamedTag ( string name )

Gets the index reference value for the named tag in this database.

Parameters:
name Name of the tag to get the index for.
Returns :
Returns the index to the tag specified by name.

public native Soup Soup.GetNamedSoup ( string name )

Gets the named database from within this database.

Parameters:
name Name of the tag to get the value of.
Returns :
Returns the database matching the name tag.

public native string Soup.GetNamedTag ( string name )

Gets the value of the named tag as a string.

Parameters:
name Name of the tag to get the value of.
Returns :
Returns the value of name as a string.

public bool Soup.GetNamedTagAsBool | ( | string | name,
 |  | bool | defaultValue
 | ) | [inline]

Gets the named tag as a bool and returns defaultValue if the tag doesn't exist.

Parameters:
name | Name of the tag to get the value of.
defaultValue | Default value to return if the name tag doesn't exist.
Returns :
Returns the value of name as a bool if possible, defaultValue otherwise.

public bool Soup.GetNamedTagAsBool ( string name ) [inline]

Gets the named tag as a bool.

Parameters:
name Name of the tag to get the value of.
Returns :
Returns the value of the name tag as a bool.

public native float Soup.GetNamedTagAsFloat ( string name )

Gets the value of the named tag in this database as a float.

Parameters:
name Name of the tag to get as a float.
Returns :
Returns the value of the name tag as a float.

public native int Soup.GetNamedTagAsInt | ( | string | name,
 |  | int | defaultValue
 | ) |

Gets the value of the named tag in this database as an int.

Parameters:
name | Name of the tag to get as an int.
defaultValue | Default value if name doesn't have one.
Returns :
Returns the value of the name tag as an int.

public native int Soup.GetNamedTagAsInt ( string name )

Gets the value of the named tag in this database as an int.

Parameters:
name Name of the tag to get as an int.
Returns :
Returns the value of the name tag as an int.

public native KUID Soup.GetNamedTagAsKUID ( string name )

Gets the value of the named tag in this database as a KUID.

Parameters:
name Name of the tag to get as a KUID.
Returns :
Returns the value of the name tag as a KUID if possible, null otherwise.

public native bool Soup.IsLocked ( void )

Determines if this database is locked (i.e. read only).

Returns :
Returns true if this database is locked, false otherwise.

public native void Soup.RemoveNamedTag ( string name )

Removes the named tag from this database.

Parameters:
name Name of the tag to remove.

public native void Soup.SetNamedSoup | ( | string | name,
 |  | Soup | value
 | ) |

Sets the named tag in this database to the given database.

Parameters:
name | Name of the tag to set.
value | Other database to set the name tag to.
Note:
A tag value can also be a database itself. This allows hierarchical databases to be created.

public void Soup.SetNamedTag | ( | string | name,
 |  | bool | value
 | ) | [inline]

Sets the named tag to the given bool value.

Parameters:
name | Name of the tag to get the value of.
value | Boolean value to set name to.

public native void Soup.SetNamedTag | ( | string | name,
 |  | KUID | value
 | ) |

Sets the named tag in this database to the given KUID.

Parameters:
name | Name of the tag to set.
value | KUID value to set name to, may be null.

public native void Soup.SetNamedTag | ( | string | name,
 |  | int | value
 | ) |

Sets the named tag in this database to the given int value.

Parameters:
name | Name of the tag to set.
value | The int to set the name tag to.

public native void Soup.SetNamedTag | ( | string | name,
 |  | float | value
 | ) |

Sets the named tag in this database to the given float value.

Parameters:
name | Name of the tag to set.
value | The float to set the value of the name tag to.

public native void Soup.SetNamedTag | ( | string | name,
 |  | string | value
 | ) |

Sets the named tag in this database to the given string value.

Parameters:
name | Name of the tag to set.
value | String to set the value of the name tag to.

The documentation for this class was generated from the following file:
  • Soup.gs


SpecificVehiclesInfo Class Reference

Inheritance diagram for SpecificVehiclesInfo:

HTMLPropertyHandler DriversInfo VehicleTypesInfo List of all members.

Public Methods

public string | GetDescriptionHTML (void)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)
public bool | DoesMatch (Train train)
public bool | DoesMatchAnd (Train train)
public bool | DoesMatchAndExlcude (Train train)

Detailed Description

Property handler that defines a list of specific vehicle items to filter.

This handler is used as a sub-handler in TrainHelperInfo to define a filter based on specific vehicle instances. Internally, the specific vehicle instances are referred to by their game object name.

Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be seen in the \Trainz\scripts\TrainHelperInfo.gs script file.
See also:
DriversInfo, VehicleTypesInfo, TrainHelperInfo, VehicleDescriptor, VHISpecificVehiclesInfo

Member Function Documentation

public bool SpecificVehiclesInfo.DoesMatch ( Train train ) [inline]

Determines if the given Train contains one or more of the specific vehicles this handler has.

This method is used by TrainHelperInfo.DoesMatch() for the specific vehicles part of the train filter. It is public and can also be called by any script code and used alone if desired.

Parameters:
train Train to compare the vehicles of against this handler's definition.
Returns :
Returns true if train contains at least one of the vehicles that this handler specifies. Vehicles in train that are not in this handler's list will not cause failure. If train does not contain one single vehicle that this handler specifies, false is returned.
See also:
TrainHelperInfo.DoesMatch(), VehicleTypesInfo.DoesMatch(), DriversInfo.DoesMatch()

Reimplemented in VehicleTypesInfo, and DriversInfo.

public bool SpecificVehiclesInfo.DoesMatchAnd ( Train train ) [inline]

Determines if the given Train contains all of the specific vehicles this handler has.

This method is a stricter version of DoesMatch() that requires the given train to have all of the vehicles in it that this handler has. It is not used by TrainHelperInfo.DoesMatch() and is mainly provided as a convenience for use in child classes derived from TrainHelperInfo that may have stricter requirements.

Parameters:
train Train to compare the vehicles of against this handler's list.
Returns :
Returns true if train contains all of the vehicles that this handler specifies. Vehicles in train that are not in this handler's list will not cause failure. If train does not contain all of the vehicles that this handler specifies, false is returned.
See also:
VehicleTypesInfo.DoesMatchAnd(), DriversInfo.DoesMatchAnd()

Reimplemented in VehicleTypesInfo, and DriversInfo.

public bool SpecificVehiclesInfo.DoesMatchAndExlcude ( Train train ) [inline]

Determines if the given Train exclusively contains all of the specific vehicles this handler has.

This method is a stricter version of DoesMatchAnd() that requires the given train to have all of the vehicles in it that this handler has to the exclusion of all other vehicles. It is not used by TrainHelperInfo.DoesMatch() and is mainly provided as a convenience for use in child classes derived from TrainHelperInfo that may have stricter requirements.

Parameters:
train Train to compare the vehicles of against this handler's list.
Returns :
Returns true if train contains all of the vehicles that this handler specifies and no other vehicles. This means that for this method to pass train as being valid, it's vehicles must be the same as this handler's, although the ordering of vehicles does not have to match. If train has a vehicle that this handler's list doesn't, false will be returned.
See also:
VehicleTypesInfo.DoesMatchAndExlcude(), DriversInfo.DoesMatchAndExlcude()

Reimplemented in VehicleTypesInfo, and DriversInfo.

public string SpecificVehiclesInfo.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from HTMLPropertyHandler.

public Soup SpecificVehiclesInfo.GetProperties ( void ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from HTMLPropertyHandler.

public string SpecificVehiclesInfo.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string [] SpecificVehiclesInfo.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from HTMLPropertyHandler.

Reimplemented in VehicleTypesInfo, and DriversInfo.

public string SpecificVehiclesInfo.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string SpecificVehiclesInfo.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public void SpecificVehiclesInfo.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from HTMLPropertyHandler.

public void SpecificVehiclesInfo.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • TrainHelperInfo.gs


StationBehaviour Class Reference

List of all members.

Public Methods

public void | SetDefaults ()
Initialize data members of this StationBehaviour object to their default values.

Public Attributes

public InterfaceObjective | warning = new InterfaceObjective()
Objective to display on the interface as the user approaches the station so they know to slow down and prepare to stop.

public InterfaceAlert | overrun = new InterfaceAlert()
Alert to display on the interface if the user has overrun the station stop.

public InterfaceAlert | reverse = new InterfaceAlert()
Alert to display on the interface if the user reverses back over trigger def.

public InterfaceAlert | mwstopped = new InterfaceAlert()
Alert to display on the interface if the user moves the train while they are supposed to be stopped at the station.

public InterfaceObjective | done = new InterfaceObjective()
Objective to display on the interface after station has been successfully stopped at and navigated through.

public InterfaceObjective | stopped = new InterfaceObjective()
Objective to display on the interface when stopped at the station.

public string | major
Major message type to broadcast when the train has stopped.

public string | minor
Minor message type to broadcast when the train has stopped.

public float | delay
Delay in seconds of message broadcast when the train has stopped.

Detailed Description

Create your own StationBehaviour object to give stations unique navigation properties.

See also:
Navigate.Station(), SignalBehaviour

The documentation for this class was generated from the following file:
  • navigate.gs


Str Class Reference

List of all members.

Public Methods

public native void | TrimLeft (string s, string trim)
public native void | TrimRight (string s, string trim)
public void | Left (string s, int i)
public void | Right (string s, int i)
public void | Mid (string s, int first, int count)
public native int | ToInt (string s)
public native float | ToFloat (string s)
public native void | ToUpper (string s)
public native void | ToLower (string s)
public native string[] | Tokens (string s, string delimiters)
public native int | UnpackInt (string s)
public native float | UnpackFloat (string s)
public native string | UnpackString (string s)

Detailed Description

Static string helper class.

Str is a static class providing string utility functions not supported by the native string object.

Note:
GS is not a pure Object Oriented language. You cannot extend the native types such as int, float, string etc.
See also:
Interface, Math, StringTable, TrainUtil.AlreadyThereStr(), TrainUtil.GetUpTo()

Member Function Documentation

public void Str.Left | ( | string | s,
 |  | int | i
 | ) | [inline]

Sets s to its ith leftmost characters.

Parameters:
s | String to strip characters from.
i | Amount of leftmost characters in s to set s to.

public void Str.Mid | ( | string | s,
 |  | int | first,
 |  | int | count
 | ) | [inline]

Clips a string to the specified segment within it.

Parameters:
s | String to clip.
first | Character in s to start the new string from.
count | Amount of characters from first onwards to include in the new string.

public void Str.Right | ( | string | s,
 |  | int | i
 | ) | [inline]

Sets s to its ith rightmost characters.

Parameters:
s | String to strip characters from.
i | Amount of rightmost characters in s to set s to.

public native float Str.ToFloat ( string s )

Converts the given string to a floating point value.

Parameters:
s String to convert to a floating point value.
Returns :
Returns s as a floating point value if possible or 0.0 in the case of failure.

public native int Str.ToInt ( string s )

Converts the given string to an integer.

Parameters:
s String to convert to an integer.
Returns :
Returns s as an integer if possible or 0 in the case of failure.

public native string [] Str.Tokens | ( | string | s,
 |  | string | delimiters
 | ) |

Tokenizes a string using the given delimiters as separators.

Parameters:
s | String to tokenize.
delimiters | Delimiter to look for in s that defines separation characters for creating the tokens. If null or empty, s will be tokenized by white space.
Returns :
Returns an array of string tokens.

public native void Str.ToLower ( string s )

Converts the given string to all lowercase characters.

Parameters:
s String to convert to all lowercase.

public native void Str.ToUpper ( string s )

Converts the given string to all uppercase (i.e. capitalize all characters).

Parameters:
s String to convert to all uppercase.

public native void Str.TrimLeft | ( | string | s,
 |  | string | trim
 | ) |

Trim left characters from s while each character encountered is in trim.

Parameters:
s | String to trim left on.
trim | Characters to trim. If an empty string is passed in, white space will be trimmed.

public native void Str.TrimRight | ( | string | s,
 |  | string | trim
 | ) |

Trim right characters from s while each character encountered is in trim.

Parameters:
s | String to trim right on.
trim | Characters to trim. If an empty string is passed in, white space will be trimmed.

public native float Str.UnpackFloat ( string s )

Removes the front most floating point value from the given string.

Parameters:
s String to remove the front most floating point value from.
Returns :
Returns the front most floating point value in s.

public native int Str.UnpackInt ( string s )

Removes the front most integer value from the given string and returns it.

Parameters:
s String to remove the front most integer value from.
Returns :
Returns the front most integer value in s.

public native string Str.UnpackString ( string s )

Removes the front most string from the given one.

Parameters:
s String to remove front most string from. That is, the first section of this string before a white space is encountered. Any leading white space is removed from this string prior to parsing.
Returns :
Returns the removed front most string.

The documentation for this class was generated from the following file:
  • gs.gs


StringTable Class Reference

Inheritance diagram for StringTable:

GSObject List of all members.

Public Methods

public native string | GetLanguage ()
public native void | ClearParams ()
Resets the parameter list of this string table.

public native void | SetParam (int param, string text)
public native string | GetString (string str)
public string | GetString0 (string str)
public string | GetString1 (string str, string parm)
public string | GetString2 (string str, string parm0, string parm1)
public string | GetString3 (string str, string parm0, string parm1, string parm2)
public string | GetString4 (string str, string parm0, string parm1, string parm2, string parm3)
public string | GetString5 (string str, string parm0, string parm1, string parm2, string parm3, string parm4)
public string | GetString6 (string str, string parm0, string parm1, string parm2, string parm3, string parm4, string parm5)
public string | GetString7 (string str, string parm0, string parm1, string parm2, string parm3, string parm4, string parm5, string parm6)
public string | GetString8 (string str, string parm0, string parm1, string parm2, string parm3, string parm4, string parm5, string parm6, string parm7)
public string | GetString9 (string str, string parm0, string parm1, string parm2, string parm3, string parm4, string parm5, string parm6, string parm7, string parm8)
public string | GetString10 (string str, string parm0, string parm1, string parm2, string parm3, string parm4, string parm5, string parm6, string parm7, string parm8, string parm9)

Detailed Description

StringTable provides access to an asset's string table.

Any asset can have string table defined in its config.txt file. String tables are defined in a string-table section as follows:

   string-table
   {
     guardAnnounce  "All aboard for the train to %0 on platform %1"
   }

A string can have up to 10 parameters in the range of [0 - 9]. A string table parameter is identified by the percentage character ('%') followed by the parameter number. The methods in this class allow a string to be retrieved such that its parameters are substituted with the desired string.

For example, consider the guardAnnounce string listed above:

   StringTable guardStr = anAsset.GetStringTable();

   string announce = guardStr.GetString2("guardAnnounce", "Brisvegas", "3");

The announce string will be set to "All aboard for the train to Brisvegas on platform 3" as returned by GetString2().

One useful application of string tables is to use them to store segments of HTML code that can be heavily reused with the right parameters such as a generic table row for example. The Browser class also supports the use of string parameters through its Browser.SetParam() method.

See also:
Asset, Browser, HTMLWindow, Interface, ScenarioStringTable, Str, Asset.GetStringTable(), Constructors.GetTrainzStrings()

Member Function Documentation

public native string StringTable.GetLanguage ( )

Gets the current language version of Trainz.

Returns :
Returns the current language version of Trainz.

public native string StringTable.GetString ( string str )

Retrieves a string from the string table with no parameters.

Parameters:
str Name of the string to retrieve.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString0 ( string str ) [inline]

Helper function to retrieve a string with no parameters from the string table.

Parameters:
str Name of the string to retrieve.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString1 | ( | string | str,
 |  | string | parm
 | ) | [inline]

Helper function to retrieve a string with 1 parameter from the string table.

Parameters:
str | Name of the string to retrieve.
parm | String to replace the first parameter in the retrieved string with. First parameter is identified by %0 in the source string.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString10 | ( | string | str,
 |  | string | parm0,
 |  | string | parm1,
 |  | string | parm2,
 |  | string | parm3,
 |  | string | parm4,
 |  | string | parm5,
 |  | string | parm6,
 |  | string | parm7,
 |  | string | parm8,
 |  | string | parm9
 | ) | [inline]

Helper function to retrieve a string with 10 parameters from the string table.

Parameters:
str | Name of the string to retrieve.
parm0 | String to replace the first parameter in the retrieved string with.
parm1 | String to replace the second parameter in the retrieved string with.
parm2 | String to replace the third parameter in the retrieved string with.
parm3 | String to replace the fourth parameter in the retrieved string with.
parm4 | String to replace the fifth parameter in the retrieved string with.
parm5 | String to replace the sixth parameter in the retrieved string with.
parm6 | String to replace the seventh parameter in the retrieved string with.
parm7 | String to replace the eighth parameter in the retrieved string with.
parm8 | String to replace the ninth parameter in the retrieved string with.
parm9 | String to replace the tenth parameter in the retrieved string with.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString2 | ( | string | str,
 |  | string | parm0,
 |  | string | parm1
 | ) | [inline]

Helper function to retrieve a string with 2 parameters from the string table.

Parameters:
str | Name of the string to retrieve.
parm0 | String to replace the first parameter in the retrieved string with.
parm1 | String to replace the second parameter in the retrieved string with.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString3 | ( | string | str,
 |  | string | parm0,
 |  | string | parm1,
 |  | string | parm2
 | ) | [inline]

Helper function to retrieve a string with 3 parameters from the string table.

Parameters:
str | Name of the string to retrieve.
parm0 | String to replace the first parameter in the retrieved string with.
parm1 | String to replace the second parameter in the retrieved string with.
parm2 | String to replace the third parameter in the retrieved string with.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString4 | ( | string | str,
 |  | string | parm0,
 |  | string | parm1,
 |  | string | parm2,
 |  | string | parm3
 | ) | [inline]

Helper function to retrieve a string with 4 parameters from the string table.

Parameters:
str | Name of the string to retrieve.
parm0 | String to replace the first parameter in the retrieved string with.
parm1 | String to replace the second parameter in the retrieved string with.
parm2 | String to replace the third parameter in the retrieved string with.
parm3 | String to replace the fourth parameter in the retrieved string with.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString5 | ( | string | str,
 |  | string | parm0,
 |  | string | parm1,
 |  | string | parm2,
 |  | string | parm3,
 |  | string | parm4
 | ) | [inline]

Helper function to retrieve a string with 5 parameters from the string table.

Parameters:
str | Name of the string to retrieve.
parm0 | String to replace the first parameter in the retrieved string with.
parm1 | String to replace the second parameter in the retrieved string with.
parm2 | String to replace the third parameter in the retrieved string with.
parm3 | String to replace the fourth parameter in the retrieved string with.
parm4 | String to replace the fifth parameter in the retrieved string with.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString6 | ( | string | str,
 |  | string | parm0,
 |  | string | parm1,
 |  | string | parm2,
 |  | string | parm3,
 |  | string | parm4,
 |  | string | parm5
 | ) | [inline]

Helper function to retrieve a string with 6 parameters from the string table.

Parameters:
str | Name of the string to retrieve.
parm0 | String to replace the first parameter in the retrieved string with.
parm1 | String to replace the second parameter in the retrieved string with.
parm2 | String to replace the third parameter in the retrieved string with.
parm3 | String to replace the fourth parameter in the retrieved string with.
parm4 | String to replace the fifth parameter in the retrieved string with.
parm5 | String to replace the sixth parameter in the retrieved string with.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString7 | ( | string | str,
 |  | string | parm0,
 |  | string | parm1,
 |  | string | parm2,
 |  | string | parm3,
 |  | string | parm4,
 |  | string | parm5,
 |  | string | parm6
 | ) | [inline]

Helper function to retrieve a string with 7 parameters from the string table.

Parameters:
str | Name of the string to retrieve.
parm0 | String to replace the first parameter in the retrieved string with.
parm1 | String to replace the second parameter in the retrieved string with.
parm2 | String to replace the third parameter in the retrieved string with.
parm3 | String to replace the fourth parameter in the retrieved string with.
parm4 | String to replace the fifth parameter in the retrieved string with.
parm5 | String to replace the sixth parameter in the retrieved string with.
parm6 | String to replace the seventh parameter in the retrieved string with.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString8 | ( | string | str,
 |  | string | parm0,
 |  | string | parm1,
 |  | string | parm2,
 |  | string | parm3,
 |  | string | parm4,
 |  | string | parm5,
 |  | string | parm6,
 |  | string | parm7
 | ) | [inline]

Helper function to retrieve a string with 8 parameters from the string table.

Parameters:
str | Name of the string to retrieve.
parm0 | String to replace the first parameter in the retrieved string with.
parm1 | String to replace the second parameter in the retrieved string with.
parm2 | String to replace the third parameter in the retrieved string with.
parm3 | String to replace the fourth parameter in the retrieved string with.
parm4 | String to replace the fifth parameter in the retrieved string with.
parm5 | String to replace the sixth parameter in the retrieved string with.
parm6 | String to replace the seventh parameter in the retrieved string with.
parm7 | String to replace the eighth parameter in the retrieved string with.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public string StringTable.GetString9 | ( | string | str,
 |  | string | parm0,
 |  | string | parm1,
 |  | string | parm2,
 |  | string | parm3,
 |  | string | parm4,
 |  | string | parm5,
 |  | string | parm6,
 |  | string | parm7,
 |  | string | parm8
 | ) | [inline]

Helper function to retrieve a string with 9 parameters from the string table.

Parameters:
str | Name of the string to retrieve.
parm0 | String to replace the first parameter in the retrieved string with.
parm1 | String to replace the second parameter in the retrieved string with.
parm2 | String to replace the third parameter in the retrieved string with.
parm3 | String to replace the fourth parameter in the retrieved string with.
parm4 | String to replace the fifth parameter in the retrieved string with.
parm5 | String to replace the sixth parameter in the retrieved string with.
parm6 | String to replace the seventh parameter in the retrieved string with.
parm7 | String to replace the eighth parameter in the retrieved string with.
parm8 | String to replace the ninth parameter in the retrieved string with.
Returns :
Returns the named string retrieved from this string table if possible, an empty string otherwise.

public native void StringTable.SetParam | ( | int | param,
 |  | string | text
 | ) |

Sets a parameter to the given text.

Note:
See the class description for further details on string parameters.
Parameters:
param | Number of the parameter to set. Must be in the range of [0 - 9].
text | Text to substitute for the parameter specified by param.

The documentation for this class was generated from the following file:
  • stringtable.gs


Timetable Class Reference

List of all members.

Public Methods

public bool | Announce (string stateName, int srcId)
public bool | UnAnnounce (string stateName)
public void | Reset ()
Removes all announcements from the timetable.

public bool | OnAnnouncement (string stateName, int notifyId)
public bool | OnAnnouncement (GameObject runningThread, string stateName)

Detailed Description

Static timetable for storing current game information/stats etc.

The static Timetable class may be used to store the current game/timetable state. It allows you to announce that something has happened (i.e. a train has reach a certain location, such that other trains or events may wait on that announcement). A list of TimetableState objects is managed for the current states in the timetable. One way to understand this class is to think of it as a global 'notice board' that any script code can access.

As an example, trainB is waiting for trainA to pull into the station before it leaves, but trainB may not be at the station when trainA arrives, so trainA will announce the state of "TrainAatStation" when it arrives, which is what trainB will be waiting on.

When trainA arrives, it announces its arrival by posting the "TrainAatStation" state to the timetable:

   Timetable.Announce("TrainAatStation", trainA.GetId());

and for trainB to wait on the "TrainAatStaiton" annoucnement, the following code would be used:

   if(!Timetable.OnAnnouncement("TrainAatStation", me.GetId()))
   {
     on "Timetable", "TrainAatStation" : ;
   }

Note:
As this is a static class, you cannot create instances of it, only call its methods directly.
Note:
This class is mostly a legacy class from the SP3/UTC era of Trainz and does not have anything to do with the TrainTimetable class and its associated classes.
See also:
Schedule, TimetableState

Member Function Documentation

public bool Timetable.Announce | ( | string | stateName,
 |  | int | srcId
 | ) |

Announces a timetable state.

Parameters:
stateName | The event/state being announced.
srcId | Node ID of the GameObject setting the state. Use GetId() on the object to get its node ID.
Returns :
Returns true if stateName is being waited on, false otherwise.
See also:
Schedule.Announce()

public bool Timetable.OnAnnouncement | ( | GameObject | runningThread,
 |  | string | stateName
 | ) |

Waits on the given thread on the named state until that state has been announced.

Parameters:
runningThread | Current running thread.
stateName | Name of the timetable state to wait on.
Note:
This method waits until the announcement is made. This means runningThread will be not be able to move on until this method returns.
Returns :
Always returns true.
See also:
Schedule.OnAnnounce()

public bool Timetable.OnAnnouncement | ( | string | stateName,
 |  | int | notifyId
 | ) |

Determines if the named timetable state has been set.

This method returns true if the named timetable state has been set. If not, a message of type ("Timetable", stateName) will be posted to the object identified by notifyId when the state is announced.

Parameters:
stateName | Name of state/event to wait for.
notifyId | Node ID of the GameObject to be notified when the announcement of stateName is made. Use GetId() on the object to get its node ID.
Returns :
Returns true if stateName has been announced, false otherwise.
See also:
Schedule.OnAnnounce()

public bool Timetable.UnAnnounce ( string stateName )

Clears the named announcement from this timetable.

Parameters:
stateName Name of the event/state to remove.
Returns :
Returns true if stateName was found and removed from the timetable, false otherwise.

The documentation for this class was generated from the following file:
  • timetable.gs


TimetableState Class Reference

List of all members.

Public Attributes

public string | stateName
State name.

public int[] | observers
Node IDs of GameObjects that are observing this state.

public bool | state
Flag indicating if this state has been announced (true) or not (false).

Detailed Description

State of a timetable announcement.

The members of this class define the properties of an announcement in a Timetable.

Note:
This class is mostly a legacy class from the SP3/UTC era of Trainz and does not have anything to do with the TrainTimetable class and its associated classes.
See also:
Timetable

The documentation for this class was generated from the following file:
  • timetable.gs


Track Class Reference

Inheritance diagram for Track:

GameObject List of all members.

Public Methods

public native Permit | RequestPermitForTrain (Train train)
public native Permit | RequestPermit (GameObject obj, bool direction)
public native Permit | RequestPermit (GameObject obj)
public native int | GetTrackPriorityNumber (void)
public native void | SetTrackPriorityNumber (int i)

Detailed Description

Track defines an uninterrupted stretch of rail between two objects of interest (e.g. junctions, industries etc.).

This class is used to control the flow of trains from a scripting perspective. While somewhat analogous to the signaling system, the Track Graph is currently a completely distinct entity. The graph provides basic path finding and clear-route enforcement through the Permit system. The graph is currently used solely from the game scripts, primarily when a Train is running a Schedule. The game engine's autopilot functionality uses the signaling system only.

Tracks are not currently named; the only reliable way to obtain a Track reference is to be given it by the game engine during Schedule construction (see DriverCharacter) or from the source of a ("Train", "EnterTrack") message (which is sent to the Train concerned).

Messages that a Track object sends are:

Major | Minor | Source | Destination
"Train" | "EnterTrack" | track | train
"Train" | "InnerEnterTrack" | track | train
"Train" | "InnerLeaveTrack" | track | train
"Train" | "LeaveTrack" | track | train

All track sections and trains have a priority value in the range of [1 - 3] with the default value being 2. The priority value for tracks and trains is not a numerical scale of precedence, but rather a value to user for matching by the AI driver. This means the driver will try and take the train along track sections that have a priority equal to that of the train.

For example, a driver in control of a train that has a priority of 1 will try and take the train along track sections with a priority of 1 whenever possible. As the priorities don't work on a precedence basis, the driver in this example will not favor a track section with a priority of 2 over one with 3 and vice-versa.

Priority values are not a mechanism for specifying an explicit route for a driver to take and should not be thought of in that way. Rather, it is about being able to specify preferences that the driver will follow when possible.

See also:
DriverCharacter, GameObject, Junction, Permit, Schedule, Trackside, Train, Train.SetTrainPriorityNumber(), SceneryWithTrack, GSTrackSearch

Member Function Documentation

public native int Track.GetTrackPriorityNumber ( void )

Gets the priority of this section of track.

Returns :
Returns the priority number of this section of track. This value will be either 1, 2 or 3.
See also:
Train.GetTrainPriorityNumber()

public native Permit Track.RequestPermit ( GameObject obj )

Request an exclusive permit for the given object on this track.

Parameters:
obj Object to get the permit for. Can be a Train or Vehicle for example.
Returns :
Returns a permit for train to run on this track. Note that the permit may not be granted.
See also:
Permit.IsGranted(), Permit States

public native Permit Track.RequestPermit | ( | GameObject | obj,
 |  | bool | direction
 | ) |

Request a directional permit for the given object on this track.

Note:
The direction refers to the track's own direction, not that of a train or vehicle.
Parameters:
obj | Object to get the permit for. Can be a Train or Vehicle for example.
direction | Direction along this track that the permit for. Use true to request a permit in direction of the track, false for a permit in the direction opposite to that of the track.
Returns :
Returns a permit for obj to run in the specified direction on this track. Note that the permit may not be granted.
See also:
Permit.IsGranted(), Permit States

public native Permit Track.RequestPermitForTrain ( Train train )

Request a permit for the given train to drive on this stretch of track.

Parameters:
train Train to get the permit for.
Returns :
Returns a permit for train to run on this track. Note that the permit may not be granted, so train isn't guaranteed a permit.
See also:
Permit.IsGranted(), Permit States

public native void Track.SetTrackPriorityNumber ( int i )

Sets the priority of this section of track.

Note:
Changing the priority of the track won't affect existing trains under driver control immediately. It will only take affect when the driver restarts a new schedule.
Parameters:
i Priority value to assign to this track. Must be either 1, 2 or 3.
See also:
Train.SetTrainPriorityNumber()

The documentation for this class was generated from the following file:
  • Track.gs


TrackLoadInfo Class Reference

List of all members.

Public Attributes

public string | trackName
Name of the track in the station.

public bool | trainLeftSide
Indicates if the platform is on the left (true) or right (false) side of the train.

public int | platformIndex = -1
Index value for the platform. This follows the general convention of 0 being the index to platform 1 etc.

Detailed Description

Defines the track and side of the vehicle where passengers can get on and off a train.

This class is used as the return value of the GetTrackAndSide() method in GenericPassengerStation which you must implement if using that class for your station.

See also:
GenericPassengerStation.GetTrackAndSide()

The documentation for this class was generated from the following file:
  • GenericPassengerStation.gs


TrackMark Class Reference

Inheritance diagram for TrackMark:

Trackside List of all members.

Detailed Description

Directional location marker placed on track in Surveyor used to position objects like Train consists on the track.

Track marks placed in Surveyor can be accessed in script code by calling Router.GetGameObject("trackmarkName") and casting the returned reference to TrackMark.

Note:
There are no methods in this class. See the parent Trackside class for details of supported methods that can be used with a TrackMark.
Messages used by a TrackMark object are:

Major | Minor | Source | Destination
"TrackMark" | "Enter" | track mark | train
"TrackMark" | "Stopped" | track mark | train
"TrackMark" | "Leave" | track mark | train
"Object" | "Enter" | train | track mark
"Object" | "Stopped" | train | track mark
"Object" | "Leave" | train | track mark

See also:
Junction, Signal, Trackside, Trigger, Vehicle, World.CreateTrain(KUID[],TrackMark,bool)

The documentation for this class was generated from the following file:
  • trackmark.gs


Trackside Class Reference

Inheritance diagram for Trackside:

MapObject Junction Signal TrackMark Trigger Vehicle Locomotive List of all members.

Public Methods

public native Permit | RequestTrackPermit (bool dir, GameObject owner)
public Permit | RequestTrackPermit (bool dir)
public native bool | ReEnter (int nodeId)
public native bool | InnerReEnter (int nodeId)
public native int | GetSignalState (void)
public native int | GetSignalStateEx (void)
public native Track | GetTrack (void)
public native float | GetSpeedLimit (void)
public native void | SetSpeedLimit (float limit)
public native GSTrackSearch | BeginTrackSearch (bool direction)

Detailed Description

A track side item such as a junction, signal, track mark, trigger or vehicle.

This class is a parent class for trackside items. Junction, Signal, TrackMark, Trigger and Vehicle are all child classes of Trackside. Functionality generic to all trackside items including methods to obtain Permits are provided in this class.

Although more specialised trackside items like signals and junctions are catered for with appropriate child classes, there is no child class for speed board items. GetSpeedLimit() can be used to determine weather a Trackside object is a speed board or not.

Trackside items may be placed in Surveyor and retrieved in script code. To retrieve a trackside item, use Router.GetGameObject("itemName") and cast the returned reference to Trackside.

See also:
Junction, Signal, TrackMark, Trigger, Vehicle, MapObject, GSTrackSearch, Permit, SceneryWithTrack, Track

Member Function Documentation

public native GSTrackSearch Trackside.BeginTrackSearch ( bool direction )

Begins a track search in the specified direction from this trackside object.

This method starts a search down the track from this trackside item in the specified direction. An interface is returned allowing the programmer to search for any trackside objects that exist along the track.

Even though the search crosses track sections and separate splines, it will come to end when the line ends or an obstacle is encountered such as a junction set against the route or a turntable for example.

Parameters:
direction Direction to perform the search in. This direction value is based on the facing direction of this trackside item (which is relative to the direction of the Track section it is located on). Use true to search in the facing direction of this trackside item, false to search in the opposite direction.
Returns :
Returns a GSTrackSearch object which is an interface that allows further trackside items to be discovered in the specified direction.

public native int Trackside.GetSignalState ( void )

Gets the current color state of a signal.

Returns :
Returns either GREEN, YELLOW or RED. This method will not return AUTOMATIC.
See also:
Signal.SetSignalState(), Signal.SetSignalStateEx()

public native int Trackside.GetSignalStateEx ( void )

Gets the extended state of a signal.

See the Extended Signal States section in Signal for details on the various extended signal states.

Returns :
Returns the extended signal state for this signal.
See also:
Signal.SetSignalState(), Signal.SetSignalStateEx()

public native float Trackside.GetSpeedLimit ( void )

Gets the speed limit associated with this trackside object.

If this trackside item is a speed board, the speed limit of it will be returned.

Returns :
Returns the speed limit of this trackside item in MPS (metres per second) if it is a valid speed board. If this trackside item is not a speed board, a value less than or equal to 0.0 is returned.

public native Track Trackside.GetTrack ( void )

Gets the Track segment that this trackside item is located on.

Returns :
Returns the track segment that this trackside item is located on.

public native bool Trackside.InnerReEnter ( int nodeId )

Sends a new ("Object", "InnerEnter") message to this trackside object from the specified train.

Parameters:
nodeId Train's node ID that may be found by using GetId().
Returns :
Returns true if the train identified by nodeId is in the trigger and the message was sent, false otherwise.

public native bool Trackside.ReEnter ( int nodeId )

Sends a new ("Object", "Enter") message to this trackside object from the specified train.

Parameters:
nodeId Train's node ID that may be found by using GetId().
Returns :
Returns true if the train identified by nodeId is in the trigger and the message was sent, false otherwise.

public Permit Trackside.RequestTrackPermit ( bool dir ) [inline]

Gets a permit for the track segment on which this trackside item lies.

Parameters:
dir Direction required by the permit.
Returns :
Returns a Permit object, which may or may not be granted.

public native Permit Trackside.RequestTrackPermit | ( | bool | dir,
 |  | GameObject | owner
 | ) |

Gets a permit for the track segment on which this trackside item lies.

Parameters:
dir | Direction required by the permit.
owner | Object which 'owns' the permit, and which is sent any relevant messages.
Returns :
Returns a Permit object, which may or may not be granted. Currently, a null result may occur if the trackside object is not on a track.

public native void Trackside.SetSpeedLimit ( float limit )

Sets the speed limit associated with this trackside object.

This method allows the speed limit of a trackside item that is a speed board to be changed. Using this method for a variable speed limit sign is not fully supported and we don't guarantee its behavior. It is generally best not to use or rely on this method.

Parameters:
limit Speed limit value expressed in MPS (meters per second). Use a value <= 0 if you don't want this trackside item to impose a speed limit.

The documentation for this class was generated from the following file:
  • trackside.gs


Train Class Reference

Inheritance diagram for Train:

GameObject List of all members.

Public Methods

public native Vehicle[] | GetVehicles (void)
public native Locomotive | GetFrontmostLocomotive (void)
public native void | SetAutopilotMode (int controlMode)
public native int | GetAutopilotMode (void)
public native bool | GetAllowsUserControl (void)
public void | SetPhysicsMode (int physicsMode)
Deprecated - this method has never worked and is no longer required.

public native int | GetPhysicsModel (void)
Deprecated as SetPhysicsMode() doesn't work, this method is no longer required.

public native void | EnablePhysics (bool enable)
public native void | ShowInConsistMenu (bool show)
public void | SetCouplingMask (int mask)
public void | SetDecouplingMask (int mask)
public native float | GetVelocity (void)
public native float | GetSmoothedVelocity (void)
public native bool | IsStopped ()
public native void | SetVelocity (float vel)
public native void | AddVelocity (float vel)
public void | SetAdhesion (float adhesion)
Obsolete, do not use.

public native void | SetDCCThrottle (float throttle)
public native float | GetDCCThrottle (void)
public void | SetHandBrake (bool state)
public native void | StopTrainGently (void)
Causes the train to come to a gentle stop by reducing the throttle to zero over a short time interval.

public native void | SetManualThrottle (int throttleNotch)
public native void | SetReverser (int reverserDirection)
public native void | SetTrainBrakes (float brakeMode)
public native float | GetTrainBrakes (void)
public native void | SetDynamicBrakeMode (int dynamicBrakeMode)
public native bool | GetHeadlightState (void)
public native void | SetHeadlightState (bool lightsOn)
public native int | GetPantographState (void)
public native void | SetPantographState (int state)
public native void | SoundHorn (void)
public native void | SetBail (void)
Sets the bail control as depressed for a short period.

public native MapObject[] | TrackSearch (bool dir, float distance)
public native void | Derail (void)
Purposely derails this train.

public native void | Turnaround (void)
public native void | SetAdvisoryLimit (float speed)
public native void | SetFloatingLimit (float delta, bool enable)
public native float | GetSpeedLimit (void)
public native float | GetAdvisoryLimit (void)
public native int | GetTrackmarkDirection (TrackMark mark)
public void | Init (void)
public native void | SetTrainPriorityNumber (int priority)
public native int | GetTrainPriorityNumber (void)
public native void | SetAutopilotTarget (Buildable obj, string triggerName)
public native void | SetAutopilotTarget (Trackside obj)
public native void | SetAutopilotTarget (Track track)
public native void | SetAutopilotTarget (JunctionBase junction)
public native void | SetAutopilotTargetMinimumSpeed (float speed)
public native void | SetAutopilotTargetMinimumDistance (float distance)
public native bool | GetAutopilotTargetSlowing (void)
public native Vehicle | GetMaximumCouplingStressVehicle (void)
public thread void | RunSchedule (Schedule schedule, bool loop, float delay)
public void | StopSchedule ()
Stops running the current schedule.

public bool | IsScheduleRunning ()
public void | UpdateScheduleWindow (string vehicleName)
public native string | GetTrainDisplayName (void)
public native DriverCharacter | GetActiveDriver (void)
public void | UpdateViewDetailsLocomotive (void)
Called to update the view details window when something on the loco has changed like a driver.

public bool | HasTrainTimetable (void)
public void | SetTrainTimetable (TrainTimetable timetable)
public void | ClearTrainTimetable (ScenarioBehavior rule)
public TrainTimetable | GetTrainTimetable (void)
public native JunctionBase | GetAutopilotStopJunctionBase (void)
public native Train | GetAutopilotStopTrain (void)
public Track | GetLastVisitedTrack (void)
public bool | IsTrainBusy (void)
public void | IncTrainBusy (void)
public void | DecTrainBusy (void)
public bool | WasRunScheduleSuccessful (void)
public Permit[] | TakePermitOnTrack (bool direction)
public void | ReleaseTrackPermits (Permit[] permits)
public void | StopScheduleAndWait ()
public bool | IsStillInJunction (JunctionBase jn)
public bool | HasReachedJunctionInnerRadius (JunctionBase jn)
public native bool | TestTrackPermit (Permit trackPermit, bool innerOnly)
public Buildable | GetLastVisitedBuildable (void)
public void | SetLastVisitedBuildable (Buildable b)
public Industry | GetLastVisitedIndustry (void)
public bool | MapObjectIsInFront (MapObject obj, float maxRange)
public bool | TracksideIsInFront (Trackside obj, float maxRange)
public void | ToggleScheduleWindow (void)
public bool | IsScheduleWindowVisible (void)
public void | UpdateViewDetails (void)
Updates the view details window (created by ViewDetails()) for this train.

public void | UpdateViewDetails (Vehicle vehicle)
public void | ViewDetails (Vehicle vehicle)
public void | ToggleViewDetailsWindow (void)
public bool | IsViewDetailsVisible (void)

Public Attributes

public Browser | timeTableInfo
Browser window to display timetable info for this train in.

Train Control Modes

Values that specify the modes of control a train can be in.

By setting the control mode of a train with SetAutopilotMode(), the user's ability to control the train can be restricted to various levels.

See also:
Train.GetAutopilotMode(), Train.GetAllowsUserControl(), Train.SetAutopilotMode()

public define int | CONTROL_MANUAL = 1
User controls train, script can change settings.

public define int | CONTROL_AUTOPILOT = 2
Autopilot controls train.

public define int | CONTROL_AUTOMANUAL = 3
User controls train, autopilot takes over when train is not currently 'focused'.

public define int | CONTROL_SCRIPT = 4
Only the script can control train.

Physics Modes

Specifies the physics mode of a train.

Note:
As SetPhysicsMode() never worked and isn't supported, these constants are now redundant.
See also:
Train.GetPhysicsModel(), Train.SetPhysicsMode()

public define int | PHYSICS_DCC = 1
DCC physics.

public define int | PHYSICS_SIMULATION = 2
Simulation physics.

Reverser Traction Modes

Traction modes that a train's reverser lever can be in.

See also:
Train.SetReverser(), Train.Turnaround()

public define int | TRACTION_FORWARD = 2
Reverser is in currently forward.

public define int | TRACTION_NEUTRAL = 1
Reverser is neutral.

public define int | TRACTION_REVERSE = 0
Reverser is currently in reverse.

Train Brake Modes

Specifies the state of the train brakes.

See also:
Train.SetTrainBrakes()

public define float | TRAIN_BRAKE_RELEASE = 0.0
Train brakes are released.

public define float | TRAIN_BRAKE_INITIAL = 1.0
Train brakes are in initial mode.

public define float | TRAIN_BRAKE_APPLICATION = 2.0
Train brakes are applied.

public define float | TRAIN_BRAKE_HANDLE_OFF = 3.0
Train brake handle is off.

public define float | TRAIN_BRAKE_EMERGENCY = 4.0
Train brakes are in emergency stop position.

public define float | TRAIN_BRAKE_LAP = 5.0
Train brakes are in the lap position. Not available on all trains.

Dynamic Brake States

States the dynamic brakes of a train can be in.

See also:
Train.SetDynamicBrakeMode()

public define int | DYNAMIC_BRAKE_TRACTION = 0
Dynamic brakes in traction mode.

public define int | DYNAMIC_BRAKE_NEUTRAL = 1
Dynamic brakes are neutral.

public define int | DYNAMIC_BRAKE_BRAKE = 2
Dynamic brakes are on.

Found Results

Results codes for a search indicating the found sate.

See also:
Train.GetTrackmarkDirection()

public define int | RESULT_NONE = 0
Item not found.

public define int | RESULT_FORWARD = 1
Item is in front of the train.

public define int | RESULT_INSIDE = 2
Item is in the train (i.e. on track the train is on, not literally inside the train).

public define int | RESULT_BACKWARD = 3
Item is behind the train.

Measurement Conversion Multipliers

Measurement conversion multiplier values.

See also:
Train.GetVelocity(), Vehicle.GetVelocity()

public define float | KPH_TO_MPS = 0.278
KPH (kilometers per hour) to MPS (meters per second) conversion multiplier.

public define float | MPH_TO_MPS = 0.447
MPH (miles per hour) to MPS (meters per second) conversion multiplier.

public define float | MPH_TO_KPH = 1.609
MPH (miles per hour) to KPG (kilometers per hour) conversion multiplier.

Detailed Description

A train is a collection of vehicles in Driver.

They are one entity and may be controlled using this class. A train is placed on a track by using World.CreateTrain() or World1.CreateTrain().

Trainz will automatically create a Train object for each consist that appears in the game such as when an existing train is uncoupled and split up into two separate consists.

Messages sent/received by a Train game object are:

Major | Minor | Source | Destination
"Train" | "Over speed limit" | train | broadcast
"Train" | "Under speed limit" | train | broadcast
"Train" | "Over advisory speed limit" | train | broadcast
"Train" | "Under advisory speed limit" | train | broadcast
"Train" | "Over floating speed limit" | train | broadcast
"Train" | "Under floating speed limit" | train | broadcast
"Train" | "StoppedMoving" | train | train
"Train" | "StartedMoving" | train | train
"Train" | "Entered red signal" | signal | train
"Train" | "Entered red signal notify" | train | broadcast
"Train" | "EnterTrack" | track | train
"Train" | "InnerEnterTrack" | track | train
"Train" | "InnerLeaveTrack" | track | train
"Train" | "LeaveTrack" | track | train
"Train" | "SlowingForTarget" | train | train
"Schedule" | "Complete" | train | broadcast
"Schedule" | "Abort" | train | train
"Schedule" | "Touch" | train | train

See also:
DriverCharacter, GameObject, Locomotive, Schedule, Track, TrackMark, TrainTimetable, Vehicle, World, Track.RequestPermitForTrain(), Vehicle.GetMyTrain()

Member Function Documentation

public native void Train.AddVelocity ( float vel )

Instantly modify the Train's velocity.

Parameters:
vel Velocity to add to current train velocity (in meters per second.)

public void Train.ClearTrainTimetable ( ScenarioBehavior rule )

Clears the train timetable of this train.

By clearing the TrainTimetable from this train, it is now safe again to set another TrainTimetable for this train through SetTrainTimetable().

This method MUST only be called by the rule which called SetTrainTimetable() in the first place.

Note:
It is the responsibility of the caller to post a ("TrainTimetable", "Touch") message after calling this function.
Parameters:
rule Rule that called SetTrainTimetable() on this train.

public void Train.DecTrainBusy ( void )

Decrements this train's busy count.

If this train is not busy, this method will do nothing as the busy count is already 0. See IsTrainBusy() for details on the train busy count.

public native void Train.EnablePhysics ( bool enable )

Enable/disables physics calculations on this train.

Note:
Turning physics off for scenic rolling stock that the player cannot interact with can boost performance. There is no point in doing physic calculations for idle rollingstock.
Parameters:
enable If true, physics calculations are enabled for this train, false to disable.

public native DriverCharacter Train.GetActiveDriver ( void )

Gets the active driver of this train.

Note:
Note that there may be more than one driver on a train but there is only one active driver and an individual Locomotive may only have on driver assigned to it.
Returns :
Returns the driver who is currently active in this train, null otherwise.

public native float Train.GetAdvisoryLimit ( void )

Gets the current script-set advisory speed limit.

Returns :
Returns the current script set advisory limit.

public native bool Train.GetAllowsUserControl ( void )

Determines if this train allows the user to control it directly through DCC or Cabin interfaces.

Returns :
Returns true if this train allows the user to control it directly, false otherwise.

public native int Train.GetAutopilotMode ( void )

Gets the current control mode of this train.

Returns :
Returns the control mode this train is currently in.
See also:
Train Control Modes

public native JunctionBase Train.GetAutopilotStopJunctionBase ( void )

Find the junction that has stopped the autopilot from taking this train any further.

If the autopilot is stopped because of the setting of a junction, this method will find and return the junction in question.

Returns :
Returns the junction that is causing the autopilot to stop if any, null otherwise.

public native Train Train.GetAutopilotStopTrain ( void )

Find the train that has stopped the autopilot from taking this train any further.

If the autopilot has stopped the train because of another train, this method will find and return the other train in question.

Returns :
Returns the other train that has caused the autopilot on this one to stop..

public native bool Train.GetAutopilotTargetSlowing ( void )

Determines if this train's autopilot is slowing down for its target.

Returns :
Returns true if the autopilot is slowing down for its target destination, false otherwise.

public native float Train.GetDCCThrottle ( void )

Gets the DCC throttle setting for this train when using DCC physics.

Returns :
Returns the current DCC throttle setting of this train. This value will be in the range of [-1.0 - 1.0] where -1.0 is full throttle in reverse, 0.0 is stop/neutral and 1.0 is full throttle forward.

public native Locomotive Train.GetFrontmostLocomotive ( void )

Gets the front most locomotive in this train.

Returns :
Returns the front most locomotive in this train.

public native bool Train.GetHeadlightState ( void )

Gets the on/off state of the headlights in this train.

Note:
When the headlights of a train are switched on, only the front locomotive's headlights will actually be visibly switched on and affect the world in Trainz.
Returns :
Returns true if the headlights of this train are switched on, false otherwise.

public Buildable Train.GetLastVisitedBuildable ( void ) [inline]

Gets the last Buildable object this train visited.

Note:
The train may or may not still be within that object's trigger range.
Returns :
Returns the Buildable object this train most recently visited, null if this train hasn't visited one yet.

public Industry Train.GetLastVisitedIndustry ( void ) [inline]

Gets the last industry object this train visited.

This method is identical to GetLastVisitedBuildable() except it casts the last visited Buildable object to Industry and then returns it.

Note:
The train may or may not still be within that object's trigger range.
Returns :
Returns the Industry object this train most recently visited, null if this train hasn't visited one yet.

public Track Train.GetLastVisitedTrack ( void ) [inline]

Gets thge last piece of Track this train visited.

Returns :
Returns the Track statement that this train last visited. Note that this may be null.

public native Vehicle Train.GetMaximumCouplingStressVehicle ( void )

Gets the Vehicle in this consist that is experiencing the greatest level of coupling stress.

Returns :
Returns the Vehicle in this consist that is experiencing the greatest level of coupling stress.
See also:
Vehicle.GetCouplingStress()

public native int Train.GetPantographState ( void )

Gets the state of the pantographs of the electric locomotives in this train.

Note:
The pantographs can only be in one of four states and what these states are is dependents on the asset. Obviously, this method will be of little use on a train that has no electric locomotives.
Returns :
Returns the current pantograph state of this train. Will be in the range of [0 - 3].

public native float Train.GetSmoothedVelocity ( void )

Gets the current velocity of this train.

Provides a smoothed velocity, intended for human consumption. If you require an accurate velocity readout for physics operations, use Train.GetVelocity() instead.

Returns :
Returns the current velocity of the train in meters per second.
See also:
Vehicle.GetVelocity(), Measurement Conversion Multipliers

public native float Train.GetSpeedLimit ( void )

Gets the current sign posted speed limit.

Note:
The speed limit is dependent on the trackside signs placed in Surveyor as well as the direction of the train. A default value applies to track that isn't sign posted.
Returns :
Returns the current speed limit for the track this train is travelling on.

public native int Train.GetTrackmarkDirection ( TrackMark mark )

Gets the direction of the given track mark relative to this train.

Parameters:
mark Track mark to get the direction of relative to this train.
Returns :
Returns the direction of the track mark relative to this train.
See also:
Found Results

public native float Train.GetTrainBrakes ( void )

Gets the current state of this train's brakes.

Returns :
Returns one of the train brake state constants to indicate the current state of this train's brakes.
See also:
Train Brake States

public native string Train.GetTrainDisplayName ( void )

Gets a localised display name of this train.

Returns :
Returns the localised display name of this train. This will be a name Trainz has created for the consist such as "Consist 0" for example and will match the consist label shown in the Minimap view.

public native int Train.GetTrainPriorityNumber ( void )

Gets the priority of this train.

Returns :
Returns the priority number of this section of track. This value will be either 1, 2 or 3. See the Track class description or SetTrainPriorityNumber() for a detailed explanation of priority values.
See also:
Track.GetTrackPriorityNumber()

public TrainTimetable Train.GetTrainTimetable ( void )

Gets the TrainTimetable this train is currently running.

Returns :
Returns the TrainTimetable currently attached to this train if any, null otherwise.

public native Vehicle [] Train.GetVehicles ( void )

Gets the vehicles in this train.

Note:
Index 0 of the returned vehicles array is always the first vehicle of the train, which is dependent on the train's forward direction. The forward direction of the train can be changed during play and may not necessarily correspond to the train's visual appearance.
Returns :
Returns an array of vehicles that define this train.

public native float Train.GetVelocity ( void )

Gets the current velocity of this train.

This function provides the instantaneous velocity for vehicles in this train, which is good for physics calculations but not good for human-readable display. If you want human-readable display, use Train.GetSmoothedVelocity() instead.

Returns :
Returns the current velocity of the train in meters per second.
See also:
Vehicle.GetVelocity(), Measurement Conversion Multipliers

public bool Train.HasReachedJunctionInnerRadius ( JunctionBase jn ) [inline]

Determines of this train is within the inner radius of the given junction.

Parameters:
jn Junction to check if this train is on.
Returns :
Returns true if this train has entered the inner radius of jn, false otherwise.

public bool Train.HasTrainTimetable ( void )

Determines if this train has a train timetable attached to it.

Returns :
Returns true if the train has a TrainTimetable, false otherwise.

public void Train.IncTrainBusy ( void )

Increments this train's busy count.

If this train is not already busy, it will become busy. See IsTrainBusy() for details on the train busy count.

public void Train.Init ( void )

Called by Trainz to initialize this train.

Note:
Feel free to override, but ALWAYS call through to the base method. Use the inherited keyword to explicitly invoke an overridden method in a parent class.

public bool Train.IsScheduleRunning ( )

Determines if this train is currently running on a schedule.

Returns :
Returns true if there is a schedule running on this train, false otherwise,

public bool Train.IsScheduleWindowVisible ( void ) [inline]

Determines if the schedule window of this train is visible.

Returns :
Returns true if the schedule window of this train is visible, false otherwise.

public bool Train.IsStillInJunction ( JunctionBase jn ) [inline]

Determines if this train still holds a permit for the given junction.

Parameters:
jn Junction to check if this train has a permit for.
Returns :
Returns true if this train holds a permit for jn (i.e. the train is still on it), false otherwise.

public native bool Train.IsStopped ( )

Determines if this train is currently not moving and at a total stop.

Returns :
Returns true if this train is not moving, false otherwise.

public bool Train.IsTrainBusy ( void )

Determines if this train is busy or not.

This method allows the busy status of this train to be queried.

Through the IncTrainBusy() method, any piece of script code can tag a train being busy. The train can be untagged later by calling DecTrainBusy(). This busy mechanism is mainly used by industries that are doing something with the train.

A train can be tagged as being busy more than once by calling IncTrainBusy() multiple times so different industries can tag the train busy. Each time IncTrainBusy() is called, an internal busy count is incremented and if that busy count is >= 1, the train is considered busy such that this method will return b> true if called.

For a train to no longer be busy such that this method will return false, DecTrainBusy() will need to be called the same amount of times IncTrainBusy() has been to bring the busy count down to 0.

Returns :
Returns true if this train has been tagged as being busy one or more times, false otherwise.

public bool Train.IsViewDetailsVisible ( void ) [inline]

Determines if the view details window for this train is visible.

Returns :
Returns true if the view details window displayed by ViewDetails() is visible for this train, false otherwise.

public bool Train.MapObjectIsInFront | ( | MapObject | obj,
 |  | float | maxRange
 | ) | [inline]

Determines if the given MapObject is in front of this Train within the specified distance.

Parameters:
obj | Object to search four in front of this train.
maxRange | Maximum distance to limit the search by.
Returns :
Returns true if obj is logically forward of this train, within the specified distance, false otherwise.

public void Train.ReleaseTrackPermits ( Permit permits[] ) [inline]

Immediately release any permits which are in the specified list.

This method will release any permits from permits that this train currently holds. Other permits in that array that are not part being held by this train will be ignored and left alone.

Parameters:
permits List of permits to release for this train.

public thread void Train.RunSchedule | ( | Schedule | schedule,
 |  | bool | loop,
 |  | float | delay
 | ) |

Runs a schedule on this train.

See Schedule for information on how to build a schedule. Only one schedule may run on a train at a time and the user cannot control the train when it is running a schedule.

Note:
This method is a thread, so the calling code does not need to wait for it to finish and return once the schedule has been completed.
Parameters:
schedule | Schedule for this train to run.
loop | If true, the schedule will be looped and run on this train continuously. Use false to run the schedule only once.
delay | Time in seconds to delay before starting to run the schedule.

public native void Train.SetAdvisoryLimit ( float speed )

Set the speed limit for a script controlled train.

Parameters:
speed Advisory speed limit in KPH (kilometers per hour). Use 0 for no speed limit.
See also:
Measurement Conversion Multipliers

public native void Train.SetAutopilotMode ( int controlMode )

Sets the control mode of this train.

Parameters:
controlMode Control mode of this train. Use one of the train control mode constants to specify the control mode.
See also:
Train Control Modes

public native void Train.SetAutopilotTarget ( JunctionBase junction )

Instructs this train to drive to the given junction.

Parameters:
junction Destination junction for the autopilot to take this train to.

public native void Train.SetAutopilotTarget ( Track track )

Instructs this train to drive to the given Track segment.

Parameters:
track Destination Track segment for the autopilot to take this train to.

public native void Train.SetAutopilotTarget ( Trackside obj )

Instructs this train to drive to the given Trackside object.

Parameters:
obj Destination Trackside item for the autopilot to take this train to.

public native void Train.SetAutopilotTarget | ( | Buildable | obj,
 |  | string | triggerName
 | ) |

Instructs this train to drive to the named scenery trigger in a Buildable object.

Parameters:
obj | Destination scenery object that the autopilot is to take this train to.
triggerName | Name of industry trigger within the destination object to drive to.

public native void Train.SetAutopilotTargetMinimumDistance ( float distance )

Sets the minimum distance from a target object that the autopilots needs to slow down from.

Parameters:
distance Distance in meters from a target object the autopilot will start slowing down.

public native void Train.SetAutopilotTargetMinimumSpeed ( float speed )

Sets the minimum speed of the autopilot when at its target.

Note:
This method is only meant to be used with the various SetAutopilot* methods of this class. It is of no use for any other purpose.
Parameters:
speed Minimum target speed in MPS (meters per second).

public void Train.SetCouplingMask ( int mask )

Sets the coupling mask for all of the vehicles in this consist.

This method can be used to only allow coupling from one end or not at all on the train. For example, you don't want the player to couple to a script controlled train. Masked couplers cannot be coupled to.

Parameters:
mask Coupling mask setting to apply to all vehicles in this consist. Use the coupler flags to specify which couplers are to be masked off from being decoupled.
See also:
Coupling Flags, Vehicle.SetCouplingMask()

public native void Train.SetDCCThrottle ( float throttle )

Sets the DCC throttle setting for this train when using DCC physics.

Parameters:
throttle Throttle setting for DCC. Must be in the range of [-1.0 - 1.0] where -1.0 is full throttle in reverse, 0,0 is stop/neutral and 1.0 is full throttle forward.

public void Train.SetDecouplingMask ( int mask )

Sets the decoupling mask for all of the vehicles in this consist.

This is useful, for example, if you don't want the player to decouple vehicles from a script controlled train. Masked couplers cannot be decoupled.

Parameters:
mask Decoupling mask setting to apply to all vehicles in this consist. Use the coupler flags to specify which couplers are to be masked off from being decoupled.
See also:
Coupler Flags, Vehicle.SetDecouplingMask()

public native void Train.SetDynamicBrakeMode ( int dynamicBrakeMode )

Sets the mode of this train's dynamic brakes.

Parameters:
dynamicBrakeMode Mode to set the dynamic brakes of this train to. Use one of the dynamic brake state constants to specify the mode to set the dynamic brakes to.
See also:
Dynamic Brake States

public native void Train.SetFloatingLimit | ( | float | delta,
 |  | bool | enable
 | ) |

Sets the floating speed limit level above the sign posted limit.

The floating limit is an amount of tolerance above the current speed limit. Messages for floating speed violations are not to be confused with regular speed limit messages.

Note:
The floating limit is monitored by the Scenario.Monitor() thread, and may be used for point deduction when speeding. It should therefore be reserved for player trains.
Parameters:
delta | Float level difference from the posted limit in MPS (meters per second).
enable | Enable/disable the floating limit messages. Use true to enable, false by default.
See also:
Measurement Conversion Multipliers

public void Train.SetHandBrake ( bool state )

Sets the hand brake state for all non-loco vehicles in this train.

Parameters:
state State to set the handbrake of non-loco vehicles to. If true, the hand brake is applied. Use false to release the hand brake.

public native void Train.SetHeadlightState ( bool lightsOn )

Switch the headlights of this train on or off.

Note:
When the headlights of a train are switched on, only the front locomotive's headlights will actually be visibly switched on and affect the world in Trainz. Other locomotives in the consist are considered to have their headlights switched on in a sense. Not only is it more prototypical to have only the front locomotive's headlights on, but this also cuts back on unnecessary lighting calculations during rendering.
Parameters:
lightsOn State to set headlights of this train to. Use true to switch headlights on or false to switch them off.

public void Train.SetLastVisitedBuildable ( Buildable b ) [inline]

Sets the last Buildable object this train has last visited.

Parameters:
b Buildable/industry that this train last visited.

public native void Train.SetManualThrottle ( int throttleNotch )

Sets the notch of this train's throttle.

Parameters:
throttleNotch Notch to set the throttle to that is to be in the range of [0 - 8].

public native void Train.SetPantographState ( int state )

Sets the state of the pantographs of the electric locomotives in this train.

Note:
The pantographs can only be in one of four states and what these states are is dependents on the asset. Obviously, this method will be of little use on a train that has no electric locomotives.
Parameters:
state State to set the pantographs to. Must be in the range of [0 - 3].

public native void Train.SetReverser ( int reverserDirection )

Sets the state of this train's reverser lever.

Parameters:
reverserDirection State to set the reverser lever to. Use one of the reverser traction mode constants to specify the state to set the reverser lever to.
See also:
Reverser Traction Modes

public native void Train.SetTrainBrakes ( float brakeMode )

Sets the mode of this train's brakes.

Parameters:
brakeMode Mode to set the brakes of this train to. Use one of the train brake state constants to specify the mode to set the brakes to.
See also:
Train Brake States

public native void Train.SetTrainPriorityNumber ( int priority )

Sets the priority value of this train.

All trains and track sections and a priority value in the range of [1 - 3] with the default value being 2. The priority value for tracks and trains is not a numerical scale of precedence, but rather a value to user for matching by the AI driver. This means the driver will try and take the train along track sections that have a priority equal to that of the train. See the Track class description for a detailed explanation of priority values.

Note:
Changing the priority of the train won't affect the train immediately. It will only take affect when the driver restarts a new schedule.
Parameters:
priority Priority value to assign to this train. Must be either 1, 2 or 3.
See also:
Track.SetTrackPriorityNumber()

public void Train.SetTrainTimetable ( TrainTimetable timetable )

Sets the specified TrainTimetable to this train.

This train MUST NOT have an existing TrainTimetable attached to it, so make sure it is clear by calling ClearTrainTimetable() before hand.

Note:
It is the responsibility of the caller to post a ("TrainTimetable", "Touch") message after calling this function.
Parameters:
timetable TrainTimetable object to assign to this train.

public native void Train.SetVelocity ( float vel )

Instantly modify the Train's velocity.

Parameters:
vel Velocity to set as the current train velocity (in meters per second.)

public native void Train.ShowInConsistMenu ( bool show )

Shows/hides this train from the in-game consist menu.

Parameters:
show If true, the consist is displayed in the consist menu, false to hide it.

public native void Train.SoundHorn ( void )

Blows the horn (or whistle) for all locomotives in this train.

See also:
AiHornMsg

public void Train.StopScheduleAndWait ( ) [inline]

Stops running this train's current schedule.

This method stops the Schedule this train is currently running (if any) and waits until the train's schedule actually does stop before returning.

If this train is not running a schedule, this method returns after broadcasting a message of type ("Schedule", "Touch") in case someone is listening for schedule messages.

public Permit [] Train.TakePermitOnTrack ( bool direction ) [inline]

Get permits on our track where possible in the given direction.

Parameters:
direction Indicates the direction relative to the train in which to take the permits.
Returns :
Returns a list of any permits taken which have not yet been granted to this train. Note that some of these permits may not have necessarily been granted yet.

public native bool Train.TestTrackPermit | ( | Permit | trackPermit,
 |  | bool | innerOnly
 | ) |

Determines if this train is within the track controlled by the given permit.

Note:
Throws a script exception if trackPermit does not refer to a track.
Parameters:
trackPermit | Permit of track to test.
innerOnly | If true, indicates to test inner radius only, otherwise the default outer radius of 150 meters will be used.
Returns :
Returns true if this train is within the track controlled by trackPermit, false otherwise.

public void Train.ToggleScheduleWindow ( void ) [inline]

Toggles the schedule window of this train.

If the schedule window is already open/visible, this method will destroy it. Otherwise if the view details window is not visible, UpdateScheduleWindow() is called to create it for display.

public void Train.ToggleViewDetailsWindow ( void ) [inline]

Toggles the view details window displayed by ViewDetails().

If the view details window is already open/visible, this method will destroy it. Otherwise if the view details window is not visible, ViewDetails() is called to re-create it for display.

public native MapObject [] Train.TrackSearch | ( | bool | dir,
 |  | float | distance
 | ) |

Gets all of the various objects on a length of track that is either in front of or behind this train.

This method determines the length of track to search by using the given direction and length provided through the arguments. All industry and trackside objects along that length of track will be returned in an array.

Parameters:
dir | Direction to search in. Use true to search forward or false to search backward. Note that the train's direction is virtual and may not necessarily match what the 3D train vehicles may indicate.
distance | Distance down the track in the direction specified by dir to search. If dir is false indicating to search backwards from the train, the length of the train will be added to this value.
Returns :
Returns an array of objects found along the stretch of track defined by the arguments, an empty array otherwise.

public bool Train.TracksideIsInFront | ( | Trackside | obj,
 |  | float | maxRange
 | ) | [inline]

Determines if the given MapObject is in front of this Train within the specified distance.

Parameters:
obj | Trackside object to search for in front of this train.
maxRange | Maximum distance to limit the search by.
Returns :
Returns true if obj is logically forward of this train, within the specified distance, false otherwise.

public native void Train.Turnaround ( void )

Reverse the conceptual direction of this train (i.e. forward becomes backwards and backwards becomes forward).

Note:
The 3D vehicle objects do not turnaround, just the concept of forward so the throttle and reverser are affected.

public void Train.UpdateScheduleWindow ( string vehicleName )

Updates the schedule view window from the vehicle.

Parameters:
vehicleName Vehicle to update from.

public void Train.UpdateViewDetails ( Vehicle vehicle ) [inline]

Called by Vehicle.UpdateViewDetails() when it's load has changed so the train's detail window can be updated.

Parameters:
vehicle Vehicle that called this method.

public void Train.ViewDetails ( Vehicle vehicle ) [inline]

Called by a Vehicle in this consist to display consist details of the entire train in a browser window.

This method is called by Vehicle.ViewDetails() when the user has requested to view the details of the consist. It will create a Browser window listing information about the train including who the driver character is and the loads of all vehicles.

Parameters:
vehicle Vehicle that called this method.

public bool Train.WasRunScheduleSuccessful ( void ) [inline]

Determines if the most recently run schedule on this train was completed successfully.

Returns :
Returns true if the most recently run schedule was completed successful, false otherwise.

The documentation for this class was generated from the following file:
  • train.gs


TrainHelperInfo Class Reference

Inheritance diagram for TrainHelperInfo:

HTMLPropertyGroup List of all members.

Public Methods

public bool | DoesMatch (Train train)
public bool | DoesFilterTrains (void)
public void | Init (void)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)

Detailed Description

Handler class that allows a description of a train to be built for filtering purposes.

This property handler allows a description of a consist to be built that can filer trains on the basis of one or more of the following:

  • train with a specific vehicle
  • train with a specific vehicle
  • train with a specific driver
  • any train
All the text and art this handler displays in a properties window is built into the game and this handler uses what it needs automatically.

To use this handler for your own assets, not only do you need to create the object with new but you must also call its Init() method before you either assign it to a PropertyObject or add it to group property handler.

Once created, the TrainHelperInfo handler manes the train definitions and automatically loads/saves as needed. The DoesMatch() method is provided to compare an existing Train against this handler's own train definitions and this is how you use this handler as a filtering mechanism.

This handler is used in the Portal scenery object as well as in the following rules:

  • Consist Check
  • Trigger Check
  • Vehicle Physics
  • Enable/Disable Driver Commands
  • Wait for Driver On/Off Train
  • Wait on Train Stop/Start
Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be seen in the \Trainz\scripts\TrainHelperInfo.gs script file.
See also:
SpecificVehiclesInfo, VehicleTypesInfo, DriversInfo, ConsistHelperInfo, ConsistListHelper, VehicleHelperInfo

Member Function Documentation

public bool TrainHelperInfo.DoesFilterTrains ( void ) [inline]

Indicates if this handler's filtering is switched on or off.

The train handler includes a mechanism in the properties interface to switch filtering off such that DoesMatch() will always return true.

Returns :
Returns true if this handler's train filtering is enabled, false otherwise.

public bool TrainHelperInfo.DoesMatch ( Train train )

Determines if the given train matches the filter requirements of this handler.

Parameters:
train Train to compare against this handler's definition.
Returns :
Returns true if train matches the criteria as defined by this handler, false otherwise.

public string TrainHelperInfo.GetDescriptionHTML ( void ) [inline]

Gets a HTML description of this group handler based on all of the child handlers.

Overridden from HTMLPropertyHandler.GetDescriptionHTML() to get the HTML description of each child handler in this group for inclusion in the returned description.

Returns :
Returns a HTML description built up by gathering the descriptions of all of the child handlers.

Reimplemented from HTMLPropertyGroup.

public Soup TrainHelperInfo.GetProperties ( void ) [inline]

Gets this handler's properties in a database.

Overridden from HTMLPropertyHandler.GetProperties() to save the properties of all sub handlers and then return a Soup containing a sub-database for each sub handler obtained by calling the sub handlers GetProperties() method.

Returns :
Returns a Soup database containing the saved properties of this group handler and its sub handlers.

Reimplemented from HTMLPropertyGroup.

public string TrainHelperInfo.GetPropertyDescription ( string propertyID ) [inline]

Gets a description for the named property.

Overridden from HTMLPropertyHandler.GetPropertyDescription() to get the property name from the appropriate child handler.

Parameters:
propertyID Name of the property to get the description of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyDescription() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public string TrainHelperInfo.GetPropertyName ( string propertyID ) [inline]

Gets a descriptive name for the given property.

Overridden from HTMLPropertyHandler.GetPropertyName() to get the property name from the appropriate child handler.

Parameters:
propertyID Name of the property to get the descriptive name of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyName() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public string TrainHelperInfo.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

Overridden from HTMLPropertyHandler.GetPropertyType() to get the type of the named property from the appropriate child handler.

Parameters:
propertyID Name of the property to get the type of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyType() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public void TrainHelperInfo.Init ( void ) [inline]

Initialization method.

This method should always be called after creating a TrainHelperInfo object and before it is used for anything else. Doing so ensures the sub-handlers used for the vehicle instances, vehicle types and drivers are initialized.

public void TrainHelperInfo.SetProperties ( Soup soup ) [inline]

Initializes this handler's properties from the given database.

Overridden from HTMLPropertyHandler.SetProperties() to initialize all of the sub handlers from the given Soup database. The HTMLPropertyGroup implementation of this method assumes the sub handlers have already been added to the group handler - it only initializes existing sub handlers and generally isn't meant to create new sub handlers itself (although you can do that in your own overridden implementation if you really want to).

Parameters:
soup Database of property values to initialize this handler with. Sub-databases in side this soup will be used to initialize each sub-handler.

Reimplemented from HTMLPropertyGroup.

public void TrainHelperInfo.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the value of the named property.

Overridden from HTMLPropertyHandler.SetPropertyValue() to set the value of the named property on the appropriate child handler.

Parameters:
propertyID | Name of the property to set the value of. This should be a full property string with group handler and sub handler prefixes.
value | Value to set the property to.

Reimplemented from HTMLPropertyGroup.

The documentation for this class was generated from the following file:
  • TrainHelperInfo.gs


TrainTimetable Class Reference

Inheritance diagram for TrainTimetable:

GSObject List of all members.

Public Methods

public ScenarioBehavior | GetTimetableRule (void)
public Train | GetTrain (void)
public TrainTimetableItem | GetCurrentTimetableItem (void)
public TrainTimetableItem[] | GetCurrentTimetable (int hintMaxDesired)
public bool | GetArrivedAtDestination (void)
public bool | GetIsLate (void)
public bool | GetIsAtDestination (void)

Detailed Description

This is an abstract base type for Train Timetabling.

Object of this class are never created directly. Instead, subclasses are derived from this class and override each of the functions defined here. Instances of these subclasses are created by train timetable rules (such as Schedule) and assigned to a Train to run.

The creating rule is responsible for tracking and updating the TrainTimetable object and, when complete, removing it from the Train.

See also:
TrainTimetableItem, Train.GetTrainTimetable(), Train.SetTrainTimetable(), Schedule Rule

Member Function Documentation

public bool TrainTimetable.GetArrivedAtDestination ( void ) [inline]

Determines if the Train running this timetable has arrived at its destination yet.

Note:
This method MUST be overridden by a derivative class as the TrainTimetable implementation always returns false.
Returns :
Returns true if the Train running the timetable has arrived at its destination, false otherwise.

public TrainTimetableItem [] TrainTimetable.GetCurrentTimetable ( int hintMaxDesired ) [inline]

Gets the current TrainTimetableItem and a number of future items from the current schedule.

The timetable may be infinitely long (procedural) and in this case, only the first hintMaxDesired items will be returned.

Note:
The caller MUST NOT modify the returned array or the contents of the array. Nor should they make any assumptions about the number of items returned.
Note:
This method MUST be overridden by a derivative class as the TrainTimetable implementation always returns an empty array.
Parameters:
hintMaxDesired provides a hint as to the maximum number of items that should be returned.
Returns :
Return the current (item 0) and some number of future items from the current schedule.

public TrainTimetableItem TrainTimetable.GetCurrentTimetableItem ( void ) [inline]

Gets the current schedule TrainTimetableItem that is currently executing.

When the schedule moves to the next item, a ("TrainTimetable", "Touch") message is sent from the owning rule to the train.

Note:
This method MUST be overridden by a derivative class as the TrainTimetable implementation always returns null.
Note:
This method may return NULL if there is no item currently available. This does not necessarily mean that the schedule is complete however.
Returns :
Return the current schedule item which is executing, null otherwise. The caller MUST NOT modify the returned TrainTimetableItem.

public bool TrainTimetable.GetIsAtDestination ( void ) [inline]

Determines if the Train running this timetable has arrived at its destination yet.

Note:
This method MUST be overridden by a derivative class as the TrainTimetable implementation always returns false.
Returns :
Returns true if the Train has arrived at its destination, false otherwise.

public bool TrainTimetable.GetIsLate ( void ) [inline]

Determines if the Train running this timetable is late.

Note:
This method MUST be overridden by a derivative class as the TrainTimetable implementation always returns false.
Returns :
Returns true if the Train is running late, false otherwise.

public ScenarioBehavior TrainTimetable.GetTimetableRule ( void ) [inline]

Gets the rule that owns this TrainTimetable object.

Note:
This method MUST be overridden by a derivative class as the TrainTimetable implementation always returns null.
Returns :
Should return the rule that owns this TrainTimetable object.

public Train TrainTimetable.GetTrain ( void ) [inline]

Gets the Train that this TrainTimetable object is attached to.

Note:
This method MUST be overridden by derivative class as the TrainTimetable implementation always returns null.
Returns :
Should return the Train to which this TrainTimetable object is attached to, null otherwise.

The documentation for this class was generated from the following file:
  • TrainTimetable.gs


TrainTimetableItem Class Reference

List of all members.

Public Attributes

public int | mode
Mode of this item, must be either MODE_INDUSTRY or MODE_TRACKMARK.

public string | destinationName
Destination name.

public string | trackName
Name of destination track (if it is an industry).

public KUID | command
KUID of the DriverCommand to perform this item.

public float | arrivalTime
Scheduled arrival time.

public float | departureTime
Scheduled departure time.

public bool | msgLateSent
Has a late message been sent?

public bool | msgEarlySent
Has an early message been sent?

public bool | arrivedAtDestination
Has the train arrived at the destination yet?

public bool | arrivedLate
Has the train arrived late?

public bool | departOnTime
Did the train depart on time?

public bool | departEarly
Did the train depart early?

public bool | arriveEarly
Did the train arrive early?

Timetable Mode

Timetable Item Modes

See also:
TrainTimetableItem.mode

public define int | MODE_INDUSTRY = 1
Drive to the named industry and (optionally) perform command.

public define int | MODE_TRACKMARK = 2
Drive via a named TrackMark.

Detailed Description

An event item in a train timetable.

This class describes a single event in a TrainTimetable object.

See also:
TrainTimetable

The documentation for this class was generated from the following file:
  • TrainTimetable.gs


TrainUtil Class Reference

List of all members.

Public Methods

public string | StrSubst (string s, string remove, string replace)
public string | GetUpTo (string propertyString, string searchChars)
public string | GetAfter (string propertyString, string searchChars)
public bool | AlreadyThereStr (string[] strArray, string searchStr)
public bool | HasPrefix (string searchStr, string prefixStr)
public bool | HasSufix (string searchStr, string sufixStr)
public bool | CompareStrLists (string[] strListOne, string[] strListTwo)
public bool | RandBool (void)
public Train | CreateTrainFromSoup (Soup trainSoup, string trackMarkName, bool direction)
public void | WaitUntilHas (Vehicle loco, ShuntTrack[] tracking)
public bool | IsInTrain (Train train, Vehicle vehicle)
public bool | AreInTrain (Train train, Vehicle[] vehicles)
public bool | IsTrainInTrigger (GameObject runningThread, Train train, Trigger trigger)
public bool | IsPartTrainInTrigger (GameObject runningThread, Train train, Trigger trigger)
public bool | IsInTrigger (GameObject runningThread, Vehicle vehicle, Trigger trigger)
public void | RunTurnTable (GameObject runningThread, Train train, string turntable)
public Train | DoCoupleUp (Train train, Train coupleTo)
public Train | DoDecouple (Train train, int wagons)

Detailed Description

Utility class with various miscellaneous functions.

See also:
ScenarioSupport, ShuntTrack

Member Function Documentation

public bool TrainUtil.AlreadyThereStr | ( | string | strArray[],
 |  | string | searchStr
 | ) |

Determines if a string exists as an element in an array of strings.

Parameters:
strArray | Array of strings to search in.
searchStr | String to search for in strArray
Returns :
Returns true if an element of strArray matches the string searchStr exactly, false otherwise.
See also:
Str

public bool TrainUtil.AreInTrain | ( | Train | train,
 |  | Vehicle | vehicles[]
 | ) |

Determines if the vehicles in an array are in a particular train consist.

Parameters:
train | Train argument.
vehicles | Vehicle argument.
Returns :
Returns true if all of the vehicles in the array are in the train consist, false otherwise.

public bool TrainUtil.CompareStrLists | ( | string | strListOne[],
 |  | string | strListTwo[]
 | ) |

Compares the two given list of strings against each other.

Parameters:
strListOne | First list of strings.
strListTwo | Second list of strings to be compared with.
Returns :
Returns true if strListOne and strListTwo have the same amount of strings in them and each string of the corresponding index in both arrays is equal. If there is any difference between the contents of strListOne and strListTwo, false is returned.

public Train TrainUtil.CreateTrainFromSoup | ( | Soup | trainSoup,
 |  | string | trackMarkName,
 |  | bool | direction
 | ) |

Creates a train consist from the given Soup consist definition.

Parameters:
trainSoup | Consist definition to create the train from. This Soup must be in the format returned by World.GetSurveyorSavedConsist().
trackMarkName | Name of the track mark to create the train consist at.
direction | Direction to orient the train in. If true, the train will face in the same direction as the track mark does, otherwise false and the train will face in the opposite direction of the track mark.
Returns :
Returns a reference to the created Train consist, null otherwise.
See also:
World.CreateTrain(KUID[],string,bool), World.GetSurveyorSavedConsist(), World.GetSurveyorSavedConsistList()

public Train TrainUtil.DoCoupleUp | ( | Train | train,
 |  | Train | coupleTo
 | ) |

Couple up two consists.

Parameters:
train | Train argument.
coupleTo | Train argument.
Returns :
Returns the newly coupled up consist.

public Train TrainUtil.DoDecouple | ( | Train | train,
 |  | int | wagons
 | ) |

Waits for a decoupling operation to be performed on the given train at on the specified vehicle.

Note:
It is assumed the train is stopped and already in position.
Parameters:
train | Train where uncoupling is going to occur (i.e. split into two consists).
wagons | Offset into train where uncoupling will take place (i.e. 1 for rear most wagon, 2 for 2nd rear most etc.)
Returns :
Returns the decoupled consist if successful, null otherwise.

public string TrainUtil.GetAfter | ( | string | propertyString,
 |  | string | searchChars
 | ) |

Gets the trimmed right side of a string that doesn't contain any of the specified characters.

In the following code example, the results string would be "ks exciting!" because in cutOff, we specify that the string is to be trimmed when either the 'l' or 'o' character occurs, whichever is first when going through the string from right to left (i.e. backwards).

     string ourString = "I like this string, it looks exciting!";
     string cutOff    = "lo";

     string results   = TrainUtil.GetAfter(ourString, cutOff);
Parameters:
propertyString | String to extract the right portion of.
searchChars | Search string that contains the delimiter characters that define where propertyString is to be trimmed.
Returns :
Returns a trimmed propertyString starting from the right side and ending at the character just before where a character from searchChars is encountered. If none of the characters in searchChars are found in propertyString, an empty string is returned.
See also:
Str

public string TrainUtil.GetUpTo | ( | string | propertyString,
 |  | string | searchChars
 | ) |

Gets the trimmed left side of a string that doesn't contain any of the specified characters.

In the following code example, the results string would be "I like this string, it l" because in cutOff, we specify that the string is to be trimmed when either the 'x' or 'o' character occurs (whichever is first).

     string ourString = "I like this string, it looks exciting!";
     string cutOff    = "xo";

     string results   = TrainUtil.GetUpTo(ourString, cutOff);
Parameters:
propertyString | String to extract the left portion of.
searchChars | Search string that contains the delimiter characters that define where propertyString is to be trimmed.
Returns :
Returns a trimmed propertyString starting from the left side and ending at the character just before where a character from searchChars is encountered. If none of the characters in searchChars are found in propertyString, an empty string is returned.
See also:
Str

public bool TrainUtil.HasPrefix | ( | string | searchStr,
 |  | string | prefixStr
 | ) |

Determines if a string is prefixed with the given prefix string.

Parameters:
searchStr | String to check for the existence of prefixStr in at the start.
prefixStr | Prefix string to search for in the start of searchStr.
Returns :
Returns true if prefixStr is a sub-string at the start of searchStr, false otherwise.

public bool TrainUtil.HasSufix | ( | string | searchStr,
 |  | string | sufixStr
 | ) |

Determines if a string is suffixed with the given suffix string.

Parameters:
searchStr | String to check for the existence of sufixStr in at the end.
sufixStr | Suffix string to search for at the end of searchStr.
Returns :
Returns true if sufixStr is a sub-string at the end of searchStr, false otherwise.

public bool TrainUtil.IsInTrain | ( | Train | train,
 |  | Vehicle | vehicle
 | ) |

Determines if a vehicle is in a particular train consist.

Parameters:
train | Train argument.
vehicle | Vehicle argument.
Returns :
Returns true if vehicle is in train, false otherwise.

public bool TrainUtil.IsInTrigger | ( | GameObject | runningThread,
 |  | Vehicle | vehicle,
 |  | Trigger | trigger
 | ) |

Determines if a vehicle is in a trigger.

Note:
This method doesn't work as it should as individual vehicle tracking was not supported when it was originally written.
Parameters:
runningThread | Thread that called this method.
vehicle | Vehicle argument.
trigger | Trigger argument.
Returns :
Returns true if any part of the train that vehicle belongs to is in the trigger, false otherwise.

public bool TrainUtil.IsPartTrainInTrigger | ( | GameObject | runningThread,
 |  | Train | train,
 |  | Trigger | trigger
 | ) |

Determines if part of the train (i.e. any vehicle) is in the given trigger.

Parameters:
runningThread | Thread that called this method.
train | Train argument.
trigger | Trigger argument.
Returns :
Returns true if the train is in the given trigger, false otherwise.

public bool TrainUtil.IsTrainInTrigger | ( | GameObject | runningThread,
 |  | Train | train,
 |  | Trigger | trigger
 | ) |

Determines if a train is in the given trigger.

Parameters:
runningThread | Thread that called this method.
train | Train argument.
trigger | Trigger argument.
Returns :
Returns true if the train is in the given trigger, false otherwise.

public bool TrainUtil.RandBool ( void )

Random Boolean generator method.

Returns :
Returns a random Boolean value (either true or false).

public void TrainUtil.RunTurnTable | ( | GameObject | runningThread,
 |  | Train | train,
 |  | string | turntable
 | ) |

A generic turntable handler. Guides train through a turntable with appropriate icons.

Parameters:
runningThread | The running thread.
train | Train argument.
turntable | Name of turntable.

public string TrainUtil.StrSubst | ( | string | s,
 |  | string | remove,
 |  | string | replace
 | ) |

String substitution method that replaces a sub string of a given major string with a replacement sub-string.

In the following code example, the results string would be "Gnomes are your enemies!" because we specify via remove that we want the string "friends" to be substituted with the contents of replace, which coincidentally is "enemies" and has the opposite meaning.

     string ourString = "Gnomes are your friends!";
     string remove    = "friends";
     string replace   = "enemies";

     string results   = TrainUtil.StrSubst(ourString, remove, replace);
Parameters:
s | String to find the sub-string in to replace.
remove | Sub-string contained in s that is to be replaced. The first instance of this parameter in s will be replaced. For this method to work, this parameter must not exceed s in length and must be a genuine sub-string of s.
replace | Replacement string that is to be inserted where remove is within s. This string does not have to be the same size as remove and can even be longer than s - the return string will be expanded/contracted as necessary.
Returns :
Returns a new string based on s such that the sub-string defined by remove is replaced with replace. If s is empty, remove cannot be found as a sub-string of s or remove is larger than s, an empty string will be returned to indicate failure.

public void TrainUtil.WaitUntilHas | ( | Vehicle | loco,
 |  | ShuntTrack | tracking[]
 | ) |

Waits until all of the vehicles tracked by the tracking array are in the train of the given loco.

Parameters:
loco | Loco of the consist.
tracking | Tracking array.

The documentation for this class was generated from the following file:
  • common.gs


Trainz Class Reference

List of all members.

Detailed Description

Static class to provide a version number.

The version member in this class is not public and script programmers won't need to ever use this class.

The documentation for this class was generated from the following file:
  • trainz.gs


TrainzGameObject Class Reference

Inheritance diagram for TrainzGameObject:

GameObject Library MeshObject ModuleScript ScenarioBehavior Bogey Cabin MapObject DriverCharacter ConditionalScenarioBehavior DefaultLocomotiveCabin DefaultSteamCabin SceneryWithTrack Trackside Buildable Crossing Turntable Junction Signal TrackMark Trigger Vehicle List of all members.

Public Methods

public void | Init (Asset asset)
public Asset | GetAsset (void)

Detailed Description

Base class for a GameObject that is an instance of a Trainz asset.

This class is a parent class for game objects in the Trainz world that are instances of a Trainz asset. Examples of game objects based on particular a asset that derive from this class include Bogey, Cabin, Crossing, Industry, Library, Turntable and Vehicle to name a few.

The only interface methods provided here deal with object initialization via Init(Asset) and GetAsset() which allows the Asset this object is based on to be obtained.

See also:
Asset, KUID, MeshObject, GameObject, Library, ScenarioBehavior

Member Function Documentation

public Asset TrainzGameObject.GetAsset ( void )

Gets the Asset of this game object.

Returns :
Returns the Asset of this game object. This returned reference can be used to obtain the KUID and StringTable of the Asset.

public void TrainzGameObject.Init ( Asset asset )

Initialization method. Called by Trainz when the object is first created.

It is up to the script programmer to do any initialization tasks required here as well as ensuring a thread is started if the object is to exist in a persistent state that can monitor and respond to message for example.

Note:
You will see that some derived classes have both an Init() and Init(Asset) method. There isn't much difference between them except one gets the Asset as a parameter. It is recommended that you use the Init(Asset) version whenever you can.
Note:
When overriding this base Init() method, you must call it explicitly by using the inherited keyword in the overridden implementation.
Note:
As Init() is called from native Trainz code, you cannot CANNOT Sleep() or wait() in an Init() method. However, Init() can start threaded methods that are allowed to sleep and process messages.
Parameters:
asset Trainz asset this object is based on.
See also:
MeshObject.Init()

Reimplemented in ConditionalScenarioBehavior, DriverCharacter, MeshObject, and MeshObject.

The documentation for this class was generated from the following file:
  • TrainzGameObject.gs


Trigger Class Reference

Inheritance diagram for Trigger:

Trackside List of all members.

Detailed Description

Trigger is a track side object that sends a message to a train every time a train enters, stops within or leaves a trigger.

Triggers placed in Surveyor can be accessed in script code by calling Router.GetGameObject("triggerName") and casting the returned reference to Trigger.

Note:
There are no methods in this class. See the parent Trackside class for details of supported methods that can be used with a Trigger.
Messages used by a Trigger object are:

Major | Minor | Source | Destination
"Trigger" | "Enter" | trigger | train
"Trigger" | "Stopped" | trigger | train
"Trigger" | "Leave" | trigger | train
"Object" | "Enter" | train | trigger
"Object" | "Stopped" | train | trigger
"Object" | "Leave" | train | trigger

See also:
Junction, Signal, TrackMark, Trackside, Vehicle, Navigate.OnTrigger()

The documentation for this class was generated from the following file:
  • trigger.gs


Turntable Class Reference

Inheritance diagram for Turntable:

SceneryWithTrack List of all members.

Public Methods

public native bool | IsMoving (void)
public native int | GetStopPosition (void)
public native void | MoveToNextStop (void)
Moves the turntable to its next stop position.

public native void | MoveToPrevStop (void)
Moves the turntable to its previous stop position.

public native void | MoveToStop (int stopIndex)
public native bool | CanMoveToNextStop (void)
public native bool | CanMoveToPrevStop (void)

Detailed Description

Turntable class. An interface to operate a turntable is provided.

To get a reference to a turntable item on the map, use Router.GetGameObject(string) and cast to this class.

See also:
Router.GetGameObject(string), Track, Trackside

Member Function Documentation

public native bool Turntable.CanMoveToNextStop ( void )

Determines if this turntable can move to the next stop position.

Returns :
Returns true if this turntable can move to the next stop position, false otherwise.

public native bool Turntable.CanMoveToPrevStop ( void )

Determines if this turntable can move to the previous stop position.

Returns :
Returns true if this turntable can move to the previous stop position, false otherwise.

public native int Turntable.GetStopPosition ( void )

Gets the current position of this turntable.

Returns :
Returns the position of this turntable.

public native bool Turntable.IsMoving ( void )

Determines if this turntable is currently moving.

Returns :
Returns true if this turntable is currently moving, false otherwise.

public native void Turntable.MoveToStop ( int stopIndex )

Moves the turntable to the given stop position.

Parameters:
stopIndex Position to move the turntable to.

The documentation for this class was generated from the following file:
  • turntable.gs


Vehicle Class Reference

Inheritance diagram for Vehicle:

Trackside Locomotive List of all members.

Public Methods

public void | Init (void)
public native Train | GetMyTrain (void)
public native bool | GetDirectionRelativeToTrain (void)
public bool | GetFacingRelativeToTrain (void)
public native float | GetMass (void)
public native float | GetLength (void)
public native float | GetVelocity (void)
public native void | SetBrokenBrakes (bool broken)
public native void | SetBrakePipeEfficiency (float efficiency)
public native void | SetRunningNumber (string rn)
public native string | GetRunningNumber ()
public native void | SetHeadlightColor (float red, float green, float blue)
public native void | Uncouple (Vehicle other)
public native void | Uncouple (int direction)
public native int | GetCouplingDirection (Vehicle other)
public native void | SetCouplingMask (int couplingMask)
public native void | SetDecouplingMask (int couplingMask)
public native bool | Couple (Vehicle other)
public native bool | Reposition (TrackMark mark, bool direction)
public native bool | Reposition (Vehicle other, int myCoupleDirection, int otherCoupleDirection)
public native bool | Reposition (Train train, int myCoupleDirection, int otherCoupleDirection)
public native bool | Reverse ()
public native float | GetBrakeCylinderPressure (void)
public native float | GetAuxReservoirPressure (void)
public native float | GetBrakePipePressure (void)
public native void | SetPitchBasedOnTrack (bool pitchBasedOnTrack)
public native void | SetPitchBasedOnSpeed (float multiplier)
public native void | SetRollBasedOnTrack (float multiplier)
public native void | SetHandBrake (bool applied)
public native bool | IsInTunnel (void)
public native bool | IsOnBridge (void)
public native int | GetEngineType (void)
public native int | GetVehicleTypeFlags (void)
public native float | GetTrackGradient (void)
public native int | GetRelationToTrack (Buildable obj, string trackName)
public bool | LoadProduct (LoadingReport report)
public bool | UnloadProduct (LoadingReport report)
public native float | GetMaximumTractiveEffort (void)
public native void | SetMaximumTractiveEffort (float maxTE)
public native float | GetDefaultMaximumTractiveEffort (void)
public native float | GetWheelslipTractionMultiplier (void)
public native void | SetWheelslipTractionMultiplier (float multiplier)
public native float | GetSandingTractionMultiplier (void)
public native void | SetSandingTractionMultiplier (float multiplier)
public native float | GetMaximumCouplerCompressionStress (void)
public native void | SetMaximumCouplerCompressionStress (float maxCouplerCompressionStress)
public native float | GetDefaultMaximumCouplerCompressionStress (void)
public native float | GetMaximumCouplerExpansionStress (void)
public native void | SetMaximumCouplerExpansionStress (float maxCouplerExpansionStress)
public native float | GetDefaultMaximumCouplerExpansionStress (void)
public native float | GetMaximumCoupleVelocity (void)
public native void | SetMaximumCoupleVelocity (float maxCoupleVelocity)
public native float | GetDefaultMaximumCoupleVelocity (void)
public native float | GetCouplingStress (Vehicle toVehicle)
public native void | SetCouplerBreakageEnabled (bool enabled)
public native bool | GetCouplerBreakageEnabled (void)
public native void | SetCabinSwayAmount (float amount)
public native float | GetCabinSwayAmount (void)
public native float | GetDefaultCabinSwayAmount (void)
public native float | GetEngineParam (string p_paramName)
public native Bogey[] | GetBogeyList (void)
float | BeginUnload (LoadingReport report)
float | EndUnload (LoadingReport report)
float | GetUnloadTime (LoadingReport report)
float | BeginLoad (LoadingReport report)
float | EndLoad (LoadingReport report)
float | GetLoadTime (LoadingReport report)
public bool | SetProductRestriction (Asset product)
public void | SetProductDisabled (void)
public ProductFilter | GetProductRestriction (void)
public bool | CanLoadProductFromQueue (ProductQueue queue)
public bool | CanUnloadProductToQueue (ProductQueue queue)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)
public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string p_propertyID)
public string | GetPropertyValue (string p_propertyID)
Allows the running number of this vehicle to be obtained when the "runningnumber" property is requested.
Parameters:
p_propertyID Name of the property to get the value of.
Returns :
Returns the running number of this vehicle if p_propertyID is equal to "runningnumber", an empty string otherwise.

void | SetPropertyValue (string p_propertyID, string p_value)
Allows the running number of this vehicle to be set through the "runningnumber" property.
Parameters:
p_propertyID | Name of the property to set. Must be equal to "runningnumber" or the running number of this vehicle won't be set.
p_value | Value to set the "runningnumber" property to.

void | SetPropertyValue (string propertyID, int value)
void | ViewDetails (Message msg)
View details window for this vehicle (uses the Train's output though). This method is setup by Init() as a handler method for when a message of type ("MapObject", "ViewDetails") is received by this vehicle object. Such a message indicates that the user has opened the right-click menu of the vehicle and selected the "View Details" menu item. This method will call the ViewDetails() method of this vehicle's train so that a Browser window describing the entire train can be displayed to the user.
Parameters:
msg Source object of message.
See also:
Train.ViewDetails().

void | UpdateViewDetails (Message msg)
Update the view details window for this vehicle (form the train). This method is setup by Init() as a handler method for when a message of type ("Vehicle", "LoadComplete") is received by this vehicle object. Such a message indicates that the load/queue of the vehicle has changed and the view details window of the train (if visible) will need to be updated, so this method calls through to Train.UpdateViewDetails().
Parameters:
msg Source object of message.
See also:
Train.UpdateViewDetails().

void | ViewSchedule (Message msg)
View the schedule window for this vehicle (from the train). This method is setup by Init() as a handler method for when a message of type ("MapObject", "View-Schedule") is received by this vehicle object. Such a message indicates that the schedule of the vehicle/train is to be displayed for the user. This method calls through to Train.UpdateScheduleWindow().
Parameters:
msg Source object of message.
See also:
Train.UpdateScheduleWindow().

public string[] | GetPropertyElementList (string propertyID)
void | SetPropertyValue (string propertyID, string value, int index)
void | LinkPropertyValue (string propertyID)
public void | SetQueueInitialCount (ProductQueue queue, Asset asset, int newValue)
Fills the given queue with a set amount of products. This method sets the amount of products in the given queue. It is a utility method that works on the given queue which need not be a queue from this vehicle. The product filter provided with queue will be used to check if the queue can take products of type asset. If it can't, the filter will be modified so it can as this method is forceful in that regard.
Parameters:
queue | Queue to put products in. Existing products in this queue will be destroyed.
asset | Type of product to put in queue.
newValue | Amount of products of type asset to place in queue.

Public Attributes

public IndustryProductInfoCollection | vehicleProductInfoCollection = new IndustryProductInfoCollection()
Information object that allows tracking of products and associated assets, queues etc.

Coupler Flags

Flags used for couplers.

These flags are used to specify couplers on a vehicle and can be used to specify which couplers in a vehicle to disable coupling or decoupling operations on. They can refer to none, the front coupler, the back coupler or both.

Note:
These flags are relative to the facing direction of the vehicle, not that of the Train.
See also:
Vehicle.SetCouplingMask(), Vehicle.SetDecouplingMask(), Vehicle.Reposition(Vehicle,int,int), Vehicle.Reposition(Train,int,int), Train.SetCouplingMask(), Train.SetDecouplingMask()

public define int | COUPLE_NONE = 0
Neither couplers.

public define int | COUPLE_FRONT = 1
Front coupler.

public define int | COUPLE_BACK = 2
Rear coupler.

public define int | COUPLE_BOTH = COUPLE_FRONT | COUPLE_BACK
Both couplers.

Direction Relationships

Used for describing relationships between entities.

Note that DIRECTION_FORWARD is guaranteed to be the negative of DIRECTION_BACKWARD.

See also:
Vehicle.GetCouplingDirection(), Vehicle.GetRelationToTrack()

public define int | DIRECTION_NONE = 0
No known relationship between entities.

public define int | DIRECTION_FORWARD = 1
Forward (same facing).

public define int | DIRECTION_BACKWARD = -1
Backward (opposite facing).

Engine Types

Constants that define the engine types a vehicle can be.

See also:
Vehicle.GetEngineType()

public define int | ENGINE_NONE = 0
Not a powered vehicle.

public define int | ENGINE_STANDARD = 1
Is a diesel, diesel-electric or electric powered engine.

public define int | ENGINE_STEAM = 2
Steam engine.

Vehicle Types

Vehicle type flags.

These flags are returned by calling Vehicle.GetVehicleTypeFlags() and give information about what the vehicle actually is.

See also:
Vehicle.GetVehicleTypeFlags()

public define int | TYPE_LOCOMOTIVE = 1
Vehicle is a powered engine.

public define int | TYPE_TENDER = 2
Vehicle carries fuel for a locomotive (i.e. a tender attached to a steam locomotive).

public define int | TYPE_HAS_INTERIOR = 4
Vehicle has interior. Note that a vehicle does not have to be a Locomotive to have an interior.

Detailed Description

Vehicle is a piece of rolling stock, or a locomotive.

A vehicle is always part of a Train consist. If a vehicle is decoupled and left alone, Trainz will create a new consist for it.

Vehicle object messages:
Major | Minor | Source | Destination | Description
"Vehicle" | "Derailed" | derailed vehicle | broadcast | Vehicle has derailed and can no longer be used.
"Vehicle" | "Coupled" | coupled vehicle | broadcast | Vehicle has coupled up with another vehicle.
"Vehicle" | "Decoupled" | decoupled vehicle | broadcast | Vehicle has decoupled from another vehicle. This message is not currently functional in TS2006.
"Vehicle" | "BadCouple" | coupled vehicle | broadcast | Vehicle has coupled with another vehicle at too high a velocity.
"Vehicle" | "Collided" | collided vehicle | broadcast | Vehicle has collided with another vehicle.

See also:
Industry, Locomotive, ProductQueue, Train, Trackside

Member Function Documentation

float Vehicle.BeginLoad ( LoadingReport report ) [inline]

Call-back method to perform custom activities before this vehicle is loaded.

This method is called by LoadProduct() to perform any custom activities required before loading such as activating particles or starting animation. Implementing this method in a vehicle script is not compulsory, but is essential if such custom activity is desired.

Parameters:
report Report on the current state of the loading operation.
Returns :
The amount of time needed in seconds for how long this custom activity runs for should be returned. For example, the length of an audio file or animation that may have been played would be an appropriate return value.
See also:
LoadProduct(), Industry.BeginLoad()

float Vehicle.BeginUnload ( LoadingReport report ) [inline]

Call-back method to perform custom activities before this vehicle is unloaded.

This method is called by UnloadProduct() to perform any custom activities required before unloading such as activating particles or starting animation. Implementing this method in a vehicle script is not compulsory, but is essential if such custom activity is desired.

Parameters:
report Report on the current state of the unloading operation.
Returns :
The amount of time needed in seconds for how long this custom activity runs for should be returned. For example, the length of an audio file or animation that may have been played would be an appropriate return value.
See also:
UnloadProduct(), Industry.BeginUnload()

public bool Vehicle.CanLoadProductFromQueue ( ProductQueue queue ) [inline]

Determines if the given queue can be used to load this vehicle.

Parameters:
queue Queue to test for loading compatibility.
Returns :
Returns true if queue can be used to load to this vehicle, false otherwise.

public bool Vehicle.CanUnloadProductToQueue ( ProductQueue queue ) [inline]

Determines if the given queue can be used to unload from vehicle.

Parameters:
queue Queue to test for unloading compatibility.
Returns :
Returns true if queue can be used to unload from this vehicle, false otherwise.

public native bool Vehicle.Couple ( Vehicle other )

Couples this vehicle to the given vehicle that is already adjacent to it.

When a vehicle is decoupled from another, the couplers are left in an unlocked state, even though the vehicles are flush against each other. This state will remain until the vehicles move a small distance apart. Sometimes you may wish to cause them to couple again which is what this method is for.

This method will cause this vehicle to couple to other if they are already flush against each other. If they are not that close to each other, this method will have no effect.

Parameters:
other Adjacent vehicle to couple with this one.
Returns :
Returns true if the two vehicles were coupled successfully, or false otherwise.

float Vehicle.EndLoad ( LoadingReport report ) [inline]

Call-back method to perform custom activities after this vehicle is loaded.

This method is called by LoadProduct() to perform any custom activities required after loading such as deactivating particles or stopping animation. Implementing this method in a vehicle script is not compulsory, but is essential if such custom activity is desired.

Parameters:
report Report on the current state of the loading operation.
Returns :
The amount of time needed in seconds for how long this custom activity runs for should be returned. For example, the length of an audio file or animation that may have been played would be an appropriate return value.
See also:
LoadProduct(), Industry.EndLoad()

float Vehicle.EndUnload ( LoadingReport report ) [inline]

Call-back method to perform custom activities after this vehicle is unloaded.

This method is called by UnloadProduct() to perform any custom activities required after unloading such as activating particles or starting animation. Implementing this method in a vehicle script is not compulsory, but is essential if such custom activity is desired.

Parameters:
report Report on the current state of the unloading operation.
Returns :
The amount of time needed in seconds for how long this custom activity runs for should be returned. For example, the length of an audio file or animation that may have been played would be an appropriate return value.
See also:
UnloadProduct(), Industry.EndUnload()

public native float Vehicle.GetAuxReservoirPressure ( void )

Gets the current auxiliary reservoir pressure of this vehicle.

Returns :
Returns the current auxiliary reservoir pressure of this vehicle.

public native Bogey [] Vehicle.GetBogeyList ( void )

Gets a list of all the bogeys this vehicle has.

Returns :
Returns the bogeys this vehicle has in an array. This array contains references to each Bogey instance this vehicle has.

public native float Vehicle.GetBrakeCylinderPressure ( void )

Gets the current brake cylinder pressure of this vehicle.

Returns :
Returns the brake cylinder pressure of this vehicle.

public native float Vehicle.GetBrakePipePressure ( void )

Gets the current brake pipe pressure of this vehicle.

Returns :
Returns the brake pipe pressure of this vehicle.

public native float Vehicle.GetCabinSwayAmount ( void )

Gets the cabin sway amount for this vehicle.

Note:
See the SetCabinSwayAmount() method for details on cabin sway.
Returns :
Returns the cabin sway amount for this vehicle. Higher positive values indicate higher levels of cabin sway while a 0.0 indicates no cabin sway.

public native bool Vehicle.GetCouplerBreakageEnabled ( void )

Determines of coupler breakage is enabled on this vehicle.

Returns :
Returns true if coupler breakage is enabled on this vehicle, false otherwise.

public native int Vehicle.GetCouplingDirection ( Vehicle other )

Gets the coupling direction of the given neighboring vehicle.

Parameters:
other Neighboring vehicle to get the coupling direction of.
Returns :
Returns the coupling direction of vehicle (in relation to this one).

public native float Vehicle.GetCouplingStress ( Vehicle toVehicle )

Gets the coupling stress between this vehicle and another vehicle.

Parameters:
toVehicle Other vehicle in the same consist as this vehicle to calculate the coupling stress load between.
Returns :
Returns the coupling stress between this vehicle and toVehicle in kilo Newtons (kN).
See also:
Train.GetMaximumCouplingStressVehicle()

public native float Vehicle.GetDefaultCabinSwayAmount ( void )

Gets the default cabin sway factor for this vehicle.

Note:
See the SetCabinSwayAmount() method for details on cabin sway.
Returns :
Returns the default cabin sway factor for this vehicle as defined in its configuration. Higher positive values indicate higher levels of cabin sway while 0.0 indicates no cabin sway be default.

public native float Vehicle.GetDefaultMaximumCouplerCompressionStress ( void )

Gets the default maximum coupler compression stress value for this vehicle.

Note:
See the SetMaximumCouplerCompressionStress() method for a description of what this vehicle parameter is about.
Returns :
Returns the maximum coupler compression stress value for this vehicle. This returned value will refer to the asset's configuration and will be unaffected by the any changes applied to this particular vehicle object via SetMaximumCouplerCompressionStress().

public native float Vehicle.GetDefaultMaximumCouplerExpansionStress ( void )

Gets the default maximum coupler expansion stress value for this vehicle in kilo Newtons (kN).

Note:
See the SetMaximumCouplerExpansionStress() method for a description of what this vehicle parameter is about.
Returns :
Returns the default maximum coupler expansion stress value for this vehicle in kilo Newtons (kN). This returned value will refer to the asset's configuration and will be unaffected by the any changes applied to this particular vehicle object via SetMaximumCouplerExpansionStress().

public native float Vehicle.GetDefaultMaximumCoupleVelocity ( void )

Gets the default maximum speed at which this vehicle can be coupled to without breaking the coupler.

Note:
See SetMaximumCoupleVelocity() for further details on what this value means.
Returns :
Returns the default maximum coupler velocity value for this vehicle in MPS (meters per second). This setting is part of the vehicle's configuration and can't be changed via SetMaximumCoupleVelocity().

public native float Vehicle.GetDefaultMaximumTractiveEffort ( void )

Gets the default maximum tractive effort of this vehicle from its configuration in kilo Newtons (kN).

Note:
See the SetMaximumTractiveEffort() method for details on the maximum tractive effort of a vehicle.
Returns :
Returns the default maximum tractive effort of this vehicle as defined in its configuration in kilo Newtons (kN). This returned value will refer to the asset's configuration and will be unaffected by the any changes applied to this particular vehicle object via SetMaximumTractiveEffort().

public string Vehicle.GetDescriptionHTML ( void ) [inline]

Gets a description of this PropertyObject as a HTML page.

This method is called by Trainz from Surveyor to get the properties of the object as HTML code for display in a Browser window.

In the default PropertyObject implementation, if a property handler is present the handler's GetDescriptionHTML() method is called to get the properties as a HTML page. Otherwise an empty string will be returned.

Property link URLs should be in the form of "live://property/foobar" where foobar is the non-localized name of the property. When one of these links is clicked on, Trainz will call LinkPropertyValue(), which must be implemented if the link is to be acted on. Note that properties used in URLs must be of type link.

Returns :
Returns a HTML description of the PropertyObject to be displayed to the user in the Surveyor Rules Editor. Properties should appear as links and summarize the current setting so that the user can edit them.
Note:
To aid in localization, any text should be extracted from the PropertyObject's asset's StringTable and not included in script code as a literal string.
See also:
Browser, HTMLPropertyHandler.GetDescriptionHTML()

Reimplemented from PropertyObject.

public native bool Vehicle.GetDirectionRelativeToTrain ( void )

Get the forward direction of this vehicle relative to its Train.

Returns :
Returns true if the vehicle faces the same way as the Train, false otherwise.

public native float Vehicle.GetEngineParam ( string p_paramName )

Gets the value of the named engine parameter.

Engine parameter strings you can use with this method are:

  • "brake-cylinder-pressure"
  • "brake-pipe-pressure"
  • "coal-mass"
  • "current-drawn"
  • "equaliser-pressure"
  • "fire-temperature"
  • "flow"
  • "horn"
  • "main-reservoir-pressure"
  • "max-coal-mass"
  • "max-fire-temperature"
  • "no3-pipe-pressure"
  • "steam-boiler-liquid-percent"
  • "steam-boiler-pressure"
  • "steam-piston-cycle"
  • "wheelslip"
  • "engine-force"
  • "applied-force"
  • "max-te"
These strings correspond to engine properties as described elsewhere in documents such as the Content Creation Guide (CCG). Some apply to steam locomotives only.
Parameters:
p_paramName Name of the parameter to get the value of.
Returns :
Returns the value of p_paramName if possible.

public native int Vehicle.GetEngineType ( void )

Gets the engine type of this vehicle.

Returns :
Returns one of the engine type constants indicating the engine type of this vehicle.
See also:
Engine Types

public bool Vehicle.GetFacingRelativeToTrain ( void ) [inline]

BUGGY FUNCTION. OBSOLETE. DO NOT USE!

As an alternative, use GetDirectionRelativeToTrain() instead. This function is only retained for scenario backward compatibility reasons.

public native float Vehicle.GetLength ( void )

Gets the length of this vehicle.

Returns :
Returns the length of this vehicle in meters.
See also:
Measurement Conversion Multipliers

float Vehicle.GetLoadTime ( LoadingReport report ) [inline]

Gets the amount of time needed to load this vehicle.

This method is called by LoadProduct() to determine how long the loading operation should take in seconds. Custom events like animation and particles could also be handled in an overridden implementation.

Parameters:
report Report on the current state of the loading operation.
Returns :
Returns the amount of needed for the loading operation in seconds.
See also:
LoadProduct(), Industry.GetLoadTime()

public native float Vehicle.GetMass ( void )

Gets the mass of this vehicle in kilograms.

Returns :
Returns the mass of this vehicle in kilograms.

public native float Vehicle.GetMaximumCouplerCompressionStress ( void )

Gets the maximum coupler compression stress value for this vehicle.

Note:
See the SetMaximumCouplerCompressionStress() method for a description of what this vehicle parameter is about.
Returns :
Returns the maximum coupler compression stress value for this vehicle in kilo Newtons (kN). A value of 0.0 indicates that there is no coupler breakage on this vehicle.

public native float Vehicle.GetMaximumCouplerExpansionStress ( void )

Gets the maximum coupler expansion stress value for this vehicle in kilo Newtons (kN).

Note:
See the SetMaximumCouplerExpansionStress() method for a description of what this vehicle parameter is about.
Returns :
Returns the maximum expansion stress in kilo Newtons (kN), or 0.0 for no breakage.

public native float Vehicle.GetMaximumCoupleVelocity ( void )

Gets the maximum velocity at which this vehicle can be coupled to without breaking a coupler.

Note:
See the SetMaximumCoupleVelocity() method for details on what this parameter is about.
Returns :
Returns the maximum delta velocity in meters/sec, or 0.0 for no coupler breakage above a certain velocity.

public native float Vehicle.GetMaximumTractiveEffort ( void )

Gets the maximum tractive effort of this vehicle in kilo Newtons (kN).

Note:
See the SetMaximumTractiveEffort() method for details on the maximum tractive effort of a vehicle.
Returns :
Returns the current maximum tractive effort of this vehicle in kilo Newtons (kN).

public native Train Vehicle.GetMyTrain ( void )

Gets the Train this vehicle belongs to.

Note:
All vehicles belong to a Train consist, even if a vehicle is solo without being coupled to any other vehicles, it is still a member of a consist (a consist with one vehicle though).
Returns :
Returns the Train consist this vehicle currently belongs to.
See also:
Train.GetVehicles()

public ProductFilter Vehicle.GetProductRestriction ( void ) [inline]

Gets the current product restriction filter of this vehicle.

Returns :
Returns the current product restriction filter if any, null otherwise if there is no restriction in effect.
See also:
ProductFilter

public Soup Vehicle.GetProperties ( void ) [inline]

Saves the state of this vehicle's product filter in a Soup database.

Note:
If overriding this method to handle your own custom vehicle properties, always call back to this parent method via the inherited keyword. Otherwise you run the risk of your vehicle not behaving correctly and even becoming incompatible with future versions of Trainz.
Returns :
Returns the properties of this vehicle in a Soup to be saved.

Reimplemented from PropertyObject.

public string Vehicle.GetPropertyDescription ( string p_propertyID ) [inline]

Gets the localized description text for the named property.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will return what the handler's GetPropertyDescription() method does. Otherwise, a generic description will be returned as a default.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Returns the localized description text for propertyID.
See also:
HTMLPropertyHandler.GetPropertyDescription()

Reimplemented from PropertyObject.

public string [] Vehicle.GetPropertyElementList ( string propertyID ) [inline]

Gets a list of elements the user can select for the named property.

This method is called to get the list of elements for the named property. Trainz will rely on it to get the elements if a property is of type "list", as returned by GetPropertyType(), so it can then display them in a pop-up window for user selection.

The script programmer is free to fill the returned elements array from the current game environment and can create this dynamically if necessary (e.g. a list of industries in the current route). Remember that these elements will be presented to the user in a pop-up selection box, so be mindful of making them human-friendly and not too wide.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will return what the handler's GetPropertyElementList() method does. Otherwise, an empty list will be returned as a default.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that list the elements in propertyID.
See also:
HTMLPropertyHandler.GetPropertyElementList()

Reimplemented from PropertyObject.

public string Vehicle.GetPropertyName ( string propertyID ) [inline]

Gets the localized human-readable name of the specified property.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will return what the handler's GetPropertyName() method does. Otherwise, a generic name will be returned as a default.

Parameters:
propertyID Name of the property to get the readable name for.
Returns :
Returns a human-readable name for propertyID.
See also:
HTMLPropertyHandler.GetPropertyName()

Reimplemented from PropertyObject.

public string Vehicle.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is used by Trainz to determine the type of the named property. It is a method that needs to be overridden in a child class to handle whatever properties that class has.

The type of a property is defined as a string describing what type of data the property holds as well as extra information about the range, size and increment count (depending on the property type). Property types supported include string, float, int, list and link. The returned string must be prefixed with one of these type names.

You can optionally include the minimum and maximum range of the value for string, float and int types and the increment level for float and int types. The list type has one optional parameter that may be 0 or 1 to disable or enable sorting of elements.

For example:
Type String | Description
"string,0,200" | A string that can be 0 through to 200 characters in length.
"float,0,20,0.2" | Float value in the range of [0.0 - 20.0] with incremental steps of 0.2.
"int,0,50,2" | Integer value in the range of [0 - 50] with incremental steps of 2.
"list,1" | List type with sorting of added elements.
"link" | No extra options required.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Returns a string describing the type of propertyID. The default PropertyObject implementation will either return whatever the handler provides or "null" (not to be confused with a null value) if there is no handler.
See also:
HTMLPropertyHandler.GetPropertyType()

Reimplemented from PropertyObject.

public native int Vehicle.GetRelationToTrack | ( | Buildable | obj,
 |  | string | trackName
 | ) |

Gets the direction of this vehicle in relation to a track in a game object.

The relation of a vehicle to the track is based on the vehicle's direction. For example, if the vehicle's forward direction is facing towards the track, then the vehicle is considered to be forward relative to that track, hence DIRECTION_FORWARD will be returned.

This method will work if the vehicle is on the track as specified by the arguments or on a directly neighboring track, otherwise DIRECTION_NONE will be returned.

Parameters:
obj | Object where trackName can be found (e.g. an Industry).
trackName | Name of track section in obj (an industry track for example).
Returns :
Returns either DIRECTION_FORWARD or DIRECTION_BACKWARD to indicate the relation between this vehicle and the track. DIRECTION_NONE is returned if this vehicle is not located on trackName or a directly neighboring track.

public native string Vehicle.GetRunningNumber ( )

Gets the running number of this vehicle.

Returns :
Returns the running number of this vehicle.

public native float Vehicle.GetSandingTractionMultiplier ( void )

Gets the sanding traction multiplier value.

Note:
See the SetSandingTractionMultiplier() method for details on the sanding traction multiplier value.
Returns :
Returns the wheelslip traction multiplier value which will be greater than or equal to 1.0.

public native float Vehicle.GetTrackGradient ( void )

Gets the gradient of the track this vehicle is currently on.

Note:
The vehicle's direction however may vary from the train's so the value returned here may not necessarily match that of the train. GetDirectionRelativeToTrain() can determine this for you.
Returns :
Returns the gradient of the track as a percentage. The signs of the gradient is determined by the direction of this vehicle relative to the gradient. A negative sign indicates that the vehicle is facing down a gradient while a positive sign indicates the vehicle is facing up a gradient.

float Vehicle.GetUnloadTime ( LoadingReport report ) [inline]

Gets the amount of time needed to unload this vehicle.

This method is called by UnloadProduct() to determine how long the unloading operation should take in seconds. Custom events like animation and particles could also be handled in an overridden implementation.

Parameters:
report Report on the current state of the unloading operation.
Returns :
Returns the amount of needed for the unloading operation in seconds.
See also:
UnloadProduct(), Industry.GetUnloadTime()

public native int Vehicle.GetVehicleTypeFlags ( void )

Gets a flag set that define what type of vehicle this vehicle actually is.

Returns :
Returns a flag set as defined by the Vehicle Types that tells us what type of vehicle we have here.

public native float Vehicle.GetVelocity ( void )

Gets the velocity of this vehicle in MPS (meters per second).

This function provides the instantaneous velocity for this vehicle, which is good for physics calculations but not good for human-readable display. If you want human-readable display, use Train.GetSmoothedVelocity() instead.

Note:
For conversion formulas, see the Measurement Conversion Multipliers constants.
Returns :
Returns the velocity of this vehicle. A positive value means the vehicle is going forward while a negative value means the vehicle is going backward.

public native float Vehicle.GetWheelslipTractionMultiplier ( void )

Gets the wheelslip traction multiplier value.

Note:
See the SetWheelslipTractionMultiplier() method for details on the wheelslip traction multiplier value.
Returns :
Returns the wheelslip traction multiplier value that will be in the range of [0.0 - 1.0].

public void Vehicle.Init ( void ) [inline]

Called by Trainz to initialize this Vehicle.

This method is implemented in Vehicle so the following message handlers are setup:

  • ViewDetails() is called on the ("MapObject", "ViewDetails") message.
  • UpdateViewDetails() is called on the ("Vehicle", "LoadComplete") message.
  • ViewSchedule() is called on a ("MapObject", "View-Schedule") message.
Note:
If overriding this method to perform your own custom vehicle initialization, always call back to this parent method via the inherited keyword.

Reimplemented from MeshObject.

public native bool Vehicle.IsInTunnel ( void )

Determines if this vehicle is in a tunnel.

Returns :
Returns true if this vehicle is in a tunnel, false otherwise.

public native bool Vehicle.IsOnBridge ( void )

Determines if this vehicle is on a bridge.

Returns :
Returns true if this vehicle is on a bridge, false otherwise.

void Vehicle.LinkPropertyValue ( string propertyID ) [inline]

Call-back method for when the named property of type link is clicked on.

This method is called by Trainz if a property of type link (as determined by GetPropertyType()) is clicked on in a URL from the HTML page returned by GetDescriptionHTML().

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will call the handler's SetPropertyValue() method to handle the link.

Parameters:
propertyID Name of the property clicked on.
See also:
HTMLPropertyHandler.SetPropertyValue()

Reimplemented from PropertyObject.

public bool Vehicle.LoadProduct ( LoadingReport report )

Loads products into this vehicle as defined by the given report.

This method works by attempting to transfer products to this vehicle's queues if possible from the industry queue specified in report. The sequence of events for a loading operation as performed by this method are:

  • Verify that an loading operation is possible with this vehicle by calling CanLoadProductFromQueue().
  • BeginLoad() on this vehicle as well as Industry.BeginLoad() on the industry specified in report are called to perform any pre-loading events like animation or particles on the vehicle and industry respectively. Both of these methods return the amount of time required for a load operation and this LoadProduct() method sleeps for which ever of these returned time lengths is the longest.
  • The actual product transfer from the industry to the vehicle is performed by calling ProductQueue.TransferProductFrom() on this vehicle's queue(s).
  • GetLoadTime() on this vehicle as well as Industry.GetLoadTime() on the industry are called. Again, LoadProduct() sleeps for which ever is the longest returned length of time.
  • EndLoad() on this vehicle and Industry.EndLoad() on the industry are called to perform any post-loading events. As before, LoadProduct() sleeps for which ever is the longest returned length of time.
Parameters:
report LoadReport defining the destination queue in an Industry to load from well as the type and quantity of product to load.
Returns :
Returns true if this vehicle was successfully loaded with one or more products, false otherwise.
See also:
Industry.BeginLoad(), Industry.GetLoadTime(), Industry.EndLoad(), LoadingReport.GetSrcIndustry(), ProductQueue.TransferProductFrom()

public native bool Vehicle.Reposition | ( | Train | train,
 |  | int | myCoupleDirection,
 |  | int | otherCoupleDirection
 | ) |

Attaches this vehicle to the given train at the specified couplers.

For example, consider vehicle1 and train1:

       // couple vehicle1 to vehicle2, back to back. vehicle1 will be repositioned.
       vehicle1.Reposition(vehicle2, Vehicle.COUPLE_BACK, Vehicle.COUPLE_BACK);

The above code example results in vehicle1 to be repositioned and coupled up from its rear coupler to the back of train1.

Parameters:
train | Other train to reposition this vehicle to attach to.
myCoupleDirection | End of this vehicle that will be coupled to train (use either COUPLE_FRONT or COUPLE_BACK).
otherCoupleDirection | End of train that will be coupled to this vehicle (use either COUPLE_FRONT or COUPLE_BACK).
Returns :
Returns true if successful, false otherwise.
See also:
Coupler Flags

public native bool Vehicle.Reposition | ( | Vehicle | other,
 |  | int | myCoupleDirection,
 |  | int | otherCoupleDirection
 | ) |

Attaches this vehicle to the given vehicle at the specified couplers.

For example, consider vehicle1 and vehicle2:

       // couple vehicle1 to vehicle2, back to back. vehicle1 will be repositioned.
       vehicle1.Reposition(vehicle2, Vehicle.COUPLE_BACK, Vehicle.COUPLE_BACK);

This above code examples results in vehicle1 being repositioned and coupled up from rear its rear to the back of vehicle2.

Parameters:
other | Other vehicle to attach to.
myCoupleDirection | End of this vehicle that will be coupled to other (use either COUPLE_FRONT or COUPLE_BACK).
otherCoupleDirection | End of other that will be coupled to this vehicle (use either COUPLE_FRONT or COUPLE_BACK).
Returns :
Returns true if successful, false otherwise.
See also:
Coupler Flags

public native bool Vehicle.Reposition | ( | TrackMark | mark,
 |  | bool | direction
 | ) |

Take this vehicle out of its current train and create it as a new train at the given track mark.

Parameters:
mark | Destination track mark.
direction | Desired direction relative to the track mark. Use true to have the vehicle face the same direction as the track mark, false to have the vehicle facing the opposite way.
Returns :
Returns true if successful, false otherwise.

public native bool Vehicle.Reverse ( )

Reverses the direction of this vehicle in relation to its consist.

Returns :
Returns true if successful, false otherwise.

public native void Vehicle.SetBrakePipeEfficiency ( float efficiency )

Sets the brake pipe efficiency of this vehicle.

Parameters:
efficiency Normalized value in the range of [0.0 - 1.0] where the lower the value, less efficient the brake pipe is.

public native void Vehicle.SetBrokenBrakes ( bool broken )

Sets the broken state of this vehicle's brakes.

Parameters:
broken Broken state to set the working state of this vehicle's brakes to. If true, brakes are broken, false for unbroken brakes.

public native void Vehicle.SetCabinSwayAmount ( float amount )

Sets the cabin sway level for this vehicle.

This method controls the amplitude of the cabin sway effect as seen from the internal cabin view. It will not affect the vehicle from any other views.

Parameters:
amount Level of cabin sway to apply to this vehicle that is >= 0.0. A value of 0.0 means no cabin sway. The cabin sway will increase with higher positive values.
Note:
It is probably a waste of time using this method for vehicles without cabins or interiors.

public native void Vehicle.SetCouplerBreakageEnabled ( bool enabled )

Enables/disables coupler breaking on this vehicle.

This method allows coupler breakage to be either be switched on or off.

Note:
Once you break a coupler, you can't repair it.
Parameters:
enabled Coupler breakage enabled state. If true, this vehicle well have coupler breakage false for no coupler breakage.

public native void Vehicle.SetCouplingMask ( int couplingMask )

Sets the coupling mask for this vehicle.

Masking the coupling flags of a vehicle prevents the user from coupling to the masked couplers.

Parameters:
couplingMask Coupling mask setting for this vehicle. Can be any one of the Coupler Flags values.
See also:
Train.SetCouplingMask(), Coupler Flags

public native void Vehicle.SetDecouplingMask ( int couplingMask )

Stops the player being able to decouple consists.

Masking the decoupling flags of a vehicle prevents the user from decoupling the masked couplers.

Note:
See the Coupling Flags section for details on how coupling and decoupling masks work.
Parameters:
couplingMask Decoupling mask setting for this vehicle. Can be any one of the Coupler Flags values.
See also:
Train.SetDecouplingMask(), Coupler Flags

public native void Vehicle.SetHandBrake ( bool applied )

Sets the handbrake state for this vehicle.

The handbrake should be used when leaving rolling stock (no locos) on slopes.

Parameters:
applied Handbrake state. If true, the handbrake is applied, use false to release it.

public native void Vehicle.SetHeadlightColor | ( | float | red,
 |  | float | green,
 |  | float | blue
 | ) |

Sets the headlight color of this vehicle.

This method controls the color of spotlight with the given RGB color components. It does not affect the color of the headlight coronas. This should method never be used to "turn off" the headlight, as even a black light will chew CPU time with lighting calculations.

Parameters:
red | Red component value of headlight color. Must be a normalized value in the range of [0.0 - 1.0].
green | Green component value of headlight color. Must be in the range of [0.0 - 1.0].
blue | Blue component value of headlight color. Must be in the range of [0.0 - 1.0].

public native void Vehicle.SetMaximumCouplerCompressionStress ( float maxCouplerCompressionStress )

Sets the maximum coupler compression stress value for this vehicle.

This value refers to the maximum compression stress in kilo Newtons (kN) this vehicle's couplers need to experience before they break. This is effectively incoming force a coupler can withstand before it breaks. As a point of reference, a typical modern knuckle-type coupler can handle approximately 2500 kN of force before breaking

Parameters:
maxCouplerCompressionStress Maximum stress compression stress in kilo Newtons (kN). Use 0.0 for no breakage.

public native void Vehicle.SetMaximumCouplerExpansionStress ( float maxCouplerExpansionStress )

Sets the maximum coupler expansion stress value for this vehicle.

The maximum coupler expansion stress value defines the maximum stress in kilo Newtons (kN) requried for the couplers to break when being pulled on. A typical modern knuckle-type coupler can handle approximately 2500 kN of force before breaking (which is the default setting used by the Vehicle Physics rule.

Parameters:
maxCouplerExpansionStress Maximum expansion stress value in kilo Newtons (kN).

public native void Vehicle.SetMaximumCoupleVelocity ( float maxCoupleVelocity )

Sets the maximum speed at which this vehicle can be coupled to without breaking a coupler.

This value refers to the maximum speed this vehicle can be coupled at without breaking a coupler. When an attempt to couple with this vehicle at a velocity greater than maxCoupleVelocity is made, the ("Vehicle", "BadCouple") broadcast message is generated.

Parameters:
maxCoupleVelocity Maximum delta velocity in meters per second. Use 0.0 for no "BadCouple" messages.

public native void Vehicle.SetMaximumTractiveEffort ( float maxTE )

Sets the maximum tractive effort of this vehicle in kilo Newtons (kN).

The maximum tractive effort of a vehicle refers to its maximum traction or pulling power that it is capable of in kilo Newtons (kN). This value is initially defined in the configuration of a vehicle asset but can be altered with this method. Generally, only locomotives will have tractive effort.

Parameters:
maxTE Maximum tractive effort of this vehicle in expressed in kilo Netwons (kN).

public native void Vehicle.SetPitchBasedOnSpeed ( float multiplier )

Sets the pitch of this vehicle based on its speed.

Parameters:
multiplier Value which will cause the vehicle to pitch based on its velocity.

public native void Vehicle.SetPitchBasedOnTrack ( bool pitchBasedOnTrack )

Enables/disables the pitch of this vehicle to be based on the track.

Parameters:
pitchBasedOnTrack If true, pitch of this vehicle (up/down) will be based on the track. Default is false.

public void Vehicle.SetProductDisabled ( void ) [inline]

Disabled this vehicle from the loading and unloading of all products.

Note:
This function overrides any previous call to SetProductRestriction().
See also:
ProductFilter

public bool Vehicle.SetProductRestriction ( Asset product ) [inline]

Restricts this vehicle to only allow the given product.

When a product restriction is in effect, only that product may be either loaded or unloaded.

Note:
This method overrides any previous call to SetProductDisabled().
Parameters:
product Product to restrict this vehicle's load to. If null, any product compatible with this vehicle can be loaded/unloaded. If it is a product that is not compatible with this vehicle, no restriction is set and false will be returned.
Returns :
Returns true if successful, false otherwise.
See also:
ProductFilter

public void Vehicle.SetProperties ( Soup soup ) [inline]

Initializes this vehicle's product queues from the given Soup database.

The Vehicle implementation of this method is used to initialize this vehicle's queues with products, thus allowing a vehicle's load to be saved and loaded specifically for a session.

Note:
If overriding this method to handle your own custom vehicle properties, always call back to this parent method via the inherited keyword. Otherwise you run the risk of your vehicle not behaving correctly and even becoming incompatible with future versions of Trainz.
Parameters:
soup Properties soup to initialize this vehicle from.

Reimplemented from PropertyObject.

void Vehicle.SetPropertyValue | ( | string | propertyID,
 |  | string | value,
 |  | int | index
 | ) | [inline]

Sets the value of the named property.

This method is called when a list property item is changed.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will call the handler's SetPropertyValue() method to set the property.

Parameters:
propertyID | Name of the list property to set the value of.
value | String to set the property's value to.
index | Index of item from the list to set.
Note:
For compatibility, SetPropertyValue(string,string,int) should call SetPropertyValue(string,string).
See also:
HTMLPropertyHandler.SetPropertyValue()

Reimplemented from PropertyObject.

void Vehicle.SetPropertyValue | ( | string | propertyID,
 |  | int | value
 | ) | [inline]

Sets the value of the named property to given int.

In the PropertyObject implementation, this method will check for a property handler and if one exists, it will call the handler's SetPropertyValue() method to set the property.

Parameters:
propertyID | Name of the property to set the value of.
value | Value to set the property named by propertyID to.
See also:
HTMLPropertyHandler.SetPropertyValue()

Reimplemented from PropertyObject.

public native void Vehicle.SetRollBasedOnTrack ( float multiplier )

Sets the roll of this vehicle based on the track.

Parameters:
multiplier Value which will cause the vehicle to roll based on track curve.

public native void Vehicle.SetRunningNumber ( string rn )

Sets the running number of this vehicle.

Parameters:
rn Running number of this vehicle. This should be limited to spaces and digits but letters are allowed just in case.

public native void Vehicle.SetSandingTractionMultiplier ( float multiplier )

Sets the sanding traction multiplier.

The sanding traction multiplier value refers to how much switching on sanding affects this vehicle's tractive effort. It is a scalar value that increases this vehicle's tractive effort when sanding has been switched on.

Parameters:
multiplier Multiplier value to increase vehicle traction with when sanding is turned on. Must be >= to 1.0.

public native void Vehicle.SetWheelslipTractionMultiplier ( float multiplier )

Sets the wheelslip traction multiplier value of this vehicle.

The wheelslip traction multiplier value refers to how much the occurrence of wheelslip affects this vehicle's traction. It is a scalar value that reduces this vehicle's tractive effort when experiencing wheelslip.

Parameters:
multiplier Factor to modify the traction of this vehicle when experiencing wheelslip. Must be in the range of [0.0 - 1.0].

public native void Vehicle.Uncouple ( int direction )

Uncouples this vehicle from another.

Parameters:
direction Is the direction of the neighboring vehicle to uncouple from. This will cause another Train object to be created. The current Train object will remain on the section of train with the most drivers declared.

public native void Vehicle.Uncouple ( Vehicle other )

Uncouple this vehicle from other given vehicle.

Parameters:
other Neighboring vehicle to uncouple from. This will cause another Train object to be created (i.e. a new consist). The current train object will remain on the section of train with the most drivers declared.

public bool Vehicle.UnloadProduct ( LoadingReport report )

Unloads products from this vehicle as defined by the given report.

This method works by attempting to transfer products from this vehicle's queues to the industry queue specified in report if possible. The sequence of events for an unloading operation as performed by this method are:

  • Verify that an actual unloading operation is possible with this vehicle by calling CanUnloadProductToQueue().
  • BeginUnload() on this vehicle as well as Industry.BeginUnload() on the industry specified in report are called to perform any pre-unloading events like animation or particles on the vehicle and industry respectively. Both of these methods return the amount of time required for an unload operation and this UnloadProduct() method sleeps for which ever of these returned time lengths is the longest.
  • The product transfer from the vehicle to the industry is performed by calling ProductQueue.TransferProductFrom() on this industry's destination queue.
  • GetUnloadTime() on this vehicle as well as Industry.GetUnloadTime() on the industry are called. Again, UnloadProduct() sleeps for which ever is the longest returned length of time.
  • EndUnload() on this vehicle and Industry.EndUnload() on the industry are called to perform any post-unloading events. As before, UnloadProduct() sleeps for which ever is the longest returned length of time.
Parameters:
report LoadReport defining the destination queue in an Industry to unload to as well as the type and quantity of product to unload.
Returns :
Returns true if this vehicle has successfully unloaded one or more products, false otherwise.
See also:
Industry.BeginUnload(), Industry.GetUnloadTime(), Industry.EndUnload(), LoadingReport.GetDstIndustry(), ProductQueue.TransferProductFrom()

The documentation for this class was generated from the following file:
  • vehicle.gs


VehicleDescriptor Class Reference

List of all members.

Public Attributes

public KUID | vehicle
KUID of vehicle asset.

public string | runningNumber = ""
Running number of vehicle.

public bool | facing = true
Direction of vehicle relative to train's forward direction.

public int | number = 1
Number of vehicles matching this description in the consist. Default is always 1.

public LoadHelperInfo[] | load = new LoadHelperInfo[0]
Load/s this vehicle may be carrying/support.

Detailed Description

Describes a vehicle in a consist and provides functions to load/save with a Soup database.

This class describes a vehicle in a consist in terms of its KUID, running number and direction. It also allows for multiple load definition.

Note that this class does not refer to a specific Vehicle instance, it just describes one for use in the ConsistHelperInfo class.

See also:
ConsistHelperInfo, LoadHelperInfo, Soup, ConsistListHelper, Vehicle, VehicleHelperInfo

The documentation for this class was generated from the following file:
  • ConsistHelperInfo.gs


VehicleHelperInfo Class Reference

Inheritance diagram for VehicleHelperInfo:

HTMLPropertyGroup List of all members.

Public Methods

public string | GetDescriptionHTML (void)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)

Detailed Description

Handler class that allows attributes of a vehicle to be built for filtering purposes.

This class describes various attributes of a vehicle including possible names, types and drivers (from the host train). It includes the functionality to check a given Vehicle instance against this criteria.

VehicleHelperInfo is very similar to TrainHelperInfo except that it provides filter checks for a Vehicle, not an entire Train consist.

The Vehicle Physics rule provides a usage example.

Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be seen in the \Trainz\scripts\VehicleHelperInfo.gs script file.
See also:
VHIDriversInfo, VHISpecificVehiclesInfo, VHIVehicleTypesInfo, TrainHelperInfo, ConsistHelperInfo

Member Function Documentation

public string VehicleHelperInfo.GetDescriptionHTML ( void ) [inline]

Gets a HTML description of this group handler based on all of the child handlers.

Overridden from HTMLPropertyHandler.GetDescriptionHTML() to get the HTML description of each child handler in this group for inclusion in the returned description.

Returns :
Returns a HTML description built up by gathering the descriptions of all of the child handlers.

Reimplemented from HTMLPropertyGroup.

public Soup VehicleHelperInfo.GetProperties ( void ) [inline]

Gets this handler's properties in a database.

Overridden from HTMLPropertyHandler.GetProperties() to save the properties of all sub handlers and then return a Soup containing a sub-database for each sub handler obtained by calling the sub handlers GetProperties() method.

Returns :
Returns a Soup database containing the saved properties of this group handler and its sub handlers.

Reimplemented from HTMLPropertyGroup.

public string VehicleHelperInfo.GetPropertyDescription ( string propertyID ) [inline]

Gets a description for the named property.

Overridden from HTMLPropertyHandler.GetPropertyDescription() to get the property name from the appropriate child handler.

Parameters:
propertyID Name of the property to get the description of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyDescription() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public string VehicleHelperInfo.GetPropertyName ( string propertyID ) [inline]

Gets a descriptive name for the given property.

Overridden from HTMLPropertyHandler.GetPropertyName() to get the property name from the appropriate child handler.

Parameters:
propertyID Name of the property to get the descriptive name of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyName() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public string VehicleHelperInfo.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

Overridden from HTMLPropertyHandler.GetPropertyType() to get the type of the named property from the appropriate child handler.

Parameters:
propertyID Name of the property to get the type of. This should be a full property string with group handler and sub handler prefixes.
Returns :
Returns whatever the sub handler's GetPropertyType() method does, "null" otherwise.

Reimplemented from HTMLPropertyGroup.

public void VehicleHelperInfo.SetProperties ( Soup soup ) [inline]

Initializes this handler's properties from the given database.

Overridden from HTMLPropertyHandler.SetProperties() to initialize all of the sub handlers from the given Soup database. The HTMLPropertyGroup implementation of this method assumes the sub handlers have already been added to the group handler - it only initializes existing sub handlers and generally isn't meant to create new sub handlers itself (although you can do that in your own overridden implementation if you really want to).

Parameters:
soup Database of property values to initialize this handler with. Sub-databases in side this soup will be used to initialize each sub-handler.

Reimplemented from HTMLPropertyGroup.

public void VehicleHelperInfo.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the value of the named property.

Overridden from HTMLPropertyHandler.SetPropertyValue() to set the value of the named property on the appropriate child handler.

Parameters:
propertyID | Name of the property to set the value of. This should be a full property string with group handler and sub handler prefixes.
value | Value to set the property to.

Reimplemented from HTMLPropertyGroup.

The documentation for this class was generated from the following file:
  • VehicleHelperInfo.gs


VehicleTypesInfo Class Reference

Inheritance diagram for VehicleTypesInfo:

SpecificVehiclesInfo List of all members.

Public Methods

public string[] | GetPropertyElementList (string propertyID)
public bool | DoesMatch (Train train)
public bool | DoesMatchAnd (Train train)
public bool | DoesMatchAndExlcude (Train train)

Detailed Description

Property handler that defines a list of specific vehicle asset types to filter.

This child class variation of SpecificVehiclesInfo filters vehicles based on the type they are (i.e. the Asset they are an instance of).

Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be seen in the \Trainz\scripts\TrainHelperInfo.gs script file.
See also:
SpecificVehiclesInfo, DriversInfo, TrainHelperInfo, VHIVehicleTypesInfo

Member Function Documentation

public bool VehicleTypesInfo.DoesMatch ( Train train ) [inline]

Determines if the given Train contains one or more of the vehicle types this handler has.

This method is used by TrainHelperInfo.DoesMatch() for the vehicle types part of the train filter. It is public and can also be called by any script code and used alone if desired.

Parameters:
train Train to compare the vehicle types of against this handler's list.
Returns :
Returns true if train contains at least one of the vehicle types that this handler specifies. Vehicle types in train that are not in this handler's list will not cause failure. If train does not contain one single vehicle type that this handler specifies, false is returned.
See also:
TrainHelperInfo.DoesMatch(), SpecificVehiclesInfo.DoesMatch(), DriversInfo.DoesMatch()

Reimplemented from SpecificVehiclesInfo.

public bool VehicleTypesInfo.DoesMatchAnd ( Train train ) [inline]

Determines if the given Train contains all of the vehicle types this handler has.

This method is a stricter version of DoesMatch() that requires the given train to have all of the vehicle types that this handler has. It is not used by TrainHelperInfo.DoesMatch() and is mainly provided as a convenience for use in child classes derived from TrainHelperInfo that may have stricter requirements.

Parameters:
train Train to compare the vehicle types of against this handler's list.
Returns :
Returns true if train contains all of the vehicle types that this handler specifies. Vehicle types in train that are not in this handler's list will not cause failure. If train does not contain all of the vehicle types that this handler specifies, false is returned.
See also:
SpecificVehiclesInfo.DoesMatchAnd(), DriversInfo.DoesMatchAnd()

Reimplemented from SpecificVehiclesInfo.

public bool VehicleTypesInfo.DoesMatchAndExlcude ( Train train ) [inline]

Determines if the given Train exclusively contains all of the vehicle types this handler has.

This method is a stricter version of DoesMatchAnd() that requires the given train to have all of the vehicle types in it that this handler has to the exclusion of all other vehicle types. It is not used by TrainHelperInfo.DoesMatch() and is mainly provided as a convenience for use in child classes derived from TrainHelperInfo that may have stricter requirements.

Parameters:
train Train to compare the vehicle types of against this handler's list.
Returns :
Returns true if train contains all of the vehicle types that this handler specifies and no other vehicle types. If train has a vehicle type that this handler's list doesn't, false will be returned.
See also:
SpecificVehiclesInfo.DoesMatchAndExlcude(), DriversInfo.DoesMatchAndExlcude()

Reimplemented from SpecificVehiclesInfo.

public string [] VehicleTypesInfo.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from SpecificVehiclesInfo.

The documentation for this class was generated from the following file:
  • TrainHelperInfo.gs


VHIDriversInfo Class Reference

Inheritance diagram for VHIDriversInfo:

VHISpecificVehiclesInfo List of all members.

Public Methods

public string[] GetPropertyElementList (string propertyID)

Detailed Description

A simple driver filter property handler.

This class is similar to DriversInfo except that it does filtering by looking for the presence of a driver from the given Vehicle's train. It is used by the VehicleHelperInfo group handler.

Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be seen in the \Trainz\scripts\VehicleHelperInfo.gs script file.
See also:
VHISpecificVehiclesInfo, VehicleTypesInfo, VehicleHelperInfo, DriversInfo

Member Function Documentation

public string [] VHIDriversInfo.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from VHISpecificVehiclesInfo.

The documentation for this class was generated from the following file:
  • VehicleHelperInfo.gs


VHISpecificVehiclesInfo Class Reference

Inheritance diagram for VHISpecificVehiclesInfo:

HTMLPropertyHandler VHIDriversInfo VHIVehicleTypesInfo List of all members.

Public Methods

public string | GetDescriptionHTML (void)
public string | GetPropertyName (string propertyID)
public string | GetPropertyDescription (string propertyID)
public string | GetPropertyType (string propertyID)
public void | SetPropertyValue (string propertyID, PropertyValue value)
public string[] | GetPropertyElementList (string propertyID)
public void | SetProperties (Soup soup)
public Soup | GetProperties (void)

Detailed Description

A simple vehicle filter property handler.

This class is similar to SpecificVehiclesInfo except that it does filtering by looking for the presence of a given Vehicle instance in its items list, not an entire Train consist. It is used by the VehicleHelperInfo group handler.

Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be seen in the \Trainz\scripts\VehicleHelperInfo.gs script file.
See also:
VHIDriversInfo, VHIVehicleTypesInfo, VehicleHelperInfo, SpecificVehiclesInfo

Member Function Documentation

public string VHISpecificVehiclesInfo.GetDescriptionHTML ( void ) [inline]

Gets the properties of this handler in HTML code.

This method is called by PropertyObject.GetDescriptionHTML() to get the properties of this handler as HTML code for display in a browser window.

See the PropertyObject.GetDescriptionHTML() method description for further details on how a HTML properties page should be constructed.

Returns :
Returns the HTML code that presents the properties for a Browser to display.
See also:
PropertyObject.GetDescriptionHTML()

Reimplemented from HTMLPropertyHandler.

public Soup VHISpecificVehiclesInfo.GetProperties ( void ) [inline]

Saves the properties of this handler to a soup and returns it.

This method is used to save the properties of a handler into a database. Care must be taken to ensure it writes data in the same tag format that SetProperties() is expecting it to be in.

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Returns :
Returns a private descriptor for the current properties in use by this object.
See also:
PropertyObject.GetProperties()

Reimplemented from HTMLPropertyHandler.

public string VHISpecificVehiclesInfo.GetPropertyDescription ( string propertyID ) [inline]

Gets a readable description for the named property.

This method is called by PropertyObject.GetPropertyDescription() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have descriptions to appear in Trainz such as in the tooltip of a property link for example.

Parameters:
propertyID Name of the property to get a human-friendly readable description of.
Returns :
Should return the localized description text for propertyID. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyDescription()

Reimplemented from HTMLPropertyHandler.

public string [] VHISpecificVehiclesInfo.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from HTMLPropertyHandler.

Reimplemented in VHIVehicleTypesInfo, and VHIDriversInfo.

public string VHISpecificVehiclesInfo.GetPropertyName ( string propertyID ) [inline]

Gets a readable name for the named property.

This method is called by PropertyObject.GetPropertyName() to get a readable description for the named property.

The script programmer will need to override this method if they want their properties to have names to appear in Trainz such as a label for the edit window of a property for example.

Parameters:
propertyID Name of the property to get a readable name for.
Returns :
Should return a short human-readable name for propertyID. The default HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyName()

Reimplemented from HTMLPropertyHandler.

public string VHISpecificVehiclesInfo.GetPropertyType ( string propertyID ) [inline]

Gets the type of the named property.

This method is called by PropertyObject.GetPropertyType() to get the type definition string for the named property.

See the PropertyObject.GetPropertyType() method for details on how a property type string is to be formatted.

Parameters:
propertyID Name of the property to get the type information for.
Returns :
Should return the type of the property named by propertyID in the required format as specified in the PropertyObject.GetPropertyType() description. The HTMLPropertyHandler implementation will always return the string "null" (not to be confused with a null value).
See also:
PropertyObject.GetPropertyType()

Reimplemented from HTMLPropertyHandler.

public void VHISpecificVehiclesInfo.SetProperties ( Soup soup ) [inline]

Initializes the properties of this handler from the given soup.

If the soup database is empty, then the PropertyObject should initialize itself with sensible defaults. If it does have tags, they will be in the private descriptor format as produced by GetProperties().

Note:
This method will only be called by the host PropertyObject if this handler's save properties flag is set.
Parameters:
soup Database to initialize this handler with.
See also:
PropertyObject.SetProperties()

Reimplemented from HTMLPropertyHandler.

public void VHISpecificVehiclesInfo.SetPropertyValue | ( | string | propertyID,
 |  | PropertyValue | value
 | ) | [inline]

Sets the named property to the specified value.

This method is called from a PropertyObject to set a property to a new value as specified in the arguments.

Parameters:
propertyID | Name of the property to set the value of.
value | Object describing that value to set the property to.
See also:
PropertyObject.LinkPropertyValue(), PropertyObject.SetPropertyValue(string,string,int), PropertyObject.SetPropertyValue(string,string), PropertyObject.SetPropertyValue(string,int), PropertyObject.SetPropertyValue(string,float)

Reimplemented from HTMLPropertyHandler.

The documentation for this class was generated from the following file:
  • VehicleHelperInfo.gs


VHIVehicleTypesInfo Class Reference

Inheritance diagram for VHIVehicleTypesInfo:

VHISpecificVehiclesInfo List of all members.

Public Methods

public string[] GetPropertyElementList (string propertyID)

Detailed Description

A simple vehicle type filter property handler.

This class is similar to VehicleTypesInfo except that it does filtering by looking for the presence of a given vehicle's type in its items list, not an entire Train consist. It is used by the VehicleHelperInfo group handler.

Note:
This class is not a part of the core Trainz API and isn't fully documented. The full class definition and implementation however can be seen in the \Trainz\scripts\VehicleHelperInfo.gs script file.
See also:
VHIDriversInfo, VHISpecificVehiclesInfo, VehicleHelperInfo, VehicleTypesInfo

Member Function Documentation

public string [] VHIVehicleTypesInfo.GetPropertyElementList ( string propertyID ) [inline]

Provides list of possible elements for the named list property.

This method is called by PropertyObject.GetPropertyElementList() to get a list of possible values that the named property can be.

See the PropertyObject.GetPropertyElementList() method for further details on list properties.

Parameters:
propertyID Name of the property to get the list elements for.
Returns :
Returns an array of strings that lists the possibly elements propertyID can be. The default HTMLPropertyHandler implementation will always return an empty list.
See also:
PropertyObject.GetPropertyElementList()

Reimplemented from VHISpecificVehiclesInfo.

The documentation for this class was generated from the following file:
  • VehicleHelperInfo.gs


World Class Reference

List of all members.

Public Methods

public native bool | LoadMap (KUID kuid)
public native bool | LoadMapTSO (Asset asset, string filename)
public native Train | CreateTrain (KUID[] consist, TrackMark mark, bool direction)
public native Train | CreateTrain (KUID[] consist, Buildable obj, string trackName, float position, bool direction)
public native Train | CreateTrain (KUID[] consist, string trackMarkName, bool direction)
public native void | DeleteVehicle (Vehicle vehicle)
public native void | DeleteTrain (Train train)
public native void | SetCamera (Train focus, int cameraMode)
public native void | SetCamera (Vehicle focus, int cameraMode)
public native void | SetCamera (Junction focus)
public native bool | SetCamera (MapObject obj)
public native void | SetCameraFlags (int cameraFlags)
public native void | SetCameraMode (int cameraMode)
public native void | UserSetCameraMode (int cameraMode)
public native bool | UserSetCamera (GameObject target)
public native void | SetCameraAngle (float yaw, float pitch, float radius)
public void | SetCameraAngle (int yaw, int pitch, float radius)
public native float | GetGameTime (void)
public native void | SetGameTime (float time)
public native void | SetGameTimeRate (int rate)
public native int | GetWeatherType ()
public native int | GetWeatherChangeability ()
public native void | SetWeather (int type, int changeability)
public native KUID | FindKUID (string name)
public native Asset | FindAsset (KUID kuid)
public native Asset[] | GetAssetList (string kind)
public native float | PlaySound (string filename, float volume, float minDistance, float maxDistance, GameObject target, string attachmentPoint)
Deprecated, use PlaySound(Asset,string,float,float,float,GameObject,string) instead.

public native float | PlaySound (Asset asset, string filename, float volume, float minDistance, float maxDistance, GameObject target, string attachmentPoint)
public float | Play2DSound (string filename)
Deprecated, use Play2DSound(Asset,string) instead.

public float | Play2DSound (Asset asset, string filename)
public void | EndScenario (float time)
public native ScenarioBehavior | CreateBehavior (KUID kuid, Soup initialProperties)
public native ScenarioBehavior[] | GetBehaviors (void)
public native GameObject[] | GetIndustryList (void)
public native Vehicle[] | GetVehicleList (void)
public native Train[] | GetTrainList (void)
public native Signal[] | GetSignalList (void)
public native TrackMark[] | GetTrackMarkList (void)
public native Trigger[] | GetTriggerList (void)
public native Junction[] | GetJunctionList (void)
public native void | RemoveDriverCharacter (DriverCharacter driverCharacter)
public native DriverCharacter[] | GetDriverCharacterList (void)
public native DriverCharacter | AddDriverCharacter (Asset driverCharacterAsset)
public native void | RemoveDriverCommand (DriverCommand command)
public native DriverCommand[] | GetDriverCommandList (void)
public native DriverCommand | AddDriverCommand (Asset driverCommandAsset)
public native DriverCommand | FindDriverCommand (Asset driverCommandAsset)
public native void | SetTargetObserver (GameObject observer)
public native float | GetSeconds (void)
public native int | GetCurrentModule (void)
public native Library | GetLibrary (KUID kuid)
public native string[] | GetSurveyorSavedConsistList (void)
public native Soup | GetSurveyorSavedConsist (string name)
public native float | GetTrainzVersion (void)
public native int | GetTrainzBuild (void)

Public Attributes

Camera View Modes

Camera view mode constants.

These values can be used to either choose the current camera viewing mode through World.SetCameraMode() or to restrict a certain camera modes from being accessed through methods such as World.SetCamera(Train,int).

See also:
World.SetCamera(Train,int), World.SetCamera(Vehicle,int), World.SetCameraFlags(), World.SetCameraMode(), Camera Flags

public define int | CAMERA_INTERNAL = 1
Internal cabin camera view.

public define int | CAMERA_EXTERNAL = 2
External train camera view.

public define int | CAMERA_TRACKING = 4
Tracking camera view.

public define int | CAMERA_ROAMING = 128
Roaming camera view.

Camera Flags

Camera flags are used to control what the user is allowed to do with the camera.

These flags are used in addition to the Camera Mode Flags to allow/disallow the user from performing certain actions with the camera.

See also:
World.SetCamera(Vehicle,int), World.SetCameraFlags(), World.SetCameraMode(), Camera View Modes

public define int | CAMERA_SWITCH_VIEWS = 8
User permitted to swap between the camera views.

public define int | CAMERA_SWITCH_VEHICLES = 16
User permitted to swap vehicles within the current train.

public define int | CAMERA_SWITCH_TRAINS = 32
User permitted to swap to other trains which are in the consist menu.

public define int | CAMERA_LOCKED = 64
User is NOT permitted to adjust camera (i.e. zoom, pan etc.).

public define int | CAMERA_NORMAL = CAMERA_INTERNAL | CAMERA_EXTERNAL | CAMERA_TRACKING | CAMERA_SWITCH_VIEWS | CAMERA_SWITCH_VEHICLES | CAMERA_SWITCH_TRAINS
Normal camera mode where everything is permitted.

Time Values

Time constants defined in seconds.

See also:
World.GetGameTime(), World.SetGameTime(), World.SetGameTimeRate(), Time Rate Constants

public define float | TIME_SECOND = 1.0f
One second.

public define float | TIME_MINUTE = TIME_SECOND * 60.0f
One minute defined as 60.0 seconds.

public define float | TIME_HOUR = TIME_MINUTE * 60.0f
One hour defined as 60.0 minutes (3600.0 seconds).

public define float | TIME_DAY = TIME_HOUR * 24.0f
One day defined as 24 hours (1440.0 minutes or 86400.0 seconds.

Weather Type Constants

Defines the current state of the weather in Trainz.

A variety of weather conditions are supported and can be changed by using one of these values with the World.SetWeather() method. The Weather Changeability settings define how much the weather state can change during play.

See also:
World.GetWeatherChangeability(), World.GetWeatherType(), World.SetWeather(), Weather Changeability Constants

public define int | WEATHER_TYPE_CLEAR = 0
Clear weather, no clouds, rain or snow.

public define int | WEATHER_TYPE_CLOUDY = 1
Cloudy weather, no rain.

public define int | WEATHER_TYPE_DRIZZLE = 2
Drizzle, light rain.

public define int | WEATHER_TYPE_RAIN = 3
Rainy weather.

public define int | WEATHER_TYPE_STORMY = 4
Stormy weather that includes lightening and thunder.

public define int | WEATHER_TYPE_LIGHT_SNOW = 5
Snowing lightly.

public define int | WEATHER_TYPE_MEDIUM_SNOW = 6
Medium level snow fall.

public define int | WEATHER_TYPE_HEAVY_SNOW = 7
Heavy snow fall.

Weather Changeability Constants

Defines the changeability settings for the weather.

The changeability of the weather determines how static or dynamic the weather is. Weather changeability does not refer to a specific weather type, but rather if variation from the current type is allowable.

See also:
World.GetWeatherChangeability(), World.GetWeatherType(), World.SetWeather(), Weather Type Constants

public define int | WEATHER_CHANGEABILITY_NONE = 0
Weather stays static and won't change.

public define int | WEATHER_CHANGEABILITY_PERIODIC = 1
Periodic changes in weather.

public define int | WEATHER_CHANGEABILITY_EXTREME = 2
Extreme and frequent changes in weather.

Time Rate Constants

Values that define the time rates relative to normal time.

These constants can be used to set the time rate that Trainz runs out through the World.SetGameTimeRate() method.

See also:
World.GetGameTime(), World.SetGameTime(), World.SetGameTimeRate(), Time Values

public define int | TIME_RATE_1X = 0
Normal time rate that is the same as real time (i.e. time in Trainz passes at the same rate you experience it in the real world!).

public define int | TIME_RATE_2X = 1
2 times faster than normal time (i.e. double speed).

public define int | TIME_RATE_4X = 2
4 times faster than normal time.

public define int | TIME_RATE_8X = 3
8 times faster than normal time.

public define int | TIME_RATE_16X = 4
16 times faster than normal time.

public define int | TIME_RATE_32X = 5
32 times faster than normal time.

public define int | TIME_RATE_60X = 6
60 times faster than normal time.

public define int | TIME_RATE_120X = 7
120 times faster than normal time.

public define int | TIME_RATE_240X = 8
240 times faster than normal time.

public define int | TIME_RATE_360X = 9
360 times faster than normal time.

public define int | TIME_RATE_480X = 10
480 times faster than normal time.

public define int | TIME_RATE_720X = 11
720 times faster than normal time.

public define int | TIME_RATE_960X = 12
960 times faster than normal time.

public define int | TIME_RATE_1200X = 13
1200 times faster than normal time.

public define int | TIME_RATE_1440X = 14
1440 times faster than normal time.

Trainz Module Modes

Trainz module mode constants.

These values define the various module environments that Trainz can be in.

See also:
World.GetCurrentModule()

public define int | NO_MODULE = 0
Trainz isn't running in a module.

public define int | SURVEYOR_MODULE = 1
Trainz is currently running in Surveyor.

public define int | DRIVER_MODULE = 2
Trainz is currently running in Driver.

Detailed Description

World is a static class used to access many things in the Trainz world.

This class is an interface to many miscellaneous items in the Trainz world including assets, cameras, industries, track marks, vehicles, weather, sound, time, routes, signals, driver commands and driver characters to name a few.

Note:
Some extra functionality is also provided by World1.
See also:
Asset, DriverCharacter, DriverCommand, Industry, Signal, ScenarioBehavior, TrackMark, Train, Vehicle, World1

Member Function Documentation

public native DriverCharacter World.AddDriverCharacter ( Asset driverCharacterAsset )

Adds a driver character to this world from the given asset.

Parameters:
driverCharacterAsset Asset of the driver character to add.
Returns :
Returns the DriverCharacter object that was added if successful, null otherwise.

public native DriverCommand World.AddDriverCommand ( Asset driverCommandAsset )

Adds a driver command to this world from the given asset.

Parameters:
driverCommandAsset Asset of the driver command to add.
Returns :
Returns the DriverCommand object that was added if successful, null otherwise.

public native ScenarioBehavior World.CreateBehavior | ( | KUID | kuid,
 |  | Soup | initialProperties
 | ) |

Creates an instance of the requested ScenarioBehavior and initializes it with the given properties.

Note:
The returned ScenarioBehavior object may be ended by releasing all references to it (i.e. resetting all references to something else or null).
Parameters:
kuid | KUID of behavior to get.
initialProperties | Properties to initialize the behavior with.
Returns :
Returns a new instance of the requested ScenarioBehavior if possible, null otherwise.
See also:
ScenarioBehavior.SetProperties()

public native Train World.CreateTrain | ( | KUID | consist[],
 |  | string | trackMarkName,
 |  | bool | direction
 | ) |

Creates a train as described by an array of vehicle KUIDs at the named track mark in the specified direction.

Parameters:
consist | An array of KUIDs of vehicles that make up the train.
trackMarkName | Name of the track mark to create the train consist at.
direction | Direction to orient the train in. If true, the train will face in the same direction as the track mark does, otherwise false and the train will face in the opposite direction of the track mark.
Returns :
Return a valid Train if successful, null on error.

public native Train World.CreateTrain | ( | KUID | consist[],
 |  | Buildable | obj,
 |  | string | trackName,
 |  | float | position,
 |  | bool | direction
 | ) |

Creates a train consist on the specified track of a Buildable scenery object.

Due to the nature of industry tracks being limited in size, it is advised that this method be used very carefully. You really need to know the length of the consist you are creating as well as the length and orientation of the track section as well to use this method effectively.

This method was intended to be used for purposes like creating a vehicle or two on an industry's track, not creating big consists. You could of course create a big consist if enough track is available, but that's not really what it is meant for.

Parameters:
consist | An array of KUIDs of vehicles that make up the train.
obj | Buildable object where track to create the train on can be found.
trackName | Name of the track to create the train on.
position | Position of where the consist is to be started. This is a distance in meters measured from where the track section starts.
direction | Orientation of the train consist relative to the direction of the track.
Returns :
Returns a valid Train if the consist was successfully created, null otherwise.
See also:
SceneryWithTrack.GetAttachedTrack(), Industry.HasTrack()

public native Train World.CreateTrain | ( | KUID | consist[],
 |  | TrackMark | mark,
 |  | bool | direction
 | ) |

Creates a train as described by an array of vehicle KUIDs at the given track mark in the specified direction.

Parameters:
consist | An array of KUIDs of vehicles that make up the train.
mark | TrackMark to place train consist at. Use Router.GetGameObject() to get track marks by name.
direction | Direction to orient the train in. If true, the train will face in the same direction as the track mark does, otherwise false and the train will face in the opposite direction of the track mark.
Returns :
Returns a valid Train if successful, null on error.

public native void World.DeleteTrain ( Train train )

Deletes a train from the current route.

Once a train is deleted, its Train reference should not be used.

Parameters:
train Train to be deleted.

public native void World.DeleteVehicle ( Vehicle vehicle )

Deletes the given vehicle from its train.

Parameters:
vehicle Vehicle to be deleted from its train.
See also:
Vehicle.GetMyTrain()

public void World.EndScenario ( float time ) [inline]

End the scenario by broadcasting a ("Scenario", "Quit") message.

Parameters:
time Amount of time in seconds to delay before ending the scenario.
Note:
Despite the name, this method also works in sessions.

public native Asset World.FindAsset ( KUID kuid )

Gets the asset that corresponds to the given KUID.

Parameters:
kuid KUID of asset to get a handle to.
Returns :
Returns the Asset object that corresponds to KUID if possible, null otherwise.

public native DriverCommand World.FindDriverCommand ( Asset driverCommandAsset )

Finds an existing driver command that matches the given asset.

Parameters:
driverCommandAsset Asset of the driver command to find.
Returns :
Returns the DriverCommand object that was found if successful, null otherwise.

public native KUID World.FindKUID ( string name )

Obsolete method.

This method is OBSOLETE and only works from within a Scenario script. Use Asset.LookupKUIDTable() instead to find the KUID of an object by name.

public native Asset [] World.GetAssetList ( string kind )

Gets all the assets of the given kind.

Parameters:
kind Name of asset kind to get the assets for.
Returns :
Return all installed assets that are of type kind.

public native ScenarioBehavior [] World.GetBehaviors ( void )

Gets the list of top-level behaviors (i.e. all rules on the currently loaded route).

Returns :
Returns a list of top-level scenario behaviors.
See also:
ScenarioBehavior.GetChildBehaviors()

public native int World.GetCurrentModule ( void )

Gets the current module Trainz is in at time of the function call.

A Potential Problem

Be careful when using this method as it may not necessarily be called when you expect it to be! This is a known potential problem a Driver session is launched from Surveyor via the 'Ctrl + F2' shortcut.

Although this quick launch shortcut may be a nice convenience, there is a side effect that creators of scripted assets need to be aware of. The reason being is that because Surveyor has already created and initialized the various game objects, Driver doesn't need to do as many initialization tasks.

This can become a problem when a scripted asset calls this method from its own Init() method to determine what to do.

For example, consider a monitoring thread for a game object that is only needed in Driver, so the Init() will check the game mode by using this method. When Surveyor calls the Init() method, it will check for the game mode, detect Surveyor and not start the monitoring thread.

However the problem comes in the transition to Driver where that thread is needed and Init() won't be re-called because of the shortcuts taken to do the quick launch. As a result, the asset may not behave in Driver as expected.

The Workaround

As a workaround to this problem, a message of type ("World", "ModuleInit") is broadcasted when Driver is launched from Surveyor so game objects can detect this and respond as needed.

In the example workaround shown here, the Init() method adds a message handler that will call automatically call the ModuleInit() method when the message is received:

     public void Init(void)
     {
       // usual initialization stuff goes here...
       inherited();

       // add a handler method for when the ("World", "ModuleInit") message is received
       AddHandler(me, "World", "ModuleInit", "ModuleInitHandler");
     }

The actual initialization needed for Driver is now in the ModuleInitHandler() method:

       // class variable to keep track of when Driver is running
       bool objectRunningDriver =<b> false</b>;

       // handler method
       void ModuleInitHandler(Message msg)
       {
         // we have already launched the thread, no need to do anything
         if (objectRunningDriver)
           return;

         // are we in Driver?, if so, get the thread started we need to run this industry
         if (World.GetCurrentModule() == World.DRIVER_MODULE)
         {
           objectRunningDriver =<b> true</b>;
           MainObjectThread();
         }
       }

When ModuleInitHandler() is called, if the object isn't already running the main thread and the current Trainz module mode is World.DRIVER_MODULE, the main thread of MainObjectThread() is started.

The objectRunningDriver class variable is used to ensure we don't end up needlessly running multiple threads.

This workaround was added late in the development of TRS2004:SP2 and as such, it is a bit crude and not the perfect solution.

Returns :
Returns the current mode. This will be one of the Trainz Module Modes constants.
See also:
Trainz Module Modes

public native DriverCharacter [] World.GetDriverCharacterList ( void )

Gets a list of all driver characters in this world.

Returns :
Returns an array of DriverCharacter objects that are the drivers for this world.

public native DriverCommand [] World.GetDriverCommandList ( void )

Gets a list of all driver commands in this world.

Returns :
Returns an array of DriverCommand objects which are the driver commands currently in this world.

public native float World.GetGameTime ( void )

Gets the current game time.

Returns :
Returns the current in-game time as a normalize value in the range of [0.0 - 1.0] where 0.0 is midday, 0.5 is midnight and 1.0 is back to midday.
See also:
Time Values

public native GameObject [] World.GetIndustryList ( void )

Gets a list of all industries on the current route.

Returns :
Returns an array of all of the Industry objects for the current route.

public native Junction [] World.GetJunctionList ( void )

Gets a list of all junctions on the current route.

Returns :
Returns an array containing all of the Junction objects on the current route.

public native Library World.GetLibrary ( KUID kuid )

Creates an instance of the specified library asset.

Note:
See the Library class for more information on library assets.
Parameters:
kuid KUID of the library asset to load and return.
Return: Returns a loaded instance of the Library asset if successful, null otherwise.

See also:
Library, Library.LibraryCall()

public native float World.GetSeconds ( void )

Gets a period of time in seconds.

This method provides a period time of time in seconds that can be used as a reference point to calculate elapsed time from. Where the time starts is un-defined.

Returns :
Returns a duration of time in seconds. Subtract the saved return value from previous call to this method from this returned value to calculate the elapsed time delta between the two separate GetSeconds() calls.
See also:
Interface.GetTimeStamp()

public native Signal [] World.GetSignalList ( void )

Gets a list of all signals on the current route.

Returns :
Returns an array containing all of the Signal objects on the current route.

public native Soup World.GetSurveyorSavedConsist ( string name )

Gets the specified train consist as a Soup database.

This method allows you to retrieve the named Surveyor consists by name as a consist definition contained in a Soup database.

The names of all available consists can be found by calling GetSurveyorSavedConsistList(). You can then use TrainUtil.CreateTrainFromSoup() to create a consist from a Soup definition.

Remember that the returned data is a consist definition, not an actual Train object.

Parameters:
name Name of the consist to get.
Note:
This method will ONLY WORK in Surveyor.
Returns :
Returns a Soup definition of the named consist if it exists. Otherwise null is returned if the consist doesn't exist or Trainz is not currently in Surveyor.
See also:
TrainUtil.CreateTrainFromSoup()

public native string [] World.GetSurveyorSavedConsistList ( void )

Gets the names of all of the pre-defined saved consists available in Surveyor.

Gets a list of pre-defined train consist names that include the ones provided with Trainz as well as your own. Use a name from that list with GetSurveyorSavedConsist() to get the actual consist definition.

Note:
This method will ONLY WORK in Surveyor.
Returns :
Returns an array of names of all of the pre-defined saved consists available in Surveyor.

public native TrackMark [] World.GetTrackMarkList ( void )

Gets a list of all track marks on the current route.

Returns :
Returns an array containing all of the TrackMark objects on the current route.

public native Train [] World.GetTrainList ( void )

Gets a list of all trains on the current route.

Returns :
Returns an array containing all of the Train objects on the current route.

public native int World.GetTrainzBuild ( void )

Gets the current build number of Trainz.

The value returned corresponds to the build number you can see in the bottom-right side of the main Trainz menu screen.

Returns :
Returns the current Trainz build number.

public native float World.GetTrainzVersion ( void )

Gets the current version of Trainz.

The value returned corresponds to the version number you can see in the bottom-right side of the main Trainz menu screen.

Returns :
Returns the current Trainz version.

public native Trigger [] World.GetTriggerList ( void )

Gets a list of all triggers on the current route.

Returns :
Returns an array containing all of the Trigger objects on the current route.

public native Vehicle [] World.GetVehicleList ( void )

Gets a list of all vehicles on the current route.

Returns :
Returns an array containing all of the Vehicle objects on the current route.

public native int World.GetWeatherChangeability ( )

Gets the current weather changeability.

Returns :
Returns one of the weather changeability constants indicating the current level of changeability to in-game weather conditions.
See also:
Weather Type Constants, Weather Changeability Constants

public native int World.GetWeatherType ( )

Gets the current weather type.

Returns :
Returns one of the weather types indicating the current in-game weather conditions.
See also:
Weather Type Constants, Weather Changeability Constants

public native bool World.LoadMap ( KUID kuid )

Load the route with the given KUID.

Parameters:
kuid KUID of route to load. Use World.FindKUID() to get the desired route KUID.
Returns :
Returns true if successful, false otherwise.

public native bool World.LoadMapTSO | ( | Asset | asset,
 |  | string | filename
 | ) |

Load the specified .tso file. Obsolete method.

Parameters:
asset | The asset in which to find the .tso file.
filename | The relative path name of the .tso file within the asset, without the file extension.
Returns :
Returns true if successful, false otherwise.

public float World.Play2DSound | ( | Asset | asset,
 |  | string | filename
 | ) | [inline]

Plays a .wav sound file from the given asset's directory in 2D.

This method does not return after the sound has finished playing, it returns with the length of the sound as soon as it is called. This means your code will keep on executing while Trainz is playing the sound. If you want to wait for the sound to complete playing before moving on, wrap the Play2DSound() call up in a Sleep() call:

     Sleep(World.Play2DSound(driverAsset,"allaboard.wav"));

Remember that Sleep() can't always be used.

Parameters:
asset | Asset where filename can be found. An Asset reference can be found by using World.FindAsset() or MeshObject.GetAsset()
filename | Name of the .wav sound file to play.
Returns :
Returns the length of the filename in seconds.

public native float World.PlaySound | ( | Asset | asset,
 |  | string | filename,
 |  | float | volume,
 |  | float | minDistance,
 |  | float | maxDistance,
 |  | GameObject | target,
 |  | string | attachmentPoint
 | ) |

Plays a .wav sound file from the given asset's directory.

This method does not return after the sound has finished playing, it returns with the length of the sound as soon as it is called. This means your code will keep on executing while Trainz is playing the sound. If you want to wait for the sound to complete playing before moving on, wrap the PlaySound() call up in a Sleep() call:

     Sleep(World.PlaySound(ourDriver, "allaboard.wav", 1000.0, 10.0, 100.0, locomotive, "a.frontseat"));

Keep in mind that Sleep() can't always be used.

Parameters:
asset | Asset where filename can be found. An Asset reference can be found by using World.FindAsset() or MeshObject.GetAsset()
filename | Name of the .wav file to play.
volume | Volume level to play the sound at.
minDistance | Minimum hearing distance in meters.
maxDistance | Maximum hearing distance in meters.
target | Target game object if the sound is to be a 3D sound, null if the sound is to be played in 2D.
attachmentPoint | Attachment point to play the sound from if it is to be a 3D sound, null if the sound is to be played in 2D.
Returns :
Returns the length of the sound in seconds.

public native void World.RemoveDriverCharacter ( DriverCharacter driverCharacter )

Removes the given driver character from the world.

Parameters:
driverCharacter Driver character to remove.

public native void World.RemoveDriverCommand ( DriverCommand command )

Removes the given driver command from this world.

Parameters:
command Driver command to remove.

public native bool World.SetCamera ( MapObject obj )

Sets the camera to target the given object.

Parameters:
obj Target object to set the camera to. Can be any MapObject-derived type.
Returns :
Returns false if the obj is not able to be a camera target, true otherwise if successful.

public native void World.SetCamera ( Junction focus )

Sets the camera to target the given junction.

Parameters:
focus Junction to focus the camera on.

public native void World.SetCamera | ( | Vehicle | focus,
 |  | int | cameraMode
 | ) |

Sets the camera to target the given vehicle.

Parameters:
focus | Train to focus camera on.
cameraMode | Flags that define the camera mode (i.e. restrictions on movement etc.). Use any combination of the camera flags and camera view modes for this argument.
Note:
In TRS2006, the camera must be focused on an object such as a Train, Vehicle or MapObject by the scenario script as TRS2006 will not focus the camera automatically. To do this, use a method such as this one during scenario initialization.
See also:
Camera Flags, Camera View Modes

public native void World.SetCamera | ( | Train | focus,
 |  | int | cameraMode
 | ) |

Sets the camera to target the given train.

Parameters:
focus | Train to focus camera on.
cameraMode | Flags that define the camera mode (i.e. restrictions on movement etc.). Use any combination of the camera flags and camera view modes for this argument.
Note:
In TRS2006, the camera must be focused on an object such as a Train, Vehicle or MapObject by the scenario script as TRS2006 will not focus the camera automatically. To do this, use a method such as this one during scenario initialization.
See also:
Camera Flags, Camera View Modes

public void World.SetCameraAngle | ( | int | yaw,
 |  | int | pitch,
 |  | float | radius
 | ) | [inline]

Sets the current camera angle.

Parameters:
yaw | Yaw rotation in degrees. 90 is looking straight at the front of a train
pitch | Angle up and down in degrees, -90 is straight down and 90 is straight up.
radius | Distance to the current object in focus in meters.

public native void World.SetCameraAngle | ( | float | yaw,
 |  | float | pitch,
 |  | float | radius
 | ) |

Sets the current camera angle.

Parameters:
yaw | Yaw rotation in radians.
pitch | The angle up and down in radians.
radius | Distance to the targeted object (what the camera is pointing towards) in meters.

public native void World.SetCameraFlags ( int cameraFlags )

Changes the current camera settings.

Parameters:
cameraFlags Flags that define behavior of the camera in what the user can and can't do. Use any combination of the camera flags and camera view modes for this argument.
See also:
Camera Flags, Camera View Modes

public native void World.SetCameraMode ( int cameraMode )

Sets the current camera mode.

Parameters:
cameraMode Mode to set the camera to. Use one of the camera view modes constants for this argument.
See also:
Camera Flags, Camera View Modes

public native void World.SetGameTime ( float time )

Set the in-game clock.

Parameters:
time Normalized value in the range of [0.0 - 1.0] where 0.0 is midday, 0.5 is midnight and 1.0 is back to midday.
See also:
Time Values

public native void World.SetGameTimeRate ( int rate )

Set the in-game time rate.

Parameters:
rate Value in the range of [0 - 14]. Use one of the time rate constants for this argument.
See also:
Time Rate Constants

public native void World.SetTargetObserver ( GameObject observer )

Not documented.

Note:
It is unlikely a script programmer would ever need to use this method.
Parameters:
observer Not documented.

public native void World.SetWeather | ( | int | type,
 |  | int | changeability
 | ) |

Sets the current weather type and changeability.

Parameters:
type | Value in the range of [0 - 7] for the desired weather type. Use one of the weather type constants for this argument.
changeability | Value in the range of [0 - 2] for the desired weather changeability. Use one of the weather changeability constants for this argument.
See also:
Weather Type Constants, Weather Changeability Constants

public native bool World.UserSetCamera ( GameObject target )

Sets the camera to the given target (if possible).

Parameters:
target Target object to set the camera to.
Returns :
Returns true if the camera was pointed to target successfully, false otherwise.

public native void World.UserSetCameraMode ( int cameraMode )

Sets the current camera mode, if permitted by the current mode flags.

Parameters:
cameraMode Mode to set the camera to. Must be one of the camera view mode values.
See also:
Camera View Modes, Camera Flags

The documentation for this class was generated from the following file:
  • world.gs


World1 Class Reference

List of all members.

Public Methods

public native Train | CreateTrain (string consistName, string trackmarkName, bool facingDirection)
public native void | SetDCCMode (bool useDCCMode)
public native void | SetDerailLevel (int derailLevel)

Detailed Description

World1 is an extension of the functionality provided in the original World class.

This class was originally made separate from World because in earlier versions of Trainz, it was not possible to modify a .gs file without breaking compatibility. Even though TRS2004 and TRS2006 don't have this problem, scenarios written for earlier versions of Trainz (SP3 or UTC) would still expect to find certain methods in World1, so World1 is provided with TRS2004 and TRS2006 to maintain backward compatibility.

See also:
TrainUtil, World

Member Function Documentation

public native Train World1.CreateTrain | ( | string | consistName,
 |  | string | trackmarkName,
 |  | bool | facingDirection
 | ) |

THIS METHOD IS OBSOLETE

It is included for backwards compatibility only. Use TrainUtil.CreateTrainFromSoup() instead.

See also:
TrainUtil.CreateTrainFromSoup()

public native void World1.SetDCCMode ( bool useDCCMode )

Sets the Driver interface to DCC or Cabin control mode.

Parameters:
useDCCMode Driver interface to set. DCC (true) or Cabin (false) control mode.

public native void World1.SetDerailLevel ( int derailLevel )

Sets the derail level of the current Trainz environment.

Parameters:
derailLevel Derail level setting in range of [0 - 2].

The documentation for this class was generated from the following file:
  • world1.gs


Class Hierarchy
[Class API Reference]

Class Hierarchy

Hierarchical listing of all Trainz API classes:

  • AITrainScope
  • BrowserInterface
  • CabinControlSetting
  • CabinData
    • DefaultSteamCabinData
  • Command
  • Constructors
  • ControlSettingsManager
  • CustomCommand
    • AiHornMsg
  • DriverScheduleCommand
  • Flags
  • GSObject
    • Asset
    • GameObject
      • Browser
      • CabinControl
      • DriverCommand
      • DriverCommands
      • OnlineAccess
      • OnlineGroup
      • Scenario
      • Track
      • Train
      • TrainzGameObject
        • Library
        • MeshObject
          • Bogey
          • Cabin
            • DefaultLocomotiveCabin
            • DefaultSteamCabin
          • MapObject
            • SceneryWithTrack
              • Buildable
                • Industry
                  • BaseIndustry
                    • GenericPassengerStation
                  • BasePortal
                  • GenericIndustry
              • Crossing
              • Turntable
            • Trackside
              • Junction
              • Signal
              • TrackMark
              • Trigger
              • Vehicle
                • Locomotive
        • ModuleScript
          • DriverCharacter
        • ScenarioBehavior
          • ConditionalScenarioBehavior
    • HTMLPropertyHandler
      • BaseIndustryInfo
      • ConfigAssetHandler
        • AssetCheckListHandler
        • CheckListPropertyHandler
          • RadioButtonListHandler
        • EnumeratedAssetHandler
        • EnumeratedGameObjectHandler
        • EnumeratedPropertyHandler
          • EnumeratedMultiPropertyHandler
        • GenericBoolHandler
          • CheckBoxHandler
        • GenericIntNumberHandler
        • GenericStringHandler
      • ConsistHelperInfo
      • HTMLPropertyGroup
        • ConsistListHelper
        • ConfigAssetGroupHandler
          • CheckListGroupHandler
            • RadioButtonGroupHandler
        • GenericListHandler
        • TrainHelperInfo
        • VehicleHelperInfo
      • LoadHelperInfo
      • PassengerStationInfo
      • SpecificVehiclesInfo
        • DriversInfo
        • VehicleTypesInfo
      • VHISpecificVehiclesInfo
        • VHIDriversInfo
        • VHIVehicleTypesInfo
    • IndustryTrainController
    • KUID
    • KUIDList
    • LoadingReport
    • Menu
    • Permit
    • ProductFilter
    • ProductQueue
    • Soup
    • StringTable
    • TrainTimetable
  • GSTrackSearch
  • HTMLWindow
  • IndustryProcessInfo
  • IndustryProductInfo
  • IndustryProductInfoCollection
  • IndustryProductInfoComplete
  • IndustryProductInfoProcess
  • IndustryProductInfoQueues
  • IndustryProductInfoTracks
  • Interface
  • InterfaceAlert
  • InterfaceObjective
  • IPICProcess
  • IPICQueue
  • IPICTrack
  • ITCTrainCommand
  • JunctionBase
    • Junction
    • JunctionBaseGameObject
  • JunctionPermitInfo
  • LinkedData
  • LinkedList
  • Log
  • LogScope
  • Math
  • Message
  • Navigate
  • NumberValueInt
  • PropertyBrowser
  • PropertyObject
    • MeshObject
    • ScenarioBehavior
  • PropertyValue
  • Requirement
    • ResourceRequirement
  • Router
  • ScenarioStringTable
  • ScenarioSupport
  • Schedule
  • ScheduleHistoryRec
  • ShuntTrack
  • SignalBehaviour
  • StationBehaviour
  • Str
  • Timetable
  • TimetableState
  • TrackLoadInfo
  • TrainTimetableItem
  • TrainUtil
  • Trainz
  • VehicleDescriptor
  • World
  • World1
See also:
Class API Reference


Trainz Railroad Simulator 2006 User Activity Creation Guide Compound Members

a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | y

Here is a list of all documented class members with links to the classes they belong to:

- a -

  • Abs() : Math
  • ACTION_LOADING : GenericPassengerStation
  • ACTION_NOTHING : GenericPassengerStation
  • ACTION_UNLOADING : GenericPassengerStation
  • AddAssetToIndustryProductInfo() : GenericIndustry, BaseIndustry
  • AddCommandMenuItem() : DriverCommand
  • AddControl() : ControlSettingsManager
  • AddDriverCharacter() : World
  • AddDriverCommand() : World
  • AddDriverScheduleCommand() : DriverCommands, DriverCharacter
  • AddHandler() : CheckListGroupHandler, HTMLPropertyGroup, GameObject
  • AddItem() : Menu, RadioButtonListHandler, CheckListPropertyHandler
  • AddKUID() : KUIDList
  • AddProduct() : ProductFilter
  • AddProductCategory() : ProductFilter
  • AddSoup() : ProductFilter
  • AddSubmenu() : Menu
  • AddTrain() : IndustryTrainController
  • AddUser() : OnlineGroup
  • AddVehicle() : IndustryTrainController
  • AddVehicleLock() : IndustryTrainController
  • AddVelocity() : Train
  • AdjustScore() : Interface
  • Alert() : InterfaceAlert
  • alert : InterfaceAlert
  • allowCoupling : Schedule
  • AllowManualControl() : JunctionBase
  • AlreadyThereStr() : TrainUtil
  • amount : ResourceRequirement, LoadingReport, LoadHelperInfo
  • ampmeter_needle0 : DefaultLocomotiveCabin
  • ampmeter_needle1 : DefaultLocomotiveCabin
  • AnimateFiremanShovelCoal() : DefaultSteamCabin
  • AnimateFiremanWave() : DefaultSteamCabin
  • Announce() : Timetable, Schedule
  • AppendDependencies() : ScenarioBehavior, DriverCommands
  • AppendDriverDestinations() : Industry
  • AppendFilter() : ProductFilter
  • AppendProductList() : Industry, GenericIndustry, BaseIndustry
  • AreInTrain() : TrainUtil
  • arrivalTime : TrainTimetableItem
  • arrivedAtDestination : TrainTimetableItem
  • arrivedLate : TrainTimetableItem
  • arriveEarly : TrainTimetableItem
  • AsBool() : PropertyValue
  • AsFloat() : PropertyValue
  • AsInt() : PropertyValue
  • asset : IndustryProductInfo
  • assets_consume : IndustryProcessInfo
  • assets_produce : IndustryProcessInfo
  • AsString() : PropertyValue
  • Attach() : DefaultSteamCabin, DefaultLocomotiveCabin, Cabin
  • AUTOMATIC : Signal

- b -

  • BaseIndustryMain() : BaseIndustry
  • BeginExecute() : DriverScheduleCommand
  • BeginLoad() : Vehicle, Industry, GenericIndustry, BaseIndustry
  • BeginTrackSearch() : Trackside
  • BeginUnload() : Vehicle, Industry, GenericIndustry, BaseIndustry
  • blowdown_lever : DefaultSteamCabin
  • blowdown_lever_val : DefaultSteamCabinData
  • blower_lever : DefaultSteamCabin
  • boiler_needle : DefaultSteamCabin
  • boiler_needle1 : DefaultSteamCabin
  • BOOL_TYPE : PropertyValue
  • BOTTOM_SIDE : LoadingReport
  • brake_cylinder0_needle : DefaultSteamCabin, DefaultLocomotiveCabin
  • brake_cylinder1_needle : DefaultSteamCabin, DefaultLocomotiveCabin
  • brake_pipe_needle : DefaultSteamCabin, DefaultLocomotiveCabin
  • BringToFront() : Browser
  • ButtonBar_Element_Close : Interface
  • ButtonBar_Element_Find : Interface
  • ButtonBar_Element_Help : Interface
  • ButtonBar_Element_MetricImp : Interface
  • ButtonBar_Element_Pause : Interface
  • ButtonBar_Element_Performance : Interface
  • ButtonBar_Element_Save : Interface

- c -

  • ca : Command
  • CAMERA_EXTERNAL : World
  • CAMERA_INTERNAL : World
  • CAMERA_LOCKED : World
  • CAMERA_NORMAL : World
  • CAMERA_ROAMING : World
  • CAMERA_SWITCH_TRAINS : World
  • CAMERA_SWITCH_VEHICLES : World
  • CAMERA_SWITCH_VIEWS : World
  • CAMERA_TRACKING : World
  • CancelBuild() : Buildable
  • CanLoadProductFromQueue() : Vehicle
  • CanMoveToNextStop() : Turntable
  • CanMoveToPrevStop() : Turntable
  • CanUnloadProductToQueue() : Vehicle
  • cause : Requirement
  • cb : Command
  • cc : Command
  • cd : Command
  • className : LogScope
  • Clear() : Soup, ProductFilter, LoadingReport, KUIDList
  • ClearDriverScheduleCommands() : DriverCommands
  • ClearMessages() : GameObject
  • ClearParams() : StringTable
  • ClearProcess() : Industry
  • ClearTrainCommand() : IndustryTrainController
  • ClearTrainTimetable() : Train
  • CMD_ANNOUNCE : Schedule
  • CMD_COMPLETE_JUNCTIONS : Schedule
  • CMD_COUPLE_VEHICLE : Schedule
  • CMD_CUSTOM : Schedule
  • CMD_DELETE_TRAIN : Schedule
  • CMD_DRIVE_FOREVER : Schedule
  • CMD_DRIVE_THROUGH_TRACKMARK : Schedule
  • CMD_ON_ANNOUNCEMENT : Schedule
  • CMD_ON_TRIGGER : Schedule
  • CMD_POST_MESSAGE : Schedule
  • CMD_RESET_TIMETABLE : Schedule
  • CMD_REVERSE_TRAIN : Schedule
  • CMD_SET_SIGNAL : Schedule
  • CMD_STOP_AT_SCENERY : Schedule
  • CMD_STOP_AT_TRACKMARK : Schedule
  • CMD_STOP_AT_TRIGGER : Schedule
  • CMD_STOP_TRAIN : Schedule
  • CMD_TAKE_JUNCTION : Schedule
  • CMD_TAKE_TRACK_PERMIT : Schedule
  • CollectMessage() : OnlineAccess
  • CollectOfflineMessage() : OnlineAccess
  • colour : InterfaceAlert
  • Colour_Black : Interface
  • Colour_Blue : Interface
  • Colour_Cyan : Interface
  • Colour_Green : Interface
  • Colour_Red : Interface
  • Colour_White : Interface
  • Colour_Yellow : Interface
  • command : TrainTimetableItem, Command, ITCTrainCommand
  • commands : Schedule
  • CompareStrLists() : TrainUtil
  • COMPLETE : ScenarioBehavior
  • CompleteJunctions() : Schedule
  • Connect() : OnlineGroup, OnlineAccess
  • CONTROL_AUTOMANUAL : Train
  • CONTROL_AUTOPILOT : Train
  • CONTROL_MANUAL : Train
  • CONTROL_SCRIPT : Train
  • controlSettings : ControlSettingsManager
  • Copy() : Soup, KUIDList
  • CopyFilter() : ProductFilter
  • CountItems() : Menu, CheckListPropertyHandler
  • CountKUIDs() : KUIDList
  • CountProductMatching() : ProductQueue
  • CountTags() : Soup
  • CountUsers() : OnlineGroup
  • CountVehicles() : IndustryTrainController
  • CountVehiclesNotAdded() : IndustryTrainController
  • Couple() : Vehicle
  • COUPLE_BACK : Vehicle
  • COUPLE_BOTH : Vehicle
  • COUPLE_FRONT : Vehicle
  • COUPLE_NONE : Vehicle
  • CoupleVehicle() : Schedule
  • couplingMask : ConsistHelperInfo
  • CreateBehavior() : World
  • CreateBrowser() : BrowserInterface
  • CreateCabinSavedData() : DefaultSteamCabin
  • CreateGroup() : OnlineAccess
  • CreateLoadingReport() : Industry
  • CreateProduct() : ProductQueue
  • CreateScheduleCommand() : DriverCommand
  • CreateTrain() : World1, World
  • CreateTrainFromSoup() : TrainUtil
  • CreateUnloadingReport() : Industry
  • CROSSING_STATE_CLOSED : Crossing
  • CROSSING_STATE_CLOSING : Crossing
  • CROSSING_STATE_OPEN : Crossing
  • CROSSING_STATE_OPENING : Crossing
  • ctrl_name : CabinControlSetting
  • ctrl_value : CabinControlSetting
  • ctrlManager : DefaultSteamCabinData
  • Custom() : Schedule
  • custom : Command

- d -

  • dccMode : ScenarioSupport
  • decouplingMask : ConsistHelperInfo
  • DecTrainBusy() : Train
  • defaultSignalBehaviour : Navigate
  • defaultStationBehaviour : Navigate
  • delay : StationBehaviour
  • DeleteTrain() : World, Schedule
  • DeleteVehicle() : World
  • departEarly : TrainTimetableItem
  • departOnTime : TrainTimetableItem
  • departureTime : TrainTimetableItem
  • Derail() : Train
  • desiredAmount : LoadingReport
  • destinationName : TrainTimetableItem
  • DestroyAllProducts() : ProductQueue
  • DestroyProductMatching() : ProductQueue
  • DIRECTION_BACKWARD : Vehicle, JunctionBase
  • DIRECTION_FORWARD : Vehicle, JunctionBase
  • DIRECTION_LEFT : JunctionBase
  • DIRECTION_NONE : Vehicle, JunctionBase
  • DIRECTION_RIGHT : JunctionBase
  • Disconnect() : OnlineGroup, OnlineAccess
  • DoCoupleUp() : TrainUtil
  • DoDecouple() : TrainUtil
  • DOES_COMPLETE : ScenarioBehavior
  • DoesAcceptProduct() : ProductFilter
  • DoesAcceptProductCategory() : ProductFilter
  • DoesFilterTrains() : TrainHelperInfo
  • DoesMatch() : TrainHelperInfo, DriversInfo, VehicleTypesInfo, SpecificVehiclesInfo
  • DoesMatchAnd() : DriversInfo, VehicleTypesInfo, SpecificVehiclesInfo
  • DoesMatchAndExlcude() : DriversInfo, VehicleTypesInfo, SpecificVehiclesInfo
  • DoInstructions() : ScenarioSupport
  • done : SignalBehaviour, StationBehaviour
  • DriveForever() : Schedule
  • DRIVER_MODULE : World
  • DriverBeginIssueSchedule() : DriverCharacter
  • DriverCompleteJunctions() : DriverCharacter
  • DriverCoupleVehicle() : DriverCharacter
  • DriverCustomCommand() : DriverCharacter
  • DriverDriveForever() : DriverCharacter
  • DriverIssueSchedule() : DriverCharacter
  • DriverSetAllowCoupling() : DriverCharacter
  • DriverTakeJunction() : DriverCharacter
  • DriverThroughTrackMark() : DriverCharacter
  • DriverTurnAround() : DriverCharacter
  • DriverVisitScenery() : DriverCharacter
  • DriverVisitTrack() : DriverCharacter
  • DriverVisitTrackMark() : DriverCharacter
  • DriveThroughTrackMark() : Schedule
  • dst : ResourceRequirement, LoadingReport, Message
  • dstQueue : ResourceRequirement, LoadingReport
  • DYNAMIC_BRAKE_BRAKE : Train
  • dynamic_brake_lever : DefaultLocomotiveCabin
  • DYNAMIC_BRAKE_NEUTRAL : Train
  • DYNAMIC_BRAKE_TRACTION : Train

- e -

  • EnablePassengerSpawn() : GenericPassengerStation
  • EnablePhysics() : Train
  • EnableUserCancelBuild() : Buildable
  • EnableUserStartBuild() : Buildable
  • EndExecute() : DriverScheduleCommand
  • EndLoad() : Vehicle, Industry, GenericIndustry, BaseIndustry
  • EndScenario() : World
  • EndUnload() : Vehicle, Industry, GenericIndustry, BaseIndustry
  • ENGINE_NONE : Vehicle
  • ENGINE_STANDARD : Vehicle
  • ENGINE_STEAM : Vehicle
  • equaliser_needle : DefaultSteamCabin, DefaultLocomotiveCabin
  • EX_ADVANCE_CAUTION : Signal
  • EX_ADVANCE_CAUTION_LEFT : Signal
  • EX_ADVANCE_CAUTION_RIGHT : Signal
  • EX_CAUTION : Signal
  • EX_CAUTION_LEFT : Signal
  • EX_CAUTION_RIGHT : Signal
  • EX_MEDIUM : Signal
  • EX_PROCEED : Signal
  • EX_PROCEED_LEFT : Signal
  • EX_PROCEED_RIGHT : Signal
  • EX_SLOW : Signal
  • EX_STOP : Signal
  • EX_STOP_THEN_CONTINUE : Signal
  • Exception() : Interface, GameObject
  • Execute() : CustomCommand, AiHornMsg
  • ExecuteRule() : ConditionalScenarioBehavior
  • extension : GameObject

- f -

  • Fabs() : Math
  • facing : VehicleDescriptor
  • FadeScreen() : BrowserInterface
  • FailExecute() : DriverScheduleCommand
  • FindAsset() : World, Asset
  • FindDriverCommand() : World
  • FindHandler() : HTMLPropertyGroup
  • FindIndex() : ControlSettingsManager
  • FindKUID() : World
  • FindTriggerContainingNode() : SceneryWithTrack
  • FindUser() : OnlineGroup
  • fire_plates : DefaultSteamCabin
  • fire_plates_val : DefaultSteamCabinData
  • FireAddCoal() : Cabin
  • firebox : DefaultSteamCabin
  • fireboxDoorOpen : DefaultSteamCabinData
  • FiremanShovelCoal() : DefaultSteamCabin
  • FiremanWave() : DefaultSteamCabin
  • FLOAT_TYPE : PropertyValue
  • flow_needle : DefaultSteamCabin, DefaultLocomotiveCabin
  • Fmax() : Math
  • Fmin() : Math
  • functionName : LogScope

- g -

  • GenericIndustryMain() : GenericIndustry
  • Get() : ScenarioStringTable
  • GetActiveDriver() : Train
  • GetAdvisoryLimit() : Train
  • GetAfter() : TrainUtil
  • GetAllowsUserControl() : Train
  • GetAmount() : ResourceRequirement
  • GetArrivedAtDestination() : TrainTimetable
  • GetAsset() : TrainzGameObject, DriverScheduleCommand, DriverCommand, Browser
  • GetAssetIndex() : AssetCheckListHandler
  • GetAssetList() : World
  • GetAssetType() : AssetCheckListHandler
  • GetAsSoup() : ProductFilter
  • GetAttachedJunctions() : SceneryWithTrack
  • GetAttachedTrack() : SceneryWithTrack
  • GetAutopilotMode() : Train
  • GetAutopilotStopJunctionBase() : Train
  • GetAutopilotStopTrain() : Train
  • GetAutopilotTargetSlowing() : Train
  • GetAuxReservoirPressure() : Vehicle
  • GetBehaviors() : World
  • GetBogeyList() : Vehicle
  • GetBoolDisplayValue() : GenericBoolHandler
  • GetBoolValue() : GenericBoolHandler
  • GetBrakeCylinderPressure() : Vehicle
  • GetBrakePipePressure() : Vehicle
  • GetBuildingProgress() : Buildable
  • GetBuildingState() : Buildable
  • GetCabinData() : Locomotive
  • GetCabinSwayAmount() : Vehicle
  • GetChildBehaviors() : ScenarioBehavior
  • GetConditionResult() : ConditionalScenarioBehavior
  • GetConfigPrefix() : ConfigAssetGroupHandler, ConfigAssetHandler
  • GetConfigSoup() : Asset
  • GetControls() : Cabin
  • GetCouplerBreakageEnabled() : Vehicle
  • GetCouplingDirection() : Vehicle
  • GetCouplingStress() : Vehicle
  • GetCrossingAutomatic() : Crossing
  • GetCrossingHasNearbyTrain() : Crossing
  • GetCrossingState() : Crossing
  • GetCurrentModule() : World
  • GetCurrentTimetable() : TrainTimetable
  • GetCurrentTimetableItem() : TrainTimetable
  • GetDCCThrottle() : Train
  • GetDebugString() : Permit, JunctionBase
  • GetDecoupleMode() : Interface
  • GetDefaultCabinSwayAmount() : Vehicle
  • GetDefaultMaximumCouplerCompressionStress() : Vehicle
  • GetDefaultMaximumCouplerExpansionStress() : Vehicle
  • GetDefaultMaximumCoupleVelocity() : Vehicle
  • GetDefaultMaximumTractiveEffort() : Vehicle
  • GetDependencyList() : Asset
  • GetDescription() : ScenarioBehavior
  • GetDescriptionHTML() : VehicleHelperInfo, VHISpecificVehiclesInfo, Vehicle, TrainHelperInfo, SpecificVehiclesInfo, PropertyObject, PassengerStationInfo, GenericListHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, EnumeratedMultiPropertyHandler, EnumeratedPropertyHandler, CheckListGroupHandler, RadioButtonListHandler, AssetCheckListHandler, CheckListPropertyHandler, CheckBoxHandler, GenericBoolHandler, GenericIntNumberHandler, GenericStringHandler, ConfigAssetGroupHandler, ConfigAssetHandler, HTMLPropertyGroup, HTMLPropertyHandler, GenericIndustry, ConsistListHelper, ConsistHelperInfo, LoadHelperInfo, BaseIndustryInfo
  • GetDirection() : JunctionBase
  • GetDirectionRelativeToTrain() : Vehicle
  • GetDirectionToTrain() : JunctionBase
  • GetDisplayHeight() : Interface
  • GetDisplayWidth() : Interface
  • GetDistance() : GSTrackSearch
  • GetDriverCharacter() : DriverScheduleCommand
  • GetDriverCharacterList() : World
  • GetDriverCommand() : DriverScheduleCommand
  • GetDriverCommandFilter() : DriverCharacter
  • GetDriverCommandList() : World
  • GetDriverCommands() : DriverCommand, DriverCharacter
  • GetDriverScheduleCommands() : DriverCommands
  • GetDriverScheduleRepeat() : DriverCommands
  • GetDst() : ResourceRequirement
  • GetDstIndustry() : LoadingReport
  • GetDstQueue() : ResourceRequirement
  • GetDstVehicle() : LoadingReport
  • GetElementProperty() : Interface, Browser
  • GetEngineParam() : Vehicle
  • GetEngineSetting() : Locomotive
  • GetEngineType() : Vehicle
  • GetFacingRelativeToSearchDirection() : GSTrackSearch
  • GetFacingRelativeToTrain() : Vehicle
  • GetFrontmostLocomotive() : Train
  • GetFXAttachment() : MeshObject
  • GetGameObject() : JunctionBase, Router
  • GetGameTime() : World
  • GetHeadlightState() : Train
  • GetHostAsset() : ConfigAssetGroupHandler, ConfigAssetHandler
  • GetHTMLString() : KUID
  • GetIcon() : DriverScheduleCommand
  • GetId() : GameObject
  • GetIndex() : PropertyValue
  • GetIndexedKUID() : KUIDList
  • GetIndexedTagName() : Soup
  • GetIndexedUser() : OnlineGroup
  • GetIndexForNamedTag() : Soup
  • GetIndustryList() : World
  • GetInterfaceVisible() : Interface
  • GetIsAtDestination() : TrainTimetable
  • GetIsLate() : TrainTimetable
  • GetJunctionList() : World
  • GetKUID() : Asset
  • GetLanguage() : StringTable
  • GetLastVisitedBuildable() : Train
  • GetLastVisitedIndustry() : Train
  • GetLastVisitedTrack() : Train
  • GetLength() : Vehicle
  • GetLibrary() : World
  • GetLoadTime() : Vehicle, Industry, GenericIndustry, BaseIndustry
  • GetLocalData() : OnlineAccess
  • GetLocalisedName() : MapObject, DriverCharacter, Asset
  • GetLocation() : DriverCharacter
  • GetLogString() : KUID
  • GetManualControl() : JunctionBase
  • GetMapObject() : JunctionBase, GSTrackSearch
  • GetMapView() : Interface
  • GetMass() : Vehicle
  • GetMaximum() : CabinControl
  • GetMaximumCouplerCompressionStress() : Vehicle
  • GetMaximumCouplerExpansionStress() : Vehicle
  • GetMaximumCoupleVelocity() : Vehicle
  • GetMaximumCouplingStressVehicle() : Train
  • GetMaximumTractiveEffort() : Vehicle
  • GetMeshAnimationFrame() : MeshObject
  • GetMeshAnimationFrameCount() : MeshObject
  • GetMessageWindowVisible() : Interface
  • GetMetricMode() : Interface
  • GetMinimum() : CabinControl
  • GetMyTrain() : Vehicle
  • GetName() : KUID, GameObject, CabinControl, Asset
  • GetNamedControl() : Cabin
  • GetNamedSoup() : Soup
  • GetNamedTag() : Soup
  • GetNamedTagAsBool() : Soup
  • GetNamedTagAsFloat() : Soup
  • GetNamedTagAsInt() : Soup
  • GetNamedTagAsKUID() : Soup
  • GetObject() : Permit
  • GetObjectBase() : Permit
  • GetObjectiveBarVisible() : Interface
  • GetOnlineAccess() : Library
  • GetOnlineGroupCookie() : OnlineGroup
  • GetPantographState() : Train
  • GetParentBehavior() : ScenarioBehavior
  • GetParentObject() : Cabin
  • GetPhysicsModel() : Train
  • GetPrefix() : HTMLPropertyHandler
  • GetPressureParam() : DefaultSteamCabin, DefaultLocomotiveCabin
  • GetProcessDuration() : Industry
  • GetProcessEnabled() : Industry
  • GetProcessInput() : Industry
  • GetProcessIOAmount() : Industry
  • GetProcessIOProduct() : Industry
  • GetProcessIOQueue() : Industry
  • GetProcessNameList() : Industry
  • GetProcessOutput() : Industry
  • GetProcessStarted() : Industry
  • GetProductCategories() : ProductFilter
  • GetProductCategory() : ProductQueue
  • GetProductFilter() : ProductQueue
  • GetProductList() : ProductQueue
  • GetProductNameList() : BaseIndustry
  • GetProductRestriction() : Vehicle
  • GetProducts() : ProductFilter
  • GetProperties() : VehicleHelperInfo, VHISpecificVehiclesInfo, Vehicle, TrainHelperInfo, SpecificVehiclesInfo, ScenarioBehavior, PropertyObject, PassengerStationInfo, GenericListHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, EnumeratedMultiPropertyHandler, EnumeratedPropertyHandler, RadioButtonGroupHandler, CheckListGroupHandler, RadioButtonListHandler, AssetCheckListHandler, CheckListPropertyHandler, GenericBoolHandler, GenericIntNumberHandler, GenericStringHandler, ConfigAssetGroupHandler, ConfigAssetHandler, Library, HTMLPropertyGroup, HTMLPropertyHandler, DriverScheduleCommand, DriverCommands, ConsistListHelper, ConsistHelperInfo, LoadHelperInfo, BaseIndustry
  • GetPropertyAttribute() : GenericBoolHandler, ConfigAssetGroupHandler, HTMLPropertyGroup, HTMLPropertyHandler
  • GetPropertyDescription() : VehicleHelperInfo, VHISpecificVehiclesInfo, Vehicle, TrainHelperInfo, SpecificVehiclesInfo, PropertyObject, PassengerStationInfo, GenericListHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, EnumeratedMultiPropertyHandler, EnumeratedPropertyHandler, GenericIntNumberHandler, GenericStringHandler, HTMLPropertyGroup, HTMLPropertyHandler, GenericIndustry, ConsistHelperInfo, LoadHelperInfo, BaseIndustryInfo
  • GetPropertyElementList() : VHIDriversInfo, VHIVehicleTypesInfo, VHISpecificVehiclesInfo, Vehicle, DriversInfo, VehicleTypesInfo, SpecificVehiclesInfo, PropertyObject, PassengerStationInfo, GenericListHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, EnumeratedMultiPropertyHandler, EnumeratedPropertyHandler, HTMLPropertyGroup, HTMLPropertyHandler, ConsistHelperInfo, LoadHelperInfo
  • GetPropertyHandler() : PropertyObject
  • GetPropertyName() : VehicleHelperInfo, VHISpecificVehiclesInfo, Vehicle, TrainHelperInfo, SpecificVehiclesInfo, PropertyObject, PassengerStationInfo, GenericListHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, EnumeratedMultiPropertyHandler, EnumeratedPropertyHandler, GenericIntNumberHandler, GenericStringHandler, HTMLPropertyGroup, HTMLPropertyHandler, GenericIndustry, ConsistHelperInfo, LoadHelperInfo, BaseIndustryInfo
  • GetPropertyType() : VehicleHelperInfo, VHISpecificVehiclesInfo, Vehicle, TrainHelperInfo, SpecificVehiclesInfo, PropertyObject, PassengerStationInfo, GenericListHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, EnumeratedMultiPropertyHandler, EnumeratedPropertyHandler, CheckListGroupHandler, AssetCheckListHandler, CheckListPropertyHandler, GenericBoolHandler, GenericIntNumberHandler, GenericStringHandler, HTMLPropertyGroup, HTMLPropertyHandler, GenericIndustry, ConsistListHelper, ConsistHelperInfo, LoadHelperInfo, BaseIndustryInfo
  • GetPropertyValue() : Vehicle, PropertyObject, PassengerStationInfo, EnumeratedAssetHandler, GenericIntNumberHandler, GenericStringHandler, HTMLPropertyGroup, HTMLPropertyHandler, ConsistHelperInfo
  • GetQueue() : MapObject
  • GetQueueCount() : ProductQueue
  • GetQueueName() : ProductQueue
  • GetQueues() : MapObject
  • GetQueueSize() : ProductQueue
  • GetQueueSpace() : ProductQueue
  • GetRelationToTrack() : Vehicle
  • GetRequirements() : ScenarioBehavior, Industry
  • GetResource() : ResourceRequirement
  • GetRunningNumber() : Vehicle
  • GetSandingTractionMultiplier() : Vehicle
  • GetSavesProperties() : HTMLPropertyHandler
  • GetScore() : Interface
  • GetSeconds() : World
  • GetSetting() : CheckListPropertyHandler
  • GetSettingAsset() : AssetCheckListHandler
  • GetSettingAssets() : AssetCheckListHandler
  • GetSettingDisplayName() : CheckListPropertyHandler
  • GetSettingName() : CheckListPropertyHandler
  • GetSettingNames() : CheckListPropertyHandler
  • GetSettings() : CheckListPropertyHandler
  • GetSettingsAsFlags() : CheckListPropertyHandler
  • GetSignalList() : World
  • GetSignalLit() : Signal
  • GetSignalState() : Trackside
  • GetSignalStateEx() : Trackside
  • GetSmoothedVelocity() : Train
  • GetSpeedLimit() : Train, Trackside
  • GetSrcIndustry() : LoadingReport
  • GetSrcVehicle() : LoadingReport
  • GetState() : Permit
  • GetStateFlags() : ScenarioBehavior
  • GetStatus() : OnlineGroup, OnlineAccess
  • GetStopPosition() : Turntable
  • GetString() : StringTable
  • GetString0() : StringTable
  • GetString1() : StringTable
  • GetString10() : StringTable
  • GetString2() : StringTable
  • GetString3() : StringTable
  • GetString4() : StringTable
  • GetString5() : StringTable
  • GetString6() : StringTable
  • GetString7() : StringTable
  • GetString8() : StringTable
  • GetString9() : StringTable
  • GetStringCount() : GenericStringHandler
  • GetStringDisplayValue() : GenericStringHandler
  • GetStringTable() : ConfigAssetGroupHandler, ConfigAssetHandler, Asset
  • GetStringValue() : GenericStringHandler
  • GetSurveyorSavedConsist() : World
  • GetSurveyorSavedConsistList() : World
  • GetTimeStamp() : Interface
  • GetTimetableRule() : TrainTimetable
  • GetTooltip() : DriverScheduleCommand
  • GetTrack() : Trackside
  • GetTrackAndSide() : GenericPassengerStation
  • GetTrackGradient() : Vehicle
  • GetTrackmarkDirection() : Train
  • GetTrackMarkList() : World
  • GetTrackPriorityNumber() : Track
  • GetTrain() : TrainTimetable, DriverCharacter
  • GetTrainBrakes() : Train
  • GetTrainCommand() : IndustryTrainController
  • GetTrainDisplayName() : Train
  • GetTrainList() : World
  • GetTrainPriorityNumber() : Train
  • GetTrainTimetable() : Train
  • GetTrainzAsset() : Constructors
  • GetTrainzBuild() : World
  • GetTrainzStrings() : Constructors
  • GetTrainzVersion() : World
  • GetTriggerList() : World
  • GetTriggerTrack() : SceneryWithTrack
  • GetType() : PropertyValue
  • GetUnloadTime() : Vehicle, Industry, GenericIndustry, BaseIndustry
  • GetUpTo() : TrainUtil
  • GetUsername() : OnlineAccess
  • GetUserStatus() : OnlineGroup
  • GetValue() : CabinControl
  • GetVehicleList() : World
  • GetVehicles() : Train
  • GetVehicleTypeFlags() : Vehicle
  • GetVelocity() : Vehicle, Train
  • GetWaybillWindowVisible() : Interface
  • GetWeatherChangeability() : World
  • GetWeatherType() : World
  • GetWheelslipTractionMultiplier() : Vehicle
  • GetWindowBottom() : Browser
  • GetWindowHeight() : Browser
  • GetWindowLeft() : Browser
  • GetWindowRight() : Browser
  • GetWindowTop() : Browser
  • GetWindowVisible() : Browser
  • GetWindowWidth() : Browser
  • GREEN : Signal
  • gsobject : LinkedData

- h -

  • handbrake : ConsistHelperInfo
  • HandleTrain() : Industry, GenericIndustry, BaseIndustry
  • HandleTrainLoadCommand() : GenericIndustry, BaseIndustry
  • HandleTrainUnloadCommand() : GenericIndustry, BaseIndustry
  • HasKUID() : KUIDList
  • HasMesh() : MeshObject
  • HasPrefix() : TrainUtil
  • HasReachedJunctionInnerRadius() : Train
  • HasSamePermissionsAs() : Permit
  • HasSufix() : TrainUtil
  • HasTrack() : Industry
  • HasTrainTimetable() : Train
  • HasUnseenMessages() : Interface
  • HasUser() : OnlineGroup
  • HighlightButtonBarElement() : Interface
  • horn_rope : DefaultSteamCabin, DefaultLocomotiveCabin
  • HREF() : HTMLPropertyHandler

- i -

  • icon : InterfaceObjective, InterfaceAlert
  • IncTrainBusy() : Train
  • index : LinkedData
  • INDEX_TYPE : PropertyValue
  • industryProductInfoCollection : BaseIndustry
  • industryProductList : GenericIndustry
  • info : GenericIndustry, BaseIndustry
  • Info() : Router
  • Init() : Vehicle, TrainzGameObject, TrainHelperInfo, Train, MeshObject, GenericListHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, EnumeratedMultiPropertyHandler, EnumeratedPropertyHandler, RadioButtonGroupHandler, CheckListGroupHandler, RadioButtonListHandler, AssetCheckListHandler, CheckListPropertyHandler, CheckBoxHandler, GenericBoolHandler, GenericIntNumberHandler, GenericStringHandler, ConfigAssetGroupHandler, ConfigAssetHandler, GenericIndustry, IndustryProcessInfo, IndustryProductInfo, DriverScheduleCommand, DriverCommand, DriverCharacter, DefaultSteamCabin, DefaultLocomotiveCabin, ConditionalScenarioBehavior, Cabin, BaseIndustry
  • InitPassengerStation() : GenericPassengerStation
  • InnerReEnter() : Trackside, SceneryWithTrack
  • InnerReEnterTrain() : SceneryWithTrack
  • INT_TYPE : PropertyValue
  • IntersectFilter() : ProductFilter
  • IsActive() : Cabin
  • IsAlreadyAdded() : IndustryTrainController
  • IsComplete() : ScenarioBehavior
  • IsControllingTrain() : IndustryTrainController
  • IsControllingVehicle() : IndustryTrainController
  • IsEmpty() : ProductFilter
  • IsForSameObjectAs() : Permit
  • IsGranted() : Permit
  • isInput : IndustryProductInfo
  • IsInTrain() : TrainUtil
  • IsInTrigger() : TrainUtil
  • IsInTunnel() : Vehicle
  • IsLocked() : Soup, ProductFilter, KUIDList, CabinControl
  • IsLockedVehicle() : IndustryTrainController
  • IsMoving() : Turntable
  • IsOnBridge() : Vehicle
  • IsPartTrainInTrigger() : TrainUtil
  • IsPaused() : ScenarioBehavior
  • IsReleased() : Permit
  • IsRunningCommand() : DriverCharacter
  • IsScheduleRunning() : Train
  • IsScheduleWindowVisible() : Train
  • IsStillInJunction() : Train
  • IsStopped() : Train
  • IssueNextCommand() : DriverCharacter
  • IsTrainBusy() : Train
  • IsTrainCommand() : IndustryTrainController
  • IsTrainInTrigger() : TrainUtil
  • IsTrainInTriggers() : SceneryWithTrack
  • IsTrainLocked() : IndustryTrainController
  • IsViewDetailsVisible() : Train
  • IsVisible() : CabinControl
  • itc : GenericIndustry, BaseIndustry
  • ItemExists() : CheckListPropertyHandler
  • ItemExistsChecked() : CheckListPropertyHandler

- j -

  • JUNCTION_ENTER : Navigate
  • JUNCTION_INNERENTER : Navigate
  • JUNCTION_INNERLEAVE : Navigate
  • JUNCTION_LEAVE : Navigate
  • JUNCTION_STOPPED : Navigate
  • JunctionInnerReEnter() : JunctionBase
  • JunctionReEnter() : JunctionBase

- k -

  • KPH_TO_MPS : Train

- l -

  • Left() : Str
  • LEFT_SIDE : LoadingReport
  • left_sliding_window : DefaultSteamCabin
  • left_sliding_window_val : DefaultSteamCabinData
  • left_window : DefaultSteamCabin
  • left_window_val : DefaultSteamCabinData
  • level : LogScope
  • LibraryCall() : Library
  • light_switch : DefaultSteamCabin, DefaultLocomotiveCabin
  • LightSignal() : Signal
  • limitCouplingTo : Schedule
  • Link() : HTMLPropertyHandler
  • LinkPropertyValue() : Vehicle, PropertyObject
  • Load() : Scenario
  • load : VehicleDescriptor
  • LOAD_COMMAND : Industry
  • LoadHTMLFile() : Browser
  • LoadHTMLString() : Browser
  • LoadMap() : World
  • LoadMapTSO() : World
  • LoadProduct() : Vehicle
  • lockControlsOnRed : SignalBehaviour
  • LockJunction() : Navigate
  • loco : DefaultSteamCabin, DefaultLocomotiveCabin
  • loco_brake_lever : DefaultSteamCabin, DefaultLocomotiveCabin
  • Log() : Interface
  • log : InterfaceObjective, InterfaceAlert
  • LogCallStack() : Interface
  • LogHandlers() : HTMLPropertyGroup
  • LogResult() : Interface
  • LookupKUIDTable() : Asset

- m -

  • m_currentSelection : RadioButtonListHandler
  • m_industry : IndustryProductInfoCollection
  • m_platformCount : GenericPassengerStation
  • m_pollingBehavior : ConditionalScenarioBehavior
  • m_pollingThreadRunning : ConditionalScenarioBehavior
  • m_processes : IndustryProductInfoCollection
  • m_queues : IndustryProductInfoCollection
  • m_saveLoadRestart : ConditionalScenarioBehavior
  • m_tracks : IndustryProductInfoCollection
  • m_trainCommands : IndustryTrainController
  • m_trainLoadingSpeed : BaseIndustry
  • main() : Scenario
  • main_reservoir_needle : DefaultSteamCabin, DefaultLocomotiveCabin
  • major : Command, StationBehaviour, Message
  • ManageBrowser() : ScenarioSupport
  • MapObjectIsInFront() : Train
  • MESSAGE_BROADCAST : Router
  • Mid() : Str
  • minor : Command, StationBehaviour, Message
  • mode : TrainTimetableItem
  • MODE_AUTH_FAILED : OnlineAccess
  • MODE_CONNECTING : OnlineAccess
  • MODE_DENIED_LOCAL : OnlineAccess
  • MODE_DISABLED : OnlineAccess
  • MODE_FAILED : OnlineAccess
  • MODE_INDUSTRY : TrainTimetableItem
  • MODE_INTERRUPTED : OnlineAccess
  • MODE_OFFLINE : OnlineAccess
  • MODE_ONLINE : OnlineAccess
  • MODE_TRACKMARK : TrainTimetableItem
  • Monitor() : Scenario
  • MoveToNextStop() : Turntable
  • MoveToPrevStop() : Turntable
  • MoveToStop() : Turntable
  • MPH_TO_KPH : Train
  • MPH_TO_MPS : Train
  • msgEarlySent : TrainTimetableItem
  • msgLateSent : TrainTimetableItem
  • mwstopped : StationBehaviour

- n -

  • name : ShuntTrack
  • NavigateThroughTrackside() : DriverCharacter
  • NavigateToIndustry() : DriverCharacter
  • NavigateToTrackside() : DriverCharacter
  • NavigateToVehicle() : DriverCharacter
  • NewBrowser() : Constructors
  • NewDriverCommand() : Constructors
  • NewDriverCommands() : Constructors
  • NewKUIDList() : Constructors
  • NewMenu() : Constructors
  • NewProductFilter() : Constructors
  • NewSoup() : Constructors
  • no3_pipe_needle : DefaultSteamCabin, DefaultLocomotiveCabin
  • NO_MODULE : World
  • NONE : ScenarioBehavior
  • notifyDriver : Schedule
  • NotifyProcessFinished() : Industry, BaseIndustry
  • NotifyProcessStarted() : Industry
  • NotifyUser() : DriverCharacter
  • NULL_TYPE : PropertyValue
  • number : VehicleDescriptor

- o -

  • obj : Command
  • Objective() : InterfaceObjective
  • objective : InterfaceObjective
  • observers : TimetableState
  • OnAnnounce() : Schedule
  • OnAnnouncement() : Timetable
  • OnJunction() : Navigate
  • OnTrigger() : Schedule, Navigate
  • OpenGroup() : OnlineAccess
  • overrun : StationBehaviour

- p -

  • pantograph_lever : DefaultLocomotiveCabin
  • Pause() : ScenarioBehavior, ConditionalScenarioBehavior
  • PauseChildren() : ConditionalScenarioBehavior
  • PAUSED : ScenarioBehavior
  • PerformInnerEnterMoving() : GenericIndustry, BaseIndustry
  • PerformInnerEnterStop() : GenericIndustry, BaseIndustry
  • PerformMassStopped() : BaseIndustry
  • PerformMassStoppedLoad() : GenericPassengerStation, BaseIndustry
  • PerformMovingLoad() : GenericIndustry, BaseIndustry
  • PerformProcessCancelled() : Industry
  • PerformProcessFinished() : Industry
  • PerformProcessInput() : Industry
  • PerformProcessOutput() : Industry
  • PerformProcessStarted() : Industry
  • PerformProductLoadAndUnload() : GenericPassengerStation
  • PerformStopped() : GenericIndustry, BaseIndustry
  • PerformStoppedLoad() : GenericIndustry, BaseIndustry
  • PerformStoppedNoTrigger() : GenericIndustry, BaseIndustry
  • PHYSICS_DCC : Train
  • PHYSICS_SIMULATION : Train
  • pipeName : GenericIndustry, BaseIndustry
  • platformIndex : TrackLoadInfo
  • Play2DSound() : World
  • PlaySound() : World
  • PlaySoundScriptEvent() : MapObject
  • PostMessage() : Schedule, OnlineAccess, Router, GameObject
  • PostOfflineMessage() : OnlineAccess
  • Print() : Interface
  • ProceedToNextCommand() : DriverCommands
  • processes : IndustryProductInfoComplete
  • processName : IndustryProcessInfo, IndustryProductInfo
  • productKUID : LoadHelperInfo
  • Prop() : HTMLPropertyHandler
  • PropertyBrowserRefresh() : PropertyObject
  • PropMatchesPrefix() : HTMLPropertyHandler
  • PropStripPrefix() : HTMLPropertyHandler
  • psi : GenericPassengerStation

- q -

  • queue : IndustryProductInfo
  • queueName : LoadHelperInfo
  • queues : IndustryProductInfoComplete
  • Quote() : BrowserInterface

- r -

  • Rand() : Math
  • RandBool() : TrainUtil
  • RED : Signal
  • ReEnter() : Trackside, SceneryWithTrack
  • RefreshBrowser() : HTMLPropertyGroup, HTMLPropertyHandler, ConsistHelperInfo
  • regulator_lever : DefaultSteamCabin
  • regulator_lever_val : DefaultSteamCabinData
  • ReissueLastCommand() : DriverCharacter
  • Release() : Permit
  • releasePermitsWhenComplete : Schedule
  • ReleaseTrackPermits() : Train
  • RemoveAllUnlockedVehicles() : IndustryTrainController
  • RemoveDriverCharacter() : World
  • RemoveDriverCommand() : World
  • RemoveHandler() : HTMLPropertyGroup
  • RemoveKUID() : KUIDList
  • RemoveNamedTag() : Soup
  • RemoveProduct() : ProductFilter
  • RemoveProductCategory() : ProductFilter
  • RemoveUser() : OnlineGroup
  • RemoveVehicle() : IndustryTrainController
  • RemoveVehicleLock() : IndustryTrainController
  • Reposition() : Vehicle
  • RequestPermit() : Track, JunctionBase
  • RequestPermitForTrain() : Track
  • RequestTrackPermit() : Trackside, JunctionBase
  • ReSendStoppedMessages() : IndustryTrainController
  • Reset() : Timetable, Schedule, ScenarioBehavior
  • ResetButtons() : RadioButtonListHandler
  • ResetChildren() : ConditionalScenarioBehavior
  • ResetResults() : Interface
  • ResetScrollBar() : Browser
  • ResetTimetable() : Schedule
  • resource : ResourceRequirement
  • RESULT_BACKWARD : Train
  • RESULT_CONNECTION_FAILED : OnlineAccess
  • RESULT_DENIED_LOCAL : OnlineAccess
  • RESULT_DENIED_REMOTE : OnlineAccess
  • RESULT_FLOOD : OnlineAccess
  • RESULT_FORWARD : Train
  • RESULT_INSIDE : Train
  • RESULT_NO_DATA : OnlineAccess
  • RESULT_NONE : Train
  • RESULT_OK : OnlineAccess
  • RESULT_OVERFLOW : OnlineAccess
  • Reverse() : Vehicle
  • reverse : StationBehaviour
  • reverser_lever : DefaultSteamCabin, DefaultLocomotiveCabin
  • ReverseTrain() : Schedule
  • Right() : Str
  • RIGHT_SIDE : LoadingReport
  • right_sliding_window : DefaultSteamCabin
  • right_sliding_window_val : DefaultSteamCabinData
  • right_window : DefaultSteamCabin
  • right_window_val : DefaultSteamCabinData
  • runningNumber : VehicleDescriptor
  • runred : SignalBehaviour
  • RunSchedule() : Train
  • RunTurnTable() : TrainUtil

- s -

  • sanding_lever : DefaultSteamCabin
  • sanding_lever_val : DefaultSteamCabinData
  • Save() : Scenario
  • score : InterfaceObjective, InterfaceAlert
  • SearchNext() : GSTrackSearch
  • seat0 : DefaultSteamCabin
  • seat0_val : DefaultSteamCabinData
  • seat1 : DefaultSteamCabin
  • seat1_val : DefaultSteamCabinData
  • SelectCabinDCC() : ScenarioSupport
  • SendMessage() : GameObject
  • Set() : PropertyValue
  • SetAdhesion() : Train
  • SetAdvisoryLimit() : Train
  • SetAlert() : Interface
  • SetAll() : CheckListPropertyHandler
  • SetAutopilotMode() : Train
  • SetAutopilotTarget() : Train
  • SetAutopilotTargetMinimumDistance() : Train
  • SetAutopilotTargetMinimumSpeed() : Train
  • SetBail() : Train
  • SetBoolValue() : GenericBoolHandler
  • SetBrakePipeEfficiency() : Vehicle
  • SetBrokenBrakes() : Vehicle
  • SetBrokenReverser() : Locomotive
  • SetBrokenThrottle() : Locomotive
  • SetBuildingPaused() : Buildable
  • SetBuildingProgress() : Buildable
  • SetBuildingState() : Buildable
  • SetCabinData() : Locomotive
  • SetCabinSwayAmount() : Vehicle
  • SetCabLightIntensity() : Cabin
  • SetCamera() : World
  • SetCameraAngle() : World
  • SetCameraFlags() : World
  • SetCameraMode() : World
  • SetCloseEnabled() : Browser
  • SetComplete() : ScenarioBehavior
  • SetCompressorEfficiency() : Locomotive
  • SetCouplerBreakageEnabled() : Vehicle
  • SetCouplingMask() : Vehicle, Train
  • SetCrossingAutomatic() : Crossing
  • SetCrossingState() : Crossing
  • SetDCCMode() : World1
  • SetDCCThrottle() : Train
  • SetDecoupleMode() : Interface
  • SetDecouplingMask() : Vehicle, Train
  • SetDefaults() : SignalBehaviour, StationBehaviour
  • SetDerailLevel() : World1
  • SetDirection() : JunctionBase
  • SetDriverCharacter() : DriverScheduleCommand
  • SetDriverCommandFilter() : DriverCharacter
  • SetDriverCommands() : DriverCharacter
  • SetDriverScheduleRepeat() : DriverCommands
  • SetDynamicBrakeMode() : Train
  • SetElementObjectProperty() : Browser
  • SetElementProperty() : Interface, Browser
  • SetEngineSetting() : Locomotive
  • SetFloatingLimit() : Train
  • SetFXAnimationState() : MeshObject
  • SetFXAttachment() : MeshObject
  • SetFXCoronaTexture() : MeshObject
  • SetFXNameText() : MeshObject
  • SetFXTextureReplacement() : MeshObject
  • SetGameTime() : World
  • SetGameTimeRate() : World
  • SetHandBrake() : Vehicle, Train
  • SetHasDriver() : Locomotive
  • SetHeadlightColor() : Vehicle
  • SetHeadlightState() : Train
  • SetHelperIconScale() : Interface
  • SetItem() : CheckListPropertyHandler
  • SetLastVisitedBuildable() : Train
  • SetLocalData() : OnlineAccess
  • SetLocalisedName() : DriverCharacter
  • SetLocation() : DriverCharacter
  • SetLocked() : CabinControl
  • SetManualThrottle() : Train
  • SetMapView() : Interface
  • SetMaximumCouplerCompressionStress() : Vehicle
  • SetMaximumCouplerExpansionStress() : Vehicle
  • SetMaximumCoupleVelocity() : Vehicle
  • SetMaximumTractiveEffort() : Vehicle
  • SetMesh() : MeshObject
  • SetMeshAnimationFrame() : MeshObject
  • SetMeshAnimationSpeed() : MeshObject
  • SetMeshAnimationState() : MeshObject
  • SetMeshVisible() : MeshObject
  • SetMessageWindowVisible() : Interface
  • SetMetricMode() : Interface
  • SetNamedSoup() : Soup
  • SetNamedTag() : Soup
  • SetNamedValue() : CabinControl
  • SetObjective() : Interface
  • SetObjectiveBarVisible() : Interface
  • SetObjectiveIcon() : Interface
  • SetOverlayColor() : BrowserInterface
  • SetOwnerObject() : Permit
  • SetPantographState() : Train
  • SetParam() : StringTable, Browser
  • SetPhysicsMode() : Train
  • SetPitchBasedOnSpeed() : Vehicle
  • SetPitchBasedOnTrack() : Vehicle
  • SetPrefix() : HTMLPropertyGroup, HTMLPropertyHandler
  • SetProcessDuration() : Industry
  • SetProcessEnabled() : Industry
  • SetProcessInput() : Industry
  • SetProcessOutput() : Industry
  • SetProductDisabled() : Vehicle
  • SetProductFilter() : ProductQueue
  • SetProductRestriction() : Vehicle
  • SetProperties() : VehicleHelperInfo, VHISpecificVehiclesInfo, Vehicle, TrainHelperInfo, SpecificVehiclesInfo, ScenarioBehavior, PropertyObject, PassengerStationInfo, GenericListHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, EnumeratedMultiPropertyHandler, EnumeratedPropertyHandler, RadioButtonGroupHandler, CheckListGroupHandler, RadioButtonListHandler, AssetCheckListHandler, CheckListPropertyHandler, GenericBoolHandler, GenericIntNumberHandler, GenericStringHandler, ConfigAssetGroupHandler, ConfigAssetHandler, Library, HTMLPropertyGroup, HTMLPropertyHandler, GenericPassengerStation, DriverScheduleCommand, DriverCommands, ConsistListHelper, ConsistHelperInfo, LoadHelperInfo, ConditionalScenarioBehavior, BaseIndustry
  • SetPropertyAttribute() : GenericBoolHandler, ConfigAssetGroupHandler, HTMLPropertyGroup, HTMLPropertyHandler
  • SetPropertyHandler() : PropertyObject
  • SetPropertySelectedElementList() : PropertyObject
  • SetPropertyValue() : VehicleHelperInfo, VHISpecificVehiclesInfo, Vehicle, TrainHelperInfo, SpecificVehiclesInfo, PropertyObject, PassengerStationInfo, GenericListHandler, EnumeratedGameObjectHandler, EnumeratedAssetHandler, EnumeratedMultiPropertyHandler, EnumeratedPropertyHandler, RadioButtonGroupHandler, CheckListGroupHandler, RadioButtonListHandler, AssetCheckListHandler, CheckListPropertyHandler, GenericBoolHandler, GenericIntNumberHandler, GenericStringHandler, HTMLPropertyGroup, HTMLPropertyHandler, GenericIndustry, ConsistListHelper, ConsistHelperInfo, LoadHelperInfo, BaseIndustryInfo
  • SetQueueInitialCount() : Vehicle, GenericIndustry, BaseIndustry
  • SetQueueSize() : ProductQueue
  • SetResults() : Interface
  • SetReverser() : Train
  • SetRollBasedOnTrack() : Vehicle
  • SetRunningCommands() : DriverCharacter
  • SetRunningNumber() : Vehicle
  • SetSandingTractionMultiplier() : Vehicle
  • SetSaveAllowed() : BrowserInterface
  • SetSavesProperties() : HTMLPropertyHandler
  • SetScore() : Interface
  • SetScrollEnabled() : Browser
  • SetSignal() : Schedule, Navigate
  • SetSignalState() : Signal
  • SetSignalStateEx() : Signal
  • SetSpeedLimit() : Trackside
  • SetStateFlags() : ScenarioBehavior
  • SetTargetObserver() : World
  • SetText() : CabinControl
  • SetTooltip() : Interface
  • SetTrackPriorityNumber() : Track
  • SetTrainBrakes() : Train
  • SetTrainCommand() : IndustryTrainController
  • SetTrainPriorityNumber() : Train
  • SetTrainSpeed() : IndustryTrainController
  • SetTrainTimetable() : Train
  • SetTrainzText() : Browser
  • SetUserLimits() : CabinControl
  • SetValue() : CabinControl
  • SetVehicleSpeed() : IndustryTrainController
  • SetVelocity() : Train
  • SetVisible() : CabinControl
  • SetWaybillWindowVisible() : Interface
  • SetWeather() : World
  • SetWheelslipTractionMultiplier() : Vehicle
  • SetWindowBottom() : Browser
  • SetWindowGrow() : Browser
  • SetWindowHeight() : Browser
  • SetWindowLeft() : Browser
  • SetWindowPosition() : Browser
  • SetWindowRect() : Browser
  • SetWindowRight() : Browser
  • SetWindowSize() : Browser
  • SetWindowStyle() : Browser
  • SetWindowTop() : Browser
  • SetWindowVisible() : Browser
  • SetWindowWidth() : Browser
  • ShouldIgnoreVehicle() : IndustryTrainController
  • ShowDriverButtonMenu() : Interface
  • ShowInConsistMenu() : Train
  • showInConsistMenu : ConsistHelperInfo
  • showInViewDetails : IndustryProductInfo
  • ShowObjective() : Interface
  • ShowOnScreenHelp() : Interface
  • sideFlags : LoadingReport
  • Signal() : Navigate
  • signalPassedAtDanger : Schedule
  • Sleep() : GameObject
  • Sniff() : GameObject
  • SoundHorn() : Train
  • speedometer : DefaultSteamCabin, DefaultLocomotiveCabin
  • Sqrt() : Math
  • src : LoadingReport, Message
  • srcQueue : LoadingReport
  • StartBuild() : Buildable
  • StartMeshAnimationLoop() : MeshObject
  • state : TimetableState
  • STATE_BUILDING : Buildable
  • STATE_COMPLETE : Buildable
  • STATE_GRANTED : Permit
  • STATE_POTENTIAL : Buildable
  • STATE_RELEASED : Permit
  • STATE_REQUESTING : Permit
  • stateName : TimetableState
  • Station() : Navigate
  • StationMain() : GenericPassengerStation
  • STATUS_CLOSED : OnlineGroup
  • STATUS_CONNECTING : OnlineGroup
  • STATUS_OFFLINE : OnlineGroup
  • STATUS_OPEN : OnlineGroup
  • StopAtScenery() : Schedule
  • StopAtTrackMark() : Schedule
  • StopAtTrigger() : Schedule
  • StopMeshAnimation() : MeshObject
  • stopped : StationBehaviour
  • StopSchedule() : Train
  • StopScheduleAndWait() : Train
  • StopSoundScriptEvent() : MapObject
  • StopTrain() : Schedule
  • StopTrainGently() : Train
  • STRING_TYPE : PropertyValue
  • StrSubst() : TrainUtil
  • STYLE_DEFAULT : Browser
  • STYLE_NO_FRAME : Browser
  • STYLE_TOOLTIP : Browser
  • SubdivideItems() : Menu
  • SURVEYOR_MODULE : World
  • SwitchForTrain() : JunctionBase

- t -

  • TakeJunction() : Schedule
  • TakePermitOnTrack() : Train
  • TakeTrackPermit() : Schedule
  • Test() : Flags
  • TestAny() : Flags
  • TestTrackPermit() : Train
  • text : LinkedData
  • ThreadEndPipeAnimation() : GenericIndustry, BaseIndustry
  • ThreadPerformMassStoppedLoad() : BaseIndustry
  • ThreadPerformMovingLoad() : BaseIndustry
  • ThreadPerformStoppedLoad() : BaseIndustry
  • ThreadPollCondition() : ConditionalScenarioBehavior
  • throttle_lever : DefaultLocomotiveCabin
  • time : InterfaceAlert
  • TIME_DAY : World
  • TIME_HOUR : World
  • TIME_MINUTE : World
  • TIME_RATE_1200X : World
  • TIME_RATE_120X : World
  • TIME_RATE_1440X : World
  • TIME_RATE_16X : World
  • TIME_RATE_1X : World
  • TIME_RATE_240X : World
  • TIME_RATE_2X : World
  • TIME_RATE_32X : World
  • TIME_RATE_360X : World
  • TIME_RATE_480X : World
  • TIME_RATE_4X : World
  • TIME_RATE_60X : World
  • TIME_RATE_720X : World
  • TIME_RATE_8X : World
  • TIME_RATE_960X : World
  • TIME_SECOND : World
  • timeTableInfo : Train
  • ToFloat() : Str
  • ToggleScheduleWindow() : Train
  • ToggleViewDetailsWindow() : Train
  • ToInt() : Str
  • Tokens() : Str
  • ToLower() : Str
  • TOP_SIDE : LoadingReport
  • ToUpper() : Str
  • trackName : TrainTimetableItem, TrackLoadInfo
  • tracks : IndustryProductInfoComplete
  • TrackSearch() : Train
  • TracksideIsInFront() : Train
  • TRACTION_FORWARD : Train
  • TRACTION_NEUTRAL : Train
  • TRACTION_REVERSE : Train
  • train : ITCTrainCommand
  • TRAIN_BRAKE_APPLICATION : Train
  • TRAIN_BRAKE_EMERGENCY : Train
  • TRAIN_BRAKE_HANDLE_OFF : Train
  • TRAIN_BRAKE_INITIAL : Train
  • TRAIN_BRAKE_LAP : Train
  • train_brake_lever : DefaultSteamCabin, DefaultLocomotiveCabin
  • TRAIN_BRAKE_RELEASE : Train
  • TRAIN_IS_STUCK : DriverCharacter
  • train_lapbrake_lever : DefaultSteamCabin, DefaultLocomotiveCabin
  • TRAIN_NOT_STUCK : DriverCharacter
  • TrainBadCouple() : Scenario
  • TrainCollided() : Scenario
  • TrainDerailed() : Scenario
  • trainLeftSide : TrackLoadInfo
  • TrainOverAdvisorySpeed() : Scenario
  • TrainOverSpeed() : Scenario
  • TrainSpeedingFine() : Scenario
  • TransferProductFrom() : ProductQueue
  • trigger : ShuntTrack
  • TRIGGER_ENTER : Navigate
  • TRIGGER_LEAVE : Navigate
  • TRIGGER_STOPPED : Navigate
  • TriggerSupportsMassMovingLoad() : BaseIndustry
  • TriggerSupportsMassStoppedLoad() : BaseIndustry
  • TriggerSupportsMovingLoad() : GenericIndustry, BaseIndustry
  • TriggerSupportsStoppedLoad() : GenericIndustry, BaseIndustry
  • TrimLeft() : Str
  • TrimRight() : Str
  • Turnaround() : Train
  • TYPE_HAS_INTERIOR : Vehicle
  • TYPE_LOCOMOTIVE : Vehicle
  • TYPE_TENDER : Vehicle

- u -

  • UnAnnounce() : Timetable
  • Uncouple() : Vehicle
  • UNLOAD_COMMAND : Industry
  • UnloadProduct() : Vehicle
  • UnpackFloat() : Str
  • UnpackInt() : Str
  • UnpackString() : Str
  • UnpauseChildren() : ConditionalScenarioBehavior
  • Update() : DefaultSteamCabin, DefaultLocomotiveCabin, Cabin
  • UpdateCabin() : ControlSettingsManager
  • UpdateCabinFromSavedData() : DefaultSteamCabin
  • UpdateChildren() : ConditionalScenarioBehavior
  • UpdateExecute() : DriverScheduleCommand
  • UpdateScheduleWindow() : Train
  • UpdateStationParameters() : GenericPassengerStation
  • UpdateViewDetails() : Vehicle, Train
  • UpdateViewDetailsLocomotive() : Train
  • usePipeAnimation : GenericIndustry, BaseIndustry
  • USER_STATUS_INSIDE : OnlineGroup
  • USER_STATUS_INVALID : OnlineGroup
  • USER_STATUS_OFFLINE : OnlineGroup
  • USER_STATUS_ONLINE : OnlineGroup
  • USER_STATUS_UNKNOWN : OnlineGroup
  • UserPressKey() : DefaultSteamCabin, DefaultLocomotiveCabin, Cabin
  • UserSetCamera() : World
  • UserSetCameraMode() : World
  • UserSetControl() : DefaultSteamCabin, DefaultLocomotiveCabin, Cabin

- v -

  • vehicle : VehicleDescriptor, ShuntTrack
  • vehicleProductInfoCollection : Vehicle
  • vehicles : ConsistHelperInfo
  • ViewDetails() : Vehicle, Train, GenericIndustry, BaseIndustry
  • ViewSchedule() : Vehicle

- w -

  • WaitUntilHas() : TrainUtil
  • warning : SignalBehaviour, StationBehaviour
  • WarnObsolete() : Interface
  • WAS_COMPLETE : ScenarioBehavior
  • WasComplete() : ScenarioBehavior
  • WasGranted() : Permit
  • WasRunScheduleSuccessful() : Train
  • waterGlassLeft_dial : DefaultSteamCabin
  • waterGlassRight_dial : DefaultSteamCabin
  • waterInjector0 : DefaultSteamCabin
  • waterInjector1 : DefaultSteamCabin
  • wav : InterfaceObjective, InterfaceAlert
  • WEATHER_CHANGEABILITY_EXTREME : World
  • WEATHER_CHANGEABILITY_NONE : World
  • WEATHER_CHANGEABILITY_PERIODIC : World
  • WEATHER_TYPE_CLEAR : World
  • WEATHER_TYPE_CLOUDY : World
  • WEATHER_TYPE_DRIZZLE : World
  • WEATHER_TYPE_HEAVY_SNOW : World
  • WEATHER_TYPE_LIGHT_SNOW : World
  • WEATHER_TYPE_MEDIUM_SNOW : World
  • WEATHER_TYPE_RAIN : World
  • WEATHER_TYPE_STORMY : World
  • wheelslip_light : DefaultLocomotiveCabin
  • whistle_lever : DefaultSteamCabin
  • whistle_lever_val : DefaultSteamCabinData

- y -

  • YELLOW : Signal


Asset Source

Config and Script Source for Auran TRS2006 Assets

Driver Commands

  • Couple
  • Decouple
  • Drive Schedule
  • Drive To
  • Drive To Trackmark
  • Drive Via Trackmark
  • Load Product
  • Notify
  • Run Around
  • Unload Product
  • Wait For
Industries
  • Airport
  • Brick Station Large
  • Brick Station Medium
  • Brick Station Medium2
  • Brick Station Small
  • Coal Mine
  • Container Station
  • Forestry
  • Hyde Pulp Mill
  • Lumber Mill
  • Multiple Industry
  • Multiple Industry New
  • Oil Field
  • Oil Refinery
  • Portal
  • Power Station
  • Seaport
  • Small Station
  • Steam Filling Station
Interiors
  • Bigsteam Interior
  • DD40 Interior
  • PB15 Interior
Libraries
  • Display HTML Pages
Rules
  • Cab Controls HUD
  • Consist Check
  • Control Type
  • Coupler Breakage HUD
  • Derailment Realism
  • Disabled HUD Icon Notification
  • Display Custom HUD
  • Display HTML
  • Display HTML Pages
  • Display Video
  • Driver Command
  • Driver Command Check
  • Driver Main Menu Options
  • Driver Setup
  • Enable/Disable Driver Commands
  • Enable/Disable HUD Icons
  • End Scenario
  • Flash HUD Icon
  • Flash HUD Panel
  • Message Popup
  • Minimap Options
  • Multiple Junction Alignment Check
  • Multiple Resource Check
  • Objective Clear
  • Objective New
  • Objective Remove
  • Online Chat
  • Ordered List
  • Play Wave
  • Power Station Rule
  • Progressive List
  • Random List
  • Reset List
  • Resource Check
  • Schedule Rule
  • Set Camera
  • Set Coupler Masks
  • Set Helper Icon Size
  • Set HTML Pages
  • Set Junctions
  • Show/Hide HUD Panel
  • Show/Hide Minimap
  • Simultaneous List
  • Startup Options
  • Time and Rate
  • Trigger Check
  • Trigger Rule
  • Variable Check
  • Variable Modify Continuous
  • Variable Modify
  • Variable Show
  • Vehicle Physics
  • Wait for Camera View Mode
  • Wait for Click on HUD Icon
  • Wait for Derailment
  • Wait for Driver On/Off Train
  • Wait for HTML Pages
  • Wait on Minimap Screen/Main Screen
  • Wait on Train Stop/Start
  • Wait on Waybill Screen/Main Screen
  • Weather
Vehicles
  • Coal Hopper
  • GATX Oil Tanker
  • Woodchip Gondola


Driver Commands
[Asset Source]

Driver Commands

  • Couple
  • Decouple
  • Drive Schedule
  • Drive To
  • Drive To Trackmark
  • Drive Via Trackmark
  • Load Product
  • Notify
  • Run Around
  • Unload Product
  • Wait For


Couple
[Driver Commands]

Couple Command

config.txt:

﻿
username            "Couple"
kind              "drivercommand"
kuid              <kuid:-3:10081>
script              "CoupleCommand"
class             "CoupleCommand"
icon-texture            "couple.texture"
string-table {
  description         "Couple train to designated vehicle."
  driver_command_couple       "Couple >"
  tt_couple_to          "Couple To "
}
kuid-table {
  command-sounds          <kuid:-3:10219>
}
supports-null-driver-character        1
username-de           "Ankoppeln"
string-table-de {
  description         "Description"
  driver_command_couple       "Koppeln >"
  tt_couple_to          "Koppeln an "
}
username-it           "Aggancia"
string-table-it {
  description         "Description"
  driver_command_couple       "Aggancia>"
  tt_couple_to          "Aggancia a "
}
username-es           "Enganchar"
string-table-es {
  description         "Description"
  driver_command_couple       "Enganchar >"
  tt_couple_to          "Enganchar a "
}
username-pl           "Połącz"
string-table-pl {
  description         "Description"
  driver_command_couple       "Połącz >"
  tt_couple_to          "Połącz z "
}
username-cz           "Spojit"
string-table-cz {
  description         "Description"
  driver_command_couple       "Spojit >"
  tt_couple_to          "Spojit s "
}
username-ru           "Прицепить"
string-table-ru {
  description         "Description"
  driver_command_couple       "Сцепить >"
  tt_couple_to          "Сцепить с"
}
username-fr           "Atteler"
string-table-fr {
  description         "Attèle le train au véhicule spécifié"
  driver_command_couple       "Atteler >"
  tt_couple_to          "Atteler à "
}

CoupleCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"

include "CoupleScheduleCommand.gs"

//
// LoadCOmmand
//
// Basic "load" command functionality.
//

class CoupleCommand isclass DriverCommand
{
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "CoupleItem", null, "Couple");
  }

  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    Menu itemMenu = Constructors.NewMenu();
    Train train;
    StringTable strTable = GetAsset().GetStringTable();

    if (driver)
      train = driver.GetTrain();

    if (train or !driver)
    {
      Train[] trains = World.GetTrainList();
      int i= 0;
      for (i = 0; i < trains.size(); i++)
      {
        if (trains[i] != train)
        {
          Vehicle[] vehicles = trains[i].GetVehicles();

          // only add first and last items..
          if (vehicles.size() > 0)
          {
            string name = vehicles[0].GetLocalisedName();

            if (name.size())
              itemMenu.AddItem(name, me, "CoupleItem", vehicles[0].GetName());
          }

          // only add the end item if there are more than 1 items, otherwise we will get duplicates
          if (vehicles.size() > 1)
          {
            string name = vehicles[vehicles.size() - 1].GetLocalisedName();

            if (name.size())
              itemMenu.AddItem(name, me, "CoupleItem", vehicles[vehicles.size() - 1].GetName());
          }
        }
      }

      if (itemMenu.CountItems())
      {
        itemMenu.SubdivideItems();
        menu.AddSubmenu(strTable.GetString("driver_command_couple"), itemMenu);
      }
    }
  }

  void PlayConfirmation(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("command-sounds");
    Library libCommandSounds = World.GetLibrary(kuid);
    if (libCommandSounds)
    {
      libCommandSounds.LibraryCall("PlayConfirmation", null, null);
    }
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    CoupleScheduleCommand cmd = new CoupleScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetParent(me);
    cmd.SetProperties(soup);
    return cast<DriverScheduleCommand>cmd;
  }

  void Couple(Message msg)
  {
    DriverCommands commands = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);
    string vehicleName = msg.minor;

      // schedule our command
    Soup soup = Constructors.NewSoup();
    soup.SetNamedTag("vehicleName", vehicleName);
    CoupleScheduleCommand cmd = cast<CoupleScheduleCommand>CreateScheduleCommand(driver, soup);
    commands.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

};

CoupleScheduleCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "CoupleCommand.gs"
include "Schedule.gs"

class CoupleScheduleCommand isclass DriverScheduleCommand
{
  public string vehicleName;

  CoupleCommand parent;

  public void SetParent(CoupleCommand newParent)
  {
    parent = newParent;
  }

  public void Init(DriverCharacter driver, DriverCommand newParent)
  {
    parent = cast<CoupleCommand>(newParent);
    inherited(driver, newParent);
  }

  public bool BeginExecute(DriverCharacter driver)
  {
    Train train = driver.GetTrain();
    if (!train)
        // cant couple if we dont have a train
      return false;

    Vehicle vehicle = cast<Vehicle>(Router.GetGameObject(vehicleName));
    if (!vehicle)
      // can't couple without a target vehicle
      return false;

    if (vehicle.GetMyTrain() == train)
      // can't couple to self
      return false;

    driver.NavigateToVehicle(vehicle);

    return true;
  }

  // we should really implement EndExecute() to allow the game to determine the success of this command

  public object GetIcon(void)
  {
    return cast<object>parent;
  }

  public string GetTooltip(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    return strTable.GetString("tt_couple_to") + vehicleName;
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    // Save support
    // Save the properties to the soup, then return the soup
    soup.SetNamedTag("vehicleName", vehicleName);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    // Load support
    // Setup the properties from the passed in soup
    vehicleName = soup.GetNamedTag("vehicleName");
  }
};


Decouple
[Driver Commands]

Decouple Command

config.txt:

﻿
username            "Decouple"
kind              "drivercommand"
kuid              <kuid:-3:10082>
script              "DecoupleCommand"
class             "DecoupleCommand"
icon-texture            "decouple.texture"
string-table {
  description         "Decouples the train at the specified vehicle."
  driver_command_decouple       "Decouple >"
  tt_decouple         "Decouple "
}
kuid-table {
  command-sounds          <kuid:-3:10219>
}
username-de           "Abkoppeln"
string-table-de {
  description         "Description"
  driver_command_decouple       "Abkoppeln >"
  tt_decouple         "Abkoppeln "
}
username-it           "Sgancia"
string-table-it {
  description         "Description"
  driver_command_decouple       "Sgancia >"
  tt_decouple         "Sgancia "
}
username-es           "Desenganchar"
string-table-es {
  description         "Description"
  driver_command_decouple       "Desenganchar >"
  tt_decouple         "Desenganchar "
}
username-pl           "Odłącz"
string-table-pl {
  description         "Description"
  driver_command_decouple       "Odłącz >"
  tt_decouple         "Odłącz "
}
username-cz           "Rozpojit"
string-table-cz {
  description         "Description"
  driver_command_decouple       "Rozpojit >"
  tt_decouple         "Rozpojit "
}
username-ru           "Расцепить"
string-table-ru {
  description         "Description"
  driver_command_decouple       "Расцепить >"
  tt_decouple         "Расцепить "
}
username-fr           "Dételer
string-table-fr {
  description         "Détèle le train à l’endroit du véhicule spécifié."
  driver_command_decouple       "Dételer >"
  tt_decouple         "'Dételer de '"
}

DecoupleCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"

include "DecoupleScheduleCommand.gs"

class DecoupleCommand isclass DriverCommand
{
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "DecoupleItem", null, "Decouple");
  }

  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    Menu itemMenu = Constructors.NewMenu();
    Train train;
    StringTable strTable = GetAsset().GetStringTable();

    if (driver)
      train = driver.GetTrain();

    if (train)
    {
      Vehicle[] vehicles = train.GetVehicles();

      if (vehicles.size() > 1)
      {
        int k;
        for (k = 1; k < vehicles.size(); k++)
        {
          if (vehicles[k].GetName() != "")
            itemMenu.AddItem(vehicles[k].GetName(), me, "DecoupleItem", vehicles[k].GetName());
        }

        itemMenu.SubdivideItems(false);
        menu.AddSubmenu(strTable.GetString("driver_command_decouple"), itemMenu);
      }
    }
  }

  void PlayConfirmation(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("command-sounds");
    Library libCommandSounds = World.GetLibrary(kuid);
    if (libCommandSounds)
    {
      libCommandSounds.LibraryCall("PlayConfirmation", null, null);
    }
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    DecoupleScheduleCommand cmd = new DecoupleScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetProperties(soup);
    cmd.SetParent(me);
    return cast<DriverScheduleCommand>cmd;
  }

  void Decouple(Message msg)
  {
    DriverCommands commands = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);
    string vehicleName = msg.minor;

      // schedule our command
    Soup soup = Constructors.NewSoup();
    soup.SetNamedTag("vehicleName", vehicleName);
    DecoupleScheduleCommand cmd = cast<DecoupleScheduleCommand>CreateScheduleCommand(driver, soup);
    commands.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

};

DecoupleScheduleCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "DecoupleCommand.gs"
include "Schedule.gs"

class DecoupleCustomCommand isclass CustomCommand
{
  public Vehicle vehicle;
  public DriverCharacter driver;

    //
    // 1. 'me' is this CustomCommand
    // 2. The thread is running on the Train GameObject,
    //    therefore all wait() calls, etc receive messages through the Train GameObject.
    // 3. 'Sniff()' works on the GameObject upon which it is called, which is not necessarily
    //    the same GameObject as the one upon which the current thread is running.
    //
    // This means that when we want to receive a message, it must go to the Train.
    // Any messages we want to send may as well come from the Train as well, but the DriverCharacter is also a GameObject.
    // And any Sniff() calls we make will want to be made on the Train.
    //
  public void HandleDecoupleCommand(Train train)
  {
    Vehicle[] vehicles = train.GetVehicles();
    int i;

    //vehicle.SetCouplingMask(Vehicle.COUPLE_BACK);
    train.SetAutopilotMode(Train.CONTROL_SCRIPT);
    train.SetDCCThrottle(0.0);

    //train.Sniff(vehicle, "Train", null, true);

    if (!train.IsStopped())
    {
      Message msg;
      wait()
      {
        on "Train", "StoppedMoving", msg:
        {
          break;
        }
        continue;
      }
    }
    //train.Sniff(vehicle, "Train", null, false);

    train.SetHandBrake(true);

    if (!vehicle.GetDirectionRelativeToTrain())
      vehicle.Uncouple(Vehicle.COUPLE_BACK);
    else
      vehicle.Uncouple(Vehicle.COUPLE_FRONT);

  }

  public bool Execute(Train train, int px, int py, int pz)
  {
    //train.SetAutopilotMode(Train.CONTROL_AUTOPILOT);
    // Tell the industry to handle our command
    HandleDecoupleCommand(train);

    return true;
  }
};

class DecoupleScheduleCommand isclass DriverScheduleCommand
{
  public string vehicleName;

  DecoupleCommand parent;

  public void SetParent(DecoupleCommand newParent)
  {
    parent = newParent;
  }

  public bool BeginExecute(DriverCharacter driver)
  {
    Train train = driver.GetTrain();
    if (!train)
        // cant decouple if we dont have a train
      return false;

    DecoupleCustomCommand command = new DecoupleCustomCommand();
    command.driver = driver;
    command.vehicle = cast<Vehicle>(Router.GetGameObject(vehicleName));

    Interface.Log("DecoupleScheduleCommand.BeginExecute> enter");

      // get the driver executing this command
    driver.DriverCustomCommand(command);
    driver.DriverIssueSchedule();

    Interface.Log("DecoupleScheduleCommand.BeginExecute> exit");
    return true;
  }

  // we should really implement EndExecute() to allow the game to determine the success of this command

  public object GetIcon(void)
  {
    return cast<object>parent;
  }

  public string GetTooltip(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    return strTable.GetString("tt_decouple") + vehicleName;
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    // Save support
    // Save the properties to the soup, then return the soup
    soup.SetNamedTag("vehicleName", vehicleName);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    // Load support
    // Setup the properties from the passed in soup
    vehicleName = soup.GetNamedTag("vehicleName");
  }
};


Drive Schedule
[Driver Commands]

Drive Schedule Command

config.txt:

﻿
username            "Drive Schedule"
kind              "drivercommand"
kuid              <kuid:-3:10186>
script              "DriveScheduleCommand"
class             "DriveScheduleCommand"
icon-texture            "driveschedule.texture"
supports-null-driver-character        1
string-table {
  description         "Driver command that causes the driver character to carry out the tasks specified by his train's schedule."
  menu-command-item       "Drive Schedule"
}
username-de           "Fahrplan"
string-table-de {
  description         "Description"
  menu-command-item       "Fahrplan"
}
username-it           "Drive Schedule"
string-table-it {
  description         "Description"
  menu-command-item       "Drive Schedule"
}
username-es           "Programa de conducción"
string-table-es {
  description         "Description"
  menu-command-item       "Programa de conducción"
}
username-pl           "Drive Schedule"
string-table-pl {
  description         "Description"
  menu-command-item       "Drive Schedule"
}
username-cz           "Jeď dle jízdního řádu"
string-table-cz {
  description         "Description"
  menu-command-item       "Jeď dle jízdního řádu"
}
username-ru           "Расписание"
string-table-ru {
  description         "Description"
  menu-command-item       "Расписание движения"
}
username-fr           "Horaires"
string-table-fr {
  description         "Ordre au conducteur qui lui fait réaliser les tâches prévues dans l’horaire du train."
  menu-command-item       "Horaires"
}

DriveScheduleCommand.gs:

//
// DriverToCommand.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "DriveScheduleScheduleCommand.gs"

//
// Driver command that causes the driver character to carry out the tasks specified by
// his train's schedule.
//
class DriveScheduleCommand isclass DriverCommand
{
  //
  // Initialize parent object and add handlers to process messages for this driver command object.
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "DriveSchedule", null, "DriveSchedule");
  }

  //
  // Adds industry destination menu items for all industries to the given menu along with submenus of
  // destination tracks for all industries added.
  //
  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (driver and !driver.GetTrain())
      return;

      // todo: localise "Drive Schedule"
    menu.AddItem(strTable.GetString("menu-command-item"), me, "DriveSchedule", "");
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    DriveScheduleScheduleCommand cmd = new DriveScheduleScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetParent(me);
    cmd.SetProperties(soup);
    return cast<DriverScheduleCommand>cmd;
  }

  //
  // Handler method to drive a train to an industry (no specific destination track though).
  //
  void DriveSchedule(Message msg)
  {
    DriverCommands commands = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);
    //string industryName = msg.minor;

      // schedule our command
    Soup soup = Constructors.NewSoup();
    //soup.SetNamedTag("industryName", industryName);
    DriveScheduleScheduleCommand cmd = cast<DriveScheduleScheduleCommand>CreateScheduleCommand(driver, soup);
    commands.AddDriverScheduleCommand(cmd);

    //PlayConfirmation();
  }

};

DriveScheduleScheduleCommand.gs:

//
// DriveScheduleScheduleCommand.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//
include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "DriveScheduleCommand.gs"
include "Schedule.gs"
include "Trackmark.gs"

class PauseCustomCommand isclass CustomCommand
{
  public float seconds;

  public bool Execute(Train train, int px, int py, int pz)
  {
    int saveMode = train.GetAutopilotMode();
    train.SetAutopilotMode(train.CONTROL_SCRIPT);
    train.SetDCCThrottle(0);

    train.Sleep(seconds);

    train.SetAutopilotMode(saveMode);

    return true;
  }
};

//
// Driver schedule command used by DriveScheduleCommand.
//
class DriveScheduleScheduleCommand isclass DriverScheduleCommand
{
  DriveScheduleCommand parent;
  //bool busy = false;
  int commandState = 0;
  int retryTimer = 0;

  KUID subDriverCommandKUID;
  DriverCommand subDriverCommand;
  DriverScheduleCommand subScheduleCommand;
  string lastVisitedIndustryName;

  public void SetParent(DriveScheduleCommand newParent)
  {
    parent = newParent;
  }

  bool PerformTimetableItem(DriverCharacter driver, TrainTimetableItem item)
  {
    if (item.mode == TrainTimetableItem.MODE_INDUSTRY)
    {
      Industry industry = cast<Industry>(Router.GetGameObject(item.destinationName));
      if (!industry)
      {
        // cant drive to an industry which doesn't exist
        Interface.Log("PerformTimetableItem> unknown industry '" + item.destinationName + "'");
        return false;
      }

      if (!industry.HasTrack(item.trackName))
      {
        // cant drive to an industry track which doesn't exist
        Interface.Log("PerformTimetableItem> unknown industry track '" + item.trackName + "' at industry '" + item.destinationName + "'");
        return false;
      }

      lastVisitedIndustryName = industry.GetName();

      /*return*/ driver.NavigateToIndustry(industry, item.trackName);

        // dont want failure due to "already at destination"
      return true;
    }

    if (item.mode == TrainTimetableItem.MODE_TRACKMARK)
    {
      TrackMark mark = cast<TrackMark>(Router.GetGameObject(item.destinationName));
      if (!mark)
      {
        // cant drive to a trackmark which doesn't exist
        Interface.Log("PerformTimetableItem> unknown trackmark '" + item.destinationName + "'");
        return false;
      }

      lastVisitedIndustryName = "";

      /*return*/ driver.NavigateToTrackside(mark);

        // dont want failure due to "already at destination"
      return true;
    }

    // unknown command?
    Interface.Log("PerformTimetableItem> unknown mode " + item.mode);
    return false;
  }

  bool IsValidTimetable(DriverCharacter driver, Train train)
  {
    TrainTimetable timetable = train.GetTrainTimetable();
    if (timetable)
      return true;

    // cant drive if we have no timetable
    // - give them 3 tries at fixing it.

    if (retryTimer >= 3)
      return true;

    PauseCustomCommand cmd = new PauseCustomCommand();
    cmd.seconds = 1.0f;

    driver.DriverBeginIssueSchedule();
    driver.DriverCustomCommand(cmd);
    driver.DriverIssueSchedule();

    retryTimer ++;

    return false;
  }

  bool ExecuteTimetable(DriverCharacter driver, Train train)
  {
    TrainTimetable timetable = train.GetTrainTimetable();
    if (!timetable)
      return false;

    TrainTimetableItem item = timetable.GetCurrentTimetableItem();

    subDriverCommand = null;
    subScheduleCommand = null;

    if (!item)
    {
      commandState = 0;

      //
      // nothing to do (yet) - delay for a few seconds, then try again
      //
      PauseCustomCommand cmd = new PauseCustomCommand();
      cmd.seconds = 5.0f;

      driver.DriverBeginIssueSchedule();
      driver.DriverCustomCommand(cmd);
      driver.DriverIssueSchedule();

      return true;
    }

    // state 0 - not running
    // state 1 - drive to item
    // state 2 - perform command
    if (commandState == 1)
      if (timetable.GetArrivedAtDestination())
      {
        // already arrived
        commandState = 2;
      }
      else
      {
        //
        // we have a scheduled item to run - do it now!
        //
        if (!PerformTimetableItem(driver, item))
        {
          // something bad happened..
          return false;
        }

        subDriverCommandKUID = item.command;
        return true;
      }

    if (commandState == 2)
    {
      //
      // Load
      //

      Asset commandAsset;

      if (subDriverCommandKUID)
      {
        commandAsset = World.FindAsset(subDriverCommandKUID);
      }

      train.SetLastVisitedBuildable( cast<Buildable> Router.GetGameObject(lastVisitedIndustryName) );

      if (commandAsset)
      {
        // we have a command to run at the destination
        Soup soup = Constructors.NewSoup();

        subDriverCommand = Constructors.NewDriverCommand(commandAsset);
        subScheduleCommand = subDriverCommand.CreateScheduleCommand(driver, soup);

        if (subScheduleCommand and subScheduleCommand.BeginExecute(driver))
        {
          Interface.Log("DriveScheduleScheduleCommand> sub-command BeginExecute() successful");
          return true;
        }

        Interface.Log("DriveScheduleScheduleCommand> sub-command BeginExecute() failed");
      }
      else
        Interface.Log("DriveScheduleScheduleCommand> no sub-command");

      subDriverCommand = null;
      subScheduleCommand = null;

      // hack:
      //  We must allow the train time to stop, otherwise we may not get recognised as having
      //  arrived at our destination. This would cause us to issue another 'drive to' command.
      //
      commandState = 0;

      PauseCustomCommand cmd = new PauseCustomCommand();
      cmd.seconds = 10.0f;

      driver.DriverBeginIssueSchedule();
      driver.DriverCustomCommand(cmd);
      driver.DriverIssueSchedule();

      return true;
    }

    //
    // Done, i guess? - delay for a few seconds, then try again
    //
    commandState = 0;

    PauseCustomCommand cmd = new PauseCustomCommand();
    cmd.seconds = 5.0f;

    driver.DriverBeginIssueSchedule();
    driver.DriverCustomCommand(cmd);
    driver.DriverIssueSchedule();

    return true;
  }

  //
  // Starts executing this schedule command on the given driver character.
  //
  public bool BeginExecute(DriverCharacter driver)
  {
    Train train = driver.GetTrain();
    if (!train)
      // cant drive if we dont have a train
      return false;

    //commandState = 0;

    if (!IsValidTimetable(driver, train))
    {
      // (hack: UpdateExecute() will increment this again before ExecuteTimetable)
      commandState--;
      return true;
    }

    if (!ExecuteTimetable(driver, train))
    {
      Interface.Print("No schedule specified.");
      return false;
    }

    return true;
  }

  //
  public bool UpdateExecute(DriverCharacter driver)
  {
    Train train = driver.GetTrain();
    if (!train)
    {
      // cant drive if we dont have a train
      return false;
    }

    if (!IsValidTimetable(driver, train))
      return true;

    commandState ++;

    if (!ExecuteTimetable(driver, train))
    {
      // assume that we have completed our timetable
      Interface.Log("DriveScheduleScheduleCommand.EndExecute> command complete");
      return false;
    }

    return true;
  }

  public bool EndExecute(DriverCharacter driver)
  {
    retryTimer = 0;
    commandState = 0;

    return true;
  }

  //
  // Provides an icon for this command so it can be seen on the driver's schedule.
  //
  public object GetIcon(void)
  {
    return cast<object>parent;
  }

  public string GetTooltip(void)
  {
    return "Drive Schedule";
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("DriveScheduleCommand.commandState", commandState);
    soup.SetNamedTag("DriveScheduleCommand.commandKUID", subDriverCommandKUID);

    soup.SetNamedTag("DriveScheduleCommand.lastVisitedIndustry", lastVisitedIndustryName);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    commandState = soup.GetNamedTagAsInt("DriveScheduleCommand.commandState");
    subDriverCommandKUID = soup.GetNamedTagAsKUID("DriveScheduleCommand.commandKUID");

    lastVisitedIndustryName = soup.GetNamedTag("DriveScheduleCommand.lastVisitedIndustry");
  }

};


Drive To
[Driver Commands]

Drive To Command

config.txt:

﻿
username            "Drive To"
kind              "drivercommand"
kuid              <kuid:-3:10058>
script              "DriveToCommand"
class             "DriveToCommand"
icon-texture            "driveto.texture"
string-table {
  description         "Allows a driver character to take a train either to a destination industry or a specific track in a destination industry."
  driver_command_drive_to       "Drive To "
}
kuid-table {
  command-sounds          <kuid:-3:10219>
}
supports-null-driver-character        1
username-de           "Fahre zu"
string-table-de {
  description         "Description"
  driver_command_drive_to       "Fahren Sie nach "
}
username-it           "Conduci fino a"
string-table-it {
  description         "Description"
  driver_command_drive_to       "Conduci fino a "
}
username-es           "Conducir a"
string-table-es {
  description         "Description"
  driver_command_drive_to       "Conducir a "
}
username-pl           "Jedź do"
string-table-pl {
  description         "Description"
  driver_command_drive_to       "Jedź do "
}
username-cz           "Jeď do"
string-table-cz {
  description         "Description"
  driver_command_drive_to       "Jeď do "
}
username-ru           "Ехать к"
string-table-ru {
  description         "Description"
  driver_command_drive_to       "Направиться к "
}
username-fr           "Aller à"
string-table-fr {
  description         "Permet au conducteur de mener un train jusqu’à une usine de destination ou une voie spéciale de l’usine de destination."
  driver_command_drive_to       "Conduire jusqu'à "
}

DriveToCommand.gs:

//
// DriverToCommand.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "DriveToScheduleCommand.gs"

//
// Driver command that allows a driver character to take a train either to a destination industry
// or a specific track in a destination industry.
//
class DriveToCommand isclass DriverCommand
{
  //
  // Initialize parent object and add handlers to process messages for this driver command object.
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "DriveToIndustry", null, "DriveTo");
    AddHandler(me, "DriveToIndustryTrack", null, "DriveToTrack");
  }

  //
  // Adds industry destination menu items for all industries to the given menu along with submenus of
  // destination tracks for all industries added.
  //
  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    Train train;
    if (driver)
    {
      train = driver.GetTrain();
      if (!train)
        return;
    }
    StringTable strTable = GetAsset().GetStringTable();

      Menu industriesMenu = Constructors.NewMenu();
      GameObject[] industryList = World.GetIndustryList();

      int i, industryCount = industryList.size();

      if (!industryCount)
        // we dont bother with a 'Drive To' command if there are no industries
        return;

      for (i = 0; i < industryCount; i++)
      {
        Industry industry = cast<Industry>(industryList[i]);
        string localisedName = industry.GetLocalisedName();

        string[] locationNames = new string[0];
        string[] locationTracks = new string[0];

        industry.AppendDriverDestinations(locationNames, locationTracks);

        if (localisedName.size())
          if (locationNames.size())
          {
            Menu submenu = Constructors.NewMenu();
            int j;

            for (j = 0; j < locationNames.size(); j++)
              if (locationNames[j] and locationNames[j].size() and locationTracks[j] and locationTracks[j].size())
                submenu.AddItem(locationNames[j], me, "DriveToIndustryTrack", industry.GetId() + " " + locationTracks[j]);
              else if (train)
                train.Exception("Error in 'track names' of industry '" + localisedName + "'");

            industriesMenu.AddSubmenu(localisedName + " >", submenu);
          }
          else
            industriesMenu.AddItem(localisedName, me, "DriveToIndustry", industry.GetName());
      }

      industriesMenu.SubdivideItems();

      menu.AddSubmenu(strTable.GetString("driver_command_drive_to") + " >", industriesMenu);

  }

  //
  // Called by either DriveTo() or DriveToTrack() to play one of 4 random driver acknowledgments.
  //
  void PlayConfirmation(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("command-sounds");
    Library libCommandSounds = World.GetLibrary(kuid);
    if (libCommandSounds)
    {
      libCommandSounds.LibraryCall("PlayConfirmation", null, null);
    }
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    DriveToScheduleCommand cmd = new DriveToScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetParent(me);
    cmd.SetProperties(soup);
    return cast<DriverScheduleCommand>cmd;
  }

  //
  // Handler method to drive a train to an industry (no specific destination track though).
  //
  void DriveTo(Message msg)
  {
    DriverCommands commands = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);
    string industryName = msg.minor;

      // schedule our command
    Soup soup = Constructors.NewSoup();
    soup.SetNamedTag("industryName", industryName);
    DriveToScheduleCommand cmd = cast<DriveToScheduleCommand>CreateScheduleCommand(driver, soup);
    commands.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

  //
  // Handler method to drive a train to a specific track in an industry.
  //
  void DriveToTrack(Message msg)
  {
    DriverCommands commands = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);
    string msgData = msg.minor;

    int industryId = Str.UnpackInt(msgData);
    string trackName = Str.UnpackString(msgData);

    GameObject industry = Router.GetGameObject(industryId);
    if (!industry)
      return;

    // schedule our command
    Soup soup = Constructors.NewSoup();
    soup.SetNamedTag("industryName", industry.GetName());
    soup.SetNamedTag("trackName", trackName);
    DriveToScheduleCommand cmd = cast<DriveToScheduleCommand>CreateScheduleCommand(driver, soup);
    commands.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

};

DriveToScheduleCommand.gs:

//
// DriveToScheduleCommand.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//
include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "DriveToCommand.gs"
include "Schedule.gs"

//
// Driver schedule command used by DriveToCommand to get a driver character to take a train to
// a specific track on an industry.
//
class DriveToScheduleCommand isclass DriverScheduleCommand
{
  public string industryName;   // Name of the industry to drive to.
  public string trackName;      // Name of the track in the industry to drive to.

  DriveToCommand parent;

  public void SetParent(DriveToCommand newParent)
  {
    parent = newParent;
  }

  //
  // Starts executing this schedule command on the given driver character.
  //
  public bool BeginExecute(DriverCharacter driver)
  {
    Train train = driver.GetTrain();
    if (!train)
      // cant drive if we dont have a train
      return false;

    Industry industry = cast<Industry>(Router.GetGameObject(industryName));
    if (!industry)
      // cant drive to an industry which doesn't exist
      return false;

    return driver.NavigateToIndustry(industry, trackName);
  }

  // we should really implement EndExecute() to allow the game to determine the success of this command

  //
  // Provides an icon for this command so it can be seen on the driver's schedule.  Uses the industry
  // icon to indicate the destination.
  //
  public object GetIcon(void)
  {
    Industry industry = cast<Industry>(Router.GetGameObject(industryName));

    return cast<object>industry;
  }

  public string GetTooltip(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    string userTrackName = trackName;
    Industry industry = cast<Industry>(Router.GetGameObject(industryName));
    if (industry)
    {
      string[] destNames = new string[0];
      string[] destTracks = new string[0];
      industry.AppendDriverDestinations(destNames, destTracks);
      int i;
      for (i = 0; i < destNames.size(); i++)
      {
        if (destTracks[i] == trackName)
        {
          userTrackName = destNames[i];
          break;
        }
      }

    }

    return strTable.GetString("driver_command_drive_to") + industryName + " (" + userTrackName + ")";
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    // Save support
    // Save the properties to the soup, then return the soup
    soup.SetNamedTag("industryName", industryName);
    soup.SetNamedTag("trackName", trackName);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    // Load support
    // Setup the properties from the passed in soup
    industryName = soup.GetNamedTag("industryName");
    trackName = soup.GetNamedTag("trackName");
  }

};


Drive To Trackmark
[Driver Commands]

Drive To Trackmark Command

config.txt:

﻿
username            "Drive To Trackmark"
kind              "drivercommand"
kuid              <kuid:-3:10149>
script              "DriveToTrackmarkCommand"
class             "DriveToTrackmarkCommand"
icon-texture            "drivetotrackmark.texture"
string-table {
  description         "Driver command that allows a driver character to take a train to a specific trackmark on the map."
  driver_command_trackmark      "Drive To Trackmark >"
  tt_drive_to         "Drive To "
}
kuid-table {
  command-sounds          <kuid:-3:10219>
}
supports-null-driver-character        1
username-de           "Fahre zu Gleismarkierung"
string-table-de {
  description         "Description"
  driver_command_trackmark      "Fahren Sie zum Startpunkt >"
  tt_drive_to         "Fahren Sie nach "
}
username-it           "Conduci a Trackmark"
string-table-it {
  description         "Description"
  driver_command_trackmark      "Conduci a Trackmark >"
  tt_drive_to         "Conduci a "
}
username-es           "Conducir a Marca viaria"
string-table-es {
  description         "Description"
  driver_command_trackmark      "Conducir a Marca viaria >"
  tt_drive_to         "Conducir a "
}
username-pl           "Jedź do znaku na torze"
string-table-pl {
  description         "Description"
  driver_command_trackmark      "Jedź do znaku na torze >"
  tt_drive_to         "Jedź do "
}
username-cz           "Jeď na traťovou značku"
string-table-cz {
  description         "Description"
  driver_command_trackmark      "Jeď na traťovou značku >"
  tt_drive_to         "Jeď na "
}
username-ru           "Ехать к метке"
string-table-ru {
  description         "Description"
  driver_command_trackmark      "Двигаться к >"
  tt_drive_to         "Двигаться к "
}
username-fr           "Conduire jusqu'au repère de voie"
string-table-fr {
  description         "Ordre conducteur permettant au conducteur d’emmener un train jusqu’à un repère de voie spécifique sur la carte."
  driver_command_trackmark      "Conduire jusqu'au repère de voie >"
  tt_drive_to         "Conduire jusqu'à "
}

DriveToTrackmarkCommand.gs:

//
// DriveToTrackmarkCommand.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "DriveToTrackmarkScheduleCommand.gs"

class MenuItemsCollection
{
  public Menu menuItem;
  public string key;
  public string name;
  public bool isChild;
};

//
// Driver command that allows a driver character to take a train either to a destination industry
// or a specific track in a destination industry.
//
class DriveToTrackmarkCommand isclass DriverCommand
{
  //
  // Initialize parent object and add handlers to process messages for this driver command object.
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "DriveToTrackmark", null, "DriveToTrackmark");
  }

  string GetKeyFromName(string name)
  {
    int i;
    for (i = 0; i < name.size(); i++)
    {
      if (name[i, i + 1] == "~")
      {
        string retString;
        retString = name;
        retString[i, retString.size()] = null;
        return retString;
      }
    }

    return "";
  }

  string GetNameFromKeyedName(string name)
  {
    int i;
    for (i = 0; i < name.size(); i++)
    {
      if (name[i, i + 1] == "~")
      {
        string retString;
        retString = name;
        retString[0, i+1] = null;
        return retString;
      }
    }

    return "";
  }

  //
  // Adds industry destination menu items for all industries to the given menu along with submenus of
  // destination tracks for all industries added.
  //
  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    if (driver and !driver.GetTrain())
      return;

      Menu trackmarkMenu = Constructors.NewMenu();
      TrackMark[] trackmarkList = World.GetTrackMarkList();
      StringTable strTable = GetAsset().GetStringTable();

      int i, trackmarkCount = trackmarkList.size();
      int j;

      if (!trackmarkCount)
        // we dont bother with a 'Drive To Trackmark' command if there are no trackmarks
        return;

      // Create a list of created submenu items.
      MenuItemsCollection[] createdSubMenus = new MenuItemsCollection[0];

      Menu subMenu = null;

      // If possible, organise in groups.
      for (i = 0; i < trackmarkCount; i++)
      {
        string name = "";
        string localisedName = trackmarkList[i].GetLocalisedName();

        if (localisedName != "")
          name = localisedName;

        if (name != "")
        {
          // Does this exist in a group?
          string key = GetKeyFromName(name);
          string sepName = GetNameFromKeyedName(name);
          if (key != "")
          {
            subMenu = null;
            for (j = 0; j < createdSubMenus.size(); j++)
            {
              if (key == createdSubMenus[j].key)
              {
                subMenu = createdSubMenus[j].menuItem;
                break;
              }
            }

            if (!subMenu)
            {
              // This is a new group.
              subMenu = Constructors.NewMenu();

              MenuItemsCollection mic = new MenuItemsCollection();
              mic.menuItem = subMenu;
              mic.name = sepName;
              mic.key = key;
              mic.isChild = true;
              createdSubMenus[createdSubMenus.size()] = mic;
            }

            Interface.Log("Adding group");
            subMenu.AddItem(sepName, me, "DriveToTrackmark", trackmarkList[i].GetName());
          }
          else
            trackmarkMenu.AddItem(name, me, "DriveToTrackmark", name);

        }
      }

      trackmarkMenu.SubdivideItems();

      Interface.Log("main item count = " + (string)createdSubMenus.size());
      for (j = 0; j < createdSubMenus.size(); j++)
      {
        Interface.Log("subitem count = " + (string)createdSubMenus[j].menuItem.CountItems());
        if (createdSubMenus[j].menuItem.CountItems() > 0)
        {
          if (createdSubMenus[j].isChild)
            trackmarkMenu.AddSubmenu(createdSubMenus[j].key + " >", createdSubMenus[j].menuItem);
          else
            trackmarkMenu.AddItem(createdSubMenus[j].name, me, "DriveToTrackmark", createdSubMenus[j].key);
        }
      }

      menu.AddSubmenu(strTable.GetString("driver_command_trackmark"), trackmarkMenu);

  }

  //
  // Called by either DriveTo() or DriveToTrack() to play one of 4 random driver acknowledgments.
  //
  void PlayConfirmation(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("command-sounds");
    Library libCommandSounds = World.GetLibrary(kuid);
    if (libCommandSounds)
    {
      libCommandSounds.LibraryCall("PlayConfirmation", null, null);
    }
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    DriveToTrackmarkScheduleCommand cmd = new DriveToTrackmarkScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetParent(me);
    cmd.SetProperties(soup);
    return cast<DriverScheduleCommand>cmd;
  }

  void DriveToTrackmark(Message msg)
  {
    DriverCommands commandList = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);
    string trackMarkName = msg.minor;

    TrackMark trackmark = cast<TrackMark>(Router.GetGameObject(trackMarkName));
    if (!trackmark)
      return;

    // schedule our command
    Soup soup = Constructors.NewSoup();
    soup.SetNamedTag("trackmarkName", trackmark.GetName());
    DriveToTrackmarkScheduleCommand cmd = cast<DriveToTrackmarkScheduleCommand>CreateScheduleCommand(driver, soup);
    commandList.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

};

DriveToTrackmarkScheduleCommand.gs:

//
// DriveToTrackmarkScheduleCommand.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//
include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "DriveToTrackmarkCommand.gs"
include "Schedule.gs"

//
// Driver schedule command used by DriveToTrackmarkCommand to get a driver character to take a train to
// a specific track on an industry.
//
class DriveToTrackmarkScheduleCommand isclass DriverScheduleCommand
{
  public string trackmarkName;   // Name of the industry to drive to.

  DriveToTrackmarkCommand parent;

  public void SetParent(DriveToTrackmarkCommand newParent)
  {
    parent = newParent;
  }

  //
  // Starts executing this schedule command on the given driver character.
  //
  public bool BeginExecute(DriverCharacter driver)
  {
    Train train = driver.GetTrain();
    if (!train)
      // cant drive if we dont have a train
      return false;

    TrackMark trackmark = cast<TrackMark>(Router.GetGameObject(trackmarkName));
    if (!trackmark)
      // cant drive to a trackmark which doesn't exist
      return false;

    driver.NavigateToTrackside(trackmark);

    return true;
  }

  // we should really implement EndExecute() to allow the game to determine the success of this command

  //
  // Provides an icon for this command so it can be seen on the driver's schedule.  Uses the industry
  // icon to indicate the destination.
  //
  public object GetIcon(void)
  {
    return cast<object>parent;
  }

  public string GetTooltip(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    return strTable.GetString("tt_drive_to") + trackmarkName;
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    // Save support
    // Save the properties to the soup, then return the soup
    soup.SetNamedTag("trackmarkName", trackmarkName);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    // Load support
    // Setup the properties from the passed in soup
    trackmarkName = soup.GetNamedTag("trackmarkName");
 }

};


Drive Via Trackmark
[Driver Commands]

Drive Via Trackmark Command

config.txt:

﻿
username            "Drive Via Trackmark"
kind              "drivercommand"
kuid              <kuid:-3:10209>
script              "DriveViaTrackmarkCommand"
class             "DriveViaTrackmarkCommand"
icon-texture            "driveviatrackmark.texture"
string-table {
  description         "Driver command that allows a driver character to take a train through a specific trackmark for its journey."
  driver_command_trackmark      "Drive Via Trackmark >"
  tt_drive_to         "Drive Via "
}
kuid-table {
  command-sounds          <kuid:-3:10219>
}
supports-null-driver-character        1
username-de           "Fahren über Streckenmarkierung"
string-table-de {
  description         "Description"
  driver_command_trackmark      "Fahren über Streckanmarkierung >"
  tt_drive_to         "Fahren über "
}
username-it           "Drive Via Trackmark"
string-table-it {
  description         "Description"
  driver_command_trackmark      "Drive Via Trackmark >"
  tt_drive_to         "Drive Via "
}
username-es           "Conducir mediante marcas viarias"
string-table-es {
  description         "Description"
  driver_command_trackmark      "Conducir mediante marcas viarias >"
  tt_drive_to         "Conducir mediante "
}
username-pl           "Drive Via Trackmark"
string-table-pl {
  description         "Description"
  driver_command_trackmark      "Drive Via Trackmark >"
  tt_drive_to         "Drive Via "
}
username-cz           "Jeď přes traťovou značku"
string-table-cz {
  description         "Description"
  driver_command_trackmark      "Jeď přes traťovou značku >"
  tt_drive_to         "Jeď přes "
}
username-ru           "Проехать через указатель"
string-table-ru {
  description         "Description"
  driver_command_trackmark      "Проехать через указатель >"
  tt_drive_to         "Проехать через "
}
username-fr           "Conduite via le marqueur de voie"
string-table-fr {
  description         "Rouler via le repère de voie"
  driver_command_trackmark      "Ordre conducteur permettant au conducteur de conduire un train en passant par un repère de voie spécifique."
  tt_drive_to         "Conduite via "
}

DriveViaTrackmarkCommand.gs:

//
// DriveViaTrackmarkCommand.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "DriveViaTrackmarkScheduleCommand.gs"

class MenuItemsCollection
{
  public Menu menuItem;
  public string key;
  public string name;
  public bool isChild;
};

//
// Driver command that allows a driver character to take a train either to a destination industry
// or a specific track in a destination industry.
//
class DriveViaTrackmarkCommand isclass DriverCommand
{
  //
  // Initialize parent object and add handlers to process messages for this driver command object.
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "DriveViaTrackmark", null, "DriveViaTrackmark");
  }

  string GetKeyFromName(string name)
  {
    int i;
    for (i = 0; i < name.size(); i++)
    {
      if (name[i, i + 1] == "~")
      {
        string retString;
        retString = name;
        retString[i, retString.size()] = null;
        return retString;
      }
    }

    return "";
  }

  string GetNameFromKeyedName(string name)
  {
    int i;
    for (i = 0; i < name.size(); i++)
    {
      if (name[i, i + 1] == "~")
      {
        string retString;
        retString = name;
        retString[0, i+1] = null;
        return retString;
      }
    }

    return "";
  }

  //
  // Adds industry destination menu items for all industries to the given menu along with submenus of
  // destination tracks for all industries added.
  //
  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    if (driver and !driver.GetTrain())
      return;

      Menu trackmarkMenu = Constructors.NewMenu();
      TrackMark[] trackmarkList = World.GetTrackMarkList();
      StringTable strTable = GetAsset().GetStringTable();

      int i, trackmarkCount = trackmarkList.size();
      int j;

      if (!trackmarkCount)
        // we dont bother with a 'Drive To Trackmark' command if there are no trackmarks
        return;

      // Create a list of created submenu items.
      MenuItemsCollection[] createdSubMenus = new MenuItemsCollection[0];

      Menu subMenu = null;

      // If possible, organise in groups.
      for (i = 0; i < trackmarkCount; i++)
      {
        string name = "";
        string localisedName = trackmarkList[i].GetLocalisedName();

        if (localisedName != "")
          name = localisedName;

        if (name != "")
        {
          // Does this exist in a group?
          string key = GetKeyFromName(name);
          string sepName = GetNameFromKeyedName(name);
          if (key != "")
          {
            subMenu = null;
            for (j = 0; j < createdSubMenus.size(); j++)
            {
              if (key == createdSubMenus[j].key)
              {
                subMenu = createdSubMenus[j].menuItem;
                break;
              }
            }

            if (!subMenu)
            {
              // This is a new group.
              subMenu = Constructors.NewMenu();

              MenuItemsCollection mic = new MenuItemsCollection();
              mic.menuItem = subMenu;
              mic.name = sepName;
              mic.key = key;
              mic.isChild = true;
              createdSubMenus[createdSubMenus.size()] = mic;
            }

            Interface.Log("Adding group");
            subMenu.AddItem(sepName, me, "DriveViaTrackmark", trackmarkList[i].GetName());
          }
          else
            trackmarkMenu.AddItem(name, me, "DriveViaTrackmark", name);

        }
      }

      trackmarkMenu.SubdivideItems();

      Interface.Log("main item count = " + (string)createdSubMenus.size());
      for (j = 0; j < createdSubMenus.size(); j++)
      {
        Interface.Log("subitem count = " + (string)createdSubMenus[j].menuItem.CountItems());
        if (createdSubMenus[j].menuItem.CountItems() > 0)
        {
          if (createdSubMenus[j].isChild)
            trackmarkMenu.AddSubmenu(createdSubMenus[j].key + " >", createdSubMenus[j].menuItem);
          else
            trackmarkMenu.AddItem(createdSubMenus[j].name, me, "DriveViaTrackmark", createdSubMenus[j].key);
        }
      }

      menu.AddSubmenu(strTable.GetString("driver_command_trackmark"), trackmarkMenu);

  }

  //
  // Called by either DriveVia() or DriveViaTrack() to play one of 4 random driver acknowledgments.
  //
  void PlayConfirmation(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("command-sounds");
    Library libCommandSounds = World.GetLibrary(kuid);
    if (libCommandSounds)
    {
      libCommandSounds.LibraryCall("PlayConfirmation", null, null);
    }
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    DriveViaTrackmarkScheduleCommand cmd = new DriveViaTrackmarkScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetParent(me);
    cmd.SetProperties(soup);
    return cast<DriverScheduleCommand>cmd;
  }

  void DriveViaTrackmark(Message msg)
  {
    DriverCommands commandList = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);
    string trackMarkName = msg.minor;

    TrackMark trackmark = cast<TrackMark>(Router.GetGameObject(trackMarkName));
    if (!trackmark)
      return;

    // schedule our command
    Soup soup = Constructors.NewSoup();
    soup.SetNamedTag("trackmarkName", trackmark.GetName());
    DriveViaTrackmarkScheduleCommand cmd = cast<DriveViaTrackmarkScheduleCommand>CreateScheduleCommand(driver, soup);
    commandList.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

};

DriveViaTrackmarkScheduleCommand.gs:

//
// DriveViaTrackmarkScheduleCommand.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//
include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "DriveViaTrackmarkCommand.gs"
include "Schedule.gs"

//
// Driver schedule command used by DriveViaTrackmarkCommand to get a driver character to take a train to
// a specific track on an industry.
//
class DriveViaTrackmarkScheduleCommand isclass DriverScheduleCommand
{
  public string trackmarkName;   // Name of the industry to drive to.

  DriveViaTrackmarkCommand parent;

  public void SetParent(DriveViaTrackmarkCommand newParent)
  {
    parent = newParent;
  }

  //
  // Starts executing this schedule command on the given driver character.
  //
  public bool BeginExecute(DriverCharacter driver)
  {
    Train train = driver.GetTrain();
    if (!train)
      // cant drive if we dont have a train
      return false;

    TrackMark trackmark = cast<TrackMark>(Router.GetGameObject(trackmarkName));
    if (!trackmark)
      // cant drive to a trackmark which doesn't exist
      return false;

    driver.NavigateThroughTrackside(trackmark);

    return true;
  }

  // we should really implement EndExecute() to allow the game to determine the success of this command

  //
  // Provides an icon for this command so it can be seen on the driver's schedule.  Uses the industry
  // icon to indicate the destination.
  //
  public object GetIcon(void)
  {
    return cast<object>parent;
  }

  public string GetTooltip(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    return strTable.GetString("tt_drive_to") + trackmarkName;
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    // Save support
    // Save the properties to the soup, then return the soup
    soup.SetNamedTag("trackmarkName", trackmarkName);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    // Load support
    // Setup the properties from the passed in soup
    trackmarkName = soup.GetNamedTag("trackmarkName");
 }

};


Load Product
[Driver Commands]

Load Product Command

config.txt:

﻿
username            "Load"
kind              "drivercommand"
kuid              <kuid:-3:10076>
script              "LoadCommand"
class             "LoadCommand"
icon-texture            "load.texture"
string-table {
  description         "Loads the train's vehicles at the industry the driver is currently at with the train."
  msg_error_industry_not_found      "Issue a 'Drive To' command prior to the 'Load' command."
  driver_command_load       "Load"
  tt_load_at          "Load at "
}
kuid-table {
  command-sounds          <kuid:-3:10219>
}
supports-null-driver-character        1
username-de           "Beladen"
string-table-de {
  description         "Description"
  msg_error_industry_not_found      "Erteilen Sie einen 'Fahre zu'-Befehl, vor dem 'Beladen'-Befehl."
  driver_command_load       "Laden"
  tt_load_at          "Laden Sie am "
}
username-it           "Carica"
string-table-it {
  description         "Description"
  msg_error_industry_not_found      "Nessuna industria trovata."
  driver_command_load       "Carica"
  tt_load_at          "Carica a "
}
username-es           "Cargar"
string-table-es {
  description         "Description"
  msg_error_industry_not_found      "Da una orden de 'Conducir a' antes de la orden 'Cargar'."
  driver_command_load       "Cargar"
  tt_load_at          "Cargar en "
}
username-pl           "Załaduj"
string-table-pl {
  description         "Description"
  msg_error_industry_not_found      "Ostatnio nie odwiedzano zakładów przemysłowych."
  driver_command_load       "Załaduj"
  tt_load_at          "Miejsce załadunku "
}
username-cz           "Nalož"
string-table-cz {
  description         "Description"
  msg_error_industry_not_found      "Příkazu 'Nalož' musí předcházet příkaz 'Jeď do'."
  driver_command_load       "Nalož"
  tt_load_at          "Nalož v "
}
username-ru           "Загрузка"
string-table-ru {
  description         "Description"
  msg_error_industry_not_found      "Нет последнего посещенного предприятия."
  driver_command_load       "Погрузка"
  tt_load_at          "Погрузить у "
}
username-fr           "Charger"
string-table-fr {
  description         "Charge les véhicules du train à l’usine dans laquelle se trouve le conducteur."
  msg_error_industry_not_found      "Il est nécessaire de donner un ordre 'Aller jusqu'à' avant celui de 'Charger'."
  driver_command_load       "Charger"
  tt_load_at          "Charger à"
}

LoadCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"

include "LoadScheduleCommand.gs"

//
// LoadCommand
//
// Basic "load" command functionality.
//

class LoadCommand isclass DriverCommand
{
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "LoadProduct", null, "Load");
  }

  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (!driver or driver.GetTrain())
      menu.AddItem(strTable.GetString("driver_command_load"), me, "LoadProduct", "Load");
  }

  void PlayConfirmation(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("command-sounds");
    Library libCommandSounds = World.GetLibrary(kuid);
    if (libCommandSounds)
    {
      libCommandSounds.LibraryCall("PlayConfirmation", null, null);
    }
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    LoadScheduleCommand cmd = new LoadScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetParent(me);
    cmd.SetProperties(soup);
    return cast<DriverScheduleCommand>cmd;
  }

  void Load(Message msg)
  {
    DriverCommands commands = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);

    // schedule our command
    Soup soup = Constructors.NewSoup();
    LoadScheduleCommand cmd = cast<LoadScheduleCommand>CreateScheduleCommand(driver, soup);
    commands.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

};

LoadScheduleCommand.gs:

 include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "LoadCommand.gs"
include "Schedule.gs"

class LoadCustomCommand isclass CustomCommand
{
  public Industry industry;
  public DriverCharacter driver;

  //
  // 1. 'me' is this CustomCommand
  // 2. The thread is running on the Train GameObject,
  //    therefore all wait() calls, etc receive messages through the Train GameObject.
  // 3. 'Sniff()' works on the GameObject upon which it is called, which is not necessarily
  //    the same GameObject as the one upon which the current thread is running.
  //
  // This means that when we want to receive a message, it must go to the Train.
  // Any messages we want to send may as well come from the Train as well, but the DriverCharacter is also a GameObject.
  // And any Sniff() calls we make will want to be made on the Train.
  //
  public void HandleLoadCommand(Train train)
  {
    Vehicle[] vehicles = train.GetVehicles();
    int i;

    // Now begin the checking to see if we are still at an industry.
    for(i = 0; i < vehicles.size(); ++i)
    {
      train.Sniff(vehicles[i], "SceneryTrigger", null, true);
      industry.ReEnter(vehicles[i].GetId());
    }

    // in case there are none:
    train.PostMessage(train, "Trigger", "Not-inside", 1.0);

    // Will stop load command if we are not in an industry, otherwise will allow to pass through
    Message msg;
    bool inScenery = false;
    wait()
    {
      on "SceneryTrigger", "Enter", msg:
      {
        // wrong industry?
        if (msg.src == industry)
        {
          inScenery = true;
          break;
        }
        continue;
      }
      on "Trigger", "Not-inside":
      {
        // no longer inside
        inScenery = false;
        break;
      }
    }

    if (inScenery)
    {
      industry.HandleTrain(train, Industry.LOAD_COMMAND);
    }

    for(i = 0; i < vehicles.size(); ++i)
      train.Sniff(vehicles[i], "SceneryTrigger", null, false);
  }

  //
  public bool Execute(Train train, int px, int py, int pz)
  {
    train.SetAutopilotMode(Train.CONTROL_AUTOPILOT);
    // Tell the industry to handle our command
    HandleLoadCommand(train);

    return true;
  }
};

class LoadScheduleCommand isclass DriverScheduleCommand
{
  public string industryName;

  LoadCommand parent;

  public void SetParent(LoadCommand newParent)
  {
    parent = newParent;
  }

  public bool BeginExecute(DriverCharacter driver)
  {
    StringTable strTable = parent.GetAsset().GetStringTable();
    Train train = driver.GetTrain();
    if (!train)
      // cant drive if we dont have a train
      return false;

    Industry industry = train.GetLastVisitedIndustry();
    if (!industry)
    {
      // Do we have the industry name stored?
      industry = cast<Industry>(Router.GetGameObject(industryName));
      if (!industry)
      {
        Interface.Print(strTable.GetString("msg_error_industry_not_found"));
        return false;
      }
    }

    industryName = industry.GetName();

    LoadCustomCommand command = new LoadCustomCommand();
    //command.parent = parent;
    command.driver = driver;
    command.industry = industry;

      // get the driver executing this command
    driver.DriverCustomCommand(command);
    driver.DriverIssueSchedule();

    return true;
  }

  // we should really implement EndExecute() to allow the game to determine the success of this command

  public object GetIcon(void)
  {
    return cast<object>parent;
  }

  public string GetTooltip(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string retString;
    if (industryName.size())
      retString = strTable.GetString("tt_load_at") + industryName;
    else
      retString = strTable.GetString("driver_command_load");

    return retString;
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    // Save support
    // Save the properties to the soup, then return the soup
    soup.SetNamedTag("industryName", industryName);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    // Load support
    // Setup the properties from the passed in soup
    industryName = soup.GetNamedTag("industryName");
  }
};


Notify
[Driver Commands]

Notify Command

config.txt:

﻿
username            "Notify"
kind              "drivercommand"
kuid              <kuid:-3:10078>
script              "NotifyCommand"
class             "NotifyCommand"
icon-texture            "notify.texture"
string-table {
  description         "Provides notification of all previous driver tasks being completed through a played audio file."
  driver_command_notify       "Notify"
  handle_command_interface_msg      ": All previous tasks are complete."
}
kuid-table {
  command-sounds          <kuid:-3:10219>
}
supports-null-driver-character        1
username-de           "Benachrichtigen"
string-table-de {
  description         "Description"
  driver_command_notify       "Melden Sie"
  handle_command_interface_msg      ": Alle vorangegangenen Aufgaben wurden ausgeführt."
}
username-it           "Notifica"
string-table-it {
  description         "Description"
  driver_command_notify       "Notifica"
  handle_command_interface_msg      ": Tutti i precedenti compiti sono stati completati."
}
username-es           "Notificar"
string-table-es {
  description         "Description"
  driver_command_notify       "Notificar"
  handle_command_interface_msg      ": Todas la tareas anteriores están completas."
}
username-pl           "Powiadom"
string-table-pl {
  description         "Description"
  driver_command_notify       "Powiadom"
  handle_command_interface_msg      ": Wszystkie poprzednie zadania zostały wykonane."
}
username-cz           "Upozorni"
string-table-cz {
  description         "Description"
  driver_command_notify       "Upozorni"
  handle_command_interface_msg      ": po dokončení všech předchozích příkazů."
}
username-ru           "Уведомление"
string-table-ru {
  description         "Description"
  driver_command_notify       "Уведомление"
  handle_command_interface_msg      ": Все распоряжения выполнены."
}
username-fr           "Avertir"
string-table-fr {
  description         "Avertit de tous les ordres conducteurs accomplis par le biais d’un fichier audio."
  driver_command_notify       "Avertir"
  handle_command_interface_msg      ": Toutes les taches précédentes sont terminées."
}

NotifyCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"

include "NotifyScheduleCommand.gs"

//
// LoadCOmmand
//
// Basic "load" command functionality.
//

class NotifyCommand isclass DriverCommand
{
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "NotifyItem", null, "Notify");
  }

  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    Menu itemMenu = Constructors.NewMenu();
    StringTable strTable = GetAsset().GetStringTable();

    menu.AddItem(strTable.GetString("driver_command_notify"), me, "NotifyItem", "Notify");
  }

  void PlayConfirmation(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("command-sounds");
    Library libCommandSounds = World.GetLibrary(kuid);
    if (libCommandSounds)
    {
      libCommandSounds.LibraryCall("PlayConfirmation", null, null);
    }
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    NotifyScheduleCommand cmd = new NotifyScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetParent(me);
    cmd.SetProperties(soup);
    return cast<DriverScheduleCommand>cmd;
  }

  void Notify(Message msg)
  {
    DriverCommands commands = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);
    string vehicleName = msg.minor;

      // schedule our command
    Soup soup = Constructors.NewSoup();
    soup.SetNamedTag("vehicleName", vehicleName);
    NotifyScheduleCommand cmd = cast<NotifyScheduleCommand>CreateScheduleCommand(driver, soup);
    commands.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

};

NotifyScheduleCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "NotifyCommand.gs"
include "Schedule.gs"

class NotifyCustomCommand isclass CustomCommand
{
  public Vehicle vehicle;
  public DriverCharacter driver;
  public Asset asset;

    //
    // 1. 'me' is this CustomCommand
    // 2. The thread is running on the Train GameObject,
    //    therefore all wait() calls, etc receive messages through the Train GameObject.
    // 3. 'Sniff()' works on the GameObject upon which it is called, which is not necessarily
    //    the same GameObject as the one upon which the current thread is running.
    //
    // This means that when we want to receive a message, it must go to the Train.
    // Any messages we want to send may as well come from the Train as well, but the DriverCharacter is also a GameObject.
    // And any Sniff() calls we make will want to be made on the Train.
    //
  public void HandleNotifyCommand(Train train)
  {
    StringTable strTable = asset.GetStringTable();
    string driverName = driver.GetLocalisedName();
    Interface.Print(driverName + strTable.GetString("handle_command_interface_msg"));
  }

  public bool Execute(Train train, int px, int py, int pz)
  {
    //train.SetAutopilotMode(Train.CONTROL_AUTOPILOT);
    // Tell the industry to handle our command
    HandleNotifyCommand(train);

    return true;
  }
};

class NotifyScheduleCommand isclass DriverScheduleCommand
{
  public string vehicleName;
  public string trackName;      // can be empty/null

  NotifyCommand parent;

  public void SetParent(NotifyCommand newParent)
  {
    parent = newParent;
  }

  public bool BeginExecute(DriverCharacter driver)
  {
    Train train = driver.GetTrain();
    if (!train)
        // cant Notify if we dont have a train
      return false;

    NotifyCustomCommand command = new NotifyCustomCommand();
    command.driver = driver;
    command.vehicle = cast<Vehicle>(Router.GetGameObject(vehicleName));
    command.asset = parent.GetAsset();

      // get the driver executing this command
    driver.DriverCustomCommand(command);
    driver.DriverIssueSchedule();

    return true;
  }

  // we should really implement EndExecute() to allow the game to determine the success of this command

  public object GetIcon(void)
  {
    return cast<object>parent;
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    // Save support
    // Save the properties to the soup, then return the soup
    soup.SetNamedTag("vehicleName", vehicleName);
    //soup.SetNamedTag("trackName", trackName);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    // Load support
    // Setup the properties from the passed in soup
    vehicleName = soup.GetNamedTag("vehicleName");
    //trackName = soup.GetNamedTag("trackName");
  }
};


Run Around
[Driver Commands]

Run Around Command

config.txt:

﻿
username            "Run Around"
kind              "drivercommand"
kuid              <kuid:-3:10083>
script              "RunaroundCommand"
class             "RunaroundCommand"
icon-texture            "runaround.texture"
string-table {
  description         "Instructs the driver to uncouple his locomotive from and run-around it to recouple up to the other end of the train."
  driver_command_runaround      "Run Around Train"
  tt_runaround          "Run Around Train"
  interface_handle_command0     "Can't runaround- The driver is not in a train"
  interface_handle_command1     "Can't runaround- The driver is not in a vehicle"
  interface_handle_command2     "Can't runaround- No rollingstock in train"
  interface_handle_command3     "Can't runaround- The driver's locomotive is in the middle of the train"
}
kuid-table {
  command-sounds          <kuid:-3:10219>
}
supports-null-driver-character        1
username-de           "Zug wenden"
string-table-de {
  description         "Description"
  driver_command_runaround      "Zug wenden"
  tt_runaround          "Zug wenden"
  interface_handle_command0     "Kann Zug nicht wenden - Der Fahrer befindet sich nicht in einem Zug"
  interface_handle_command1     "Kann Zug nicht wenden- Der Fahrer befindet sich nicht in einem Fahrzeug"
  interface_handle_command2     "Kann Zug nicht wenden – Kein rollendes Material im Zug"
  interface_handle_command3     "Kann Zug nicht wenden – Die Lokomotive des Fahrers befindet sich in der Mitte des Zugs"
}
username-it           "Run Around"
string-table-it {
  description         "Description"
  driver_command_runaround      "Run Around Train"
  tt_runaround          "Run Around Train"
  interface_handle_command0     "Can't runaround- The driver is not in a train"
  interface_handle_command1     "Can't runaround- The driver is not in a vehicle"
  interface_handle_command2     "Can't runaround- No rollingstock in train"
  interface_handle_command3     "Can't runaround- The driver's locomotive is in the middle of the train"
}
username-es           "Maniobra de cambio de sentido"
string-table-es {
  description         "Description"
  driver_command_runaround      "Dar la vuelta al tren"
  tt_runaround          "Dar la vuelta al tren"
  interface_handle_command0     "No se puede dar la vuelta: el maquinista no está en el tren"
  interface_handle_command1     "No se puede dar la vuelta: el maquinista no está en un vehículo"
  interface_handle_command2     "No se puede dar la vuelta: en el tren no hay material rodante"
  interface_handle_command3     "No se puede dar la vuelta: la locomotora del maquinista está en medio de la composición"
}
username-pl           "Run Around"
string-table-pl {
  description         "Description"
  driver_command_runaround      "Run Around Train"
  tt_runaround          "Run Around Train"
  interface_handle_command0     "Can't runaround- The driver is not in a train"
  interface_handle_command1     "Can't runaround- The driver is not in a vehicle"
  interface_handle_command2     "Can't runaround- No rollingstock in train"
  interface_handle_command3     "Can't runaround- The driver's locomotive is in the middle of the train"
}
username-cz           "Přepřažení lokomotivy"
string-table-cz {
  description         "Description"
  driver_command_runaround      "Přepřažení lokomotivy"
  tt_runaround          "Přepřažení lokomotivy na druhý konec vlaku"
  interface_handle_command0     "Příkaz nelze provést - Strojvůdce se nenachází ve vlaku"
  interface_handle_command1     "Příkaz nelze provést - Strojvůdce se nenachází v lokomotivě"
  interface_handle_command2     "Příkaz nelze provést - Součástí vlaku nejsou žádné vagóny"
  interface_handle_command3     "Příkaz nelze provést - Lokomotiva se strojvůdcem se nachází uprostřed vlaku"
}
username-ru           "Разворот"
string-table-ru {
  description         "Description"
  driver_command_runaround      "Развернуть поезд"
  tt_runaround          "Развернуть состав"
  interface_handle_command0     "Ошибка- машинист не в составе"
  interface_handle_command1     "Ошибка- машинист не в машине"
  interface_handle_command2     "Ошибка- нет локомотива в составе"
  interface_handle_command3     "Ошибка- Локомотив машиниста в середине состава"
}
username-fr           "Demi-tour automatique"
string-table-fr {
  description         "Donne l’ordre au conducteur de dételer sa locomotive et de la retourner pour la réatteler à l’autre bout du train."
  driver_command_runaround      "Demi-tour automatique du train"
  tt_runaround          "Demi-tour automatique du train"
  interface_handle_command0     "Demi-tour impossible – le conducteur n'est pas dans un train"
  interface_handle_command1     "Demi-tour impossible - le conducteur n'est pas dans un véhicule"
  interface_handle_command2     "Demi-tour impossible – aucun matériel roulant à bord du train"
  interface_handle_command3     "Demi-tour impossible – la locomotive du conducteur est située au milieu du train"
}

RunaroundCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"

include "RunaroundScheduleCommand.gs"

//
// RunaroundCommand
//

class RunaroundCommand isclass DriverCommand
{
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "RunaroundItem", null, "Runaround");
  }

  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    //Menu itemMenu = Constructors.NewMenu();
    //Train train = driver.GetTrain();
    StringTable strTable = GetAsset().GetStringTable();

    menu.AddItem(strTable.GetString("driver_command_runaround"), me, "RunaroundItem", "");
  }

  void PlayConfirmation(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("command-sounds");
    Library libCommandSounds = World.GetLibrary(kuid);
    if (libCommandSounds)
    {
      libCommandSounds.LibraryCall("PlayConfirmation", null, null);
    }
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    RunaroundScheduleCommand cmd = new RunaroundScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetProperties(soup);
    cmd.SetParent(me);
    return cast<DriverScheduleCommand>cmd;
  }

  void Runaround(Message msg)
  {
    DriverCommands commands = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);
    //string vehicleName = msg.minor;

      // schedule our command
    Soup soup = Constructors.NewSoup();
    //soup.SetNamedTag("vehicleName", vehicleName);
    RunaroundScheduleCommand cmd = cast<RunaroundScheduleCommand>CreateScheduleCommand(driver, soup);
    commands.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

};

RunaroundScheduleCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "RunaroundCommand.gs"
include "Schedule.gs"
include "Flags.gs"

static class RunaroundUtil
{
  public define int NONE = 0;
  public define int FRONT = 1;
  public define int BACK = 2;

  public bool IsPartOfLocomotive(Vehicle vehicle)
  {
    return Flags.TestAny(vehicle.GetVehicleTypeFlags(), Vehicle.TYPE_LOCOMOTIVE | Vehicle.TYPE_TENDER);
  }

    // returns which end of the train is being decoupled
  public int DetermineDecoupleEnd(Vehicle vehicle)
  {
    int i;
    Vehicle[] vehicles = vehicle.GetMyTrain().GetVehicles();
    if (vehicles.size() < 2)
      return NONE;

    if (vehicles[0] == vehicle)
      return FRONT;

    if (vehicles[vehicles.size()-1] == vehicle)
      return BACK;

    int vehicleIndex = -1;
    for (i = 0; i < vehicles.size(); i++)
      if (vehicles[i] == vehicle)
      {
        vehicleIndex = i;
        break;
      }

    if (vehicleIndex == -1)
      return NONE;

    int forwardIndex = vehicleIndex;

    while (forwardIndex > 0  and  IsPartOfLocomotive(vehicles[forwardIndex-1]))
      forwardIndex--;
    if (forwardIndex == 0)
      return FRONT;

    int backwardIndex = vehicleIndex;

    while (backwardIndex < vehicles.size()-1  and  IsPartOfLocomotive(vehicles[backwardIndex+1]))
      backwardIndex++;
    if (backwardIndex == vehicles.size()-1)
      return BACK;

    return NONE;
  }
};

class RunaroundCustomCommand isclass CustomCommand
{
  public Vehicle vehicle;
  public DriverCharacter driver;

  public void HandleDecouple(Train train)
  {
    //
    // Stop the Train
    //
    train.SetAutopilotMode(Train.CONTROL_SCRIPT);
    train.SetDCCThrottle(0.0);

    if (!train.IsStopped())
    {
      Message msg;
      wait()
      {
        on "Train", "StoppedMoving", msg:
        {
          break;
        }
        continue;
      }
    }

    //
    // Decouple
    //

    Vehicle[] vehicles = train.GetVehicles();

    if (vehicles.size() < 2)
      return;

    int decoupleEnd = RunaroundUtil.DetermineDecoupleEnd(vehicle);

    train.SetHandBrake(true);

    if (decoupleEnd == RunaroundUtil.FRONT)
    {
      //
      // uncouple front
      //
      int index = 0;

      while ((index < vehicles.size() - 2)  and  RunaroundUtil.IsPartOfLocomotive(vehicles[index+1]))
        index++;

      if (vehicles[index].GetDirectionRelativeToTrain())
        vehicles[index].Uncouple(Vehicle.COUPLE_BACK);
      else
        vehicles[index].Uncouple(Vehicle.COUPLE_FRONT);
    }
    else if (decoupleEnd == RunaroundUtil.BACK)
    {
      //
      // uncouple back
      //
      int index = vehicles.size() - 1;

      while ((index > 1)  and  RunaroundUtil.IsPartOfLocomotive(vehicles[index-1]))
        index--;

      if (vehicles[index].GetDirectionRelativeToTrain())
        vehicles[index].Uncouple(Vehicle.COUPLE_FRONT);
      else
        vehicles[index].Uncouple(Vehicle.COUPLE_BACK);
    }

    //vehicle.Uncouple(Vehicle.COUPLE_BACK);
    //vehicle.Uncouple(Vehicle.COUPLE_FRONT);
  }

  public bool Execute(Train train, int px, int py, int pz)
  {
    // Tell the industry to handle our command
    HandleDecouple(train);

    return true;
  }
};

class RunaroundScheduleCommand isclass DriverScheduleCommand
{
  //public string vehicleName;

  RunaroundCommand parent;

  int state = 0;
  Vehicle navigateToVehicle;
  bool navigateToDirection;

  public void SetParent(RunaroundCommand newParent)
  {
    parent = newParent;
  }

  bool HandleCommand(DriverCharacter driver)
  {
    Interface.Log("RunaroundScheduleCommand.HandleCommand> state = " + state);

    StringTable strTable = GetAsset().GetStringTable();

    Train train = driver.GetTrain();
    if (!train)
    {
        // cant runaround if we dont have a train
      Interface.Print(strTable.GetString("interface_handle_command0"));
      return false;
    }

    Vehicle driverVehicle = cast<Vehicle> driver.GetLocation();
    if (!driverVehicle)
    {
        // cant runaround if we dont have a vehicle (should never happen)
      Interface.Print(strTable.GetString("interface_handle_command1"));
      return false;
    }

    if (state == 0)
    {
      Vehicle[] vehicles = train.GetVehicles();

      if (vehicles.size() < 2)
      {
        Interface.Print(strTable.GetString("interface_handle_command2"));
        return false;
      }

      int decoupleEnd = RunaroundUtil.DetermineDecoupleEnd(driverVehicle);

      if (decoupleEnd == RunaroundUtil.FRONT)
      {
        // runaround to back
        navigateToVehicle = vehicles[vehicles.size() - 1];
        navigateToDirection = !navigateToVehicle.GetDirectionRelativeToTrain();
      }
      else if (decoupleEnd == RunaroundUtil.BACK)
      {
        // runaround to front
        navigateToVehicle = vehicles[0];
        navigateToDirection = navigateToVehicle.GetDirectionRelativeToTrain();
      }
      else
      {
        Interface.Print(strTable.GetString("interface_handle_command3"));
        return false;
      }

      state = 1;
    }

    if (state == 1)
    {
      //Interface.Print("performing decouple");

      RunaroundCustomCommand command = new RunaroundCustomCommand();
      command.driver = driver;
      command.vehicle = driverVehicle;

      driver.DriverBeginIssueSchedule();
      driver.DriverCustomCommand(command);
      driver.DriverIssueSchedule();
      return true;
    }

    if (state == 2)
    {
      //Interface.Print("performing navigate-to-vehicle " + navigateToVehicle.GetLocalisedName());
      return driver.NavigateToVehicle(navigateToVehicle, navigateToDirection);
    }

    return false;
  }

  public bool BeginExecute(DriverCharacter driver)
  {
    Interface.Log("RunaroundScheduleCommand.BeginExecute> state = " + state);
    return HandleCommand(driver);
  }

  bool UpdateExecute(DriverCharacter driver)
  {
    state++;
    Interface.Log("RunaroundScheduleCommand.UpdateExecute> state = " + (state-1) + " -> " + state);

    return HandleCommand(driver);
  }

  bool FailExecute(DriverCharacter driver)
  {
    Interface.Log("RunaroundScheduleCommand.FailExecute> state = " + (state-1) + " -> " + state);

    return HandleCommand(driver);
  }

  public bool EndExecute(DriverCharacter driver)
  {
    bool okay = (state >= 3);

    Interface.Log("RunaroundScheduleCommand.EndExecute> state = " + state + " -> 0, okay = " + okay);

      // reset command
    state = 0;
    navigateToVehicle = null;
    return okay;
  }

  public object GetIcon(void)
  {
    return cast<object>parent;
  }

  public string GetTooltip(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    return strTable.GetString("tt_runaround");
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    // Save support
    // Save the properties to the soup, then return the soup

    if (navigateToVehicle)
    {
      soup.SetNamedTag("RunAroundScheduleCommand.navigateToVehicle", navigateToVehicle.GetName());
      soup.SetNamedTag("RunAroundScheduleCommand.navigateToDirection", navigateToDirection);
    }

    soup.SetNamedTag("RunAroundScheduleCommand.state", state);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    // Load support
    // Setup the properties from the passed in soup
    string vehicleName = soup.GetNamedTag("RunAroundScheduleCommand.navigateToVehicle");
    state = soup.GetNamedTagAsInt("RunAroundScheduleCommand.state");

    if (vehicleName != "")
    {
      navigateToVehicle = cast<Vehicle> Router.GetGameObject(vehicleName);
      if (!navigateToVehicle)
        Interface.Exception("RunaroundScheduleCommands.SetProperties> unknown vehicle '" + vehicleName + "'");

      navigateToDirection = soup.GetNamedTagAsBool("RunAroundScheduleCommand.navigateToDirection");
    }
  }
};


Unload Product
[Driver Commands]

Unload Product Command

config.txt:

﻿
username            "Unload"
kind              "drivercommand"
kuid              <kuid:-3:10077>
script              "UnLoadCommand"
class             "UnLoadCommand"
icon-texture            "unload.texture"
string-table {
  description         "Unload train vehicles at current industry location."
  msg_error_industry_not_found      "Issue a 'Drive To' command prior to the 'Unload' command."
  driver_command_unload       "Unload"
  tt_unload_at          "Unload at "
}
kuid-table {
  command-sounds          <kuid:-3:10219>
}
supports-null-driver-character        1
username-de           "Abladen"
string-table-de {
  description         "Description"
  msg_error_industry_not_found      "Erteilen Sie einen 'Fahre zu'-Befehl, vor dem 'Beladen'-Befehl."
  driver_command_unload       "Abladen"
  tt_unload_at          "Abladen an "
}
username-it           "NonCaricato"
string-table-it {
  description         "Description"
  msg_error_industry_not_found      "Nessuna industria trovata."
  driver_command_unload       "Scarica"
  tt_unload_at          "Scarica a "
}
username-es           "Descargar"
string-table-es {
  description         "Description"
  msg_error_industry_not_found      "Da una orden de 'Conducir a' antes de la orden 'Descargar'."
  driver_command_unload       "Descargar"
  tt_unload_at          "Descargar en "
}
username-pl           "Rozładuj"
string-table-pl {
  description         "Description"
  msg_error_industry_not_found      "Ostatnio nie odwiedzano zakładów przemysłowych."
  driver_command_unload       "Rozładuj"
  tt_unload_at          "Miejsce rozładunku: "
}
username-cz           "Vylož"
string-table-cz {
  description         "Description"
  msg_error_industry_not_found      "Tomuto příkazu musí předcházet příkaz 'Jeď do'."
  driver_command_unload       "Vylož"
  tt_unload_at          "Vylož v "
}
username-ru           "Выгрузка"
string-table-ru {
  description         "Description"
  msg_error_industry_not_found      "Нет последнего посещенного предприятия."
  driver_command_unload       "Выгрузка"
  tt_unload_at          "Выгрузить в "
}
username-fr           "Décharger"
string-table-fr {
  description         "Décharger les wagons à l’usine où se trouve le train."
  msg_error_industry_not_found      "Il est nécessaire de donner un ordre "
  aller           "jusqu'à' avant celui de 'Décharger'.'"
  driver_command_unload       "Décharger"
  tt_unload_at          "Décharger à "
}

UnLoadCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"

include "UnLoadScheduleCommand.gs"

//
// LoadCommand
//
// Basic "load" command functionality.
//

class UnLoadCommand isclass DriverCommand
{
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "UnloadProduct", null, "Unload");
  }

  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (!driver or driver.GetTrain())
      menu.AddItem(strTable.GetString("driver_command_unload"), me, "UnloadProduct", "Unload");
  }

  void PlayConfirmation(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("command-sounds");
    Library libCommandSounds = World.GetLibrary(kuid);
    if (libCommandSounds)
    {
      libCommandSounds.LibraryCall("PlayConfirmation", null, null);
    }
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    UnLoadScheduleCommand cmd = new UnLoadScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetParent(me);
    cmd.SetProperties(soup);
    return cast<DriverScheduleCommand>cmd;
  }

  void Unload(Message msg)
  {
    DriverCommands commands = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);

    // schedule our command
    Soup soup = Constructors.NewSoup();
    UnLoadScheduleCommand cmd = cast<UnLoadScheduleCommand>CreateScheduleCommand(driver, soup);
    commands.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

};

UnLoadScheduleCommand.gs:

 include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "UnLoadCommand.gs"
include "Schedule.gs"

class UnLoadCustomCommand isclass CustomCommand
{
  public Industry industry;
  public DriverCharacter driver;

  //
  // 1. 'me' is this CustomCommand
  // 2. The thread is running on the Train GameObject,
  //    therefore all wait() calls, etc receive messages through the Train GameObject.
  // 3. 'Sniff()' works on the GameObject upon which it is called, which is not necessarily
  //    the same GameObject as the one upon which the current thread is running.
  //
  // This means that when we want to receive a message, it must go to the Train.
  // Any messages we want to send may as well come from the Train as well, but the DriverCharacter is also a GameObject.
  // And any Sniff() calls we make will want to be made on the Train.
  //
  public void HandleUnLoadCommand(Train train)
  {
    Vehicle[] vehicles = train.GetVehicles();
    int i;

    // Now begin the checking to see if we are still at an industry.
    for(i = 0; i < vehicles.size(); ++i)
    {
      train.Sniff(vehicles[i], "SceneryTrigger", null, true);
      industry.ReEnter(vehicles[i].GetId());
    }

    // in case there are none:
    train.PostMessage(train, "Trigger", "Not-inside", 1.0);

    // Will stop load command if we are not in an industry, otherwise will allow to pass through
    Message msg;
    bool inScenery = false;
    wait()
    {
      on "SceneryTrigger", "Enter", msg:
      {
        // wrong industry?
        if (msg.src == industry)
        {
          inScenery = true;
          break;
        }
        continue;
      }
      on "Trigger", "Not-inside":
      {
        // no longer inside
        inScenery = false;
        break;
      }
    }

    if (inScenery)
    {
      industry.HandleTrain(train, Industry.UNLOAD_COMMAND);
    }

    for(i = 0; i < vehicles.size(); ++i)
      train.Sniff(vehicles[i], "SceneryTrigger", null, false);
  }

  public bool Execute(Train train, int px, int py, int pz)
  {
    train.SetAutopilotMode(Train.CONTROL_AUTOPILOT);
    // Tell the industry to handle our command
    HandleUnLoadCommand(train);

    return true;
  }
};

class UnLoadScheduleCommand isclass DriverScheduleCommand
{
  public string industryName;

  UnLoadCommand parent;

  public void SetParent(UnLoadCommand newParent)
  {
    parent = newParent;
  }

  public bool BeginExecute(DriverCharacter driver)
  {
    StringTable strTable = parent.GetAsset().GetStringTable();
    Train train = driver.GetTrain();
    if (!train)
      // cant drive if we dont have a train
      return false;

    Industry industry = train.GetLastVisitedIndustry();
    if (!industry)
    {
      // Do we have the industry name stored?
      industry = cast<Industry>(Router.GetGameObject(industryName));
      if (!industry)
      {
        Interface.Print(strTable.GetString("msg_error_industry_not_found"));
        return false;
      }
    }

    industryName = industry.GetName();

    UnLoadCustomCommand command = new UnLoadCustomCommand();
    //command.parent = parent;
    command.driver = driver;
    command.industry = industry;

    // get the driver executing this command
    driver.DriverCustomCommand(command);
    driver.DriverIssueSchedule();

    return true;
  }

  // we should really implement EndExecute() to allow the game to determine the success of this command

  public object GetIcon(void)
  {
    return cast<object>parent;
  }

  public string GetTooltip(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string retString;
    if (industryName.size())
      retString = strTable.GetString("tt_unload_at") + industryName;
    else
      retString = strTable.GetString("driver_command_unload");

    return retString;
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    // Save support
    // Save the properties to the soup, then return the soup
    soup.SetNamedTag("industryName", industryName);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    // Load support
    // Setup the properties from the passed in soup
    industryName = soup.GetNamedTag("industryName");
  }
};


Wait For
[Driver Commands]

Wait For Command

config.txt:

﻿
username            "WaitFor"
kind              "drivercommand"
kuid              <kuid:-3:10090>
script              "WaitForCommand"
class             "WaitForCommand"
icon-texture            "waitfor.texture"
string-table {
  description         "Pauses the driver's schedule for a set duration of time."
  driver_command_wait_for       "Wait for "
  return_msg_seconds        "$0 seconds"
  return_msg_one_minute       "1 minute"
  return_msg_minutes        "$0 minutes"
  return_msg_one_hour       "1 hour"
}
kuid-table {
  command-sounds          <kuid:-3:10219>
}
supports-null-driver-character        1
username-de           "Warten"
string-table-de {
  description         "Description"
  driver_command_wait_for       "Warten "
  return_msg_seconds        "$0 Sekunden"
  return_msg_one_minute       "1 Minute"
  return_msg_minutes        "$0 Minuten"
  return_msg_one_hour       "1 Stunde"
}
username-it           "Attendi"
string-table-it {
  description         "Description"
  driver_command_wait_for       "Aspetta per "
  return_msg_seconds        "$0 secondi"
  return_msg_one_minute       "1 minuto"
  return_msg_minutes        "$0 minuti"
  return_msg_one_hour       "1 ora"
}
username-es           "Esperar a"
string-table-es {
  description         "Description"
  driver_command_wait_for       "Esperar "
  return_msg_seconds        "$0 segundos"
  return_msg_one_minute       "1 minuto"
  return_msg_minutes        "$0 minutos"
  return_msg_one_hour       "1 hora"
}
username-pl           "CzekajNa"
string-table-pl {
  description         "Description"
  driver_command_wait_for       "Czekaj na "
  return_msg_seconds        "$0 s"
  return_msg_one_minute       "1 min."
  return_msg_minutes        "$0 min."
  return_msg_one_hour       "1 h"
}
username-cz           "Čekej"
string-table-cz {
  description         "Description"
  driver_command_wait_for       "Čekej "
  return_msg_seconds        "$0 sekund"
  return_msg_one_minute       "1 minutu"
  return_msg_minutes        "$0 minut"
  return_msg_one_hour       "1 hodinu"
}
username-ru           "Ждать"
string-table-ru {
  description         "Description"
  driver_command_wait_for       "Ждать "
  return_msg_seconds        "$0 секунд"
  return_msg_one_minute       "1 минуту"
  return_msg_minutes        "$0 минут"
  return_msg_one_hour       "1 час"
}
username-fr           "Attendre"
string-table-fr {
  description         "Marque une pause dans l’horaire du conducteur pour une durée déterminée."
  driver_command_wait_for       "Attendre "
  return_msg_seconds        "$0 secondes"
  return_msg_one_minute       "1 minute"
  return_msg_minutes        "$0 minutes"
  return_msg_one_hour       "1 heure"
}

WaitForCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"

include "WaitForScheduleCommand.gs"

//
// LoadCOmmand
//
// Basic "load" command functionality.
//

class WaitForCommand isclass DriverCommand
{
  public void Init(Asset asset)
  {
    inherited(asset);
    AddHandler(me, "WaitForItem", null, "WaitFor");
  }

  public void AddCommandMenuItem(DriverCharacter driver, Menu menu)
  {
    StringTable strTable = GetAsset().GetStringTable();
    Menu itemMenu = Constructors.NewMenu();
    Train train;

    if (driver)
      train = driver.GetTrain();

    if (train or !driver)
    {
      itemMenu.AddItem(strTable.GetString1("return_msg_seconds", "5"), me, "WaitForItem", "5");
      itemMenu.AddItem(strTable.GetString1("return_msg_seconds", "10"), me, "WaitForItem", "10");
      itemMenu.AddItem(strTable.GetString1("return_msg_seconds", "20"), me, "WaitForItem", "20");
      itemMenu.AddItem(strTable.GetString1("return_msg_seconds", "30"), me, "WaitForItem", "30");
      itemMenu.AddItem(strTable.GetString("return_msg_one_minute"), me, "WaitForItem", "60");
      itemMenu.AddItem(strTable.GetString1("return_msg_minutes", "2"), me, "WaitForItem", "120");
      itemMenu.AddItem(strTable.GetString1("return_msg_minutes", "5"), me, "WaitForItem", "300");
      itemMenu.AddItem(strTable.GetString1("return_msg_minutes", "10"), me, "WaitForItem", "600");
      itemMenu.AddItem(strTable.GetString1("return_msg_minutes", "30"), me, "WaitForItem", "1800");
      itemMenu.AddItem(strTable.GetString("return_msg_one_hour"), me, "WaitForItem", "3600");

      menu.AddSubmenu(strTable.GetString("driver_command_wait_for") + ">", itemMenu);
    }
  }

  void PlayConfirmation(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("command-sounds");
    Library libCommandSounds = World.GetLibrary(kuid);
    if (libCommandSounds)
    {
      libCommandSounds.LibraryCall("PlayConfirmation", null, null);
    }
  }

  DriverScheduleCommand CreateScheduleCommand(DriverCharacter driver, Soup soup)
  {
    WaitForScheduleCommand cmd = new WaitForScheduleCommand();
    cmd.Init(driver, me);
    cmd.SetParent(me);
    cmd.SetProperties(soup);
    return cast<DriverScheduleCommand>cmd;
  }

  void WaitFor(Message msg)
  {
    DriverCommands commands = GetDriverCommands(msg);
    DriverCharacter driver = cast<DriverCharacter>(msg.src);
    float timeToWait = Str.ToFloat((string)msg.minor);

      // schedule our command
    Soup soup = Constructors.NewSoup();
    soup.SetNamedTag("timeToWait", timeToWait);
    WaitForScheduleCommand cmd = cast<WaitForScheduleCommand>CreateScheduleCommand(driver, soup);
    commands.AddDriverScheduleCommand(cmd);

    if (driver)
      PlayConfirmation();
  }

};

WaitForScheduleCommand.gs:

include "DriverCommand.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "Industry.gs"
include "WaitForCommand.gs"
include "Schedule.gs"

class WaitForCustomCommand isclass CustomCommand
{
  public float timeToWait;
  public DriverCharacter driver;

  public void WaitForSleepFinished(void)
  {
    wait()
    {
      on "WaitForCustomCommand", "Finished":
        break;

      on "Schedule", "Abort":
        break;
    }

  }
  //
    // 1. 'me' is this CustomCommand
    // 2. The thread is running on the Train GameObject,
    //    therefore all wait() calls, etc receive messages through the Train GameObject.
    // 3. 'Sniff()' works on the GameObject upon which it is called, which is not necessarily
    //    the same GameObject as the one upon which the current thread is running.
    //
    // This means that when we want to receive a message, it must go to the Train.
    // Any messages we want to send may as well come from the Train as well, but the DriverCharacter is also a GameObject.
    // And any Sniff() calls we make will want to be made on the Train.
    //
  public void HandleWaitForCommand(Train train)
  {
    train.SetAutopilotMode(Train.CONTROL_SCRIPT);
    train.SetDCCThrottle(0.0);
    //train.Sleep(timeToWait);

    train.PostMessage(train, "WaitForCustomCommand", "Finished", timeToWait);
    WaitForSleepFinished();

  }

  public bool Execute(Train train, int px, int py, int pz)
  {
    // Tell the industry to handle our command
    HandleWaitForCommand(train);

    return true;
  }
};

class WaitForScheduleCommand isclass DriverScheduleCommand
{
  public float timeToWait;

  WaitForCommand parent;

  public void SetParent(WaitForCommand newParent)
  {
    parent = newParent;
  }

  public bool BeginExecute(DriverCharacter driver)
  {
    Train train = driver.GetTrain();
    if (!train)
        // cant WaitFor if we dont have a train
      return false;

    WaitForCustomCommand command = new WaitForCustomCommand();
    command.driver = driver;
    command.timeToWait = timeToWait;

      // get the driver executing this command
    driver.DriverCustomCommand(command);
    driver.DriverIssueSchedule();

    return true;
  }

  // we should really implement EndExecute() to allow the game to determine the success of this command

  public object GetIcon(void)
  {
    return cast<object>parent;
  }

  public string GetTooltip(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string retString;

    if (timeToWait == 5)
      retString = strTable.GetString1("return_msg_seconds", "5");
    if (timeToWait == 10)
      retString = strTable.GetString1("return_msg_seconds", "10");
    if (timeToWait == 20)
      retString = strTable.GetString1("return_msg_seconds", "20");
    if (timeToWait == 30)
      retString = strTable.GetString1("return_msg_seconds", "30");
    if (timeToWait == 60)
      retString = strTable.GetString("return_msg_one_minute");
    if (timeToWait == 120)
      retString = strTable.GetString1("return_msg_minutes", "2");
    if (timeToWait == 300)
      retString = strTable.GetString1("return_msg_minutes", "5");
    if (timeToWait == 600)
      retString = strTable.GetString1("return_msg_minutes", "10");
    if (timeToWait == 1800)
      retString = strTable.GetString1("return_msg_minutes", "30");
    if (timeToWait == 3600)
      retString = strTable.GetString("return_msg_one_hour");

    return strTable.GetString("driver_command_wait_for") + retString;
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    // Save support
    // Save the properties to the soup, then return the soup
    soup.SetNamedTag("timeToWait", timeToWait);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    // Load support
    // Setup the properties from the passed in soup
    timeToWait = soup.GetNamedTagAsFloat("timeToWait");
  }
};


Industries
[Asset Source]

Industries

  • Airport
  • Brick Station Large
  • Brick Station Medium
  • Brick Station Medium2
  • Brick Station Small
  • Coal Mine
  • Container Station
  • Forestry
  • Hyde Pulp Mill
  • Lumber Mill
  • Multiple Industry
  • Multiple Industry New
  • Oil Field
  • Oil Refinery
  • Portal
  • Power Station
  • Seaport
  • Small Station
  • Steam Filling Station


Airport
[Industries]

Airport Industry and Station

config.txt:

﻿
kind              "industry"
region              "TRS2004"
kuid              <kuid:-3:10043>
type              "Industrial"
username            "Airport"
light             1
nightmode           "lamp"
preview-mesh-kuid         <kuid:-3:10121>
script              "airport"
class             "Airport"
icon-texture            "icon_airport.tga"
name              "New Farm Airport"
fontsize            0.08
fontcolor           0,0,0
kuid-table {
  pipe            <kuid:-3:10051>
  diesel            <kuid:-3:10011>
  gengoods          <kuid:-3:10013>
  avgas           <kuid:-3:10045>
  passenger         <kuid:-3:10060>
}
mesh-table {
  default {
    mesh          "airport.lm"
    auto-create       1
    anim          "anim.kin"
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.coronagreen"
        frequency   0.5
        directional   0
        texture-kuid    <kuid:-3:10110>
      }
      1 {
        kind      "corona"
        att     "a.coronawhite"
        frequency   1
        directional   0
        texture-kuid    <kuid:-3:10111>
      }
      2 {
        kind      "corona"
        att     "a.jumbored"
        frequency   0.5
        directional   0
        texture-kuid    <kuid:-3:10112>
      }
      3 {
        kind      "corona"
        att     "a.jumbogreen"
        frequency   0.5
        directional   0
        texture-kuid    <kuid:-3:10110>
      }
      4 {
        kind      "corona"
        att     "a.cessnared"
        frequency   0.5
        directional   0
        texture-kuid    <kuid:-3:10112>
      }
      5 {
        kind      "corona"
        att     "a.cessnagreen"
        frequency   0.5
        directional   0
        texture-kuid    <kuid:-3:10110>
      }
      6 {
        kind      "corona"
        att     "a.jumboredbot"
        frequency   2
        directional   0
        texture-kuid    <kuid:-3:10112>
      }
      7 {
        kind      "corona"
        att     "a.jumbotailred"
        frequency   3
        directional   0
        texture-kuid    <kuid:-3:10112>
      }
      8 {
        kind      "corona"
        att     "a.jumbowhite0"
        frequency   0.25
        directional   0
        texture-kuid    <kuid:-3:10111>
      }
      9 {
        kind      "corona"
        att     "a.jumbowhite1"
        frequency   0.25
        directional   0
        texture-kuid    <kuid:-3:10111>
      }
      10 {
        kind      "corona"
        att     "a.cessnatailred"
        frequency   3
        directional   0
        texture-kuid    <kuid:-3:10112>
      }
      11 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name0"
        name      "name"
      }
      12 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name1"
        name      "name"
      }
      13 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name2"
        name      "name"
      }
      14 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name3"
        name      "name"
      }
      15 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name4"
        name      "name"
      }
      16 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name5"
        name      "name"
      }
    }
  }
  default-night {
    mesh          "night.im"
    night-mesh-base       "default"
  }
  jet-night {
    mesh          "jet_night/jet_night.im"
    att         "a.jetsound"
    night-mesh-base       "default"
  }
  load_diesel {
    mesh          "diesel_load.im"
    anim          "diesel_load.kin"
    auto-create       1
    att         "a.diesel_load"
    att-parent        "default"
  }
  load_av {
    mesh          "av_load.im"
    anim          "av_load.kin"
    auto-create       1
    att         "a.av_load"
    att-parent        "default"
  }
  radar {
    mesh          "radar/radar.im"
    anim          "radar/radar.kin"
    auto-create       1
    att         "a.radar"
    att-parent        "default"
    animation-loop-speed      1
  }
  warning-light-0 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_0"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-1 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_1"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-2 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_2"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-3 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_3"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
}
attached-track {
  passenger_station {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
    }
  }
  general_goods_depot {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1a"
      1       "a.track1b"
      2       "a.track1c"
    }
  }
  link2 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1c"
      1       "a.track1d"
    }
  }
  diesel_depot {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1d"
      1       "a.track1e"
    }
  }
  link3 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1e"
      1       "a.track1f"
    }
  }
  avgas_depot {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1f"
      1       "a.track1g"
      2       "a.track1h"
    }
  }
}
attached-trigger {
  trigger_track_one_a {
    att         "a.track0d"
    radius          5
    track         "passenger_station"
  }
  trigger_track_one_b {
    att         "a.trig0"
    radius          57
    track         "passenger_station"
  }
  trigger_track_one_c {
    att         "a.track0a"
    radius          5
    track         "passenger_station"
  }
  goods_in_t0 {
    att         "a.trig3"
    radius          14
    track         "general_goods_depot"
  }
  diesel_in_t0 {
    att         "a.trig4"
    radius          10
    track         "diesel_depot"
  }
  diesel_in_t1 {
    att         "a.trig5"
    radius          10
    track         "diesel_depot"
  }
  diesel_in_t2 {
    att         "a.trig6"
    radius          10
    track         "diesel_depot"
  }
  diesel_in_t3 {
    att         "a.trig7"
    radius          10
    track         "diesel_depot"
  }
  av_in_t0 {
    att         "a.trig8"
    radius          10
    track         "avgas_depot"
  }
  av_in_t1 {
    att         "a.trig9"
    radius          10
    track         "avgas_depot"
  }
  av_in_t2 {
    att         "a.trig10"
    radius          10
    track         "avgas_depot"
  }
  av_in_t3 {
    att         "a.trig11"
    radius          10
    track         "avgas_depot"
  }
}
soundscript {
  airport_ambient {
    repeat-delay        0
    distance        40,500
    sound {
      airport_ambient.wav
    }
  }
  jet_taxi {
    trigger         "taxi"
    attachment        "a.jetsound"
    repeat-delay        0
    distance        10,300
    sound {
      taxi.wav
    }
  }
  jet_take_off {
    trigger         "take_off"
    attachment        "a.jetsound"
    nostartdelay        1
    repeat-delay        1
    distance        10,400
    sound {
      jet_take_off.wav
    }
  }
  jet_land {
    trigger         "landing"
    attachment        "a.jetsound"
    nostartdelay        1
    repeat-delay        1
    distance        10,400
    sound {
      jet_land.wav
    }
  }
  cessna_start {
    trigger         "prop_startup"
    attachment        "a.propsound01"
    nostartdelay        1
    repeat-delay        1
    distance        10,300
    sound {
      cessna_start.wav
    }
  }
  cessna_taxi {
    trigger         "prop_taxi"
    attachment        "a.propsound01"
    repeat-delay        0
    distance        10,300
    sound {
      cessna_run.wav
    }
  }
  cessna_stop {
    trigger         "prop_shutdown"
    attachment        "a.propsound01"
    nostartdelay        1
    repeat-delay        1
    distance        10,300
    sound {
      cessna_off.wav
    }
  }
  station_amb {
    attachment        "a.passon01"
    nostartdelay        1
    distance        8,130
    sound {
      station_amb_2.wav
    }
  }
}
queues {
  passengers_on_0 {
    passenger-queue       1
    size          150
    initial-count       15
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passsit12"
      1       "a.passon02"
      2       "a.passsit30"
      3       "a.passon04"
      4       "a.passsit13"
      5       "a.passsit01"
      6       "a.passon34"
      7       "a.passon41"
      8       "a.passon51"
      9       "a.passon114"
      10        "a.passon11"
      11        "a.passon25"
      12        "a.passon106"
      13        "a.passon61"
      14        "a.passon97"
      15        "a.passon16"
      16        "a.passon66"
      17        "a.passsit15"
      18        "a.passon19"
      19        "a.passsit28"
      20        "a.passon67"
      21        "a.passon22"
      22        "a.passon55"
      23        "a.passsit18"
      24        "a.passon44"
      25        "a.passon26"
      26        "a.passon03"
      27        "a.passon17"
      28        "a.passon29"
      29        "a.passsit10"
      30        "a.passon31"
      31        "a.passon76"
      32        "a.passon33"
      33        "a.passon80"
      34        "a.passsit07"
      35        "a.passon83"
      36        "a.passon37"
      37        "a.passon59"
      38        "a.passon07"
      39        "a.passon40"
      40        "a.passon96"
      41        "a.passon42"
      42        "a.passon18"
      43        "a.passon69"
      44        "a.passon45"
      45        "a.passsit25"
      46        "a.passon73"
      47        "a.passon48"
      48        "a.passon38"
      49        "a.passon50"
      50        "a.passsit04"
      51        "a.passon52"
      52        "a.passsit20"
      53        "a.passon54"
      54        "a.passon06"
      55        "a.passon56"
      56        "a.passon20"
      57        "a.passon58"
      58        "a.passon116"
      59        "a.passon60"
      60        "a.passon28"
      61        "a.passon39"
      62        "a.passon63"
      63        "a.passon01"
      64        "a.passon65"
      65        "a.passon101"
      66        "a.passsit23"
      67        "a.passon12"
      68        "a.passon27"
      69        "a.passon13"
      70        "a.passon08"
      71        "a.passon72"
      72        "a.passon14"
      73        "a.passon09"
      74        "a.passon75"
      75        "a.passsit03"
      76        "a.passon77"
      77        "a.passon78"
      78        "a.passon10"
      79        "a.passsit27"
      80        "a.passon81"
      81        "a.passon82"
      82        "a.passsit22"
      83        "a.passon43"
      84        "a.passsit17"
      85        "a.passon23"
      86        "a.passon87"
      87        "a.passon21"
      88        "a.passsit09"
      89        "a.passon90"
      90        "a.passon112"
      91        "a.passon92"
      92        "a.passon93"
      93        "a.passon94"
      94        "a.passon57"
      95        "a.passon36"
      96        "a.passon30"
      97        "a.passon98"
      98        "a.passon71"
      99        "a.passon100"
      100       "a.passon49"
      101       "a.passon102"
      102       "a.passon79"
      103       "a.passon104"
      104       "a.passon105"
      105       "a.passon68"
      106       "a.passon107"
      107       "a.passon46"
      108       "a.passon109"
      109       "a.passon05"
      110       "a.passon111"
      111       "a.passsit29"
      112       "a.passon113"
      113       "a.passon53"
      114       "a.passon115"
      115       "a.passon88"
      116       "a.passon117"
      117       "a.passon84"
      118       "a.passon119"
      119       "a.passon120"
      120       "a.passon74"
      121       "a.passsit02"
      122       "a.passon62"
      123       "a.passon89"
      124       "a.passon91"
      125       "a.passsit06"
      126       "a.passon47"
      127       "a.passsit08"
      128       "a.passon95"
      129       "a.passon32"
      130       "a.passsit11"
      131       "a.passon108"
      132       "a.passon85"
      133       "a.passsit14"
      134       "a.passon70"
      135       "a.passsit16"
      136       "a.passon24"
      137       "a.passon35"
      138       "a.passsit19"
      139       "a.passon86"
      140       "a.passsit21"
      141       "a.passon15"
      142       "a.passon118"
      143       "a.passsit24"
      144       "a.passon64"
      145       "a.passsit26"
      146       "a.passon99"
      147       "a.passon110"
      148       "a.passsit05"
      149       "a.passon103"
    }
  }
  passengers_off_0 {
    passenger-queue       1
    size          93
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passoff01"
      1       "a.passoff65"
      2       "a.passoff74"
      3       "a.passoff04"
      4       "a.passoff22"
      5       "a.passoff18"
      6       "a.passoff07"
      7       "a.passoff35"
      8       "a.passoff28"
      9       "a.passoff68"
      10        "a.passoff41"
      11        "a.passoff12"
      12        "a.passoff09"
      13        "a.passoff24"
      14        "a.passoff05"
      15        "a.passoff16"
      16        "a.passoff90"
      17        "a.passoff55"
      18        "a.passoff19"
      19        "a.passoff30"
      20        "a.passoff21"
      21        "a.passoff46"
      22        "a.passoff23"
      23        "a.passoff83"
      24        "a.passoff25"
      25        "a.passoff57"
      26        "a.passoff27"
      27        "a.passoff43"
      28        "a.passoff77"
      29        "a.passoff66"
      30        "a.passoff31"
      31        "a.passoff06"
      32        "a.passoff33"
      33        "a.passoff10"
      34        "a.passoff54"
      35        "a.passoff85"
      36        "a.passoff11"
      37        "a.passoff03"
      38        "a.passoff39"
      39        "a.passoff14"
      40        "a.passoff79"
      41        "a.passoff42"
      42        "a.passoff02"
      43        "a.passoff44"
      44        "a.passoff81"
      45        "a.passoff88"
      46        "a.passoff87"
      47        "a.passoff48"
      48        "a.passoff86"
      49        "a.passoff50"
      50        "a.passoff51"
      51        "a.passoff34"
      52        "a.passoff53"
      53        "a.passoff76"
      54        "a.passoff20"
      55        "a.passoff56"
      56        "a.passoff84"
      57        "a.passoff91"
      58        "a.passoff59"
      59        "a.passoff38"
      60        "a.passoff32"
      61        "a.passoff15"
      62        "a.passoff63"
      63        "a.passoff40"
      64        "a.passoff08"
      65        "a.passoff47"
      66        "a.passoff67"
      67        "a.passoff93"
      68        "a.passoff69"
      69        "a.passoff13"
      70        "a.passoff52"
      71        "a.passoff72"
      72        "a.passoff73"
      73        "a.passoff58"
      74        "a.passoff75"
      75        "a.passoff45"
      76        "a.passoff62"
      77        "a.passoff78"
      78        "a.passoff49"
      79        "a.passoff80"
      80        "a.passoff26"
      81        "a.passoff82"
      82        "a.passoff37"
      83        "a.passoff17"
      84        "a.passoff70"
      85        "a.passoff64"
      86        "a.passoff71"
      87        "a.passoff61"
      88        "a.passoff89"
      89        "a.passoff36"
      90        "a.passoff29"
      91        "a.passoff92"
      92        "a.passoff60"
    }
  }
  goods_in_q {
    size          84
    initial-count       72
    product-kuid        <kuid:-3:10013>
    attachment-points {
      0       "a.gen_goods0"
      1       "a.gen_goods1"
      2       "a.gen_goods2"
      3       "a.gen_goods3"
      4       "a.gen_goods4"
      5       "a.gen_goods5"
      6       "a.gen_goods6"
      7       "a.gen_goods7"
      8       "a.gen_goods8"
      9       "a.gen_goods9"
      10        "a.gen_goods10"
      11        "a.gen_goods11"
      12        "a.gen_goods12"
      13        "a.gen_goods13"
      14        "a.gen_goods14"
      15        "a.gen_goods15"
      16        "a.gen_goods16"
      17        "a.gen_goods17"
      18        "a.gen_goods18"
      19        "a.gen_goods19"
      20        "a.gen_goods20"
      21        "a.gen_goods21"
      22        "a.gen_goods22"
      23        "a.gen_goods23"
      24        "a.gen_goods24"
      25        "a.gen_goods25"
      26        "a.gen_goods26"
      27        "a.gen_goods27"
      28        "a.gen_goods28"
      29        "a.gen_goods29"
      30        "a.gen_goods30"
      31        "a.gen_goods31"
      32        "a.gen_goods32"
      33        "a.gen_goods33"
      34        "a.gen_goods34"
      35        "a.gen_goods35"
      36        "a.gen_goods36"
      37        "a.gen_goods37"
      38        "a.gen_goods38"
      39        "a.gen_goods39"
      40        "a.gen_goods40"
      41        "a.gen_goods41"
      42        "a.gen_goods42"
      43        "a.gen_goods43"
      44        "a.gen_goods44"
      45        "a.gen_goods45"
      46        "a.gen_goods46"
      47        "a.gen_goods47"
      48        "a.gen_goods48"
      49        "a.gen_goods49"
      50        "a.gen_goods50"
      51        "a.gen_goods51"
      52        "a.gen_goods52"
      53        "a.gen_goods53"
      54        "a.gen_goods54"
      55        "a.gen_goods55"
      56        "a.gen_goods56"
      57        "a.gen_goods57"
      58        "a.gen_goods58"
      59        "a.gen_goods59"
      60        "a.gen_goods60"
      61        "a.gen_goods61"
      62        "a.gen_goods62"
      63        "a.gen_goods63"
      64        "a.gen_goods64"
      65        "a.gen_goods65"
      66        "a.gen_goods66"
      67        "a.gen_goods67"
      68        "a.gen_goods68"
      69        "a.gen_goods69"
      70        "a.gen_goods70"
      71        "a.gen_goods71"
      72        "a.gen_goods72"
      73        "a.gen_goods73"
      74        "a.gen_goods74"
      75        "a.gen_goods75"
      76        "a.gen_goods76"
      77        "a.gen_goods77"
      78        "a.gen_goods78"
      79        "a.gen_goods79"
      80        "a.gen_goods80"
      81        "a.gen_goods81"
      82        "a.gen_goods82"
      83        "a.gen_goods83"
      84        "a.gen_goods84"
    }
  }
  diesel_in_q {
    size          388000
    animated-mesh       "load_diesel"
    allowed-products {
      0       <kuid:-3:10011>
    }
    product-kuid        <kuid:-3:10011>
    initial-count       155200
    !         "- 155200 = 38800 x 4 Tankers"
  }
  av_in_q {
    size          582000
    animated-mesh       "load_av"
    allowed-products {
      0       <kuid:-3:10045>
    }
    product-kuid        <kuid:-3:10045>
    initial-count       582000
    !         "- 582000 = 38800 x 15 Tankers"
  }
}
processes {
  airport_consumer {
    start-enabled       1
    duration        30
    inputs {
      0 {
        amount      7760
        !     "- 10 min to consume 155200 (initial load)"
        queue     "diesel_in_q"
      }
      1 {
        amount      14550
        !     "- 20 min to consume 582000 (initial/full load)"
        queue     "av_in_q"
      }
      2 {
        amount      4
        queue     "goods_in_q"
      }
    }
    outputs {
    }
  }
  passenger_spawn_0 {
    start-enabled       1
    duration        20
    outputs {
      0 {
        amount      1
        queue     "passengers_on_0"
      }
    }
  }
  passenger_delete_0 {
    start-enabled       1
    duration        3
    inputs {
      0 {
        amount      1
        queue     "passengers_off_0"
      }
    }
  }
}
icon0             <kuid:-3:10164>
string-table {
  airport_passenger       "Passenger Station"
  airport_general         "General Goods drop off"
  airport_diesel          "Diesel drop off"
  airport_avgas         "Aviation Gas drop off"
}
name-de             "Neuer Farm-Flughafen"
username-de           "Flughafen"
string-table-de {
  airport_passenger       "Passagier-Bahnhof"
  airport_general         "Allgemeine Güter abladen"
  airport_diesel          "Diesel abladen"
  airport_avgas         "Flugbenzin abladen"
}
name-it             "New Farm Airport"
username-it           "Aeroporto"
string-table-it {
  airport_passenger       "Stazione passegeri"
  airport_general         "Scarico merci varie"
  airport_diesel          "Scarico gasolio"
  airport_avgas         "Scarico carburante aerei"
}
name-es             "Aeropuerto de New Farm"
username-es           "Aeropuerto"
string-table-es {
  airport_passenger       "Estación de pasajeros"
  airport_general         "Entrega de mercancía general"
  airport_diesel          "Entrega de diesel"
  airport_avgas         "Entrega de gasavión"
}
name-pl             "Lotnisko New Farm"
username-pl           "Lotnisko"
string-table-pl {
  airport_passenger       "Stacja osobowa"
  airport_general         "Punkt rozładunku drobnicy"
  airport_diesel          "Punkt rozładunku oleju napędowego"
  airport_avgas         "Punkt rozładunku paliwa lotniczego"
}
name-cz             "Letiště New Farm"
username-cz           "Letiště"
string-table-cz {
  airport_passenger       "Nádraží pro cestující"
  airport_general         "Vykládka zboží"
  airport_diesel          "Vykládka nafty"
  airport_avgas         "Vykládka leteckého benzínu"
}
name-ru             "Новый аэропорт"
username-ru           "Аэропорт"
string-table-ru {
  airport_passenger       "Пассажирская станция"
  airport_general         "Выгрузка товаров"
  airport_diesel          "Выгрузка дизтоплива"
  airport_avgas         "Выгрузка авиатоплива"
}
name-fr             "Aéroport New Farm"
username-fr           "Aéroport"
string-table-fr {
  airport_passenger                                                                      "Station de passager"
  airport_general                                                                          "Décharge générale de marchandises"
  airport_diesel                                                                            "Décharge de diesel"
  airport_avgas                                                                              "Décharge d'essence d'avion"
}

airport.gs:

include "GenericPassengerStation.gs"

//
//
//
class Airport isclass GenericPassengerStation
{
  ProductQueue avInQueue, dieselInQueue, goodsInQueue, passengersInQueue, passengerQueueOff;
  ProductQueue[] allQueues = null;

  int ACTION_NOTHING = 0;
  int ACTION_LOADING = 1;
  int ACTION_UNLOADING = 2;

  PassengerStationInfo[] psi;
  bool alreadyLoading = false;
  Vehicle[] doorsOpen = new Vehicle[0];

  bool scriptletEnabled = true;

  // Track if they only supply some of the logs that were requested in the waybill.
  int avWBRemain = 0;
  int dieselWBRemain = 0;
  int goodsWBRemain = 0;

  bool TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();

    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_b" or triggerName == "trigger_track_one_c")
    {
      int direction = vehicle.GetRelationToTrack(me, "passenger_station");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_one_a")
        return true;

      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_one_c")
        return true;
    }

    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_b" or triggerName == "trigger_track_one_c")
    {
      if (vehicle.GetMyTrain().IsStopped())
        return true;
    }

    return false;
  }

  //
  //
  //

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();

    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
    {
      if (triggerName == "diesel_in_t0" or triggerName == "diesel_in_t3")
      {
        int direction = vehicle.GetRelationToTrack(me, "diesel_depot");
        if (!vehicleToTrain)
          direction = -direction;

        // Are we up to the furthest trigger away from the side we entered for diesel?
        if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "diesel_in_t0")
          return true;
        if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "diesel_in_t3")
          return true;
      }

      if (triggerName == "av_in_t0" or triggerName == "av_in_t3")
      {
        int direction = vehicle.GetRelationToTrack(me, "avgas_depot");
        if (!vehicleToTrain)
          direction = -direction;

        // Are we up to the furthest trigger away from the side we entered for avgas?
        if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "av_in_t3")
          return true;
        if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "av_in_t0")
          return true;
      }

      // There is only one trigger, so just accept it if we are stopped there.
      if (triggerName == "goods_in_t0")
        return true;

      // If the train has already stopped, then fall thru and allow this load as well
      if (triggerName == "diesel_in_t0" or triggerName == "diesel_in_t1" or triggerName == "diesel_in_t2" or triggerName == "diesel_in_t3" or triggerName == "goods_in_t0" or triggerName == "av_in_t0" or triggerName == "av_in_t1" or triggerName == "av_in_t2" or triggerName == "av_in_t3" or triggerName == "queue0" or triggerName == "queue1" or triggerName == "queue2")
      {
        if (vehicle.GetMyTrain().IsStopped())
          return true;
      }
    }

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (triggerName == "diesel_in_t0" or triggerName == "diesel_in_t1" or triggerName == "diesel_in_t2" or triggerName == "diesel_in_t3")
    {
      int spaceAvailable = dieselInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(dieselInQueue, spaceAvailable);

      int direction = vehicle.GetRelationToTrack(me, "diesel_depot");
      if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;

      Interface.Log("Unloading Diesel");
      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (dieselWBRemain > 0)
        dieselWBRemain = dieselWBRemain - report.amount;

    }

    if (triggerName == "goods_in_t0")
    {
      int spaceAvailable = goodsInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(goodsInQueue, spaceAvailable);

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (goodsWBRemain > 0)
        goodsWBRemain = goodsWBRemain - report.amount;

    }

    if (triggerName == "queue0" or triggerName == "queue1" or triggerName == "queue2")
    {
      if (vehicle.CanLoadProductFromQueue(passengersInQueue) or vehicle.CanUnloadProductToQueue(passengerQueueOff))
      {
        int industrySide;
        bool leftSide;

        leftSide = (vehicle.GetRelationToTrack(me, "passenger_station") == Vehicle.DIRECTION_FORWARD);

        if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
          industrySide = 0;
        else if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
          industrySide = -1;
        else
          return;

/*        if (!AddStationVehicle(vehicle, industrySide))
        {
          Interface.Log("PerformStoppedLoad> AddStationVehicle failed");
          return;
        }

        if (leftSide)
          vehicle.SetMeshAnimationState("left-passenger-door", true);
        else
          vehicle.SetMeshAnimationState("right-passenger-door", true);

          // Wait until the passenger system is happy with us.
        int i = 0;
        for (i = 0; i < 24; i++)    // Wait 2 mins max
        {
          Sleep(5);
          if (!CountTransferring(vehicle))
            break;
        }

        Sleep(5);

        RemoveStationVehicle(vehicle);*/

        if (leftSide)
          vehicle.SetMeshAnimationState("left-passenger-door", false);
        else
          vehicle.SetMeshAnimationState("right-passenger-door", false);

      }
    }

    if (triggerName == "av_in_t0" or triggerName == "av_in_t1" or triggerName == "av_in_t2" or triggerName == "av_in_t3")
    {
      int spaceAvailable = avInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(avInQueue, spaceAvailable);

      int direction = vehicle.GetRelationToTrack(me, "avgas_depot");
      if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (avWBRemain > 0)
        avWBRemain = avWBRemain - report.amount;

    }

  }

  //
  // ?
  //
  thread void AirportMain(void)
  {
    Message msg;

    wait()
    {
      Vehicle vehicle;
      string triggerName;

      on "Scriptlet-Enabled", "1":
      {
        SetProcessEnabled("airport_consumer", true);
        continue;
      }

      // ? Power station is providing electricity, if not already running. start the
      on "Scriptlet-Enabled", "0":
      {
        SetProcessEnabled("airport_consumer", false);
        continue;
      }

      // logs_consumer process in lumber mill has started, so active smoke stack particles and
      // start the animation (forklift & conveyor)
      on "Process-Start", "airport_consumer":

        continue;

      // logs_consumer process has stopped, disable particle effect and stop animation
      on "Process-Stop", "airport_consumer":

        continue;

    }
  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    usePipeAnimation = true;
    useGenericViewDetails = true;

    avInQueue = GetQueue("av_in_q");
    dieselInQueue = GetQueue("diesel_in_q");
    passengersInQueue = GetQueue("passengers0");;
    goodsInQueue = GetQueue("goods_in_q");
    passengerQueueOff = GetQueue("passengers_off");

    AddAssetToIndustryProductInfo("gengoods", "goods_in_q", "airport_consumer", true);
    AddAssetToIndustryProductInfo("diesel", "diesel_in_q", "airport_consumer", true);
    AddAssetToIndustryProductInfo("avgas", "av_in_q", "airport_consumer", true);

    // Enabled or disabled on startup? (Depends on if we have fuel! :D)
    if (dieselInQueue.GetQueueCount() > 0)
    {
      scriptletEnabled = true;
      SetMeshAnimationFrame("default", 2);
      StartMeshAnimationLoop("default");
    }
    else
    {
      scriptletEnabled = false;
      StopMeshAnimation("default");
      SetMeshAnimationFrame("default", 999.5);
    }

    InitPassengerStation(1);

    AirportMain();
    StationMain();

  }

  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret = new Requirement[0];

    if (avInQueue.GetQueueCount() < 145000 or avWBRemain > 0)  // approx 25% of full
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = avInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 465600;        // 12 tank cars
      if (avInQueue.GetQueueCount() < 145000 and avWBRemain == 0)
        avWBRemain = 465600;

      req.dst = me;
      req.dstQueue = avInQueue;

      ret[ret.size()] = req;
    }

    if (dieselInQueue.GetQueueCount() < 97000 or dieselWBRemain > 0)  // approx 25% of full
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = dieselInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 310400;        // 8 tank cars
      if (dieselInQueue.GetQueueCount() < 97000 and dieselWBRemain == 0)
        dieselWBRemain = 310400;

      req.dst = me;
      req.dstQueue = dieselInQueue;

      ret[ret.size()] = req;
    }

    if (goodsInQueue.GetQueueCount() < 20 or goodsWBRemain > 0)
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = goodsInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 50;
      if (goodsInQueue.GetQueueCount() < 20 and goodsWBRemain == 0)
        goodsWBRemain = 50;

      req.dst = me;
      req.dstQueue = goodsInQueue;

      ret[ret.size()] = req;
    }

    return ret;
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("airport_passenger");
    destTracks[destTracks.size()] = "passenger_station";

    destNames[destNames.size()] = stringTable.GetString("airport_general");
    destTracks[destTracks.size()] = "general_goods_depot";

    destNames[destNames.size()] = stringTable.GetString("airport_diesel");
    destTracks[destTracks.size()] = "diesel_depot";

    destNames[destNames.size()] = stringTable.GetString("airport_avgas");
    destTracks[destTracks.size()] = "avgas_depot";
  }

  void GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo)
  {
    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_b" or triggerName == "trigger_track_one_c")
    {
      retInfo.trackName = "passenger_station";
      retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) != Vehicle.DIRECTION_BACKWARD) == vehicle.GetDirectionRelativeToTrain();
      retInfo.platformIndex = 0;
    }
  }

};


Brick Station Large
[Industries]

Brick Station Large

config.txt:

﻿
username            "Brick_Station_large"
kind              "industry"
kuid              <kuid:-16:22999>
light             1
region              "TRS2004"
type              "Trackside"
nightmode           "lamp"
icon-texture            "icon_brickstation.tga"
script              "Station"
class             "Station"
kuid-table {
  passenger         <kuid:-3:10060>
}
mesh-table {
  default {
    mesh          "Brick_Station.im"
    auto-create       1
    effects {
      0 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name0"
        name      "name"
      }
      1 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name1"
        name      "name"
      }
      2 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name2"
        name      "name"
      }
      3 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name3"
        name      "name"
      }
    }
  }
  default-night {
    mesh          "night.im"
    night-mesh-base       "default"
  }
}
attached-track {
  track_0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
      4       "a.track0e"
      5       "a.track0f"
    }
  }
}
attached-trigger {
  trigger_track_0_a {
    att         "a.track0a"
    radius          5
    track         "track_0"
  }
  trigger_track_0_b {
    att         "a.track0b"
    radius          27
    track         "track_0"
  }
  trigger_track_0_c {
    att         "a.track0c"
    radius          27
    track         "track_0"
  }
  trigger_track_0_d {
    att         "a.track0d"
    radius          27
    track         "track_0"
  }
  trigger_track_0_e {
    att         "a.track0e"
    radius          5
    track         "track_0"
  }
}
queues {
  passengers_on_0 {
    passenger-queue       1
    size          80
    initial-count       8
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passon01"
      1       "a.passon02"
      2       "a.passon03"
      3       "a.passon04"
      4       "a.passon05"
      5       "a.passon06"
      6       "a.passon07"
      7       "a.passon08"
      8       "a.passon09"
      9       "a.passon10"
      10        "a.passon11"
      11        "a.passon12"
      12        "a.passon13"
      13        "a.passon14"
      14        "a.passon15"
      15        "a.passon16"
      16        "a.passon17"
      17        "a.passon18"
      18        "a.passon19"
      19        "a.passon20"
      20        "a.passon21"
      21        "a.passon22"
      22        "a.passon23"
      23        "a.passon24"
      24        "a.passon25"
      25        "a.passon26"
      26        "a.passon27"
      27        "a.passon28"
      28        "a.passon29"
      29        "a.passon30"
      30        "a.passon31"
      31        "a.passon32"
      32        "a.passon33"
      33        "a.passon34"
      34        "a.passon35"
      35        "a.passon36"
      36        "a.passon37"
      37        "a.passon38"
      38        "a.passon39"
      39        "a.passon40"
      40        "a.passon41"
      41        "a.passon42"
      42        "a.passon43"
      43        "a.passon44"
      44        "a.passon45"
      45        "a.passon46"
      46        "a.passon47"
      47        "a.passon48"
      48        "a.passon49"
      49        "a.passon50"
      50        "a.passon51"
      51        "a.passon52"
      52        "a.passon53"
      53        "a.passon54"
      54        "a.passon55"
      55        "a.passon56"
      56        "a.passon57"
      57        "a.passon58"
      58        "a.passon59"
      59        "a.passon60"
      60        "a.passon61"
      61        "a.passon62"
      62        "a.passon63"
      63        "a.passon64"
      64        "a.passon65"
      65        "a.passon66"
      66        "a.passon67"
      67        "a.passon68"
      68        "a.passon69"
      69        "a.passon70"
      70        "a.passon71"
      71        "a.passon72"
      72        "a.passon73"
      73        "a.passon74"
      74        "a.passon75"
      75        "a.passon76"
      76        "a.passon77"
      77        "a.passon78"
      78        "a.passon79"
      79        "a.passon80"
    }
  }
  passengers_off_0 {
    passenger-queue       1
    size          52
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passoff01"
      1       "a.passoff02"
      2       "a.passoff03"
      3       "a.passoff04"
      4       "a.passoff05"
      5       "a.passoff06"
      6       "a.passoff07"
      7       "a.passoff08"
      8       "a.passoff09"
      9       "a.passoff10"
      10        "a.passoff11"
      11        "a.passoff12"
      12        "a.passoff13"
      13        "a.passoff14"
      14        "a.passoff15"
      15        "a.passoff16"
      16        "a.passoff17"
      17        "a.passoff18"
      18        "a.passoff19"
      19        "a.passoff20"
      20        "a.passoff21"
      21        "a.passoff22"
      22        "a.passoff23"
      23        "a.passoff24"
      24        "a.passoff25"
      25        "a.passoff26"
      26        "a.passoff27"
      27        "a.passoff28"
      28        "a.passoff29"
      29        "a.passoff30"
      30        "a.passoff31"
      31        "a.passoff32"
      32        "a.passoff33"
      33        "a.passoff34"
      34        "a.passoff35"
      35        "a.passoff36"
      36        "a.passoff37"
      37        "a.passoff38"
      38        "a.passoff39"
      39        "a.passoff40"
      40        "a.passoff41"
      41        "a.passoff42"
      42        "a.passoff43"
      43        "a.passoff44"
      44        "a.passoff45"
      45        "a.passoff46"
      46        "a.passoff47"
      47        "a.passoff48"
      48        "a.passoff49"
      49        "a.passoff50"
      50        "a.passoff51"
      51        "a.passoff52"
    }
  }
}
processes {
  passenger_spawn_0 {
    start-enabled       1
    duration        20
    outputs {
      0 {
        amount      1
        queue     "passengers_on_0"
      }
    }
  }
  passenger_delete_0 {
    start-enabled       1
    duration        3
    inputs {
      0 {
        amount      1
        queue     "passengers_off_0"
      }
    }
  }
}
soundscript {
  dayloop {
    repeat-delay        0
    distance        8,130
    sound {
      station_amb_2.wav
    }
  }
}
string-table {
  brickstation_platform1        "Platform 1"
}
icon0             <kuid:-3:10164>
username-de           "Backstein_Bahnhof_Groß"
string-table-de {
  brickstation_platform1        "Bahnsteig 1"
}
username-it           "Stazione_mattoni_grande"
string-table-it {
  brickstation_platform1        "Marciapiede 1"
}
username-es           "Ladrillo_Estación_gran"
string-table-es {
  brickstation_platform1        "Andén 1"
}
username-pl           "Brick_Station_large"
string-table-pl {
  brickstation_platform1        "Platform 1"
}
username-cz           "Cihlové_nádraží_velké"
string-table-cz {
  brickstation_platform1        "Nástupiště 1"
}
name-ru             "name"
username-ru           "Кирпичная_станция_большая"
string-table-ru {
  brickstation_platform1        "Платформа 1"
}
username-fr           "Gde_gare_brique"
string-table-fr {
  brickstation_platform1                                                            "Plateforme 1"
}

Station.gs:

include "GenericPassengerStation.gs"

class Station isclass GenericPassengerStation
{

  bool TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();

    if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_e")
    {
      int direction = vehicle.GetRelationToTrack(me, "track_0");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_0_e")
        return true;

      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_0_a")
        return true;
    }

    if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_b" or triggerName == "trigger_track_0_c" or triggerName == "trigger_track_0_d" or triggerName == "trigger_track_0_e")
    {
      if (vehicle.GetMyTrain().IsStopped())
        return true;
    }

    return false;
  }

  void GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo)
  {
    if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_b" or triggerName == "trigger_track_0_c" or triggerName == "trigger_track_0_d" or triggerName == "trigger_track_0_e")
    {
      retInfo.trackName = "track_0";
      retInfo.trainLeftSide = ((vehicle.GetRelationToTrack(me, retInfo.trackName) != Vehicle.DIRECTION_FORWARD) == vehicle.GetDirectionRelativeToTrain());
      retInfo.platformIndex = 0;
    }
  }

  public void Init(void)
  {
    inherited();

    InitPassengerStation(1);

    StationMain();
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("brickstation_platform1");
    destTracks[destTracks.size()] = "track_0";
  }

};


Brick Station Medium
[Industries]

Brick Station Medium

config.txt:

﻿
username            "Brick_Station_medium"
kind              "industry"
kuid              <kuid:-3:10148>
light             1
region              "TRS2004"
type              "Trackside"
nightmode           "lamp"
icon-texture            "icon_brickstationmed.tga"
script              "Station"
class             "Station"
kuid-table {
  passenger         <kuid:-3:10060>
}
mesh-table {
  default {
    mesh          "Brick_Station_2.im"
    auto-create       1
    effects {
      0 {
        kind      "name"
        fontsize    0.13
        fontcolor   30,30,30
        att     "a.name0"
        name      "name"
      }
      1 {
        kind      "name"
        fontsize    0.13
        fontcolor   30,30,30
        att     "a.name1"
        name      "name"
      }
      2 {
        kind      "name"
        fontsize    0.13
        fontcolor   30,30,30
        att     "a.name2"
        name      "name"
      }
      3 {
        kind      "name"
        fontsize    0.13
        fontcolor   30,30,30
        att     "a.name3"
        name      "name"
      }
    }
  }
  default-night {
    mesh          "night.im"
    night-mesh-base       "default"
  }
}
attached-track {
  track_0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
      4       "a.track0e"
      5       "a.track0f"
    }
  }
}
attached-trigger {
  trigger_track_0_a {
    att         "a.track0a"
    radius          5
    track         "track_0"
  }
  trigger_track_0_b {
    att         "a.track0d"
    radius          40
    track         "track_0"
  }
  trigger_track_0_c {
    att         "a.track0f"
    radius          5
    track         "track_0"
  }
}
queues {
  passengers_on_0 {
    passenger-queue       1
    size          88
    initial-count       9
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passon01"
      1       "a.passon02"
      2       "a.passon03"
      3       "a.passon04"
      4       "a.passon05"
      5       "a.passon06"
      6       "a.passon07"
      7       "a.passon08"
      8       "a.passon09"
      9       "a.passon10"
      10        "a.passon11"
      11        "a.passon12"
      12        "a.passon13"
      13        "a.passon14"
      14        "a.passon15"
      15        "a.passon16"
      16        "a.passon17"
      17        "a.passon18"
      18        "a.passon19"
      19        "a.passon20"
      20        "a.passon21"
      21        "a.passon22"
      22        "a.passon23"
      23        "a.passon24"
      24        "a.passon25"
      25        "a.passon26"
      26        "a.passon27"
      27        "a.passon28"
      28        "a.passon29"
      29        "a.passon30"
      30        "a.passon31"
      31        "a.passon32"
      32        "a.passon33"
      33        "a.passon34"
      34        "a.passon35"
      35        "a.passon36"
      36        "a.passon37"
      37        "a.passon38"
      38        "a.passon39"
      39        "a.passon40"
      40        "a.passon41"
      41        "a.passon42"
      42        "a.passon43"
      43        "a.passon44"
      44        "a.passon45"
      45        "a.passon46"
      46        "a.passon47"
      47        "a.passon48"
      48        "a.passon49"
      49        "a.passon50"
      50        "a.passon51"
      51        "a.passon52"
      52        "a.passon53"
      53        "a.passon54"
      54        "a.passon55"
      55        "a.passon56"
      56        "a.passon57"
      57        "a.passon58"
      58        "a.passon59"
      59        "a.passon60"
      60        "a.passon61"
      61        "a.passon62"
      62        "a.passon63"
      63        "a.passon64"
      64        "a.passon65"
      65        "a.passon66"
      66        "a.passon67"
      67        "a.passon68"
      68        "a.passon69"
      69        "a.passon70"
      70        "a.passon71"
      71        "a.passon72"
      72        "a.passon73"
      73        "a.passon74"
      74        "a.passon75"
      75        "a.passon76"
      76        "a.passon77"
      77        "a.passon78"
      78        "a.passon79"
      79        "a.passon80"
      80        "a.passsit01"
      81        "a.passsit02"
      82        "a.passsit03"
      83        "a.passsit04"
      84        "a.passsit05"
      85        "a.passsit06"
      86        "a.passsit07"
      87        "a.passsit08"
    }
  }
  passengers_off_0 {
    passenger-queue       1
    size          52
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passoff01"
      1       "a.passoff02"
      2       "a.passoff03"
      3       "a.passoff04"
      4       "a.passoff05"
      5       "a.passoff06"
      6       "a.passoff07"
      7       "a.passoff08"
      8       "a.passoff09"
      9       "a.passoff10"
      10        "a.passoff11"
      11        "a.passoff12"
      12        "a.passoff13"
      13        "a.passoff14"
      14        "a.passoff15"
      15        "a.passoff16"
      16        "a.passoff17"
      17        "a.passoff18"
      18        "a.passoff19"
      19        "a.passoff20"
      20        "a.passoff21"
      21        "a.passoff22"
      22        "a.passoff23"
      23        "a.passoff24"
      24        "a.passoff25"
      25        "a.passoff26"
      26        "a.passoff27"
      27        "a.passoff28"
      28        "a.passoff29"
      29        "a.passoff30"
      30        "a.passoff31"
      31        "a.passoff32"
      32        "a.passoff33"
      33        "a.passoff34"
      34        "a.passoff35"
      35        "a.passoff36"
      36        "a.passoff37"
      37        "a.passoff38"
      38        "a.passoff39"
      39        "a.passoff40"
      40        "a.passoff41"
      41        "a.passoff42"
      42        "a.passoff43"
      43        "a.passoff44"
      44        "a.passoff45"
      45        "a.passoff46"
      46        "a.passoff47"
      47        "a.passoff48"
      48        "a.passoff49"
      49        "a.passoff50"
      50        "a.passoff51"
      51        "a.passoff52"
    }
  }
}
processes {
  passenger_spawn_0 {
    start-enabled       1
    duration        20
    outputs {
      0 {
        amount      1
        queue     "passengers_on_0"
      }
    }
  }
  passenger_delete_0 {
    start-enabled       1
    duration        3
    inputs {
      0 {
        amount      1
        queue     "passengers_off_0"
      }
    }
  }
}
soundscript {
  dayloop {
    repeat-delay        0
    distance        8,130
    sound {
      station_amb_2.wav
    }
  }
}
string-table {
  brickstation_platform1        "Platform 1"
}
icon0             <kuid:-3:10164>
username-de           "Backstein_Bahnhof_Mittel"
string-table-de {
  brickstation_platform1        "Bahnsteig 1"
}
username-it           "Stazione_mattoni_media"
string-table-it {
  brickstation_platform1        "Marciapiede 1"
}
username-es           "Ladrillo_Estación_med"
string-table-es {
  brickstation_platform1        "Andén 1"
}
username-pl           "Stacja_ceglana_średnia"
string-table-pl {
  brickstation_platform1        "Peron 1"
}
username-cz           "Nádraží_střední"
string-table-cz {
  brickstation_platform1        "Nástupiště 1"
}
username-cn           "Brick_Station_medium"
string-table-cn {
  brickstation_platform1        "月台1"
}
name-ru             "name"
username-ru           "Станция Кирпичная_2"
string-table-ru {
  brickstation_platform1        "Платформа1"
}
username-fr           "Gare_brique_moyenne"
string-table-fr {
  brickstation_platform1                                                            "Plateforme 1"
}

Station.gs:

include "GenericPassengerStation.gs"

class Station isclass GenericPassengerStation
{

  bool TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();

    if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_c")
    {
      int direction = vehicle.GetRelationToTrack(me, "track_0");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_0_c")
        return true;

      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_0_a")
        return true;
    }

    if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_b" or triggerName == "trigger_track_0_c")
    {
      if (vehicle.GetMyTrain().IsStopped())
        return true;
    }

    return false;
  }

  void GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo)
  {
    if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_b" or triggerName == "trigger_track_0_c")
    {
      retInfo.trackName = "track_0";
      retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) != Vehicle.DIRECTION_FORWARD) == vehicle.GetDirectionRelativeToTrain();
      retInfo.platformIndex = 0;
    }
  }

  public void Init(void)
  {
    inherited();

    InitPassengerStation(1);

    StationMain();
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("brickstation_platform1");
    destTracks[destTracks.size()] = "track_0";
  }

};


Brick Station Medium2
[Industries]

Brick Station Medium2

config.txt:

﻿
username            "Brick_Station_medium2"
kind              "industry"
kuid              <kuid:-3:10210>
light             1
region              "TRS2004"
type              "Trackside"
nightmode           "lamp"
icon-texture            "icon_brickstation.tga"
script              "Station"
class             "Station"
kuid-table {
  passenger         <kuid:-3:10060>
}
mesh-table {
  default {
    mesh          "BrickStation_medium2.im"
    auto-create       1
    effects {
      0 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name0"
        name      "name"
      }
      1 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name1"
        name      "name"
      }
      2 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name2"
        name      "name"
      }
      3 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name3"
        name      "name"
      }
      4 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name4"
        name      "name"
      }
    }
  }
  default-night {
    mesh          "night.im"
    night-mesh-base       "default"
  }
}
attached-track {
  track_one {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
      4       "a.track0e"
      5       "a.track0f"
    }
  }
  track_two {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1a"
      1       "a.track1b"
      2       "a.track1c"
      3       "a.track1d"
      4       "a.track1e"
      5       "a.track1f"
    }
  }
}
attached-trigger {
  trigger_track_one_a {
    att         "a.track0a"
    radius          6
    track         "track_one"
  }
  trigger_track_one_b {
    att         "a.trigmain"
    radius          52
    track         "track_one"
  }
  trigger_track_one_c {
    att         "a.track0f"
    radius          6
    track         "track_one"
  }
  trigger_track_two_a {
    att         "a.track1a"
    radius          6
    track         "track_two"
  }
  trigger_track_two_b {
    att         "a.trigmain"
    radius          52
    track         "track_two"
  }
  trigger_track_two_c {
    att         "a.track1f"
    radius          6
    track         "track_two"
  }
}
queues {
  passengers_on_0 {
    passenger-queue       1
    size          40
    initial-count       40
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passon01"
      1       "a.passon02"
      2       "a.passon03"
      3       "a.passon04"
      4       "a.passon05"
      5       "a.passon06"
      6       "a.passon07"
      7       "a.passon08"
      8       "a.passon09"
      9       "a.passon10"
      10        "a.passon11"
      11        "a.passon12"
      12        "a.passon13"
      13        "a.passon14"
      14        "a.passon15"
      15        "a.passon16"
      16        "a.passon17"
      17        "a.passon18"
      18        "a.passon19"
      19        "a.passon20"
      20        "a.passon21"
      21        "a.passon22"
      22        "a.passon23"
      23        "a.passon24"
      24        "a.passon25"
      25        "a.passon26"
      26        "a.passon27"
      27        "a.passon28"
      28        "a.passon29"
      29        "a.passon30"
      30        "a.passon31"
      31        "a.passon32"
      32        "a.passon33"
      33        "a.passon34"
      34        "a.passon35"
      35        "a.passon36"
      36        "a.passon37"
      37        "a.passon38"
      38        "a.passon39"
      39        "a.passon40"
    }
  }
  passengers_on_1 {
    passenger-queue       1
    size          40
    initial-count       40
    product-kuid        <kuid:-3:10060>
    attachment-points {
      1       "a.passon42"
      2       "a.passon43"
      3       "a.passon44"
      4       "a.passon45"
      5       "a.passon46"
      6       "a.passon47"
      7       "a.passon48"
      8       "a.passon49"
      9       "a.passon50"
      0       "a.passon51"
      10        "a.passon52"
      12        "a.passon53"
      13        "a.passon54"
      14        "a.passon55"
      15        "a.passon56"
      16        "a.passon57"
      17        "a.passon58"
      18        "a.passon59"
      19        "a.passon60"
      20        "a.passon61"
      21        "a.passon62"
      22        "a.passon63"
      23        "a.passon64"
      24        "a.passon65"
      25        "a.passon66"
      26        "a.passon67"
      27        "a.passon68"
      28        "a.passon69"
      29        "a.passon70"
      30        "a.passon71"
      31        "a.passon72"
      32        "a.passon73"
      33        "a.passon74"
      34        "a.passon75"
      35        "a.passon76"
      36        "a.passon77"
      37        "a.passon78"
      38        "a.passon79"
      39        "a.passon80"
    }
  }
  passengers_off_0 {
    passenger-queue       1
    size          26
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passoff01"
      1       "a.passoff15"
      2       "a.passoff03"
      3       "a.passoff04"
      4       "a.passoff18"
      5       "a.passoff06"
      6       "a.passoff07"
      7       "a.passoff05"
      8       "a.passoff22"
      9       "a.passoff10"
      10        "a.passoff11"
      11        "a.passoff26"
      12        "a.passoff13"
      13        "a.passoff14"
      14        "a.passoff09"
      15        "a.passoff24"
      16        "a.passoff17"
      17        "a.passoff25"
      18        "a.passoff19"
      19        "a.passoff20"
      20        "a.passoff21"
      21        "a.passoff08"
      22        "a.passoff23"
      23        "a.passoff02"
      24        "a.passoff12"
      25        "a.passoff16"
    }
  }
  passengers_off_1 {
    passenger-queue       1
    size          26
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passoff27"
      1       "a.passoff44"
      2       "a.passoff29"
      3       "a.passoff30"
      4       "a.passoff36"
      5       "a.passoff32"
      6       "a.passoff46"
      7       "a.passoff34"
      8       "a.passoff48"
      9       "a.passoff43"
      10        "a.passoff37"
      11        "a.passoff35"
      12        "a.passoff39"
      13        "a.passoff33"
      14        "a.passoff41"
      15        "a.passoff42"
      16        "a.passoff38"
      17        "a.passoff40"
      18        "a.passoff45"
      19        "a.passoff31"
      20        "a.passoff47"
      21        "a.passoff52"
      22        "a.passoff49"
      23        "a.passoff50"
      24        "a.passoff51"
      25        "a.passoff28"
    }
  }
}
processes {
  passenger_spawn_0 {
    start-enabled       1
    duration        20
    outputs {
      0 {
        amount      1
        queue     "passengers_on_0"
      }
    }
  }
  passenger_spawn_1 {
    start-enabled       1
    duration        20
    outputs {
      0 {
        amount      1
        queue     "passengers_on_1"
      }
    }
  }
  passenger_delete_0 {
    start-enabled       1
    duration        3
    inputs {
      0 {
        amount      1
        queue     "passengers_off_0"
      }
    }
  }
  passenger_delete_1 {
    start-enabled       1
    duration        3
    inputs {
      0 {
        amount      1
        queue     "passengers_off_1"
      }
    }
  }
}
soundscript {
  dayloop {
    repeat-delay        0
    distance        8,130
    sound {
      station_amb_2.wav
    }
  }
}
string-table {
  stationtest_plat1       "Platform 1"
  stationtest_plat2       "Platform 2"
}
icon0             <kuid:-3:10164>
username-de           "Brick_Station_medium2"
string-table-de {
  stationtest_plat1       "Platform 1"
  stationtest_plat2       "Platform 2"
}
username-it           "Brick_Station_medium2"
string-table-it {
  stationtest_plat1       "Marciapiede 1"
  stationtest_plat2       "Marciapiede 2"
}
username-es           "Estación_Ladrillo_media2"
string-table-es {
  stationtest_plat1       "Andén 1"
  stationtest_plat2       "Andén 2"
}
username-pl           "Brick_Station_medium2"
string-table-pl {
  stationtest_plat1       "Platform 1"
  stationtest_plat2       "Platform 2"
}
username-cz           "Cihlové_nádraží_střední2"
string-table-cz {
  stationtest_plat1       "Nástupiště 1"
  stationtest_plat2       "Nástupiště 2"
}
name-ru             "name"
username-ru           "Кирпичная_станция_средняя2"
string-table-ru {
  stationtest_plat1       "Платформа 1"
  stationtest_plat2       "Платформа 2"
}
username-fr           "Gare_brique_moyenne2"
string-table-fr {
  stationtest_plat1                                                                      "Quai 1"
  stationtest_plat2                                                                      "Quai 2"
}

Station.gs:

include "GenericPassengerStation.gs"

class Station isclass GenericPassengerStation
{

  bool TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();

    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_c")
    {
      int direction = vehicle.GetRelationToTrack(me, "track_one");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_one_c")
        return true;

      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_one_a")
        return true;
    }

    if (triggerName == "trigger_track_two_a" or triggerName == "trigger_track_two_c")
    {
      int direction = vehicle.GetRelationToTrack(me, "track_two");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_two_c")
        return true;

      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_two_a")
        return true;
    }

    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_b" or triggerName == "trigger_track_one_c" or triggerName == "trigger_track_two_a" or triggerName == "trigger_track_two_b" or triggerName == "trigger_track_two_c")
    {
      if (vehicle.GetMyTrain().IsStopped())
        return true;
    }

    return false;
  }

  void GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo)
  {
    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_b" or triggerName == "trigger_track_one_c")
    {
      retInfo.trackName = "track_one";
      retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) != Vehicle.DIRECTION_FORWARD) == vehicle.GetDirectionRelativeToTrain();
      retInfo.platformIndex = 0;
    }
    else if (triggerName == "trigger_track_two_a" or triggerName == "trigger_track_two_b" or triggerName == "trigger_track_two_c")
    {
      retInfo.trackName = "track_two";
      retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) == Vehicle.DIRECTION_BACKWARD) == vehicle.GetDirectionRelativeToTrain();
      retInfo.platformIndex = 1;
    }
  }

  public void Init(void)
  {
    inherited();

    InitPassengerStation(2);

    StationMain();
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("stationtest_plat1");
    destTracks[destTracks.size()] = "track_one";

    destNames[destNames.size()] = stringTable.GetString("stationtest_plat2");
    destTracks[destTracks.size()] = "track_two";
  }

};


Brick Station Small
[Industries]

Brick Station Small

config.txt:

﻿
username            "Brick_Station_small"
kind              "industry"
kuid              <kuid:-3:10211>
light             1
region              "TRS2004"
type              "Trackside"
nightmode           "lamp"
icon-texture            "icon_station.tga"
script              "Station"
class             "Station"
passenger-height          1.204
kuid-table {
  passenger         <kuid:-3:10060>
}
mesh-table {
  default {
    mesh          "BrickStation_small.im"
    auto-create       1
    effects {
      0 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name0"
        name      "name"
      }
      1 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name1"
        name      "name"
      }
      2 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name2"
        name      "name"
      }
      3 {
        kind      "name"
        fontsize    0.15
        fontcolor   30,30,30
        att     "a.name3"
        name      "name"
      }
    }
  }
  default-night {
    mesh          "night.im"
    night-mesh-base       "default"
  }
}
attached-track {
  track_0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
      4       "a.track0e"
      5       "a.track0f"
    }
  }
}
attached-trigger {
  trigger_track_0_a {
    att         "a.track0a"
    radius          4
    track         "track_0"
  }
  trigger_track_0_b {
    att         "a.maintrig"
    radius          49
    track         "track_0"
  }
  trigger_track_0_c {
    att         "a.track0f"
    radius          4
    track         "track_0"
  }
}
queues {
  passengers_on_0 {
    passenger-queue       1
    size          86
    initial-count       86
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passon01"
      1       "a.passon02"
      2       "a.passon03"
      3       "a.passon04"
      4       "a.passon05"
      5       "a.passon06"
      6       "a.passon07"
      7       "a.passon08"
      8       "a.passon09"
      9       "a.passon10"
      10        "a.passon11"
      11        "a.passon12"
      12        "a.passon13"
      13        "a.passon14"
      14        "a.passon15"
      15        "a.passon16"
      16        "a.passon17"
      17        "a.passon18"
      18        "a.passon19"
      19        "a.passon20"
      20        "a.passon21"
      21        "a.passon22"
      22        "a.passon23"
      23        "a.passon24"
      24        "a.passon25"
      25        "a.passon26"
      26        "a.passon27"
      27        "a.passon28"
      28        "a.passon29"
      29        "a.passon30"
      30        "a.passon31"
      31        "a.passon32"
      32        "a.passon33"
      33        "a.passon34"
      34        "a.passon35"
      35        "a.passon36"
      36        "a.passon37"
      37        "a.passon38"
      38        "a.passon39"
      39        "a.passon40"
      40        "a.passon41"
      41        "a.passon42"
      42        "a.passon43"
      43        "a.passon44"
      44        "a.passon45"
      45        "a.passon46"
      46        "a.passon47"
      47        "a.passon48"
      48        "a.passon49"
      49        "a.passon50"
      50        "a.passon51"
      51        "a.passon52"
      52        "a.passon53"
      53        "a.passon54"
      54        "a.passon55"
      55        "a.passon56"
      56        "a.passon57"
      57        "a.passon58"
      58        "a.passon59"
      59        "a.passon60"
      60        "a.passon61"
      61        "a.passon62"
      62        "a.passon63"
      63        "a.passon64"
      64        "a.passon65"
      65        "a.passon66"
      66        "a.passon67"
      67        "a.passon68"
      68        "a.passon69"
      69        "a.passon70"
      70        "a.passon71"
      71        "a.passon72"
      72        "a.passon73"
      73        "a.passon74"
      74        "a.passon75"
      75        "a.passon76"
      76        "a.passon77"
      77        "a.passon78"
      78        "a.passon79"
      79        "a.passon80"
      80        "a.passsit01"
      81        "a.passsit02"
      82        "a.passsit03"
      83        "a.passsit04"
      84        "a.passsit05"
      85        "a.passsit06"
      86        "a.passsit07"
    }
  }
  passengers_off_0 {
    passenger-queue       1
    size          26
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passoff01"
      1       "a.passoff02"
      2       "a.passoff03"
      3       "a.passoff04"
      4       "a.passoff05"
      5       "a.passoff06"
      6       "a.passoff07"
      7       "a.passoff08"
      8       "a.passoff09"
      9       "a.passoff10"
      10        "a.passoff11"
      11        "a.passoff12"
      12        "a.passoff13"
      13        "a.passoff14"
      14        "a.passoff15"
      15        "a.passoff16"
      16        "a.passoff17"
      17        "a.passoff18"
      18        "a.passoff19"
      19        "a.passoff20"
      20        "a.passoff21"
      21        "a.passoff22"
      22        "a.passoff23"
      23        "a.passoff24"
      24        "a.passoff25"
      25        "a.passoff26"
      26        "a.passoff27"
      27        "a.passoff28"
      28        "a.passoff29"
      29        "a.passoff30"
      30        "a.passoff31"
      31        "a.passoff32"
      32        "a.passoff33"
      33        "a.passoff34"
      34        "a.passoff35"
      35        "a.passoff36"
      36        "a.passoff37"
      37        "a.passoff38"
      38        "a.passoff39"
      39        "a.passoff40"
      40        "a.passoff41"
      41        "a.passoff42"
      42        "a.passoff43"
      43        "a.passoff44"
      44        "a.passoff45"
      45        "a.passoff46"
      46        "a.passoff47"
      47        "a.passoff48"
      48        "a.passoff49"
      49        "a.passoff50"
      50        "a.passoff51"
      51        "a.passoff52"
    }
  }
}
processes {
  passenger_spawn_0 {
    start-enabled       1
    duration        20
    outputs {
      0 {
        amount      1
        queue     "passengers_on_0"
      }
    }
  }
  passenger_delete_0 {
    start-enabled       1
    duration        3
    inputs {
      0 {
        amount      1
        queue     "passengers_off_0"
      }
    }
  }
}
soundscript {
  dayloop {
    repeat-delay        0
    distance        8,130
    sound {
      station_amb_2.wav
    }
  }
}
string-table {
  brickstation_platform1        "Platform 1"
}
icon0             <kuid:-3:10164>
username-de           "Brick_Station_small"
string-table-de {
  brickstation_platform1        "Platform 1"
}
username-it           "Brick_Station_small"
string-table-it {
  brickstation_platform1        "Platform 1"
}
username-es           "Estación_Ladrillo_pequeña"
string-table-es {
  brickstation_platform1        "Andén 1"
}
username-pl           "Brick_Station_small"
string-table-pl {
  brickstation_platform1        "Platform 1"
}
username-cz           "Cihlové_nádraží_malé"
string-table-cz {
  brickstation_platform1        "Nástupiště 1"
}
name-ru             "name"
username-ru           "Кирпичная_станция_малая"
string-table-ru {
  brickstation_platform1        "Платформа 1"
}
username-fr           "Gare_brique_petite"
string-table-fr {
  brickstation_platform1                                                            "Quai 1"
}

Station.gs:

include "GenericPassengerStation.gs"

class Station isclass GenericPassengerStation
{

  bool TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();

    if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_c")
    {
      int direction = vehicle.GetRelationToTrack(me, "track_0");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_0_c")
        return true;

      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_0_a")
        return true;
    }

    if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_b" or triggerName == "trigger_track_0_c")
    {
      if (vehicle.GetMyTrain().IsStopped())
        return true;
    }

    return false;
  }

  void GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo)
  {
    if (triggerName == "trigger_track_0_a" or triggerName == "trigger_track_0_b" or triggerName == "trigger_track_0_c")
    {
      retInfo.trackName = "track_0";
      retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) == Vehicle.DIRECTION_FORWARD) == vehicle.GetDirectionRelativeToTrain();
      retInfo.platformIndex = 0;
    }
  }

  public void Init(void)
  {
    inherited();

    InitPassengerStation(1);

    StationMain();
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("brickstation_platform1");
    destTracks[destTracks.size()] = "track_0";
  }

};


Coal Mine
[Industries]

Coal Mine Industry

config.txt:

﻿
username            "Coal Mine"
kind              "industry"
light             1
region              "TRS2004"
kuid              <kuid:-3:10050>
type              "Industrial"
nightmode           "lamp"
script              "coalmine"
class             "CoalMine"
icon-texture            "icon_coalmine.tga"
kuid-table {
  pipe            <kuid:-3:10051>
  coal            <kuid:44179:60013>
  diesel            <kuid:-3:10011>
}
soundscript {
  daysingle {
    repeat-delay        0
    distance        10,300
    sound {
      coal_mine_ambient.wav
    }
  }
  truck_run0 {
    trigger         "truck_run0"
    attachment        "a.sound"
    repeat-delay        0
    distance        5,200
    sound {
      truck_run.wav
    }
  }
  truck_idle {
    trigger         "truck_idle"
    attachment        "a.sound"
    repeat-delay        0
    distance        5,200
    sound {
      truck_idle.wav
    }
  }
  coal_dump {
    trigger         "coal_dump"
    attachment        "a.sound"
    nostartdelay        1
    repeat-delay        1
    distance        5,200
    sound {
      coal_dump.wav
    }
  }
  clunk {
    attachment        "a.sound"
    trigger         "clunk0"
    nostartdelay        1
    repeat-delay        1
    distance        10,300
    sound {
      clunk.wav
    }
  }
  backup {
    attachment        "a.sound"
    trigger         "reverse"
    repeat-delay        0
    distance        5,100
    sound {
      warning.wav
    }
  }
}
mesh-table {
  default {
    mesh          "coalmine.lm"
    auto-create       1
    anim          "coalmine.kin"
    critical-animation      1
    animation-loop-speed      1
    effects {
      0 {
        kind      "name"
        fontsize    0.3
        fontcolor   220,220,220
        att     "a.name0"
        name      "name"
      }
      1 {
        kind      "name"
        fontsize    0.3
        fontcolor   220,220,220
        att     "a.name1"
        name      "name"
      }
      2 {
        kind      "name"
        fontsize    0.16
        fontcolor   220,220,220
        att     "a.name2"
        name      "name"
      }
      3 {
        kind      "name"
        fontsize    0.16
        fontcolor   220,220,220
        att     "a.name3"
        name      "name"
      }
    }
  }
  load {
    mesh          "load/load.im"
    anim          "load/load.kin"
    auto-create       1
  }
  load_diesel {
    mesh          "diesel_load.im"
    anim          "diesel_load.kin"
    auto-create       1
    att         "a.diesel_load"
    att-parent        "default"
  }
  warning-light-0 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_0"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-1 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_1"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-2 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_2"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  dumpsterwarning-light-1 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_3"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  dumpsterwarning-light-2 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_4"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
}
attached-track {
  out_track0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
    }
  }
  out_track1 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1a"
      1       "a.track1b"
      2       "a.track1c"
      3       "a.track1d"
    }
  }
  out_track2 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track2a"
      1       "a.track2b"
      2       "a.track2c"
      3       "a.track2d"
    }
  }
  out_track3 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track3a"
      1       "a.track3b"
      2       "a.track3c"
      3       "a.track3d"
    }
  }
  in_track0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track4a"
      1       "a.track4b"
      2       "a.track4c"
      3       "a.track4d"
    }
  }
}
attached-trigger {
  out_load0 {
    att         "a.trig0"
    radius          2
  }
  out_load1 {
    att         "a.trig1"
    radius          2
  }
  out_load2 {
    att         "a.trig2"
    radius          2
  }
  out_load3 {
    att         "a.trig3"
    radius          2
  }
  in_load0 {
    att         "a.trig4"
    radius          10
  }
  in_load1 {
    att         "a.trig5"
    radius          10
  }
  in_load2 {
    att         "a.trig6"
    radius          10
  }
  in_load3 {
    att         "a.trig7"
    radius          10
  }
}
queues {
  coal_out {
    size          1357500
    animated-mesh       "load"
    allowed-products {
      0       <kuid:44179:60013>
    }
    product-kuid        <kuid:44179:60013>
    initial-count       543000
    !         "- 543000 = 54300 x 10 Hoppers"
  }
  diesel_in {
    size          310400
    animated-mesh       "load_diesel"
    allowed-products {
      0       <kuid:-3:10011>
    }
    product-kuid        <kuid:-3:10011>
    initial-count       155200
    !         "- 155200 = 38800 x 4 Tankers"
  }
}
processes {
  coal_consumer {
    start-enabled       1
    duration        30
    inputs {
      0 {
        amount      6465
        !     "- 24 min to consume 310400 (full load)"
        queue     "diesel_in"
      }
    }
    outputs {
      0 {
        amount      22620
        !     "- 18 min to make initial count full"
        queue     "coal_out"
      }
    }
  }
}
smoke0 {
  ;           "chimney"
  particle          "effect"
  attachment          "a.stack0"
  mode            "time"
  color           46,46,39,150
  accel           0.5,0.3,0
  rate            8
  velocity          3
  lifetime          10
  minsize           2
  maxsize           10
  enabled           1
}
smoke1 {
  ;           "chimney"
  particle          "effect"
  attachment          "a.stack1"
  mode            "time"
  color           176,176,176,100
  accel           0.5,0.3,0
  rate            8
  velocity          3
  lifetime          8
  minsize           2
  maxsize           5
  enabled           1
}
smoke2 {
  ;           "vehicle load"
  particle          "effect"
  attachment          "a.load_top0"
  mode            "time"
  color           25,25,25,220
  accel           0.5,0.3,0
  rate            8
  velocity          3
  lifetime          10
  minsize           2
  maxsize           10
  enabled           0
}
smoke3 {
  ;           "vehicle load"
  particle          "effect"
  attachment          "a.load_top1"
  mode            "time"
  color           25,25,25,220
  accel           0.5,0.3,0
  rate            8
  velocity          3
  lifetime          10
  minsize           2
  maxsize           10
  enabled           0
}
smoke4 {
  ;           "vehicle load"
  particle          "effect"
  attachment          "a.load_top2"
  mode            "time"
  color           25,25,25,220
  accel           0.5,0.3,0
  rate            8
  velocity          3
  lifetime          10
  minsize           2
  maxsize           10
  enabled           0
}
smoke5 {
  ;           "vehicle load"
  particle          "effect"
  attachment          "a.load_top3"
  mode            "time"
  color           25,25,25,220
  accel           0.5,0.3,0
  rate            8
  velocity          3
  lifetime          10
  minsize           2
  maxsize           10
  enabled           0
}
icon0             <kuid:-3:10164>
string-table {
  coalmine_loadbay1       "Coal load bay #1"
  coalmine_loadbay2       "Coal load bay #2"
  coalmine_loadbay3       "Coal load bay #3"
  coalmine_loadbay4       "Coal load bay #4"
  coalmine_dieselunload       "Diesel unload bay"
}
username-de           "Kohlegrube"
string-table-de {
  coalmine_loadbay1       "Kohle-Ladebucht #1"
  coalmine_loadbay2       "Kohle-Ladebucht #2"
  coalmine_loadbay3       "Kohle-Ladebucht #3"
  coalmine_loadbay4       "Kohle-Ladebucht #4"
  coalmine_dieselunload       "Diesel-Abladebucht"
}
username-it           "Miniera carbone"
string-table-it {
  coalmine_loadbay1       "Coal load bay #1"
  coalmine_loadbay2       "Coal load bay #2"
  coalmine_loadbay3       "Coal load bay #3"
  coalmine_loadbay4       "Coal load bay #4"
  coalmine_dieselunload       "Diesel unload bay"
}
username-es           "Mina de carbón"
string-table-es {
  coalmine_loadbay1       "Muelle carga carbón no. 1"
  coalmine_loadbay2       "Muelle carga carbón no. 2"
  coalmine_loadbay3       "Muelle carga carbón no. 3"
  coalmine_loadbay4       "Muelle carga carbón no. 4"
  coalmine_dieselunload       "Muelle de descarga de diesel"
}
username-pl           "Kopalnia węgla"
string-table-pl {
  coalmine_loadbay1       "Strefa załadunku węgla #1"
  coalmine_loadbay2       "Strefa załadunku węgla #2"
  coalmine_loadbay3       "Strefa załadunku węgla #3"
  coalmine_loadbay4       "Strefa załadunku węgla #4"
  coalmine_dieselunload       "Strefa rozładunku oleju napędowego"
}
username-cz           "Uhelný důl"
string-table-cz {
  coalmine_loadbay1       "Nakládka uhlí #1"
  coalmine_loadbay2       "Nakládka uhlí #2"
  coalmine_loadbay3       "Nakládka uhlí #3"
  coalmine_loadbay4       "Nakládka uhlí #4"
  coalmine_dieselunload       "Vykládka nafty"
}
username-cn           ""
string-table-cn {
  coalmine_loadbay1       "#1"
  coalmine_loadbay2       "#2"
  coalmine_loadbay3       "#3"
  coalmine_loadbay4       "#4"
  coalmine_dieselunload       ""
}
name-ru             "name"
username-ru           "Угольная шахта"
string-table-ru {
  coalmine_loadbay1       "Погрузка угля #1"
  coalmine_loadbay2       "Погрузка угля #2"
  coalmine_loadbay3       "Погрузка угля #3"
  coalmine_loadbay4       "Погрузка угля #4"
  coalmine_dieselunload       "Выгрузка дизтоплива"
}
username-fr           "Mine de charbon"
string-table-fr {
  coalmine_loadbay1                                                                      "Dock de charge de charbon #1"
  coalmine_loadbay2                                                                      "Dock de charge de charbon #2"
  coalmine_loadbay3                                                                      "Dock de charge de charbon #3"
  coalmine_loadbay4                           "Dock de charge de charbon #4"
  coalmine_dieselunload                                                              "Dock de décharge de diesel"
}

coalmine.gs:

include "BaseIndustry.gs"

//
//
//
class CoalMine isclass BaseIndustry
{
  ProductQueue coalOutQueue, dieselInQueue;
  bool scriptletEnabled = true;
  //bool nodiesel = false;
  bool animating = false;
  bool processing = false;

  // Track if they only supply some of the logs that were requested in the waybill.
  int dieselWBRemain = 0;

  //
  //
  //

  bool TriggerSupportsMovingLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
      if (triggerName == "out_load0" or triggerName == "out_load1" or triggerName == "out_load2" or triggerName == "out_load3")
        return true;

    return false;
  }

  void PerformMovingLoad(Vehicle vehicle, string triggerName)
  {
    //
    // OUTPUT trigger - load
    //
    float speed = vehicle.GetVelocity();

    if (speed > -5.0f and speed < 5.0f)
    {
      int coalAvailable = coalOutQueue.GetQueueCount();
      if (triggerName == "out_load0")
      {
        SendMessage(me, "pfx", "+2");
        //World.PlaySound("coal_load.wav");
        LoadingReport report = CreateLoadingReport(coalOutQueue, coalAvailable);
        vehicle.LoadProduct(report);
        SendMessage(me, "pfx", "-2");
      }
      if (triggerName == "out_load1")
      {
        SendMessage(me, "pfx", "+3");
        //World.PlaySound("coal_load.wav");
        LoadingReport report = CreateLoadingReport(coalOutQueue, coalAvailable);
        vehicle.LoadProduct(report);
        SendMessage(me, "pfx", "-3");
      }
      if (triggerName == "out_load2")
      {
        SendMessage(me, "pfx", "+4");
        //World.PlaySound("coal_load.wav");
        LoadingReport report = CreateLoadingReport(coalOutQueue, coalAvailable);
        vehicle.LoadProduct(report);
        SendMessage(me, "pfx", "-4");
      }
      if (triggerName == "out_load3")
      {
        SendMessage(me, "pfx", "+5");
        //World.PlaySound("coal_load.wav");
        LoadingReport report = CreateLoadingReport(coalOutQueue, coalAvailable);
        vehicle.LoadProduct(report);
        SendMessage(me, "pfx", "-5");
      }
    }
  }

  //
  //
  //

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
    {
      bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();
      int direction = vehicle.GetRelationToTrack(me, "in_track0");
      if (!vehicleToTrain)
        direction = -direction;

      // Are we up to the furthest trigger away from the side we entered for diesel?
      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "in_load0")
        return true;
      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "in_load3")
        return true;

      // If the train has already stopped, then fall thru and allow this load as well
      if (triggerName == "in_load0" or triggerName == "in_load1" or triggerName == "in_load2" or triggerName == "in_load3")
      {
        if (vehicle.GetMyTrain().IsStopped())
          return true;
      }
    }

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    int spaceAvailable = dieselInQueue.GetQueueSpace();
    LoadingReport report = CreateUnloadingReport(dieselInQueue, spaceAvailable);

    int direction = vehicle.GetRelationToTrack(me, "in_track0");
    if (direction == Vehicle.DIRECTION_FORWARD)
      report.sideFlags = LoadingReport.LEFT_SIDE;
    else if (direction == Vehicle.DIRECTION_BACKWARD)
      report.sideFlags = LoadingReport.RIGHT_SIDE;

    vehicle.UnloadProduct(report);

    // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
    if (dieselWBRemain > 0)
      dieselWBRemain = dieselWBRemain - report.amount;

    /*if (report.amount > 0)
    {
      nodiesel = false;
      SetMeshAnimationFrame("default", 2);
      StartMeshAnimationLoop("default");
    }*/
  }

  //
  // ?
  //
  thread void CoalMain(void)
  {
    Message msg;

    wait()
    {
      on "Scriptlet-Enabled", "1":
      {
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("coal_consumer", true);
        }
        continue;
      }

      // ? Power station is providing electricity, if not already running. start the
      on "Scriptlet-Enabled", "0":
      {
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("coal_consumer", false);
        }
        continue;
      }

      // logs_consumer process in lumber mill has started, so active smoke stack particles and
      // start the animation (forklift & conveyor)
      on "Process-Start", "coal_consumer":
        //Interface.Print("CoalMine.LumberMain(): Process-Start:coal_consumer message received, starting default animation amd smoke stack particles");

        SendMessage(me, "pfx", "+0+1");

        if (animating) // only start animating if animation isn't already running
          StartMeshAnimationLoop("default");

        continue;

      // logs_consumer process has stopped, disable particle effect and stop animation
      on "Process-Stop", "coal_consumer":
        //Interface.Print("CoalMine.LumberMain(): Process-Stop:coal_consumer message received, stopping default animation and smoke stack particles");

        SendMessage(me, "pfx", "-0-1");
        StopMeshAnimation("default");
        continue;

      // ?
      on "Animation-Event", "animstop":
      {
        //if (!(GetProcessStarted("logs_consumer") and GetProcessEnabled("logs_consumer")))
        //Interface.Print("Animation-Event: animstop message received, stopping default animation!");

        StopMeshAnimation("default");

        // make sure we didn't overshoot the end of the animation
        SetMeshAnimationFrame("default", 2);

        // it's actually possible to receive the Animation-Event message multiple times, even
        // though we tell the game engine to stop the animation. this can occur if the frame-rate
        // is low and the animation repeats multiple times inside one frame. it's important that we
        // check for this situation, otherwise a script exception will result.
        if (animating)
        {
          animating = false;

          if (!processing)
          {
            // we are making the assumption that there is only one process, "coal_consumer"
            // if there were more, we would have to be careful to finish the correct process here
            PerformProcessOutput("coal_consumer");
            PerformProcessFinished("coal_consumer");
          }
        }

        continue;
      }

    }
  }

  //
  // Called by the game once when a process is ready to start (see Industry.gs)
  //
  void NotifyProcessStarted(string processName)
  {
    //Interface.Print("CoalMine.NotifyProcessFinished: Process Started");

    if (scriptletEnabled) // only when power is running
    {

      if (PerformProcessInput(processName))
      {
        //Interface.Print("NotifyProcessStarted: Starting the default animation!");

        // we are making the assumption that there is only one process, "logs_consumer"
        SetMeshAnimationFrame("default", 2);
        StartMeshAnimationLoop("default");

        animating = true;
        processing = true;

        PerformProcessStarted(processName);
      }
      else
        PerformProcessCancelled(processName);

    }

  }

  // called by the game once when a process is ready to stop (see Industry.gs)
  void NotifyProcessFinished(string processName)
  {
    //Interface.Print("CoalMine.NotifyProcessFinished: Process Finished");

    if (scriptletEnabled)
    {
      processing = false;

      if (!animating)
      {
        PerformProcessOutput(processName);
        PerformProcessFinished(processName);
    PostMessage(me, "GenericIndustry", "ProcessComplete", 0.0f);
      }
    }

    //if (GetProcessInput(processName, dieselInQueue, GetAsset().FindAsset("diesel")) <= 0)
    //{
      //nodiesel = true;
      //StopMeshAnimation("default");
      //SetMeshAnimationFrame("default", 1098);
    //}
  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    usePipeAnimation = true;
    useGenericViewDetails = true;

    coalOutQueue = GetQueue("coal_out");
    dieselInQueue = GetQueue("diesel_in");

    AddAssetToIndustryProductInfo("diesel", "diesel_in", "coal_consumer", true);
    AddAssetToIndustryProductInfo("coal", "coal_out", "coal_consumer", false);

    // Enabled or disabled on startup? (Depends on if we have fuel! :D)
    /*if (dieselInQueue.GetQueueCount() > 0)
    {
      nodiesel = false;
      SetMeshAnimationFrame("default", 2);
      StartMeshAnimationLoop("default");
    }
    else
    {
      nodiesel = true;
      StopMeshAnimation("default");
      SetMeshAnimationFrame("default", 1098);
    }*/

    CoalMain();
  }

  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret = new Requirement[0];

    if (dieselInQueue.GetQueueCount() < 77600 or dieselWBRemain > 0) // Approx 25% of full
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = dieselInQueue.GetProductFilter().GetProducts()[0];
      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 232800;        // 6 tank cars
      if (dieselInQueue.GetQueueCount() < 77600 and dieselWBRemain == 0)
        dieselWBRemain = 232800;
      req.dst = me;
      req.dstQueue = dieselInQueue;

      ret[ret.size()] = req;
    }

    return ret;
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("coalmine_loadBay1");
    destTracks[destTracks.size()] = "out_track0";

    destNames[destNames.size()] = stringTable.GetString("coalmine_loadBay2");
    destTracks[destTracks.size()] = "out_track1";

    destNames[destNames.size()] = stringTable.GetString("coalmine_loadBay3");
    destTracks[destTracks.size()] = "out_track2";

    destNames[destNames.size()] = stringTable.GetString("coalmine_loadBay4");
    destTracks[destTracks.size()] = "out_track3";

    destNames[destNames.size()] = stringTable.GetString("coalmine_dieselUnload");
    destTracks[destTracks.size()] = "in_track0";
  }
};


Container Station
[Industries]

Container Station Industry

config.txt:

﻿
kind              "industry"
region              "TRS2004"
kuid              <kuid:-3:10086>
type              "Industrial"
username            "Container Station"
light             1
script              "container_station"
class             "container_station"
icon-texture            "icon_containerstation.tga"
kuid-table {
  gen_goods         <kuid:-3:10013>
  20ft_container          <kuid:-3:10014>
  40ft_container          <kuid:-3:10041>
}
mesh-table {
  default {
    mesh          "container_station.im"
    auto-create       1
    anim          "anim.kin"
    animation-loop-speed      1
    effects {
      0 {
        kind      "name"
        fontsize    0.4
        fontcolor   10,10,10
        att     "a.name0"
        name      "name"
      }
      1 {
        kind      "name"
        fontsize    0.18
        fontcolor   10,10,10
        att     "a.name1"
        name      "name"
      }
      2 {
        kind      "name"
        fontsize    0.18
        fontcolor   10,10,10
        att     "a.name2"
        name      "name"
      }
    }
  }
}
smoke0 {
  attachment          "a.smoke0"
  mode            "time"
  color           50,50,50,255
  start           0
  period            86400
  rate            2
  velocity          2
  lifetime          1
  minsize           0.5
  maxsize           2
}
attached-track {
  out_track0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
      4       "a.track0e"
      5       "a.track0f"
    }
  }
  out_track2 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track2a"
      1       "a.track2b"
      2       "a.track2c"
      3       "a.track2d"
      4       "a.track2e"
      5       "a.track2f"
    }
  }
  in_track1 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1a"
      1       "a.track1b"
      2       "a.track1c"
      3       "a.track1d"
      4       "a.track1e"
      5       "a.track1f"
    }
  }
}
queues {
  20ft_cont_q {
    size          180
    initial-count       73
    product-kuid        <kuid:-3:10014>
    attachment-points {
      0       "a.20cont0"
      1       "a.20cont1"
      2       "a.20cont2"
      3       "a.20cont3"
      4       "a.20cont4"
      5       "a.20cont5"
      6       "a.20cont6"
      7       "a.20cont7"
      8       "a.20cont8"
      9       "a.20cont9"
      10        "a.20cont10"
      11        "a.20cont11"
      12        "a.20cont12"
      13        "a.20cont13"
      14        "a.20cont14"
      15        "a.20cont15"
      16        "a.20cont16"
      17        "a.20cont17"
      18        "a.20cont18"
      19        "a.20cont19"
      20        "a.20cont20"
      21        "a.20cont21"
      22        "a.20cont22"
      23        "a.20cont23"
      24        "a.20cont24"
      25        "a.20cont25"
      26        "a.20cont26"
      27        "a.20cont27"
      28        "a.20cont28"
      29        "a.20cont29"
      30        "a.20cont30"
      31        "a.20cont31"
      32        "a.20cont32"
      33        "a.20cont33"
      34        "a.20cont34"
      35        "a.20cont35"
      36        "a.20cont36"
      37        "a.20cont37"
      38        "a.20cont38"
      39        "a.20cont39"
      40        "a.20cont40"
      41        "a.20cont41"
      42        "a.20cont42"
      43        "a.20cont43"
      44        "a.20cont44"
      45        "a.20cont45"
      46        "a.20cont46"
      47        "a.20cont47"
      48        "a.20cont48"
      49        "a.20cont49"
      50        "a.20cont50"
      51        "a.20cont51"
      52        "a.20cont52"
      53        "a.20cont53"
      54        "a.20cont54"
      55        "a.20cont55"
      56        "a.20cont56"
      57        "a.20cont57"
      58        "a.20cont58"
      59        "a.20cont59"
      60        "a.20cont60"
      61        "a.20cont61"
      62        "a.20cont62"
      63        "a.20cont63"
      64        "a.20cont64"
      65        "a.20cont65"
      66        "a.20cont66"
      67        "a.20cont67"
      68        "a.20cont68"
      69        "a.20cont69"
      70        "a.20cont70"
      71        "a.20cont71"
      72        "a.20cont72"
      73        "a.20cont73"
      74        "a.20cont74"
      75        "a.20cont75"
      76        "a.20cont76"
      77        "a.20cont77"
      78        "a.20cont78"
      79        "a.20cont79"
      80        "a.20cont80"
      81        "a.20cont81"
      82        "a.20cont82"
      83        "a.20cont83"
      84        "a.20cont84"
      85        "a.20cont85"
      86        "a.20cont86"
      87        "a.20cont87"
      88        "a.20cont88"
      89        "a.20cont89"
      90        "a.20cont90"
      91        "a.20cont91"
      92        "a.20cont92"
      93        "a.20cont93"
      94        "a.20cont94"
      95        "a.20cont95"
      96        "a.20cont96"
      97        "a.20cont97"
      98        "a.20cont98"
      99        "a.20cont99"
      100       "a.20cont100"
      101       "a.20cont101"
      102       "a.20cont102"
      103       "a.20cont103"
      104       "a.20cont104"
      105       "a.20cont105"
      106       "a.20cont106"
      107       "a.20cont107"
      108       "a.20cont108"
      109       "a.20cont109"
      110       "a.20cont110"
      111       "a.20cont111"
      112       "a.20cont112"
      113       "a.20cont113"
      114       "a.20cont114"
      115       "a.20cont115"
      116       "a.20cont116"
      117       "a.20cont117"
      118       "a.20cont118"
      119       "a.20cont119"
      120       "a.20cont120"
      121       "a.20cont121"
      122       "a.20cont122"
      123       "a.20cont123"
      124       "a.20cont124"
      125       "a.20cont125"
      126       "a.20cont126"
      127       "a.20cont127"
      128       "a.20cont128"
      129       "a.20cont129"
      130       "a.20cont130"
      131       "a.20cont131"
      132       "a.20cont132"
      133       "a.20cont133"
      134       "a.20cont134"
      135       "a.20cont135"
      136       "a.20cont136"
      137       "a.20cont137"
      138       "a.20cont138"
      139       "a.20cont139"
      140       "a.20cont140"
      141       "a.20cont141"
      142       "a.20cont142"
      143       "a.20cont143"
      144       "a.20cont144"
      145       "a.20cont145"
      146       "a.20cont146"
      147       "a.20cont147"
      148       "a.20cont148"
      149       "a.20cont149"
      150       "a.20cont150"
      151       "a.20cont151"
      152       "a.20cont152"
      153       "a.20cont153"
      154       "a.20cont154"
      155       "a.20cont155"
      156       "a.20cont156"
      157       "a.20cont157"
      158       "a.20cont158"
      159       "a.20cont159"
      160       "a.20cont160"
      161       "a.20cont161"
      162       "a.20cont162"
      163       "a.20cont163"
      164       "a.20cont164"
      165       "a.20cont165"
      166       "a.20cont166"
      167       "a.20cont167"
      168       "a.20cont168"
      169       "a.20cont169"
      170       "a.20cont170"
      171       "a.20cont171"
      172       "a.20cont172"
      173       "a.20cont173"
      174       "a.20cont174"
      175       "a.20cont175"
      176       "a.20cont176"
      177       "a.20cont177"
      178       "a.20cont178"
      179       "a.20cont179"
    }
  }
  40ft_cont_q {
    size          168
    initial-count       48
    product-kuid        <kuid:-3:10041>
    attachment-points {
      0       "a.40cont0"
      1       "a.40cont1"
      2       "a.40cont2"
      3       "a.40cont3"
      4       "a.40cont4"
      5       "a.40cont5"
      6       "a.40cont6"
      7       "a.40cont7"
      8       "a.40cont8"
      9       "a.40cont9"
      10        "a.40cont10"
      11        "a.40cont11"
      12        "a.40cont12"
      13        "a.40cont13"
      14        "a.40cont14"
      15        "a.40cont15"
      16        "a.40cont16"
      17        "a.40cont17"
      18        "a.40cont18"
      19        "a.40cont19"
      20        "a.40cont20"
      21        "a.40cont21"
      22        "a.40cont22"
      23        "a.40cont23"
      24        "a.40cont24"
      25        "a.40cont25"
      26        "a.40cont26"
      27        "a.40cont27"
      28        "a.40cont28"
      29        "a.40cont29"
      30        "a.40cont30"
      31        "a.40cont31"
      32        "a.40cont32"
      33        "a.40cont33"
      34        "a.40cont34"
      35        "a.40cont35"
      36        "a.40cont36"
      37        "a.40cont37"
      38        "a.40cont38"
      39        "a.40cont39"
      40        "a.40cont40"
      41        "a.40cont41"
      42        "a.40cont42"
      43        "a.40cont43"
      44        "a.40cont44"
      45        "a.40cont45"
      46        "a.40cont46"
      47        "a.40cont47"
      48        "a.40cont48"
      49        "a.40cont49"
      50        "a.40cont50"
      51        "a.40cont51"
      52        "a.40cont52"
      53        "a.40cont53"
      54        "a.40cont54"
      55        "a.40cont55"
      56        "a.40cont56"
      57        "a.40cont57"
      58        "a.40cont58"
      59        "a.40cont59"
      60        "a.40cont60"
      61        "a.40cont61"
      62        "a.40cont62"
      63        "a.40cont63"
      64        "a.40cont64"
      65        "a.40cont65"
      66        "a.40cont66"
      67        "a.40cont67"
      68        "a.40cont68"
      69        "a.40cont69"
      70        "a.40cont70"
      71        "a.40cont71"
      72        "a.40cont72"
      73        "a.40cont73"
      74        "a.40cont74"
      75        "a.40cont75"
      76        "a.40cont76"
      77        "a.40cont77"
      78        "a.40cont78"
      79        "a.40cont79"
      80        "a.40cont80"
      81        "a.40cont81"
      82        "a.40cont82"
      83        "a.40cont83"
      84        "a.40cont84"
      85        "a.40cont85"
      86        "a.40cont86"
      87        "a.40cont87"
      88        "a.40cont88"
      89        "a.40cont89"
      90        "a.40cont90"
      91        "a.40cont91"
      92        "a.40cont92"
      93        "a.40cont93"
      94        "a.40cont94"
      95        "a.40cont95"
      96        "a.40cont96"
      97        "a.40cont97"
      98        "a.40cont98"
      99        "a.40cont99"
      100       "a.40cont100"
      101       "a.40cont101"
      102       "a.40cont102"
      103       "a.40cont103"
      104       "a.40cont104"
      105       "a.40cont105"
      106       "a.40cont106"
      107       "a.40cont107"
      108       "a.40cont108"
      109       "a.40cont109"
      110       "a.40cont110"
      111       "a.40cont111"
      112       "a.40cont112"
      113       "a.40cont113"
      114       "a.40cont114"
      115       "a.40cont115"
      116       "a.40cont116"
      117       "a.40cont117"
      118       "a.40cont118"
      119       "a.40cont119"
      120       "a.40cont120"
      121       "a.40cont121"
      122       "a.40cont122"
      123       "a.40cont123"
      124       "a.40cont124"
      125       "a.40cont125"
      126       "a.40cont126"
      127       "a.40cont127"
      128       "a.40cont128"
      129       "a.40cont129"
      130       "a.40cont130"
      131       "a.40cont131"
      132       "a.40cont132"
      133       "a.40cont133"
      134       "a.40cont134"
      135       "a.40cont135"
      136       "a.40cont136"
      137       "a.40cont137"
      138       "a.40cont138"
      139       "a.40cont139"
      140       "a.40cont140"
      141       "a.40cont141"
      142       "a.40cont142"
      143       "a.40cont143"
      144       "a.40cont144"
      145       "a.40cont145"
      146       "a.40cont146"
      147       "a.40cont147"
      148       "a.40cont148"
      149       "a.40cont149"
      150       "a.40cont150"
      151       "a.40cont151"
      152       "a.40cont152"
      153       "a.40cont153"
      154       "a.40cont154"
      155       "a.40cont155"
      156       "a.40cont156"
      157       "a.40cont157"
      158       "a.40cont158"
      159       "a.40cont159"
      160       "a.40cont160"
      161       "a.40cont161"
      162       "a.40cont162"
      163       "a.40cont163"
      164       "a.40cont164"
      165       "a.40cont165"
      166       "a.40cont166"
      167       "a.40cont167"
    }
  }
  gen_goods_q {
    size          106
    initial-count       95
    product-kuid        <kuid:-3:10013>
    attachment-points {
      0       "a.gen_goods0"
      1       "a.gen_goods1"
      2       "a.gen_goods2"
      3       "a.gen_goods3"
      4       "a.gen_goods4"
      5       "a.gen_goods5"
      6       "a.gen_goods6"
      7       "a.gen_goods7"
      8       "a.gen_goods8"
      9       "a.gen_goods9"
      10        "a.gen_goods10"
      11        "a.gen_goods11"
      12        "a.gen_goods12"
      13        "a.gen_goods13"
      14        "a.gen_goods14"
      15        "a.gen_goods15"
      16        "a.gen_goods16"
      17        "a.gen_goods17"
      18        "a.gen_goods18"
      19        "a.gen_goods19"
      20        "a.gen_goods20"
      21        "a.gen_goods21"
      22        "a.gen_goods22"
      23        "a.gen_goods23"
      24        "a.gen_goods24"
      25        "a.gen_goods25"
      26        "a.gen_goods26"
      27        "a.gen_goods27"
      28        "a.gen_goods28"
      29        "a.gen_goods29"
      30        "a.gen_goods30"
      31        "a.gen_goods31"
      32        "a.gen_goods32"
      33        "a.gen_goods33"
      34        "a.gen_goods34"
      35        "a.gen_goods35"
      36        "a.gen_goods36"
      37        "a.gen_goods37"
      38        "a.gen_goods38"
      39        "a.gen_goods39"
      40        "a.gen_goods40"
      41        "a.gen_goods41"
      42        "a.gen_goods42"
      43        "a.gen_goods43"
      44        "a.gen_goods44"
      45        "a.gen_goods45"
      46        "a.gen_goods46"
      47        "a.gen_goods47"
      48        "a.gen_goods48"
      49        "a.gen_goods49"
      50        "a.gen_goods50"
      51        "a.gen_goods51"
      52        "a.gen_goods52"
      53        "a.gen_goods53"
      54        "a.gen_goods54"
      55        "a.gen_goods55"
      56        "a.gen_goods56"
      57        "a.gen_goods57"
      58        "a.gen_goods58"
      59        "a.gen_goods59"
      60        "a.gen_goods60"
      61        "a.gen_goods61"
      62        "a.gen_goods62"
      63        "a.gen_goods63"
      64        "a.gen_goods64"
      65        "a.gen_goods65"
      66        "a.gen_goods66"
      67        "a.gen_goods67"
      68        "a.gen_goods68"
      69        "a.gen_goods69"
      70        "a.gen_goods70"
      71        "a.gen_goods71"
      72        "a.gen_goods72"
      73        "a.gen_goods73"
      74        "a.gen_goods74"
      75        "a.gen_goods75"
      76        "a.gen_goods76"
      77        "a.gen_goods77"
      78        "a.gen_goods78"
      79        "a.gen_goods79"
      80        "a.gen_goods80"
      81        "a.gen_goods81"
      82        "a.gen_goods82"
      83        "a.gen_goods83"
      84        "a.gen_goods84"
      85        "a.gen_goods85"
      86        "a.gen_goods86"
      87        "a.gen_goods87"
      88        "a.gen_goods88"
      89        "a.gen_goods89"
      90        "a.gen_goods90"
      91        "a.gen_goods91"
      92        "a.gen_goods92"
      93        "a.gen_goods93"
      94        "a.gen_goods94"
      95        "a.gen_goods95"
      96        "a.gen_goods96"
      97        "a.gen_goods97"
      98        "a.gen_goods98"
      99        "a.gen_goods99"
      100       "a.gen_goods100"
      101       "a.gen_goods101"
      102       "a.gen_goods102"
      103       "a.gen_goods103"
      104       "a.gen_goods104"
      105       "a.gen_goods105"
    }
  }
}
processes {
  container_packing {
    start-enabled       1
    duration        60
    inputs {
      0 {
        amount      6
        queue     "gen_goods_q"
      }
    }
    outputs {
      0 {
        amount      3
        queue     "20ft_cont_q"
      }
      1 {
        amount      3
        queue     "40ft_cont_q"
      }
    }
  }
}
attached-trigger {
  20cont_t {
    att         "a.trig0"
    radius          15
  }
  40cont_t {
    att         "a.trig2"
    radius          15
  }
  gen_goods_t {
    att         "a.trig1"
    radius          20
  }
}
icon0             <kuid:-3:10164>
string-table {
  container_20pickup        "20ft Container pickup"
  container_40pickup        "40ft Container pickup"
  container_generaldropoff      "General Goods drop off"
}
username-de           "Container Bahnhof"
string-table-de {
  container_20pickup        "20ft Container aufnehmen"
  container_40pickup        "40ft Container aufnehmen"
  container_generaldropoff      "Allgemeine Güter abladen"
}
username-it           "Container - Stazione"
string-table-it {
  container_20pickup        "Raccolta container 6m"
  container_40pickup        "Raccolta container 12m"
  container_generaldropoff      "Scarico merci varie"
}
username-es           "Estación de contenedores"
string-table-es {
  container_20pickup        "Recogida de contenedor 20p"
  container_40pickup        "Recogida de contenedor 40p"
  container_generaldropoff      "Entrega de mercancía general"
}
username-pl           "Stacja kontenerowa"
string-table-pl {
  container_20pickup        "Punkt załadunku kontenerów 20-stopowych"
  container_40pickup        "Punkt załadunku kontenerów 40-stopowych"
  container_generaldropoff      "Punkt rozładunku drobnicy"
}
username-cz           "Skladiště kontejnerů"
string-table-cz {
  container_20pickup        "Nakládka kontejnerů 20ft"
  container_40pickup        "Nakládka kontejnerů 40ft"
  container_generaldropoff      "Vykládka zboží"
}
username-cn           "貨櫃月台"
string-table-cn {
  container_20pickup        "20ft 貨櫃裝載"
  container_40pickup        "40ft貨櫃裝載"
  container_generaldropoff      "一般貨物卸貨"
}
username-ru           "Контейнерная станция"
string-table-ru {
  container_20pickup        "Погрузка 6м контейнеров"
  container_40pickup        "Погрузка 12м контейнеров"
  container_generaldropoff      "Выгрузка товаров"
}
username-fr           "Gare conteneurs"
string-table-fr {
  container_20pickup                                                                    "Charge de conteneur de 20pieds"
  container_40pickup                                                                    "Charge de conteneur de 40pieds"
  container_generaldropoff                                                        "Décharge générale de marchandises"
}

container_station.gs:

include "BaseIndustry.gs"

//
// ?
//
class container_station isclass BaseIndustry
{
  ProductQueue gengoodsInQueue, cont20OutQueue, cont40OutQueue;
  bool processing = false;        // is the log consumer process currently running?
  bool scriptletEnabled = true;  // state of power supply (must be true for this mill to run)

  // Track if they only supply some of the logs that were requested in the waybill.
  int goodsWBRemain = 0;

  //
  //
  //

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
      if (triggerName == "20cont_t" or triggerName == "40cont_t")
        return true;
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
      if (triggerName == "gen_goods_t")
        return true;

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (triggerName == "20cont_t")
    {
      int spaceAvailable = cont20OutQueue.GetQueueCount();
      LoadingReport report = CreateLoadingReport(cont20OutQueue, spaceAvailable);

      /*
      int direction = vehicle.GetRelationToTrack(me, "out_track0");
      if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;
      */

      vehicle.LoadProduct(report);
    }

    if (triggerName == "40cont_t")
    {
      int spaceAvailable = cont40OutQueue.GetQueueCount();
      LoadingReport report = CreateLoadingReport(cont40OutQueue, spaceAvailable);

      /*
      int direction = vehicle.GetRelationToTrack(me, "out_track2");
      if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;
      */

      vehicle.LoadProduct(report);
    }

    if (triggerName == "gen_goods_t")
    {
      int spaceAvailable = gengoodsInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(gengoodsInQueue, spaceAvailable);

      /*
      int direction = vehicle.GetRelationToTrack(me, "out_track1");
      if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;
      */

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (goodsWBRemain > 0)
        goodsWBRemain = goodsWBRemain - report.amount;

    }
  }

  //
  // Thread that runs this lumber mill scriplet.
  //
  thread void contStationMain(void)
  {
    Message msg;
    Vehicle vehicle;
    string triggerName;

    //
    wait()
    {

      // container_packing process in lumber mill has started, so active smoke stack particles and
      // start the animation (forklift & conveyor)
      on "Process-Start", "container_packing":
      {
        SendMessage(me, "pfx", "+0");
        StartMeshAnimationLoop("default");
        continue;
      }

      // container_packing process has stopped, disable particle effect and stop animation
      on "Process-Stop", "container_packing":
      {
        SendMessage(me, "pfx", "-0");
        StopMeshAnimation("default");
        continue;
      }

      // Messages with a major of "Scriptlet-Enabled" are sent by the PowerStationRule scriplet
      // when the power station's coal consumption process has started (minor = "1") or stopped
      // (minor = "0").

      // Power station is providing electricity, if not already running. start the
      on "Scriptlet-Enabled", "1":
      {
        //Interface.Print("Enable script ");
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("container_packing", true);
        }
        continue;
      }

      // ? Power station is providing electricity, if not already running. start the
      on "Scriptlet-Enabled", "0":
      {
        //Interface.Print("Disable script ");
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("container_packing", false);
        }
        continue;
      }

    }
  }

  //
  // Called by the game once when a process is ready to start (see Industry.gs)
  //
  void NotifyProcessStarted(string processName)
  {
    if (scriptletEnabled) // only when power is running
    {

      if (PerformProcessInput(processName))
      {
        // we are making the assumption that there is only one process, "container_packing"
        SetMeshAnimationFrame("default", 0);
        StartMeshAnimationLoop("default");

        processing = true;

        PerformProcessStarted(processName);
      }
      else
        PerformProcessCancelled(processName);

    }

  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    useGenericViewDetails = true;

    gengoodsInQueue = GetQueue("gen_goods_q");
    cont20OutQueue = GetQueue("20ft_cont_q");
    cont40OutQueue = GetQueue("40ft_cont_q");

    AddAssetToIndustryProductInfo("gen_goods", "gen_goods_q", "container_packing", true);
    AddAssetToIndustryProductInfo("20ft_container", "20ft_cont_q", "container_packing", false);
    AddAssetToIndustryProductInfo("40ft_container", "40ft_cont_q", "container_packing", false);

    //
    StopMeshAnimation("default");
    SetMeshAnimationFrame("default", 875.5);

    // Start main thread to process messages and run the lumber mill.
    contStationMain();
  }

  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret;

    if (gengoodsInQueue.GetQueueCount() < 30 or goodsWBRemain > 0) // approx 30% of full
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = gengoodsInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 75;
      if (gengoodsInQueue.GetQueueCount() < 30 and goodsWBRemain == 0)
        goodsWBRemain = 75;

      req.dst = me;
      req.dstQueue = gengoodsInQueue;

      ret = new Requirement[1];
      ret[0] = req;
    }

    return ret;
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("container_20pickup");
    destTracks[destTracks.size()] = "out_track0";

    destNames[destNames.size()] = stringTable.GetString("container_40pickup");
    destTracks[destTracks.size()] = "out_track2";

    destNames[destNames.size()] = stringTable.GetString("container_generalDropoff");
    destTracks[destTracks.size()] = "in_track1";
  }

};


Forestry
[Industries]

Forestry Industry

config.txt:

﻿
username            "Forestry"
kind              "industry"
light             1
region              "TRS2004"
kuid              <kuid:-3:10052>
type              "Industrial"
script              "forestry"
class             "forestry"
icon-texture            "icon_forestry.tga"
kuid-table {
  logs            <kuid:-3:10001>
}
mesh-table {
  default {
    mesh          "forestry.lm"
    anim          "anim.kin"
    critical-animation      1
    auto-create       1
    animation-loop-speed      1
  }
}
attached-track {
  out_track0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
    }
  }
}
attached-trigger {
  out_load0 {
    att         "a.trig0"
    radius          12
  }
}
soundscript {
  loader {
    attachment        "a.sound"
    repeat-delay        0
    distance        10,200
    sound {
      loader.wav
    }
  }
  saw0 {
    trigger         "chainsaw0"
    nostartdelay        1
    repeat-delay        1
    distance        10,300
    sound {
      chainsaw.wav
    }
  }
  saw1 {
    trigger         "chainsaw1"
    nostartdelay        1
    repeat-delay        1
    distance        10,300
    sound {
      chainsaw.wav
    }
  }
  saw2 {
    trigger         "chainsaw2"
    nostartdelay        1
    repeat-delay        1
    distance        10,300
    attachment        "a.sound2"
    sound {
      chainsaw.wav
    }
  }
  saw3 {
    trigger         "chainsaw3"
    nostartdelay        1
    repeat-delay        1
    distance        5,200
    attachment        "a.sound2"
    sound {
      chainsaw.wav
    }
  }
  treefall {
    trigger         "treefall"
    nostartdelay        1
    repeat-delay        1
    distance        10,300
    sound {
      tree_falling.wav
    }
  }
  firstclunk {
    attachment        "a.sound"
    trigger         "clunk0"
    nostartdelay        1
    repeat-delay        1
    distance        10,300
    sound {
      clunk.wav
    }
  }
  secondclunk {
    attachment        "a.sound"
    trigger         "clunk1"
    nostartdelay        1
    repeat-delay        1
    distance        10,300
    sound {
      clunk.wav
    }
  }
  backup1 {
    attachment        "a.sound"
    trigger         "reverse1"
    repeat-delay        0
    distance        5,100
    sound {
      warning.wav
    }
  }
  backup2 {
    attachment        "a.sound"
    trigger         "reverse2"
    repeat-delay        0
    distance        5,100
    sound {
      warning.wav
    }
  }
}
queues {
  logs_out {
    size          45
    allowed-products {
      0       <kuid:-3:10001>
    }
    product-kuid        <kuid:-3:10001>
    initial-count       25
    attachment-points {
      0       "a.log0"
      1       "a.log1"
      2       "a.log2"
      3       "a.log3"
      4       "a.log4"
      5       "a.log5"
      6       "a.log6"
      7       "a.log7"
      8       "a.log8"
      9       "a.log9"
      10        "a.log10"
      11        "a.log11"
      12        "a.log12"
      13        "a.log13"
      14        "a.log14"
      15        "a.log15"
      16        "a.log16"
      17        "a.log17"
      18        "a.log18"
      19        "a.log19"
      20        "a.log20"
      21        "a.log21"
      22        "a.log22"
      23        "a.log23"
      24        "a.log24"
      25        "a.log25"
      26        "a.log26"
      27        "a.log27"
      28        "a.log28"
      29        "a.log29"
      30        "a.log30"
      31        "a.log31"
      32        "a.log32"
      33        "a.log33"
      34        "a.log34"
      35        "a.log35"
      36        "a.log36"
      37        "a.log37"
      38        "a.log38"
      39        "a.log39"
      40        "a.log40"
      41        "a.log41"
      42        "a.log42"
      43        "a.log43"
      44        "a.log44"
    }
  }
}
processes {
  tree_lopping {
    start-enabled       1
    duration        30
    outputs {
      0 {
        amount      1
        queue     "logs_out"
      }
    }
  }
}
icon0             <kuid:-3:10164>
string-table {
  forestry_logpickup        "Log pickup"
}
username-de           "Forstwirtschaft"
string-table-de {
  forestry_logpickup        "Baumstämme aufnehmen"
}
username-it           "Silvicoltura"
string-table-it {
  forestry_logpickup        "Raccolta tronchi"
}
username-es           "Bosque"
string-table-es {
  forestry_logpickup        "Recogida de troncos"
}
username-pl           "Leśnictwo"
string-table-pl {
  forestry_logpickup        "Punkt załadunku dłużyc"
}
username-cz           "Lesní závod"
string-table-cz {
  forestry_logpickup        "Nakládka klád"
}
username-ru           "Лес"
string-table-ru {
  forestry_logpickup        "Погрузка бревен"
}
username-fr           "Foresterie"
string-table-fr {
  forestry_logpickup                                                                    "Charge de billot"
}

forestry.gs:

//
// forestry.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "BaseIndustry.gs"

//
// Refinery industry
//
class forestry isclass BaseIndustry
{
  ProductQueue logsOutQueue;
  bool animating = false;
  bool processing = false;
  bool scriptletEnabled = true;
  bool waitingForOutput = false;

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
      if (triggerName == "out_load0")
        return true;

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    int logsAvailable = logsOutQueue.GetQueueCount();
    LoadingReport report = CreateLoadingReport(logsOutQueue, logsAvailable);
    vehicle.LoadProduct(report);
  }

  bool HandleTrainUnloadCommand(Train train)
  {
    return false;
  }

  //
  //
  //
  thread void TreeLoppingMain(void)
  {
    wait()
    {
      // logs_consumer process in lumber mill has started, so active smoke stack particles and
      // start the animation (forklift & conveyor)
      on "Process-Start", "tree_lopping":
      {
        processing = true;

        if (!animating) // only start animating if animation isn't already running
          StartMeshAnimationLoop("default");

        animating = true;

        continue;
      }

      on "Animation-Event", "animfin":
      {
        // it's actually possible to receive the Animation-Event message multiple times, even
        // though we tell the game engine to stop the animation. this can occur if the frame-rate
        // is low and the animation repeats multiple times inside one frame. it's important that we
        // check for this situation, otherwise a script exception will result.
        if (waitingForOutput)
        {
          waitingForOutput = false;
          PerformProcessFinished("tree_lopping");
          PostMessage(me, "GenericIndustry", "ProcessComplete", 0.0f);

          //autoLoader.ReSendStoppedMessages(me);
          InnerReEnter(-1);

        }
        // If we are no longer processing, then stop the animation
        StopMeshAnimation("default");
        animating = false;

        continue;
      }

      on "Animation-Event", "longdrop":
      {
        // it's actually possible to receive the Animation-Event message multiple times, even
        // though we tell the game engine to stop the animation. this can occur if the frame-rate
        // is low and the animation repeats multiple times inside one frame. it's important that we
        // check for this situation, otherwise a script exception will result.
        // we are making the assumption that there is only one process, "tree_lopping"
        // if there were more, we would have to be careful to finish the correct process here
        if (waitingForOutput)
          PerformProcessOutput("tree_lopping");

        continue;
      }

      // ?
      on "Scriptlet-Enabled", "1":
      {
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("tree_lopping", true);
          StartMeshAnimationLoop("default");
        }
        continue;
      }

      // ?
      on "Scriptlet-Enabled", "0":
      {
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          processing = false;
          animating = false;
          StopMeshAnimation("default");
          SetProcessEnabled("tree_lopping", false);
        }
        continue;
      }
    }
  }

  //
  // Called by the game once when a process is ready to start (see Industry.gs)
  //
  void NotifyProcessStarted(string processName)
  {
    //Interface.Print("NotifyProcessStarted called in lumber mill!");

    if (scriptletEnabled) // only when power is running
    {

      if (PerformProcessInput(processName))
      {
        //Interface.Print("NotifyProcessStarted: Starting the default animation!");

        // we are making the assumption that there is only one process, "logs_consumer"
        SetMeshAnimationFrame("default", 0);
        StartMeshAnimationLoop("default");

        animating = true;
        processing = true;
        //waitingForOutput = true;

        PerformProcessStarted(processName);
      }
      else
      {
        PerformProcessCancelled(processName);
        processing = false;
      }

    }

  }

  // called by the game once when a process is ready to stop (see Industry.gs)
  void NotifyProcessFinished(string processName)
  {
    waitingForOutput = true;
    //processing = false;

/*    if (!animating)
    {
      PerformProcessOutput(processName);
      PerformProcessFinished(processName);
    }*/
  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    useGenericViewDetails = true;

    // initialize queues
    logsOutQueue = GetQueue("logs_out");

    AddAssetToIndustryProductInfo("logs", "logs_out", "tree_lopping", false);

    SetProcessEnabled("tree_lopping", true);
    StartMeshAnimationLoop("default");
    animating = true;
    processing = true;

    TreeLoppingMain();
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("forestry_logPickup");
    destTracks[destTracks.size()] = "out_track0";
  }

};


Hyde Pulp Mill
[Industries]

Hyde Pulp Mill Industry

config.txt:

﻿
username            "Hyde Pulp Mill"
kuid              <kuid:316:27007>
kind              "industry"
light             1
type              "Industrial"
script              "pulpmill"
class             "PulpMill"
icon-texture            "icon_pulpmill.tga"
kuid-table {
  gengoods          <kuid:-3:10013>
  woodchips         <kuid:-3:10002>
}
mesh-table {
  default {
    mesh          "pulpmill.im"
    auto-create       1
  }
  load_woodchips {
    mesh          "woodchips/woodchips.im"
    anim          "woodchips/woodchips.kin"
    auto-create       1
  }
}
attached-track {
  out_track {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
    }
  }
  in_track {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1a"
      1       "a.track1b"
      2       "a.track1c"
      3       "a.track1d"
    }
  }
}
attached-trigger {
  goods_out_t0 {
    att         "a.trig0"
    radius          5
  }
  goods_out_t1 {
    att         "a.trig1"
    radius          5
  }
  goods_out_t2 {
    att         "a.trig2"
    radius          5
  }
  goods_out_t3 {
    att         "a.trig3"
    radius          5
  }
  woodchips_in {
    att         "a.trig5"
    radius          7
  }
}
queues {
  woodchips_q {
    size          302500
    initial-count       121000
    !         "- 121000 = 60500 x 2 Gondolas"
    animated-mesh       "load_woodchips"
    allowed-products {
      0       <kuid:-3:10002>
    }
    product-kuid        <kuid:-3:10002>
  }
  gen_goods_q {
    size          108
    initial-count       45
    product-kuid        <kuid:-3:10013>
    allowed-products {
      0       <kuid:-3:10013>
    }
    attachment-points {
      0       "a.gen_goods0"
      1       "a.gen_goods1"
      2       "a.gen_goods2"
      3       "a.gen_goods3"
      4       "a.gen_goods4"
      5       "a.gen_goods5"
      6       "a.gen_goods6"
      7       "a.gen_goods7"
      8       "a.gen_goods8"
      9       "a.gen_goods9"
      10        "a.gen_goods10"
      11        "a.gen_goods11"
      12        "a.gen_goods12"
      13        "a.gen_goods13"
      14        "a.gen_goods14"
      15        "a.gen_goods15"
      16        "a.gen_goods16"
      17        "a.gen_goods17"
      18        "a.gen_goods18"
      19        "a.gen_goods19"
      20        "a.gen_goods20"
      21        "a.gen_goods21"
      22        "a.gen_goods22"
      23        "a.gen_goods23"
      24        "a.gen_goods24"
      25        "a.gen_goods25"
      26        "a.gen_goods26"
      27        "a.gen_goods27"
      28        "a.gen_goods28"
      29        "a.gen_goods29"
      30        "a.gen_goods30"
      31        "a.gen_goods31"
      32        "a.gen_goods32"
      33        "a.gen_goods33"
      34        "a.gen_goods34"
      35        "a.gen_goods35"
      36        "a.gen_goods36"
      37        "a.gen_goods37"
      38        "a.gen_goods38"
      39        "a.gen_goods39"
      40        "a.gen_goods40"
      41        "a.gen_goods41"
      42        "a.gen_goods42"
      43        "a.gen_goods43"
      44        "a.gen_goods44"
      45        "a.gen_goods45"
      46        "a.gen_goods46"
      47        "a.gen_goods47"
      48        "a.gen_goods48"
      49        "a.gen_goods49"
      50        "a.gen_goods50"
      51        "a.gen_goods51"
      52        "a.gen_goods52"
      53        "a.gen_goods53"
      54        "a.gen_goods54"
      55        "a.gen_goods55"
      56        "a.gen_goods56"
      57        "a.gen_goods57"
      58        "a.gen_goods58"
      59        "a.gen_goods59"
      60        "a.gen_goods60"
      61        "a.gen_goods61"
      62        "a.gen_goods62"
      63        "a.gen_goods63"
      64        "a.gen_goods64"
      65        "a.gen_goods65"
      66        "a.gen_goods66"
      67        "a.gen_goods67"
      68        "a.gen_goods68"
      69        "a.gen_goods69"
      70        "a.gen_goods70"
      71        "a.gen_goods71"
      72        "a.gen_goods72"
      73        "a.gen_goods73"
      74        "a.gen_goods74"
      75        "a.gen_goods75"
      76        "a.gen_goods76"
      77        "a.gen_goods77"
      78        "a.gen_goods78"
      79        "a.gen_goods79"
      80        "a.gen_goods80"
      81        "a.gen_goods81"
      82        "a.gen_goods82"
      83        "a.gen_goods83"
      84        "a.gen_goods84"
      85        "a.gen_goods85"
      86        "a.gen_goods86"
      87        "a.gen_goods87"
      88        "a.gen_goods88"
      89        "a.gen_goods89"
      90        "a.gen_goods90"
      91        "a.gen_goods91"
      92        "a.gen_goods92"
      93        "a.gen_goods93"
      94        "a.gen_goods94"
      95        "a.gen_goods95"
      96        "a.gen_goods96"
      97        "a.gen_goods97"
      98        "a.gen_goods98"
      99        "a.gen_goods99"
      100       "a.gen_goods100"
      101       "a.gen_goods101"
      102       "a.gen_goods102"
      103       "a.gen_goods103"
      104       "a.gen_goods104"
      105       "a.gen_goods105"
      106       "a.gen_goods106"
      107       "a.gen_goods107"
    }
  }
}
processes {
  pulpmill_consumer {
    start-enabled       1
    duration        30
    inputs {
      0 {
        amount      5000
        queue     "woodchips_q"
      }
    }
    outputs {
      0 {
        amount      4
        queue     "gen_goods_q"
      }
    }
  }
}
smoke0 {
  attachment          "a.boilersmoke"
  mode            "timeofday"
  color           150,150,150,250
  accel           1,0.3,0
  start           0.25
  period            0.5
  rate            8
  velocity          3
  lifetime          5
  minsize           0.5
  maxsize           2
}
trainz-build            2
category-region-0         "US"
category-region-1         "CA"
category-era-0            "1890s"
category-era-1            "1900s"
category-era-2            "1940s"
region              "TRS2004"
asset-filename            "hyde_pulp_mill"
category-class            "BI"
description           "
Hyde Pulp Mill, based on Master Creations HO kit
"
icon0             <kuid:-3:10164>
string-table {
  pulpmill_goodspickup        "General Goods Pickup"
  pulpmill_woodchipdropoff      "Woodchips Drop off"
}
username-de           "Hyde-Zellstoffwerk"
description-de            "Hyde-Zellstoffwerk, auf Master Creations HO-Modell basierend"
string-table-de {
  pulpmill_goodspickup        "Allgemeine Güter aufnehmen"
  pulpmill_woodchipdropoff      "Holzspähne abladen"
}
username-it           "Fabbrica di pasta di legno Hyde"
description-it            "Fabbrica di pasta di legno Hyde, creata col kit Master Creations HO"
string-table-it {
  pulpmill_goodspickup        "Raccolta merci varie"
  pulpmill_woodchipdropoff      "Scarico trucioli"
}
username-es           "Molino Papelero Hyde"
description-es            "Molino Papelero Hyde, basado en el kit HO de Master Creations."
string-table-es {
  pulpmill_goodspickup        "Recogida mercancía general"
  pulpmill_woodchipdropoff      "Entrega de restos de madera"
}
username-pl           "Celulozownia Hyde"
description-pl            "Celulozownia Hyde wzorowana na zestawie Master Creations HO"
string-table-pl {
  pulpmill_goodspickup        "Punkt załadunku drobnicy"
  pulpmill_woodchipdropoff      "Punkt rozładunku wiórów"
}
username-cz           "Celulózka"
description-cz            "Celulózka - založena na objektech z HO kitu"
string-table-cz {
  pulpmill_goodspickup        "Nakládka zboží"
  pulpmill_woodchipdropoff      "Vykládka pilin"
}
username-ru           "Целлюлозный завод Хайда"
description-ru            "Целлюлозный завод Хайда, основано на наборе 'Master Creations HO'"
string-table-ru {
  pulpmill_goodspickup        "Погрузка товаров"
  pulpmill_woodchipdropoff      "Выгрузка опилок"
}
username-fr           "Usine de pâte de Hyde"
description-fr            "Usine de pâte de Hyde, d'après le kit Master Creations HO"
string-table-fr {
  pulpmill_goodspickup                                                                "Charge générale de marchandises"
  pulpmill_woodchipdropoff                                                        "Décharge de copeau"
}

pulpmill.gs:

include "BaseIndustry.gs"

//
//
//
class PulpMill isclass BaseIndustry
{
  ProductQueue gengoodsOutQueue, woodchipsInQueue;
  bool scriptletEnabled = true;
  //bool animating = false;
  //bool processing = false;

  // Track if they only supply some of the logs that were requested in the waybill.
  int woodchipsWBRemain = 0;

  //
  //
  //

  bool TriggerSupportsMovingLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
      if (triggerName == "woodchips_in")
        return true;

    return false;
  }

  void PerformMovingLoad(Vehicle vehicle, string triggerName)
  {
    //
    // OUTPUT trigger - load
    //
    float speed = vehicle.GetVelocity();

    if (speed > -5.0f and speed < 5.0f)
    {
      int woodchipsSpaceAvailable = woodchipsInQueue.GetQueueSpace();
      if (triggerName == "woodchips_in")
      {
        LoadingReport report = CreateUnloadingReport(woodchipsInQueue, woodchipsSpaceAvailable);

        vehicle.UnloadProduct(report);

        // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
        if (woodchipsWBRemain > 0)
          woodchipsWBRemain = woodchipsWBRemain - report.amount;

      }
    }
  }

  //
  //
  //

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
    {
      bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();
      int direction = vehicle.GetRelationToTrack(me, "out_track");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "goods_out_t0")
        return true;
      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "goods_out_t3")
        return true;

      if (triggerName == "goods_out_t0" or triggerName == "goods_out_t1" or triggerName == "goods_out_t2" or triggerName == "goods_out_t3")
        if (vehicle.GetMyTrain().IsStopped())
          return true;
    }

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (triggerName == "goods_out_t0" or triggerName == "goods_out_t1" or triggerName == "goods_out_t2" or triggerName == "goods_out_t3")
    {
      int available = gengoodsOutQueue.GetQueueCount();
      LoadingReport report = CreateLoadingReport(gengoodsOutQueue, available);
      vehicle.LoadProduct(report);
    }
  }

  //
  // ?
  //
  thread void PulpMain(void)
  {
    Message msg;

    wait()
    {
      Vehicle vehicle;
      string triggerName;

      on "Scriptlet-Enabled", "1":
      {
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("pulpmill_consumer", true);
        }
        continue;
      }

      // ? Power station is providing electricity, if not already running. start the
      on "Scriptlet-Enabled", "0":
      {
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("pulpmill_consumer", false);
        }
        continue;
      }

      // logs_consumer process in lumber mill has started, so active smoke stack particles and
      // start the animation (forklift & conveyor)
      on "Process-Start", "pulpmill_consumer":
        SendMessage(me, "pfx", "+0");

        StartMeshAnimationLoop("default");

        continue;

      // logs_consumer process has stopped, disable particle effect and stop animation
      on "Process-Stop", "pulpmill_consumer":
        SendMessage(me, "pfx", "-0");
        StopMeshAnimation("default");
        continue;
    }
  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    useGenericViewDetails = true;

    gengoodsOutQueue = GetQueue("gen_goods_q");
    woodchipsInQueue = GetQueue("woodchips_q");

    AddAssetToIndustryProductInfo("woodchips", "woodchips_q", "pulpmill_consumer", true);
    AddAssetToIndustryProductInfo("gengoods", "gen_goods_q", "pulpmill_consumer", false);

    //scriptletEnabled = true;
    SetMeshAnimationFrame("default", 0);
    StartMeshAnimationLoop("default");

    PulpMain();
  }

  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret = new Requirement[0];

    if (woodchipsInQueue.GetQueueCount() < 60500 or woodchipsWBRemain > 0)  // 1 gondola - 6 minutes till empty
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = woodchipsInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 242000;        // 4 gondolas
      if (woodchipsInQueue.GetQueueCount() < 10 and woodchipsWBRemain == 0)
        woodchipsWBRemain = 242000;

      req.dst = me;
      req.dstQueue = woodchipsInQueue;

      ret[ret.size()] = req;
    }

    return ret;
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("pulpmill_goodsPickup");
    destTracks[destTracks.size()] = "out_track";

    destNames[destNames.size()] = stringTable.GetString("pulpmill_woodchipDropoff");
    destTracks[destTracks.size()] = "in_track";
  }
};


Lumber Mill
[Industries]

Lumber Mill Industry

config.txt:

﻿
kind              "industry"
region              "TRS2004"
kuid              <kuid:-3:10027>
type              "Industrial"
username            "Lumber Mill"
light             1
nightmode           "lamp"
script              "lumber_mill"
class             "lumber_mill"
icon-texture            "icon_lumbermill.tga"
kuid-table {
  lumber            <kuid:-3:10003>
  woodchips         <kuid:-3:10002>
  logs            <kuid:-3:10001>
}
mesh-table {
  default {
    mesh          "lumber_mill.lm"
    auto-create       1
    anim          "anim.kin"
    critical-animation      1
    animation-loop-speed      1
    effects {
      0 {
        kind      "name"
        fontsize    0.18
        fontcolor   10,10,10
        att     "a.name0"
        name      "name"
      }
      1 {
        kind      "name"
        fontsize    0.18
        fontcolor   10,10,10
        att     "a.name1"
        name      "name"
      }
      2 {
        kind      "name"
        fontsize    0.18
        fontcolor   10,10,10
        att     "a.name2"
        name      "name"
      }
      3 {
        kind      "name"
        fontsize    0.18
        fontcolor   10,10,10
        att     "a.name3"
        name      "name"
      }
      4 {
        kind      "name"
        fontsize    0.18
        fontcolor   10,10,10
        att     "a.name4"
        name      "name"
      }
      5 {
        kind      "name"
        fontsize    0.18
        fontcolor   10,10,10
        att     "a.name5"
        name      "name"
      }
      6 {
        kind      "name"
        fontsize    0.18
        fontcolor   10,10,10
        att     "a.name6"
        name      "name"
      }
      7 {
        kind      "name"
        fontsize    0.18
        fontcolor   10,10,10
        att     "a.name7"
        name      "name"
      }
      8 {
        kind      "name"
        fontsize    0.31
        fontcolor   10,10,10
        att     "a.name8"
        name      "name"
      }
      9 {
        kind      "name"
        fontsize    0.31
        fontcolor   10,10,10
        att     "a.name9"
        name      "name"
      }
    }
  }
  default-night {
    mesh          "night.im"
    night-mesh-base       "default"
  }
  load {
    mesh          "load/load.im"
    auto-create       1
    anim          "load/load.kin"
  }
}
smoke0 {
  attachment          "a.smoke"
  mode            "time"
  color           150,150,150,250
  accel           1,0.3,0
  rate            8
  velocity          3
  lifetime          5
  minsize           0.5
  maxsize           2
  enabled           0
}
smoke1 {
  attachment          "a.chips0"
  mode            "time"
  color           218,193,104,255
  accel           0
  rate            8
  velocity          3
  lifetime          3
  minsize           1
  maxsize           2
  enabled           0
}
smoke2 {
  attachment          "a.chips1"
  mode            "time"
  color           218,193,104,255
  accel           0
  rate            8
  velocity          3
  lifetime          1
  minsize           2
  maxsize           4
  enabled           0
}
soundscript {
  daysingle {
    repeat-delay        0
    distance        20,400
    sound {
      sawmill_ambient.wav
    }
  }
  log_cut {
    trigger         "logcut"
    attachment        "a.sawsound"
    nostartdelay        1
    repeat-delay        1
    distance        10,400
    sound {
      log_cutting.wav
    }
  }
  forklift {
    attachment        "a.forklift_sound"
    repeat-delay        0
    distance        5,200
    sound {
      forklift.wav
    }
  }
  crane {
    attachment        "a.cranesound"
    repeat-delay        0
    distance        5,200
    sound {
      crane.wav
    }
  }
}
attached-track {
  log_depot {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
    }
  }
  link1 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0c"
      1       "a.track0d"
    }
  }
  woodchips_depot {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0d"
      1       "a.track0e"
      2       "a.track0f"
    }
  }
  lumber_depot {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1a"
      1       "a.track1b"
      2       "a.track1c"
      3       "a.track1d"
    }
  }
}
queues {
  logs_q {
    size          41
    initial-count       28
    product-kuid        <kuid:-3:10001>
    attachment-points {
      0       "a.log0"
      1       "a.log1"
      2       "a.log2"
      3       "a.log3"
      4       "a.log4"
      5       "a.log5"
      6       "a.log6"
      7       "a.log7"
      8       "a.log8"
      9       "a.log9"
      10        "a.log10"
      11        "a.log11"
      12        "a.log12"
      13        "a.log13"
      14        "a.log14"
      15        "a.log15"
      16        "a.log16"
      17        "a.log17"
      18        "a.log18"
      19        "a.log19"
      20        "a.log20"
      21        "a.log21"
      22        "a.log22"
      23        "a.log23"
      24        "a.log24"
      25        "a.log25"
      26        "a.log26"
      27        "a.log27"
      28        "a.log28"
      29        "a.log29"
      30        "a.log30"
      31        "a.log31"
      32        "a.log32"
      33        "a.log33"
      34        "a.log34"
      35        "a.log35"
      36        "a.log36"
      37        "a.log37"
      38        "a.log38"
      39        "a.log39"
      40        "a.log40"
    }
  }
  lumber_q {
    size          36
    initial-count       2
    product-kuid        <kuid:-3:10003>
    attachment-points {
      0       "a.lumber0"
      1       "a.lumber1"
      2       "a.lumber2"
      3       "a.lumber3"
      4       "a.lumber4"
      5       "a.lumber5"
      6       "a.lumber6"
      7       "a.lumber7"
      8       "a.lumber8"
      9       "a.lumber9"
      10        "a.lumber10"
      11        "a.lumber11"
      12        "a.lumber12"
      13        "a.lumber13"
      14        "a.lumber14"
      15        "a.lumber15"
      16        "a.lumber16"
      17        "a.lumber17"
      18        "a.lumber18"
      19        "a.lumber19"
      20        "a.lumber20"
      21        "a.lumber21"
      22        "a.lumber22"
      23        "a.lumber23"
      24        "a.lumber24"
      25        "a.lumber25"
      26        "a.lumber26"
      27        "a.lumber27"
      28        "a.lumber28"
      29        "a.lumber29"
      30        "a.lumber30"
      31        "a.lumber31"
      32        "a.lumber32"
      33        "a.lumber33"
      34        "a.lumber34"
      35        "a.lumber35"
    }
  }
  woodchips_q {
    size          1210000
    initial-count       302500
    !         "- 302500 = 60500 x 5 Gondolas"
    animated-mesh       "load"
    product-kuid        <kuid:-3:10002>
  }
}
processes {
  logs_consumer {
    start-enabled       1
    duration        34
    inputs {
      0 {
        amount      1
        queue     "logs_q"
      }
    }
    outputs {
      0 {
        amount      34571
        queue     "woodchips_q"
      }
      1 {
        amount      2
        queue     "lumber_q"
      }
    }
  }
}
attached-trigger {
  woodchips_t {
    att         "a.trig0"
    radius          5
    track         "woodchips_depot"
  }
  lumber_t {
    att         "a.trig1"
    radius          20
  }
  logs_t {
    att         "a.trig2"
    radius          20
    track         "log_depot"
  }
}
icon0             <kuid:-3:10164>
string-table {
  lumber_logdropoff       "Log drop off"
  lumber_woodchipspickup        "Woodchips pickup"
  lumber_lumberpickup       "Lumber pickup"
}
username-de           "Sägewerk"
string-table-de {
  lumber_logdropoff       "Baumstämme abladen"
  lumber_woodchipspickup        "Holzspäne aufnehmen"
  lumber_lumberpickup       "Holz aufnehmen"
}
username-it           "Segheria"
string-table-it {
  lumber_logdropoff       "Scarico tronchi"
  lumber_woodchipspickup        "Raccolta trucioli"
  lumber_lumberpickup       "Raccolta legna"
}
username-es           "Aserradero"
string-table-es {
  lumber_logdropoff       "Entrega de troncos"
  lumber_woodchipspickup        "Recogida restos madera"
  lumber_lumberpickup       "Recogida de madera"
}
username-pl           "Tartak"
string-table-pl {
  lumber_logdropoff       "Punkt rozładunku dłużyc"
  lumber_woodchipspickup        "Punkt załadunku wiórów"
  lumber_lumberpickup       "Punkt załadunku tarcicy"
}
username-cz           "Pila"
string-table-cz {
  lumber_logdropoff       "Vykládka klád"
  lumber_woodchipspickup        "Nakládka pilin"
  lumber_lumberpickup       "Nakládka dřeva"
}
name-ru             "name"
username-ru           "Лесопилка"
string-table-ru {
  lumber_logdropoff       "Выгрузка бревен"
  lumber_woodchipspickup        "Погрузка опилок"
  lumber_lumberpickup       "Погрузка пиломатериалов"
}
username-fr           "Scierie"
string-table-fr {
  lumber_logdropoff                                                                      "Décharge de billot"
  lumber_woodchipspickup                                                            "Charge de copeau"
  lumber_lumberpickup                                                                  "Charge de planche"
}

lumber_mill.gs:

include "BaseIndustry.gs"

//
// ?
//
class lumber_mill isclass BaseIndustry
{
  ProductQueue logsInQueue, chipsOutQueue, lumberOutQueue;
  bool animating = false;         // is the forklift/conveyor belt animation currently running?
  bool processing = false;        // is the log consumer process currently running?
  bool scriptletEnabled = true;  // state of power supply (must be true for this mill to run)

  // Track if they only supply some of the logs that were requested in the waybill.
  int logWBRemain = 0;

  bool TriggerSupportsMovingLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
      if (triggerName == "woodchips_t")
        return true;

    return false;
  }

  void PerformMovingLoad(Vehicle vehicle, string triggerName)
  {
    if (scriptletEnabled)
    {
      float speed = vehicle.GetVelocity();

      if (speed > -5.0f and speed < 5.0f)
      {
        int available = chipsOutQueue.GetQueueCount();

        SendMessage(me, "pfx", "+1+2");
        LoadingReport report = CreateLoadingReport(chipsOutQueue, available);
        vehicle.LoadProduct(report);

        SendMessage(me, "pfx", "-1-2");
      }
    }
  }

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
      if (triggerName == "lumber_t")
        return true;
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
      if (triggerName == "logs_t")
        return true;

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (triggerName == "lumber_t")
    {
      int available = lumberOutQueue.GetQueueCount();
      LoadingReport report = CreateLoadingReport(lumberOutQueue, available);
      vehicle.LoadProduct(report);
    }

    else if (triggerName == "logs_t")
    {
      int spaceAvailable = logsInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(logsInQueue, spaceAvailable);
      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (logWBRemain > 0)
        logWBRemain = logWBRemain - report.amount;
    }
  }

  //
  // Thread that runs this lumber mill scriplet.
  //
  thread void LumberMain(void)
  {
    Message msg;
    Vehicle vehicle;
    string triggerName;

    //
    wait()
    {

      // logs_consumer process in lumber mill has started, so active smoke stack particles and
      // start the animation (forklift & conveyor)
      on "Process-Start", "logs_consumer":
        //Interface.Print("LumberMain(): Process-Start:logs_consumer message received, starting default animation amd smoke stack particles");

        SendMessage(me, "pfx", "+0");

        StartMeshAnimationLoop("default");

        continue;

      // logs_consumer process has stopped, disable particle effect and stop animation
      on "Process-Stop", "logs_consumer":
        //Interface.Print("LumberMain(): Process-Stop message received, stopping default animation and smoke stack particles");

        SendMessage(me, "pfx", "-0");
        StopMeshAnimation("default");
        continue;

      // ?
      on "Animation-Event", "animstop":
    {
        //if (!(GetProcessStarted("logs_consumer") and GetProcessEnabled("logs_consumer")))
        //Interface.Print("Animation-Event,animstop message received, stopping default animation!");
        //Interface.Print("Animation-Event,animstop message received, stopping default animation!");

        StopMeshAnimation("default");

        // make sure we didn't overshoot the end of the animation
        SetMeshAnimationFrame("default", 999.5);

        // it's actually possible to receive the Animation-Event message multiple times, even
        // though we tell the game engine to stop the animation. this can occur if the frame-rate
        // is low and the animation repeats multiple times inside one frame. it's important that we
        // check for this situation, otherwise a script exception will result.
        if (animating)
        {
          animating = false;

          if (!processing)
          {
            // we are making the assumption that there is only one process, "logs_consumer"
            // if there were more, we would have to be careful to finish the correct process here
            PerformProcessOutput("logs_consumer");
            PerformProcessFinished("logs_consumer");
            PostMessage(me, "GenericIndustry", "ProcessComplete", 0.0f);

            //autoLoader.ReSendStoppedMessages(me);
            InnerReEnter(-1);
          }
        }

        continue;
    }

      // Messages with a major of "Scriptlet-Enabled" are sent by the PowerStationRule scriplet
      // when the power station's coal consumption process has started (minor = "1") or stopped
      // (minor = "0").

      // Power station is providing electricity, if not already running. start the
      on "Scriptlet-Enabled", "1":
      {
        //Interface.Print("Enable script ");
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("logs_consumer", true);
        }
        continue;
      }

      // ? Power station is providing electricity, if not already running. start the
      on "Scriptlet-Enabled", "0":
      {
        //Interface.Print("Disable script ");
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("logs_consumer", false);
        }
        continue;
      }
    }
  }

  //
  // Called by the game once when a process is ready to start (see Industry.gs)
  //
  void NotifyProcessStarted(string processName)
  {
    //Interface.Print("NotifyProcessStarted called in lumber mill!");

    if (scriptletEnabled) // only when power is running
    {

      if (PerformProcessInput(processName))
      {
        //Interface.Print("NotifyProcessStarted: Starting the default animation!");

        // we are making the assumption that there is only one process, "logs_consumer"
        SetMeshAnimationFrame("default", 0);
        StartMeshAnimationLoop("default");

        animating = true;
        processing = true;

        PerformProcessStarted(processName);
      }
      else
        PerformProcessCancelled(processName);

    }

  }

  // called by the game once when a process is ready to stop (see Industry.gs)
  void NotifyProcessFinished(string processName)
  {

    processing = false;

    if (!animating)
    {
      PerformProcessOutput(processName);
      PerformProcessFinished(processName);
      PostMessage(me, "GenericIndustry", "ProcessComplete", 0.0f);
    }
  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    useGenericViewDetails = true;

    logsInQueue = GetQueue("logs_q");
    chipsOutQueue = GetQueue("woodchips_q");
    lumberOutQueue = GetQueue("lumber_q");

    AddAssetToIndustryProductInfo("logs", "logs_q", "logs_consumer", true);
    AddAssetToIndustryProductInfo("woodchips", "woodchips_q", "logs_consumer", false);
    AddAssetToIndustryProductInfo("lumber", "lumber_q", "logs_consumer", false);

    //
    StopMeshAnimation("default");
    SetMeshAnimationFrame("default", 999);

    // Start main thread to process messages and run the lumber mill.
    LumberMain();
  }

  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret = new Requirement[0];

    if (logsInQueue.GetQueueCount() < 10 or logWBRemain > 0)
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = logsInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 25;
      if (logsInQueue.GetQueueCount() < 10 and logWBRemain == 0)
        logWBRemain = 25;

      req.dst = me;
      req.dstQueue = logsInQueue;

      ret[ret.size()] = req;
    }

    return ret;
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("lumber_logDropoff");
    destTracks[destTracks.size()] = "Log_Depot";

    destNames[destNames.size()] = stringTable.GetString("lumber_woodchipsPickup");
    destTracks[destTracks.size()] = "Woodchips_Depot";

    destNames[destNames.size()] = stringTable.GetString("lumber_lumberPickup");
    destTracks[destTracks.size()] = "Lumber_Depot";
  }

};


Multiple Industry
[Industries]

Multiple Industry

config.txt:

﻿
username            "Multiple_Industry"
kind              "industry"
light             1
region              "TRS2004"
kuid              <kuid:-3:10123>
type              "Industrial"
nightmode           "lamp"
script              "MultipleIndustry"
class             "MultipleIndustry"
icon-texture            "icon_multiple.tga"
kuid-table {
  pipe            <kuid:-3:10051>
  coal            <kuid:44179:60013>
  diesel            <kuid:-3:10011>
  cont20ft          <kuid:-3:10014>
  cont40ft          <kuid:-3:10041>
  gengoods          <kuid:-3:10013>
  logs            <kuid:-3:10001>
  lumber            <kuid:-3:10003>
  woodchips         <kuid:-3:10002>
  oil           <kuid:-3:10010>
  petrol            <kuid:-3:10012>
  water           <kuid:-3:10004>
  avgas           <kuid:-3:10045>
}
mesh-table {
  default {
    mesh          "Multiple_Industry.im"
    auto-create       1
  }
}
attached-track {
  out_track0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
      4       "a.track0e"
      5       "a.track0f"
    }
  }
}
attached-trigger {
  trig0 {
    att         "a.track0b"
    radius          10
  }
  trig1 {
    att         "a.track0c"
    radius          10
  }
  trig2 {
    att         "a.track0d"
    radius          10
  }
  trig3 {
    att         "a.track0e"
    radius          10
  }
}
queues {
  20ft_cont_q {
    size          100
    initial-count       50
    product-kuid        <kuid:-3:10014>
    allowed-products {
      0       <kuid:-3:10014>
    }
  }
  40ft_cont_q {
    size          100
    initial-count       50
    product-kuid        <kuid:-3:10041>
    allowed-products {
      0       <kuid:-3:10041>
    }
  }
  gen_goods_q {
    size          100
    initial-count       50
    product-kuid        <kuid:-3:10013>
    allowed-products {
      0       <kuid:-3:10013>
    }
  }
  logs_q {
    size          90
    initial-count       45
    product-kuid        <kuid:-3:10001>
    allowed-products {
      0       <kuid:-3:10001>
    }
  }
  lumber_q {
    size          51
    initial-count       25
    product-kuid        <kuid:-3:10003>
    allowed-products {
      0       <kuid:-3:10003>
    }
  }
  coal_q {
    size          1086000
    initial-count       543000
    !         "- 543000 = 54300 x 10 Hoppers"
    allowed-products {
      0       <kuid:44179:60013>
    }
    product-kuid        <kuid:44179:60013>
  }
  woodchips_q {
    size          726000
    initial-count       302500
    !         "- 302500  = 60500 x 5 Gondolas"
    allowed-products {
      0       <kuid:-3:10002>
    }
    product-kuid        <kuid:-3:10002>
  }
  crude_oil_q {
    size          1940000
    initial-count       776000
    !         "- 776000 = 38800 x 20 Tankers"
    allowed-products {
      0       <kuid:-3:10010>
    }
    product-kuid        <kuid:-3:10010>
  }
  diesel_q {
    size          1164000
    initial-count       582000
    !         "- 582000 = 38800 x 15 Tankers"
    allowed-products {
      0       <kuid:-3:10011>
    }
    product-kuid        <kuid:-3:10011>
  }
  petrol_q {
    size          388000
    initial-count       194000
    !         "- 194000 = 38800 x 5 Tankers"
    allowed-products {
      0       <kuid:-3:10012>
    }
    product-kuid        <kuid:-3:10012>
  }
  water_q {
    size          15000
    initial-count       10000
    animated-mesh       "load_water"
    allowed-products {
      0       <kuid:-3:10004>
    }
    product-kuid        <kuid:-3:10004>
  }
  av_in_q {
    size          582000
    initial-count       271600
    !         "- 271600 = 38800 x 7 Tankers"
    allowed-products {
      0       <kuid:-3:10045>
    }
    product-kuid        <kuid:-3:10045>
  }
}
processes {
  multi_consumer_producer {
    start-enabled       1
    duration        30
    inputs {
      0 {
        amount      1
        queue     "20ft_cont_q"
      }
      1 {
        amount      1
        queue     "40ft_cont_q"
      }
      2 {
        amount      1
        queue     "gen_goods_q"
      }
      3 {
        amount      1
        queue     "logs_q"
      }
      4 {
        amount      1
        queue     "lumber_q"
      }
      5 {
        amount      100000
        queue     "coal_q"
      }
      6 {
        amount      100000
        queue     "woodchips_q"
      }
      7 {
        amount      100000
        queue     "crude_oil_q"
      }
      8 {
        amount      100000
        queue     "diesel_q"
      }
      9 {
        amount      100000
        queue     "petrol_q"
      }
      10 {
        amount      100
        queue     "water_q"
      }
      11 {
        amount      100000
        queue     "av_in_q"
      }
    }
    outputs {
      0 {
        amount      1
        queue     "20ft_cont_q"
      }
      1 {
        amount      1
        queue     "40ft_cont_q"
      }
      2 {
        amount      1
        queue     "gen_goods_q"
      }
      3 {
        amount      1
        queue     "logs_q"
      }
      4 {
        amount      1
        queue     "lumber_q"
      }
      5 {
        amount      100000
        queue     "coal_q"
      }
      6 {
        amount      100000
        queue     "woodchips_q"
      }
      7 {
        amount      100000
        queue     "crude_oil_q"
      }
      8 {
        amount      100000
        queue     "diesel_q"
      }
      9 {
        amount      100000
        queue     "petrol_q"
      }
      10 {
        amount      100
        queue     "water_q"
      }
      11 {
        amount      100000
        queue     "av_in_q"
      }
    }
  }
}
icon0             <kuid:-3:10164>
string-table {
  multi_pickupdropoff       "Multiple Pickup/Drop off"
}
username-de           "Mehrfach_Industrie"
string-table-de {
  multi_pickupdropoff       "Mehrfaches Auf-/Abladen"
}
username-it           "Industria_Polivalente"
string-table-it {
  multi_pickupdropoff       "Raccolta/Scarico"
}
username-es           "Múltiple_Industria"
string-table-es {
  multi_pickupdropoff       "Recogida/entrega múltiple"
}
username-pl           "Zakład przemysłowy ogólny"
string-table-pl {
  multi_pickupdropoff       "Punkt załadunku i rozładunku ogólny"
}
username-cz           "Průmyslový_komplex"
string-table-cz {
  multi_pickupdropoff       "Nakládka/vykládka"
}
username-cn           "複合工業"
string-table-cn {
  multi_pickupdropoff       "多樣裝載/卸貨"
}
username-ru           "Различные_предприятия"
string-table-ru {
  multi_pickupdropoff       "Погрузка/разгрузка"
}
username-fr           "Industrie_multiple"
string-table-fr {
  multi_pickupdropoff                                                    "Chargement/déchargement multiple"
}

MultipleIndustry.gs

include "BaseIndustry.gs"

//
// MultipleIndustry industry
//
class MultipleIndustry isclass BaseIndustry
{
  ProductQueue crudeOilQueue, dieselQueue, petrolQueue, coalQueue, cont20ftQueue, cont40ftQueue, gengoodsQueue, logsQueue, lumberQueue, woodchipsQueue, waterQueue, avgasQueue;
  Asset crudeOilAsset, dieselAsset, petrolAsset, coalAsset, cont20ftAsset, cont40ftAsset, gengoodsAsset, logsAsset, lumberAsset, woodchipsAsset, waterAsset, avgasAsset;

  bool animating = false;
  bool processing = false;

  // Track if they only supply some of the logs that were requested in the waybill.
  int avWBRemain = 0;
  int cont20WBRemain = 0;
  int cont40WBRemain = 0;
  int goodsWBRemain = 0;
  int logWBRemain = 0;
  int lumberWBRemain = 0;
  int coalWBRemain = 0;
  int woodchipWBRemain = 0;
  int oilWBRemain = 0;
  int dieselWBRemain = 0;
  int petrolWBRemain = 0;
  int waterWBRemain = 0;

  //
  //
  //

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();
    int direction = vehicle.GetRelationToTrack(me, "out_track0");
    if (!vehicleToTrain)
      direction = -direction;

    // Are we up to the furthest trigger away from the side we entered for diesel?
    if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trig3")
      return true;
    if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trig0")
      return true;

    // If the train has already stopped, then fall thru and allow this load as well
    if (triggerName == "trig0" or triggerName == "trig1" or triggerName == "trig2" or triggerName == "trig3")
    {
      if (vehicle.GetMyTrain().IsStopped())
        return true;
    }

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (triggerName == "trig0" or triggerName == "trig1" or triggerName == "trig2" or triggerName == "trig3")
    {
      bool avWBModified = false;
      bool cont20WBModified = false;
      bool cont40WBModified = false;
      bool goodsWBModified = false;
      bool logWBModified = false;
      bool lumberWBModified = false;
      bool coalWBModified = false;
      bool woodchipWBModified = false;
      bool oilWBModified = false;
      bool dieselWBModified = false;
      bool petrolWBModified = false;
      bool waterWBModified = false;

      int spaceAvailable;
      LoadingReport report;
      int direction;

      if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
      {
        // Attempt to load everything! ;)
        //
        // Load the crudeoil
        //
        if (GetProcessOutput("multi_consumer_producer", crudeOilQueue, crudeOilAsset) > 0)
        {
          spaceAvailable = crudeOilQueue.GetQueueCount();
          report = CreateLoadingReport(crudeOilQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            oilWBModified = true;
        }

        //
        // Load the diesel
        //
        if (GetProcessOutput("multi_consumer_producer", dieselQueue, dieselAsset) > 0)
        {
          spaceAvailable = dieselQueue.GetQueueCount();
          report = CreateLoadingReport(dieselQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            dieselWBModified = true;
        }

        //
        // Load the petrol
        //
        if (GetProcessOutput("multi_consumer_producer", petrolQueue, petrolAsset) > 0)
        {
          spaceAvailable = petrolQueue.GetQueueCount();
          report = CreateLoadingReport(petrolQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            petrolWBModified = true;
        }

        //
        // Load the coal
        //
        if (GetProcessOutput("multi_consumer_producer", coalQueue, coalAsset) > 0)
        {
          spaceAvailable = coalQueue.GetQueueCount();
          report = CreateLoadingReport(coalQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            coalWBModified = true;
        }

        //
        // Load the cont20
        //
        if (GetProcessOutput("multi_consumer_producer", cont20ftQueue, cont20ftAsset) > 0)
        {
          spaceAvailable = cont20ftQueue.GetQueueCount();
          report = CreateLoadingReport(cont20ftQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            cont20WBModified = true;
        }

        //
        // Load the cont40
        //
        if (GetProcessOutput("multi_consumer_producer", cont40ftQueue, cont40ftAsset) > 0)
        {
          spaceAvailable = cont40ftQueue.GetQueueCount();
          report = CreateLoadingReport(cont40ftQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            cont40WBModified = true;
        }

        //
        // Load the gengoods
        //
        if (GetProcessOutput("multi_consumer_producer", gengoodsQueue, gengoodsAsset) > 0)
        {
          spaceAvailable = gengoodsQueue.GetQueueCount();
          report = CreateLoadingReport(gengoodsQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            goodsWBModified = true;
        }

        //
        // Load the logs
        //
        if (GetProcessOutput("multi_consumer_producer", logsQueue, logsAsset) > 0)
        {
          spaceAvailable = logsQueue.GetQueueCount();
          report = CreateLoadingReport(logsQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            logWBModified = true;
        }

        //
        // Load the lumber
        //
        if (GetProcessOutput("multi_consumer_producer", lumberQueue, lumberAsset) > 0)
        {
          spaceAvailable = lumberQueue.GetQueueCount();
          report = CreateLoadingReport(lumberQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            lumberWBModified = true;
        }

        //
        // Load the woodchips
        //
        if (GetProcessOutput("multi_consumer_producer", woodchipsQueue, woodchipsAsset) > 0)
        {
          spaceAvailable = woodchipsQueue.GetQueueCount();
          report = CreateLoadingReport(woodchipsQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            woodchipWBModified = true;
        }

        //
        // Load the water
        //
        if (GetProcessOutput("multi_consumer_producer", waterQueue, waterAsset) > 0)
        {
          spaceAvailable = waterQueue.GetQueueCount();
          report = CreateLoadingReport(waterQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            waterWBModified = true;
        }

        //
        // Load the avgas
        //
        if (GetProcessOutput("multi_consumer_producer", avgasQueue, avgasAsset) > 0)
        {
          spaceAvailable = avgasQueue.GetQueueCount();
          report = CreateLoadingReport(avgasQueue, spaceAvailable);

          direction = vehicle.GetRelationToTrack(me, "out_track0");
          if (direction == Vehicle.DIRECTION_FORWARD)
            report.sideFlags = LoadingReport.LEFT_SIDE;
          else if (direction == Vehicle.DIRECTION_BACKWARD)
            report.sideFlags = LoadingReport.RIGHT_SIDE;

          vehicle.LoadProduct(report);
          // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
          if (report.amount > 0)
            avWBModified = true;
        }
      }

      if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
      {
        // Attemp to unload everything! ;)
        //
        // Unload the crudeoil
        //
        if (GetProcessInput("multi_consumer_producer", crudeOilQueue, crudeOilAsset) > 0)
        {
          if (!oilWBModified)
          {
            spaceAvailable = crudeOilQueue.GetQueueSpace();
            report = CreateUnloadingReport(crudeOilQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (oilWBRemain > 0)
              oilWBRemain = oilWBRemain - report.amount;
          }
        }

        //
        // Unload the diesel
        //
        if (GetProcessInput("multi_consumer_producer", dieselQueue, dieselAsset) > 0)
        {
          if (!dieselWBModified)
          {
            spaceAvailable = dieselQueue.GetQueueSpace();
            report = CreateUnloadingReport(dieselQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (dieselWBRemain > 0)
              dieselWBRemain = dieselWBRemain - report.amount;
          }
        }

        //
        // Unload the petrol
        //
        if (GetProcessInput("multi_consumer_producer", petrolQueue, petrolAsset) > 0)
        {
          if (!petrolWBModified)
          {
            spaceAvailable = petrolQueue.GetQueueSpace();
            report = CreateUnloadingReport(petrolQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (petrolWBRemain > 0)
              petrolWBRemain = petrolWBRemain - report.amount;
          }
        }

        //
        // Unload the coal
        //
        if (GetProcessInput("multi_consumer_producer", coalQueue, coalAsset) > 0)
        {
          if (!coalWBModified)
          {
            spaceAvailable = coalQueue.GetQueueSpace();
            report = CreateUnloadingReport(coalQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (coalWBRemain > 0)
              coalWBRemain = coalWBRemain - report.amount;
          }
        }

        //
        // Unload the cont20
        //
        if (GetProcessInput("multi_consumer_producer", cont20ftQueue, cont20ftAsset) > 0)
        {
          if (!cont20WBModified)
          {
            spaceAvailable = cont20ftQueue.GetQueueSpace();
            report = CreateUnloadingReport(cont20ftQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (cont20WBRemain > 0)
              cont20WBRemain = cont20WBRemain - report.amount;
          }
        }

        //
        // Unload the cont40
        //
        if (GetProcessInput("multi_consumer_producer", cont40ftQueue, cont40ftAsset) > 0)
        {
          if (!cont40WBModified)
          {
            spaceAvailable = cont40ftQueue.GetQueueSpace();
            report = CreateUnloadingReport(cont40ftQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (cont40WBRemain > 0)
              cont40WBRemain = cont40WBRemain - report.amount;
          }
        }

        //
        // Unload the gengoods
        //
        if (GetProcessInput("multi_consumer_producer", gengoodsQueue, gengoodsAsset) > 0)
        {
          if (!goodsWBModified)
          {
            spaceAvailable = gengoodsQueue.GetQueueSpace();
            report = CreateUnloadingReport(gengoodsQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (goodsWBRemain > 0)
              goodsWBRemain = goodsWBRemain - report.amount;
          }
        }

        //
        // Unload the logs
        //
        if (GetProcessInput("multi_consumer_producer", logsQueue, logsAsset) > 0)
        {
          if (!logWBModified)
          {
            spaceAvailable = logsQueue.GetQueueSpace();
            report = CreateUnloadingReport(logsQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (logWBRemain > 0)
              logWBRemain = logWBRemain - report.amount;
          }
        }

        //
        // Unload the lumber
        //
        if (GetProcessInput("multi_consumer_producer", lumberQueue, lumberAsset) > 0)
        {
          if (!lumberWBModified)
          {
            spaceAvailable = lumberQueue.GetQueueSpace();
            report = CreateUnloadingReport(lumberQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (lumberWBRemain > 0)
              lumberWBRemain = lumberWBRemain - report.amount;
          }
        }

        //
        // Unload the woodchips
        //
        if (GetProcessInput("multi_consumer_producer", woodchipsQueue, woodchipsAsset) > 0)
        {
          if (!woodchipWBModified)
          {
            spaceAvailable = woodchipsQueue.GetQueueSpace();
            report = CreateUnloadingReport(woodchipsQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (woodchipWBRemain > 0)
              woodchipWBRemain = woodchipWBRemain - report.amount;
          }
        }

        //
        // Unload the water
        //
        if (GetProcessInput("multi_consumer_producer", waterQueue, waterAsset) > 0)
        {
          if (!waterWBModified)
          {
            spaceAvailable = waterQueue.GetQueueSpace();
            report = CreateUnloadingReport(waterQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (waterWBRemain > 0)
              waterWBRemain = waterWBRemain - report.amount;
          }
        }

        //
        // Unload the avgas
        //
        if (GetProcessInput("multi_consumer_producer", avgasQueue, avgasAsset) > 0)
        {
          if (!avWBModified)
          {
            spaceAvailable = avgasQueue.GetQueueSpace();
            report = CreateUnloadingReport(avgasQueue, spaceAvailable);

            direction = vehicle.GetRelationToTrack(me, "out_track0");
            if (direction == Vehicle.DIRECTION_FORWARD)
              report.sideFlags = LoadingReport.LEFT_SIDE;
            else if (direction == Vehicle.DIRECTION_BACKWARD)
              report.sideFlags = LoadingReport.RIGHT_SIDE;

            vehicle.UnloadProduct(report);
            // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
            if (avWBRemain > 0)
              avWBRemain = avWBRemain - report.amount;
          }
        }
      }
    }
  }

 //
  //
  //
  thread void MultipleMain(void)
  {
    Message msg;
    Vehicle vehicle;
    string triggerName;

    wait()
    {

      // ?
      on "Scriptlet-Enabled", "1":
      {
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("multi_consumer_producer", true);
        }
        continue;
      }
      // ?
      on "Scriptlet-Enabled", "0":
      {
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("multi_consumer_producer", false);
        }
        continue;
      }

    }
  }

  // called by the game once when a process is ready to start (see Industry.gs)
  void NotifyProcessStarted(string processName)
  {
    //Interface.Print("A process in the oil refinery has started.");

    if (PerformProcessInput(processName))
    {
        // we are making the assumption that there is only one process, "multi_consumer_producer"
      PerformProcessStarted(processName);
    }
    else
      PerformProcessCancelled(processName);

  }

  //
  // Called by the game once when a process is ready to stop (see Industry.gs)
  //
  void NotifyProcessFinished(string processName)
  {
    //Interface.Print("A process in the oil refinery has finished.");
    processing = false;

    if (!animating)
    {
      PerformProcessOutput(processName);
      PerformProcessFinished(processName);
      PostMessage(me, "GenericIndustry", "ProcessComplete", 0.0f);
    }

  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    usePipeAnimation = true;
    useGenericViewDetails = true;

    // initialize queues
    crudeOilQueue = GetQueue("crude_oil_q");
    dieselQueue = GetQueue("diesel_q");
    petrolQueue = GetQueue("petrol_q");
    coalQueue = GetQueue("coal_q");
    cont20ftQueue = GetQueue("20ft_cont_q");
    cont40ftQueue = GetQueue("40ft_cont_q");
    gengoodsQueue = GetQueue("gen_goods_q");
    logsQueue = GetQueue("logs_q");
    lumberQueue = GetQueue("lumber_q");
    woodchipsQueue = GetQueue("woodchips_q");
    waterQueue = GetQueue("water_q");
    avgasQueue = GetQueue("av_in_q");

    crudeOilAsset = GetAsset().FindAsset("oil");
    dieselAsset = GetAsset().FindAsset("diesel");
    petrolAsset = GetAsset().FindAsset("petrol");
    coalAsset = GetAsset().FindAsset("coal");
    cont20ftAsset = GetAsset().FindAsset("cont20ft");
    cont40ftAsset = GetAsset().FindAsset("cont40ft");
    gengoodsAsset = GetAsset().FindAsset("gengoods");
    logsAsset = GetAsset().FindAsset("logs");
    lumberAsset = GetAsset().FindAsset("lumber");
    woodchipsAsset = GetAsset().FindAsset("woodchips");
    waterAsset = GetAsset().FindAsset("water");
    avgasAsset = GetAsset().FindAsset("avgas");

    AddAssetToIndustryProductInfo("oil", "crude_oil_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("petrol", "petrol_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("diesel", "diesel_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("coal", "coal_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("cont20ft", "20ft_cont_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("cont40ft", "40ft_cont_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("gengoods", "gen_goods_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("logs", "logs_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("lumber", "lumber_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("woodchips", "woodchips_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("water", "water_q", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("avgas", "av_in_q", "multi_consumer_producer", true);

    AddAssetToIndustryProductInfo("oil", "crude_oil_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("petrol", "petrol_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("diesel", "diesel_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("coal", "coal_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("cont20ft", "20ft_cont_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("cont40ft", "40ft_cont_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("gengoods", "gen_goods_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("logs", "logs_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("lumber", "lumber_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("woodchips", "woodchips_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("water", "water_q", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("avgas", "av_in_q", "multi_consumer_producer", false);

    // stop animation on refinery mesh - fueling doors are shut and not animated
    StopMeshAnimation("fuelling_doors");
    SetMeshAnimationFrame("fuelling_doors", 0);

    MultipleMain();

  }

  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret = new Requirement[0];
    int rate = 0;

    rate = GetProcessInput("multi_consumer_producer", GetQueue("20ft_cont_q"), GetAsset().FindAsset("cont20ft"));
    if (rate > 0)
    {
      if (cont20ftQueue.GetQueueCount() < 30 or cont20WBRemain > 0)
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = cont20ftQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 30;
        if (cont20ftQueue.GetQueueCount() < 30 and cont20WBRemain == 0)
          cont20WBRemain = 30;

        req.dst = me;
        req.dstQueue = cont20ftQueue;

        ret[ret.size()] = req;
      }
    }

    rate = GetProcessInput("multi_consumer_producer", GetQueue("40ft_cont_q"), GetAsset().FindAsset("cont40ft"));
    if (rate > 0)
    {
      if (cont40ftQueue.GetQueueCount() < 30 or cont40WBRemain > 0)
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = cont40ftQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 30;
        if (cont40ftQueue.GetQueueCount() < 30 and cont40WBRemain == 0)
          cont40WBRemain = 30;

        req.dst = me;
        req.dstQueue = cont40ftQueue;

        ret[ret.size()] = req;
      }
    }

    rate = GetProcessInput("multi_consumer_producer", GetQueue("gen_goods_q"), GetAsset().FindAsset("gengoods"));
    if (rate > 0)
    {
      if (gengoodsQueue.GetQueueCount() < 15 or goodsWBRemain > 0)
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = gengoodsQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 40;
        if (gengoodsQueue.GetQueueCount() < 15 and goodsWBRemain == 0)
          goodsWBRemain = 40;

        req.dst = me;
        req.dstQueue = gengoodsQueue;

        ret[ret.size()] = req;
      }
    }

    rate = GetProcessInput("multi_consumer_producer", GetQueue("logs_q"), GetAsset().FindAsset("logs"));
    if (rate > 0)
    {
      if (logsQueue.GetQueueCount() < 25 or logWBRemain > 0)
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = logsQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 50;
        if (logsQueue.GetQueueCount() < 25 and logWBRemain == 0)
          logWBRemain = 50;

        req.dst = me;
        req.dstQueue = logsQueue;

        ret[ret.size()] = req;
      }
    }

    rate = GetProcessInput("multi_consumer_producer", GetQueue("lumber_q"), GetAsset().FindAsset("lumber"));
    if (rate > 0)
    {
      if (lumberQueue.GetQueueCount() < 40 or lumberWBRemain > 0)
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = lumberQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 30;
        if (lumberQueue.GetQueueCount() < 40 and lumberWBRemain == 0)
          lumberWBRemain = 30;

        req.dst = me;
        req.dstQueue = lumberQueue;

        ret[ret.size()] = req;
      }
    }

    rate = GetProcessInput("multi_consumer_producer", GetQueue("coal_q"), GetAsset().FindAsset("coal"));
    if (rate > 0)
    {
      if (coalQueue.GetQueueCount() < 271500 or coalWBRemain > 0)  // 7 mins till empty
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = coalQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 814500;
        if (coalQueue.GetQueueCount() < 271500 and coalWBRemain == 0)
          coalWBRemain = 814500;        // 15 hoppers

        req.dst = me;
        req.dstQueue = coalQueue;

        ret[ret.size()] = req;
      }
    }

    rate = GetProcessInput("multi_consumer_producer", GetQueue("woodchips_q"), GetAsset().FindAsset("woodchips"));
    if (rate > 0)
    {
      if (woodchipsQueue.GetQueueCount() < 181500 or woodchipWBRemain > 0)  // 3 gondolas
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = woodchipsQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 544500;
        if (woodchipsQueue.GetQueueCount() < 181500 and woodchipWBRemain == 0)
          woodchipWBRemain = 544500;        // 9 gondolas

        req.dst = me;
        req.dstQueue = woodchipsQueue;

        ret[ret.size()] = req;
      }
    }

    rate = GetProcessInput("multi_consumer_producer", GetQueue("crude_oil_q"), GetAsset().FindAsset("oil"));
    if (rate > 0)
    {
      if (crudeOilQueue.GetQueueCount() < 27500 or oilWBRemain > 0)  // approx 14 min to empty
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = crudeOilQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 543000;
        if (crudeOilQueue.GetQueueCount() < 27500 and oilWBRemain == 0)
          oilWBRemain = 543000;        // 10 tank cars

        req.dst = me;
        req.dstQueue = crudeOilQueue;

        ret[ret.size()] = req;
      }
    }

    rate = GetProcessInput("multi_consumer_producer", GetQueue("diesel_q"), GetAsset().FindAsset("diesel"));
    if (rate > 0)
    {
      if (dieselQueue.GetQueueCount() < 232800 or dieselWBRemain > 0)  // 6 tankers
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = dieselQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 776000;
        if (dieselQueue.GetQueueCount() < 232800 and dieselWBRemain == 0)
          dieselWBRemain = 776000;        // 20 tankers

        req.dst = me;
        req.dstQueue = dieselQueue;

        ret[ret.size()] = req;
      }
    }

    rate = GetProcessInput("multi_consumer_producer", GetQueue("petrol_q"), GetAsset().FindAsset("petrol"));
    if (rate > 0)
    {
      if (petrolQueue.GetQueueCount() < 77600 or petrolWBRemain > 0)  // 2 tankers approx 10 min
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = petrolQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 116400;
        if (petrolQueue.GetQueueCount() < 77600 and petrolWBRemain == 0)
          petrolWBRemain = 116400;        // 3 tankers

        req.dst = me;
        req.dstQueue = petrolQueue;

        ret[ret.size()] = req;
      }
    }

    /*  NOT BEING USED AS WE HAVE NO WAY OF TRANSPORTING WATER YET
    rate = GetProcessInput("multi_consumer_producer", GetQueue("water_q"), GetAsset().FindAsset("water"));
    if (rate > 0)
    {
      if (waterQueue.GetQueueCount() < 77600 or waterWBRemain > 0)  // 2 tankers approx 10 min  // VAUGHAN EDIT
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = waterQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 116400;    // VAUGHAN EDIT
        if (waterQueue.GetQueueCount() < 77600 and petrolWBRemain == 0)    // VAUGHAN EDIT
          waterWBRemain = 116400;        // 3 tankers        // VAUGHAN EDIT

        req.dst = me;
        req.dstQueue = waterQueue;

        ret[ret.size()] = req;
      }
    }*/

    rate = GetProcessInput("multi_consumer_producer", GetQueue("av_in_q"), GetAsset().FindAsset("avgas"));
    if (rate > 0)
    {
      if (avgasQueue.GetQueueCount() < 145000 or avWBRemain > 0)  // approx 25% of full
      {
        ResourceRequirement req = new ResourceRequirement();

        req.resource = avgasQueue.GetProductFilter().GetProducts()[0];

        // This is how many we have asked for. Wait till it is fullfilled,
        // if we are not already waiting for a waybill to be completed.
        req.amount = 465600;        // 12 tank cars
        if (avgasQueue.GetQueueCount() < 145000 and avWBRemain == 0)
          avWBRemain = 465600;

        req.dst = me;
        req.dstQueue = avgasQueue;

        ret[ret.size()] = req;
      }
    }

    return ret;
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("multi_PickupDropoff");
    destTracks[destTracks.size()] = "out_track0";
  }

};


Multiple Industry New
[Industries]

Multiple Industry New

config.txt:

﻿
username            "Multiple_Industry_New"
kind              "industry"
light             1
region              "TRS2004"
kuid              <kuid:-19:10165>
obsolete-table {
  0           <kuid:-19:10152>
}
type              "Industrial"
nightmode           "lamp"
script              "MultipleIndustryNew"
class             "MultipleIndustryNew"
icon-texture            "icon_multiple.tga"
preview-mesh-kuid         <kuid:-3:10154>
kuid-table {
  coal            <kuid:44179:60013>
  diesel            <kuid:-3:10011>
  cont20ft          <kuid:-3:10014>
  cont40ft          <kuid:-3:10041>
  gengoods          <kuid:-3:10013>
  logs            <kuid:-3:10001>
  lumber            <kuid:-3:10003>
  woodchips         <kuid:-3:10002>
  oil           <kuid:-3:10010>
  petrol            <kuid:-3:10012>
  water           <kuid:-3:10004>
  avgas           <kuid:-3:10045>
}
mesh-table {
  default {
    mesh          "Multiple_Industry.im"
    auto-create       1
    effects {
      arrow0 {
        att     "a.track0a"
        default-mesh    <kuid:-3:10092>
        surveyor-only   1
        kind      "attachment"
      }
      arrow1 {
        att     "a.track0f"
        default-mesh    <kuid:-3:10092>
        surveyor-only   1
        kind      "attachment"
      }
    }
  }
}
attached-track {
  out_track0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
      4       "a.track0e"
      5       "a.track0f"
    }
  }
}
attached-trigger {
  trig0 {
    att         "a.track0b"
    radius          10
  }
  trig1 {
    att         "a.track0c"
    radius          10
  }
  trig2 {
    att         "a.track0d"
    radius          10
  }
  trig3 {
    att         "a.track0e"
    radius          10
  }
}
queues {
  queue1 {
    size          100
    allowed-products {
    }
  }
  queue2 {
    size          100
    allowed-products {
    }
  }
  queue3 {
    size          100
    allowed-products {
    }
  }
  queue4 {
    size          100
    allowed-products {
    }
  }
  queue5 {
    size          100
    allowed-products {
    }
  }
  queue6 {
    size          100
    allowed-products {
    }
  }
}
processes {
  multi_consumer_producer {
    start-enabled       1
    duration        30
    inputs {
    }
    outputs {
    }
  }
}
icon0             <kuid:-3:10164>
string-table {
  multi_pickupdropoff       "Multiple Pickup/Drop off"
  property_name_add_queue       "Add Queue"
  property_name_add_product     "Add Product"
  property_name_add_product_input     "Add Product to Input"
  property_name_add_product_output    "Add Product to Output"
  property_name_set_max_units     "Set Max Units"
  property_name_set_track_queue     "Set Track Queue"
  property_name_set_init_prod_amount    "Set Initial Product Amount"
  property_name_set_process_duration    "Set Process Duration"
  property_name_set_prod_input_amount   "Set Product Input Amount"
  property_name_set_prod_output_amount    "Set Product Output Amount"
  property_name_set_prod_vehicle      "Set Product Vehicle"
  property_name_set_waybill_percent   "Set Waybill Issue Percent"
  property_name_set_description     "Set Description"
  html_description_tag        "Description: "
  html_warnings         "WARNING: $0 is limited to $1 units"
  html_metric_type_mass       "Tonnes"
  html_metric_type_volume       "Litres"
  html_metric_type_count        "Items"
  html_ipic_queue_waybill       "Waybill %: "
  html_ipic_queue_size        "Size: "
  html_track_mode_load        "Load into vehicle"
  html_track_mode_unload        "Unload from vehicle"
  html_track_mode_both        "Load into vehicle and Unload from vehicle"
  html_item_headings_mode       "Mode: "
  html_item_headings_consume      "Consume: "
  html_item_headings_produce      "Produce: "
  html_item_headings_vehicle      "Vehicle: "
  html_item_headings_loadsize     "Load Size: "
  html_item_headings_products     " Products"
  html_item_headings_queue      "Queue: "
  html_item_headings_units      " ($0 units)"
  html_product_details_duration     "Duration: "
  html_product_details_enabled      "Start Enabled: "
  html_description_expand_queues      "<BR><B>Queues</B>: Setup each of your <i>product queues</i> by clicking the black plus icon and choosing a <i>product</i>.<BR>
You can add multiple <i>products</i> to the same <i>queue</i> in order to support multiple <i>products</i>. Changing the <i>queue</i> size allows you to change the maximium number of <i>products</i> allowed in the <i>queue</i>.<BR>
To change the initial number of <i>products</i> in a <i>queue</i>, click the <i>product</i> icon in the <i>queue</i> and change it's value.<BR>
This value is initially in <i>tonnes</i>, but can be changed under the <i><B>Products</B><i> section.<BR><BR>"
  html_description_expand_tracks      "<BR><B>Tracks</B>: Setup each of your <i>tracks</i> by clicking the black plus icon and choosing a <i>product</i> to load/unload on that track.<BR>
You can add multiple <i>products</i> to the same <i>track</i> in order to support multiple <i>products</i> on that <i>track</i>.<BR>
After selecting a <i>product</i> you can choose whether you only want it to load/unload or both.<BR>
You can also change the queue that it will get loaded or unloaded to.<BR><BR>"
  html_description_expand_processes   "<BR><B>Processes</B>: Add <i>Inputs</i> and <i>Outputs</i> to each <i>process</i> by clicking the black plus icon on the appropriate side. Anything on the left side of the red arrow indicates <i>inputs</i>. Anything on the right side indicates <i>outputs</i><BR>
You can add multiple <i>products</i> to the same <i>process</i> in order to support multiple <i>consumption</i> and <i>production</i> of <i>products</i>.<BR>
After selecting a <i>product</i> you can select how much of that product you want it to <i>Consume</i> or <i>Produce</i>.<BR>
This value is initially in <i>tonnes</i>, but can be changed under the <i><B>Products</B><i> section.<BR><BR>"
  html_description_expand_products    "<BR><B>Products</B>: Products displayed here, are products that you have used in a <i>queue</i>.<BR>
Specifying a <i>vehicle</i> will allow the load size to be displayed in the correct size for the <i>vehicle</i>. This means that in driver, it will tell you how many vehicles are needed to either empty or fill a particular <i>Queue</i><BR>
Changing the default value of <i>Tonnes</i> to <i>Litres</i> or <i>Items</i> will have an effect on the driver <i>View Details</i> interface, as well as when entering values in the <I><B>Queues</B></I> and <I><B>Processes</B></I> tabs.<BR><BR>"
}
username-de           "Multi-Industrie, neu"
string-table-de {
  multi_pickupdropoff       "Mehrfache Aufladung/Abladung"
  property_name_add_queue       "Warteschlange hinzufügen"
  property_name_add_product     "Produkt hinzufügen"
  property_name_add_product_input     "Produkt dem Wareneingang hinzufügen"
  property_name_add_product_output    "Produkt dem Warenausgang hinzufügen"
  property_name_set_max_units     "Maximale Einheiten festlegen"
  property_name_set_track_queue     "Streckenwarteschlange festlegen"
  property_name_set_init_prod_amount    "Anfangsmenge des Produkts festlegen"
  property_name_set_process_duration    "Prozessdauer festlegen"
  property_name_set_prod_input_amount   "Produkt-Eingangsmenge festlegen"
  property_name_set_prod_output_amount    "Produkt-Ausgangsmenge festlegen"
  property_name_set_prod_vehicle      "Produkt-Fahrzeug festlegen"
  property_name_set_waybill_percent   "Set Waybill Issue Percent"
  property_name_set_description     "Beschreibung festlegen"
  html_description_tag        "Beschreibung: "
  html_warnings         "WARNUNG: $0 ist auf $1 Einheiten beschränkt"
  html_metric_type_mass       "Tonnen"
  html_metric_type_volume       "Liter"
  html_metric_type_count        "Stück"
  html_ipic_queue_waybill       "Frachtbrief %: "
  html_ipic_queue_size        "Größe: "
  html_track_mode_load        "Auf Fahrzeug aufladen"
  html_track_mode_unload        "Von Fahrzeug abladen"
  html_track_mode_both        "Auf Fahrzeug aufladen und von Fahrzeug abladen"
  html_item_headings_mode       "Modus: "
  html_item_headings_consume      "Verbrauch: "
  html_item_headings_produce      "Produktion: "
  html_item_headings_vehicle      "Fahreug: "
  html_item_headings_loadsize     "Ladegröße: "
  html_item_headings_products     " Produkte"
  html_item_headings_queue      "Warteschlange: "
  html_item_headings_units      " ($0 Einheiten)"
  html_product_details_duration     "Dauer: "
  html_product_details_enabled      "Von Anfang an aktiviert: "

  html_description_expand_queues      "<BR><B>Warteschlangen</B>: Richten Sie jede Ihrer <i>Produkt-Warteschlangen</i> ein, indem Sie das schwarze Plus-Symbol anklicken und ein <i>Produkt</i> auswählen.<BR>

Sie können der selben <i>Warteschlange</i> mehrere <i>Produkte</i> hinzufügen, um mehrere <i>Produkte</i> zu unterstützen. Das Ändern der <i>Warteschlangen</i>-Größe ermöglicht Ihnen die maximale Anzahl an <i>Produkten</i> die in der <i>Warteschlange</i> möglich sind, zu bestimmen.<BR>

Um die Anfangsmenge eines <i>Produkts</i> in einer <i>Warteschlange</i> festzulegen, klicken Sie auf das <i>Produkt</i>-Symbol in der <i>Warteschlange</i> und ändern den Wert.<BR>

Dieser Wert wird standardmäßig in <i>Tonnen</i> angezeigt, kann aber im Abschnitt <i><B>Produkte</B><i> geändert werden.<BR><BR>"
  html_description_expand_tracks      "<BR><B>Strecken</B>: Richten Sie Ihre <i>Strecken</i> ein, indem Sie das schwarze Plus-Symbol anklicken und ein <i>Produkt</i> auswählen, das auf dieser Strecke aufgeladen bzw. abgeladen werden soll.<BR>

Sie können der selben <i>Strecke</i> mehrere <i>Produkte</i> hinzufügen, um mehrere <i>Produkte</i> auf dieser <i>Strecke</i> zu unterstützen.

Nach Auswahl eines <i>Produkts</i> können Sie auswählen ob Sie abladen, aufladen oder beides wollen.<BR>

Sie können auch die Warteschlange auf die abgeladen bzw. aufgeladen werden soll ändern.<BR><BR>"
  html_description_expand_processes   "<BR><B>Prozesse</B>: Fügen Sie jedem <i>Prozess</i> <i>Wareneingänge</i> und <i>Warenausgänge</i> hinzu, indem Sie das schwarze Plus-Symbol auf der entsprechenden Seite anklicken. Alles auf der linken Seite des roten Pfeils steht für <i>Wareneingänge</i>. Alles auf der rechten Seite steht für <i>Warenausgänge</i><BR>

Sie können einem <i>Prozess</i> mehrere <i>Produkte</i> zuordnen, um mehrere <i>Verbrauchs-</i> und <i>Produktions-</i>Werte für die <i>Produkte</i> festzulegen.<BR>

Nach Auswahl eines <i>Produkts</i> können Sie festlegen, welche Mengen dieses Produkts <i>verbraucht</i> oder <i>produziert</i> werden sollen.<BR>

Dieser Wert wird standardmäßig in <i>Tonnen</i> angezeigt, kann aber im Abschnitt <i><B>Produkte</B><i> geändert werden.<BR><BR>"
  html_description_expand_products    "<BR><B>Produkte</B>: Produkte die hier angezeigt werden, sind Produkte die einer <i>Warteschlange</i> zugewiesen sind.<BR>

Die Angabe eines <i>Fahrzeugs</i> erlaubt die korrekte Anzeige der Lademenge in der zum <i>Fahrzeug</i> passenden Einheit. Das bedeutet, dass im Fahrer-Modus angezeigt wird, wieviele Fahrzeuge benötigt werden, um eine bestimmte <i>Warteschlange</i> zu füllen oder zu leeren.<BR>

Das Ändern der Standard-Einheit von <i>Tonnen</i> in <i>Liter</i> oder <i>Stück</i> beeinflusst die <i>Details ansehen</i>-Anzeige, und die Eingabefelder für <I><B>Warteschlangen</B></I> und <I><B>Prozesse</B></I><BR><BR>"
}
username-it           "Multiple_Industry_basic"
string-table-it {
  multi_pickupdropoff       "Multiple Pickup/Drop off"
}
username-es           "Industria_Múltiple_Nuevo"
string-table-es {
  multi_pickupdropoff       "Recogida/entrega múltiple"
  property_name_add_queue       "Añadir cola"
  property_name_add_product     "Añadir producto"
  property_name_add_product_input     "Añadir entrada de producto"
  property_name_add_product_output    "Añadir salida de producto"
  property_name_set_max_units     "Configurar máx. unidades"
  property_name_set_track_queue     "Configurar cola de vías"
  property_name_set_init_prod_amount    "Configurar cantidad inicial de producto"
  property_name_set_process_duration    "Configurar duración del proceso"
  property_name_set_prod_input_amount   "Configurar cantidad de entrada del producto"
  property_name_set_prod_output_amount    "Configurar cantidad de salida del producto"
  property_name_set_prod_vehicle      "Configurar vehículo del producto"
  property_name_set_waybill_percent   "Configurar porcentaje de reparto de la hoja de ruta"
  property_name_set_description     "Configurar descripción"
  html_description_tag        "Descripción: "
  html_warnings         "ATENCIÓN: $0 se limita a $1 unidades"
  html_metric_type_mass       "Toneladas métricas"
  html_metric_type_volume       "Litros"
  html_metric_type_count        "Objetos"
  html_ipic_queue_waybill       "% de hoja de ruta: "
  html_ipic_queue_size        "Tamaño: "
  html_track_mode_load        "Cargar en vehículo"
  html_track_mode_unload        "Descargar del vehículo"
  html_track_mode_both        "Cargar en vehículo y descargar de éste"
  html_item_headings_mode       "Modo: "
  html_item_headings_consume      "Consumo: "
  html_item_headings_produce      "Producción: "
  html_item_headings_vehicle      "Vehículo: "
  html_item_headings_loadsize     "Tamaño de la carga: "
  html_item_headings_products     " Productos"
  html_item_headings_queue      "Cola: "
  html_item_headings_units      " ($0 unidades)"
  html_product_details_duration     "Duración: "
  html_product_details_enabled      "Inicio activado: "
  html_description_expand_queues      "<BR><B>Colas</B>: Configura cada una de las <i>colas de productos</i> haciendo clic en el signo negro de sumar y escoge un <i>producto</i>.<BR>

Puedes añadir varios <i>productos</i> a la misma <i>cola</i> para admitir <i>productos</i> múltiples. Cambiar el tamaño de la <i>cola</i> te permite cambiar la cantidad máxima de <i>productos</i> admitidos en la <i>cola</i>.<BR>

Para cambiar el número inicial de <i>productos</i> en una <i>cola</i>, haz clic en el icono del <i>producto</i> que hay en la <i>cola</i> y cambia su valor.<BR>

Este valor está, en un principio, en <i>toneladas métricas</i>, pero puede cambiarse en el apartado <i><B>Productos</B><i>.<BR><BR>"
  html_description_expand_tracks      "<BR><B>Vías</B>: Configura cada una de las <i>vías</i> haciendo clic en el signo negro de sumar y escoge el <i>producto</i> a cargar/descargar en esa vía.<BR>

Puedes añadir varios <i>productos</i> a la misma <i>vía</i> para admitir <i>productos</i> múltiples en esa <i>vía</i>.<BR>

Tras seleccionar un <i>producto</i>, puedes elegir si sólo quieres cargarlo, descargarlo o ambas cosas.<BR>

También puedes cambiar la cola en la que se cargará o descargará.<BR><BR>"
  html_description_expand_processes   "<BR><B>Procesos</B>: Añade <i>Entradas</i> y <i>Salidas</i> a cada <i>proceso</i> haciendo clic en el lado correspondiente del icono del signo negro de sumar. Todo lo que esté en el lado izquierdo de la flecha roja indica <i>entradas</i>. Todo lo que esté al lado derecho, <i>salidas</i>.<BR>

Puedes añadir varios <i>productos</i> al mismo <i>proceso</i> para permitir la multiplicidad del <i>consumo</i> y la <i>producción</i> de <i>productos</i>.<BR>

Tras seleccionar un <i>producto</i>, también podrás escoger la cantidad de <i>Consumo</i> o <i>Producción</i> de éste que quieras.<BR>

Este valor está, en un principio, en <i>toneladas métricas</i>, pero puede cambiarse en el apartado <i><B>Productos</B><i>.<BR><BR>"
  html_description_expand_products    "<BR><B>Productos</B>: Los productos que aparecen aquí son los que has utilizado en la <i>cola</i>.<BR>

Especificar un <i>vehículo</i> permitirá que el tamaño de la carga se especifique en escala correcta para el <i>vehículo</i>. Esto significa que, en el modo Maquinista, se te informará de cuántos vehículos se necesitan para llenar o vaciar una <i>cola</i>en concreto.<BR>

Cambiar el valor predeterminado en <i>Toneladas métricas</i> a <i>Litros</i> u <i>Objetos</i> tendrá efectos en la interfaz <i>Ver detalles</i> del Maquinista, así como cuando se introduzcan valores en las pestañas de <I><B>Colas</B></I> y <I><B>Procesos</B></I>.<BR><BR>"
}
username-pl           "Multiple_Industry_New"
string-table-pl {
  multi_pickupdropoff       "Multiple Pickup/Drop off"
  property_name_add_queue       "Add Queue"
  property_name_add_product     "Add Product"
  property_name_add_product_input     "Add Product to Input"
  property_name_add_product_output    "Add Product to Output"
  property_name_set_max_units     "Set Max Units"
  property_name_set_track_queue     "Set Track Queue"
  property_name_set_init_prod_amount    "Set Initial Product Amount"
  property_name_set_process_duration    "Set Process Duration"
  property_name_set_prod_input_amount   "Set Product Input Amount"
  property_name_set_prod_output_amount    "Set Product Output Amount"
  property_name_set_prod_vehicle      "Set Product Vehicle"
  property_name_set_waybill_percent   "Set Waybill Issue Percent"
  property_name_set_description     "Set Description"
  html_description_tag        "Description: "
  html_warnings         "WARNING: $0 is limited to $1 units"
  html_metric_type_mass       "Tonnes"
  html_metric_type_volume       "Litres"
  html_metric_type_count        "Items"
  html_ipic_queue_waybill       "Waybill %: "
  html_ipic_queue_size        "Size: "
  html_track_mode_load        "Load into vehicle"
  html_track_mode_unload        "Unload from vehicle"
  html_track_mode_both        "Load into vehicle and Unload from vehicle"
  html_item_headings_mode       "Mode: "
  html_item_headings_consume      "Consume: "
  html_item_headings_produce      "Produce: "
  html_item_headings_vehicle      "Vehicle: "
  html_item_headings_loadsize     "Load Size: "
  html_item_headings_products     " Products"
  html_item_headings_queue      "Queue: "
  html_item_headings_units      " ($0 units)"
  html_product_details_duration     "Duration: "
  html_product_details_enabled      "Start Enabled: "
  html_description_expand_queues      "<BR><B>Queues</B>: Setup each of your <i>product queues</i> by clicking the black plus icon and choosing a <i>product</i>.<BR>

You can add multiple <i>products</i> to the same <i>queue</i> in order to support multiple <i>products</i>. Changing the <i>queue</i> size allows you to change the maximium number of <i>products</i> allowed in the <i>queue</i>.<BR>

To change the initial number of <i>products</i> in a <i>queue</i>, click the <i>product</i> icon in the <i>queue</i> and change it's value.<BR>

This value is initially in <i>tonnes</i>, but can be changed under the <i><B>Products</B><i> section.<BR><BR>"
  html_description_expand_tracks      "<BR><B>Tracks</B>: Setup each of your <i>tracks</i> by clicking the black plus icon and choosing a <i>product</i> to load/unload on that track.<BR>

You can add multiple <i>products</i> to the same <i>track</i> in order to support multiple <i>products</i> on that <i>track</i>.<BR>

After selecting a <i>product</i> you can choose whether you only want it to load/unload or both.<BR>

You can also change the queue that it will get loaded or unloaded to.<BR><BR>"
  html_description_expand_processes   "<BR><B>Processes</B>: Add <i>Inputs</i> and <i>Outputs</i> to each <i>process</i> by clicking the black plus icon on the appropriate side. Anything on the left side of the red arrow indicates <i>inputs</i>. Anything on the right side indicates <i>outputs</i><BR>

You can add multiple <i>products</i> to the same <i>process</i> in order to support multiple <i>consumption</i> and <i>production</i> of <i>products</i>.<BR>

After selecting a <i>product</i> you can select how much of that product you want it to <i>Consume</i> or <i>Produce</i>.<BR>

This value is initially in <i>tonnes</i>, but can be changed under the <i><B>Products</B><i> section.<BR><BR>"
  html_description_expand_products    "<BR><B>Products</B>: Products displayed here, are products that you have used in a <i>queue</i>.<BR>

Specifying a <i>vehicle</i> will allow the load size to be displayed in the correct size for the <i>vehicle</i>. This means that in driver, it will tell you how many vehicles are needed to either empty or fill a particular <i>Queue</i><BR>

Changing the default value of <i>Tonnes</i> to <i>Litres</i> or <i>Items</i> will have an effect on the driver <i>View Details</i> interface, as well as when entering values in the <I><B>Queues</B></I> and <I><B>Processes</B></I> tabs.<BR><BR>"
}
username-cz           "Flexibilní_průmyslová_stavba_nová"
string-table-cz {
  multi_pickupdropoff       "Flexibilní nakládka/vykládka"
  property_name_add_queue       "Přidat frontu"
  property_name_add_product     "Přidat surovinu"
  property_name_add_product_input     "Přidat surovinu do spotřeby"
  property_name_add_product_output    "Přidat surovinu do výroby"
  property_name_set_max_units     "Nastavit max. jednotek"
  property_name_set_track_queue     "Nastavit traťovou frontu"
  property_name_set_init_prod_amount    "Nastavit počáteční množství suroviny"
  property_name_set_process_duration    "Nastavit délku zpracování"
  property_name_set_prod_input_amount   "Nastavit míru spotřeby"
  property_name_set_prod_output_amount    "Nastavit míru produkce"
  property_name_set_prod_vehicle      "Zvolit vagón na surovinu"
  property_name_set_waybill_percent   "Nastavit procenta pro vystavení poptávkového lístku"
  property_name_set_description     "Zadat popis"
  html_description_tag        "Popis: "
  html_warnings         "POZOR: $0 je omezeno na $1 jednotek"
  html_metric_type_mass       "Tun"
  html_metric_type_volume       "Litrů"
  html_metric_type_count        "Jednotek"
  html_ipic_queue_waybill       "Poptávkový lístek %: "
  html_ipic_queue_size        "Velikost: "
  html_track_mode_load        "Naložit do vagónu"
  html_track_mode_unload        "Vyložit z vagónu"
  html_track_mode_both        "Naložit i vyložit"
  html_item_headings_mode       "Mód: "
  html_item_headings_consume      "Spotřeba: "
  html_item_headings_produce      "Výroba: "
  html_item_headings_vehicle      "Vagón: "
  html_item_headings_loadsize     "Velikost nákladu: "
  html_item_headings_products     " Produkty"
  html_item_headings_queue      "Fronta: "
  html_item_headings_units      " ($0 jednotek)"
  html_product_details_duration     "Trvání: "
  html_product_details_enabled      "Zapnuto: "
  html_description_expand_queues      "<BR><B>Fronty</B>: Jednotlivé <i>produktové fronty</i> nastav kliknutím na černou ikonu se symbolem '+' a vybráním požadované <i>suroviny</i>.<BR>

Jedné <i>frontě</i> lze přiřadit i více <i>surovin</i>. Velikost <i>fronty</i> má vliv na maximální objem <i>surovin</i>, které v ní mohou čekat.<BR>

Pro nastavení počátečního množství <i>surovin</i> ve <i>frontě</i>, klikni na ikonu <i>suroviny</i> v příslušné <i>frontě</i> a zadej požadovanou hodnotu.<BR>

Tato hodnota je na počátku uvedena <i>tunách</i>, ale její jednotky lze změnit v sekci <i><B>suroviny</B><i>.<BR><BR>"
  html_description_expand_tracks      "<BR><B>Koleje</B>: Jednotlivé <i>koleje</i> nastav kliknutím na černou ikonu se symbolem '+' a vybráním požadované <i>suroviny</i>, se kterou se zde bude pracovat.<BR>

Jedné <i>koleji</i> lze přiřadit i více <i>surovin</i>.<BR>

Po zvolení <i>suroviny</i> si můžež vybrat, jestli zde má probíhat její vykládka, nakládka či obojí.<BR>

U koleje si dále můžeš zvolit produktovou frontu, se kterou bude spojena.<BR><BR>"
  html_description_expand_processes   "<BR><B>Procesy</B>: <i>Vstupní</i> a <i>výstupní</i> suroviny můžeš každému <i>procesu</i> nastavit kliknutím na černou ikonu se symbolem '+'. Ikona na levé straně červené šipky nastavuje <i>vstupy</i>, ikona napravo pak <i>výstupy</i>.<BR>

Jednomu <i>procesu</i> lze přiřadit i více <i>surovin</i>. Stavba pak bude <i>spotřebovávat</i> a/nebo <i>vyrábět</i> více <i>surovin</i>.<BR>

Po zvolení <i>suroviny</i> si můžeš nastavit míru její <i>spotřeby</i> nebo <i>výroby</i>.<BR>

Tato hodnota je na počátku uvedena <i>tunách</i>, ale její jednotky lze změnit v sekci <i><B>suroviny</B><i>.<BR><BR>"
  html_description_expand_products    "<BR><B>Suroviny</B>: Zde jsou zobrazeny suroviny, které jsi zadal v sekci <i>Fronty</i>.<BR>

Po zvolení <i>vagónu</i> bude zobrazena správná velikost nákladu pro tento typ <i>vozu</i>. V módu Strojvůdce pak budeš moci snadno zjistit, kolik vagónů je potřeba pro vyprázdnění či zaplnění dané <i>fronty</i><BR>

Změna standardních jednotek - <i>tun</i> na <i>litry</i> nebo obecné <i>jednotky</i> se projeví na zobrazení statistik v okně <i>Zobrazit detaily</i> a při zadávání hodnot v záložkách <I><B>Fronty</B></I> a <I><B>Procesy</B></I>.<BR><BR>"
}
username-ru           "Множественная_Индустрая_новая"
string-table-ru {
  multi_pickupdropoff       "Погрузка/разгрузка различных грузов"
}
username-fr           "Nouvelle_industrie_multiple"
string-table-fr {
  multi_pickupdropoff                                                    "Chargement/déchargement multiple"
  property_name_add_queue                                                                          "Ajouter file d'attente"
  property_name_add_product                                                      "Ajouter produit"
  property_name_add_product_input                                                          "Ajouter produit en entrée"
  property_name_add_product_output                                        "Ajouter produit en sortie"
  property_name_set_max_units                                                  "Définir unités maximum"
  property_name_set_track_queue                                              "Définir file d'attente de voies"
  property_name_set_init_prod_amount                                    "Définir quantité initial du produit"
  property_name_set_process_duration                                    "Définir durée opération"
  property_name_set_prod_input_amount       "Définir quantité en entrée"
  property_name_set_prod_output_amount                                "Définir quantité en sortie"
  property_name_set_prod_vehicle                                            "Définir véhicule produit"
  property_name_set_waybill_percent                                      "Définir le pourcentage d'émission de bons de commande"
  property_name_set_description                                              "Modifier description"
  html_description_tag                                                                "Description : "
  html_warnings                                                                              "AVERTISSEMENT : $0 est limité à $1 unités"
  html_metric_type_mass                                                              "Tonnes"
  html_metric_type_volume                                                                          "Litres"
  html_metric_type_count                                                            "Articles"
  html_ipic_queue_waybill                                                                          "Bon de commande % : "
  html_ipic_queue_size                                                                "Taille : "
  html_track_mode_load                                                                "Charger dans véhicule"
  html_track_mode_unload                                                            "Décharger depuis véhicule"
  html_track_mode_both                                                                "Charger dans le véhicule et décharger depuis le véhicule"
  html_item_headings_mode                                                                          "Mode : "
  html_item_headings_consume                                                    "Consomme : "
  html_item_headings_produce                                                    "Produit : "
  html_item_headings_vehicle                                                    "Véhicule : "
  html_item_headings_loadsize                                                  "Taille du chargement : "
  html_item_headings_products                                                  "Produits"
  html_item_headings_queue                                                        "File d'attente : "
  html_item_headings_units                                                        " ($0 unités)"
  html_product_details_duration                                              "Durée : "
  html_product_details_enabled                                                "Démarrage activé : "
  html_description_expand_queues                                            "<BR><B>Files d'attente</B> : modifiez chacune de vos <i>files de production</i> en cliquant sur l'icone noir représentant un symbole plus et en sélectionnant un <i>produit</i>.<BR>

Vous pouvez assigner plusieurs <i>produits</i> à une même <i>file</i> pour diversifier votre production. Modifier la taille de votre <i>file d'attente</i> vous permet de régler le nombre maximum de <i>produits</i> autorisés dans celle-ci.<BR>

Pour modifier le nombre initial de <i>produits</i> dans une <i>file d'attente</i>, cliquez sur l'icone <i>produit</i> dans celle-ci avant de procéder aux réglages qui vous conviennent.<BR>

Cette valeur est initialement calculée en <i>tonnes</i>, mais rien ne vous empêche de changer d'unité de mesure via la section <i><B>Produits</B><i>.<BR><BR>"
  html_description_expand_tracks                                            "<BR><B>Voies</B> : modifiez chacune de vos <i>voies</i> en cliquant sur l'icone noir représentant un symbole plus et sélectionnez un produit à charger/décharger via cette <i>voie</i>.<BR>

Vous pouvez assigner de multiples <i>produits</i> à une même <i>voie</i>, ce qui permet de l'exploiter efficacement.<BR>

Après avoir sélectionné un <i>produit</i>, vous avez le choix entre le charger, le décharger, ou les deux.<BR>

Vous pouvez également choisir sa file d'attente d'origine ou de destination.<BR><BR>"
  html_description_expand_processes                                      "<BR><B>File de production</B> : vous pouvez modiier les <i>entrées</i> et <i>sorties</i> propres à chaque <i>file de production</i> en cliquant sur l'une des deux icones noirs représentant un symbole plus. Tout ce qui se trouve à gauche de la flèche rouge concerne les <i>entrées</i>. Tout ce qui se trouve à droite concerne les produits en <i>sortie</i><BR>

Vous pouvez lier différents <i>produits</i> à la même <i>file de production</i> selon vos besoins de <i>consommation</i> et de <i>production</i>.<BR>

Après avoir sélectionné un <i>produit</i>, il n'appartient qu'à vous de définir la quantité à <i>Consommer</i> ou à <i>Produire</i>.<BR>

Cette valeur est initialement calculée en <i>tonnes</i>, mais rien ne vous empêche de changer d'unité de mesure via la section <i><B>Produits</B><i>.<BR><BR>"
  html_description_expand_products                          "<BR><B>Produits</B> : les produits affichés ici sont ceux que vous avez utilisé dans une <i>file d'attente</i>.<BR>"
  en            "sélectionnant un <i>véhicule</i>, vous obtenez automatiquement des renseignements concernant sa capacité de transport. Cela vous permet, en mode conducteur, de calculer le nombre de véhicules qui vous seront nécessaires pour remplir ou vider une <i>File d'attente</i> donnée.<BR>"
  remplacer         "l'unité <i>Tonnes</i> par des <i>Litres</i> ou des <i>Articles</i> modifie les informations contenues dans la partie <i>Voir Détails</i> de l'interface conducteur, ainsi que les valeurs des onglets <I><B>File d'attente</B></I> et <I><B>File de production</B></I>.<BR><BR>'"
}

MultipleIndustryNew.gs:

include "BaseIndustry.gs"
include "gs.gs"

//
// MultipleIndustry industry
//
class MultipleIndustryNew isclass BaseIndustry
{
  bool scriptletEnabled = true;

  bool expandQueues = false;
  bool expandTracks = false;
  bool expandProcesses = false;
  bool expandProducts = false;

  LinkedList linkedList = new LinkedList();

  //
  //
  //
  void HideAllQueueItems(int productIndex, ProductQueue foundQueue)
  {
    int k = 0;
    for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
    {
      if (k != productIndex)
      {
        int foundIndex = industryProductInfoCollection.GetQueueIndex(k, foundQueue);
        if (foundIndex > -1)
        {
          industryProductInfoCollection.ipicCollection[k].queues[foundIndex].uiIsExpanded = false;
        }
      }
    }
  }

  void HideAllTrackItems(int productIndex, string foundTrack)
  {
    int k = 0;
    for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
    {
      if (k != productIndex)
      {
        int foundIndex = industryProductInfoCollection.GetTrackIndex(k, foundTrack);
        if (foundIndex > -1)
        {
          industryProductInfoCollection.ipicCollection[k].tracks[foundIndex].uiIsExpanded = false;
        }
      }
    }
  }

  void HideAllProcessItemsOut(int productIndex, string foundProcess)
  {
    int k = 0;
    for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
    {
      if (k != productIndex)
      {
        int foundIndex = industryProductInfoCollection.GetProcessIndex(k, foundProcess);
        if (foundIndex > -1)
        {
          industryProductInfoCollection.ipicCollection[k].processes[foundIndex].SetUiIsExpanded(true, false);
          industryProductInfoCollection.ipicCollection[k].processes[foundIndex].SetUiIsExpanded(false, false);
        }
      }
      else
      {
        int foundIndex = industryProductInfoCollection.GetProcessIndex(k, foundProcess);
        if (foundIndex > -1)
          industryProductInfoCollection.ipicCollection[k].processes[foundIndex].SetUiIsExpanded(true, false);
      }
    }
  }

  void HideAllProcessItemsIn(int productIndex, string foundProcess)
  {
    int k = 0;
    for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
    {
      if (k != productIndex)
      {
        int foundIndex = industryProductInfoCollection.GetProcessIndex(k, foundProcess);
        if (foundIndex > -1)
        {
          industryProductInfoCollection.ipicCollection[k].processes[foundIndex].SetUiIsExpanded(true, false);
          industryProductInfoCollection.ipicCollection[k].processes[foundIndex].SetUiIsExpanded(false, false);
        }
      }
      else
      {
        int foundIndex = industryProductInfoCollection.GetProcessIndex(k, foundProcess);
        if (foundIndex > -1)
          industryProductInfoCollection.ipicCollection[k].processes[foundIndex].SetUiIsExpanded(false, false);
      }
    }
  }

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();
    int direction = vehicle.GetRelationToTrack(me, "out_track0");
    if (!vehicleToTrain)
      direction = -direction;

    // Are we up to the furthest trigger away from the side we entered for diesel?
    if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trig3")
      return true;
    if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trig0")
      return true;

    // If the train has already stopped, then fall thru and allow this load as well
    if (triggerName == "trig0" or triggerName == "trig1" or triggerName == "trig2" or triggerName == "trig3")
    {
      if (vehicle.GetMyTrain().IsStopped())
        return true;
    }

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (triggerName == "trig0" or triggerName == "trig1" or triggerName == "trig2" or triggerName == "trig3")
    {
      bool avWBModified = false;
      bool cont20WBModified = false;
      bool cont40WBModified = false;
      bool goodsWBModified = false;
      bool logWBModified = false;
      bool lumberWBModified = false;
      bool coalWBModified = false;
      bool woodchipWBModified = false;
      bool oilWBModified = false;
      bool dieselWBModified = false;
      bool petrolWBModified = false;
      bool waterWBModified = false;

      int spaceAvailable;
      LoadingReport report;
      int direction;
      int k;
      int i;
      int l;

      if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
      {
        for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
        {
          IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[k];
          for (i = 0; i < ipic.tracks.size(); i++)
          {
            IndustryProductInfoTracks ipit = ipic.tracks[i];

            if (ipit.mode == "BOTH" or ipit.mode == "LOAD")
            {
              //for (l = 0; l < ipic.processes.size(); l++)
              //{
                //IndustryProductInfoProcess ipip = ipic.processes[l];

                //if (ipip.GetOutputQueue())
                //{
                  IndustryProductInfoQueues ipiq = ipit.GetIPIQ();//ipip.GetOutputIPIQ();

                  //if (GetProcessOutput(ipip.GetProcessName(), ipiq.GetProductQueue(), ipic.GetProduct()) > 0)
                  {
                    spaceAvailable = ipiq.GetProductQueue().GetQueueCount();

                    report = CreateLoadingReport(ipiq.GetProductQueue(), spaceAvailable);

                    direction = vehicle.GetRelationToTrack(me, ipit.GetTrackName());
                    if (direction == Vehicle.DIRECTION_FORWARD)
                      report.sideFlags = LoadingReport.LEFT_SIDE;
                    else if (direction == Vehicle.DIRECTION_BACKWARD)
                      report.sideFlags = LoadingReport.RIGHT_SIDE;

                    vehicle.LoadProduct(report);
                    // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
                    //if (report.amount > 0)
                    //  oilWBModified = true;

                    if (ipiq.GetQueueWaybillRemain() > 0)
                      ipiq.SetQueueWaybillRemain(ipiq.GetQueueWaybillRemain() - report.amount);
                    if (ipiq.GetQueueWaybillRemain() < 0)
                      ipiq.SetQueueWaybillRemain(0);

                  }
                //}
              //}
            }
          }
        }
      }

      if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
      {
        for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
        {
          IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[k];
          for (i = 0; i < ipic.tracks.size(); i++)
          {
            IndustryProductInfoTracks ipit = ipic.tracks[i];

            if (ipit.mode == "BOTH" or ipit.mode == "UNLOAD")
            {
              //for (l = 0; l < ipic.processes.size(); l++)
              {
                //IndustryProductInfoProcess ipip = ipic.processes[l];

                //if (ipip.GetInputQueue())
                {
                  IndustryProductInfoQueues ipiq = ipit.GetIPIQ();//ipip.GetInputIPIQ();

                  //if (GetProcessInput(ipip.GetProcessName(), ipip.GetInputQueue().GetProductQueue(), ipic.GetProduct()) > 0)
                  {
                    //spaceAvailable = ipip.GetInputQueue().GetProductQueue().GetQueueSpace();
                    spaceAvailable = ipiq.GetProductQueue().GetQueueSpace();

                    report = CreateUnloadingReport(ipiq.GetProductQueue(), spaceAvailable);

                    direction = vehicle.GetRelationToTrack(me, ipit.GetTrackName());
                    if (direction == Vehicle.DIRECTION_FORWARD)
                      report.sideFlags = LoadingReport.LEFT_SIDE;
                    else if (direction == Vehicle.DIRECTION_BACKWARD)
                      report.sideFlags = LoadingReport.RIGHT_SIDE;

                    vehicle.UnloadProduct(report);

                    if (!ipiq.GetProductQueue())
                      Interface.Log("null product queue!");
                    // Already done something to the queue?  if so, set flag so that we don't unload it again. (just for this multi ind)
                    //if (report.amount > 0)
                    //  oilWBModified = true;
                    if (ipiq.GetQueueWaybillRemain() > 0)
                      ipiq.SetQueueWaybillRemain(ipiq.GetQueueWaybillRemain() - report.amount);
                    if (ipiq.GetQueueWaybillRemain() < 0)
                      ipiq.SetQueueWaybillRemain(0);

                  }
                }
              }
            }
          }
        }
      }
    }
  }

  //
  //
  //
  thread void MultipleMain(void)
  {
    wait()
    {

      // Enable this scriptlet
      on "Scriptlet-Enabled", "1":
      {
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("multi_consumer_producer", true);
        }
        continue;
      }

      // Disable this scriptlet
      on "Scriptlet-Enabled", "0":
      {
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("multi_consumer_producer", false);
        }
        continue;
      }
    }
  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    usePipeAnimation = false;
    useGenericViewDetails = true;

    /*
    AddAssetToIndustryProductInfo("cont20ft", "queue1", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("cont40ft", "queue2", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("gengoods", "queue3", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("logs", "queue4", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("lumber", "queue5", "multi_consumer_producer", true);
    AddAssetToIndustryProductInfo("coal", "queue6", "multi_consumer_producer", true);

    AddAssetToIndustryProductInfo("cont20ft", "queue1", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("cont40ft", "queue2", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("gengoods", "queue3", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("logs", "queue4", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("lumber", "queue5", "multi_consumer_producer", false);
    AddAssetToIndustryProductInfo("coal", "queue6", "multi_consumer_producer", false);
    */

    MultipleMain();
  }

  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret = new Requirement[0];

    int k = 0;
    int i = 0;
    int rate = 0;

    for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
    {
      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[k];

      for (i = 0; i < ipic.processes.size(); i++)
      {
        IndustryProductInfoProcess ipip = ipic.processes[i];

        if (ipip.GetInputQueue())
        {
          IndustryProductInfoQueues ipiq = ipip.GetInputIPIQ();
          rate = GetProcessInput(ipip.GetProcessName(), ipip.GetInputQueue().GetProductQueue(), ipic.GetProduct());

          if (ipiq.GetQueueWaybillIssuePercent() > 0)
          {
            float percentage = ipiq.GetQueueWaybillIssuePercent() / 100.0f;
            int requiredAmount = ipiq.GetProductQueue().GetQueueSize() * percentage;
            int reIssueAmnt = ipiq.GetProductQueue().GetQueueSize() - requiredAmount;

            if (rate > 0)
            {

              if (ipiq.GetProductQueue().GetQueueCount() <= reIssueAmnt or ipiq.GetQueueWaybillRemain() > 0)
              {
                ResourceRequirement req = new ResourceRequirement();

                req.resource = ipic.GetProduct();

                int requestedAmount = ipiq.GetProductQueue().GetQueueSize() - ipiq.GetProductQueue().GetQueueCount();
                // If we already had a waybill amount, that we are waiting for, then
                // just re-issue that value instead.
                if (ipiq.GetQueueWaybillRemain() > 0)
                  requestedAmount = ipiq.GetQueueWaybillRemain();

                // This is how many we have asked for. Wait till it is fullfilled,
                // if we are not already waiting for a waybill to be completed.
                req.amount = requestedAmount;
                if (ipiq.GetProductQueue().GetQueueCount() <= reIssueAmnt and ipiq.GetQueueWaybillRemain() == 0)
                  ipiq.SetQueueWaybillRemain(requestedAmount);

                req.dst = me;
                req.dstQueue = ipiq.GetProductQueue();

                ret[ret.size()] = req;
              }
            }

          }
        }
      }

    }

    return ret;
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("multi_PickupDropoff");
    destTracks[destTracks.size()] = "out_track0";
  }

  public string GetDescriptionHTML(void)
  {
    int i;
    int l;
    int k;
    int j;
    string htmlString;
    string dataString;
    string spacerCell = HTMLWindow.MakeSpacerCell(50);

    StringTable stringTable = GetAsset().GetStringTable();

    htmlString = "<html><body>" + HTMLWindow.StartFontColor("000000");

    if (userDescription.size() > 0 and userDescription[0] == ' ')
      userDescription = "&nbsp;" + userDescription;
    if (userDescription == "")
      htmlString = htmlString + stringTable.GetString("html_description_tag") + HTMLWindow.MakeLink( "live://property/userDescription", "None" ) + "<BR><BR>";
    else
      htmlString = htmlString + stringTable.GetString("html_description_tag") + HTMLWindow.MakeLink( "live://property/userDescription", userDescription ) + "<BR><BR>";

    string imgQueue = "imgQueues.tga";
    string imgTrack = "imgTracks.tga";
    string imgProcess = "imgProcesses.tga";
    string imgProduct = "imgProducts.tga";

    if (expandQueues)
      imgQueue = "imgQueues_on.tga";
    if (expandTracks)
      imgTrack = "imgTracks_on.tga";
    if (expandProcesses)
      imgProcess = "imgProcesses_on.tga";
    if (expandProducts)
      imgProduct = "imgProducts_on.tga";

    // "pre-cache our _on images, so we don't get black squares when switching to them"
    htmlString = htmlString + HTMLWindow.MakeImage("imgQueues_on.tga", false, 0, 0);
    htmlString = htmlString + HTMLWindow.MakeImage("imgTracks_on.tga", false, 0, 0);
    htmlString = htmlString + HTMLWindow.MakeImage("imgProcesses_on.tga", false, 0, 0);
    htmlString = htmlString + HTMLWindow.MakeImage("imgProducts_on.tga", false, 0, 0);

    htmlString = htmlString + "    ";

    htmlString = htmlString + HTMLWindow.MakeFontSizeMedium(
                                HTMLWindow.MakeLink( "live://property/expand/expandQueues", HTMLWindow.MakeImage(imgQueue, false, 134, 36), "Queues" )
                                + " " + HTMLWindow.MakeLink( "live://property/expand/expandTracks", HTMLWindow.MakeImage(imgTrack, false, 134, 36), "Tracks" )
                                + " " + HTMLWindow.MakeLink( "live://property/expand/expandProcesses", HTMLWindow.MakeImage(imgProcess, false, 134, 36), "Processes" )
                                + " " + HTMLWindow.MakeLink( "live://property/expand/expandProducts", HTMLWindow.MakeImage(imgProduct, false, 134, 36), "Products" )
                              ) + "<BR>";

    if (expandQueues)
    {
      htmlString = htmlString + HTMLWindow.MakeTable(
                                  HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( "", "bgcolor=#00000059 width=1" ) +
                                    HTMLWindow.MakeCell(
                                      HTMLWindow.MakeFontColorBlack(
                                        stringTable.GetString("html_description_expand_queues")
                                      )
                                    ) +
                                    HTMLWindow.MakeCell( "", "bgcolor=#00000059 width=1" )
                                  ) +
                                  HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( "" )
                                  , "bgcolor=#00000059 height=1"
                                  )

                                , "bgcolor=#FFAD0059 width=100% cellspacing=0 cellpadding=0 border=0"
                                ) + HTMLWindow.MakeTable( HTMLWindow.MakeRow( HTMLWindow.MakeCell( "" ) ), "height=4" );

      ProductQueue[] queues;
      queues = GetQueues();

      for (i = 0; i < queues.size(); i++)
      {
        ProductFilter pf = queues[i].GetProductFilter();
        Asset[] products = pf.GetProducts();
        string productList = "";

        string warnings = "";
        string instanceType = "";
        string productName = "";

        IPICQueue ipicQueue = industryProductInfoCollection.FindIPICQueue(queues[i]);
        if (ipicQueue)
        {
          IndustryProductInfoQueues[] ipiqs = ipicQueue.GetRelatedProducts();
          int q = 0;
          for (q = 0; q < ipiqs.size(); q++)
          {
            IndustryProductInfoComplete ipic = ipiqs[q].GetIPICProduct();

            // This is a single product in a collection of products from the current queue.
            Asset product = ipic.GetProduct();
            KUID kuid = product.GetKUID();
            string icon = kuid.GetHTMLString();

            int productIndex = industryProductInfoCollection.GetProductIndexFromAsset(product);
            int queueIndex = industryProductInfoCollection.GetQueueIndex(productIndex, ipiqs[q].GetProductQueue());

            productList = productList + HTMLWindow.MakeLink( "live://property/ToggleQueueDisplay/" + (string)productIndex + "/" + (string)queueIndex, HTMLWindow.MakeImage( icon, true, 32, 32 ) + " " );

            // Check if there are any limitations on the number of products in this queue.
            instanceType = product.GetConfigSoup().GetNamedTag("instance-type");
            productName = product.GetLocalisedName();
            if (instanceType == "instance")
              warnings = warnings + HTMLWindow.MakeRow(
                HTMLWindow.MakeCell( HTMLWindow.MakeBold(stringTable.GetString2("html_warnings", productName, "256")), "colspan=4" )
                );
            if (instanceType == "unique")
              warnings = warnings + HTMLWindow.MakeRow(
                HTMLWindow.MakeCell( HTMLWindow.MakeBold(stringTable.GetString2("html_warnings", productName, "4")), "colspan=4" )
              );

          }
        }

        // Add item...
        productList = productList + HTMLWindow.MakeLink( "live://property/AddQueueProduct/" + (string)i, HTMLWindow.MakeImage("imgAdd.tga", false, 32, 32, "imgAdd_over.tga") );

        // Find each product that contains this queue.
        string openProducts = "";

        if (ipicQueue)
        {
          IndustryProductInfoQueues[] ipiqs = ipicQueue.GetRelatedProducts();
          int q = 0;
          for (q = 0; q < ipiqs.size(); q++)
          {
            IndustryProductInfoComplete ipic = ipiqs[q].GetIPICProduct();
            Asset product = ipic.GetProduct();
            int productIndex = industryProductInfoCollection.GetProductIndexFromAsset(product);
            int queueIndex = industryProductInfoCollection.GetQueueIndex(productIndex, ipiqs[q].GetProductQueue());

            if (ipiqs[q].uiIsExpanded)
            {
              KUID kuid = product.GetKUID();
              string icon = kuid.GetHTMLString();

              string type = "";
              if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_MASS)
                type = "Tonnes";
              if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_VOLUME)
                type = "Litres";
              if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_COUNT)
                type = "Items";

              ProductFilter pf = Constructors.NewProductFilter();
              pf.AddProduct(ipic.GetProduct());
              int count = queues[i].CountProductMatching(pf);

              // Perform conversion on count to translate to type.
              float massPerUnit = ipic.GetProduct().GetConfigSoup().GetNamedTagAsFloat("mass");
              string strConvCount = HTMLWindow.UnitsToString(count, massPerUnit, type);

              openProducts = openProducts + HTMLWindow.MakeTable(
                                              HTMLWindow.MakeRow(
                                                HTMLWindow.MakeCell( HTMLWindow.MakeImage( icon, true, 64, 64 ), "width=64" )
                                                + HTMLWindow.MakeCell( HTMLWindow.MakeBold( ipic.GetProduct().GetLocalisedName() ) + "<BR>" + HTMLWindow.MakeItalic(type + ": ") + HTMLWindow.MakeLink( "live://property/SetQueueProductCount/" + (string)productIndex + "/" + (string)queueIndex, strConvCount ) + stringTable.GetString1("html_item_headings_units", count) + "<BR>" + HTMLWindow.MakeLink( "live://property/RemoveQueueProduct/" + (string)productIndex + "/" + (string)i, HTMLWindow.MakeImage("imgRemove.tga", false, 32, 32, "imgRemove_over.tga") ) )
                                              )
                                              , "bgcolor=#FFAD0059 width=300 bordercolor=#00000059"
                                            );
              // TODO:!:!:!.! DO WE NEED TO BREAK HERE OR NOT?!?!?!?
              //break;
            }
          }
        }

        // Find each product that contains this queue.

        // Found a product in this queue.
        // Properties of the process list:

        if (ipicQueue)
        {
          int queueIndex = i;
          string wayBillCode = "";
          int waybillPct = 0;
          IndustryProductInfoQueues[] ipiqs = ipicQueue.GetRelatedProducts();
          if (ipiqs.size() > 0)
          {
            waybillPct = ipiqs[0].GetQueueWaybillIssuePercent();
            wayBillCode = HTMLWindow.MakeCell( HTMLWindow.MakeItalic( stringTable.GetString("html_ipic_queue_waybill") ) + HTMLWindow.MakeLink( "live://property/SetWaybillIssuePct/" + (string)queueIndex, (string)waybillPct ) );
          }

          htmlString = htmlString + HTMLWindow.MakeTable(
                                      HTMLWindow.MakeRow(
                                        HTMLWindow.MakeCell( HTMLWindow.MakeImage("imgArrowRight.tga") + " " + queues[i].GetQueueName(), "width=190" )
                                        + HTMLWindow.MakeCell( HTMLWindow.MakeItalic( stringTable.GetString("html_ipic_queue_size") ) + HTMLWindow.MakeLink( "live://property/SetQueueSize/" + (string)queueIndex, (string)queues[i].GetQueueSize() ), "width=80")
                                        + wayBillCode
                                      , "bgcolor=#C9880059")
                                      + HTMLWindow.MakeRow(
                                        HTMLWindow.MakeCell( productList, "colspan=4" )
                                      )
                                      + HTMLWindow.MakeRow(
                                        HTMLWindow.MakeCell( openProducts + "<BR>", "colspan=4" )
                                      )
                                      + warnings
                                    , "bgcolor=#FFAD0059 width=100% bordercolor=#00000059"
                                    )
                                    + HTMLWindow.MakeTable( HTMLWindow.MakeRow( HTMLWindow.MakeCell( "" ) ), "height=4" );
        }

      }
    }

    if (expandTracks)
    {
      htmlString = htmlString + HTMLWindow.MakeTable(
                                  HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( "", "bgcolor=#00000059 width=1" ) +
                                    HTMLWindow.MakeCell(
                                      HTMLWindow.MakeFontColorBlack(
                                        stringTable.GetString("html_description_expand_tracks")
                                      )
                                    ) +
                                    HTMLWindow.MakeCell( "", "bgcolor=#00000059 width=1" )
                                  ) +
                                  HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( "" )
                                  , "bgcolor=#00000059 height=1"
                                  )

                                , "bgcolor=#FFAD0059 width=100% cellspacing=0 cellpadding=0 border=0"
                                ) + HTMLWindow.MakeTable( HTMLWindow.MakeRow( HTMLWindow.MakeCell( "" ) ), "height=4" );

      // Get all the tracks.
      string[] destNames = new string[0];
      string[] destTracks = new string[0];
      AppendDriverDestinations(destNames, destTracks);

      for (i = 0; i < destNames.size(); i++)
      {
        // Properties of the process list:
        string productList = "";
        string openProducts = "";

        // Loop through each of the products, and then loop through each of the tracks that are associated with that product.
        for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
        {
          IndustryProductInfoComplete ipiCollection = industryProductInfoCollection.ipicCollection[k];
          for (l = 0; l < ipiCollection.tracks.size(); l++)
          {
            IndustryProductInfoTracks ipiTrack = ipiCollection.tracks[l];
            if (ipiTrack.GetTrackName() == destTracks[i])
            {
              Asset asset = ipiCollection.GetProduct();
              KUID kuid = asset.GetKUID();
              string icon = kuid.GetHTMLString();

              productList = productList + HTMLWindow.MakeLink( "live://property/ToggleTrackDisplay/" + (string)k + "/" + (string)l, HTMLWindow.MakeImage( icon, true, 32, 32 ) + " " );
            }
          }
        }

        // Add item...
        productList = productList + HTMLWindow.MakeLink( "live://property/AddTrackProduct/" + (string)destTracks[i], HTMLWindow.MakeImage("imgAdd.tga", false, 32, 32, "imgAdd_over.tga") );

        // Find each product that contains this track.
        for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
        {
          IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[k];
          int trackIndex = industryProductInfoCollection.GetTrackIndex(k, destTracks[i]);
          if (trackIndex > -1)
          {
            IndustryProductInfoTracks ipit = industryProductInfoCollection.ipicCollection[k].tracks[trackIndex];
            if (ipit.uiIsExpanded)
            {
              KUID kuid = ipic.GetProduct().GetKUID();
              string icon = kuid.GetHTMLString();

              ProductQueue queue = null;
              if (ipit.GetIPICQueue())
                queue = ipit.GetIPICQueue().GetProductQueue();

              if (queue)
                dataString = queue.GetQueueName();
              else
                dataString = "None";

              string trackModeString = "";
              if (ipit.mode == "LOAD")
                trackModeString = stringTable.GetString("html_track_mode_load");
              if (ipit.mode == "UNLOAD")
                trackModeString = stringTable.GetString("html_track_mode_unload");
              if (ipit.mode == "BOTH")
                trackModeString = stringTable.GetString("html_track_mode_both");

              openProducts = openProducts + HTMLWindow.MakeTable(
                                              HTMLWindow.MakeRow(
                                                HTMLWindow.MakeCell( HTMLWindow.MakeImage( icon, true, 64, 64 ), "width=64" )
                                                + HTMLWindow.MakeCell( HTMLWindow.MakeBold( ipic.GetProduct().GetLocalisedName() ) + "<BR>"
                                                    + HTMLWindow.MakeItalic( stringTable.GetString("html_item_headings_mode") ) + HTMLWindow.MakeLink( "live://property/TrackMode/" + (string)k + "/" + (string)trackIndex, trackModeString ) + "<BR>"
                                                    + HTMLWindow.MakeItalic( stringTable.GetString("html_item_headings_queue") ) + HTMLWindow.MakeLink( "live://property/SetTrackQueue/" + (string)k + "/" + (string)trackIndex, dataString ) + "<BR>"
                                                    + HTMLWindow.MakeLink( "live://property/RemoveTrackProduct/" + (string)k + "/" + (string)i, HTMLWindow.MakeImage("imgRemove.tga", false, 32, 32, "imgRemove_over.tga") ) )
                                              )
                                              , "bgcolor=#FFAD0059 width=400 bordercolor=#00000059"
                                            );

              break;
            }
          }
        }

        htmlString = htmlString + HTMLWindow.MakeTable(
                                    HTMLWindow.MakeRow(
                                      HTMLWindow.MakeCell( HTMLWindow.MakeImage("imgArrowRight.tga") + " " + destNames[i], "width=290" )
                                    , "bgcolor=#C9880059")
                                    + HTMLWindow.MakeRow(
                                      HTMLWindow.MakeCell( productList, "colspan=4" )
                                    )
                                    + HTMLWindow.MakeRow(
                                      HTMLWindow.MakeCell( openProducts + "<BR>", "colspan=4" )
                                    )
                                  , "bgcolor=#FFAD0059 width=100% bordercolor=#00000059"
                                  )
                                  + HTMLWindow.MakeTable( HTMLWindow.MakeRow( HTMLWindow.MakeCell( "" ) ), "height=4" );

      }

    }

    if (expandProcesses)
    {
      htmlString = htmlString + HTMLWindow.MakeTable(
                                  HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( "", "bgcolor=#00000059 width=1" ) +
                                    HTMLWindow.MakeCell(
                                      HTMLWindow.MakeFontColorBlack(
                                        stringTable.GetString("html_description_expand_processes")
                                      )
                                    ) +
                                    HTMLWindow.MakeCell( "", "bgcolor=#00000059 width=1" )
                                  ) +
                                  HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( "" )
                                  , "bgcolor=#00000059 height=1"
                                  )

                                , "bgcolor=#FFAD0059 width=100% cellspacing=0 cellpadding=0 border=0"
                                ) + HTMLWindow.MakeTable( HTMLWindow.MakeRow( HTMLWindow.MakeCell( "" ) ), "height=4" );

      // Get a list of unique processes.
      string[] processes = GetProcessNameList();

      for (i = 0; i < processes.size(); i++)
      {

        //=====================================================================

        // Properties of the process list:
        string productListIn = "";
        int productListInCount = 0;
        string productListOut = "";
        int productListOutCount = 0;
        string openProducts = "";

        // Get a list of all the product icons, allowing them to be toggled
        for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
        {
          IndustryProductInfoComplete ipiCollection = industryProductInfoCollection.ipicCollection[k];
          for (l = 0; l < ipiCollection.processes.size(); l++)
          {
            IndustryProductInfoProcess ipip = ipiCollection.processes[l];
            if (ipip.GetProcessName() == processes[i])
            {
              Asset asset = ipiCollection.GetProduct();
              KUID kuid = asset.GetKUID();
              string icon = kuid.GetHTMLString();
              // Limit the product list count to 3
              if (ipip.DoesUseInputForSurveyor() and productListInCount < 3)
              {
                productListIn = productListIn + HTMLWindow.MakeLink( "live://property/ToggleProcessDisplayIn/" + (string)k + "/" + (string)l, HTMLWindow.MakeImage( icon, true, 32, 32 ) + " " );
                productListInCount = productListInCount + 1;
              }
              // Limit the product list count to 3
              if (ipip.DoesUseOutputForSurveyor() and productListOutCount < 3)
              {
                productListOut = productListOut + HTMLWindow.MakeLink( "live://property/ToggleProcessDisplayOut/" + (string)k + "/" + (string)l, HTMLWindow.MakeImage( icon, true, 32, 32 ) + " " );
                productListOutCount = productListOutCount + 1;
              }
            }
          }
        }
        // Allow items to be added
        productListIn = productListIn + HTMLWindow.MakeLink( "live://property/AddProcessInput/" + processes[i], HTMLWindow.MakeImage("imgAdd.tga", false, 32, 32, "imgAdd_over.tga") );
        productListOut = productListOut + HTMLWindow.MakeLink( "live://property/AddProcessOutput/" + processes[i], HTMLWindow.MakeImage("imgAdd.tga", false, 32, 32, "imgAdd_over.tga") );

        // Get a list of all the products which are open (toggled)
        for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
        {
          IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[k];
          int processIndex = industryProductInfoCollection.GetProcessIndex(k, processes[i]);
          if (processIndex > -1)
          {
            IndustryProductInfoProcess ipip = industryProductInfoCollection.ipicCollection[k].processes[processIndex];
            KUID kuid = ipic.GetProduct().GetKUID();
            string icon = kuid.GetHTMLString();

            if (ipip.GetUiIsExpanded(true))
            {
              if (ipip.DoesUseInputForSurveyor())
              {
                ProductQueue queue = null;
                if (ipip.GetInputQueue())
                  queue = ipip.GetInputQueue().GetProductQueue();

                if (queue)
                  dataString = queue.GetQueueName();
                else
                  dataString = "None";

                // Perform conversion on count to translate to type.
                int count = GetProcessInput(ipip.GetProcessName(), ipip.GetInputQueue().GetProductQueue(), ipic.GetProduct());
                float massPerUnit = ipic.GetProduct().GetConfigSoup().GetNamedTagAsFloat("mass");

                string type = "";
                if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_MASS)
                  type = "Tonnes";
                if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_VOLUME)
                  type = "Litres";
                if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_COUNT)
                  type = "Items";

                string strConvCount = HTMLWindow.UnitsToString(count, massPerUnit, type);

                openProducts = openProducts + HTMLWindow.MakeTable(
                                                HTMLWindow.MakeRow(
                                                  HTMLWindow.MakeCell( HTMLWindow.MakeImage( icon, true, 64, 64 ), "width=64" )
                                                  + HTMLWindow.MakeCell( HTMLWindow.MakeBold( ipic.GetProduct().GetLocalisedName() ) + "<BR>"
                                                      + HTMLWindow.MakeItalic(stringTable.GetString("html_item_headings_consume")) + HTMLWindow.MakeLink("live://property/SetProcessQueueInputCount/" + (string)k + "/" + (string)processIndex, strConvCount) + stringTable.GetString1("html_item_headings_units", count) + "<BR>"
                                                      + HTMLWindow.MakeItalic(stringTable.GetString("html_item_headings_queue")) + ipip.GetInputQueue().GetProductQueue().GetQueueName() + "<BR>"
                                                      + HTMLWindow.MakeLink( "live://property/RemoveProcessInput/" + (string)k + "/" + (string)processIndex, HTMLWindow.MakeImage("imgRemove.tga", false, 32, 32, "imgRemove_over.tga") ) )
                                                )
                                                , "bgcolor=#FFAD0059 width=400 bordercolor=#00000059"
                                              );
              }
            }

            if (ipip.GetUiIsExpanded(false))
            {
              if (ipip.DoesUseOutputForSurveyor())
              {
                ProductQueue queue = null;
                if (ipip.GetOutputQueue())
                  queue = ipip.GetOutputQueue().GetProductQueue();

                if (queue)
                  dataString = queue.GetQueueName();
                else
                  dataString = "None";

                // Perform conversion on count to translate to type.
                int count = GetProcessOutput(ipip.GetProcessName(), ipip.GetOutputQueue().GetProductQueue(), ipic.GetProduct());
                float massPerUnit = ipic.GetProduct().GetConfigSoup().GetNamedTagAsFloat("mass");

                string type = "";
                if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_MASS)
                  type = "Tonnes";
                if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_VOLUME)
                  type = "Litres";
                if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_COUNT)
                  type = "Items";

                string strConvCount = HTMLWindow.UnitsToString(count, massPerUnit, type);

                openProducts = openProducts + HTMLWindow.MakeTable(
                                                HTMLWindow.MakeRow(
                                                  HTMLWindow.MakeCell( HTMLWindow.MakeImage( icon, true, 64, 64 ), "width=64" )
                                                  + HTMLWindow.MakeCell( HTMLWindow.MakeBold( ipic.GetProduct().GetLocalisedName() ) + "<BR>"
                                                      + HTMLWindow.MakeItalic(stringTable.GetString("html_item_headings_produce")) + HTMLWindow.MakeLink("live://property/SetProcessQueueOutputCount/" + (string)k + "/" + (string)processIndex, strConvCount) + stringTable.GetString1("html_item_headings_units", count) + "<BR>"
                                                      + HTMLWindow.MakeItalic(stringTable.GetString("html_item_headings_queue")) + ipip.GetOutputQueue().GetProductQueue().GetQueueName() + "<BR>"
                                                      + HTMLWindow.MakeLink( "live://property/RemoveProcessOutput/" + (string)k + "/" + (string)processIndex, HTMLWindow.MakeImage("imgRemove.tga", false, 32, 32, "imgRemove_over.tga") ) )
                                                )
                                                , "bgcolor=#FFAD0059 width=400 bordercolor=#00000059"
                                              );
              }
            }
          }
        }
        //=====================================================================

        // Generate the table that contains the product list, open products,
        // and also the details about the current item
        Asset core = Constructors.GetTrainzAsset();
        KUID kuid = core.LookupKUIDTable("texture-products");
        string arrowicon = kuid.GetHTMLString();

        htmlString = htmlString + HTMLWindow.MakeTable(
                                    HTMLWindow.MakeRow(
                                      HTMLWindow.MakeCell( HTMLWindow.MakeImage("imgArrowRight.tga") + " " + processes[i], "width=190" )
                                      + HTMLWindow.MakeCell( HTMLWindow.MakeItalic( stringTable.GetString("html_product_details_duration") ) + HTMLWindow.MakeLink( "live://property/SetProcessDuration/" + (string)i, (string)(int)GetProcessDuration(processes[i]) ) , "width=160")
                                      + HTMLWindow.MakeCell( HTMLWindow.MakeItalic( stringTable.GetString("html_product_details_enabled") ) + HTMLWindow.MakeLink( "live://property/SetProcessStartEnabled/" + (string)i, (string)GetProcessEnabled(processes[i]) ) )
                                    , "bgcolor=#C9880059")
                                    + HTMLWindow.MakeRow(
                                      HTMLWindow.MakeCell( productListIn + HTMLWindow.MakeImage( arrowicon, true, 32, 32 ) + productListOut, "colspan=4" )
                                    )
                                    + HTMLWindow.MakeRow(
                                      HTMLWindow.MakeCell( openProducts + "<BR>", "colspan=4" )
                                    )
                                  , "bgcolor=#FFAD0059 width=100% bordercolor=#00000059"
                                  )
                                  + HTMLWindow.MakeTable( HTMLWindow.MakeRow( HTMLWindow.MakeCell( "" ) ), "height=4" );

      }
    }

    if (expandProducts)
    {
      htmlString = htmlString + HTMLWindow.MakeTable(
                                  HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( "", "bgcolor=#00000059 width=1" ) +
                                    HTMLWindow.MakeCell(
                                      HTMLWindow.MakeFontColorBlack(
                                        stringTable.GetString("html_description_expand_products")
                                      )
                                    ) +
                                    HTMLWindow.MakeCell( "", "bgcolor=#00000059 width=1" )
                                  ) +
                                  HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( "" )
                                  , "bgcolor=#00000059 height=1"
                                  )

                                , "bgcolor=#FFAD0059 width=100% cellspacing=0 cellpadding=0 border=0"
                                ) + HTMLWindow.MakeTable( HTMLWindow.MakeRow( HTMLWindow.MakeCell( "" ) ), "height=4" );

      // Retrieve list of linked assets.
      int i;
      Asset asset;

      // Properties of the process list:
      string productList = "";
      string openProducts = "";

      // Loop through each of the products
      for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
      {
        IndustryProductInfoComplete ipiCollection = industryProductInfoCollection.ipicCollection[k];

        KUID kuid = ipiCollection.GetProduct().GetKUID();
        string productIcon = kuid.GetHTMLString();

        productList = productList + HTMLWindow.MakeLink( "live://property/ToggleProductDisplay/" + (string)k, HTMLWindow.MakeImage( productIcon, true, 32, 32 ) + " " );

      }

      // Check if a product has been expanded.
      for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
      {
        IndustryProductInfoComplete ipiCollection = industryProductInfoCollection.ipicCollection[k];

        if (ipiCollection.uiIsExpanded)
        {
          KUID kuid = ipiCollection.GetProduct().GetKUID();
          string productIcon = kuid.GetHTMLString();

          string vehicleIcon = "";
          if (ipiCollection.GetVehicleKUID())
          {
            if (ipiCollection.GetVehicleKUID())
              kuid = ipiCollection.GetVehicleKUID();

            vehicleIcon = kuid.GetHTMLString();
          }

          string type = "";

          if (ipiCollection.GetVehicleKUID())
            dataString = HTMLWindow.MakeImage( vehicleIcon, true, 64, 32 );
          else
            dataString = "None";

          // Perform conversion on count to translate to type.
          int count = ipiCollection.GetPerVehicleAmount();
          float massPerUnit = ipiCollection.GetProduct().GetConfigSoup().GetNamedTagAsFloat("mass");

          type = "";
          if (ipiCollection.GetDisplayType() == ipiCollection.DISPLAY_TYPE_MASS)
            type = "Tonnes";
          if (ipiCollection.GetDisplayType() == ipiCollection.DISPLAY_TYPE_VOLUME)
            type = "Litres";
          if (ipiCollection.GetDisplayType() == ipiCollection.DISPLAY_TYPE_COUNT)
            type = "Items";

          string strConvCount = HTMLWindow.UnitsToString(count, massPerUnit, type);

          // Get the language versions of the type string.
          if (ipiCollection.GetDisplayType() == ipiCollection.DISPLAY_TYPE_MASS)
            type = stringTable.GetString("html_metric_type_mass");
          if (ipiCollection.GetDisplayType() == ipiCollection.DISPLAY_TYPE_VOLUME)
            type = stringTable.GetString("html_metric_type_volume");
          if (ipiCollection.GetDisplayType() == ipiCollection.DISPLAY_TYPE_COUNT)
            type = stringTable.GetString("html_metric_type_count");

          openProducts = openProducts + HTMLWindow.MakeTable(
                                          HTMLWindow.MakeRow(
                                            HTMLWindow.MakeCell( HTMLWindow.MakeImage( productIcon, true, 64, 64 ), "width=64" )
                                            + HTMLWindow.MakeCell( HTMLWindow.MakeBold( ipiCollection.GetProduct().GetLocalisedName() ) + "<BR>"
                                                + HTMLWindow.MakeItalic( stringTable.GetString("html_item_headings_vehicle") ) + HTMLWindow.MakeLink( "live://property/SetProductVehicle/" + (string)k, dataString ) + "<BR>"
                                                + HTMLWindow.MakeItalic( stringTable.GetString("html_item_headings_loadsize") ) + strConvCount + stringTable.GetString1("html_item_headings_units", count) + "<BR>"
                                                + HTMLWindow.MakeLink( "live://property/SetProductType/" + (string)k, type ) )
                                          )
                                          , "bgcolor=#FFAD0059 width=400 bordercolor=#00000059"
                                        );

          break;
        }
      }

      htmlString = htmlString + HTMLWindow.MakeTable(
                                  HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( HTMLWindow.MakeImage("imgArrowRight.tga") + stringTable.GetString("html_item_headings_products") )
                                  , "bgcolor=#C9880059")
                                  + HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( productList )
                                  )
                                  + HTMLWindow.MakeRow(
                                    HTMLWindow.MakeCell( openProducts + "<BR>" )
                                  )
                                , "bgcolor=#FFAD0059 width=100% bordercolor=#00000059"
                                )
                                + HTMLWindow.MakeTable( HTMLWindow.MakeRow( HTMLWindow.MakeCell( "" ) ), "height=4" );

    }

    htmlString = htmlString + HTMLWindow.EndFontColor() + "</body></html>";

    return htmlString;
  }

  public string GetPropertyType(string propertyID)
  {
    string returnType;
    if (propertyID[0, 7] == "expand/")
    {
      propertyID[0, 7] = null;
      returnType = "link";
    }

    if (propertyID[0, 16] == "AddQueueProduct/")
    {
      propertyID[0, 16] = null;
      returnType = "list";
    }

    if (propertyID[0, 16] == "AddTrackProduct/")
    {
      propertyID[0, 16] = null;
      returnType = "list";
    }

    if (propertyID[0, 10] == "TrackMode/")
    {
      propertyID[0, 10] = null;
      returnType = "link";
    }

    if (propertyID[0, 16] == "AddProcessInput/")
    {
      propertyID[0, 16] = null;
      returnType = "list";
    }

    if (propertyID[0, 17] == "AddProcessOutput/")
    {
      propertyID[0, 17] = null;
      returnType = "list";
    }

    if (propertyID[0, 13] == "SetQueueSize/")
    {
      propertyID[0, 13] = null;
      returnType = "int,1,999999999,10000";
    }

    if (propertyID[0, 14] == "SetTrackQueue/")
    {
      propertyID[0, 14] = null;
      returnType = "list";
    }

    if (propertyID[0, 21] == "SetQueueProductCount/")
    {
      propertyID[0, 21] = null;
      returnType = "int,1,999999999,10000";
    }

    if (propertyID[0, 19] == "SetProcessDuration/")
    {
      propertyID[0, 19] = null;
      returnType = "int,1,99999,10";
    }

    if (propertyID[0, 23] == "SetProcessStartEnabled/")
    {
      propertyID[0, 23] = null;
      returnType = "link";
    }

    if (propertyID[0, 26] == "SetProcessQueueInputCount/")
    {
      propertyID[0, 26] = null;
      returnType = "int,1,999999999,10000";
    }

    if (propertyID[0, 27] == "SetProcessQueueOutputCount/")
    {
      propertyID[0, 27] = null;
      returnType = "int,1,999999999,10000";
    }

    if (propertyID[0, 15] == "SetProductType/")
    {
      propertyID[0, 15] = null;
      returnType = "link";
    }

    if (propertyID[0, 18] == "SetProductVehicle/")
    {
      propertyID[0, 18] = null;
      returnType = "list";
    }

    if (propertyID[0, 19] == "RemoveQueueProduct/")
    {
      propertyID[0, 19] = null;
      returnType = "link";
    }

    if (propertyID[0, 19] == "RemoveTrackProduct/")
    {
      propertyID[0, 19] = null;
      returnType = "link";
    }

    if (propertyID[0, 19] == "RemoveProcessInput/")
    {
      propertyID[0, 19] = null;
      returnType = "link";
    }

    if (propertyID[0, 20] == "RemoveProcessOutput/")
    {
      propertyID[0, 20] = null;
      returnType = "link";
    }

    if (propertyID[0, 19] == "ToggleQueueDisplay/")
    {
      propertyID[0, 19] = null;
      returnType = "link";
    }

    if (propertyID[0, 19] == "ToggleTrackDisplay/")
    {
      propertyID[0, 19] = null;
      returnType = "link";
    }

    if (propertyID[0, 23] == "ToggleProcessDisplayIn/")
    {
      propertyID[0, 23] = null;
      returnType = "link";
    }

    if (propertyID[0, 24] == "ToggleProcessDisplayOut/")
    {
      propertyID[0, 24] = null;
      returnType = "link";
    }

    if (propertyID[0, 21] == "ToggleProductDisplay/")
    {
      propertyID[0, 21] = null;
      returnType = "link";
    }

    if (propertyID[0, 19] == "SetWaybillIssuePct/")
    {
      propertyID[0, 19] = null;
      returnType = "int,1,100,10";
    }

    if (propertyID[0, 15] == "userDescription")
    {
      propertyID[0, 15] = null;
      returnType = "string,0,512";
    }

    return returnType;
  }

  void SetPropertyValue(string propertyID, string value)
  {
    if (propertyID[0, 15] == "userDescription")
    {
      userDescription = value;
    }
  }

  void SetPropertyValue(string propertyID, int value)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    if (propertyID[0, 13] == "SetQueueSize/")
    {
      propertyID[0, 13] = null;
      int queueIndex = Str.ToInt(propertyID);

      ProductQueue[] queues;
      queues = GetQueues();
      IPICQueue ipicQueue = industryProductInfoCollection.FindIPICQueue(queues[queueIndex]);
      if (ipicQueue)
      {
        IndustryProductInfoQueues[] ipiqs = ipicQueue.GetRelatedProducts();
        int i;
        for (i = 0; i < ipiqs.size(); i++)
        {
          ipiqs[i].SetQueueSize(value);
        }
      }
      else
      {
        queues[queueIndex].SetQueueSize(value);
      }

    }

    if (propertyID[0, 21] == "SetQueueProductCount/")
    {
      propertyID[0, 21] = null;

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int queueIndex = Str.ToInt(propertyID);

      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[productIndex];
      IndustryProductInfoQueues ipiq = ipic.queues[queueIndex];

      ProductQueue queue = ipiq.GetProductQueue();

      // Convert from whatever unit type, to whatever unit type :)
      float massPerUnit = ipic.GetProduct().GetConfigSoup().GetNamedTagAsFloat("mass");
      string type = "";
      if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_MASS)
        type = "Tonnes";
      if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_VOLUME)
        type = "Litres";
      if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_COUNT)
        type = "Items";

      value = HTMLWindow.ConvertValueToUnits(value, massPerUnit, type);

      ipiq.SetInitialAmount(value);
    }

    if (propertyID[0, 19] == "SetProcessDuration/")
    {
      propertyID[0, 19] = null;
      int index = Str.ToInt(propertyID);

      string[] processes = GetProcessNameList();

      IPICProcess ipicProcess = industryProductInfoCollection.FindIPICProcess(processes[index]);
      if (ipicProcess)
        ipicProcess.SetDuration(value);
      else
        Interface.Log("WARNING: Process " + processes[index] + " not found!");
    }

    if (propertyID[0, 26] == "SetProcessQueueInputCount/")
    {
      propertyID[0, 26] = null;

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int processIndex = Str.ToInt(propertyID);

      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[productIndex];
      IndustryProductInfoProcess ipip = industryProductInfoCollection.ipicCollection[productIndex].processes[processIndex];

      // Convert from whatever unit type, to whatever unit type :)
      float massPerUnit = ipic.GetProduct().GetConfigSoup().GetNamedTagAsFloat("mass");
      string type = "";
      if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_MASS)
        type = "Tonnes";
      if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_VOLUME)
        type = "Litres";
      if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_COUNT)
        type = "Items";

      value = HTMLWindow.ConvertValueToUnits(value, massPerUnit, type);

      ipip.SetInputAmount(value);
    }

    if (propertyID[0, 27] == "SetProcessQueueOutputCount/")
    {
      propertyID[0, 27] = null;
      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int processIndex = Str.ToInt(propertyID);

      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[productIndex];
      IndustryProductInfoProcess ipip = industryProductInfoCollection.ipicCollection[productIndex].processes[processIndex];

      // Convert from whatever unit type, to whatever unit type :)
      float massPerUnit = ipic.GetProduct().GetConfigSoup().GetNamedTagAsFloat("mass");
      string type = "";
      if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_MASS)
        type = "Tonnes";
      if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_VOLUME)
        type = "Litres";
      if (ipic.GetDisplayType() == ipic.DISPLAY_TYPE_COUNT)
        type = "Items";

      value = HTMLWindow.ConvertValueToUnits(value, massPerUnit, type);

      ipip.SetOutputAmount(value);
    }

    if (propertyID[0, 19] == "SetWaybillIssuePct/")
    {
      propertyID[0, 19] = null;
      int queueIndex = Str.ToInt(propertyID);

      ProductQueue[] queues;
      queues = GetQueues();
      IPICQueue ipicQueue = industryProductInfoCollection.FindIPICQueue(queues[queueIndex]);
      if (ipicQueue)
      {
        IndustryProductInfoQueues[] ipiqs = ipicQueue.GetRelatedProducts();
        int i;
        for (i = 0; i < ipiqs.size(); i++)
        {
          ipiqs[i].SetQueueWaybillIssuePercent(value);
        }
      }

    }
  }

  void LinkPropertyValue(string propertyID)
  {
    if (propertyID[0, 7] == "expand/")
    {
      propertyID[0, 7] = null;

      if (propertyID == "expandQueues")
      {
        expandQueues = !expandQueues;
        expandTracks = false;
        expandProcesses = false;
        expandProducts = false;
      }
      if (propertyID == "expandTracks")
      {
        expandTracks = !expandTracks;
        expandQueues = false;
        expandProcesses = false;
        expandProducts = false;
      }
      if (propertyID == "expandProcesses")
      {
        expandProcesses = !expandProcesses;
        expandQueues = false;
        expandTracks = false;
        expandProducts = false;
      }
      if (propertyID == "expandProducts")
      {
        expandProducts = !expandProducts;
        expandQueues = false;
        expandTracks = false;
        expandProcesses = false;
      }
    }

    if (propertyID[0, 10] == "TrackMode/")
    {
      propertyID[0, 10] = null;

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int trackIndex = Str.ToInt(propertyID);

      IndustryProductInfoTracks trackInfo = industryProductInfoCollection.AccessProductInfo(productIndex).tracks[trackIndex];

      if (trackInfo.mode == "BOTH")
        trackInfo.mode = "LOAD";
      else if (trackInfo.mode == "LOAD")
        trackInfo.mode = "UNLOAD";
      else if (trackInfo.mode == "UNLOAD")
        trackInfo.mode = "BOTH";
    }

    if (propertyID[0, 19] == "ToggleQueueDisplay/")
    {
      propertyID[0, 19] = null;

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int queueIndex = Str.ToInt(propertyID);

      industryProductInfoCollection.ipicCollection[productIndex].queues[queueIndex].uiIsExpanded = !industryProductInfoCollection.ipicCollection[productIndex].queues[queueIndex].uiIsExpanded;
      ProductQueue foundQueue = industryProductInfoCollection.ipicCollection[productIndex].queues[queueIndex].GetProductQueue();

      HideAllQueueItems(productIndex, foundQueue);

    }

    if (propertyID[0, 19] == "ToggleTrackDisplay/")
    {
      propertyID[0, 19] = null;

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int trackIndex = Str.ToInt(propertyID);

      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[productIndex];
      IndustryProductInfoTracks ipit = ipic.tracks[trackIndex];

      ipit.uiIsExpanded = !ipit.uiIsExpanded;
      string foundTrack = ipit.GetTrackName();

      HideAllTrackItems(productIndex, foundTrack);
    }

    if (propertyID[0, 23] == "ToggleProcessDisplayIn/")
    {
      propertyID[0, 23] = null;

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int processIndex = Str.ToInt(propertyID);

      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[productIndex];
      IndustryProductInfoProcess ipip = ipic.processes[processIndex];

      ipip.SetUiIsExpanded(true, !ipip.GetUiIsExpanded(true));
      string foundProcess = ipip.GetProcessName();

      HideAllProcessItemsIn(productIndex, foundProcess);

    }

    if (propertyID[0, 24] == "ToggleProcessDisplayOut/")
    {
      propertyID[0, 24] = null;

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int processIndex = Str.ToInt(propertyID);

      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[productIndex];
      IndustryProductInfoProcess ipip = ipic.processes[processIndex];

      ipip.SetUiIsExpanded(false, !ipip.GetUiIsExpanded(false));
      string foundProcess = ipip.GetProcessName();

      HideAllProcessItemsOut(productIndex, foundProcess);

    }

    if (propertyID[0, 21] == "ToggleProductDisplay/")
    {
      propertyID[0, 21] = null;

      int productIndex = Str.ToInt(propertyID);

      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[productIndex];

      ipic.uiIsExpanded = !ipic.uiIsExpanded;

      int k = 0;
      for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
      {
        if (k != productIndex)
        {
          industryProductInfoCollection.ipicCollection[k].uiIsExpanded = false;
        }
      }

    }

    if (propertyID[0, 23] == "SetProcessStartEnabled/")
    {
      propertyID[0, 23] = null;

      int id = Str.ToInt(propertyID);

      string[] processes = GetProcessNameList();

      IPICProcess ipicProcess = industryProductInfoCollection.FindIPICProcess(processes[id]);
      if (ipicProcess)
      {
        bool enabled = ipicProcess.GetEnabled();
        enabled = !enabled;
        ipicProcess.SetEnabled(enabled);
      }
      else
        Interface.Log("WARNING: Process " + processes[id] + " not found!");

    }

    if (propertyID[0, 15] == "SetProductType/")
    {
      propertyID[0, 15] = null;

      int index = Str.ToInt(propertyID);
      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[index];

      int prevType = ipic.GetDisplayType();
      if (prevType == ipic.DISPLAY_TYPE_MASS)
        ipic.SetDisplayType(ipic.DISPLAY_TYPE_VOLUME);
      else if (prevType == ipic.DISPLAY_TYPE_VOLUME)
        ipic.SetDisplayType(ipic.DISPLAY_TYPE_COUNT);
      else if (prevType == ipic.DISPLAY_TYPE_COUNT)
        ipic.SetDisplayType(ipic.DISPLAY_TYPE_MASS);

    }

    if (propertyID[0, 19] == "RemoveQueueProduct/")
    {
      propertyID[0, 19] = null;

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int queueIndex = Str.ToInt(propertyID);

      ProductQueue[] queues;
      queues = GetQueues();
      ProductFilter pf = queues[queueIndex].GetProductFilter();
      Asset[] products = pf.GetProducts();

      industryProductInfoCollection.RemoveQueueFromProduct(industryProductInfoCollection.ipicCollection[productIndex].GetProduct(), queues[queueIndex]);

    }

    if (propertyID[0, 19] == "RemoveTrackProduct/")
    {
      propertyID[0, 19] = null;
      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int trackIndex = Str.ToInt(propertyID);

      industryProductInfoCollection.ipicCollection[productIndex].tracks[trackIndex, trackIndex + 1] = null;
    }

    if (propertyID[0, 19] == "RemoveProcessInput/")
    {
      propertyID[0, 19] = null;

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int processIndex = Str.ToInt(propertyID);

      IndustryProductInfoProcess process = industryProductInfoCollection.ipicCollection[productIndex].processes[processIndex];
      process.SetInputQueue(null);

      // Hide in driver
      process.SetVisibleInViewDetails(true, false);

      if (!process.DoesAnythingForSurveyor())
        industryProductInfoCollection.ipicCollection[productIndex].processes[processIndex, processIndex + 1] = null;
    }

    if (propertyID[0, 20] == "RemoveProcessOutput/")
    {
      propertyID[0, 20] = null;
      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int processIndex = Str.ToInt(propertyID);

      IndustryProductInfoProcess process = industryProductInfoCollection.ipicCollection[productIndex].processes[processIndex];
      process.SetOutputQueue(null);

      // Hide in driver
      process.SetVisibleInViewDetails(false, false);

      if (!process.DoesAnythingForSurveyor())
        industryProductInfoCollection.ipicCollection[productIndex].processes[processIndex, processIndex + 1] = null;
    }
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    string[] retList = new string[0];
    int i;
    int l;

    if (propertyID[0, 14] == "SetTrackQueue/")
    {
      propertyID[0, 14] = null;

      int index = Str.ToInt(propertyID);

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int trackIndex = Str.ToInt(propertyID);

      IndustryProductInfoQueues[] queues = industryProductInfoCollection.ipicCollection[productIndex].queues;
      for (i = 0; i < queues.size(); i++)
      {
        retList[retList.size()] = queues[i].GetProductQueue().GetQueueName();
      }

    }

    if (propertyID[0, 16] == "AddProcessInput/")
    {
      propertyID[0, 16] = null;
      string processName = propertyID;
      linkedList.Init();

      int k;
      for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
      {
        IndustryProductInfoComplete ipiCollection = industryProductInfoCollection.ipicCollection[k];

        // Only add items if they have valid queue available.
        int queueIndex = -1;
        for (i = 0; i < ipiCollection.queues.size(); i++)
        {
          ProductQueue queue = ipiCollection.queues[i].GetProductQueue();
          ProductFilter pf = queue.GetProductFilter();
          if (pf.DoesAcceptProduct(ipiCollection.GetProduct()))
          {
            queueIndex = i;
            break;
          }
        }

        if (queueIndex > -1)
        {
          // Only add items that don't have this process enabled.
          if (industryProductInfoCollection.DoesProductHaveProcess(ipiCollection.GetProduct(), processName))
          {
            if (!ipiCollection.processes[industryProductInfoCollection.GetProcessIndexFromName(k, processName)].DoesUseInputForSurveyor())
            {
              LinkedData ll = new LinkedData();
              ll.text = ipiCollection.GetProduct().GetLocalisedName();
              ll.index = k;
              linkedList.Add(ll);
            }
          }
          else
          {
            LinkedData ll = new LinkedData();
            ll.text = ipiCollection.GetProduct().GetLocalisedName();
            ll.index = k;
            linkedList.Add(ll);
          }
        }
      }

      linkedList.Sort();

      // Copy the list of strings to the return list.
      for (i = 0; i < linkedList.data.size(); i++)
        retList[i] = linkedList.data[i].text;

    }

    if (propertyID[0, 17] == "AddProcessOutput/")
    {
      propertyID[0, 17] = null;
      string processName = propertyID;
      linkedList.Init();

      int k;
      for (k = 0; k < industryProductInfoCollection.ipicCollection.size(); k++)
      {
        IndustryProductInfoComplete ipiCollection = industryProductInfoCollection.ipicCollection[k];

        // Only add items if they have valid queue available.
        int queueIndex = -1;
        for (i = 0; i < ipiCollection.queues.size(); i++)
        {
          ProductQueue queue = ipiCollection.queues[i].GetProductQueue();
          ProductFilter pf = queue.GetProductFilter();
          if (pf.DoesAcceptProduct(ipiCollection.GetProduct()))
          {
            queueIndex = i;
            break;
          }
        }

        if (queueIndex > -1)
        {
          // Only add items that don't have this process enabled.
          if (industryProductInfoCollection.DoesProductHaveProcess(ipiCollection.GetProduct(), processName))
          {
            if (!ipiCollection.processes[industryProductInfoCollection.GetProcessIndexFromName(k, processName)].DoesUseOutputForSurveyor())
            {
              LinkedData ll = new LinkedData();
              ll.text = ipiCollection.GetProduct().GetLocalisedName();
              ll.index = k;
              linkedList.Add(ll);
            }
          }
          else
          {
            LinkedData ll = new LinkedData();
            ll.text = ipiCollection.GetProduct().GetLocalisedName();
            ll.index = k;
            linkedList.Add(ll);
          }
        }
      }

      linkedList.Sort();

      // Copy the list of strings to the return list.
      for (i = 0; i < linkedList.data.size(); i++)
        retList[i] = linkedList.data[i].text;

    }

    if (propertyID[0, 16] == "AddQueueProduct/")
    {
      propertyID[0, 16] = null;
      linkedList.Init();

      //retList = GetProductNameList(process.queue);
      Asset[] assets = World.GetAssetList("product");

      ProductQueue[] queues;
      queues = GetQueues();
      ProductQueue queue = queues[Str.ToInt(propertyID)];
      ProductFilter pf = queue.GetProductFilter();
      Asset[] assetList = pf.GetProducts();
      for (i = 0; i < assets.size(); i++)
      {
        // ensure does not alrady exist.
        int k;
        bool exists = false;
        for (k = 0; k < assetList.size(); k++)
        {
          if (assetList[k] == assets[i])
          {
            exists = true;
            break;
          }
        }

        // pass each product thru this:
        if (!exists)
          if (!pf.DoesAcceptProduct(assets[i]))
          {
            LinkedData ll = new LinkedData();
            ll.text = assets[i].GetLocalisedName();
            ll.index = i;
            linkedList.Add(ll);
          }
      }

      linkedList.Sort();

      // Copy the list of strings to the return list.
      for (i = 0; i < linkedList.data.size(); i++)
        retList[i] = linkedList.data[i].text;

    }

    if (propertyID[0, 18] == "SetProductVehicle/")
    {
      propertyID[0, 18] = null;
      int index = Str.ToInt(propertyID);
      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[index];

      Asset asset = ipic.GetProduct();
      Vehicle[] vehicles = World.GetVehicleList();

      // Add an item for no vehicle
      retList[retList.size()] = "None";

      for (i = 0; i < vehicles.size(); i++)
      {
        Vehicle vehicle = vehicles[i];

        if (vehicle)
        {
          ProductQueue[] vehicleQueues = vehicle.GetQueues();
          for (l = 0; l < vehicleQueues.size(); l++)
          {
            ProductQueue vehicleQueue = vehicleQueues[l];
            ProductFilter filter = vehicleQueue.GetProductFilter();

            if (filter.DoesAcceptProduct(asset))
            {
              // Ensure this doesn't already exist.
              Asset vehicleAsset = vehicle.GetAsset();
              bool exists = false;
              for (l = 0; l < retList.size(); l++)
              {
                if (retList[l] == vehicleAsset.GetName())
                {
                  exists = true;
                  break;
                }
              }
              if (!exists)
                retList[retList.size()] = vehicleAsset.GetName();
              break;
            }
          }
        }

      }
    }

    if (propertyID[0, 16] == "AddTrackProduct/")
    {
      propertyID[0, 16] = null;
      linkedList.Init();

      Asset[] assets = World.GetAssetList("product");
      ProductQueue[] queues;
      queues = GetQueues();
      for (i = 0; i < queues.size(); i++)
      {
        ProductFilter pf = queues[i].GetProductFilter();
        for (l = 0; l < assets.size(); l++)
        {
          bool exists = industryProductInfoCollection.DoesProductHaveTrack(assets[l], propertyID);

          // pass each product thru this:
          if (!exists)
            if (pf.DoesAcceptProduct(assets[l]))
            {
              LinkedData ll = new LinkedData();
              ll.text = assets[l].GetLocalisedName();
              ll.gsobject = assets[l];
              ll.index = l;
              linkedList.Add(ll);
            }

        }
      }

      linkedList.Sort();

      // Copy the list of strings to the return list.
      for (i = 0; i < linkedList.data.size(); i++)
        retList[i] = linkedList.data[i].text;

    }

    return retList;
  }

  void SetPropertyValue(string propertyID, string value, int index)
  {
    Asset[] assetList = new Asset[0];
    ProductQueue[] queueList = new ProductQueue[0];
    ProductQueue[] newqueueList = new ProductQueue[0];
    int i;
    int l;

    if (propertyID[0, 14] == "SetTrackQueue/")
    {
      propertyID[0, 14] = null;
      int index = Str.ToInt(propertyID);

      int productIndex = -1;
      // Find the separating slash.
      int i;
      for (i = 0; i < propertyID.size(); i++)
      {
        if (propertyID[i] == '/')
        {
          productIndex = Str.ToInt(propertyID[0, i]);
          propertyID[0, i + 1] = null;
          break;
        }
      }
      int trackIndex = Str.ToInt(propertyID);

      industryProductInfoCollection.ipicCollection[productIndex].tracks[trackIndex].SetIPICQueue(industryProductInfoCollection.FindIPICQueue(GetQueue(value)));
    }

    if (propertyID[0, 16] == "AddProcessInput/")
    {
      propertyID[0, 16] = null;
      string processName = propertyID;

      LinkedData ld = linkedList.data[index];

      // Add the selected process to the product.
      IndustryProductInfoComplete ipiCollection = industryProductInfoCollection.ipicCollection[ld.index];
      // Doesn't exist, create it.
      int processIndex = industryProductInfoCollection.GetProcessIndexFromName(ld.index, processName);
      if (processIndex == -1)
      {
        industryProductInfoCollection.AddProcessToProduct(ipiCollection.GetProduct(), processName);
        processIndex = industryProductInfoCollection.GetProcessIndexFromName(ld.index, processName);
      }

      // just to be sure..
      if (processIndex > -1)
      {
        // Find a valid queue.
        ipiCollection.processes[processIndex].SetInputQueue(null);

        for (i = 0; i < ipiCollection.queues.size(); i++)
        {
          ProductQueue queue = ipiCollection.queues[i].GetProductQueue();
          ProductFilter pf = queue.GetProductFilter();
          if (pf.DoesAcceptProduct(ipiCollection.GetProduct()))
          {
            ipiCollection.processes[processIndex].SetInputQueue(industryProductInfoCollection.FindIPICQueue(queue));
            break;
          }
        }

        //ipiCollection.processes[processIndex].inUse = true;
        ipiCollection.processes[processIndex].SetInputAmount(1);

        // Ensure it will be visible in view details...
        ipiCollection.processes[processIndex].SetVisibleInViewDetails(true, true);
        // And just in case...
        ipiCollection.processes[processIndex].SetVisibleInSurveyor(true, true);

        // Auto expand...
        ipiCollection.processes[processIndex].SetUiIsExpanded(true, true);
        HideAllProcessItemsIn(ld.index, processName);
      }

    }

    if (propertyID[0, 17] == "AddProcessOutput/")
    {
      propertyID[0, 17] = null;
      string processName = propertyID;

      LinkedData ld = linkedList.data[index];

      // Add the selected process to the product.
      IndustryProductInfoComplete ipiCollection = industryProductInfoCollection.ipicCollection[ld.index];
      int processIndex = industryProductInfoCollection.GetProcessIndexFromName(ld.index, processName);
      // Doesn't exist, create it.
      if (processIndex == -1)
      {
        industryProductInfoCollection.AddProcessToProduct(ipiCollection.GetProduct(), processName);
        processIndex = industryProductInfoCollection.GetProcessIndexFromName(ld.index, processName);
      }

      // just to be sure..
      if (processIndex > -1)
      {
        // Find a valid queue.
        ipiCollection.processes[processIndex].SetOutputQueue(null);

        for (i = 0; i < ipiCollection.queues.size(); i++)
        {
          ProductQueue queue = ipiCollection.queues[i].GetProductQueue();
          ProductFilter pf = queue.GetProductFilter();
          if (pf.DoesAcceptProduct(ipiCollection.GetProduct()))
          {
            ipiCollection.processes[processIndex].SetOutputQueue(industryProductInfoCollection.FindIPICQueue(queue));
            break;
          }
        }

        //ipiCollection.processes[processIndex].outUse = true;
        ipiCollection.processes[processIndex].SetOutputAmount(1);

        // Ensure it will be visible in view details...
        ipiCollection.processes[processIndex].SetVisibleInViewDetails(false, true);
        // And just in case...
        ipiCollection.processes[processIndex].SetVisibleInSurveyor(false, true);

        // Auto expand...
        ipiCollection.processes[processIndex].SetUiIsExpanded(false, true);
        HideAllProcessItemsOut(ld.index, processName);

      }

    }

    if (propertyID[0, 16] == "AddQueueProduct/")
    {
      propertyID[0, 16] = null;
      Asset[] finalList = new Asset[0];
      linkedList.Init();

      // Add the selected product to the selected queue.
      Asset[] assets = World.GetAssetList("product");

      ProductQueue[] queues;
      queues = GetQueues();
      ProductQueue queue = queues[Str.ToInt(propertyID)];
      ProductFilter pf = queue.GetProductFilter();
      Asset[] assetList = pf.GetProducts();
      for (i = 0; i < assets.size(); i++)
      {
        // ensure does not alrady exist.
        int k;
        bool exists = false;
        for (k = 0; k < assetList.size(); k++)
        {
          if (assetList[k] == assets[i])
          {
            exists = true;
            break;
          }
        }

        // pass each product thru this:
        if (!exists)
          if (!pf.DoesAcceptProduct(assets[i]))
          {
            LinkedData ll = new LinkedData();
            ll.text = assets[i].GetLocalisedName();
            ll.gsobject = assets[i];
            ll.index = i;
            linkedList.Add(ll);
          }
      }

      linkedList.Sort();

      // Copy the list of strings to the return list.
      for (i = 0; i < linkedList.data.size(); i++)
        finalList[i] = cast <Asset> linkedList.data[i].gsobject;

      // list built, find it.
      Asset foundAsset = finalList[index];
      // update the industryProductInfoCollection (which will update the queue)
      industryProductInfoCollection.AddQueueToProduct(foundAsset, queue);

      int productIndex = industryProductInfoCollection.GetProductIndex(foundAsset);
      if (productIndex > -1)
      {
        int queueIndex = industryProductInfoCollection.GetQueueIndex(productIndex, queue);
        if (queueIndex > -1)
        {
          industryProductInfoCollection.ipicCollection[productIndex].queues[queueIndex].uiIsExpanded = true;

          HideAllQueueItems(productIndex, queue);
        }
      }
    }

    if (propertyID[0, 16] == "AddTrackProduct/")
    {
      propertyID[0, 16] = null;
      // Find the product they selected, then add to its tracks.

      linkedList.Init();

      Asset[] assets = World.GetAssetList("product");
      ProductQueue[] queues;
      queues = GetQueues();
      ProductQueue firstQueue = null;
      for (i = 0; i < queues.size(); i++)
      {
        ProductFilter pf = queues[i].GetProductFilter();
        for (l = 0; l < assets.size(); l++)
        {
          bool exists = industryProductInfoCollection.DoesProductHaveTrack(assets[l], propertyID);

          // pass each product thru this:
          if (!exists)
            if (pf.DoesAcceptProduct(assets[l]))
            {
              LinkedData ll = new LinkedData();
              ll.text = assets[l].GetLocalisedName();
              ll.gsobject = assets[l];
              ll.index = l;
              linkedList.data[linkedList.data.size()] = ll;
              if (!firstQueue)
                firstQueue = queues[i];
            }
        }
      }

      linkedList.Sort();

      // Copy the list of strings to the return list.
      for (i = 0; i < linkedList.data.size(); i++)
        assetList[i] = cast<Asset>linkedList.data[i].gsobject;

      int productIndex = industryProductInfoCollection.GetProductIndexFromAsset(assetList[index]);
      industryProductInfoCollection.AccessProductInfo(productIndex).AddProductTrack(propertyID, "BOTH", firstQueue);

      int trackIndex = industryProductInfoCollection.GetTrackIndex(productIndex, propertyID);
      if (trackIndex > -1)
      {
        industryProductInfoCollection.ipicCollection[productIndex].tracks[trackIndex].uiIsExpanded = true;

        HideAllTrackItems(productIndex, propertyID);
      }
    }

    if (propertyID[0, 18] == "SetProductVehicle/")
    {
      propertyID[0, 18] = null;
      int pcindex = Str.ToInt(propertyID);
      IndustryProductInfoComplete ipic = industryProductInfoCollection.ipicCollection[pcindex];

      if (value == "None")
      {
        ipic.SetVehicleKUID(null);
      }
      else
      {
        Asset asset = ipic.GetProduct();
        Vehicle[] vehicles = World.GetVehicleList();

        for (i = 0; i < vehicles.size(); i++)
        {
          Vehicle vehicle = vehicles[i];

          Asset vehicleAsset = vehicle.GetAsset();
          if (vehicleAsset)
          {
            if (value == vehicle.GetAsset().GetName())
            {
              ipic.SetVehicleKUID(vehicle.GetAsset().GetKUID());

              ProductQueue[] vehicleQueues = vehicle.GetQueues();

              ipic.SetPerVehicleAmount(1);
              for (i = 0; i < vehicleQueues.size(); i++)
              {
                ProductQueue vehicleQueue = vehicleQueues[i];
                ProductFilter filter = vehicleQueue.GetProductFilter();

                if (filter.DoesAcceptProduct(ipic.GetProduct()))
                {
                  ipic.SetPerVehicleAmount(vehicleQueue.GetQueueSize());
                  break;
                }
              }

              break;
            }
          }
        }
      }
    }
  }

  public string GetPropertyDescription(string propertyID)
  {
    string returnDescription = "!! THIS DESCRIPTION NEEDS SETTING !!";
    return returnDescription;
  }

  public string GetPropertyName(string propertyID)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    string returnName = "!! THIS NAME NEEDS SETTING !!";
    if (propertyID[0, 16] == "AddQueueProduct/")
      returnName = stringTable.GetString("property_name_add_queue");

    if (propertyID[0, 16] == "AddTrackProduct/")
      returnName = stringTable.GetString("property_name_add_product");

    if (propertyID[0, 16] == "AddProcessInput/")
      returnName = stringTable.GetString("property_name_add_product_input");

    if (propertyID[0, 17] == "AddProcessOutput/")
      returnName = stringTable.GetString("property_name_add_product_output");

    if (propertyID[0, 13] == "SetQueueSize/")
      returnName = stringTable.GetString("property_name_set_max_units");

    if (propertyID[0, 14] == "SetTrackQueue/")
      returnName = stringTable.GetString("property_name_set_track_queue");

    if (propertyID[0, 21] == "SetQueueProductCount/")
      returnName = stringTable.GetString("property_name_set_init_prod_amount");

    if (propertyID[0, 19] == "SetProcessDuration/")
      returnName = stringTable.GetString("property_name_set_process_duration");

    if (propertyID[0, 26] == "SetProcessQueueInputCount/")
      returnName = stringTable.GetString("property_name_set_prod_input_amount");

    if (propertyID[0, 27] == "SetProcessQueueOutputCount/")
      returnName = stringTable.GetString("property_name_set_prod_output_amount");

    if (propertyID[0, 18] == "SetProductVehicle/")
      returnName = stringTable.GetString("property_name_set_prod_vehicle");

    if (propertyID[0, 19] == "SetWaybillIssuePct/")
      returnName = stringTable.GetString("property_name_set_waybill_percent");

    if (propertyID[0, 15] == "userDescription")
      returnName = stringTable.GetString("property_name_set_description");

    return returnName;
  }

};


Oil Field
[Industries]

Oil Field Industry

config.txt:

﻿
username            "Oil Field"
kind              "industry"
light             1
region              "TRS2004"
kuid              <kuid:-3:10055>
type              "Industrial"
nightmode           "lamp"
script              "oil_field"
class             "oil_field"
icon-texture            "icon_oilfield.tga"
kuid-table {
  pipe            <kuid:-3:10051>
  oil           <kuid:-3:10010>
}
soundscript {
  daysingle {
    repeat-delay        0
    distance        5,200
    sound {
      oil_field_ambient.wav
    }
  }
}
mesh-table {
  default {
    mesh          "oil_field.lm"
    auto-create       1
    effects {
      0 {
        kind      "name"
        fontsize    0.2
        fontcolor   255,255,255
        att     "a.name0"
        name      "name"
      }
      1 {
        kind      "name"
        fontsize    0.2
        fontcolor   255,255,255
        att     "a.name1"
        name      "name"
      }
    }
  }
  default-night {
    mesh          "night.im"
    night-mesh-base       "default"
  }
  load_oil {
    mesh          "oil_indicator.im"
    anim          "oil_indicator.kin"
    auto-create       1
    att         "a.oil_indicator"
    att-parent        "default"
  }
  warning-light-0 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_0"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-1 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_1"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
}
attached-track {
  out_track0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
    }
  }
}
attached-trigger {
  out_load0 {
    att         "a.trig0"
    radius          10
  }
  out_load1 {
    att         "a.trig1"
    radius          10
  }
  out_load2 {
    att         "a.trig2"
    radius          10
  }
  out_load3 {
    att         "a.trig3"
    radius          10
  }
}
queues {
  oil_out {
    size          1940000
    animated-mesh       "load_oil"
    allowed-products {
      0       <kuid:-3:10010>
    }
    product-kuid        <kuid:-3:10010>
    initial-count       388000
    !         "- 388000 = 38800 x 10 Tankers"
  }
}
processes {
  oil_pumping {
    start-enabled       1
    duration        60
    outputs {
      0 {
        amount      200000
        queue     "oil_out"
      }
    }
  }
}
icon0             <kuid:-3:10164>
string-table {
  oilfield_oilpickup        "Oil pickup"
}
username-de           "Ölfeld"
string-table-de {
  oilfield_oilpickup        "Öl aufnehmen"
}
username-it           "Campo petrolifero"
string-table-it {
  oilfield_oilpickup        "Raccolta petrolio"
}
username-es           "Campo petrolífero"
string-table-es {
  oilfield_oilpickup        "Recogida de petróleo"
}
username-pl           "Pole naftowe"
string-table-pl {
  oilfield_oilpickup        "Punkt załadunku ropy naftowej"
}
username-cz           "Ropné pole"
string-table-cz {
  oilfield_oilpickup        "Nakládka ropy"
}
username-cn           "油田"
string-table-cn {
  oilfield_oilpickup        "油裝載"
}
username-ru           "Нефтяное месторождение"
string-table-ru {
  oilfield_oilpickup        "Погрузка нефти"
}
username-fr           "Champ pétrolifère"
string-table-fr {
  oilfield_oilpickup                                                                    "Charge de pétrole"
}

oil_field.gs:

//
// oil_field.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "BaseIndustry.gs"

//
// Refinery industry
//
class oil_field isclass BaseIndustry
{
  ProductQueue oilOutQueue;
  bool scriptletEnabled = true;

  bool HandleTrainUnloadCommand(Train train)
  {
    return false;
  }

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
    {
      bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();
      int direction = vehicle.GetRelationToTrack(me, "out_track0");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "out_load0")
        return true;

      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "out_load3")
        return true;

      if (triggerName == "out_load0" or triggerName == "out_load1" or triggerName == "out_load2" or triggerName == "out_load3")
      {
        if (vehicle.GetMyTrain().IsStopped())
          return true;
      }
    }

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (scriptletEnabled)
    {
      int oilAvailable = oilOutQueue.GetQueueCount();
      LoadingReport report = CreateLoadingReport(oilOutQueue, oilAvailable);

      int direction = vehicle.GetRelationToTrack(me, "out_track0");
      if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;

      vehicle.LoadProduct(report);
    }
  }

  //
  //
  thread void OilPumpingMain(void)
  {
    wait()
    {
      // ?
      on "Scriptlet-Enabled", "1":
      {
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("oil_pumping", true);
        }
        continue;
      }

      // ?
      on "Scriptlet-Enabled", "0":
      {
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("oil_pumping", false);
        }
        continue;
      }
    }
  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    usePipeAnimation = true;
    useGenericViewDetails = true;

    // initialize queues
    oilOutQueue = GetQueue("oil_out");

    AddAssetToIndustryProductInfo("oil", "oil_out", "oil_pumping", false);

    OilPumpingMain();
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("oilfield_oilPickup");
    destTracks[destTracks.size()] = "out_track0";
  }

};


Oil Refinery
[Industries]

Oil Refinery Industry

config.txt:

﻿
username            "Oil Refinery"
kind              "Industry"
kuid              <kuid:-3:10031>
region              "TRS2004"
type              "Industrial"
nightmode           "lamp"
light             1
script              "refinery"
class             "Refinery"
icon-texture            "icon_oilrefinery.tga"
kuid-table {
  pipe            <kuid:-3:10051>
  petrol            <kuid:-3:10012>
  diesel            <kuid:-3:10011>
  avgas           <kuid:-3:10045>
  oil           <kuid:-3:10010>
}
smoke0 {
  attachment          "a.smoke0"
  mode            "timeofday"
  color           0,0,0,250
  accel           1,0.3,0
  start           0.25,0.5
  period            0.25,0.125
  rate            8
  velocity          3
  lifetime          5
  minsize           1
  maxsize           3
  enabled           1
}
smoke1 {
  attachment          "a.smoke1"
  mode            "timeofday"
  color           0,0,0,250
  accel           1,0.3,0
  start           0.25,0.5
  period            0.25,0.125
  rate            8
  velocity          3
  lifetime          5
  minsize           1
  maxsize           3
  enabled           1
}
smoke2 {
  attachment          "a.fire"
  mode            "timeofday"
  color           247,89,0,250
  accel           0.1,0.1,0
  rate            2
  velocity          0.6
  lifetime          3
  minsize           3
  maxsize           6
  enabled           1
}
smoke3 {
  attachment          "a.fire1"
  mode            "timeofday"
  color           0,0,0,220
  accel           1,0.3,0
  rate            2
  velocity          2
  lifetime          9
  minsize           5
  maxsize           9
  enabled           1
}
mesh-table {
  default {
    mesh          "oil_refinery.lm"
    auto-create       1
  }
  default-night {
    mesh          "night.im"
    night-mesh-base       "default"
  }
  load_crude_oil {
    mesh          "oil_indicator.im"
    anim          "fuel_indicator.kin"
    auto-create       1
    att         "a.load_oil"
    att-parent        "default"
  }
  load_diesel {
    mesh          "fuel_indicator.im"
    anim          "fuel_indicator.kin"
    auto-create       1
    att         "a.load_diesel"
    att-parent        "default"
  }
  load_petrol {
    mesh          "fuel_indicator.im"
    anim          "fuel_indicator.kin"
    auto-create       1
    att         "a.load_petrol"
    att-parent        "default"
  }
  load_avgas {
    mesh          "fuel_indicator.im"
    anim          "fuel_indicator.kin"
    auto-create       1
    att         "a.load_avgas"
    att-parent        "default"
  }
  warning-light-0 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_0"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-1 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_1"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-2 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_2"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-3 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_3"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-4 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_4"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
}
soundscript {
  refinery_ambient {
    repeat-delay        0
    distance        20,500
    sound {
      refinery_ambient.wav
    }
  }
  flame {
    attachment        "a.fire"
    repeat-delay        0
    distance        10,250
    sound {
      flare_burn.wav
    }
  }
}
queues {
  in_crude_oil {
    size          1940000
    animated-mesh       "load_crude_oil"
    allowed-products {
      0       <kuid:-3:10010>
    }
    initial-count       1164000
    !         "- 1164000 = 38800 x 30 Tankers"
    product-kuid        <kuid:-3:10010>
  }
  out_diesel {
    size          582000
    animated-mesh       "load_diesel"
    allowed-products {
      0       <kuid:-3:10011>
    }
    initial-count       116400
    !         "- 116400 = 38800 x 5 Tankers"
    product-kuid        <kuid:-3:10011>
  }
  out_avgas {
    size          582000
    animated-mesh       "load_avgas"
    allowed-products {
      0       <kuid:-3:10010>
    }
    initial-count       116400
    !         "- 116400 = 38800 x 5 Tankers"
    product-kuid        <kuid:-3:10045>
  }
  out_petrol {
    size          582000
    animated-mesh       "load_petrol"
    allowed-products {
      0       <kuid:-3:10010>
    }
    initial-count       116400
    !         "- 116400 = 38800 x 5 Tankers"
    product-kuid        <kuid:-3:10012>
  }
}
processes {
  oil_refining {
    start-enabled       1
    duration        60
    inputs {
      0 {
        amount      52500
        !     "- 15 min to consume initial count"
        queue     "in_crude_oil"
      }
    }
    outputs {
      0 {
        amount      35000
        queue     "out_diesel"
      }
      1 {
        amount      10000
        queue     "out_petrol"
      }
      2 {
        amount      60000
        queue     "out_avgas"
      }
    }
  }
}
attached-track {
  intrack {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
    }
  }
  outrack {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1a"
      1       "a.track1b"
      2       "a.track1c"
      3       "a.track1d"
    }
  }
}
attached-trigger {
  oil_entry0 {
    att         "a.trig0"
    radius          10
  }
  oil_entry1 {
    att         "a.trig1"
    radius          10
  }
  oil_entry2 {
    att         "a.trig2"
    radius          10
  }
  oil_entry3 {
    att         "a.trig3"
    radius          10
  }
  fuel_loading0 {
    att         "a.trig4"
    radius          10
  }
  fuel_loading1 {
    att         "a.trig5"
    radius          10
  }
  fuel_loading2 {
    att         "a.trig6"
    radius          10
  }
  fuel_loading3 {
    att         "a.trig7"
    radius          10
  }
}
icon0             <kuid:-3:10164>
string-table {
  refinery_oildropoff       "Oil drop off"
  refinery_fuelpickup       "Fuel pickup"
}
username-de           "Ölraffinerie"
string-table-de {
  refinery_oildropoff       "Öl abladen"
  refinery_fuelpickup       "Treibstoff aufnehmen"
}
username-it           "Raffineria"
string-table-it {
  refinery_oildropoff       "Scarico petrolio"
  refinery_fuelpickup       "Raccolta carburante"
}
username-es           "Refinería"
string-table-es {
  refinery_oildropoff       "Entrega de petróleo"
  refinery_fuelpickup       "Recogida de combustible"
}
username-pl           "Rafineria"
string-table-pl {
  refinery_oildropoff       "Punkt rozładunku ropy naftowej"
  refinery_fuelpickup       "Punkt załadunku paliwa"
}
username-cz           "Ropná rafinerie"
string-table-cz {
  refinery_oildropoff       "Vykládka ropy"
  refinery_fuelpickup       "Nakládka paliv"
}
username-cn           "煉油廠"
string-table-cn {
  refinery_oildropoff       "油卸貨"
  refinery_fuelpickup       "燃料裝載"
}
username-ru           "Нефтеперегонный завод"
string-table-ru {
  refinery_oildropoff       "Выгрузка нефти"
  refinery_fuelpickup       "Погрузка топлива"
}
username-fr           "Raffinerie de pétrole"
string-table-fr {
  refinery_oildropoff                       "Décharge de pétrole"
  refinery_fuelpickup                                                                  "Charge de carburant"
}

refinery.gs:

include "BaseIndustry.gs"

//
// Refinery industry
//
class Refinery isclass BaseIndustry
{
  ProductQueue crudeOilInQueue, dieselOutQueue, avgasOutQueue, petrolOutQueue;

  bool scriptletEnabled = true;

  // Track if they only supply some of the logs that were requested in the waybill.
  int oilWBRemain = 0;

  //
  //
  //

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
    {
      bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();
      int direction = vehicle.GetRelationToTrack(me, "outrack");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "fuel_loading3")
        return true;
      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "fuel_loading0")
        return true;

      direction = vehicle.GetRelationToTrack(me, "intrack");
      if (!vehicleToTrain)
        direction = -direction;

      if (triggerName == "fuel_loading0" or triggerName == "fuel_loading1" or triggerName == "fuel_loading2" or triggerName == "fuel_loading3")
      {
        if (vehicle.GetMyTrain().IsStopped())
          return true;
      }
    }

    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
    {
      bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();
      int direction = vehicle.GetRelationToTrack(me, "intrack");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "oil_entry3")
        return true;
      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "oil_entry0")
        return true;

      if (triggerName == "oil_entry0" or triggerName == "oil_entry1" or triggerName == "oil_entry2" or triggerName == "oil_entry3")
      {
        if (vehicle.GetMyTrain().IsStopped())
          return true;
      }
    }

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (triggerName == "fuel_loading0" or triggerName == "fuel_loading1" or triggerName == "fuel_loading2" or triggerName == "fuel_loading3")
    {
      //
      // Load the diesel
      //
      int spaceAvailable = dieselOutQueue.GetQueueCount();
      LoadingReport report = CreateLoadingReport(dieselOutQueue, spaceAvailable);

      int direction = vehicle.GetRelationToTrack(me, "outrack");
      if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;

      vehicle.LoadProduct(report);

      //
      // Load the avgas
      //
      spaceAvailable = avgasOutQueue.GetQueueCount();
      report = CreateLoadingReport(avgasOutQueue, spaceAvailable);

      direction = vehicle.GetRelationToTrack(me, "outrack");
      if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;

      vehicle.LoadProduct(report);

      //
      // Load the petrol
      //
      spaceAvailable = petrolOutQueue.GetQueueCount();
      report = CreateLoadingReport(petrolOutQueue, spaceAvailable);

      direction = vehicle.GetRelationToTrack(me, "outrack");
      if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;

      vehicle.LoadProduct(report);
    }

    if (triggerName == "oil_entry0" or triggerName == "oil_entry1" or triggerName == "oil_entry2" or triggerName == "oil_entry3")
    {
      int spaceAvailable = crudeOilInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(crudeOilInQueue, spaceAvailable);

      int direction = vehicle.GetRelationToTrack(me, "intrack");
      if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (oilWBRemain > 0)
        oilWBRemain = oilWBRemain - report.amount;

    }

  }

 //
  //
  //
  thread void RefineryMain(void)
  {
    Message msg;
    Vehicle vehicle;
    string triggerName;

    //Interface.Print("Start of refinery thread!");

    wait()
    {

      on "Process-Start", "oil_refining":
      {
        SendMessage(me, "pfx", "+0+1+2+3");
        continue;
      }
      on "Process-Stop", "oil_refining":
      {
        SendMessage(me, "pfx", "-0-2-3-4");
        continue;
      }

      // ?
      on "Scriptlet-Enabled", "1":
      {
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("oil_refining", true);
        }
        continue;
      }
      // ?
      on "Scriptlet-Enabled", "0":
      {
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("oil_refining", false);
        }
        continue;
      }

    }
  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    usePipeAnimation = true;
    useGenericViewDetails = true;

    // initialize queues
    crudeOilInQueue = GetQueue("in_crude_oil");
    dieselOutQueue = GetQueue("out_diesel");
    avgasOutQueue = GetQueue("out_avgas");
    petrolOutQueue = GetQueue("out_petrol");

    AddAssetToIndustryProductInfo("oil", "in_crude_oil", "oil_refining", true);
    AddAssetToIndustryProductInfo("diesel", "out_diesel", "oil_refining", false);
    AddAssetToIndustryProductInfo("petrol", "out_petrol", "oil_refining", false);
    AddAssetToIndustryProductInfo("avgas", "out_avgas", "oil_refining", false);

    // stop animation on refinery mesh - fueling doors are shut and not animated
    StopMeshAnimation("fuelling_doors");
    SetMeshAnimationFrame("fuelling_doors", 0);

    //Interface.Print("Initializing oil refinery here!");

    RefineryMain();

    //Interface.Print("End of oil refinery initialization!");
  }

  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret = new Requirement[0];

    if (crudeOilInQueue.GetQueueCount() < 776000 or oilWBRemain > 0)  // 10 minutes till empty approx
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = crudeOilInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 1164000;        // 30 tank cars
      if (crudeOilInQueue.GetQueueCount() < 776000 and oilWBRemain == 0)
        oilWBRemain = 1164000;

      req.dst = me;
      req.dstQueue = crudeOilInQueue;

      ret[ret.size()] = req;
    }

    return ret;
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("refinery_oilDropoff");
    destTracks[destTracks.size()] = "intrack";

    destNames[destNames.size()] = stringTable.GetString("refinery_fuelPickup");
    destTracks[destTracks.size()] = "outrack";
  }

};


Portal
[Industries]

Portal Industry

config.txt:

﻿
username            "Portal"
kind              "industry"
light             1
region              "TRS2004"
kuid              <kuid:-3:10192>
type              "Industrial"
script              "PortalTunnel"
class             "PortalTunnel"
icon-texture            "icon_portal.tga"
category-region-0         "US"
category-era-0            "1960s"
category-era-1            "2000s"
category-class            "BIN"
kuid-table {
  loco            <kuid:-1:100861>
  wagon           <kuid:-1:100048>
  guardsvan         <kuid:-1:100770>
}
mesh-table {
  default {
    mesh          "portal.im"
    auto-create       1
    effects {
      portalentry {
        kind      "attachment"
        att     "a.track0g"
        default-mesh    <kuid:-3:10239>
        surveyor-only   1
      }
    }
  }
}
string-table {
  html_portal_header        "<b>Portal Options</b><br>"
  html_portal_footer        "<br><br>"
  html_portal_option_oneway     "One way only?: <a href=live://property/$0oneway tooltip='$1'>$2</a><br>"
  html_portal_option_direction_oneway   "Direction: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_direction_normal   "Default direction: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_cache_trains     "Capture incoming trains: <a href=live://property/$0cachetrains tooltip='$1'>$2</a><br>"
  html_portal_random_title      "<br><b>Random Settings</b><br>"
  html_portal_random_min        "Minimum: <a href=live://property/$0minimum tooltip='$1'>$2</a><br>"
  html_portal_random_max        "Maximum: <a href=live://property/$0maximum tooltip='$1'>$2</a><br>"
  html_portal_consist_title     "<br><b>Train Consist Pool</b><br>"
  html_portal_consist_train     "<img kuid='$0'>$1<a href=live://property/$2removeconsist/$3 tooltip='$4'>remove</a><br>"
  html_portal_consist_add       "<br><a href=live://property/$0addnew tooltip='$1'>Add a new consist</a><br>"
  html_viewdetails_wait_both      "Portal is currently waiting to produce or consume a train."
  html_viewdetails_wait_produce     "Portal is currently waiting to produce a train."
  html_viewdetails_wait_consume     "Portal is currently waiting to consume a train."
  html_viewdetails_wait_inactive      "Portal is inactive."
  html_viewdetails_producing      "Portal is currently producing a train."
  html_viewdetails_consuming      "Portal is currently consuming a train."
  html_viewdetails_unknown      "This portal tunnel is in an unknown state."
  propname-produce-time       "Production frequency"
  propname-regurgitate-time     "Return delay"
  propname-reg-alternate-name     "Alternate Portal"
  propname-help         "Portal Help"
  propdesc-produce-time       "Portal produces a new train every:"
  propdesc-regurgitate-time     "Train returns to play after:"
  propdesc-reg-alternate-name     "Train returns through portal:"
  propdesc-help         "Portal Help"
  html_description_1        "Produce new trains"
  html_description_2        "<p>Produce trains every $0 real minutes</a>.</p>"
  html_description_3        "<p>One of the following consists is chosen for production, at random:</p>"
  html_description_4        "Consume trains"
  html_description_5        "Train returns after $0 real minutes</a> delay"
  html_description_6        "Train returns through alternate portal '$0</a>'."
  get_property_value        "Help goes here"
  html_portal_produce_new_trains      "Produce new trains"
  html_portal_produce_trains_every    "Produce trains every "
  html_portal_produce_trains_real_mins    " real minutes"
  html_portal_produce_random_consist    "One of the following consists is chosen for production, at random:"
  html_portal_produce_consume_trains    "Consume trains"
  html_portal_produce_return_after    "Train returns after "
  html_portal_produce_return_delay    " real minutes</a> delay."
  html_portal_produce_load_none     "Train is not loaded or unloaded."
  html_portal_produce_load_load_only    "Train is loaded only."
  html_portal_produce_load_unload_only    "Train is unloaded only."
  html_portal_produce_load_both     "Empty trains are loaded, other trains are unloaded."
  html_portal_produce_portals_return    "Train returns through alternate portal '"
}
consists {
  aus-freight {
    0 {
      vehicle       <kuid:-1:100725>
      running-number      4840
    }
    1 {
      vehicle       <kuid:-1:100828>
    }
    2 {
      vehicle       <kuid:-1:100828>
    }
    3 {
      vehicle       <kuid:-1:100048>
    }
    4 {
      vehicle       <kuid:-1:100048>
    }
    5 {
      vehicle       <kuid:-1:100770>
    }
    6 {
      vehicle       <kuid:-1:100770>
    }
    coupling-mask       0
    decoupling-mask       0
  }
  british-hst {
    0 {
      vehicle       <kuid:-1:100039>
      running-number      7
    }
    1 {
      vehicle       <kuid:-1:100058>
    }
    2 {
      vehicle       <kuid:-1:100058>
    }
    3 {
      vehicle       <kuid:-1:100059>
      facing        0
    }
    4 {
      vehicle       <kuid:-1:100062>
    }
    5 {
      vehicle       <kuid:-1:100062>
      facing        0
    }
    6 {
      vehicle       <kuid:-1:100062>
    }
    7 {
      vehicle       <kuid:-1:101221>
    }
    8 {
      vehicle       <kuid:-1:100039>
      facing        0
      running-number      5
    }
    show-in-consist-menu      0
    coupling-mask       0
    decoupling-mask       0
  }
  trs2004testnew {
    0 {
      vehicle       <kuid:-1:100725>
      running-number      4844
    }
    1 {
      vehicle       <kuid:44179:60006>
    }
    2 {
      vehicle       <kuid:-3:10028>
    }
    3 {
      vehicle       <kuid:-3:10028>
    }
    4 {
      vehicle       <kuid:-3:10028>
    }
    5 {
      vehicle       <kuid:-3:10028>
    }
    6 {
      vehicle       <kuid:-3:10028>
    }
    7 {
      vehicle       <kuid:-1:100048>
    }
    show-in-consist-menu      1
    coupling-mask       1
    decoupling-mask       1
  }
  trs2004test {
    0 {
      vehicle       <kuid:-1:100725>
      running-number      4844
    }
    1 {
      vehicle       <kuid:-3:10028>
    }
    2 {
      vehicle       <kuid:-3:10028>
    }
    3 {
      vehicle       <kuid:-3:10028>
    }
    4 {
      vehicle       <kuid:44179:60006>
    }
    show-in-consist-menu      1
    coupling-mask       1
    decoupling-mask       1
  }
}
attached-track {
  out_track0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
      4       "a.track0e"
      5       "a.track0f"
      6       "a.track0g"
    }
  }
}
attached-trigger {
  trig_end {
    att         "a.track0d"
    radius          20
  }
  trig_entry {
    att         "a.track0f"
    radius          20
  }
}
icon0             <kuid:-3:10164>
username-de           "Portal"
string-table-de {
  html_portal_header        "<b>Portal-Optionen</b><br>"
  html_portal_footer        "<br><br>"
  html_portal_option_oneway     "Nur eine Richtung?: <a href=live://property/$0oneway tooltip='$1'>$2</a><br>"
  html_portal_option_direction_oneway   "Richtung: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_direction_normal   "Standard-Richtung: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_cache_trains     "Einfahrende Züge einfangen: <a href=live://property/$0cachetrains tooltip='$1'>$2</a><br>"
  html_portal_random_title      "<br><b>Zufallseinstellungen</b><br>"
  html_portal_random_min        "Minimum: <a href=live://property/$0minimum tooltip='$1'>$2</a><br>"
  html_portal_random_max        "Maximum: <a href=live://property/$0maximum tooltip='$1'>$2</a><br>"
  html_portal_consist_title     "<br><b>Zugzusammenstellungs-Pool</b><br>"
  html_portal_consist_train     "<img kuid='$0'>$1<a href=live://property/$2removeconsist/$3 tooltip='$4'>entfernen</a><br>"
  html_portal_consist_add       "<br><a href=live://property/$0addnew tooltip='$1'>Eine neue Zugzusammenstellung hinzufügen</a><br>"
  html_viewdetails_wait_both      "Portal wartet auf Erzeugung oder Beseitigung eines Zugs."
  html_viewdetails_wait_produce     "Portal wartet auf Erzeugung eines Zugs."
  html_viewdetails_wait_consume     "Portal wartet auf Beseitigung eines Zugs."
  html_viewdetails_wait_inactive      "Portal is inaktiv."
  html_viewdetails_producing      "Portal stellt grade einen Zug her."
  html_viewdetails_consuming      "Portal beseitigt grade einen Zug."
  html_viewdetails_unknown      "Dieser Portal-Tunnel hat einen unbekannten Zustand."
  propname-produce-time       "Produktions-Frequenz"
  propname-regurgitate-time     "Rückkehr-Verzögerung"
  propname-reg-alternate-name     "Alternatives Portal"
  propname-help         "Portal-Hilfe"
  propdesc-produce-time       "Portal erzeugt neuen Zug alle:"
  propdesc-regurgitate-time     "Zug kehrt ins Spiel zurück nach:"
  propdesc-reg-alternate-name     "Zug kehrt zurück durch Portal:"
  propdesc-help         "Portal-Hilfe"
  html_description_1        "Neue Züge erzeugen"
  html_description_2        "<p>Neue Züge alle $0 Echtzeitminuten herstellen</a>.</p>"
  html_description_3        "<p>Eine der folgenden Zugzusammenstellungen wird per Zufall zur Herstellung ausgewählt:</p>"
  html_description_4        "Züge beseitigen"
  html_description_5        "Zug kehrt nach $0 Echtzeitminuten Verzögerung zurück</a>"
  html_description_6        "Zug kehrt durch alternatives Portal '$0</a>' zurück."
  get_property_value        "Hilfe gibt´s hier"
}
username-it           "Portal"
string-table-it {
  html_portal_header        "<b>Portal Options</b><br>"
  html_portal_footer        "<br><br>"
  html_portal_option_oneway     "One way only?: <a href=live://property/$0oneway tooltip='$1'>$2</a><br>"
  html_portal_option_direction_oneway   "Direction: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_direction_normal   "Default direction: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_cache_trains     "Capture incoming trains: <a href=live://property/$0cachetrains tooltip='$1'>$2</a><br>"
  html_portal_random_title      "<br><b>Random Settings</b><br>"
  html_portal_random_min        "Minimum: <a href=live://property/$0minimum tooltip='$1'>$2</a><br>"
  html_portal_random_max        "Maximum: <a href=live://property/$0maximum tooltip='$1'>$2</a><br>"
  html_portal_consist_title     "<br><b>Train Consist Pool</b><br>"
  html_portal_consist_train     "<img kuid='$0'>$1<a href=live://property/$2removeconsist/$3 tooltip='$4'>remove</a><br>"
  html_portal_consist_add       "<br><a href=live://property/$0addnew tooltip='$1'>Add a new consist</a><br>"
  html_viewdetails_wait_both      "Portal is currently waiting to produce or consume a train."
  html_viewdetails_wait_produce     "Portal is currently waiting to produce a train."
  html_viewdetails_wait_consume     "Portal is currently waiting to consume a train."
  html_viewdetails_wait_inactive      "Portal is inactive."
  html_viewdetails_producing      "Portal is currently producing a train."
  html_viewdetails_consuming      "Portal is currently consuming a train."
  html_viewdetails_unknown      "This portal tunnel is in an unknown state."
  propname-produce-time       "Production frequency"
  propname-regurgitate-time     "Return delay"
  propname-reg-alternate-name     "Alternate Portal"
  propname-help         "Portal Help"
  propdesc-produce-time       "Portal produces a new train every:"
  propdesc-regurgitate-time     "Train returns to play after:"
  propdesc-reg-alternate-name     "Train returns through portal:"
  propdesc-help         "Portal Help"
  html_description_1        "Produce new trains"
  html_description_2        "<p>Produce trains every $0 real minutes</a>.</p>"
  html_description_3        "<p>One of the following consists is chosen for production, at random:</p>"
  html_description_4        "Consume trains"
  html_description_5        "Train returns after $0 real minutes</a> delay"
  html_description_6        "Train returns through alternate portal '$0</a>'."
  get_property_value        "Help goes here"
}
username-es           "Portal"
string-table-es {
  html_portal_header        "<b>Opciones del portal</b><br>"
  html_portal_footer        "<br><br>"
  html_portal_option_oneway     "¿Sólo un sentido? </b> <a href=live://property/industryname tooltip='tooltip'>$0</a><br>"
  html_portal_option_direction_oneway   "Dirección: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_direction_normal   "Dirección predeterminada: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_cache_trains     "Capturar trenes entrantes: <a href=live://property/$0cachetrains tooltip='$1'>$2</a><br>"
  html_portal_random_title      "<br><b>Ajustes aleatorios</b><br>"
  html_portal_random_min        "Mínimo: <a href=live://property/$0minimum tooltip='$1'>$2</a><br>"
  html_portal_random_max        "Máximo: <a href=live://property/$0maximum tooltip='$1'>$2</a><br>"
  html_portal_consist_title     "<br><b>Reserva de composiciones de trenes</b><br>"
  html_portal_consist_train     "<img kuid='$0'>$1<a href=live://property/$2removeconsist/$3 tooltip='$4'>quitar</a><br>"
  html_portal_consist_add       "<br><a href=live://property/$0addnew tooltip='$1'>Añadir una composición nueva</a><br>"
  html_viewdetails_wait_both      "El portal está esperando a producir o consumir un tren."
  html_viewdetails_wait_produce     "El portal está esperando a producir un tren."
  html_viewdetails_wait_consume     "El portal está esperando a consumir un tren."
  html_viewdetails_wait_inactive      "El portal está inactivo."
  html_viewdetails_producing      "El portal está produciendo un tren."
  html_viewdetails_consuming      "El portal está consumiendo un tren."
  html_viewdetails_unknown      "Este portal se encuentra en un estado desconocido."
  propname-produce-time       "Frecuencia de producción"
  propname-regurgitate-time     "Lapso de retorno"
  propname-reg-alternate-name     "Alternar portal"
  propname-help         "Ayuda del portal"
  propdesc-produce-time       "El portal produce un nuevo tren cada:"
  propdesc-regurgitate-time     "El tren vuelve al juego tras:"
  propdesc-reg-alternate-name     "El tren vuelve por el portal:"
  propdesc-help         "Ayuda del portal"
  html_description_1        "Produce nuevos trenes"
  html_description_2        "<p>Produce trenes cada $0 minutos de tiempo real</a>.</p>"
  html_description_3        "<p>Se escogerá aleatoriamente la producción de una de las composiciones siguientes:</p>"
  html_description_4        "Consume trenes"
  html_description_5        "El tren vuelve tras un lapso de $0 minutos de tiempo real</a>."
  html_description_6        "El tren vuelve por el portal alterno '$0</a>'."
  get_property_value        "Ayuda"
}
username-pl           "Portal"
string-table-pl {
  html_portal_header        "<b>Portal Options</b><br>"
  html_portal_footer        "<br><br>"
  html_portal_option_oneway     "One way only?: <a href=live://property/$0oneway tooltip='$1'>$2</a><br>"
  html_portal_option_direction_oneway   "Direction: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_direction_normal   "Default direction: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_cache_trains     "Capture incoming trains: <a href=live://property/$0cachetrains tooltip='$1'>$2</a><br>"
  html_portal_random_title      "<br><b>Random Settings</b><br>"
  html_portal_random_min        "Minimum: <a href=live://property/$0minimum tooltip='$1'>$2</a><br>"
  html_portal_random_max        "Maximum: <a href=live://property/$0maximum tooltip='$1'>$2</a><br>"
  html_portal_consist_title     "<br><b>Train Consist Pool</b><br>"
  html_portal_consist_train     "<img kuid='$0'>$1<a href=live://property/$2removeconsist/$3 tooltip='$4'>remove</a><br>"
  html_portal_consist_add       "<br><a href=live://property/$0addnew tooltip='$1'>Add a new consist</a><br>"
  html_viewdetails_wait_both      "Portal is currently waiting to produce or consume a train."
  html_viewdetails_wait_produce     "Portal is currently waiting to produce a train."
  html_viewdetails_wait_consume     "Portal is currently waiting to consume a train."
  html_viewdetails_wait_inactive      "Portal is inactive."
  html_viewdetails_producing      "Portal is currently producing a train."
  html_viewdetails_consuming      "Portal is currently consuming a train."
  html_viewdetails_unknown      "This portal tunnel is in an unknown state."
  propname-produce-time       "Production frequency"
  propname-regurgitate-time     "Return delay"
  propname-reg-alternate-name     "Alternate Portal"
  propname-help         "Portal Help"
  propdesc-produce-time       "Portal produces a new train every:"
  propdesc-regurgitate-time     "Train returns to play after:"
  propdesc-reg-alternate-name     "Train returns through portal:"
  propdesc-help         "Portal Help"
  html_description_1        "Produce new trains"
  html_description_2        "<p>Produce trains every $0 real minutes</a>.</p>"
  html_description_3        "<p>One of the following consists is chosen for production, at random:</p>"
  html_description_4        "Consume trains"
  html_description_5        "Train returns after $0 real minutes</a> delay"
  html_description_6        "Train returns through alternate portal '$0</a>'."
  get_property_value        "Help goes here"
}
username-cz           "Portál"
string-table-cz {
  html_portal_header        "<b>Nastavení portálu</b><br>"
  html_portal_footer        "<br><br>"
  html_portal_option_oneway     "Jednosměrný?: <a href=live://property/$0oneway tooltip='$1'>$2</a><br>"
  html_portal_option_direction_oneway   "Směr: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_direction_normal   "Standardní směr: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_cache_trains     "Zachycovat příchozí vlaky: <a href=live://property/$0cachetrains tooltip='$1'>$2</a><br>"
  html_portal_random_title      "<br><b>Nastavení náhodnosti</b><br>"
  html_portal_random_min        "Minimum: <a href=live://property/$0minimum tooltip='$1'>$2</a><br>"
  html_portal_random_max        "Maximum: <a href=live://property/$0maximum tooltip='$1'>$2</a><br>"
  html_portal_consist_title     "<br><b>Řazení vlaku</b><br>"
  html_portal_consist_train     "<img kuid='$0'>$1<a href=live://property/$2removeconsist/$3 tooltip='$4'>odstranit</a><br>"
  html_portal_consist_add       "<br><a href=live://property/$0addnew tooltip='$1'>Přidat novou soupravu</a><br>"
  html_viewdetails_wait_both      "Portál čeká na vytvoření či pohlcení vlaku."
  html_viewdetails_wait_produce     "Portál čeká na vytvoření vlaku."
  html_viewdetails_wait_consume     "Portál čeká na pohlcení vlaku."
  html_viewdetails_wait_inactive      "Portál není aktivní."
  html_viewdetails_producing      "Portál právě vytváří vlak."
  html_viewdetails_consuming      "Portál právě pohlcuje vlak."
  html_viewdetails_unknown      "Tento portál se nachází v neznámém stavu."
  propname-produce-time       "Produkční frekvence"
  propname-regurgitate-time     "Zpoždění návratu"
  propname-reg-alternate-name     "Jiný portál"
  propname-help         "Nápověda portálu"
  propdesc-produce-time       "Portál vytváří nový vlak každých:"
  propdesc-regurgitate-time     "Vlak se vrací do hry po:"
  propdesc-reg-alternate-name     "Vlak se vrací přes portál:"
  propdesc-help         "Nápověda portálu"
  html_description_1        "Vytvořit nový vlak"
  html_description_2        "<p>Vytváří vlaky každých $0 minut skutečného času</a>.</p>"
  html_description_3        "<p>Náhodně bude vytvořena jedna z následujících souprav:</p>"
  html_description_4        "Pohltit vlak"
  html_description_5        "Vlak se vrací do hry po $0 minutách skutečného času</a>"
  html_description_6        "Vlak se vrací do hry jiným portálem '$0</a>'."
  get_property_value        "Zde zadej nápovědu"
}
username-ru           "Portal"
string-table-ru {
  html_portal_header        "<b>Portal Options</b><br>"
  html_portal_footer        "<br><br>"
  html_portal_option_oneway     "One way only?: <a href=live://property/$0oneway tooltip='$1'>$2</a><br>"
  html_portal_option_direction_oneway   "Direction: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_direction_normal   "Default direction: <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_cache_trains     "Capture incoming trains: <a href=live://property/$0cachetrains tooltip='$1'>$2</a><br>"
  html_portal_random_title      "<br><b>Random Settings</b><br>"
  html_portal_random_min        "Minimum: <a href=live://property/$0minimum tooltip='$1'>$2</a><br>"
  html_portal_random_max        "Maximum: <a href=live://property/$0maximum tooltip='$1'>$2</a><br>"
  html_portal_consist_title     "<br><b>Train Consist Pool</b><br>"
  html_portal_consist_train     "<img kuid='$0'>$1<a href=live://property/$2removeconsist/$3 tooltip='$4'>remove</a><br>"
  html_portal_consist_add       "<br><a href=live://property/$0addnew tooltip='$1'>Add a new consist</a><br>"
  html_viewdetails_wait_both      "Portal is currently waiting to produce or consume a train."
  html_viewdetails_wait_produce     "Portal is currently waiting to produce a train."
  html_viewdetails_wait_consume     "Portal is currently waiting to consume a train."
  html_viewdetails_wait_inactive      "Portal is inactive."
  html_viewdetails_producing      "Portal is currently producing a train."
  html_viewdetails_consuming      "Portal is currently consuming a train."
  html_viewdetails_unknown      "This portal tunnel is in an unknown state."
  propname-produce-time       "Production frequency"
  propname-regurgitate-time     "Return delay"
  propname-reg-alternate-name     "Alternate Portal"
  propname-help         "Portal Help"
  propdesc-produce-time       "Portal produces a new train every:"
  propdesc-regurgitate-time     "Train returns to play after:"
  propdesc-reg-alternate-name     "Train returns through portal:"
  propdesc-help         "Portal Help"
  html_description_1        "Produce new trains"
  html_description_2        "<p>Produce trains every $0 real minutes</a>.</p>"
  html_description_3        "<p>One of the following consists is chosen for production, at random:</p>"
  html_description_4        "Consume trains"
  html_description_5        "Train returns after $0 real minutes</a> delay"
  html_description_6        "Train returns through alternate portal '$0</a>'."
  get_property_value        "Help goes here"
}
username-fr           "Portique"
string-table-fr {
  html_portal_header                                                                    "<b>Options de portique</b><br>"
  html_portal_footer                                                                    "<br><br>"
  html_portal_option_oneway                                                      "A sens unique ? : <a href=live://property/$0oneway tooltip='$1'>$2</a><br>"
  html_portal_option_direction_oneway                                  "Direction : <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_direction_normal                                  "Direction par défaut : <a href=live://property/$0direction tooltip='$1'>$2</a><br>"
  html_portal_option_cache_trains                                          "Retenir les trains entrant : <a href=live://property/$0cachetrains tooltip='$1'>$2</a><br>"
  html_portal_random_title                                                        "<br><b>Réglages aléatoires</b><br>"
  html_portal_random_min                                                            "Minimum : <a href=live://property/$0minimum tooltip='$1'>$2</a><br>"
  html_portal_random_max                                                            "Maximum : <a href=live://property/$0maximum tooltip='$1'>$2</a><br>"
  html_portal_consist_title                                                      "<br><b>Réserve de convois ferroviaires</b><br>"
  html_portal_consist_train                                                      "<img kuid='$0'>$1<a href=live://property/$2removeconsist/$3 tooltip='$4'>retirer</a><br>"
  html_portal_consist_add                                                                          "<br><a href=live://property/$0addnew tooltip='$1'>Ajouter un nouveau convoi</a><br>"
  html_viewdetails_wait_both                                                    "Le portique attend un convoi entrant ou sortant."
  html_viewdetails_wait_produce                                              "Le portique attend de pouvoir produire un train."
  html_viewdetails_wait_consume                                              " Le portique attend de pouvoir accueillir un train."
  html_viewdetails_wait_inactive                                            "Le portique est inactif."
  html_viewdetails_producing                                                    "Le portique est en train de produire un train."
  html_viewdetails_consuming                                                    "Le portique est en train d'accueillir un train."
  html_viewdetails_unknown                                                        "L'état actuel de ce portique est inconnu."
  propname-produce-time                                                              "Fréquence de production"
  propname-regurgitate-time                                                      "Délai de retour"
  propname-reg-alternate-name                                                  "Portique alternatif"
  propname-help                                                                              "Aide pour portique"
  propdesc-produce-time                                                              "Le portique émet un nouveau train toutes les :"
  propdesc-regurgitate-time                                                      "Le train réintègre la partie après :"
  propdesc-reg-alternate-name                                                  "Le train réapparaît via le portique :"
  propdesc-help                                                                              "Aide pour portique"
  html_description_1                                                                    "Produit de nouveaux trains"
  html_description_2                                                                    "<p>Produit un train toutes les $0 minutes (temps réel)</a>.</p>"
  html_description_3                                                                    "<p>L'un des convois suivants est choisi au hasard pour être produit :</p>"
  html_description_4                                                                    "Accepte un train"
  html_description_5                                                                    "Le train réapparaît passé un délai de $0 </a> minutes"
  html_description_6                                                                    "Le train réapparaît via le portail '$0</a>'."
  get_property_value                                                                    "L'aide se trouve ici."
}

PortalTunnel.gs

//
// PortalTunnel.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "BasePortal.gs"
include "IndustryTrainController.gs"
include "ConsistHelperInfo.gs"
include "common.gs"
include "PortalTunnelInfo.gs"
include "Track.gs"
include "permit.gs"

//
// Portal industry
//
class PortalTunnel isclass BasePortal
{
  IndustryTrainController itc;  // industry train controller - used to track incoming/outgoing vehicles
  Browser      info;         // browser for displaying info on this industry
  //Asset        thisAsset;    // handy reference to the asset
  StringTable  stringTable;  // asset's string table

  // handles the properties options specific to this asset
  HTMLPropertyGroup group;
  PortalTunnelInfo  portalInfo;

  // portal state definition
  define int IDLE_STATE = 0;
  define int CONSUME_STATE = 1;
  define int PRODUCE_STATE = 2;

  int m_currentState = IDLE_STATE;

  define int PORTAL_IDLE = 0;
  define int PORTAL_CREATE = 1;
  define int PORTAL_CLEAR = 2;
  int portalDebugMode = PORTAL_IDLE;

  //
  // Method definitions
  //
  public void Init(void);
  void ViewDetails(void);

  thread void ThreadMain(void);
  thread void ConsumeTrain(Train train, Vehicle triggerVehicle);
  thread void ThreadEmitTrains(void);
  thread void ThreadProductionSchedule(void);

  void EmitTrain(Soup consistDescription);
  void CheckEmitTrains(void);
  bool ShouldConsumeTrain(Train train);
  thread void NotifyConsumedTrain(Soup consistDescriptor);

  //
  // Portal methods
  //

  bool portalInDriver = false;

  void ModuleInitHandler(Message msg)
  {
    if (portalInDriver)
      return;

    // are we in Driver?, so kick off portal threads needed
    if (World.GetCurrentModule() == World.DRIVER_MODULE)
    {
      portalInDriver = true;

      ThreadEmitTrains();
      ThreadProductionSchedule();
      ThreadMain();
    }
  }

  //
  // Init method called by Trainz when an instance of this industry has been created.
  //
  public void Init(void)
  {
    inherited();

    info        = null;
    itc         = new IndustryTrainController();
    //thisAsset   = me.GetAsset();
    stringTable = GetAsset().GetStringTable();

    // property handlers for this asset
    group = new HTMLPropertyGroup();

    portalInfo = new PortalTunnelInfo();
    portalInfo.Init(me);
    group.AddHandler(portalInfo, "portalinfo/");

    SetPropertyHandler(group);

    AddHandler(me, "World", "ModuleInit", "ModuleInitHandler");
  }

  void BeginPortalState(int state)
  {
    while (m_currentState != IDLE_STATE)
    {
      Interface.Log("PortalTunnel.BeginPortalState> in state " + m_currentState + "; waiting for state " + state);
      wait()
      {
        on "PortalTunnel", "Consume-Done":
          break;
        on "PortalTunnel", "Produce-Done":
          break;
      }
    }

    m_currentState = state;
  }

  void EndPortalState(int state)
  {
    if (m_currentState == state)
      m_currentState = IDLE_STATE;
    else
      Exception("EndPortalState> portal is not in state " + state);
  }

  //
  // Manage this game object.
  //
  thread void ThreadMain(void)
  {
    Message msg;

    wait()
    {
      // as a start, this industry will only eat trains up!
      on "Object", "InnerEnter", msg:
      {
        // obtain vehicle data to determine what to do
        Vehicle vehicle = cast<Vehicle>(msg.src);
        Train train = vehicle.GetMyTrain();

        if (m_currentState == IDLE_STATE)
        {
          if (ShouldConsumeTrain(train))
          {
            BeginPortalState(CONSUME_STATE);
            ConsumeTrain(train, vehicle);
          }
        }
        //else
        //  Interface.Log("PortalTunnel.ThreadMain> portal is busy- ignoring train " + train.GetId());
        continue;
      }

      // User has right-clicked on this industry and selected View Details menu option.
      // Start the ViewDetails() thread to display a browser with industry info.
      on "MapObject", "View-Details" :
      {
        ViewDetails();
        continue;
      }

      // Kill browser created by ViewDetails() as it has been closed.
      on "Browser-Closed", "", msg:
      {
        if (msg.src == info)
          info = null;
        continue;
      }
    }

  }

  //
  // View details of this asset (non functional now)
  //
  void ViewDetails(void)
  {
    //StringTable strTable = me.GetAsset().GetStringTable();

    if (!info)
    {
      info = Constructors.NewBrowser();

      // DW: usual industry details aren't really what we need - something special with train
      //     statistics instead would be preferable
      string str = "<b>" + me.GetLocalisedName() + "</b><br>";

      if (m_currentState == IDLE_STATE)
      {
        if (portalInfo.GetProduce() and portalInfo.GetConsume())
          str = str + stringTable.GetString("html_viewdetails_wait_both");

        else if (portalInfo.GetProduce() and !portalInfo.GetConsume())
          str = str + stringTable.GetString("html_viewdetails_wait_produce");

        else if (portalInfo.GetConsume() and !portalInfo.GetProduce())
          str = str + stringTable.GetString("html_viewdetails_wait_consume");

        else
          str = str + stringTable.GetString("html_viewdetails_wait_inactive");
      }
      else if (m_currentState == CONSUME_STATE)
        str = str + stringTable.GetString("html_viewdetails_consuming");

      else if (m_currentState == PRODUCE_STATE)
        str = str + stringTable.GetString("html_viewdetails_producing");

      else
        str = str + stringTable.GetString("html_viewdetails_unknown");

/*
      if (portalDebugMode == PORTAL_IDLE)
        str = str + "<p>DEBUG: EmitTrain is IDLE</p>";
      else if (portalDebugMode == PORTAL_CREATE)
        str = str + "<p>DEBUG: EmitTrain is CREATING</p>";
      else if (portalDebugMode == PORTAL_CLEAR)
        str = str + "<p>DEBUG: EmitTrain is CLEARING</p>";
      else
        str = str + "<p>DEBUG: EmitTrain is in unknown state</p>";
*/

      info.LoadHTMLString("<html><body><font color=#000000>" + str + "</font></body></html>");
      info.SetWindowRect(100, 80, 500, 250);
    }
  }

  //
  // Handle in InnterEnter of a specific vehicle during consumption process
  //
  void ConsumeTrain_InnerEnter(Vehicle vehicle)
  {
    // initialise and get info needed to determine if this inner-enter is valid part of consumption
    string    triggerName   = FindTriggerContainingNode(vehicle.GetId(), true);
    Train     train         = vehicle.GetMyTrain();
    //float     trainSpeed    = train.GetVelocity();
    //float     vehicleSpeed  = vehicle.GetVelocity();
    int       trackRelation = vehicle.GetRelationToTrack(me, "out_track0");
    //bool      trainRelation = vehicle.GetDirectionRelativeToTrain();

    // is this the first portal entry trigger?
    if (triggerName == "trig_entry")
    {
      // is this train not yet under industry control and moving into the tunnel?
      if (!itc.IsControllingTrain(train))
      {
        // TODO: dw - if it is from a seperate train, then we should ignore it (bullet proof late)
        // ok this is the first vehicle, we need to wait out this train (ie swallow it)
        itc.AddVehicle(vehicle, false);

      }
      // is this vehicle in a train being driven into this industry but not yet itself in the industry's list?
      else
      {
        itc.AddVehicle(vehicle, false);
      }
    }

  }

  //
  // inOut - true for incoming (consume), false for outoging (emitting)
  //
  void UpdateDCCThrottle(Vehicle vehicle, float capturedSpeed, bool inOut)
  {
    bool vehicleToTrain   = vehicle.GetDirectionRelativeToTrain();
    int  directionToTrack = vehicle.GetRelationToTrack(me, "out_track0");

    bool vehicleToTrack = (directionToTrack == Vehicle.DIRECTION_FORWARD);
    bool trainToTrack   = (vehicleToTrack == vehicleToTrain);

    float throttle = 0.5f;
    float speed    = capturedSpeed;

    if (speed < 0)
      speed = -speed;

    if (speed < 5)
      speed = 5;

    if (inOut and trainToTrack)
    {
      throttle = -throttle;
      speed    = -speed;
    }
    else if (!inOut and !trainToTrack)
    {
      throttle = -throttle;
      speed    = -speed;
    }

    vehicle.GetMyTrain().SetHandBrake(false);
    vehicle.GetMyTrain().SetDCCThrottle(throttle);
    vehicle.GetMyTrain().SetVelocity(speed);
  }

  //
  // Waits for given train and consumes it
  //
  thread void ConsumeTrain(Train train, Vehicle triggerVehicle)
  {
    Vehicle[] vehicleList = train.GetVehicles();
    if (triggerVehicle == vehicleList[0])
    {
      // forwards order
    }
    else if (triggerVehicle == vehicleList[vehicleList.size() - 1])
    {
      // backwards order
      Vehicle[] tempList = vehicleList;
      int i, count = tempList.size();
      vehicleList = new Vehicle[count];

      for (i = 0; i < count; i++)
        vehicleList[i] = tempList[count - 1 - i];
    }
    else
    {
      // a problem- better ignore this train!

      // set industry state back to idle and post message to indicate end of consumption process
      EndPortalState(CONSUME_STATE);
      PostMessage(me, "PortalTunnel", "Consume-Done", 0);
      return;
    }

    // blank consist description to save incoming consist to
    ConsistHelperInfo consumedConsist = new ConsistHelperInfo();

    float dccValue = 0.4;

    // save driver (if any)
    DriverCharacter driver = train.GetActiveDriver();
    if (driver)
    {
      DriverCommands commands = driver.GetDriverCommands();
      commands.ProceedToNextCommand();
      consumedConsist.SetDriverCommands(commands);
      consumedConsist.SetDriverName(driver.GetLocalisedName());
      consumedConsist.SetDriverKUID(driver.GetAsset().GetKUID());

      // remove driver from world - we don't want it on the loose to be assigned to
      // another train or anything like that
      World.RemoveDriverCharacter(driver);

      // destroy shceudle/threads once they are saved
      train.StopScheduleAndWait();
      train.SetAutopilotMode(Train.CONTROL_SCRIPT);
    }

    // handle first vehicle entry
    ConsumeTrain_InnerEnter(triggerVehicle);

    float capturedSpeed = train.GetVelocity();
    if (capturedSpeed < 0)
      capturedSpeed = -capturedSpeed;

    UpdateDCCThrottle(triggerVehicle, capturedSpeed, true);

    PostMessage(me, "Timer", "Tick", 0.25);

    Message msg;
    wait()
    {
      on "Object", "InnerEnter", msg:
      {
        Vehicle vehicle = cast<Vehicle>(msg.src);
        Train vehicleTrain = vehicle.GetMyTrain();

        if (vehicleTrain != triggerVehicle.GetMyTrain())
          // wrong train! ignore it..
          continue;

        ConsumeTrain_InnerEnter(vehicle);

        continue;
      }

      on "Object", "InnerLeave", msg:
      {
        // obtain vehicle & consist info to determine what to do
        Vehicle vehicle = cast<Vehicle>(msg.src);

        if (vehicle.GetMyTrain() != triggerVehicle.GetMyTrain())
          return;

        vehicle = triggerVehicle;

        int trackRelation = vehicle.GetRelationToTrack(me, "out_track0");

        // remove vehicle from this controller
        itc.RemoveVehicle(vehicle);

        bool vehicleFacing = (trackRelation == Vehicle.DIRECTION_BACKWARD);

        // put swallowed vehicle into our consist helper's list
        consumedConsist.AppendVehicle(vehicle, portalInfo.GetRegurgitateAction(), vehicleFacing);

        // is this not the last vehicle?
        if (vehicleList.size() > 1)
        {
          vehicleList[0, 1] = null;
          triggerVehicle = vehicleList[0];

          World.DeleteVehicle(vehicle);

          //UpdateDCCThrottle(triggerVehicle, capturedSpeed, true);
        }
        else
        {
          World.DeleteTrain(vehicle.GetMyTrain());
          break;
        }
        continue;
      }

      on "Timer", "Tick":
      {
        if (capturedSpeed > 10.f)
          capturedSpeed = capturedSpeed - 1.f;

        UpdateDCCThrottle(triggerVehicle, capturedSpeed, true);
        PostMessage(me, "Timer", "Tick", 0.25);
        continue;
      }
    }  // wait()

    ClearMessages("Timer", "Tick");

    // convert captured consist to soup and add to the list
    Soup consumedConsistSoup = consumedConsist.GetProperties();
    NotifyConsumedTrain(consumedConsistSoup);

    // set industry state back to idle and post message to indicate end of consumption process
    EndPortalState(CONSUME_STATE);
    PostMessage(me, "PortalTunnel", "Consume-Done", 0);
  }

  //
  // Emits a vehicle from the
  //
  Vehicle EmitNewVehicle(ConsistHelperInfo emitTrain, int currentVehicleIndex, Vehicle prevVehicle, Permit permit)
  {
    // use an array as CreateTrain requires that (Even though it is only one vehicle in it)
    KUID[] currentVehicleKUID = new KUID[1];
    currentVehicleKUID[0] = emitTrain.vehicles[currentVehicleIndex].vehicle;

    // create the vehicle to emit in a consist of its own
    Train newTrain = World.CreateTrain(currentVehicleKUID, me, "out_track0", 60.0, true);
    if (!newTrain)
    {
      Interface.Log("PortalTunnel.EmitNewVehicle> Failed to create initial consist for exiting train!");
      return null;
    }
    newTrain.ShowInConsistMenu(false);

    // set the vehicle up to correct direction + running number
    Vehicle[] newTrainVehicles = newTrain.GetVehicles();
    Vehicle   newVehicle       = newTrainVehicles[0];

    // running number
    string savedRunningNumber = emitTrain.vehicles[currentVehicleIndex].runningNumber;
    if (savedRunningNumber.size() > 0)
      newVehicle.SetRunningNumber(savedRunningNumber);

    // vehicel load (just use whatever the setting is from the descriptor - the consume
    // method will have seen to adjusting the load specs if needed)
    emitTrain.vehicles[currentVehicleIndex].LoadVehicle(newVehicle);

    // Reposition and attach to exiting train (if any)
    if (prevVehicle)
    {
      // if rear vehicles is not same direction as train, it's front coupler will be train's rear
      bool vehicleToTrack = (prevVehicle.GetRelationToTrack(me, "out_track0") == Vehicle.DIRECTION_FORWARD);
      int exitingVehicleRear = Vehicle.COUPLE_BACK;

      // if prev vehicle is against track, it's front coupler is facing us
      if (!vehicleToTrack)
        exitingVehicleRear = Vehicle.COUPLE_FRONT;

      bool ok = newVehicle.Reposition(prevVehicle, Vehicle.COUPLE_FRONT, exitingVehicleRear);
      if (!ok)
      {
        Interface.Log("PortalTunnel.EmitNewVehicle> Vehicle.Reposition failed - will retry");
        World.DeleteVehicle(newVehicle);
        return prevVehicle;
      }

      newTrain = newVehicle.GetMyTrain();
    }

    // assign the permit
    permit.SetOwnerObject(newTrain);

    // adjust direction of vehicle if needed
    // (always do this after we have repositioned vehicle into the exiting consist, chaos otherwise!
    if (!emitTrain.vehicles[currentVehicleIndex].facing)
      newVehicle.Reverse();

    UpdateDCCThrottle(newVehicle, 5, false);

/*
    // does the train have a driver yet? - if not add one (all trains must leave with drivers)
    if (!newTrain.GetActiveDriver())
    {
      // attach a driver to vehicle if it is a loco
      Locomotive loco = cast<Locomotive> newVehicle;
      if (loco)
      {
        Asset driverAsset;
        if (!emitTrain.GetDriverKUID())
        {
          // if we can't find a driver, then choose on at random
          Asset[] driverAssets = World.GetAssetList("drivercharacter");
          int randomDriver = Math.Rand(0, driverAssets.size());

          driverAsset = driverAssets[randomDriver];
          emitTrain.SetDriverName(driverAsset.GetName());
        }
        else
          driverAsset = World.FindAsset(emitTrain.GetDriverKUID());

        DriverCharacter newDriver = World.AddDriverCharacter(driverAsset);
        if (newDriver)
        {
          // assign to train
          newDriver.SetLocalisedName(emitTrain.GetDriverName());
          newDriver.SetLocation(newVehicle);
        }
      }
    }
*/
    Interface.Log("PortalTunnel.EmitNewVehicle> new vehicle " + newVehicle.GetId() + " on train " + newVehicle.GetMyTrain().GetId());

    return newVehicle;
  }

  //
  // Sends out the specified train from either the cached array or consist pool
  //
  void EmitTrain(Soup consistDescription)
  {
    // setup access to consist from soup descrition
    ConsistHelperInfo emitTrain = new ConsistHelperInfo();
    emitTrain.SetProperties(consistDescription);

    if (emitTrain.vehicles.size() < 1)
    {
      Interface.Log("PortalTunnel.EmitTrain> Failure, empty consist!");
//      goto abort;
      return;
    }

    Message msg;

    //bool trainDone = false;
    int  currentVehicleIndex = 0;
    int  trainSize = emitTrain.vehicles.size();

    // wait for a permit
    Track portalTrack = me.GetAttachedTrack("out_track0");
    Permit permit = portalTrack.RequestPermit(me);

    if (!permit.IsGranted())
      wait()
      {
        on "Permit", "Granted":
          if (permit.IsGranted())
            break;
          continue;
      }

    BeginPortalState(PRODUCE_STATE);
    Interface.Log("PortalTunnel.EmitTrain> Permit granted, safe to create train now...");

    // emit first vehicle
    Vehicle emitVehicle = EmitNewVehicle(emitTrain, currentVehicleIndex, null, permit);
    if (!emitVehicle)
      goto abort;

    // only move into next vehicle if we are ready (ie count isn't enough)
    if (emitTrain.vehicles[currentVehicleIndex].number > 1)
      emitTrain.vehicles[currentVehicleIndex].number--;
    else
      currentVehicleIndex++;

    PostMessage(me, "Timer", "Tick", 0.25);

    portalDebugMode = PORTAL_CREATE;

    int retryCount = 0;

    wait()
    {
      on "Timer", "Tick", msg:
      {
        // if is still in the trigger, push it out...
        if (FindTriggerContainingNode(emitVehicle.GetId(), true) == "trig_end")
        {
          if (Math.Fabs(emitVehicle.GetVelocity()) < 5.0)
            UpdateDCCThrottle(emitVehicle, 5, false);
        }
        else// if (!trainDone)
        {
          // not in the trigger? ack, we must have missed the InnerLeave somehow

          if (retryCount++ >= 4)
          {

            // before we do anything, determine if last vehicle has been done, if so, break the cycle
            // (we need to check at start, otherwise it could complicate things if there was only one
            // vehicle to emit for the entire consist)
            if (currentVehicleIndex == trainSize)
              break;

            // emit the next vehicle as previous one has left the trigger
            Vehicle prevVehicle = emitVehicle;
            emitVehicle = EmitNewVehicle(emitTrain, currentVehicleIndex, prevVehicle, permit);

            if (emitVehicle != prevVehicle)
            {
              // only move into next vehicle if we are ready (ie count isn't enough)
              if (emitTrain.vehicles[currentVehicleIndex].number > 1)
                emitTrain.vehicles[currentVehicleIndex].number--;
              else
                currentVehicleIndex++;
            }

            if (!emitVehicle)
              goto abort;

            retryCount = 0;
          }

          if (Math.Fabs(emitVehicle.GetVelocity()) < 5.0)
            UpdateDCCThrottle(emitVehicle, 5, false);
        }

        PostMessage(me, "Timer", "Tick", 0.25);
        continue;
      }

      on "Object", "InnerLeave", msg:
      {
        Vehicle vehicle = cast<Vehicle>(msg.src);

        // get info needed to determine what vehicle left this trigger
        string triggerName = FindTriggerContainingNode(vehicle.GetId(), false); // vehicle is outside inner radius once we get here

        // trigger at rear, move onto next vehicle
        if (vehicle == emitVehicle)//  and  !trainDone) //triggerName == "trig_end")
        {
          //if (!trainDone)
          {

            // before we do anything, determine if last vehicle has ben done, if so, break the cycle
            // (we need to check at start, otehrwise it could complicate things if there was only one
            // vehicle to emit for the entire consist)
            if (currentVehicleIndex == trainSize)
              break;

            // emit the next vehicle as previous one has left the trigger
            Vehicle prevVehicle = emitVehicle;
            emitVehicle = EmitNewVehicle(emitTrain, currentVehicleIndex, prevVehicle, permit);

            if (emitVehicle != prevVehicle)
            {
              // only move into next vehicle if we are ready (ie count isn't enough)
              if (emitTrain.vehicles[currentVehicleIndex].number > 1)
                emitTrain.vehicles[currentVehicleIndex].number--;
              else
                currentVehicleIndex++;
            }

            if (!emitVehicle)
              goto abort;

            retryCount = 0;
          } // !trainDone
        }
        /*else if (trainDone  and  vehicle == emitVehicle  and  triggerName != "trig_end")
        {
          // TODO: What if a vehicle isn't part of the train???

          //Vehicle[] vehicles = vehicle.GetMyTrain().GetVehicles();
          //if (vehicle == vehicles[vehicles.size()-1])
          {
            break;
          }
        }*/
        //PostMessage(me, "Timer", "Tick", 0.25);
        continue;

      } // on "Object", "InnerLeave"
    }

    ClearMessages("Timer", "Tick");

    Train exitingTrain = emitVehicle.GetMyTrain();

    //
    // Allow the train to clear the portal before handing over control.
    //
    portalDebugMode = PORTAL_CLEAR;

    if (!exitingTrain.GetFrontmostLocomotive())
    {
        // no locomotive = can't move train, so don't bother trying
    }
    else
    {
      exitingTrain.SetAutopilotMode(Train.CONTROL_AUTOPILOT);
      AITrainScope scope = exitingTrain.OpenAITrainScope();

      Sniff(exitingTrain, "Train", null, true);

      bool emitVehicleInTrigEntry = false;

      PostMessage(me, "Portal-Exit", "Tick", 10.f);

      wait()
      {
        on "Object", "InnerEnter", msg:
          if (msg.src == emitVehicle)
          {
            string triggerName = FindTriggerContainingNode(emitVehicle.GetId(), false);

            if (triggerName == "trig_entry")
              emitVehicleInTrigEntry = true;
          }
          continue;

        on "Object", "Enter", msg:
          if (msg.src == emitVehicle)
          {
            string triggerName = FindTriggerContainingNode(emitVehicle.GetId(), false);

            if (triggerName == "trig_entry")
              emitVehicleInTrigEntry = true;
          }
          continue;

        on "Object", "Leave", msg:
          if (msg.src == emitVehicle  and  emitVehicleInTrigEntry)
          {
            string triggerName = FindTriggerContainingNode(emitVehicle.GetId(), false);
            if (triggerName == "")
              break;
          }
          continue;

        on "Train", "StoppedMoving", msg:
          if (msg.src == exitingTrain)
            exitingTrain.BeginAITrainStuck(scope);
          continue;

        on "Train", "StartedMoving", msg:
          if (msg.src == exitingTrain)
            exitingTrain.EndAITrainStuck(scope);
          continue;

        on "Train", "Cleanup", msg:
          if (msg.src == exitingTrain)
            goto abort;
          continue;

        on "Portal-Exit", "Tick", msg:
          {
            Vehicle[] vehicles = emitVehicle.GetMyTrain().GetVehicles();
            int i;
            for (i = 0; i < vehicles.size(); i++)
              if (FindTriggerContainingNode(vehicles[i].GetId(), false) != "")
                goto keepWaiting;

            // uhoh.. we've run off the end of the portal without noticing.
            break;
          }

        keepWaiting:
          PostMessage(me, "Portal-Exit", "Tick", 5.f);
          continue;
      }

      ClearMessages("Timer", "Tick");
      Sniff(exitingTrain, "Train", null, false);
      exitingTrain.CloseAITrainScope(scope);
      //
    }

    DriverCharacter theDriver = exitingTrain.GetActiveDriver();

    if (!theDriver)
    {
      Vehicle driverVehicle = exitingTrain.GetFrontmostLocomotive();
      if (!driverVehicle)
        driverVehicle = exitingTrain.GetVehicles()[0];

      // determine which Driver asset to use
      Asset driverAsset;
      if (!emitTrain.GetDriverKUID())
      {
        // if we can't find a driver, then choose on at random
        Asset[] driverAssets = World.GetAssetList("drivercharacter");
        int randomDriver = Math.Rand(0, driverAssets.size());

        driverAsset = driverAssets[randomDriver];
        emitTrain.SetDriverName(driverAsset.GetName());
      }
      else
        driverAsset = World.FindAsset(emitTrain.GetDriverKUID());

      // create the Driver
      theDriver = World.AddDriverCharacter(driverAsset);
      if (theDriver)
      {
        // assign to train
        theDriver.SetLocalisedName(emitTrain.GetDriverName());
        theDriver.SetLocation(driverVehicle);
      }
    }

    // allow user to get control of the train if they wish
    exitingTrain.SetDCCThrottle(0.0);
    exitingTrain.SetAutopilotMode(Train.CONTROL_AUTOMANUAL);
    exitingTrain.ShowInConsistMenu(true);

    // always set driver commands last
    if (theDriver)
    {
      DriverCommands driverCommands = emitTrain.GetDriverCommands();
      theDriver.SetDriverCommands(driverCommands);
      theDriver.SetRunningCommands(true);
    }

  abort:
    portalDebugMode = PORTAL_IDLE;

    // set this portal back to an idle state and post message indicating this emission has finished
    EndPortalState(PRODUCE_STATE);
    PostMessage(me, "PortalTunnel", "Produce-Done", 0);
  }

  //
  // ?
  //
  bool ShouldConsumeTrain(Train train)
  {
    if (m_currentState != IDLE_STATE)
      return false;

    return portalInfo.ShouldConsumeTrain(train);
  }

  thread void ThreadProductionSchedule(void)
  {
    float delay = portalInfo.GetProduceTimeInSeconds();

    if (delay <= 0)
      // we don't want to produce anything
      return;

    while (1)
    {
      Sleep(delay);
      Soup consistDescriptor = portalInfo.GetRandomProduceConsist();
      AddProduceTrain(consistDescriptor);
    }
  }

  thread void ThreadEmitTrains(void)
  {
    wait()
    {
      on "PortalTunnel", "Consume-Done":
        CheckEmitTrains();
        continue;

      on "PortalTunnel", "Produce-Done":
        CheckEmitTrains();
        continue;

      on "PortalTunnel", "EmitTrain":
        CheckEmitTrains();
        continue;
    }
  }

  void CheckEmitTrains(void)
  {
    if (m_currentState == IDLE_STATE)
    {
      Soup consistDescriptor = PopFirstProduceTrain();
      if (consistDescriptor)
      {
        EmitTrain(consistDescriptor);
        return;
      }
    }
  }

  //
  //
  //

  thread void NotifyConsumedTrain(Soup consistDescriptor)
  {
    float time = portalInfo.GetRegurgitateTimeInSeconds(consistDescriptor);

    if (time <= 0)
      // we don't want to regurgitate anything now
      return;

    Sleep(time);

    string altPortal = portalInfo.GetRegurgitateAlternatePortalName();
    BasePortal portal;

    if (altPortal == "")
    {
      portal = me;
    }
    else
    {
      portal = cast<BasePortal> Router.GetGameObject(altPortal);
      if (!portal)
      {
        Exception("PortalTunnel> Alternate portal named '" + altPortal + "' was not found.");
        return;
      }
    }

    portal.AddProduceTrain(consistDescriptor);
  }

};


Power Station
[Industries]

Power Station Industry

config.txt:

﻿
username            "Powerstation"
kind              "Industry"
kuid              <kuid:-3:10026>
region              "TRS2004"
type              "Industrial"
nightmode           "lamp"
light             1
icon-texture            "icon_powerstation.tga"
kuid-table {
  coal            <kuid:44179:60013>
}
smoke0 {
  attachment          "a.smoke0"
  mode            "time"
  color           255,255,255,150
  accel           0.5,0.3,0
  rate            8
  velocity          3
  lifetime          10
  minsize           4
  maxsize           10
  enabled           0
}
smoke1 {
  attachment          "a.smoke1"
  mode            "time"
  color           255,255,255,150
  accel           0.5,0.3,0
  rate            8
  velocity          3
  lifetime          10
  minsize           4
  maxsize           10
  enabled           0
}
smoke2 {
  attachment          "a.smoke2"
  mode            "time"
  color           255,255,255,150
  accel           0.5,0.3,0
  rate            8
  velocity          3
  lifetime          10
  minsize           4
  maxsize           10
  enabled           0
}
smoke3 {
  attachment          "a.smoke3"
  mode            "time"
  color           50,50,50,250
  accel           1,0.3,0
  rate            8
  velocity          3
  lifetime          5
  minsize           1
  maxsize           3
  enabled           0
}
smoke4 {
  attachment          "a.smoke4"
  mode            "time"
  color           50,50,50,250
  accel           1,0.3,0
  rate            8
  velocity          3
  lifetime          5
  minsize           1
  maxsize           3
  enabled           0
}
smoke5 {
  attachment          "a.smoke5"
  mode            "time"
  color           50,50,50,250
  accel           1,0.3,0
  rate            8
  velocity          3
  lifetime          5
  minsize           1
  maxsize           3
  enabled           0
}
smoke6 {
  attachment          "a.smoke6"
  mode            "time"
  color           50,50,50,250
  accel           1,0.3,0
  rate            8
  velocity          3
  lifetime          5
  minsize           1
  maxsize           3
  enabled           0
}
script              "powerstation"
class             "PowerStation"
mesh-table {
  default {
    mesh          "powerstation.im"
    auto-create       1
  }
  default-night {
    mesh          "powerstation_nightwindows/powerstation_nightwindows.im"
    night-mesh-base       "default"
  }
  load {
    mesh          "load/load.im"
    anim          "load/load.kin"
    auto-create       1
  }
}
soundscript {
  powerstn_ambient1 {
    attachment        "a.smoke0"
    repeat-delay        0
    distance        20,500
    sound {
      power_station_ambient.wav
    }
  }
  powerstn_ambient2 {
    attachment        "a.buzz"
    repeat-delay        0
    distance        10,250
    sound {
      power_station_hum3.wav
    }
  }
}
attached-track {
  in_track {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
      4       "a.track0e"
      5       "a.track0f"
    }
  }
}
attached-trigger {
  in_load {
    att         "a.trig0"
    radius          12
  }
}
queues {
  coal_in {
    size          814500
    initial-count       271500
    !         "- 271500 = 54300 x 5 Hoppers"
    animated-mesh       "load"
    product-kuid        <kuid:44179:60013>
  }
}
processes {
  coal_consumer {
    start-enabled       1
    duration        30
    inputs {
      0 {
        amount      16290
        !     "- 25 min to consume full load"
        queue     "coal_in"
      }
    }
    outputs {
    }
  }
}
icon0             <kuid:-3:10164>
string-table {
  power_coaldropoff       "Coal drop off"
}
username-de           "Kraftwerk"
string-table-de {
  power_coaldropoff       "Kohle abladen"
}
username-it           "Centrale energetica"
string-table-it {
  power_coaldropoff       "Scarico carbone"
}
username-es           "Central eléctrica"
string-table-es {
  power_coaldropoff       "Entrega de carbón"
}
username-pl           "Elektrownia"
string-table-pl {
  power_coaldropoff       "Punkt rozładunku węgla"
}
username-cz           "Elektrárna"
string-table-cz {
  power_coaldropoff       "Vykládka uhlí"
}
username-cn           "電力公司"
string-table-cn {
  power_coaldropoff       "煤礦卸貨"
}
username-ru           "Электростанция"
string-table-ru {
  power_coaldropoff       "Выгрузка угля"
}
username-fr           "Centrale électrique"
string-table-fr {
  power_coaldropoff                                                                      "Décharge de charbon"
}

powerstation.gs:

//
// powerstation.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "BaseIndustry.gs"

//
// The scriptlet for the power station is rather basic.  All it does is unload coal from slow moving
// hoppers and activate/deactivate the particle effects as required.  As well as that, the
// consumption rate of the coal consumer process can be changed through the implemented
// PropertyObject methods.
//
// The coal_consumer process runs itself as long as there is coal to consumer (which is dependent
// on coal being dumped as the coal input queue is initially empty in default config).
//
class PowerStation isclass BaseIndustry
{
  ProductQueue coalInQueue;       // Coal input queue.

  // this flag was duplicated in BaseIndustry parent class
//  bool scriptletEnabled = true;   // Enabled/disabled indicator flag of this scriptlet.

  // Track if they only supply some of the coal that was requested in the waybill.
  int coalWBRemain = 0;

  //
  // BaseIndustry methods
  //

  //
  // Returns false to indicate that this no loading commands will be handled by this industry.
  //
  bool HandleTrainLoadCommand(Train train)
  {
    return false;
  }

  //
  // Returns true to indicate that the trigger allows loading/unloading while a vehicle is moving.
  //
  bool TriggerSupportsMovingLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
      return true;

    return false;
  }

  //
  // Unloads coal from a hopper into the coal pile (input queue).
  //
  void PerformMovingLoad(Vehicle vehicle, string triggerName)
  {
    float speed = vehicle.GetVelocity();

    if (speed > -5.0f and speed < 5.0f)
    {
      int roomAvailable = coalInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(coalInQueue, roomAvailable);
      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (coalWBRemain > 0)
        coalWBRemain = coalWBRemain - report.amount;
    }

  }

  //
  // PowerStation methods
  //

  //
  // Main thread that monitors the coal consumer process and enables/disables particle effects
  // for unloading.
  //
  thread void CoalMain(void)
  {
    Message msg;

    wait()
    {
      // Power Rule has sent message indicating power is running, so update enabled flag and ensure
      // that coal_consumer process is enabled.
      on "Scriptlet-Enabled", "1":
      {
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("coal_consumer", true);
        }
        continue;
      }
      // Power Rule has sent message indicating power is not running, so update enabled flag and
      // and ensure that coal_consumer process is disabled.
      on "Scriptlet-Enabled", "0":
      {
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("coal_consumer", false);
        }
        continue;
      }

      // enable particle effects when coal consuming process starts
      on "Process-Start", "coal_consumer":
      {
        scriptletEnabled = true;
        SendMessage(me, "pfx", "+0+1+2+3+4+5+6");
        continue;
      }
      // disable particle effects when coal consuming process has stopped
      on "Process-Stop", "coal_consumer":
      {
        scriptletEnabled = false;
        SendMessage(me, "pfx", "-0-1-2-3-4-5-6");
        continue;
      }
    }
  }

  //
  // Game object initialization method, called by Trainz when the industry is first created.  Is
  // responsible for initializing data members and starting threads to run the industry.
  //
  public void Init(void)
  {
    inherited();

    useGenericViewDetails = true;

    coalInQueue = GetQueue("coal_in");

    AddAssetToIndustryProductInfo("coal", "coal_in", "coal_consumer", true);

    CoalMain();
  }

  //
  // Industry methods
  //

  //
  // Gets the requirements of this power station (coal drop off request) for use in a waybill.
  //
  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret = new Requirement[0];

    if (coalInQueue.GetQueueCount() < 162900 or coalWBRemain > 0) // 3 coal hoppers
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = coalInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fulfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 651600;        // 12 coal hoppers
      if (coalInQueue.GetQueueCount() < 162900 and coalWBRemain == 0)
        coalWBRemain = 651600;

      req.dst = me;
      req.dstQueue = coalInQueue;

      ret[ret.size()] = req;
    }

    return ret;
  }

  //
  // Provides information so the coal drop track destination can appear in this industry's
  // sub-menu for the 'Drive To >' command menu.
  //
  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("power_coalDropoff");
    destTracks[destTracks.size()] = "in_track";
  }

};


Seaport
[Industries]

Seaport Industry and Station

config.txt:

﻿
username            "Seaport"
kind              "industry"
light             1
region              "TRS2004"
kuid              <kuid:-3:10059>
type              "Industrial"
nightmode           "lamp"
preview-mesh-kuid         <kuid:-3:10125>
script              "seaport"
class             "Seaport"
icon-texture            "icon_seaport.tga"
kuid-table {
  pipe            <kuid:-3:10051>
  cont20ft          <kuid:-3:10014>
  cont40ft          <kuid:-3:10041>
  gengoods          <kuid:-3:10013>
  logs            <kuid:-3:10001>
  lumber            <kuid:-3:10003>
  coal            <kuid:44179:60013>
  woodchips         <kuid:-3:10002>
  oil           <kuid:-3:10010>
  diesel            <kuid:-3:10011>
  petrol            <kuid:-3:10012>
  passenger         <kuid:-3:10060>
}
mesh-table {
  default {
    mesh          "Seaport.lm"
    auto-create       1
  }
  default-night {
    mesh          "night.im"
    night-mesh-base       "default"
  }
  radar {
    mesh          "radar/radar.im"
    anim          "radar/radar.kin"
    auto-create       1
    att         "a.mainradar"
    att-parent        "default"
    animation-loop-speed      1
  }
  load_crude_oil {
    mesh          "oil_indicator.im"
    anim          "fuel_indicator.kin"
    auto-create       1
    att         "a.load_oil"
    att-parent        "default"
  }
  load_diesel {
    mesh          "fuel_indicator.im"
    anim          "fuel_indicator.kin"
    auto-create       1
    att         "a.load_diesel"
    att-parent        "default"
  }
  load_petrol {
    mesh          "fuel_indicator.im"
    anim          "fuel_indicator.kin"
    auto-create       1
    att         "a.load_petrol"
    att-parent        "default"
  }
  coal_load {
    mesh          "coal_load/coal_load.im"
    anim          "coal_load/coal_load.kin"
    auto-create       1
    att         "a.load_coal"
    att-parent        "default"
  }
  woodchip_load {
    mesh          "woodchip_load/woodchip_load.im"
    anim          "woodchip_load/woodchip_load.kin"
    auto-create       1
    att         "a.load_woodchips"
    att-parent        "default"
  }
  crane {
    mesh          "crane/crane.im"
    anim          "crane/anim.kin"
    auto-create       1
    att         "a.contcrane"
    att-parent        "default"
    animation-loop-speed      1
  }
  warning-light-0 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_0"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-1 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_1"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-2 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_2"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-3 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_3"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-4 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_4"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  warning-light-5 {
    mesh          "warninglight/warninglight.im"
    att         "a.warnlight_5"
    att-parent        "default"
    anim          "warninglight/anim.kin"
    auto-create       1
    animation-loop-speed      1
    effects {
      0 {
        kind      "corona"
        att     "a.lightcorona0"
      }
      1 {
        kind      "corona"
        att     "a.lightcorona1"
      }
    }
  }
  floodlight0 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight0"
    att-parent        "default"
  }
  floodlight0_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight0"
    att-parent        "default"
    night-mesh-base       "floodlight0"
  }
  floodlight1 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight1"
    att-parent        "default"
  }
  floodlight1_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight1"
    att-parent        "default"
    night-mesh-base       "floodlight1"
  }
  floodlight2 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight2"
    att-parent        "default"
  }
  floodlight2_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight2"
    att-parent        "default"
    night-mesh-base       "floodlight2"
  }
  floodlight3 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight3"
    att-parent        "default"
  }
  floodlight3_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight3"
    att-parent        "default"
    night-mesh-base       "floodlight3"
  }
  floodlight4 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight4"
    att-parent        "default"
  }
  floodlight4_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight4"
    att-parent        "default"
    night-mesh-base       "floodlight4"
  }
  floodlight5 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight5"
    att-parent        "default"
  }
  floodlight5_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight5"
    att-parent        "default"
    night-mesh-base       "floodlight5"
  }
  floodlight6 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight6"
    att-parent        "default"
  }
  floodlight6_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight6"
    att-parent        "default"
    night-mesh-base       "floodlight6"
  }
  floodlight7 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight7"
    att-parent        "default"
  }
  floodlight7_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight7"
    att-parent        "default"
    night-mesh-base       "floodlight7"
  }
  floodlight8 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight8"
    att-parent        "default"
  }
  floodlight8_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight8"
    att-parent        "default"
    night-mesh-base       "floodlight8"
  }
  floodlight9 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight9"
    att-parent        "default"
  }
  floodlight9_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight9"
    att-parent        "default"
    night-mesh-base       "floodlight9"
  }
  floodlight10 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight10"
    att-parent        "default"
  }
  floodlight10_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight10"
    att-parent        "default"
    night-mesh-base       "floodlight10"
  }
  floodlight11 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight11"
    att-parent        "default"
  }
  floodlight11_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight11"
    att-parent        "default"
    night-mesh-base       "floodlight11"
  }
  floodlight12 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight12"
    att-parent        "default"
  }
  floodlight12_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight12"
    att-parent        "default"
    night-mesh-base       "floodlight12"
  }
  floodlight13 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight13"
    att-parent        "default"
  }
  floodlight13_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight13"
    att-parent        "default"
    night-mesh-base       "floodlight13"
  }
  floodlight14 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight14"
    att-parent        "default"
  }
  floodlight14_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight14"
    att-parent        "default"
    night-mesh-base       "floodlight14"
  }
  floodlight15 {
    mesh          "floodlight/floodlight.im"
    auto-create       1
    att         "a.floodlight15"
    att-parent        "default"
  }
  floodlight15_night {
    mesh          "floodlight/floodlight_night/floodlight_night.im"
    att         "a.floodlight15"
    att-parent        "default"
    night-mesh-base       "floodlight15"
  }
}
attached-track {
  track0_link1 {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track0a"
      1       "a.track0b"
    }
  }
  crude_oil_depot {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track0b"
      1       "a.track0c"
    }
  }
  diesel_depot {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track0c"
      1       "a.track0d"
    }
  }
  track0_link2 {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track0d"
      1       "a.track0e"
    }
  }
  container_depot {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track0e"
      1       "a.track0f"
    }
  }
  track0_link3 {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track0f"
      1       "a.track0g"
    }
  }
  general_goods_depot {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track0g"
      1       "a.track0h"
    }
  }
  track0_link4 {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track0h"
      1       "a.track0i"
      2       "a.track0j"
      3       "a.track0k"
      4       "a.track0l"
      5       "a.track0m"
      6       "a.track0n"
      7       "a.track0o"
      8       "a.track0p"
    }
  }
  track1_link1 {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track1a"
      1       "a.track1aa"
    }
  }
  petrol_depot {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track1aa"
      1       "a.track1b"
    }
  }
  track1_link2 {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track1b"
      1       "a.track1c"
    }
  }
  woodchips_depot {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track1c"
      1       "a.track1d"
    }
  }
  track1_link3 {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track1d"
      1       "a.track1e"
    }
  }
  coal_depot {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track1e"
      1       "a.track1f"
    }
  }
  track1_link4 {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track1f"
      1       "a.track1g"
    }
  }
  log_depot {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track1g"
      1       "a.track1h"
    }
  }
  lumber_depot {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track1h"
      1       "a.track1i"
      2       "a.track1j"
    }
  }
  track1_link5 {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track1j"
      1       "a.track1k"
      2       "a.track1l"
      3       "a.track1m"
      4       "a.track1n"
    }
  }
  cruiseliner_terminal {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track2a"
      1       "a.track2b"
    }
  }
  track2_link3 {
    track         <kuid:-3:10122>
    useadjoiningtracktype     0
    vertices {
      0       "a.track2b"
      1       "a.track2c"
      2       "a.track2d"
    }
  }
}
attached-trigger {
  crude_oil_in_t0 {
    att         "a.trig0"
    radius          10
    track         "crude_oil_depot"
  }
  crude_oil_in_t1 {
    att         "a.trig1"
    radius          10
    track         "crude_oil_depot"
  }
  crude_oil_in_t2 {
    att         "a.trig2"
    radius          10
    track         "crude_oil_depot"
  }
  crude_oil_in_t3 {
    att         "a.trig3"
    radius          10
    track         "crude_oil_depot"
  }
  diesel_in_t0 {
    att         "a.trig4"
    radius          10
    track         "diesel_depot"
  }
  diesel_in_t1 {
    att         "a.trig5"
    radius          10
    track         "diesel_depot"
  }
  diesel_in_t2 {
    att         "a.trig6"
    radius          10
    track         "diesel_depot"
  }
  diesel_in_t3 {
    att         "a.trig7"
    radius          10
    track         "diesel_depot"
  }
  containers_in_t {
    att         "a.trig8"
    radius          20
    track         "container_depot"
  }
  goods_in_t {
    att         "a.trig9"
    radius          20
    track         "general_goods_depot"
  }
  petrol_in_t0 {
    att         "a.trig10"
    radius          10
    track         "petrol_depot"
  }
  petrol_in_t1 {
    att         "a.trig11"
    radius          10
    track         "petrol_depot"
  }
  petrol_in_t2 {
    att         "a.trig12"
    radius          10
    track         "petrol_depot"
  }
  petrol_in_t3 {
    att         "a.trig13"
    radius          10
    track         "petrol_depot"
  }
  woodchips_in_t {
    att         "a.trig14"
    radius          20
    track         "woodchips_depot"
  }
  coal_in_t {
    att         "a.trig15"
    radius          20
    track         "coal_depot"
  }
  logs_in_t {
    att         "a.trig16"
    radius          20
    track         "log_depot"
  }
  lumber_in_t {
    att         "a.trig17"
    radius          20
    track         "lumber_depot"
  }
  passenger1_out_t0 {
    att         "a.trig20"
    radius          78
    track         "cruiseliner_terminal"
  }
  passenger2_out_t0 {
    att         "a.trig18"
    radius          78
    track         "cruiseliner_terminal"
  }
  passenger3_out_t0 {
    att         "a.track2a"
    radius          20
    track         "cruiseliner_terminal"
  }
}
soundscript {
  seaport_ambient0 {
    repeat-delay        0
    attachment        "a.track0d"
    distance        20,400
    sound {
      seaport_ambient.wav
    }
  }
  seaport_ambient1 {
    repeat-delay        0
    attachment        "a.floodlight8"
    distance        20,400
    sound {
      seaport_ambient.wav
    }
  }
  foghorns0 {
    repeat-delay        10
    attachment        "a.40cont54"
    distance        10,200
    sound {
      ships_horn.wav
    }
  }
  foghorns1 {
    repeat-delay        15
    attachment        "a.smoke0"
    distance        10,200
    sound {
      ships_horn.wav
    }
  }
  station_amb {
    attachment        "a.passon01"
    nostartdelay        1
    distance        10,0
    sound {
      station_amb_2.wav
    }
  }
}
smoke1 {
  attachment          "a.smoke0"
  mode            "time"
  color           50,50,50,255
  start           0
  period            86400
  rate            3
  velocity          2
  lifetime          2
  minsize           0.5
  maxsize           8
}
queues {
  20ft_cont_q {
    size          126
    initial-count       40
    product-kuid        <kuid:-3:10014>
    allowed-products {
      0       <kuid:-3:10014>
    }
    attachment-points {
      0       "a.20cont0"
      1       "a.20cont1"
      2       "a.20cont2"
      3       "a.20cont3"
      4       "a.20cont4"
      5       "a.20cont5"
      6       "a.20cont6"
      7       "a.20cont7"
      8       "a.20cont8"
      9       "a.20cont9"
      10        "a.20cont10"
      11        "a.20cont11"
      12        "a.20cont12"
      13        "a.20cont13"
      14        "a.20cont14"
      15        "a.20cont15"
      16        "a.20cont16"
      17        "a.20cont17"
      18        "a.20cont18"
      19        "a.20cont19"
      20        "a.20cont20"
      21        "a.20cont21"
      22        "a.20cont22"
      23        "a.20cont23"
      24        "a.20cont24"
      25        "a.20cont25"
      26        "a.20cont26"
      27        "a.20cont27"
      28        "a.20cont28"
      29        "a.20cont29"
      30        "a.20cont30"
      31        "a.20cont31"
      32        "a.20cont32"
      33        "a.20cont33"
      34        "a.20cont34"
      35        "a.20cont35"
      36        "a.20cont36"
      37        "a.20cont37"
      38        "a.20cont38"
      39        "a.20cont39"
      40        "a.20cont40"
      41        "a.20cont41"
      42        "a.20cont42"
      43        "a.20cont43"
      44        "a.20cont44"
      45        "a.20cont45"
      46        "a.20cont46"
      47        "a.20cont47"
      48        "a.20cont48"
      49        "a.20cont49"
      50        "a.20cont50"
      51        "a.20cont51"
      52        "a.20cont52"
      53        "a.20cont53"
      54        "a.20cont54"
      55        "a.20cont55"
      56        "a.20cont56"
      57        "a.20cont57"
      58        "a.20cont58"
      59        "a.20cont59"
      60        "a.20cont60"
      61        "a.20cont61"
      62        "a.20cont62"
      63        "a.20cont63"
      64        "a.20cont64"
      65        "a.20cont65"
      66        "a.20cont66"
      67        "a.20cont67"
      68        "a.20cont68"
      69        "a.20cont69"
      70        "a.20cont70"
      71        "a.20cont71"
      72        "a.20cont72"
      73        "a.20cont73"
      74        "a.20cont74"
      75        "a.20cont75"
      76        "a.20cont76"
      77        "a.20cont77"
      78        "a.20cont78"
      79        "a.20cont79"
      80        "a.20cont80"
      81        "a.20cont81"
      82        "a.20cont82"
      83        "a.20cont83"
      84        "a.20cont84"
      85        "a.20cont85"
      86        "a.20cont86"
      87        "a.20cont87"
      88        "a.20cont88"
      89        "a.20cont89"
      90        "a.20cont90"
      91        "a.20cont91"
      92        "a.20cont92"
      93        "a.20cont93"
      94        "a.20cont94"
      95        "a.20cont95"
      96        "a.20cont96"
      97        "a.20cont97"
      98        "a.20cont98"
      99        "a.20cont99"
      100       "a.20cont100"
      101       "a.20cont101"
      102       "a.20cont102"
      103       "a.20cont103"
      104       "a.20cont104"
      105       "a.20cont105"
      106       "a.20cont106"
      107       "a.20cont107"
      108       "a.20cont108"
      109       "a.20cont109"
      110       "a.20cont110"
      111       "a.20cont111"
      112       "a.20cont112"
      113       "a.20cont113"
      114       "a.20cont114"
      115       "a.20cont115"
      116       "a.20cont116"
      117       "a.20cont117"
      118       "a.20cont118"
      119       "a.20cont119"
      120       "a.20cont120"
      121       "a.20cont121"
      122       "a.20cont122"
      123       "a.20cont123"
      124       "a.20cont124"
      125       "a.20cont125"
    }
  }
  40ft_cont_q {
    size          199
    initial-count       55
    product-kuid        <kuid:-3:10041>
    allowed-products {
      0       <kuid:-3:10041>
    }
    attachment-points {
      0       "a.40cont0"
      1       "a.40cont1"
      2       "a.40cont2"
      3       "a.40cont3"
      4       "a.40cont4"
      5       "a.40cont5"
      6       "a.40cont6"
      7       "a.40cont7"
      8       "a.40cont8"
      9       "a.40cont9"
      10        "a.40cont10"
      11        "a.40cont11"
      12        "a.40cont12"
      13        "a.40cont13"
      14        "a.40cont14"
      15        "a.40cont15"
      16        "a.40cont16"
      17        "a.40cont17"
      18        "a.40cont18"
      19        "a.40cont19"
      20        "a.40cont20"
      21        "a.40cont21"
      22        "a.40cont22"
      23        "a.40cont23"
      24        "a.40cont24"
      25        "a.40cont25"
      26        "a.40cont26"
      27        "a.40cont27"
      28        "a.40cont28"
      29        "a.40cont29"
      30        "a.40cont30"
      31        "a.40cont31"
      32        "a.40cont32"
      33        "a.40cont33"
      34        "a.40cont34"
      35        "a.40cont35"
      36        "a.40cont36"
      37        "a.40cont37"
      38        "a.40cont38"
      39        "a.40cont39"
      40        "a.40cont40"
      41        "a.40cont41"
      42        "a.40cont42"
      43        "a.40cont43"
      44        "a.40cont44"
      45        "a.40cont45"
      46        "a.40cont46"
      47        "a.40cont47"
      48        "a.40cont48"
      49        "a.40cont49"
      50        "a.40cont50"
      51        "a.40cont51"
      52        "a.40cont52"
      53        "a.40cont53"
      54        "a.40cont54"
      55        "a.40cont55"
      56        "a.40cont56"
      57        "a.40cont57"
      58        "a.40cont58"
      59        "a.40cont59"
      60        "a.40cont60"
      61        "a.40cont61"
      62        "a.40cont62"
      63        "a.40cont63"
      64        "a.40cont64"
      65        "a.40cont65"
      66        "a.40cont66"
      67        "a.40cont67"
      68        "a.40cont68"
      69        "a.40cont69"
      70        "a.40cont70"
      71        "a.40cont71"
      72        "a.40cont72"
      73        "a.40cont73"
      74        "a.40cont74"
      75        "a.40cont75"
      76        "a.40cont76"
      77        "a.40cont77"
      78        "a.40cont78"
      79        "a.40cont79"
      80        "a.40cont80"
      81        "a.40cont81"
      82        "a.40cont82"
      83        "a.40cont83"
      84        "a.40cont84"
      85        "a.40cont85"
      86        "a.40cont86"
      87        "a.40cont87"
      88        "a.40cont88"
      89        "a.40cont89"
      90        "a.40cont90"
      91        "a.40cont91"
      92        "a.40cont92"
      93        "a.40cont93"
      94        "a.40cont94"
      95        "a.40cont95"
      96        "a.40cont96"
      97        "a.40cont97"
      98        "a.40cont98"
      99        "a.40cont99"
      100       "a.40cont100"
      101       "a.40cont101"
      102       "a.40cont102"
      103       "a.40cont103"
      104       "a.40cont104"
      105       "a.40cont105"
      106       "a.40cont106"
      107       "a.40cont107"
      108       "a.40cont108"
      109       "a.40cont109"
      110       "a.40cont110"
      111       "a.40cont111"
      112       "a.40cont112"
      113       "a.40cont113"
      114       "a.40cont114"
      115       "a.40cont115"
      116       "a.40cont116"
      117       "a.40cont117"
      118       "a.40cont118"
      119       "a.40cont119"
      120       "a.40cont120"
      121       "a.40cont121"
      122       "a.40cont122"
      123       "a.40cont123"
      124       "a.40cont124"
      125       "a.40cont125"
      126       "a.40cont126"
      127       "a.40cont127"
      128       "a.40cont128"
      129       "a.40cont129"
      130       "a.40cont130"
      131       "a.40cont131"
      132       "a.40cont132"
      133       "a.40cont133"
      134       "a.40cont134"
      135       "a.40cont135"
      136       "a.40cont136"
      137       "a.40cont137"
      138       "a.40cont138"
      139       "a.40cont139"
      140       "a.40cont140"
      141       "a.40cont141"
      142       "a.40cont142"
      143       "a.40cont143"
      144       "a.40cont144"
      145       "a.40cont145"
      146       "a.40cont146"
      147       "a.40cont147"
      148       "a.40cont148"
      149       "a.40cont149"
      150       "a.40cont150"
      151       "a.40cont151"
      152       "a.40cont152"
      153       "a.40cont153"
      154       "a.40cont154"
      155       "a.40cont155"
      156       "a.40cont156"
      157       "a.40cont157"
      158       "a.40cont158"
      159       "a.40cont159"
      160       "a.40cont160"
      161       "a.40cont161"
      162       "a.40cont162"
      163       "a.40cont163"
      164       "a.40cont164"
      165       "a.40cont165"
      166       "a.40cont166"
      167       "a.40cont167"
      168       "a.40cont168"
      169       "a.40cont169"
      170       "a.40cont170"
      171       "a.40cont171"
      172       "a.40cont172"
      173       "a.40cont173"
      174       "a.40cont174"
      175       "a.40cont175"
      176       "a.40cont176"
      177       "a.40cont177"
      178       "a.40cont178"
      179       "a.40cont179"
      180       "a.40cont180"
      181       "a.40cont181"
      182       "a.40cont182"
      183       "a.40cont183"
      184       "a.40cont184"
      185       "a.40cont185"
      186       "a.40cont186"
      187       "a.40cont187"
      188       "a.40cont188"
      189       "a.40cont189"
      190       "a.40cont190"
      191       "a.40cont191"
      192       "a.40cont192"
      193       "a.40cont193"
      194       "a.40cont194"
      195       "a.40cont195"
      196       "a.40cont196"
      197       "a.40cont197"
      198       "a.40cont198"
    }
  }
  gen_goods_q {
    size          144
    initial-count       50
    product-kuid        <kuid:-3:10013>
    allowed-products {
      0       <kuid:-3:10013>
    }
    attachment-points {
      0       "a.gen_goods0"
      1       "a.gen_goods1"
      2       "a.gen_goods2"
      3       "a.gen_goods3"
      4       "a.gen_goods4"
      5       "a.gen_goods5"
      6       "a.gen_goods6"
      7       "a.gen_goods7"
      8       "a.gen_goods8"
      9       "a.gen_goods9"
      10        "a.gen_goods10"
      11        "a.gen_goods11"
      12        "a.gen_goods12"
      13        "a.gen_goods13"
      14        "a.gen_goods14"
      15        "a.gen_goods15"
      16        "a.gen_goods16"
      17        "a.gen_goods17"
      18        "a.gen_goods18"
      19        "a.gen_goods19"
      20        "a.gen_goods20"
      21        "a.gen_goods21"
      22        "a.gen_goods22"
      23        "a.gen_goods23"
      24        "a.gen_goods24"
      25        "a.gen_goods25"
      26        "a.gen_goods26"
      27        "a.gen_goods27"
      28        "a.gen_goods28"
      29        "a.gen_goods29"
      30        "a.gen_goods30"
      31        "a.gen_goods31"
      32        "a.gen_goods32"
      33        "a.gen_goods33"
      34        "a.gen_goods34"
      35        "a.gen_goods35"
      36        "a.gen_goods36"
      37        "a.gen_goods37"
      38        "a.gen_goods38"
      39        "a.gen_goods39"
      40        "a.gen_goods40"
      41        "a.gen_goods41"
      42        "a.gen_goods42"
      43        "a.gen_goods43"
      44        "a.gen_goods44"
      45        "a.gen_goods45"
      46        "a.gen_goods46"
      47        "a.gen_goods47"
      48        "a.gen_goods48"
      49        "a.gen_goods49"
      50        "a.gen_goods50"
      51        "a.gen_goods51"
      52        "a.gen_goods52"
      53        "a.gen_goods53"
      54        "a.gen_goods54"
      55        "a.gen_goods55"
      56        "a.gen_goods56"
      57        "a.gen_goods57"
      58        "a.gen_goods58"
      59        "a.gen_goods59"
      60        "a.gen_goods60"
      61        "a.gen_goods61"
      62        "a.gen_goods62"
      63        "a.gen_goods63"
      64        "a.gen_goods64"
      65        "a.gen_goods65"
      66        "a.gen_goods66"
      67        "a.gen_goods67"
      68        "a.gen_goods68"
      69        "a.gen_goods69"
      70        "a.gen_goods70"
      71        "a.gen_goods71"
      72        "a.gen_goods72"
      73        "a.gen_goods73"
      74        "a.gen_goods74"
      75        "a.gen_goods75"
      76        "a.gen_goods76"
      77        "a.gen_goods77"
      78        "a.gen_goods78"
      79        "a.gen_goods79"
      80        "a.gen_goods80"
      81        "a.gen_goods81"
      82        "a.gen_goods82"
      83        "a.gen_goods83"
      84        "a.gen_goods84"
      85        "a.gen_goods85"
      86        "a.gen_goods86"
      87        "a.gen_goods87"
      88        "a.gen_goods88"
      89        "a.gen_goods89"
      90        "a.gen_goods90"
      91        "a.gen_goods91"
      92        "a.gen_goods92"
      93        "a.gen_goods93"
      94        "a.gen_goods94"
      95        "a.gen_goods95"
      96        "a.gen_goods96"
      97        "a.gen_goods97"
      98        "a.gen_goods98"
      99        "a.gen_goods99"
      100       "a.gen_goods100"
      101       "a.gen_goods101"
      102       "a.gen_goods102"
      103       "a.gen_goods103"
      104       "a.gen_goods104"
      105       "a.gen_goods105"
      106       "a.gen_goods106"
      107       "a.gen_goods107"
      108       "a.gen_goods108"
      109       "a.gen_goods109"
      110       "a.gen_goods110"
      111       "a.gen_goods111"
      112       "a.gen_goods112"
      113       "a.gen_goods113"
      114       "a.gen_goods114"
      115       "a.gen_goods115"
      116       "a.gen_goods116"
      117       "a.gen_goods117"
      118       "a.gen_goods118"
      119       "a.gen_goods119"
      120       "a.gen_goods120"
      121       "a.gen_goods121"
      122       "a.gen_goods122"
      123       "a.gen_goods123"
      124       "a.gen_goods124"
      125       "a.gen_goods125"
      126       "a.gen_goods126"
      127       "a.gen_goods127"
      128       "a.gen_goods128"
      129       "a.gen_goods129"
      130       "a.gen_goods130"
      131       "a.gen_goods131"
      132       "a.gen_goods132"
      133       "a.gen_goods133"
      134       "a.gen_goods134"
      135       "a.gen_goods135"
      136       "a.gen_goods136"
      137       "a.gen_goods137"
      138       "a.gen_goods138"
      139       "a.gen_goods139"
      140       "a.gen_goods140"
      141       "a.gen_goods141"
      142       "a.gen_goods142"
      143       "a.gen_goods143"
    }
  }
  logs_q {
    size          90
    initial-count       65
    product-kuid        <kuid:-3:10001>
    allowed-products {
      0       <kuid:-3:10001>
    }
    attachment-points {
      0       "a.log0"
      1       "a.log1"
      2       "a.log2"
      3       "a.log3"
      4       "a.log4"
      5       "a.log5"
      6       "a.log6"
      7       "a.log7"
      8       "a.log8"
      9       "a.log9"
      10        "a.log10"
      11        "a.log11"
      12        "a.log12"
      13        "a.log13"
      14        "a.log14"
      15        "a.log15"
      16        "a.log16"
      17        "a.log17"
      18        "a.log18"
      19        "a.log19"
      20        "a.log20"
      21        "a.log21"
      22        "a.log22"
      23        "a.log23"
      24        "a.log24"
      25        "a.log25"
      26        "a.log26"
      27        "a.log27"
      28        "a.log28"
      29        "a.log29"
      30        "a.log30"
      31        "a.log31"
      32        "a.log32"
      33        "a.log33"
      34        "a.log34"
      35        "a.log35"
      36        "a.log36"
      37        "a.log37"
      38        "a.log38"
      39        "a.log39"
      40        "a.log40"
      41        "a.log41"
      42        "a.log42"
      43        "a.log43"
      44        "a.log44"
      45        "a.log45"
      46        "a.log46"
      47        "a.log47"
      48        "a.log48"
      49        "a.log49"
      50        "a.log50"
      51        "a.log51"
      52        "a.log52"
      53        "a.log53"
      54        "a.log54"
      55        "a.log55"
      56        "a.log56"
      57        "a.log57"
      58        "a.log58"
      59        "a.log59"
      60        "a.log60"
      61        "a.log61"
      62        "a.log62"
      63        "a.log63"
      64        "a.log64"
      65        "a.log65"
      66        "a.log66"
      67        "a.log67"
      68        "a.log68"
      69        "a.log69"
      70        "a.log70"
      71        "a.log71"
      72        "a.log72"
      73        "a.log73"
      74        "a.log74"
      75        "a.log75"
      76        "a.log76"
      77        "a.log77"
      78        "a.log78"
      79        "a.log79"
      80        "a.log80"
      81        "a.log81"
      82        "a.log82"
      83        "a.log83"
      84        "a.log84"
      85        "a.log85"
      86        "a.log86"
      87        "a.log87"
      88        "a.log88"
      89        "a.log89"
    }
  }
  lumber_q {
    size          72
    initial-count       45
    product-kuid        <kuid:-3:10003>
    allowed-products {
      0       <kuid:-3:10003>
    }
    attachment-points {
      0       "a.lumber0"
      1       "a.lumber1"
      2       "a.lumber2"
      3       "a.lumber3"
      4       "a.lumber4"
      5       "a.lumber5"
      6       "a.lumber6"
      7       "a.lumber7"
      8       "a.lumber8"
      9       "a.lumber9"
      10        "a.lumber10"
      11        "a.lumber11"
      12        "a.lumber12"
      13        "a.lumber13"
      14        "a.lumber14"
      15        "a.lumber15"
      16        "a.lumber16"
      17        "a.lumber17"
      18        "a.lumber18"
      19        "a.lumber19"
      20        "a.lumber20"
      21        "a.lumber21"
      22        "a.lumber22"
      23        "a.lumber23"
      24        "a.lumber24"
      25        "a.lumber25"
      26        "a.lumber26"
      27        "a.lumber27"
      28        "a.lumber28"
      29        "a.lumber29"
      30        "a.lumber30"
      31        "a.lumber31"
      32        "a.lumber32"
      33        "a.lumber33"
      34        "a.lumber34"
      35        "a.lumber35"
      36        "a.lumber36"
      37        "a.lumber37"
      38        "a.lumber38"
      39        "a.lumber39"
      40        "a.lumber40"
      41        "a.lumber41"
      42        "a.lumber42"
      43        "a.lumber43"
      44        "a.lumber44"
      45        "a.lumber45"
      46        "a.lumber46"
      47        "a.lumber47"
      48        "a.lumber48"
      49        "a.lumber49"
      50        "a.lumber50"
      51        "a.lumber51"
      52        "a.lumber52"
      53        "a.lumber53"
      54        "a.lumber54"
      55        "a.lumber55"
      56        "a.lumber56"
      57        "a.lumber57"
      58        "a.lumber58"
      59        "a.lumber59"
      60        "a.lumber60"
      61        "a.lumber61"
      62        "a.lumber62"
      63        "a.lumber63"
      64        "a.lumber64"
      65        "a.lumber65"
      66        "a.lumber66"
      67        "a.lumber67"
      68        "a.lumber68"
      69        "a.lumber69"
      70        "a.lumber70"
      71        "a.lumber71"
    }
  }
  passengers_on_0 {
    passenger-queue       1
    size          150
    initial-count       15
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passsit12"
      1       "a.passon02"
      2       "a.passsit30"
      3       "a.passon04"
      4       "a.passsit13"
      5       "a.passsit01"
      6       "a.passon34"
      7       "a.passon41"
      8       "a.passon51"
      9       "a.passon114"
      10        "a.passon11"
      11        "a.passon25"
      12        "a.passon106"
      13        "a.passon61"
      14        "a.passon97"
      15        "a.passon16"
      16        "a.passon66"
      17        "a.passsit15"
      18        "a.passon19"
      19        "a.passsit28"
      20        "a.passon67"
      21        "a.passon22"
      22        "a.passon55"
      23        "a.passsit18"
      24        "a.passon44"
      25        "a.passon26"
      26        "a.passon03"
      27        "a.passon17"
      28        "a.passon29"
      29        "a.passsit10"
      30        "a.passon31"
      31        "a.passon76"
      32        "a.passon33"
      33        "a.passon80"
      34        "a.passsit07"
      35        "a.passon83"
      36        "a.passon37"
      37        "a.passon59"
      38        "a.passon07"
      39        "a.passon40"
      40        "a.passon96"
      41        "a.passon42"
      42        "a.passon18"
      43        "a.passon69"
      44        "a.passon45"
      45        "a.passsit25"
      46        "a.passon73"
      47        "a.passon48"
      48        "a.passon38"
      49        "a.passon50"
      50        "a.passsit04"
      51        "a.passon52"
      52        "a.passsit20"
      53        "a.passon54"
      54        "a.passon06"
      55        "a.passon56"
      56        "a.passon20"
      57        "a.passon58"
      58        "a.passon116"
      59        "a.passon60"
      60        "a.passon28"
      61        "a.passon39"
      62        "a.passon63"
      63        "a.passon01"
      64        "a.passon65"
      65        "a.passon101"
      66        "a.passsit23"
      67        "a.passon12"
      68        "a.passon27"
      69        "a.passon13"
      70        "a.passon08"
      71        "a.passon72"
      72        "a.passon14"
      73        "a.passon09"
      74        "a.passon75"
      75        "a.passsit03"
      76        "a.passon77"
      77        "a.passon78"
      78        "a.passon10"
      79        "a.passsit27"
      80        "a.passon81"
      81        "a.passon82"
      82        "a.passsit22"
      83        "a.passon43"
      84        "a.passsit17"
      85        "a.passon23"
      86        "a.passon87"
      87        "a.passon21"
      88        "a.passsit09"
      89        "a.passon90"
      90        "a.passon112"
      91        "a.passon92"
      92        "a.passon93"
      93        "a.passon94"
      94        "a.passon57"
      95        "a.passon36"
      96        "a.passon30"
      97        "a.passon98"
      98        "a.passon71"
      99        "a.passon100"
      100       "a.passon49"
      101       "a.passon102"
      102       "a.passon79"
      103       "a.passon104"
      104       "a.passon105"
      105       "a.passon68"
      106       "a.passon107"
      107       "a.passon46"
      108       "a.passon109"
      109       "a.passon05"
      110       "a.passon111"
      111       "a.passsit29"
      112       "a.passon113"
      113       "a.passon53"
      114       "a.passon115"
      115       "a.passon88"
      116       "a.passon117"
      117       "a.passon84"
      118       "a.passon119"
      119       "a.passon120"
      120       "a.passon74"
      121       "a.passsit02"
      122       "a.passon62"
      123       "a.passon89"
      124       "a.passon91"
      125       "a.passsit06"
      126       "a.passon47"
      127       "a.passsit08"
      128       "a.passon95"
      129       "a.passon32"
      130       "a.passsit11"
      131       "a.passon108"
      132       "a.passon85"
      133       "a.passsit14"
      134       "a.passon70"
      135       "a.passsit16"
      136       "a.passon24"
      137       "a.passon35"
      138       "a.passsit19"
      139       "a.passon86"
      140       "a.passsit21"
      141       "a.passon15"
      142       "a.passon118"
      143       "a.passsit24"
      144       "a.passon64"
      145       "a.passsit26"
      146       "a.passon99"
      147       "a.passon110"
      148       "a.passsit05"
      149       "a.passon103"
    }
  }
  passengers_off_0 {
    passenger-queue       1
    size          93
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passoff01"
      1       "a.passoff65"
      2       "a.passoff74"
      3       "a.passoff04"
      4       "a.passoff22"
      5       "a.passoff18"
      6       "a.passoff07"
      7       "a.passoff35"
      8       "a.passoff28"
      9       "a.passoff68"
      10        "a.passoff41"
      11        "a.passoff12"
      12        "a.passoff09"
      13        "a.passoff24"
      14        "a.passoff05"
      15        "a.passoff16"
      16        "a.passoff90"
      17        "a.passoff55"
      18        "a.passoff19"
      19        "a.passoff30"
      20        "a.passoff21"
      21        "a.passoff46"
      22        "a.passoff23"
      23        "a.passoff83"
      24        "a.passoff25"
      25        "a.passoff57"
      26        "a.passoff27"
      27        "a.passoff43"
      28        "a.passoff77"
      29        "a.passoff66"
      30        "a.passoff31"
      31        "a.passoff06"
      32        "a.passoff33"
      33        "a.passoff10"
      34        "a.passoff54"
      35        "a.passoff85"
      36        "a.passoff11"
      37        "a.passoff03"
      38        "a.passoff39"
      39        "a.passoff14"
      40        "a.passoff79"
      41        "a.passoff42"
      42        "a.passoff02"
      43        "a.passoff44"
      44        "a.passoff81"
      45        "a.passoff88"
      46        "a.passoff87"
      47        "a.passoff48"
      48        "a.passoff86"
      49        "a.passoff50"
      50        "a.passoff51"
      51        "a.passoff34"
      52        "a.passoff53"
      53        "a.passoff76"
      54        "a.passoff20"
      55        "a.passoff56"
      56        "a.passoff84"
      57        "a.passoff91"
      58        "a.passoff59"
      59        "a.passoff38"
      60        "a.passoff32"
      61        "a.passoff15"
      62        "a.passoff63"
      63        "a.passoff40"
      64        "a.passoff08"
      65        "a.passoff47"
      66        "a.passoff67"
      67        "a.passoff93"
      68        "a.passoff69"
      69        "a.passoff13"
      70        "a.passoff52"
      71        "a.passoff72"
      72        "a.passoff73"
      73        "a.passoff58"
      74        "a.passoff75"
      75        "a.passoff45"
      76        "a.passoff62"
      77        "a.passoff78"
      78        "a.passoff49"
      79        "a.passoff80"
      80        "a.passoff26"
      81        "a.passoff82"
      82        "a.passoff37"
      83        "a.passoff17"
      84        "a.passoff70"
      85        "a.passoff64"
      86        "a.passoff71"
      87        "a.passoff61"
      88        "a.passoff89"
      89        "a.passoff36"
      90        "a.passoff29"
      91        "a.passoff92"
      92        "a.passoff60"
    }
  }
  coal_in {
    size          1086000
    initial-count       543000
    !         "- 543000 = 54300 x 10 Hoppers"
    animated-mesh       "coal_load"
    allowed-products {
      0       <kuid:44179:60013>
    }
    product-kuid        <kuid:44179:60013>
  }
  woodchips_in {
    size          726000
    initial-count       302500
    !         "- 302500  = 60500 x 5 Gondolas"
    animated-mesh       "woodchip_load"
    allowed-products {
      0       <kuid:-3:10002>
    }
    product-kuid        <kuid:-3:10002>
  }
  crude_oil_in {
    size          1940000
    initial-count       776000
    !         "- 776000 = 38800 x 20 Tankers"
    animated-mesh       "load_crude_oil"
    allowed-products {
      0       <kuid:-3:10010>
    }
    product-kuid        <kuid:-3:10010>
  }
  diesel_in {
    size          1164000
    initial-count       465600
    !         "- 465600 = 38800 x 12 Tankers"
    animated-mesh       "load_diesel"
    allowed-products {
      0       <kuid:-3:10011>
    }
    product-kuid        <kuid:-3:10011>
  }
  petrol_in {
    size          194000
    initial-count       194000
    !         "- 194000 = 38800 x 5 Tankers"
    animated-mesh       "load_petrol"
    allowed-products {
      0       <kuid:-3:10012>
    }
    product-kuid        <kuid:-3:10012>
  }
}
processes {
  passenger_spawn_0 {
    start-enabled       1
    duration        20
    inputs {
    }
    outputs {
      0 {
        amount      1
        queue     "passengers_on_0"
      }
    }
  }
  passenger_delete_0 {
    start-enabled       1
    duration        3
    inputs {
      0 {
        amount      1
        queue     "passengers_off_0"
      }
    }
  }
  seaport_consumer {
    start-enabled       1
    duration        120
    inputs {
      0 {
        amount      4
        queue     "20ft_cont_q"
        !     "- 4 every 2 minutes: 20 min. for initial."
      }
      1 {
        amount      3
        queue     "40ft_cont_q"
        !     "- 3 every 2 minutes: 36 min. for initial."
      }
      2 {
        amount      4
        queue     "gen_goods_q"
        !     "- 4 every 2 minutes: 25 min. for initial."
      }
      3 {
        amount      4
        queue     "lumber_q"
        !     "- 3 every 2 minutes: 9 min. for initial."
      }
      4 {
        amount      11081
        !     "- 14 min to consume initial load"
        queue     "coal_in"
      }
      5 {
        amount      40000
        !     "- 15 min to consume initial load"
        queue     "woodchips_in"
      }
      6 {
        amount      55428
        !     "- 28 min to consume initial load"
        queue     "crude_oil_in"
      }
      7 {
        amount      23280
        !     "- 20 min to consume initial load"
        queue     "diesel_in"
      }
      8 {
        amount      15520
        !     "- 25 min to consume initial load"
        queue     "petrol_in"
      }
      9 {
        amount      4
        !     "- 32.5 min to consume initial load"
        queue     "logs_q"
      }
    }
    outputs {
    }
  }
}
icon0             <kuid:-3:10164>
string-table {
  seaport_crudeoildroppoff      "Crude Oil drop off"
  seaport_dieseldroppoff        "Diesel drop off"
  seaport_containerdropoff      "Container drop off"
  seaport_generaldropoff        "General Goods drop off"
  seaport_petroldropoff       "Petrol drop off"
  seaport_woodchipsdropoff      "Woodchips drop off"
  seaport_coaldropoff       "Coal drop off"
  seaport_logdropoff        "Log drop off"
  seaport_lumberdropoff       "Lumber drop off"
  seaport_passstation       "Passenger Station"
}
username-de           "Hafen"
string-table-de {
  seaport_crudeoildroppoff      "Rohöl abladen"
  seaport_dieseldroppoff        "Diesel abladen"
  seaport_containerdropoff      "Container abladen"
  seaport_generaldropoff        "Allgemeine Güter abladen"
  seaport_petroldropoff       "Benzin abladen"
  seaport_woodchipsdropoff      "Holzspähne abladen"
  seaport_coaldropoff       "Kohle abladen"
  seaport_logdropoff        "Baumstämme abladen"
  seaport_lumberdropoff       "Holz abladen"
  seaport_passstation       "Passagier-Bahnhof"
}
username-it           "Porto"
string-table-it {
  seaport_crudeoildroppoff      "Scarico petrolio grezzo"
  seaport_dieseldroppoff        "Scarico gasolio"
  seaport_containerdropoff      "Scarico container"
  seaport_generaldropoff        "Scarico merci varie"
  seaport_petroldropoff       "Scarico benzina"
  seaport_woodchipsdropoff      "Scarico trucioli"
  seaport_coaldropoff       "Scarico carbone"
  seaport_logdropoff        "Scarico tronchi"
  seaport_lumberdropoff       "Scarico legna"
  seaport_passstation       "Stazione passeggeri"
}
username-es           "Puerto"
string-table-es {
  seaport_crudeoildroppoff      "Entrega de crudo de petróleo"
  seaport_dieseldroppoff        "Entrega de diesel"
  seaport_containerdropoff      "Entrega de cisternas/contenedores"
  seaport_generaldropoff        "Entrega de mercancía general"
  seaport_petroldropoff       "Entrega de petróleo"
  seaport_woodchipsdropoff      "Entrega de restos de madera"
  seaport_coaldropoff       "Entrega de carbón"
  seaport_logdropoff        "Entrega de troncos"
  seaport_lumberdropoff       "Entrega de madera"
  seaport_passstation       "Estación de pasajeros"
}
username-pl           "Port morski"
string-table-pl {
  seaport_crudeoildroppoff      "Punkt rozładunku ropy naftowej"
  seaport_dieseldroppoff        "Punkt rozładunku oleju napędowego"
  seaport_containerdropoff      "Punkt rozładunku kontenerów"
  seaport_generaldropoff        "Punkt rozładunku drobnicy"
  seaport_petroldropoff       "Punkt rozładunku benzyny"
  seaport_woodchipsdropoff      "Punkt rozładunku wiórów"
  seaport_coaldropoff       "Punkt rozładunku węgla"
  seaport_logdropoff        "Punkt rozładunku dłużyc"
  seaport_lumberdropoff       "Punkt rozładunku tarcicy"
  seaport_passstation       "Stacja osobowa"
}
username-cz           "Přístav"
string-table-cz {
  seaport_crudeoildroppoff      "Vykládka surové ropy"
  seaport_dieseldroppoff        "Vykládka nafty"
  seaport_containerdropoff      "Vykládka kontejnerů"
  seaport_generaldropoff        "Vykládka zboží"
  seaport_petroldropoff       "Vykládka benzínu"
  seaport_woodchipsdropoff      "Vykládka pilin"
  seaport_coaldropoff       "Vykládka uhlí"
  seaport_logdropoff        "Vykládka klád"
  seaport_lumberdropoff       "Vykládka dřeva"
  seaport_passstation       "Nádraží pro cestující"
}
username-ru           "Порт"
string-table-ru {
  seaport_crudeoildroppoff      "Выгрузка сырой нефти"
  seaport_dieseldroppoff        "Выгрузка дизеля"
  seaport_containerdropoff      "Выгрузка контейнеров"
  seaport_generaldropoff        "Выгрузка товаров"
  seaport_petroldropoff       "Выгрузка бензина"
  seaport_woodchipsdropoff      "Выгрузка ДСП"
  seaport_coaldropoff       "Выгрузка угля"
  seaport_logdropoff        "Выгрузка бревен"
  seaport_lumberdropoff       "Выгрузка пиломатериалов"
  seaport_passstation       "Пассажирская станция"
}
username-fr           "Port maritime"
string-table-fr {
  seaport_crudeoildroppoff                                                        "Décharge de pétrole brut"
  seaport_dieseldroppoff                                                            "Décharge de diesel"
  seaport_containerdropoff                                                        "Décharge de conteneur"
  seaport_generaldropoff                                                            "Décharge générale de marchandises"
  seaport_petroldropoff                                                              "Décharge d'essence"
  seaport_woodchipsdropoff                                                        "Décharge de copeau"
  seaport_coaldropoff                                                                  "Décharge de charbon"
  seaport_logdropoff                                                                    "Décharge de billot"
  seaport_lumberdropoff                                                              "Décharge de planche"
  seaport_passstation                                                                  "Station de passager"
}

seaport.gs:

include "GenericPassengerStation.gs"

//
//
//
class Seaport isclass GenericPassengerStation
{
  ProductQueue cont20ftInQueue, cont40ftInQueue, gengoodsInQueue, logsInQueue, lumberInQueue, passengersInQueue, coalInQueue, woodchipsInQueue, oilInQueue, dieselInQueue, petrolInQueue;
  ProductQueue[] allQueues = null;

  int ACTION_NOTHING = 0;
  int ACTION_LOADING = 1;
  int ACTION_UNLOADING = 2;

  PassengerStationInfo[] psi;
  bool alreadyLoading = false;
  Vehicle[] doorsOpen = new Vehicle[0];

  bool scriptletEnabled = true;
  //bool animating = false;
  //bool processing = false;

  // Track if they only supply some of the logs that were requested in the waybill.
  int cont20WBRemain = 0;
  int cont40WBRemain = 0;
  int goodsWBRemain = 0;
  int logWBRemain = 0;
  int lumberWBRemain = 0;
  int coalWBRemain = 0;
  int woodchipWBRemain = 0;
  int oilWBRemain = 0;
  int dieselWBRemain = 0;
  int petrolWBRemain = 0;

  bool TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();

    if (triggerName == "passenger1_out_t0" or triggerName == "passenger2_out_t0" or triggerName == "passenger3_out_t0")
    {
      int direction = vehicle.GetRelationToTrack(me, "cruiseliner_terminal");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "passenger1_out_t0")
        return true;

      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "passenger3_out_t0")
        return true;
    }

    if (triggerName == "passenger1_out_t0" or triggerName == "passenger2_out_t0" or triggerName == "passenger3_out_t0")
    {
      if (vehicle.GetMyTrain().IsStopped())
        return true;
    }

    return false;
  }

  //
  //
  //

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();

    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
    {
      if (triggerName == "crude_oil_in_t0" or triggerName == "crude_oil_in_t3")
      {
        int direction = vehicle.GetRelationToTrack(me, "Crude_Oil_Depot");
        if (!vehicleToTrain)
          direction = -direction;

        if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "crude_oil_in_t3")
          return true;
        if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "crude_oil_in_t0")
          return true;
      }

      if (triggerName == "diesel_in_t0" or triggerName == "diesel_in_t3")
      {
        int direction = vehicle.GetRelationToTrack(me, "Diesel_Depot");
        if (!vehicleToTrain)
          direction = -direction;

        if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "diesel_in_t3")
          return true;
        if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "diesel_in_t0")
          return true;
      }

      if (triggerName == "petrol_in_t0" or triggerName == "petrol_in_t3")
      {
        int direction = vehicle.GetRelationToTrack(me, "Petrol_Depot");
        if (!vehicleToTrain)
          direction = -direction;

        if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "petrol_in_t3")
          return true;
        if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "petrol_in_t0")
          return true;
      }
    }

    if (triggerName == "passenger1_out_t0" or triggerName == "passenger3_out_t0")
    {
      int direction = vehicle.GetRelationToTrack(me, "Cruiseliner_Terminal");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "passenger1_out_t0")
        return true;
      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "passenger3_out_t0")
        return true;
    }

    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
      if (triggerName == "containers_in_t" or triggerName == "goods_in_t" or triggerName == "woodchips_in_t" or triggerName == "coal_in_t" or triggerName == "logs_in_t" or triggerName == "lumber_in_t")
        return true;

    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
      if (triggerName == "crude_oil_in_t0" or triggerName == "crude_oil_in_t1" or triggerName == "crude_oil_in_t2" or triggerName == "crude_oil_in_t3" or triggerName == "diesel_in_t0" or triggerName == "diesel_in_t1" or triggerName == "diesel_in_t2" or triggerName == "diesel_in_t3" or triggerName == "petrol_in_t0" or triggerName == "petrol_in_t1" or triggerName == "petrol_in_t2" or triggerName == "petrol_in_t3" or triggerName == "containers_in_t" or triggerName == "goods_in_t" or triggerName == "woodchips_in_t" or triggerName == "coal_in_t" or triggerName == "logs_in_t" or triggerName == "lumber_in_t")
      {
        if (vehicle.GetMyTrain().IsStopped())
          return true;
      }

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (triggerName == "crude_oil_in_t0" or triggerName == "crude_oil_in_t1" or triggerName == "crude_oil_in_t2" or triggerName == "crude_oil_in_t3")
    {
      int spaceAvailable = oilInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(oilInQueue, spaceAvailable);

      int direction = vehicle.GetRelationToTrack(me, "Crude_Oil_Depot");
      if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (oilWBRemain > 0)
        oilWBRemain = oilWBRemain - report.amount;
    }

    if (triggerName == "diesel_in_t0" or triggerName == "diesel_in_t1" or triggerName == "diesel_in_t2" or triggerName == "diesel_in_t3")
    {
      int spaceAvailable = dieselInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(dieselInQueue, spaceAvailable);

      int direction = vehicle.GetRelationToTrack(me, "Diesel_Depot");
      if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (dieselWBRemain > 0)
        dieselWBRemain = dieselWBRemain - report.amount;
    }

    if (triggerName == "petrol_in_t0" or triggerName == "petrol_in_t1" or triggerName == "petrol_in_t2" or triggerName == "petrol_in_t3")
    {
      int spaceAvailable = petrolInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(petrolInQueue, spaceAvailable);

      int direction = vehicle.GetRelationToTrack(me, "Petrol_Depot");
      if (direction == Vehicle.DIRECTION_BACKWARD)
        report.sideFlags = LoadingReport.LEFT_SIDE;
      else if (direction == Vehicle.DIRECTION_FORWARD)
        report.sideFlags = LoadingReport.RIGHT_SIDE;

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (petrolWBRemain > 0)
        petrolWBRemain = petrolWBRemain - report.amount;
    }

    if (triggerName == "containers_in_t")
    {
      //
      // 20 ft containers
      //
      int spaceAvailable = cont20ftInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(cont20ftInQueue, spaceAvailable);

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (cont20WBRemain > 0)
        cont20WBRemain = cont20WBRemain - report.amount;

      //
      // 40 ft containers
      //
      spaceAvailable = cont40ftInQueue.GetQueueSpace();
      report = CreateUnloadingReport(cont40ftInQueue, spaceAvailable);

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (cont40WBRemain > 0)
        cont40WBRemain = cont40WBRemain - report.amount;
    }

    if (triggerName == "goods_in_t")
    {
      int spaceAvailable = gengoodsInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(gengoodsInQueue, spaceAvailable);

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (goodsWBRemain > 0)
        goodsWBRemain = goodsWBRemain - report.amount;
    }

    if (triggerName == "woodchips_in_t")
    {
      int spaceAvailable = woodchipsInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(woodchipsInQueue, spaceAvailable);

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (woodchipWBRemain > 0)
        woodchipWBRemain = woodchipWBRemain - report.amount;
    }

    if (triggerName == "coal_in_t")
    {
      int spaceAvailable = coalInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(coalInQueue, spaceAvailable);

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (coalWBRemain > 0)
        coalWBRemain = coalWBRemain - report.amount;
    }

    if (triggerName == "logs_in_t")
    {
      int spaceAvailable = logsInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(logsInQueue, spaceAvailable);

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (logWBRemain > 0)
        logWBRemain = logWBRemain - report.amount;
    }

    if (triggerName == "lumber_in_t")
    {
      int spaceAvailable = lumberInQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(lumberInQueue, spaceAvailable);

      vehicle.UnloadProduct(report);

      // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
      if (lumberWBRemain > 0)
        lumberWBRemain = lumberWBRemain - report.amount;
    }

  }

  //
  // ?
  //
  thread void SeaportMain(void)
  {
    Message msg;

    wait()
    {
      Vehicle vehicle;
      string triggerName;

      on "Object", "Enter", msg:
      {
        Vehicle vehicle = cast<Vehicle>(msg.src);
        string triggerName = FindTriggerContainingNode(vehicle.GetId(), false);

//        if (triggerName == "passenger_out_t0")
//        {
//          PrepareForTrain(0);
//        }
        continue;
      }

      on "Scriptlet-Enabled", "1":
      {
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("seaport_consumer", true);
        }
        continue;
      }

      // ? Power station is providing electricity, if not already running. start the
      on "Scriptlet-Enabled", "0":
      {
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("seaport_consumer", false);
        }
        continue;
      }

      // logs_consumer process in lumber mill has started, so active smoke stack particles and
      // start the animation (forklift & conveyor)
      on "Process-Start", "seaport_consumer":

        StartMeshAnimationLoop("default");

        continue;

      // logs_consumer process has stopped, disable particle effect and stop animation
      on "Process-Stop", "seaport_consumer":

        StopMeshAnimation("default");
        continue;

    }
  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    usePipeAnimation = true;
    useGenericViewDetails = true;

    cont20ftInQueue = GetQueue("20ft_cont_q");
    cont40ftInQueue = GetQueue("40ft_cont_q");
    gengoodsInQueue = GetQueue("gen_goods_q");
    logsInQueue = GetQueue("logs_q");
    lumberInQueue = GetQueue("lumber_q");
    passengersInQueue = GetQueue("passengers0");;
    coalInQueue = GetQueue("coal_in");
    woodchipsInQueue = GetQueue("woodchips_in");
    oilInQueue = GetQueue("crude_oil_in");
    dieselInQueue = GetQueue("diesel_in");
    petrolInQueue = GetQueue("petrol_in");

    AddAssetToIndustryProductInfo("cont20ft", "20ft_cont_q", "seaport_consumer", true);
    AddAssetToIndustryProductInfo("cont40ft", "40ft_cont_q", "seaport_consumer", true);
    AddAssetToIndustryProductInfo("gengoods", "gen_goods_q", "seaport_consumer", true);
    AddAssetToIndustryProductInfo("logs", "logs_q", "seaport_consumer", true);
    AddAssetToIndustryProductInfo("lumber", "lumber_q", "seaport_consumer", true);
    AddAssetToIndustryProductInfo("coal", "coal_in", "seaport_consumer", true);
    AddAssetToIndustryProductInfo("woodchips", "woodchips_in", "seaport_consumer", true);
    AddAssetToIndustryProductInfo("oil", "crude_oil_in", "seaport_consumer", true);
    AddAssetToIndustryProductInfo("diesel", "diesel_in", "seaport_consumer", true);
    AddAssetToIndustryProductInfo("petrol", "petrol_in", "seaport_consumer", true);

    scriptletEnabled = true;
    SetMeshAnimationFrame("default", 0);
    StartMeshAnimationLoop("default");

    InitPassengerStation(1);

    SeaportMain();
    StationMain();
  }

  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret = new Requirement[0];

    if (cont20ftInQueue.GetQueueCount() < 30 or cont20WBRemain > 0)
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = cont20ftInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 30;
      if (cont20ftInQueue.GetQueueCount() < 30 and cont20WBRemain == 0)
        cont20WBRemain = 30;

      req.dst = me;
      req.dstQueue = cont20ftInQueue;

      ret[ret.size()] = req;
    }

    if (cont40ftInQueue.GetQueueCount() < 30 or cont40WBRemain > 0)
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = cont40ftInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 30;
      if (cont40ftInQueue.GetQueueCount() < 30 and cont40WBRemain == 0)
        cont40WBRemain = 30;

      req.dst = me;
      req.dstQueue = cont40ftInQueue;

      ret[ret.size()] = req;
    }

    if (gengoodsInQueue.GetQueueCount() < 15 or goodsWBRemain > 0)
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = gengoodsInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 40;
      if (gengoodsInQueue.GetQueueCount() < 15 and goodsWBRemain == 0)
        goodsWBRemain = 40;

      req.dst = me;
      req.dstQueue = gengoodsInQueue;

      ret[ret.size()] = req;
    }

    if (logsInQueue.GetQueueCount() < 25 or logWBRemain > 0)
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = logsInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 50;
      if (logsInQueue.GetQueueCount() < 25 and logWBRemain == 0)
        logWBRemain = 50;

      req.dst = me;
      req.dstQueue = logsInQueue;

      ret[ret.size()] = req;
    }

    if (lumberInQueue.GetQueueCount() < 40 or lumberWBRemain > 0)
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = lumberInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 30;
      if (lumberInQueue.GetQueueCount() < 40 and lumberWBRemain == 0)
        lumberWBRemain = 30;

      req.dst = me;
      req.dstQueue = lumberInQueue;

      ret[ret.size()] = req;
    }

    if (coalInQueue.GetQueueCount() < 271500 or coalWBRemain > 0)  // 7 mins till empty
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = coalInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 814500;
      if (coalInQueue.GetQueueCount() < 271500 and coalWBRemain == 0)
        coalWBRemain = 814500;        // 15 hoppers

      req.dst = me;
      req.dstQueue = coalInQueue;

      ret[ret.size()] = req;
    }

    if (woodchipsInQueue.GetQueueCount() < 181500 or woodchipWBRemain > 0)  // 3 gondolas
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = woodchipsInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 544500;
      if (woodchipsInQueue.GetQueueCount() < 181500 and woodchipWBRemain == 0)
        woodchipWBRemain = 544500;        // 9 gondolas

      req.dst = me;
      req.dstQueue = woodchipsInQueue;

      ret[ret.size()] = req;
    }

    if (oilInQueue.GetQueueCount() < 27500 or oilWBRemain > 0)  // approx 14 min to empty
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = oilInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 543000;
      if (oilInQueue.GetQueueCount() < 27500 and oilWBRemain == 0)
        oilWBRemain = 543000;        // 10 tank cars

      req.dst = me;
      req.dstQueue = oilInQueue;

      ret[ret.size()] = req;
    }

    if (dieselInQueue.GetQueueCount() < 232800 or dieselWBRemain > 0)  // 6 tankers
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = dieselInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 776000;
      if (dieselInQueue.GetQueueCount() < 232800 and dieselWBRemain == 0)
        dieselWBRemain = 776000;        // 20 tankers

      req.dst = me;
      req.dstQueue = dieselInQueue;

      ret[ret.size()] = req;
    }

    if (petrolInQueue.GetQueueCount() < 77600 or petrolWBRemain > 0)  // 2 tankers approx 10 min
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = petrolInQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 116400;
      if (petrolInQueue.GetQueueCount() < 77600 and petrolWBRemain == 0)
        petrolWBRemain = 116400;        // 3 tankers

      req.dst = me;
      req.dstQueue = petrolInQueue;

      ret[ret.size()] = req;
    }

    return ret;
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("seaport_crudeoilDroppoff");  // "Crude Oil Drop off"
    destTracks[destTracks.size()] = "Crude_Oil_Depot";

    destNames[destNames.size()] = stringTable.GetString("seaport_dieselDroppoff");  // "Diesel Drop off"
    destTracks[destTracks.size()] = "Diesel_Depot";

    destNames[destNames.size()] = stringTable.GetString("seaport_containerDropoff");  // "Container Drop off"
    destTracks[destTracks.size()] = "Container_Depot";

    destNames[destNames.size()] = stringTable.GetString("seaport_generalDropoff");  // "General Goods Drop off"
    destTracks[destTracks.size()] = "General_Goods_Depot";

    destNames[destNames.size()] = stringTable.GetString("seaport_petrolDropoff");  // "Petrol Drop off"
    destTracks[destTracks.size()] = "Petrol_Depot";

    destNames[destNames.size()] = stringTable.GetString("seaport_woodchipsDropoff");  // "Woodchips Drop off"
    destTracks[destTracks.size()] = "Woodchips_Depot";

    destNames[destNames.size()] = stringTable.GetString("seaport_coalDropoff");  // "Coal Drop off"
    destTracks[destTracks.size()] = "Coal_Depot";

    destNames[destNames.size()] = stringTable.GetString("seaport_logDropoff");  // "Log Drop off"
    destTracks[destTracks.size()] = "Log_Depot";

    destNames[destNames.size()] = stringTable.GetString("seaport_lumberDropoff");  // "Lumber Drop off"
    destTracks[destTracks.size()] = "Lumber_Depot";

    destNames[destNames.size()] = stringTable.GetString("seaport_passStation");  // "Passenger Station"
    destTracks[destTracks.size()] = "Cruiseliner_Terminal";
  }

  void GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo)
  {
    if (triggerName == "passenger1_out_t0" or triggerName == "passenger2_out_t0" or triggerName == "passenger3_out_t0")
    {
      retInfo.trackName = "cruiseliner_terminal";
      retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) != Vehicle.DIRECTION_FORWARD) == vehicle.GetDirectionRelativeToTrain();
      retInfo.platformIndex = 0;
    }
  }

};


Small Station
[Industries]

Small Station

config.txt:

﻿
username            "Small_Station"
kind              "industry"
kuid              <kuid:-3:10075>
light             1
region              "TRS2004"
type              "Trackside"
icon-texture            "icon_small_station.tga"
script              "SmallStation"
class             "SmallStation"
passenger-height          1.204
kuid-table {
  passenger         <kuid:-3:10060>
}
mesh-table {
  default {
    mesh          "small_station.im"
    auto-create       1
    effects {
      0 {
        kind      "name"
        fontsize    0.08
        fontcolor   220,220,220
        att     "a.name0"
        name      "name"
      }
      1 {
        kind      "name"
        fontsize    0.08
        fontcolor   220,220,220
        att     "a.name1"
        name      "name"
      }
      2 {
        kind      "name"
        fontsize    0.08
        fontcolor   220,220,220
        att     "a.name2"
        name      "name"
      }
      3 {
        kind      "name"
        fontsize    0.08
        fontcolor   220,220,220
        att     "a.name3"
        name      "name"
      }
    }
  }
}
;             "1 goes to track_two"
attached-track {
  track_one {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
    }
  }
  track_two {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1a"
      1       "a.track1b"
      2       "a.track1c"
      3       "a.track1d"
    }
  }
}
attached-trigger {
  trigger_track_one_a {
    att         "a.track0a"
    radius          2
    track         "track_one"
  }
  trigger_track_one_b {
    att         "a.trigmain"
    radius          19
    track         "track_one"
  }
  trigger_track_one_c {
    att         "a.track0d"
    radius          2
    track         "track_one"
  }
  trigger_track_two_a {
    att         "a.track1a"
    radius          2
    track         "track_two"
  }
  trigger_track_two_b {
    att         "a.trigmain"
    radius          19
    track         "track_two"
  }
  trigger_track_two_c {
    att         "a.track1d"
    radius          2
    track         "track_two"
  }
}
queues {
  passengers_on_0 {
    passenger-queue       1
    size          47
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passon30"
      1       "a.passon02"
      2       "a.passon23"
      3       "a.passon14"
      4       "a.passon05"
      5       "a.passon06"
      6       "a.passon37"
      7       "a.passon28"
      8       "a.passon09"
      9       "a.passon31"
      10        "a.passsit01"
      11        "a.passon12"
      12        "a.passon13"
      13        "a.passon04"
      14        "a.passsit09"
      15        "a.passon16"
      16        "a.passon17"
      17        "a.passon24"
      18        "a.passon29"
      19        "a.passon20"
      20        "a.passon21"
      21        "a.passon35"
      22        "a.passon03"
      23        "a.passon34"
      24        "a.passon25"
      25        "a.passon18"
      26        "a.passon27"
      27        "a.passon08"
      28        "a.passon19"
      29        "a.passon01"
      30        "a.passon10"
      31        "a.passon32"
      32        "a.passon22"
      33        "a.passsit02"
      34        "a.passon39"
      35        "a.passon36"
      36        "a.passon07"
      37        "a.passon38"
      38        "a.passsit11"
      39        "a.passon40"
      40        "a.passon11"
      41        "a.passon15"
      42        "a.passsit03"
      43        "a.passsit08"
      44        "a.passon33"
      45        "a.passsit10"
      46        "a.passon26"
    }
  }
  passengers_on_1 {
    passenger-queue       1
    size          48
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passon61"
      1       "a.passon67"
      2       "a.passon43"
      3       "a.passon65"
      4       "a.passon72"
      5       "a.passon59"
      6       "a.passon47"
      7       "a.passon55"
      8       "a.passon62"
      9       "a.passon50"
      10        "a.passon51"
      11        "a.passon76"
      12        "a.passon78"
      13        "a.passon46"
      14        "a.passsit13"
      15        "a.passon56"
      16        "a.passon57"
      17        "a.passon58"
      18        "a.passon44"
      19        "a.passon52"
      20        "a.passon41"
      21        "a.passsit06"
      22        "a.passon53"
      23        "a.passon64"
      24        "a.passon74"
      25        "a.passon66"
      26        "a.passsit15"
      27        "a.passon68"
      28        "a.passon63"
      29        "a.passon70"
      30        "a.passon71"
      31        "a.passon79"
      32        "a.passon73"
      33        "a.passsit07"
      34        "a.passon75"
      35        "a.passon45"
      36        "a.passon77"
      37        "a.passsit05"
      38        "a.passon69"
      39        "a.passon80"
      40        "a.passsit04"
      41        "a.passon49"
      42        "a.passon48"
      43        "a.passon60"
      44        "a.passsit12"
      45        "a.passon42"
      46        "a.passsit14"
      47        "a.passon54"
    }
  }
  passengers_off_0 {
    passenger-queue       1
    size          26
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passoff01"
      1       "a.passoff15"
      2       "a.passoff03"
      3       "a.passoff04"
      4       "a.passoff18"
      5       "a.passoff06"
      6       "a.passoff07"
      7       "a.passoff05"
      8       "a.passoff22"
      9       "a.passoff10"
      10        "a.passoff11"
      11        "a.passoff26"
      12        "a.passoff13"
      13        "a.passoff14"
      14        "a.passoff09"
      15        "a.passoff24"
      16        "a.passoff17"
      17        "a.passoff25"
      18        "a.passoff19"
      19        "a.passoff20"
      20        "a.passoff21"
      21        "a.passoff08"
      22        "a.passoff23"
      23        "a.passoff02"
      24        "a.passoff12"
      25        "a.passoff16"
    }
  }
  passengers_off_1 {
    passenger-queue       1
    size          26
    initial-count       0
    product-kuid        <kuid:-3:10060>
    attachment-points {
      0       "a.passoff27"
      1       "a.passoff44"
      2       "a.passoff29"
      3       "a.passoff30"
      4       "a.passoff36"
      5       "a.passoff32"
      6       "a.passoff46"
      7       "a.passoff34"
      8       "a.passoff48"
      9       "a.passoff43"
      10        "a.passoff37"
      11        "a.passoff35"
      12        "a.passoff39"
      13        "a.passoff33"
      14        "a.passoff41"
      15        "a.passoff42"
      16        "a.passoff38"
      17        "a.passoff40"
      18        "a.passoff45"
      19        "a.passoff31"
      20        "a.passoff47"
      21        "a.passoff52"
      22        "a.passoff49"
      23        "a.passoff50"
      24        "a.passoff51"
      25        "a.passoff28"
    }
  }
}
processes {
  passenger_spawn_0 {
    start-enabled       1
    duration        20
    outputs {
      0 {
        amount      1
        queue     "passengers_on_0"
      }
    }
  }
  passenger_spawn_1 {
    start-enabled       1
    duration        20
    outputs {
      0 {
        amount      1
        queue     "passengers_on_1"
      }
    }
  }
  passenger_delete_0 {
    start-enabled       1
    duration        3
    inputs {
      0 {
        amount      1
        queue     "passengers_off_0"
      }
    }
  }
  passenger_delete_1 {
    start-enabled       1
    duration        3
    inputs {
      0 {
        amount      1
        queue     "passengers_off_1"
      }
    }
  }
}
soundscript {
  dayloop {
    repeat-delay        0
    distance        8,130
    sound {
      station_amb_2.wav
    }
  }
}
string-table {
  smallstation_plat1        "Platform 1"
  smallstation_plat2        "Platform 2"
}
icon0             <kuid:-3:10164>
username-de           "Kleiner_Bahnhof"
string-table-de {
  smallstation_plat1        "Bahnsteig 1"
  smallstation_plat2        "Bahnsteig 2"
}
username-it           "Stazione_Piccola"
string-table-it {
  smallstation_plat1        "Marciapiede 1"
  smallstation_plat2        "Marciapiede 2"
}
username-es           "Estación_Pequeña"
string-table-es {
  smallstation_plat1        "Andén 1"
  smallstation_plat2        "Andén 2"
}
username-pl           "Mała_stacja"
string-table-pl {
  smallstation_plat1        "Peron 1"
  smallstation_plat2        "Peron 2"
}
username-cz           "Nádraží_malé"
string-table-cz {
  smallstation_plat1        "Nástupiště 1"
  smallstation_plat2        "Nástupiště 2"
}
name-cn             "Moreton-in-Marsh"
username-cn           "Moreton車站1"
description-cn            "一個小型城鎮車站 (Moreton-in-Marsh車站模組)"
name-ru             "name"
username-ru           "Маленькая станция"
string-table-ru {
  smallstation_plat1        "Платформа 1"
  smallstation_plat2        "Платформа 2"
}
username-fr           "Gare_petite"
string-table-fr {
  smallstation_plat1                                                                    "Plateforme 1"
  smallstation_plat2                                                                    "Plateforme 2"
}

SmallStation.gs:

include "GenericPassengerStation.gs"

class SmallStation isclass GenericPassengerStation
{

  bool TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = !vehicle.GetDirectionRelativeToTrain();

    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_c")
    {
      int direction = vehicle.GetRelationToTrack(me, "track_one");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_one_c")
        return true;

      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_one_a")
        return true;
    }

    if (triggerName == "trigger_track_two_a" or triggerName == "trigger_track_two_c")
    {
      int direction = vehicle.GetRelationToTrack(me, "track_two");
      if (!vehicleToTrain)
        direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_two_c")
        return true;

      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_two_a")
        return true;
    }

    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_b" or triggerName == "trigger_track_one_c" or triggerName == "trigger_track_two_a" or triggerName == "trigger_track_two_b" or triggerName == "trigger_track_two_c")
    {
      if (vehicle.GetMyTrain().IsStopped())
        return true;
    }

    return false;
  }

  void GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo)
  {
    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_b" or triggerName == "trigger_track_one_c")
    {
      retInfo.trackName = "track_one";
      retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) != Vehicle.DIRECTION_BACKWARD) == vehicle.GetDirectionRelativeToTrain();
      retInfo.platformIndex = 0;
    }
    else if (triggerName == "trigger_track_two_a" or triggerName == "trigger_track_two_b" or triggerName == "trigger_track_two_c")
    {
      retInfo.trackName = "track_two";
      retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) == Vehicle.DIRECTION_BACKWARD) == vehicle.GetDirectionRelativeToTrain();
      retInfo.platformIndex = 1;
    }
  }

  public void Init(void)
  {
    inherited();

    InitPassengerStation(2);

    StationMain();
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("smallStation_plat1");
    destTracks[destTracks.size()] = "track_one";

    destNames[destNames.size()] = stringTable.GetString("smallStation_plat2");
    destTracks[destTracks.size()] = "track_two";
  }

};


Steam Filling Station
[Industries]

Steam Filling Station Industry

config.txt:

﻿
username            "Steam Filling Station"
kind              "industry"
light             1
region              "TRS2004"
kuid              <kuid:-3:10053>
type              "Industrial"
nightmode           "lamp"
script              "steam_filling_station"
class             "steam_filling_station"
icon-texture            "icon_steamfilling.tga"
kuid-table {
  coal            <kuid:44179:60013>
  water           <kuid:-3:10004>
  tender            <kuid:-3:10054>
}
mesh-table {
  default {
    mesh          "steam_filling_station.im"
    auto-create       1
  }
  default-night {
    mesh          "night/night.im"
    night-mesh-base       "default"
  }
  load {
    mesh          "load/load.im"
    anim          "load/load.kin"
    auto-create       1
  }
  load_water {
    mesh          "water_load.im"
    anim          "water_load.kin"
    auto-create       1
    att         "a.waterlevel"
    att-parent        "default"
  }
}
attached-track {
  out_track0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track0a"
      1       "a.track0b"
      2       "a.track0c"
      3       "a.track0d"
    }
  }
  in_track0 {
    track         <kuid:-1:15>
    vertices {
      0       "a.track1a"
      1       "a.track1b"
      2       "a.track1c"
      3       "a.track1d"
    }
  }
}
attached-trigger {
  in_load0 {
    att         "a.trig2"
    radius          6.8
  }
  out_load0 {
    att         "a.trig0"
    radius          8
  }
}
queues {
  coal_in_out {
    size          217200
    animated-mesh       "load"
    allowed-products {
      0       <kuid:44179:60013>
    }
    product-kuid        <kuid:44179:60013>
    initial-count       54300
  }
  water_out {
    size          100000
    animated-mesh       "load_water"
    allowed-products {
      0       <kuid:-3:10004>
    }
    product-kuid        <kuid:-3:10004>
    initial-count       80000
  }
}
processes {
  water_gathering {
    start-enabled       1
    duration        15
    inputs {
      0 {
        amount      1
        queue     "coal_in_out"
      }
    }
    outputs {
      0 {
        amount      25000
        queue     "water_out"
      }
      1 {
        amount      1
        queue     "coal_in_out"
      }
    }
  }
}
icon0             <kuid:-3:10164>
string-table {
  steamfill_watercoalpickup     "Water and Coal pickup"
  steamfill_coaldropoff       "Coal drop off"
}
username-de           "Dampf-Nachfüllstation"
string-table-de {
  steamfill_watercoalpickup     "Wasser und Kohle aufladen"
  steamfill_coaldropoff       "Kohle abladen"
}
username-it           "Stazione Rifornimento Vapore"
string-table-it {
  steamfill_watercoalpickup     "Raccolta acqua e carbone"
  steamfill_coaldropoff       "Scarico carbone"
}
username-es           "Estación_Abastecimiento_Vapor"
string-table-es {
  steamfill_watercoalpickup     "Recogida de agua y carbón"
  steamfill_coaldropoff       "Entrega de carbón"
}
username-pl           "Stacja obsługi parowozów"
string-table-pl {
  steamfill_watercoalpickup     "Punkt załadunku wody i węgla"
  steamfill_coaldropoff       "Punkt rozładunku węgla"
}
username-cz           "Parní depo"
string-table-cz {
  steamfill_watercoalpickup     "Nakládka vody a uhlí"
  steamfill_coaldropoff       "Vykládka uhlí"
}
username-cn           "蒸氣加油站"
string-table-cn {
  steamfill_watercoalpickup     "水和煤礦裝載"
  steamfill_coaldropoff       "煤礦卸貨"
}
username-ru           "Парозаполняющая станция"
string-table-ru {
  steamfill_watercoalpickup     "Погрузка воды и угля"
  steamfill_coaldropoff       "Выгрузка угля"
}
username-fr           "Dépôt vapeur"
string-table-fr {
  steamfill_watercoalpickup                                                      "Charge d'eau et de charbon"
  steamfill_coaldropoff                                                              "Décharge de charbon"
}

steam_filling_station.gs:

include "BaseIndustry.gs"

//
// Refinery industry
//
class steam_filling_station isclass BaseIndustry
{
  ProductQueue coalInOutQueue, waterOutQueue;
  //bool animating = false;
  //bool processing = false;
  bool scriptletEnabled = true;

  // Track if they only supply some of the logs that were requested in the waybill.
  int coalWBRemain = 0;

  bool TriggerSupportsMovingLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
      if (triggerName == "in_load0")
        return true;

    return false;
  }

  void PerformMovingLoad(Vehicle vehicle, string triggerName)
  {
    //
    // OUTPUT trigger - load
    //
    float speed = vehicle.GetVelocity();

    if (speed > -5.0f and speed < 5.0f)
    {
      int coalAvailable = coalInOutQueue.GetQueueSpace();
      LoadingReport report = CreateUnloadingReport(coalInOutQueue, coalAvailable);

      vehicle.UnloadProduct(report);
    }
  }

  //
  //
  //

  bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
  {
    if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.LOAD_COMMAND))
      if (triggerName == "out_load0")
        return true;

    return false;
  }

  void PerformStoppedLoad(Vehicle vehicle, string triggerName)
  {
    //
    // Load the coal
    //
    int spaceAvailable = coalInOutQueue.GetQueueCount();
    LoadingReport report = CreateLoadingReport(coalInOutQueue, spaceAvailable);

    int direction = vehicle.GetRelationToTrack(me, "out_track0");
    if (direction == Vehicle.DIRECTION_FORWARD)
      report.sideFlags = LoadingReport.RIGHT_SIDE;
    else if (direction == Vehicle.DIRECTION_BACKWARD)
      report.sideFlags = LoadingReport.LEFT_SIDE;

    vehicle.LoadProduct(report);

    // Ensure we are tracking this if we are waiting for a way bill to complete in its entirety
    if (coalWBRemain > 0)
      coalWBRemain = coalWBRemain - report.amount;

    // Load the water
    spaceAvailable = waterOutQueue.GetQueueCount();
    report = CreateLoadingReport(waterOutQueue, spaceAvailable);

    direction = vehicle.GetRelationToTrack(me, "out_track0");
    if (direction == Vehicle.DIRECTION_FORWARD)
      report.sideFlags = LoadingReport.RIGHT_SIDE;
    else if (direction == Vehicle.DIRECTION_BACKWARD)
      report.sideFlags = LoadingReport.LEFT_SIDE;

    vehicle.LoadProduct(report);

  }

  //
  //
  //
  thread void SteamFillingMain(void)
  {
    Message msg;
    Vehicle vehicle;
    string triggerName;

    //Interface.Print("Start of refinery thread!");

    wait()
    {
      // ?
      on "Scriptlet-Enabled", "1":
      {
        if (!scriptletEnabled)
        {
          scriptletEnabled = true;
          SetProcessEnabled("water_gathering", true);
        }
        continue;
      }
      // ?
      on "Scriptlet-Enabled", "0":
      {
        if (scriptletEnabled)
        {
          scriptletEnabled = false;
          SetProcessEnabled("water_gathering", false);
        }
        continue;
      }

    }
  }

  //
  //
  //
  public void Init(void)
  {
    inherited();

    usePipeAnimation = true;
    useGenericViewDetails = true;

    // Use a different animation mesh than the standard pipe
    pipeName = "tender";

    // initialize queues
    coalInOutQueue = GetQueue("coal_in_out");
    waterOutQueue = GetQueue("water_out");

    AddAssetToIndustryProductInfo("coal", "coal_in_out", "water_gathering", true, false);
    AddAssetToIndustryProductInfo("coal", "coal_in_out", "water_gathering", false);
    AddAssetToIndustryProductInfo("water", "water_out", "water_gathering", false);

    SteamFillingMain();

  }

  public Requirement[] GetRequirements(void)
  {
    Requirement[] ret = new Requirement[0];

    if (coalInOutQueue.GetQueueCount() < 30000 or coalWBRemain > 0)
    {
      ResourceRequirement req = new ResourceRequirement();

      req.resource = coalInOutQueue.GetProductFilter().GetProducts()[0];

      // This is how many we have asked for. Wait till it is fullfilled,
      // if we are not already waiting for a waybill to be completed.
      req.amount = 150000;
      if (coalInOutQueue.GetQueueCount() < 30000 and coalWBRemain == 0)
        coalWBRemain = 150000;

      req.dst = me;
      req.dstQueue = coalInOutQueue;

      ret[ret.size()] = req;
    }

    return ret;
  }

  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("steamFill_waterCoalPickup");
    destTracks[destTracks.size()] = "out_track0";

    destNames[destNames.size()] = stringTable.GetString("steamFill_coalDropoff");
    destTracks[destTracks.size()] = "in_track0";
  }

};


Interiors
[Asset Source]

Interiors

  • Bigsteam
  • DD40
  • PB15


Bigsteam
[Interiors]

Bigsteam Interior

config.txt:

﻿kind interior
camera -1.2, .8, 0.0
kuid <KUID:523:55901>
category-era-0 1930
category-region-0 Au
category-class ZI

cameralist

{
  camera0 -1.4, 0.6, 0.3
  camera1 -1.4, .3, 0.3
  camera2 0.0, 1.3, 0.3
  camera3 1.4, .3, 0.3
  camera4 1.4, 0.6, 0.3
}

cameradefault 0

script "Bigsteam_Interior"
class "Bigsteam_Interior"

mesh-table
{
    default {
        mesh Bigsteam_Interior.im
        auto-create 1
      }
       regulator {
    kind lever
    mesh regulator/regulator.im
    att a.regulator
        att-parent default
        auto-create 1
    limits 0, 1
    angles 0.24, -0.24
    radius 0.35
    mousespeed -1
    mousemode exact
    }
       trainbrakelap_lever {
    kind lever
    mesh trainbrake_lever.pm
    att a.trainbrake_lever
    limits 0, 4
    angles 2.5, 0
    notches 0, 0.25, 0.5, 0.75, 1.0
    notchheight 1, 1, 1, 1, 1
    mousespeed -1
        att-parent default
        auto-create 1
          }
  independantbrake_lever {
    kind lever
    mesh independant.pm
    att a.loco_brake_lever
    limits 0,32
    angles 0.94,0
    notches 0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1
    notchheight 1,2,2,2,2,2,2,2,2,2,1
    radius 0.15
    mousespeed -1
        att-parent default
        auto-create 1
    }
  reverser {
    mesh reverser/reverser.im
    anim reverser/reverser.kin
    auto-create 1
    kind animated-lever
    test-collisions 0
    limits -1.0, 1.0
    mousespeed 2
    }
  reverser-collision-box {
    mesh reverser/selection_box/selection_box.im
    att-parent reverser
    att a.selection_box
    auto-create 1
    kind collision-proxy
    opacity 0
    collision-parent reverser
    }
  speedo_needle {
    kind needle
    mesh speedo_needle.pm
    att a.speedo
    limits 0, 45
        att-parent default
        auto-create 1
    }
  bptrainbrakepipe_needle {
    kind needle
    mesh trainpipe_needle.pm
    att a.trainbrake_needle
    limits 0, 700
        att-parent default
        auto-create 1
    }
  bptrainbrakecylinder_needle {
    kind needle
    mesh locobrake_needle.pm
    att a.locobrake_needle
    limits 0, 600
        att-parent default
        auto-create 1
    }
  bplocomain_needle {
    kind needle
    mesh flow_needle.pm
    att a.mainres_needle
    limits 0,1000
        att-parent default
        auto-create 1
    }
  bploco_equaliser {
    kind needle
    mesh mainres_needle.pm
    att a.aux_needle
    limits 0,1000
        att-parent default
        auto-create 1
          }
    water_valve0 {
        mesh water_valve/water_valve.im
        auto-create 1
        att a.water_valve0
        att-parent default
    kind lever
      }
    water_valve1 {
        mesh water_valve/water_valve.im
        auto-create 1
        att a.water_valve1
        att-parent default
    kind lever
      }
    water_valve2 {
        mesh water_valve/water_valve.im
        auto-create 1
        att a.water_valve2
        att-parent default
    kind lever
      }
    water_valve3 {
        mesh water_valve/water_valve.im
        auto-create 1
        att a.water_valve3
        att-parent default
    kind lever
      }
    water_valve4 {
        mesh water_valve/water_valve.im
        auto-create 1
        att a.water_valve4
        att-parent default
    kind lever
      }
    water_valve5 {
        mesh water_valve/water_valve.im
        auto-create 1
        att a.water_valve5
        att-parent default
    kind lever
      }
    sanding_lever {
        kind lever
        mesh sanding_lever/sanding_lever.pm
        auto-create 1
        limits 0, 4
        angles 0, 0.2
        att a.sanding_lever
        att-parent default
    mousespeed -1.0
      }
    boiler_needle {
        kind needle
        mesh boiler_needle.pm
        att a.boiler_pressure
        limits 0, 1000
        auto-create 1
        att-parent default
      }
  horn {
    kind pullrope
    mesh whistle.pm
    att a.whistle
    limits 0,1
    angles 0.1,0
    notches 0, 1
    notchheight 0,0
    mousespeed -1
        att-parent default
        auto-create 1
          }
    fire_plates {
        mesh fireplates/fireplates.im
        anim fireplates/fireplates.kin
        auto-create 1
    kind animated-lever
    test-collisions 0
    notches 0,0.5,1.0
    notchheight 1,1,1
    limits 0, 1.0
      }
  fire_plates-collision-box {
    mesh fireplates/selection_box/selection_box.im
    att-parent fire_plates
    att a.selection_box
    auto-create 1
    kind collision-proxy
    opacity 0
    collision-parent fire_plates
    }
    waterglass_right {
        mesh waterglass_right.im
        anim waterglass_right.kin
        auto-create 1
    limits 0, 100
    kind animated-dial
      }
    waterglass_left {
        mesh waterglass_left.im
        anim waterglass_left.kin
        auto-create 1
    limits 0, 100
    kind animated-dial
    }
    firebox {
    kind firebox
        mesh firebox.im
        auto-create 1
        att a.origin
        att-parent default
    test-collisions 0
                }
    fire {
        mesh fire.im
        auto-create 1
    light 0
    test-collisions 0
      }
    coal {
        mesh coal.im
        auto-create 1
    light 0
    test-collisions 0
      }
  fireglow {
        mesh fireglow.im
        auto-create 1
        light 0
    test-collisions 0
      }
    blowdown {
        kind lever
        mesh blowdown/blowdown.im
        auto-create 1
        limits 0, 4
        angles 0, 0.01
        att a.blowdown
        att-parent default
    mousespeed -1.0
    }
    water_injector_0 {
        mesh injector_handle/injector_handle.im
        auto-create 1
        att a.injector_1
        att-parent default
    kind lever
    mousemode exact
      }
    water_injector_1 {
        mesh injector_handle/injector_handle.im
        auto-create 1
        att a.injector_0
        att-parent default
    kind lever
    mousemode exact
      }
    boiler_needle {
        kind needle
        mesh boiler_needle/boiler_needle.im
        att a.boiler_pressure1
        limits 0, 2360
        att-parent default
        auto-create 1
      }
    boiler_needle1 {
        kind needle
        mesh trainpipe_needle.pm
        att a.boiler_pressure2
        limits 0, 2360
        att-parent default
        auto-create 1
      }
      _ {
        mesh water_handle/water_handle.im
        auto-create 1
        att a.water_handle1
        att-parent default
    kind lever
    mousemode exact
    limits 0, 1
    angles 0, -0.48
    mousespeed -1
      }
      __ {
        mesh water_handle/water_handle.im
        auto-create 1
        att a.water_handle2
        att-parent default
    kind lever
    mousemode exact
    limits 0, 1
    angles 0, -0.48
    mousespeed -1
      }
      ___ {
        mesh water_handle/water_handle.im
        auto-create 1
        att a.water_handle3
        att-parent default
    kind lever
    mousemode exact
    limits 0, 1
    angles 0, -0.48
    mousespeed -1
      }
      ____ {
        mesh water_handle/water_handle.im
        auto-create 1
        att a.water_handle4
        att-parent default
    kind lever
    mousemode exact
    limits 0, 1
    angles 0, -0.48
      }
      _____ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap1
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ______ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap2
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _______ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap3
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap4
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap5
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      __________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap6
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ___________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap7
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ____________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap8
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _____________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap9
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ______________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap10
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _______________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap11
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap12
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap13
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      __________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap14
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ___________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap15
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ____________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap16
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _____________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap17
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ______________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap18
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _______________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap19
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ________________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap20
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _________________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap21
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      __________________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap22
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ___________________________ {
        mesh water_valve/valve.im
        auto-create 1
        att a.tap23
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ____________________________ {
        mesh handle.im
        auto-create 1
        att a.handle1
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _____________________________ {
        mesh handle.im
        auto-create 1
        att a.handle2
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ______________________________ {
        mesh handle.im
        auto-create 1
        att a.handle3
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _______________________________ {
        mesh handle.im
        auto-create 1
        att a.handle4
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      ________________________________ {
        mesh handle2.im
        auto-create 1
        att a.handle5
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      _________________________________ {
        mesh water_valve/water_valve.im
        auto-create 1
        att a.blower_1
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }
      blower {
        mesh water_valve/water_valve.im
        auto-create 1
        att a.blower_0
        att-parent default
    kind lever
    mousemode exact
    mousespeed-1
      }

}

Bigsteam_Interior.gs:

include "DefaultSteamCabin.gs"

class Bigsteam_Interior isclass DefaultSteamCabin
{
  public void Init(void)
  {
    inherited();

    hasAnimatedFireman = false;
  }
};


DD40
[Interiors]

DD40 Interior

config.txt:

kind interior
camera -1.058, 0.522, 0.887

script "DD40Cabin"
class "DD40Cabin"

kuid <KUID:-3:10085>

cameralist
{
  camera0 -0.564, 0.984, 0.987, 13.528, -0.137
  camera1 0.707, -0.333, 1.023, -6.189, -0.049
  camera2 1.317, 0.949, 1.023, -13.501, -0.122
  camera3 -1.058, 0.522, 0.887, 0.1, -0.089
  camera4 -1.382, 0.78, 0.987, 6.592, -0.194
  camera5 -1.361, 0.923, 1.137, 6.902, -0.503
  camera6 -0.618, 0.715, 1.023, -0.983, -0.234
}
cameradefault 3

mesh-table
{
  default
  {
    mesh gen_dd40_int.im
    auto-create 1
  }

Fan_Switch {
kind lever
auto-create 1
mesh switch_red.im
att a.switch0
limits 0, 1
angles 0, -2
notches 0, 1
notchheight 0, 0
mousespeed -1
radius 0.05
onlight switchlight0
    att-parent default
}
switchlight0 {
kind light
mesh switchlight.pm
att a.switch0
    auto-create 0
    att-parent default
}
Wiper_Switch {
kind lever
auto-create 1
mesh switch_red.im
att a.switch1
limits 0, 1
angles 0, -2
notches 0, 1
notchheight 0, 0
mousespeed -1
radius 0.05
onlight switchlight1
    att-parent default
}
switchlight1 {
kind light
mesh switchlight.pm
att a.switch1
    auto-create 0
    att-parent default
}
Switch_3 {
kind lever
auto-create 1
mesh switch.pm
att a.switch2
limits 0, 1
angles 0, -2
notches 0, 1
notchheight 0, 0
mousespeed -1
radius 0.05
onlight switchlight2
    att-parent default

}
switchlight2 {
kind light
mesh switchlight.pm
att a.switch2
    auto-create 0
    att-parent default
}
Switch_4 {
kind lever
auto-create 1
mesh switch.pm
att a.switch3
limits 0, 1
angles 0, -2
notches 0, 1
notchheight 0, 0
mousespeed -1
radius 0.05
onlight switchlight3
    att-parent default
}
switchlight3 {
kind light
mesh switchlight.pm
att a.switch3
    auto-create 0
    att-parent default
}
Switch_5 {
kind lever
auto-create 1
mesh switch.pm
att a.switch4
limits 0, 1
angles 0, -2
notches 0, 1
notchheight 0, 0
mousespeed -1
radius 0.05
onlight switchlight4
    att-parent default
}
switchlight4 {
kind light
mesh switchlight.pm
att a.switch4
    auto-create 0
    att-parent default
}
Switch_6 {
kind lever
auto-create 1
mesh switch.pm
att a.switch5
limits 0, 1
angles 0, -2
notches 0, 1
notchheight 0, 0
mousespeed -1
radius 0.05
onlight switchlight5
    att-parent default
}
switchlight5 {
kind light
mesh switchlight.pm
att a.switch5
    auto-create 0
    att-parent default
}
Switch_7 {
kind lever
auto-create 1
mesh switch.pm
att a.switch6
limits 0, 1
angles 0, -2
notches 0, 1
notchheight 0, 0
mousespeed -1
radius 0.05
onlight switchlight6
    att-parent default
}
switchlight6 {
kind light
mesh switchlight.pm
att a.switch6
    auto-create 0
    att-parent default
}
Switch_8 {
kind lever
auto-create 1
mesh switch.pm
att a.switch7
limits 0, 1
angles 0, -2
notches 0, 1
notchheight 0, 0
mousespeed -1
radius 0.05
onlight switchlight7
    att-parent default
}
switchlight7 {
kind light
mesh switchlight.pm
att a.switch7
    auto-create 0
    att-parent default
}
reverser_lever {
kind lever
auto-create 1
mesh reverser_lever.pm
att a.reverser_lever
limits 0, 2
angles 0.55, -0.55
notches 0, 0.5, 1
notchheight 1, 1, 1
    att-parent default
}
independantbrake_lever {
kind lever
auto-create 1
mesh ind_brake_lever.pm
att a.ind_brake_lever
limits 0, 32
angles 0, -2.1
notches 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1
notchheight 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
radius 0.15
    att-parent default
}
trainbrake_lever {
kind lever
auto-create 1
mesh train_brake_lever.pm
att a.train_brake_lever
limits 0, 4
angles 0, -2.4
notches 0, 0.25, 0.27, 0.29, 0.31, 0.33, 0.35, 0.37, 0.39, 0.41, 0.43, 0.45, 0.47, 0.49, 0.5, 0.75, 1
notchheight 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1
radius 0.15
    att-parent default
}
throttle_lever {
kind lever
auto-create 1
mesh throttle_lever.pm
att a.thottle_lever
limits 0, 8
angles 1.2, 0
notches 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1
notchheight 1, 2, 2, 2, 2, 2, 2, 2, 1
radius 0.35
    att-parent default
}
dynamicbrake_lever {
kind lever
auto-create 1
mesh dynamic_lever.pm
att a.dynamic_brake
limits 0, 2
angles 0, -1.2
notches 0, 0.5, 1
notchheight 1, 1, 1
radius 0.35
    att-parent default
}
light_switch {
kind lever
auto-create 1
att a.light_switch
mesh dial.pm
limits 0, 1
angles 0, 4.5
notches 0, 0.5, 1
notchheight 0, 0, 0
    att-parent default
}
ampmeter_needle {
kind needle
auto-create 1
mesh ampmeter_needle.pm
att a.ammeter
limits 0, 1500
angles 0, 1.9
    att-parent default
}
bploco_equaliser {
kind needle
auto-create 1
mesh whitepress_needle.pm
att a.equaliser_pressure
limits 0, 1000
    att-parent default
}
bplocomain_needle {
kind needle
auto-create 1
mesh redpress_needle.pm
att a.main_res_pressure
limits 0, 1000
    att-parent default
}
bptrainbrakecylinder_needle {
kind needle
auto-create 1
mesh redpress_needle.pm
att a.brake_cyl_pressure
limits 0, 1000
    att-parent default
}
bptrainbrakepipe_needle {
kind needle
auto-create 1
mesh whitepress_needle.pm
att a.brake_pipe_pressure
limits 0, 1000
    att-parent default
}
speedo_needle {
kind needle
auto-create 1
mesh whitepress_needle.pm
att a.speedo
limits 0, 48
    att-parent default
}
horn {
kind lever
auto-create 1
mesh horn.pm
att a.horn
limits 0, 1
angles 0, -0.6
notches 0, 1
notchheight 3, 3
radius 0.16
mousespeed -2
    att-parent default
}
wheelslip_light {
kind light
auto-create 0
mesh wheelslip.pm
}

swivel_chair {
kind lever
auto-create 1
mesh chair.im
att a.chair1
limits 0, 8
angles 6.8, -6.8
radius 0.5
mousespeed 0.2
    att-parent default
}

dial0 {
kind lever
auto-create 1
att a.dial0
mesh dial.pm
limits 0, 1
angles 0, 3.8
notches 0, 1
notchheight 0, 0
    att-parent default
}
dial1 {
kind lever
auto-create 1
att a.dial1
mesh dial.pm
limits 0, 1
angles 0, 3.8
notches 0, 1
notchheight 0, 0
    att-parent default
}
fan
  {
   mesh fan.im
   anim fan.kin
   auto-create 1
   att a.fan
   att-parent default
   }
visor0
  {
   mesh visor.im
   auto-create 1
   att a.visor0
   att-parent default
   kind lever
   mousespeed -1
   limits 0, 1
   angles 0, 1.7
   notches 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1
   notchheight 0, 0, 0, 0, 0, 0, 0, 0, 0
   }
visor1
  {
   mesh visor.im
   auto-create 1
   att a.visor1
   att-parent default
   kind lever
   mousespeed -1
   limits 0, 1
   angles 0, 1.7
   notches 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1
   notchheight 0, 0, 0, 0, 0, 0, 0, 0, 0
   }
sl_wind_R_Fr
  {
    mesh sliding_wind_R_Fr.im
    auto-create 1
    att a.sliding_wind_R_Fr
    att-parent default
    limits 0, 1.0
    angles 0, 0.011
   notches 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1
   notchheight 0, 0, 0, 0, 0, 0, 0, 0, 0
  kind lever
  }
sl_wind_R_Bk
  {
    mesh sliding_wind_R_Bk.im
    auto-create 1
    att a.sliding_wind_R_Bk
    att-parent default
    limits 0, 1.0
    angles 0, -0.011
   notches 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1
   notchheight 0, 0, 0, 0, 0, 0, 0, 0, 0
    mousespeed -1
  kind lever
  }
sl_wind_L_Fr
  {
    mesh sliding_wind_L_Fr.im
    auto-create 1
    att a.sliding_wind_L_Fr
    att-parent default
    limits 0, 1.0
    angles 0, -0.011
   notches 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1
   notchheight 0, 0, 0, 0, 0, 0, 0, 0, 0
  kind lever
  }
sl_wind_L_Bk.im
  {
    mesh sliding_wind_L_Bk.im
    auto-create 1
    att a.sliding_wind_L_Bk
    att-parent default
    limits 0, 1.0
    angles 0, 0.011
   notches 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1
   notchheight 0, 0, 0, 0, 0, 0, 0, 0, 0
    mousespeed -1
  kind lever
  }
wipers
  {
   mesh wipers.im
   anim wipers.kin
   auto-create 1
   att a.wipers
   att-parent default
   }
}

DD40Cabin.gs:

include "defaultlocomotivecabin.gs"

class DD40CabinData isclass CabinData
{
  public bool animatingFan;
  public bool animatingWiper;
  public bool switchOn3;
  public bool switchOn4;
  public bool switchOn5;
  public bool switchOn6;
  public bool switchOn7;
  public bool switchOn8;

  public ControlSettingsManager ctrlManager = new ControlSettingsManager();
};

class DD40Cabin isclass DefaultLocomotiveCabin
{
  // Switches
  CabinControl cabin_fan_switch;
  CabinControl window_wipers;
  CabinControl switch3;
  CabinControl switch4;
  CabinControl switch5;
  CabinControl switch6;
  CabinControl switch7;
  CabinControl switch8;

  // Lights
  CabinControl cabin_fan_light;
  CabinControl window_wipers_light;
  CabinControl light3;
  CabinControl light4;
  CabinControl light5;
  CabinControl light6;
  CabinControl light7;
  CabinControl light8;

  thread void SlowFanDown(void);
  thread void SpeedFanUp(void);

  void UpdateFan(void);
  void UpdateWipers(void);
  thread void RunAnimation(void);

  float fanSpeed;
  bool isFanSpeedingUp;
  bool isFanSlowingDown;

  //
  // Param:  obj  Game object to attach this cabin to (usually a Locomotive).
  //
  void Attach(GameObject obj)
  {
    inherited(obj);

    // get cabin data
    CabinData cd = loco.GetCabinData();
    if(cd)
    {
      // reset the controls from saved values
      DD40CabinData ddcd = cast<DD40CabinData>cd;
      float value = 0.0;

      // ANIMATING FAN
      if (ddcd.animatingFan)
      {
        fanSpeed = 1.0;
        SetMeshAnimationSpeed("fan", 1.0);
        StartMeshAnimationLoop("fan");
        value = 1.0;
      }
      else
        value = 0.0;

      cabin_fan_switch.SetValue(value);
      cabin_fan_light.SetValue(value);

      // ANIMATING WIPER
      if (ddcd.animatingWiper)
      {
        value = 1.0;
        SetMeshAnimationSpeed("wipers", 1.0);
        StartMeshAnimationLoop("wipers");
      }
      else
        value = 0.0;

      window_wipers.SetValue(value);
      window_wipers_light.SetValue(value);

      // SWITCH 3
      if (ddcd.switchOn3)
        value = 1.0;
      else
        value = 0.0;
      switch3.SetValue(value);
      light3.SetValue(value);

      // SWITCH 4
      if (ddcd.switchOn4)
        value = 1.0;
      else
        value = 0.0;

      switch4.SetValue(value);
      light4.SetValue(value);

      // SWITCH 5
      if (ddcd.switchOn5)
        value = 1.0;
      else
        value = 0.0;

      switch5.SetValue(value);
      light5.SetValue(value);

      // SWITCH 6
      if (ddcd.switchOn6)
        value = 1.0;
      else
        value = 0.0;

      switch6.SetValue(value);
      light6.SetValue(value);

      // SWITCH 7
      if (ddcd.switchOn7)
        value = 1.0;
      else
        value = 0.0;

      switch7.SetValue(value);
      light7.SetValue(value);

      // SWITCH 8
      if (ddcd.switchOn8)
        value = 1.0;
      else
        value = 0.0;

      switch8.SetValue(value);
      light8.SetValue(value);

      // restore saved value settings from the cabin data
      ddcd.ctrlManager.UpdateCabin(me);
    }
    else
    {
      DD40CabinData ddd = new DD40CabinData();
      loco.SetCabinData(ddd);
    }
  }

  void UserPressKey(string s)
  {
    if (s == "cabin-fans")
    {
      DD40CabinData cd = cast<DD40CabinData>loco.GetCabinData();
      cd.animatingFan = !cd.animatingFan;

      float value;
      if (cd.animatingFan)
        value = 1.0;
      else
        value = 0.0;

      cabin_fan_switch.SetValue(value);
      cabin_fan_light.SetValue(value);

      UpdateFan();
    }

    else if (s == "wipers")
    {
      DD40CabinData cd = cast<DD40CabinData>loco.GetCabinData();
      cd.animatingWiper = !cd.animatingWiper;

      float value;
      if (cd.animatingWiper)
        value = 1.0;
      else
        value = 0.0;

      window_wipers.SetValue(value);
      window_wipers_light.SetValue(value);

      UpdateWipers();
    }

    else
      inherited(s);
  }

  public void Init(void)
  {
    inherited();

    cabin_fan_switch = GetNamedControl("fan_switch");
    window_wipers = GetNamedControl("wiper_switch");
    switch3 = GetNamedControl("switch_3");
    switch4 = GetNamedControl("switch_4");
    switch5 = GetNamedControl("switch_5");
    switch6 = GetNamedControl("switch_6");
    switch7 = GetNamedControl("switch_7");
    switch8 = GetNamedControl("switch_8");

    cabin_fan_light = GetNamedControl("switchlight0");
    window_wipers_light = GetNamedControl("switchlight1");
    light3 = GetNamedControl("switchlight2");
    light4 = GetNamedControl("switchlight3");
    light5 = GetNamedControl("switchlight4");
    light6 = GetNamedControl("switchlight5");
    light7 = GetNamedControl("switchlight6");
    light8 = GetNamedControl("switchlight7");

    RunAnimation();

  }

  void UserSetControl(CabinControl p_control, float p_value)
  {
    DD40CabinData cd = cast<DD40CabinData>loco.GetCabinData();

    if (p_control == cabin_fan_switch)
    {
      bool wantFanAnimation = p_value > 0.5;
      if (wantFanAnimation != cd.animatingFan)
      {
        cd.animatingFan = wantFanAnimation;
        UpdateFan();
      }

      if (wantFanAnimation)
        cabin_fan_light.SetValue(1.0);
      else
        cabin_fan_light.SetValue(0.0);
    }

    else if (p_control == window_wipers)
    {
      bool wantWiperAnimation = p_value > 0.5;
      if (wantWiperAnimation != cd.animatingWiper)
      {
        cd.animatingWiper = wantWiperAnimation;
        UpdateWipers();
      }

      if (wantWiperAnimation)
        window_wipers_light.SetValue(1.0);
      else
        window_wipers_light.SetValue(0.0);

    }

    else if (p_control == switch3)
    {
      bool isOn = p_value > 0.5;
      float value = 0.0;
      if (isOn)
        value = 1.0;

      light3.SetValue(value);
      cd.switchOn3 = value;
    }

    else if (p_control == switch4)
    {
      bool isOn = p_value > 0.5;
      float value = 0.0;
      if (isOn)
        value = 1.0;

      light4.SetValue(value);
      cd.switchOn4 = value;
    }

    else if (p_control == switch5)
    {
      bool isOn = p_value > 0.5;
      float value = 0.0;
      if (isOn)
        value = 1.0;

      light5.SetValue(value);
      cd.switchOn5 = value;
    }

    else if (p_control == switch6)
    {
      bool isOn = p_value > 0.5;
      float value = 0.0;
      if (isOn)
        value = 1.0;

      light6.SetValue(value);
      cd.switchOn6 = value;
    }

    else if (p_control == switch7)
    {
      bool isOn = p_value > 0.5;
      float value = 0.0;
      if (isOn)
        value = 1.0;

      light7.SetValue(value);
      cd.switchOn7 = value;
    }

    else if (p_control == switch8)
    {
      bool isOn = p_value > 0.5;
      float value = 0.0;
      if (isOn)
        value = 1.0;

      light8.SetValue(value);
      cd.switchOn8 = value;
    }

    // other control, save it to cabin data so it can be restored when cabin is reconstructed
    else
    {
//      DefaultSteamCabinData dscd = cast<DefaultSteamCabinData>loco.GetCabinData();
//      dd40scd.ctrlManager.AddControl(p_control.GetName(), p_value);
      cd.ctrlManager.AddControl(p_control.GetName(), p_value);
      inherited(p_control, p_value);
    }

  }

  thread void SlowFanDown(void)
  {
    DD40CabinData cd = cast<DD40CabinData>loco.GetCabinData();

    if (isFanSlowingDown)
      return;

    isFanSlowingDown = true;
    isFanSpeedingUp = false;

    // Slow it down...
    while (fanSpeed > 0.1)
    {
      fanSpeed = fanSpeed - 0.1;
      SetMeshAnimationSpeed("fan", fanSpeed);

      Sleep(0.5);
      if (!isFanSlowingDown)
        return;
    }

    fanSpeed = 0.0;
    StopMeshAnimation("fan");
  }

  thread void SpeedFanUp(void)
  {
    DD40CabinData cd = cast<DD40CabinData>loco.GetCabinData();

    if (isFanSpeedingUp)
      return;

    isFanSpeedingUp = true;
    isFanSlowingDown = false;

    // Speed it up...
    while (fanSpeed < 1.0)
    {
      fanSpeed = fanSpeed + 0.1;
      SetMeshAnimationSpeed("fan", fanSpeed);
      StartMeshAnimationLoop("fan");

      Sleep(0.5);
      if (!isFanSpeedingUp)
        return;
    }

    fanSpeed = 1.0;
    SetMeshAnimationSpeed("fan", fanSpeed);
    //isFanSpeedingUp = false;
  }

  void UpdateFan(void)
  {
    DD40CabinData cd = cast<DD40CabinData>loco.GetCabinData();

    if (cd.animatingFan)
      SpeedFanUp();
    else
      SlowFanDown();
  }

  void UpdateWipers(void)
  {
    DD40CabinData cd = cast<DD40CabinData>loco.GetCabinData();

    // Don't need to worry about else, as it will be handled when the loop is done.
    if (cd.animatingWiper)
    {
      SetMeshAnimationSpeed("wipers", 1.0);
      StartMeshAnimationLoop("wipers");
    }
  }

  thread void RunAnimation(void)
  {
    DD40CabinData cd = cast<DD40CabinData>loco.GetCabinData();

    wait()
    {
      on "Animation-Event", "wiperstop":
        if (!cd.animatingWiper)
          StopMeshAnimation("wipers");
      continue;
    }

  }

};


PB15
[Interiors]

PB15 Interior

config.txt:

kuid <KUID:-3:10191>
kind interior

script "pb15cabin"
class "PB15Cabin"

camera -0.769, 0.566, 0.617
cameralist
{
  camera0 0.817, 0.026, 0.654, 0.026, -0.146
  camera1 -0.808, 0.474, 0.694, 0.214, -0.773
  camera2 -1.429, 0.461, 0.617, 0.162, -0.075
  camera3 -0.769, 0.566, 0.617,0.157, -0.125
  camera4 0.703, 0.831, 0.694, -0.715, -0.561
  camera5 1.344, 0.305, 0.617, -0.015, -0.049
}
cameradefault 3

obsolete-table
{
0 <KUID:44179:55003>
}

soundscript
{
  coal_on
  {
    trigger coal_on
  attachment a.coalman
  ambient 1
  nostartdelay 1
    repeat-delay 0,0.001
    distance 5,200
    sound
    {
      sound/coal_shovel2.wav
    }
  }
  shovel_againstmetal
  {
    trigger shovel_againstmetal
  attachment a.coalman
  ambient 1
  nostartdelay 1
    repeat-delay 0,0.001
    distance 5,200
    sound
    {
      sound/shovel_hit.wav
    }
  }
  step_metal
  {
    trigger step_metal
  attachment a.coalman
  ambient 1
  nostartdelay 1
    repeat-delay 0,0.001
    distance 5,200
    sound
    {
      sound/metal_footstep_left.wav
    }
  }
  coal_off
  {
    trigger coal_off
  attachment a.coalman
  ambient 1
  nostartdelay 1
    repeat-delay 0,0.001
    distance 5,200
    sound
    {
    sound/coal_into_firebox1.wav
    }
  }
}

mesh-table
{
  default
  {
    mesh PB_interior_main.im
    auto-create 1
  }

  trainbrakelap_lever
  {
    mesh brake_lever/brake_lever.im
    auto-create 1
    att a.brake
    limits 0, 4
    angles 0.35, -0.75
  notches 0, 0.25, 0.5, 0.75, 1.0
  notchheight 1, 1, 1, 1, 1
  mousespeed -1
    radius 0.16
    att-parent default
    kind lever
  }

  left_window
  {
    mesh window_sides.im
    auto-create 1
    limits 0, 1.0
    angles 0, -1
    notches 0, 1.0
    notchheight 1,1
    att a.window_l
    att-parent default
  kind lever
  }

  right_window
  {
    mesh window_sides.im
    auto-create 1
    att a.window_r
    att-parent default
    limits 0, 1.0
    angles 0, -1
    notches 0, 1.0
    notchheight 1,1
  kind lever
  }

  left_sliding_window
  {
    mesh window_sliding.im
    auto-create 1
    att a.windowsliding_l
    att-parent default
    limits 0, 1.0
    angles 0, -0.009
    notches 0, 1.0
    notchheight 1,1
  kind lever
  }

  right_sliding_window
  {
    mesh window_sliding.im
    auto-create 1
    att a.windowsliding_r
    att-parent default
    limits 0, 1
    angles 0, -0.009
    notches 0, 1.0
    notchheight 1,1
  kind lever
  }

  cylinder_drain
  {
    limits 0,4
    angles 0,-0.3
    mesh cylinder_clean/cylinder_clean.im
    auto-create 1
    limits 0, 1.0
  notches 0, 1.0
  notchheight 1, 1
    att a.cylinderclean
    att-parent default
    kind lever
  }

  regulator
  {
    mesh regulator/regulator.im
    anim regulator/regulator.kin
    auto-create 1
    att a.regulator
    limits 0, 1.0
  x-notches 0, 0.25, 0.5, 0.75, 1.0
  x-notchheight 1, 1, 1, 1, 1
  att-parent default
    kind animated-lever
    test-collisions 0
    mousespeed -1.0
  }

  regulator-collision-box
  {
    mesh regulator/selection_box/selection_box.im
    att-parent regulator
    att a.selection_box
    auto-create 1
    kind collision-proxy
    opacity 0
    collision-parent regulator
  }

  seat0
  {
    mesh seat/seat.im
    anim seat/seat.kin
    auto-create 1
    limits 0, 1.0
  notches 0, 1.0
  notchheight 1, 1
    att a.seat0
    att-parent default
  kind animated-lever
  test-collisions 0
  }

  seat0-collision-box
  {
    mesh seat/selection_box/selection_box.im
    att-parent seat0
    att a.selection_box
    auto-create 1
    kind collision-proxy
    opacity 0
    collision-parent seat0
  }

  seat1
  {
    mesh seat/seat.im
    anim seat/seat.kin
    auto-create 1
    limits 0, 1.0
  notches 0, 1.0
  notchheight 1, 1
    att a.seat1
    att-parent default
    kind animated-lever
    test-collisions 0
  }

  seat1-collision-box
  {
    mesh seat/selection_box/selection_box.im
    att-parent seat1
    att a.selection_box
    auto-create 1
    kind collision-proxy
    opacity 0
    collision-parent seat1
  }

  water_injector_0
  {
    mesh injector/injector.im
    anim injector/injector.kin
    auto-create 1
    limits 0, 1.0
    att a.injector0
    att-parent default
    kind animated-lever
    test-collisions 0
    mousespeed -1.0
  }

  water_injector_0-collision-box
  {
    mesh injector/selection_box/selection_box.im
    att-parent water_injector_0
    att a.selection_box
    auto-create 1
    kind collision-proxy
    opacity 0
    collision-parent water_injector_0
  }

  water_injector_1
  {
    mesh injector/injector.im
    anim injector/injector.kin
    auto-create 1
    limits 0, 1.0
    att a.injector1
    att-parent default
    kind animated-lever
    test-collisions 0
    mousespeed -1.0
  }

  water_injector_1-collision-box
  {
    mesh injector/selection_box/selection_box.im
    att-parent water_injector_1
    att a.selection_box
    auto-create 1
    kind collision-proxy
    opacity 0
    collision-parent water_injector_1
  }

  fire_plates
  {
    mesh fireplates/fireplates.im
    anim fireplates/fireplates.kin
    auto-create 1
  kind animated-lever
  test-collisions 0
  notches 0, 1.0
  notchheight 1,1
  limits 0, 1.0
  }

  fire_plates-collision-box
  {
    mesh fireplates/selection_box/selection_box.im
    att-parent fire_plates
    att a.selection_box
    auto-create 1
    kind collision-proxy
    opacity 0
    collision-parent fire_plates
  }

  water_valve0
  {
    mesh water_valve/water_valve.im
    auto-create 1
    att a.water_valve0
    att-parent default
    kind lever
  }

  water_valve1
  {
    mesh water_valve/water_valve.im
    auto-create 1
    att a.water_valve1
    att-parent default
    kind lever
  }

  water_valve2
  {
    mesh water_valve/water_valve.im
    auto-create 1
    att a.water_valve2
    att-parent default
    kind lever
  }

  water_valve3
  {
    mesh water_valve/water_valve.im
    auto-create 1
    att a.water_valve3
    att-parent default
    kind lever
  }

  water_valve4
  {
    mesh water_valve/water_valve.im
    auto-create 1
    att a.water_valve4
    att-parent default
    kind lever
  }

  water_valve5
  {
    mesh water_valve/water_valve.im
    auto-create 1
    att a.water_valve5
    att-parent default
    kind lever
  }

  blower {
    mesh blower.im
    auto-create 1
    att a.blower
    att-parent default
    kind lever
    mousemode exact
  }

  blowdown
  {
    kind lever
    mesh blowdown/blowdown.im
    auto-create 1
    limits 0, 1.0
  notches 0, 1.0
  notchheight 1, 1
    angles 0, 0.01
    att a.blowdown
    att-parent default
    mousespeed -1.0
  }

  sanding_lever
  {
    kind lever
    mesh sanding_lever/sanding_lever.im
    auto-create 1
    limits 0, 1.0
  notches 0, 1.0
  notchheight 1, 1
    angles 0, 0.2
    att a.sanding_lever
    att-parent default
    mousespeed -1.0
  }
  whistle_lever
  {
    kind lever
    mesh whistle_lever/whistle_lever.im
    auto-create 1
    limits 0, 1.0
  notches 0, 1.0
  notchheight 1, 1
    angles 0, 0.3
    att a.whistle
    att-parent default
  }

  bplocomain_needle {
    kind needle
    mesh main_res_needle/main_res_needle.im
    auto-create 1
    att a.reservoir_press_red
    att-parent default
    limits 0, 3600
  }

  bptrainbrakepipe_needle {
    kind needle
    mesh trainline_needle_black/trainline_needle_black.im
    auto-create 1
    att a.brake_press_black
    att-parent default
    limits 0, 3600
  }

  boiler_needle {
    kind needle
    mesh boiler_needle/boiler_needle.im
    att a.boiler_pressure
    limits 0, 1570
    auto-create 1
  }

  reverser
  {
    mesh reverser/reverser.pm
    anim reverser/reverser.kin
    auto-create 1
    kind animated-lever
    test-collisions 0
    limits -1.0, 1.0
  }

  reverser-collision-box
  {
    mesh reverser/selection_box/selection_box.im
    att-parent reverser
    att a.selection_box
    auto-create 1
    kind collision-proxy
    opacity 0
    collision-parent reverser
  }
  waterglass_right
  {
    mesh waterglass_right.im
    anim waterglass_right.kin
    auto-create 1
    limits 0, 100
    kind animated-dial
  }
  waterglass_left
  {
    mesh waterglass_left.im
    anim waterglass_left.kin
    auto-create 1
    limits 0, 100
    kind animated-dial
  }
  firebox
  {
    mesh firebox.im
    auto-create 1
    kind firebox
    light 0
    test-collisions 0
  }
  fire
  {
    mesh fire.im
    auto-create 1
    light 0
    test-collisions 0
  }
  coal
  {
    mesh coal.im
    auto-create 1
    light 0
    test-collisions 0
  }
  fireglow
  {
    mesh fireglow.im
    auto-create 1
    light 0
    test-collisions 0
  }
  coalman
  {
    mesh coalman/coalman.im
    auto-create 1
    att-parent default
    att a.coalman
    effects
    {
      shovel
      {
        kind animation
        anim coalman/Coalman_shovel.kin
      }
      wave
      {
        kind animation
        anim coalman/Coalman_wave.kin
      }
      idle1
      {
        kind animation
        anim coalman/Coalman_loop1.kin
      }
      idle2
      {
        kind animation
        anim coalman/Coalman_loop2.kin
      }
      loop2shovel
      {
        kind animation
        anim coalman/Coalman_loop2shovel.kin
      }
      shovel2loop
      {
        kind animation
        anim coalman/Coalman_shovel2loop.kin
      }
      wipebrow
      {
        kind animation
        anim coalman/Coalman_wipebrow.kin
      }

    }
  }
}

PB15Cabin.gs:

include "DefaultSteamCabin.gs"

class PB15Cabin isclass DefaultSteamCabin
{
  thread void RunAnimation(void);

  public void Init(void)
  {
    inherited();

    RunAnimation();
  }

  thread void RunAnimation(void)
  {
    SetFXAnimationState("idle1", true);

    wait()
    {
      on "Animation-Event", "Coalman_loop1_end":
        SetFXAnimationState("idle1", false);
        SetFXAnimationState("idle2", true);
        continue;

      on "Animation-Event", "Coalman_loop2_end":
        SetFXAnimationState("idle2", false);
        SetFXAnimationState("idle1", true);
        continue;

      on "Animation-Event", "Coalman_loop2shovel_end":
        SetFXAnimationState("loop2shovel", false);
        SetFXAnimationState("shovel", true);
        continue;

      on "Animation-Event", "Coalman_shovel_end":
        SetFXAnimationState("shovel", false);
        SetFXAnimationState("wipebrow", true);
        continue;

      on "Animation-Event", "Coalman_wipebrow_end":
        SetFXAnimationState("wipebrow", false);
        SetFXAnimationState("shovel2loop", true);
        continue;

      on "Animation-Event", "Coalman_shovel2loop_end":
        SetFXAnimationState("shovel2loop", false);
        SetFXAnimationState("idle1", true);
        shovellingCoal = false;
        continue;

      on "Animation-Event", "Coalman_wave_end":
        SetFXAnimationState("wave", false);
        SetFXAnimationState("idle1", true);
        waving = false;
        continue;

    }
  }

};


Libraries
[Asset Source]

Libraries

  • Display HTML Pages


Display HTML Pages
[Libraries]

Display HTML Pages Library

config.txt:

﻿
kind              "library"
kuid              <kuid:-18:1245>
username            "Display HTML Pages Library"
script              "DisplayHTMLPagesLib"
class             "DisplayHTMLPagesLib"
username-fr           "Display HTML Pages Library"

DisplayHTMLPagesLib.gs:

//
// DisplayHTMLPagesLib.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "gs.gs"
include "Soup.gs"
include "Constructors.gs"
include "Library.gs"
include "Browser.gs"
include "Asset.gs"

//
// The SessionVariables interface.
//
//   You must still use World.GetLibrary(..) to access this library object.
//   The asset for this DisplayHTMLPagesLib.gs script is <kuid:-18:1245>.
//
class DisplayHTMLPagesLib isclass Library
{
  // special flags that dictate beahbvioral optiosn for an individual page
  public define int PAGE_FLAG_NONE         =  0;  // flag set empty
  public define int PAGE_FLAG_DONE_CLOSE   =  1;  // browser is to be made invisible special message when page is done and the next page is not moved along to
  public define int PAGE_FLAG_NO_DONE      =  2;  // the done button is to be omitted for the page

  // dw: the functionality for these flags is not implemented yet
  public define int PAGE_FLAG_NO_CLOSE     =  4;  // no closing of brwoser window on this page
  public define int PAGE_FLAG_NO_SCROLL    =  8;  // scrolling is not permitted for the page
  public define int PAGE_FLAG_START_HIDDEN = 16;  // page is invisble when intially loaded
  public define int PAGE_FLAG_TEMP_ONE     = 32;  // for future usage
  public define int PAGE_FLAG_TEMP_TWO     = 64;  // for future usage

  // Stuff for the sequence browser (which navigates the pages list)
  Browser  m_sequenceBrowser;
  string[] m_htmlPages     = new string[0]; // list of HTML file names in order they are to be displayed in by the seunce browser
  Asset[]  m_htmlAssets    = new Asset[0];  // asset for each HTML page in sequences (directly corresponds to m_htmlPages index)
  int[]    m_htmlPageFlags = new int[0];    // list of propertie flags for each individial page (directly corresponds to m_htmlPages index)

  int  m_pageIndex = 0;          // current page in sequence - corresponds to m_htmlPages array index
  int  m_pageListSize = 0;       // amount of pages, equal to m_htmlPages.size()
  bool m_threadRunning = false;  // is the main thread running?

  // we have these in addition to the browser's own attributes so they can be can be used to reset the
  // browser on an update cycle after being set via the library call
  bool m_closeEnabled  = true;  // closing of sequence browser allowed?
  bool m_scrollEnabled = true;  // scrolling of sequence browser window allowed?
  bool m_windowVisible = true;  // is the sequence browser currently visible?

  int m_sizeWidth, m_sizeHeight; // width and height of the sequence browser window in pixels
  int m_posLeft, m_posTop;       // (x,y) position of the top left corner of the sequence browser window in pixel coordinates

  // progressive navigation stuff
  bool m_progressiveNext = false; // do we allow next button to be used only if the page has already neem visited (via 'done') before?
  int  m_highestVisited  = 0;     // records the furtherest most visited page index

  // Message box stuff, completely seperate from the browser sequence
  // Note: As an alternative, if the msgBox asset is null, simply use contents of this string as the page
  Browser m_msgBoxBrowser;
  Asset   m_msgBoxPageAsset;
  string  m_msgBoxPageName;

  // show/hide button browser that allows the user to re-open the sequence browser once if it has been hidden
  Browser m_showHideBrowser;
  Asset   m_showHidePageAsset;      // host HTML asset of the hidden button page
  string  m_showHidePageName = "";  // file name of image file used for hidden button browser
  string  m_showHideButtonImg = ""; // name of image file used for hidden browser

  //
  // Method definitions
  //
  public void Init(Asset asset);
  thread void MainThread(void);

  void CreateSequenceBrowser(void);
  void ResetSequenceMembers(void);            // resets all sequence browser-realted data members to default values
  void UpdateSequenceBrowser(void);           // Updates the sequence browser based on the current settings, namely the page index.
  void UpdateSequenceParam(Message nullMsg);  // Handler method to update the browsers parameters like visiblity etc.

  void CreateShowHideBrowser(void);           // ?
  void UpdateShowHideBrowser(void);           // ?

  void CreateMsgBox(void);                    // ?
  void ResetMsgBox(void);                     // ?

  string GetButtonHTML(bool enabled, string buttonType);
  int GetPageIndexByName(string pageName);
  bool SetBrowserParam(string stringParam);

  //
  // PRIVATE IMPLEMENTATION
  //

  public void Init(Asset p_asset)
  {
    inherited(p_asset);

    ResetSequenceMembers();
    ResetMsgBox();

    AddHandler(me, "DisplayHTMLPages", "ResetBrowserParam", "UpdateSequenceParam");
    Interface.Log("# DisplayHTMLPagesLib.Init> Creating library object instance...");
  }

  //
  // Library call
  //
  // Supported function calls are:
  //
  // "CreatePageSession"
  //  - stringParam[X] - Name of Xth HTML file to load (minus the .html extension)
  //  - objectParam[X] - Asset where Xth HTML file can be found.  Must be able to cast to Asset.
  //
  // As this is a multi-HTML sequence. stringParam and objectParam must be the same size and correspond to
  // each other by index. Order of paramaters data dictates page order with the stringParam[0]/objectParam[0]
  // combo being used for the first page, stringParam[1]/objectParam[1] for the second page and so on.
  //
  // "PageOperation"
  //  - stringParam[0] - Name of operation to perform on this browser sequence.  Valid operations are
  //                      - "close"   - close this HTML Browser Sequence
  //                      - "done"    - Simulate press of the 'done' check mark button.  Either goes to next page or
  //                                    closes the sequence if on last page.
  //                      - "first"   - Go to the first page of the sequence.
  //                      - "last"    - Go to the last page of the sequence.
  //                      - "next"    - Go to the next page of the sequence (ignored if currently on the last page)
  //                      - "prev"    - Go to the previous page of the sequence (ignored if currently on the first page)
  //                      - "refresh" - ?
  //
  // "SetPageIndex"
  //  - stringParam[0] - ?
  //
  // "SetPageName"
  //  - stringParam[0] - ?
  //
  // "SetBrowserParameters"
  //  - stringParam[0] - ?
  //  - stringParam[1] - ?
  //  - stringParam[2] - ?
  //
  public string LibraryCall(string function, string[] stringParam, GSObject[] objectParam)
  {
    // starts a new multi-page session
    if (function == "CreatePageSession")
    {
      if (m_sequenceBrowser) // (m_threadRunning)
      {
        Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-ERROR: Sequence browser is already in use, can't re-create a new one!");
        return (string)false;
      }

      // we use the arrays for stringParam and objectParam in parallel such that for each stringParam element
      // (which is a html file name), there is a corresponding asset objectParam element (which is the Asset
      // where the html file can be found)
      if (objectParam  and  stringParam)
      {
        if ((objectParam.size() == stringParam.size())  and  objectParam.size()) // make sure there is at least 1 item
        {
          // reset everything sequence browser related to be clean
          ResetSequenceMembers();

          int paramSize = objectParam.size();
          m_htmlPages = new string[stringParam.size()];
          m_htmlAssets = new Asset[stringParam.size()];
          m_htmlPageFlags = new int[stringParam.size()];

          int i;
          for (i = 0; i < paramSize; i++)
          {
            m_htmlPages[i] = stringParam[i];
            m_htmlAssets[i] = cast<Asset>objectParam[i];
            m_htmlPageFlags[i] = 0; // always empty flags, must be set explcitly via the Set HTML Pages rule
          }

          Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-INFO: Creating HTML display sequence with " + paramSize + " pages!");

//          ResetSequenceBrowser();
          CreateSequenceBrowser();
          UpdateSequenceBrowser();

          if (!m_threadRunning)
            MainThread();

          return (string)true;
        }
      }
      return (string)false;
    }

    // call to set the properties of the show/hide button browser
    else if (function == "SetShowHideButton")
    {
      if (stringParam  and  objectParam)
        if ((stringParam.size() > 1)  and  objectParam.size())
        {
          m_showHidePageAsset = cast <Asset> objectParam[0];
          if (m_showHidePageAsset)
          {
            m_showHidePageName = stringParam[0];
            m_showHideButtonImg = stringParam[1];

            if (m_showHidePageName.size()  and  m_showHideButtonImg.size())
            {
              Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-INFO: Creating a show/hide button based on file '" + m_showHidePageName + " in asset + '" + m_showHidePageAsset.GetLocalisedName() + "'");
              CreateShowHideBrowser();
              return (string)true;
            }
          }
        }

      Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-ERROR: invalid parameters!");
      return (string)false;
    }

    // Message box display
    else if (function == "MessageBox")
    {
      // error, we already have an active messsage box window
      if (m_msgBoxBrowser)
      {
        Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-WARN: Already displaying a message box, library call ignored!");
        return (string)false;
      }

      if (stringParam  and  stringParam.size())
      {
        // if an object parameter is specified, we use an asset + page
        if (objectParam  and  objectParam.size())
        {
          m_msgBoxPageName = stringParam[0];
          m_msgBoxPageAsset = cast<Asset>objectParam[0];

          if (m_msgBoxPageName.size()  and  m_msgBoxPageAsset)
          {
//Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-INFO: Creating a message box asset browser!");
            CreateMsgBox();
            if (!m_threadRunning)
              MainThread();

            return (string)true;
          }
        }
        // else, assume the first string page as being the HTML page text contents as there is no asset to load from!
        else
        {
          m_msgBoxPageName = stringParam[0];
          m_msgBoxPageAsset = null;

          if (m_msgBoxPageName.size())
          {
            CreateMsgBox();
            if (!m_threadRunning)
              MainThread();

            return (string)true;
          }

        }
      }

      return (string)false;
    }

    // all other Library calls require the browser to exist, so abort if it isn't
    if (!m_sequenceBrowser) // if (!m_threadRunning)
    {
      Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-ERROR: No active browser session, library call can't be performed!");
      return (string)false;
    }

    // Perform specific HTML sequence operation as specified in stringParam[0] - an invalid operation will
    // be ignored by the main thread controlling the browser
    if (function == "PageOperation")
    {
      if (stringParam  and  stringParam.size())
      {
        Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-INFO: Telling browser to peform a '" + stringParam[0] + "' operation.");
        Router.PostMessage(me.GetId(), me.GetId(), "PageOperation", stringParam[0], 0.0);
        return (string)true;
      }
      else
        Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-ERROR: Invalid library paramaters provided!");
    }

    // Sets various paramaters of the browser
    else if (function == "SetBrowserParameters")
    {
      if (stringParam  and  stringParam.size())
      {
        int i;
        for (i = 0; i < stringParam.size(); i++)
          SetBrowserParam(stringParam[i]);

        Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-INFO: Setting browser parameters call!");

        // even if the browser isn't active, this message won't cause problems
        Router.PostMessage(me.GetId(), me.GetId(), "DisplayHTMLPages", "ResetBrowserParam", 0.0);
        return (string)true;
      }
      else
        Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-ERROR: Invalid library paramaters provided!");

      return (string)false;
    }

    // Sets the current page to the index given in stringParam[0] (if valid)
    else if (function == "SetPageIndex")
    {
      if (stringParam  and  stringParam.size())
      {
        int newIndex = Str.ToInt(stringParam[0]);
        if ((newIndex >= 0) and (newIndex < m_htmlPages.size()))
        {
          Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-INFO: Setting page to index " + newIndex + " (" + m_htmlPages[newIndex] + ")");

          m_pageIndex = newIndex;
          Router.PostMessage(me.GetId(), me.GetId(), "PageOperation", "refresh", 0.0);
          return (string)true;
        }
        Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-ERROR: page no. '" + newIndex + "' is not a valid index!");
      }
      else
        Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-ERROR: Invalid library paramaters provided!");
    }

    // Sets the current page to the one named in stringParam[0] (if valid)
    else if (function == "SetPageName")
    {
      if (stringParam  and  stringParam.size())
      {
        int newPageIndex = GetPageIndexByName(stringParam[0]);
        if (newPageIndex >= 0)
        {
          Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-INFO: Setting browser page to '" + stringParam[0] + "' (index=" + newPageIndex + ")");
          m_pageIndex = newPageIndex;

          // if sequence browser is invisible, we assume the caller wants it visible for their relaoded page
          m_windowVisible = true;

          Router.PostMessage(me.GetId(), me.GetId(), "PageOperation", "refresh", 0.0);
          return (string)true;
        }
        else
          Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-ERROR: page '" + stringParam[0] + "' is not a valid page in my list!");
      }
    }

    // Set state flags of specified page
    else if (function == "SetPageFlags")
    {
      if (stringParam  and  (stringParam.size() >= 2))
      {
        int pageIndex = GetPageIndexByName(stringParam[0]);
        if (pageIndex >= 0)
        {
          int flagSet = Str.ToInt(stringParam[1]);
          Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-INFO: Setting flags for page '" + stringParam[0] + "' to: " + (string)flagSet);
          m_htmlPageFlags[pageIndex] = flagSet;

          return (string)true;
        }
        Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-ERROR: Page '" + stringParam[0] + "' not in my list, can't set flags for!");
      }
      else
        Interface.Log("# DisplayHTMLPagesLib.LibraryCall> " + function + "-ERROR: Invalid library paramaters provided!");
    }
    else
      Interface.Log("# DisplayHTMLPagesLib.LibraryCall> ERROR: Invalid function call '" + function + "'");

    return (string)false;
  }

  //
  // main thread for managing a multi-paged display session
  //
  thread void MainThread(void)
  {
    Message msg;
    m_threadRunning = true;

    wait()
    {
      on "PageOperation", "", msg:
      {
        // close is a special case where there is no update, but browser is always closed
        if (msg.minor == "close")
          break;

        // same applies to done if we are on the last page
        if ((msg.minor == "done") and (m_pageIndex == m_pageListSize))
          break;

        // refresh assumes something like the index has been changed (safely!) so updates browser window
        if (msg.minor == "refresh")
        {
          UpdateSequenceBrowser();
          msg.src = null;
          continue;
        }

        // it's a normal operation otherwise, so adjust index, update the page and continue
        if ((msg.minor == "prev") and (m_pageIndex > 0))
          m_pageIndex--;
        else if ((msg.minor == "next") and (m_pageIndex < m_pageListSize))
          m_pageIndex++;
        else if (msg.minor == "done")
          m_pageIndex++;
        else if (msg.minor == "first")
          m_pageIndex = 0;
        else if (msg.minor == "last")
          m_pageIndex = m_pageListSize;
        else if ((msg.minor == "hide")  and  m_windowVisible) // only hide if already visible
          m_windowVisible = false;
        else if ((msg.minor == "show")  and  !m_windowVisible) // only show if already hidden
          m_windowVisible = true;
        else
        {
          msg.src = null;
          continue;  // continue and ignore if it's an unknown message
        }

        UpdateSequenceBrowser();
        msg.src = null;
        continue;
      }
      on "Browser-URL", "live://pages/messagebox/done", msg:
      {
        if (msg.src != m_msgBoxBrowser)
        {
          msg.src = null;
          continue;
        }

        ResetMsgBox();
        msg.src = null;
        continue;
      }
      on "Browser-URL", "live://pages/next", msg:
      {
        // continue on if it isn't our browser
        if (msg.src != m_sequenceBrowser)
        {
          msg.src = null;
          continue;
        }

        // increment along to the next page
        m_pageIndex++;
        UpdateSequenceBrowser();

        msg.src = null;
        continue;
      }
      on "Browser-URL", "live://pages/prev", msg:
      {
        // continue on if it isn't our browser
        if (msg.src != m_sequenceBrowser)
        {
          msg.src = null;
          continue;
        }

        // decrement back to the previous page
        m_pageIndex--;
        UpdateSequenceBrowser();

        msg.src = null;
        continue;
      }
      on "Browser-URL", "live://pages/done", msg:
      {
        // continue on if it isn't our browser
        if (msg.src != m_sequenceBrowser)
        {
          msg.src = null;
          continue;
        }

        // if the flag to hide browser on done is set, we do so without incrementing the page along
        // (if the user hasn't visited that page already!)

bool tempFlag = false;
if (m_pageIndex < m_highestVisited) // have we been here? before
  tempFlag = true;

        if (((m_htmlPageFlags[m_pageIndex] & PAGE_FLAG_DONE_CLOSE) > 0)  or  tempFlag)
        {
          // hide browser and continue
          m_windowVisible = false;
          UpdateSequenceParam(null); // we only need to update basic browser attributes for this, no need to reload with UpdateSequenceBrowser()

          Router.PostMessage(me.GetId(), Router.MESSAGE_BROADCAST, "DisplayHTMLPagesRuleDone", m_htmlPages[m_pageIndex], 0.0);

          msg.src = null;
          continue;
        }

        // if user not on the last page, increment on to the next page
        if (m_pageIndex < m_pageListSize)
        {
          // increment along to the next page
          m_pageIndex++;
          UpdateSequenceBrowser();

          msg.src = null;
          continue;
        }

        // otherwise, we let them close the browser via the 'ok/check' button
        break;
      }
      on "Browser-URL", "live://pages/showhide-button", msg:
      {
        if (msg.src != m_showHideBrowser)
        {
          msg.src = null;
          continue;
        }

        m_windowVisible = true;
        UpdateShowHideBrowser();

        msg.src = null;
        continue;
      }
      on "Browser-Closed", "", msg:
      {
        // continue on if it isn't our browser
        if (msg.src != m_sequenceBrowser)
        {
          msg.src = null;
          continue;
        }

        // otherwise, it is our browser, so end the rule
        break;
      }

    }

    Interface.Log("# DisplayHTMLPagesLib.MainThread> thread over, HTML page sequence complete!");

    ResetSequenceMembers();
    m_threadRunning = false;
  }

  void CreateSequenceBrowser(void)
  {
    m_pageListSize = m_htmlPages.size() - 1; // always revise here before starting something new
    m_pageIndex = 0;
    m_highestVisited = 0;
    m_sequenceBrowser = Constructors.NewBrowser();

    m_sequenceBrowser.SetWindowVisible(false);  // it is invisble until the first page is loaded

    m_sequenceBrowser.SetWindowPosition(m_posLeft, m_posTop);
    m_sequenceBrowser.SetWindowSize(m_sizeWidth, m_sizeHeight);
    m_sequenceBrowser.SetCloseEnabled(m_closeEnabled);
    m_sequenceBrowser.SetScrollEnabled(m_scrollEnabled);
  }

  void ResetSequenceMembers(void)
  {
    m_sequenceBrowser = null;
    m_htmlPages = new string[0];
    m_htmlAssets = new Asset[0];
    m_htmlPageFlags = new int[0];
    m_pageIndex = 0;
    m_pageListSize = 0;

    m_progressiveNext = true; // do we allow next button to be used only if the page has already neem visited (via 'done') before?
    m_highestVisited = 0;     // records the furtherest most visited page index

    // defaults based on ideal position in Driver with 800x600 resolution
    m_closeEnabled = m_scrollEnabled = m_windowVisible = true;
    m_sizeWidth = 528;
    m_sizeHeight = 424;
    m_posLeft = 46;
    m_posTop = 67;
  }

  //
  // Updates the sequence browser based on the current settings, namely the page index.  This is the method
  // called to navigate along to another page and sets the states of the navigation button based on where
  // the current page is.
  //
  void UpdateSequenceBrowser(void)
  {
    if (m_pageIndex > m_highestVisited)
      m_highestVisited = m_pageIndex;

    // special case where we allow for progressive navigation
    bool nextVisit = (m_pageIndex < m_pageListSize);
    if (m_progressiveNext  and  (m_pageIndex == m_highestVisited))
      nextVisit = false;

    // the 'done' check button can be a bit of a tricky one
    bool doneButton = true;

    // we allow a 'done' if they have alreadyt been beyond the current page
    if (((m_htmlPageFlags[m_pageIndex] & PAGE_FLAG_NO_DONE) > 0)  and  !nextVisit)
      doneButton = false;

    // put in the buttons - we assume the params $0, $1 and $2 are available for this purpose
    m_sequenceBrowser.SetParam(0, GetButtonHTML(m_pageIndex != 0, "prev"));
    m_sequenceBrowser.SetParam(1, GetButtonHTML(nextVisit, "next"));
    m_sequenceBrowser.SetParam(2, GetButtonHTML(doneButton, "done"));

    // every time we re-load the page, the scrollbar is reset
    m_sequenceBrowser.ResetScrollBar();

    // finally, load the page
    m_sequenceBrowser.LoadHTMLFile(m_htmlAssets[m_pageIndex], m_htmlPages[m_pageIndex] + ".html");

    // updates various browser properties like visiblity, size, location etc.
    UpdateSequenceParam(null); // dw: experimental

/*    if (m_sequenceBrowser.GetWindowVisible() !=  m_windowVisible)
      Interface.Log("@@@@ Hmmm, browser visiblity and visiblity flag are different!");*/

    // visiblity is changing, so update the show/hide button window (m_windowVisible is to mode to apply)
    if (m_sequenceBrowser.GetWindowVisible() !=  m_windowVisible)
      UpdateShowHideBrowser();

    // notify the world we changed the page
    Router.PostMessage(me.GetId(), Router.MESSAGE_BROADCAST, "DisplayHTMLPagesRule", m_htmlPages[m_pageIndex], 0.0);
  }

  //
  // Handler method called every time ??
  //
  void UpdateSequenceParam(Message nullMsg)
  {
    if (m_sequenceBrowser)
    {
      // visiblity is changing, so update the show/hide button window
      if (m_sequenceBrowser.GetWindowVisible() !=  m_windowVisible)
      {
        m_sequenceBrowser.SetWindowVisible(m_windowVisible);
        UpdateShowHideBrowser();
      }

      m_sequenceBrowser.SetCloseEnabled(m_closeEnabled);
      m_sequenceBrowser.SetScrollEnabled(m_scrollEnabled);
      m_sequenceBrowser.SetWindowVisible(m_windowVisible); // dw: experimental!

//      m_sequenceBrowser.SetWindowPosition(m_posLeft, m_posTop);
  //    m_sequenceBrowser.SetWindowSize(m_sizeWidth, m_sizeHeight);
    }
  }

  string GetButtonHTML(bool enabled, string buttonType)
  {
    StringTable strTable = m_htmlAssets[m_pageIndex].GetStringTable();
    if (enabled)
      return strTable.GetString("html-pages-button-" + buttonType);

    return strTable.GetString("html-pages-button-" + buttonType + "-disabled");
  }

  //
  // Gets the index to the named page if possible, -1 otheriwse.
  //
  // Note: page names are specified without the .html extension, so ensure pageName is the name of the page
  //       you want without the .html extension!
  //
  int GetPageIndexByName(string pageName)
  {
    int i;
    for (i = 0; i < m_htmlPages.size(); i++)
      if (pageName == m_htmlPages[i])
        return i;

    return -1;
  }

  //
  // Sets various browser paramaters based on a string command
  //
  //  - "progressiveNav/<bool>" - This is more a display HTML pages sequence thing and not really a browser paramter
  //  - "enableClose/<bool>"    - ?
  //  - "enableScroll/<bool>"   - ?
  //  - "windowVisible/<bool>"  - ?
  //  - "windowPosition/"       - ?
  //  - "windowSize/"           - ?
  //
  bool SetBrowserParam(string stringParam)
  {
//Interface.Log("## Browser param is: '" + stringParam + "'");

    if (TrainUtil.HasPrefix(stringParam, "progressiveNav/"))
    {
      m_progressiveNext = TrainUtil.HasSufix(stringParam, "/true");
    }
    else if (TrainUtil.HasPrefix(stringParam, "enableClose/"))
    {
      m_closeEnabled = TrainUtil.HasSufix(stringParam, "/true");
    }
    else if (TrainUtil.HasPrefix(stringParam, "enableScroll/"))
    {
      m_scrollEnabled = TrainUtil.HasSufix(stringParam, "/true");
    }
    else if (TrainUtil.HasPrefix(stringParam, "windowVisible/"))
    {
      m_windowVisible = TrainUtil.HasSufix(stringParam, "/true");
    }

// dw: not done yet!!!
    else if (TrainUtil.HasPrefix(stringParam, "windowPosition/"))
    {
      Interface.Log("## DisplayHTMLPagesLib.SetBrowserParam> Functionality for setting browser window position via '" + stringParam + "' not implemented yet!");

      if (stringParam.size() > 15)
      {
        string stripped   = stringParam[15,];
        string posLeftStr = TrainUtil.GetUpTo(stripped, "/");
        string posTopStr  = TrainUtil.GetAfter(stripped, "/");
        int posLeft = Str.ToInt(posLeftStr);
        int posTop  = Str.ToInt(posTopStr);

// dw: maybe check screen resolution?
        if (posLeft  and  posTop)
        {
          m_posLeft = posLeft;
          m_posTop  = posTop;
          return true;
        }
      }
    }

    else if (TrainUtil.HasPrefix(stringParam, "windowSize/"))
    {
      Interface.Log("## DisplayHTMLPagesLib.SetBrowserParam> Functionality for setting browser window size via '" + stringParam + "' not implemented yet!");

      if (stringParam.size() > 11)
      {
        string stripped  = stringParam[11,];
        string widthStr  = TrainUtil.GetUpTo(stripped, "/");
        string heightStr = TrainUtil.GetAfter(stripped, "/");
        int width  = Str.ToInt(widthStr);
        int height = Str.ToInt(heightStr);

// dw: maybe check screen resosolution?
        if (width  and  height)
        {
          m_sizeWidth = width;
          m_sizeHeight = height;
          return true;
        }
      }
    }
    else
    {
      Interface.Log("# DisplayHTMLPagesLib.SetBrowserParam> ERROR: Unknown param '" + stringParam + "'");
      return false;
    }

    return true;
  }

  void CreateShowHideBrowser(void)
  {
    // for here, we noramlly assume that the showHid datamembers like the page asset have already been
    // initialized correctly elsewhere...
    if (m_showHidePageAsset)
    {
      m_showHideBrowser = Constructors.NewBrowser();

      // leave invisible, the main thread (it the sub-methods it calls) will make this show/hide
      // browser visible/invisible as needed, this method just gets it ready
//      m_showHideBrowser.SetWindowVisible(false);

      m_showHideBrowser.SetWindowSize(64,64);

//      m_showHideBrowser.SetWindowPosition(676,403);
      m_showHideBrowser.SetWindowPosition(Interface.GetDisplayWidth() - 124, Interface.GetDisplayHeight() - 197);

      m_showHideBrowser.SetScrollEnabled(false);
      m_showHideBrowser.SetCloseEnabled(false);
      m_showHideBrowser.SetWindowStyle(Browser.STYLE_NO_FRAME);

      m_showHideBrowser.SetParam(0, m_showHideButtonImg + ".tga");
      m_showHideBrowser.SetParam(1, m_showHideButtonImg + "_on.tga");
      m_showHideBrowser.LoadHTMLFile(m_showHidePageAsset, m_showHidePageName + ".html");

      m_showHideBrowser.SetWindowVisible(false);
    }

  }

  // called by one of the sequence browser updating methods to make the show/hide browser visible (or invisible)
  // as required
  void UpdateShowHideBrowser(void)
  {
    // never assume the show/hide or sequence browser exist!
    if (m_sequenceBrowser  and  m_showHideBrowser)
    {
      m_sequenceBrowser.SetWindowVisible(m_windowVisible);
      m_showHideBrowser.SetWindowVisible(!m_windowVisible);
    }
  }

  // Create a new message box window
  void CreateMsgBox(void)
  {
// dw: pixel coordinates used here are really defaults for 800*600
    if (!m_msgBoxBrowser  and  m_msgBoxPageName.size())
    {
      m_msgBoxBrowser = Constructors.NewBrowser();

      m_msgBoxBrowser.SetCloseEnabled(false); // we rely on a particular type of URL to close this browser
      m_msgBoxBrowser.SetWindowStyle(Browser.STYLE_DEFAULT);
      m_msgBoxBrowser.SetWindowPosition(66, 87);

//    m_sizeWidth = 528;
//    m_sizeHeight = 424;
//    m_posLeft = 46;
//    m_posTop = 67;

      if (m_msgBoxPageAsset)
      {
        m_msgBoxBrowser.SetWindowSize(500, 350);
        m_msgBoxBrowser.SetScrollEnabled(true);
        m_msgBoxBrowser.LoadHTMLFile(m_msgBoxPageAsset, m_msgBoxPageName + ".html");
      }
      else  // we use the text of the page name instead with a mini-window
      {
        m_msgBoxBrowser.SetWindowSize(500, 100);
        m_msgBoxBrowser.SetScrollEnabled(false);

        m_msgBoxBrowser.SetParam(0, m_msgBoxPageName);
        m_msgBoxBrowser.LoadHTMLFile(me.GetAsset(), "default_msgbox.html");
      }
    }

  }

  // Resets the message box back to nothing
  void ResetMsgBox(void)
  {
    m_msgBoxBrowser = null;
    m_msgBoxPageAsset = null;
    m_msgBoxPageName = "";
  }

};


Rules
[Asset Source]

Session Rules

  • Cab Controls HUD
  • Consist Check
  • Control Type
  • Coupler Breakage HUD
  • Derailment Realism
  • Disabled HUD Icon Notification
  • Display Custom HUD
  • Display HTML
  • Display HTML Pages
  • Display Video
  • Driver Command
  • Driver Command Check
  • Driver Main Menu Options
  • Driver Setup
  • Enable/Disable Driver Commands
  • Enable/Disable HUD Icons
  • End Scenario
  • Flash HUD Icon
  • Flash HUD Panel
  • Message Popup
  • Minimap Options
  • Multiple Junction Alignment Check
  • Multiple Resource Check
  • Objective Clear
  • Objective New
  • Objective Remove
  • Online Chat
  • Ordered List
  • Play Wave
  • Power Station Rule
  • Progressive List
  • Random List
  • Reset List
  • Resource Check
  • Schedule Rule
  • Set Camera
  • Set Coupler Masks
  • Set Helper Icon Size
  • Set HTML Pages
  • Set Junctions
  • Show/Hide HUD Panel
  • Show/Hide Minimap
  • Simultaneous List
  • Startup Options
  • Time and Rate
  • Trigger Check
  • Trigger Rule
  • Variable Check
  • Variable Modify Continuous
  • Variable Modify
  • Variable Show
  • Vehicle Physics
  • Wait for Camera View Mode
  • Wait for Click on HUD Icon
  • Wait for Derailment
  • Wait for Driver On/Off Train
  • Wait for HTML Pages
  • Wait on Minimap Screen/Main Screen
  • Wait on Train Stop/Start
  • Wait on Waybill Screen/Main Screen
  • Weather


Cab Controls HUD
[Rules]

Cab Controls HUD Rule

config.txt:

﻿
username            "Cab Controls HUD"
kind              "behavior"
kuid              <kuid:-16:287428>
script              "CabControlsHUD"
class             "CabControlsHUD"
icon-texture            "CabControlsHUD.texture"
string-table {
  description         "Displays a cab-mode control HUD."
  html_description        "The Cab Controls HUD provides access to cab-like controls."
  show-hud          "Show the Cab Controls Display"
  hide-hud          "Hide the Cab Controls Display"
}
kuid-table {
  driver-module         <kuid:-16:10240>
}
username-fr           "Cab Controls HUD"
string-table-fr {
  description         "Displays a cab-mode control HUD."
  html_description        "The Cab Controls HUD provides access to cab-like controls."
  show-hud          "Show the Cab Controls Display"
  hide-hud          "Hide the Cab Controls Display"
}

CabControlsHUD.gs:

//
// CabControlsHUD.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "common.gs"

class CabControlsHUD isclass ScenarioBehavior
{
  define int CONTROL_MODE_NONE = 0;
  define int CONTROL_MODE_DIESEL = 1;
  define int CONTROL_MODE_STEAM = 2;

  Browser browser;
  bool hudEnabled = true;
  int controlMode = CONTROL_MODE_NONE;

  Locomotive cameraTargetLocomotive;
  Vehicle cameraTargetVehicle;
  Train cameraTargetTrain;

  public void Init(Asset asset);
  void ConstructBrowser(void);
  void CloseBrowser(void);
  void UpdateHTML(void);
  void OnCameraTargetChanged(Message msg);
  void OnTimerTick(Message msg);
  void OnBrowserURL(Message msg);
  void UpdateHTMLSliders(void);
  public string LibraryCall(string function, string[] stringParam, GSObject[] objectParam);
  public Soup GetProperties(void);
  public void SetProperties(Soup soup);
  void UpdateHUDActive(void);
  void UpdateControlMode(void);

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);

    AddHandler(me, "Camera", "Target-Changed", "OnCameraTargetChanged");
    AddHandler(me, "Timer", "Tick", "OnTimerTick");
  }

  //
  // Pause/unpause this rule.
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    UpdateHUDActive();
  }

  //
  bool hudActive = false;

  void ActivateHUD(void)
  {
    if (hudActive)
      return;
    hudActive = true;

    PostMessage(me, "Timer", "Tick", 0.5f);
    UpdateControlMode();
  }

  void DeactivateHUD(void)
  {
    if (!hudActive)
      return;
    hudActive = false;

    controlMode = CONTROL_MODE_NONE;
    cameraTargetLocomotive = null;
    cameraTargetVehicle = null;
    cameraTargetTrain = null;

    ClearMessages("Timer", "Tick");

    CloseBrowser();
  }

  void UpdateHUDActive(void)
  {
    if (hudEnabled)
      if (!IsPaused())
        if (World.GetCurrentModule() == World.DRIVER_MODULE)
        {
          ActivateHUD();
          return;
        }

    DeactivateHUD();
  }

  //
  // Create a new browser if needed
  //
  void ConstructBrowser(void)
  {
    if (!browser)
    {
      int width = Interface.GetDisplayWidth();
      browser = Constructors.NewBrowser();
      browser.SetCloseEnabled(false);
      browser.SetWindowStyle(Browser.STYLE_NO_FRAME);
      browser.SetWindowRect(width - 183,100,width,100+114);

      AddHandler(browser, "Browser-URL", "", "OnBrowserURL");
    }

    UpdateHTML();

    //
    // Add this browser to the DriverModule's custom HUD list
    //
    Library driverModule = World.GetLibrary( GetAsset().LookupKUIDTable("driver-module") );
    GameObject[] objectParam = new GameObject[1];
    objectParam[0] = browser;
    driverModule.LibraryCall("add-hud", null, objectParam);
  }

  //
  //
  void CloseBrowser(void)
  {
    if (!browser)
      return;

    //
    // Remove this browser from the DriverModule's custom HUD list
    //
    Library driverModule = World.GetLibrary( GetAsset().LookupKUIDTable("driver-module") );
    GameObject[] objectParam = new GameObject[1];
    objectParam[0] = browser;
    driverModule.LibraryCall("remove-hud", null, objectParam);

    browser = null;
  }

  //
  void UpdateHTML(void)
  {
    if (!browser)
      return;

    if (controlMode == CONTROL_MODE_STEAM)
      browser.LoadHTMLFile(me.GetAsset(), "CabControlsSteamHUD.html");
    else
      browser.LoadHTMLFile(me.GetAsset(), "CabControlsHUD.html");

    UpdateHTMLSliders();
  }

  //
  void OnCameraTargetChanged(Message msg)
  {
    cameraTargetTrain = null;

    cameraTargetVehicle = cast<Vehicle>(msg.src);

    if (cameraTargetVehicle)
    {
      cameraTargetTrain = cameraTargetVehicle.GetMyTrain();
      cameraTargetLocomotive = cast<Locomotive>(cameraTargetVehicle);

      if (!cameraTargetLocomotive)
        cameraTargetLocomotive = cameraTargetTrain.GetFrontmostLocomotive();
    }

    if (hudActive)
      UpdateControlMode();
  }

  void UpdateControlMode(void)
  {
    int newControlMode = CONTROL_MODE_NONE;

    if (!cameraTargetTrain)
    {
      // no train selected
      newControlMode = CONTROL_MODE_NONE;
    }
    else if (!cameraTargetTrain.GetAllowsUserControl())
    {
      // selected train under AI or Script control
      newControlMode = CONTROL_MODE_NONE;
    }
    else if (cameraTargetTrain.GetPhysicsModel() != Train.PHYSICS_SIMULATION)
    {
      // only for cab controls, not for dcc
      newControlMode = CONTROL_MODE_NONE;
    }
    else if (cameraTargetLocomotive)
    {
      if (cameraTargetLocomotive.GetEngineType() == Vehicle.ENGINE_STEAM)
      {
        // steam cab controls
        newControlMode = CONTROL_MODE_STEAM;
      }
      else
      {
        // diesel/electric cab controls
        newControlMode = CONTROL_MODE_DIESEL;
      }
    }
    else
    {
      // no locomotive
      newControlMode = CONTROL_MODE_NONE;
    }

    if (controlMode != newControlMode)
    {
      int oldControlMode = controlMode;
      controlMode = newControlMode;

      if (!IsPaused())
      {
        if (newControlMode == CONTROL_MODE_NONE)
          CloseBrowser();
        else if (oldControlMode == CONTROL_MODE_NONE)
          ConstructBrowser();
        else
          UpdateHTML();
      }
    }
  }

  //
  //
  void OnBrowserURL(Message msg)
  {
    if (!hudActive)
      return;

    if (controlMode == CONTROL_MODE_DIESEL  and  cameraTargetTrain != null)
    {
      if (msg.src == browser  and  msg.minor == "live://slider/0")
      {
        // reverser 0, 1, 2
        string valueStr = browser.GetElementProperty("slider0", "value");
        float value = Str.ToFloat(valueStr);

        Interface.Log("traction " + value);
        if (value < 0.5f)
          cameraTargetTrain.SetReverser(Train.TRACTION_FORWARD);
        else if (value > 1.5f)
          cameraTargetTrain.SetReverser(Train.TRACTION_REVERSE);
        else
          cameraTargetTrain.SetReverser(Train.TRACTION_NEUTRAL);
      }

      else if (msg.src == browser  and  msg.minor == "live://slider/1"  and  cameraTargetLocomotive != null)
      {
        // throttle 0, 1, 2, 3, 4, 5, 6, 7, 8
        string valueStr = browser.GetElementProperty("slider1", "value");
        int value = (Str.ToFloat(valueStr) + 0.5f);

        int throttleNotches = cameraTargetLocomotive.GetEngineParam("throttle-notches") + 0.5f;
        cameraTargetLocomotive.SetEngineSetting("throttle", (throttleNotches - value));
      }

      else if (msg.src == browser  and  msg.minor == "live://slider/2")
      {
        // dynamic brake 0 .. 1 .. 2
        string valueStr = browser.GetElementProperty("slider2", "value");
        float value = Str.ToFloat(valueStr);

        Interface.Log("dynbrake " + value);
        if (value > 1.5f)
          cameraTargetTrain.SetDynamicBrakeMode(Train.DYNAMIC_BRAKE_TRACTION);
        else if (value > 0.5f)
          cameraTargetTrain.SetDynamicBrakeMode(Train.DYNAMIC_BRAKE_NEUTRAL);
        else
          cameraTargetTrain.SetDynamicBrakeMode(Train.DYNAMIC_BRAKE_BRAKE);
      }

      else if (msg.src == browser  and  msg.minor == "live://slider/3")
      {
        // train brake 0.0 .. 4.0 { release, initial .. full application, emergency }
        string valueStr = browser.GetElementProperty("slider3", "value");
        float value = Str.ToFloat(valueStr);

          // mostly notched, but with one variable range
        if (value > 3.5f)
          value = Train.TRAIN_BRAKE_RELEASE;
        else if (value > 3.0f)
          value = Train.TRAIN_BRAKE_INITIAL;
        else if (value > 2.0f)
          value = Train.TRAIN_BRAKE_INITIAL + (3.0f - value);
        else if (value > 1.3f)
          value = Train.TRAIN_BRAKE_APPLICATION;
        else
          value = Train.TRAIN_BRAKE_EMERGENCY;

        cameraTargetTrain.SetTrainBrakes(value);
      }

      else if (msg.src == browser  and  msg.minor == "live://slider/4"  and  cameraTargetLocomotive)
      {
        // independant brake 0.0 .. 1.0
        string valueStr = browser.GetElementProperty("slider4", "value");
        float value = Str.ToFloat(valueStr);

        cameraTargetLocomotive.SetEngineSetting("loco-auto-brake", 32.0f * (1.0f - value));
      }
    }

    else if (controlMode == CONTROL_MODE_STEAM  and  cameraTargetTrain != null)
    {
      if (msg.src == browser  and  msg.minor == "live://slider/0")
      {
        // cut-off -1.0 .. 1.0
        string valueStr = browser.GetElementProperty("slider0", "value");
        float value = Str.ToFloat(valueStr);

        cameraTargetLocomotive.SetEngineSetting("reverser", - value);
      }

      else if (msg.src == browser  and  msg.minor == "live://slider/1"  and  cameraTargetLocomotive != null)
      {
        // regulator 0.0 .. 1.0
        string valueStr = browser.GetElementProperty("slider1", "value");
        float value = Str.ToFloat(valueStr);

        cameraTargetLocomotive.SetEngineSetting("regulator", 1.0f - value);
      }

      else if (msg.src == browser  and  msg.minor == "live://slider/2")
      {
        // train brake 0.0 .. 4.0 { release, initial .. full application, emergency }
        string valueStr = browser.GetElementProperty("slider2", "value");
        float value = Str.ToFloat(valueStr);

          // mostly notched, but with one variable range
        if (value > 3.5f)
          value = Train.TRAIN_BRAKE_RELEASE;
        else if (value > 3.0f)
          value = Train.TRAIN_BRAKE_INITIAL;
        else if (value > 2.0f)
          value = Train.TRAIN_BRAKE_INITIAL + (3.0f - value);
        else if (value > 1.3f)
          value = Train.TRAIN_BRAKE_APPLICATION;
        else
          value = Train.TRAIN_BRAKE_EMERGENCY;

        cameraTargetTrain.SetTrainBrakes(value);
      }

      else if (msg.src == browser  and  msg.minor == "live://slider/3"  and  cameraTargetLocomotive)
      {
        // independant brake 0.0 .. 1.0
        string valueStr = browser.GetElementProperty("slider3", "value");
        float value = Str.ToFloat(valueStr);

        cameraTargetLocomotive.SetEngineSetting("loco-auto-brake", 32.0f * (1.0f - value));
      }

      else if (msg.src == browser  and  msg.minor == "live://slider/4"  and  cameraTargetLocomotive)
      {
        // injectors 0.0 .. 1.0
        string valueStr = browser.GetElementProperty("slider4", "value");
        float value = Str.ToFloat(valueStr);

        cameraTargetLocomotive.SetEngineSetting("injector", (1.0f - value));
      }
    }
  }

  void OnTimerTick(Message msg)
  {
    if (msg.src != me)
      return;

    if (!hudActive)
      return;

    int wasControlMode = controlMode;
    UpdateControlMode();
    if (controlMode == wasControlMode)
      UpdateHTMLSliders();

    PostMessage(me, "Timer", "Tick", 0.5f);
  }

  void UpdateHTMLSliders(void)
  {
    if (controlMode == CONTROL_MODE_DIESEL  and  cameraTargetLocomotive != null)
    {
      string value;

      // reverser
      int reverser = (int)cameraTargetLocomotive.GetEngineSetting("reverser");
      if (reverser == Train.TRACTION_FORWARD)
        value = "0";
      else if (reverser == Train.TRACTION_REVERSE)
        value = "2";
      else
        value = "1";
      browser.SetElementProperty("slider0", "value", value);

      // throttle
      int throttle = cameraTargetLocomotive.GetEngineSetting("throttle") + 0.5f;
      int throttleNotches = cameraTargetLocomotive.GetEngineParam("throttle-notches") + 0.5f;
      value = (string)(throttleNotches - throttle);
      browser.SetElementProperty("slider1", "max", throttleNotches);
      browser.SetElementProperty("slider1", "value", value);

      // dynamic brake
      int dynamicBrake = (int)cameraTargetLocomotive.GetEngineSetting("dynamic-brake");
      if (dynamicBrake == Train.DYNAMIC_BRAKE_TRACTION)
        value = "2";
      else if (dynamicBrake == Train.DYNAMIC_BRAKE_NEUTRAL)
        value = "1";
      else
        value = "0";
      browser.SetElementProperty("slider2", "value", value);

      // train brake
      float trainBrake = cameraTargetLocomotive.GetEngineSetting("train-auto-brake");
      int trainBrakeInt = trainBrake;

        // mostly notched, but with one variable range
      if (trainBrakeInt == Train.TRAIN_BRAKE_RELEASE)
        value = "4";

      else if (trainBrakeInt == Train.TRAIN_BRAKE_INITIAL)
        value = (string)(2 + (Train.TRAIN_BRAKE_APPLICATION - trainBrake));

      else if (trainBrakeInt == Train.TRAIN_BRAKE_APPLICATION)
        value = "2";

      else
        value = "0";

      browser.SetElementProperty("slider3", "value", value);

      // ind brake
      float locoBrake = cameraTargetLocomotive.GetEngineSetting("loco-auto-brake");
      value = (string)(1.0f - (locoBrake / 32.0f));
      browser.SetElementProperty("slider4", "value", value);
    }

    else if (controlMode == CONTROL_MODE_STEAM  and  cameraTargetLocomotive != null)
    {
      string value;

      // reverser
      float reverser = cameraTargetLocomotive.GetEngineSetting("reverser");
      value = (string)(- reverser);
      browser.SetElementProperty("slider0", "value", value);

      // regulator
      float regulator = cameraTargetLocomotive.GetEngineSetting("regulator");
      value = (string)(1.0f - regulator);
      browser.SetElementProperty("slider1", "value", value);

      // train brake
      float trainBrake = cameraTargetLocomotive.GetEngineSetting("train-auto-brake");
      int trainBrakeInt = trainBrake;

        // mostly notched, but with one variable range
      if (trainBrakeInt == Train.TRAIN_BRAKE_RELEASE)
        value = "4";

      else if (trainBrakeInt == Train.TRAIN_BRAKE_INITIAL)
        value = (string)(2 + (Train.TRAIN_BRAKE_APPLICATION - trainBrake));

      else if (trainBrakeInt == Train.TRAIN_BRAKE_APPLICATION)
        value = "2";

      else
        value = "0";

      browser.SetElementProperty("slider2", "value", value);

      // ind brake
      float locoBrake = cameraTargetLocomotive.GetEngineSetting("loco-auto-brake");
      value = (string)(1.0f - (locoBrake / 32.0f));
      browser.SetElementProperty("slider3", "value", value);

      // injector
      float injector = cameraTargetLocomotive.GetEngineSetting("injector");
      value = (string)(1.0f - injector);
      browser.SetElementProperty("slider4", "value", value);
    }
  }

  //
  //
  public string LibraryCall(string function, string[] stringParam, GSObject[] objectParam)
  {
    string ret;

    if (function == "show")
    {
      hudEnabled = true;

      UpdateHUDActive();

      return ret;
    }

    if (function == "hide")
    {
      hudEnabled = false;

      UpdateHUDActive();

      return ret;
    }

    return inherited(function, stringParam, objectParam);
  }

  //
  // Save properties to the soup
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    // save state of browser
    soup.SetNamedTag("CabControlsHUD.enabledState", hudEnabled);

    return soup;
  }

  //
  // Initialise from properties including the hide/show state
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    // determine if we need to recreate the HUD browser (ie enabled/disabled)
    bool enabledHUD = soup.GetNamedTagAsBool("CabControlsHUD.enabledState", hudEnabled);
    if (enabledHUD)
      LibraryCall("show", null, null);
    else
      LibraryCall("hide", null, null);

  }

  //
  // Returns HTML description.
  //
  public string GetDescriptionHTML(void)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    string body = "<html><body><font color=#000000>";

    body = body + "<p>" + stringTable.GetString("html_description") + "</p>";

    body = body + "<p>" + HTMLWindow.RadioButton("live://property/show-hud", hudEnabled)
      + stringTable.GetString("show-hud") + "</p>";

    body = body + "<p>" + HTMLWindow.RadioButton("live://property/hide-hud", !hudEnabled)
      + stringTable.GetString("hide-hud") + "</p>";

    body = body + "</font></body></html>";

    return body;
  }

  //
  string GetPropertyType(string propertyID)
  {
    return "link";
  }

  void LinkPropertyValue(string propertyID)
  {
    if (propertyID == "show-hud")
      hudEnabled = true;

    if (propertyID == "hide-hud")
      hudEnabled = false;
  }
};


Consist Check
[Rules]

Consist Check Rule

config.txt:

﻿
username            "Consist Check"
kind              "behavior"
kuid              <kuid:-18:1207>
script              "ConsistCheckRule"
class             "ConsistCheckRule"
icon-texture            "consist_check_rule.texture"
string-table {
  description_html        "Waits for a consist to exist that matches a train definition."
  description         "Waits for a consist to exist that matches a train definition."
  strict-check-html-checkbox      "Enforce strict exclusive testing"
  strict-check-html-prefix      "<font color=#000000>"
  strict-check-html-sufix       "</font><br>"
}
username-de           "Consist Check"
string-table-de {
  description_html        "Wartet auf Zugzusammenstellung, die einer Zugdefinition entspricht."
  description         "Wartet auf Zugzusammenstellung, die einer Zugdefinition entspricht."
}
username-it           "Consist Check"
string-table-it {
  description_html        "Waits for a consist to exist that matches a train definition."
  description         "Waits for a consist to exist that matches a train definition."
}
username-es           "Comprobación de la composición"
string-table-es {
  description_html        "Espera a que haya una composición que se corresponda con la definición del tren."
  description         "Espera a que haya una composición que se corresponda con la definición del tren."
}
username-pl           "Consist Check"
string-table-pl {
  description_html        "Waits for a consist to exist that matches a train definition."
  description         "Waits for a consist to exist that matches a train definition."
}
username-cz           "Kontrolní bod soupravy"
string-table-cz {
  description_html        "Čekání na soupravu odpovídající zadaným parametrům."
  description         "Čekání na soupravu odpovídající zadaným parametrům."
}
username-ru           "Проверка состава"
description-ru            "Ждать появления состава, соответствующего заданному описанию поезда."
string-table-ru {
  description_html        "Ждать появления состава, соответствующего заданному описанию поезда."
  description         "Ждать появления состава, соответствующего заданному описанию поезда."
}
username-fr           "Vérification des convois"
string-table-fr {
  description_html        "Attente d'un convoi correspondant à une définition de train."
  description         "Attente d'un convoi correspondant à une définition de train."
}

ConsistCheckRule.gs:

//
// ConsistCheckRule.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ConditionalScenarioBehavior.gs"
include "ConsistHelperInfo.gs"
include "ListItemPropertyHandler.gs"
include "TrainHelperInfo.gs"
include "common.gs"

//
// Stricter version of TrainHelperInfo that does not support the "any trains" wild card.
//
class TrainFilterInfoStrict isclass TrainHelperInfo
{
  // clone of HTMLPropertyGroup.GetDescriptionHTML() as a workaround so we don't have
  // to call TrainHelperInfo.GetDescriptionHTML() - we want to bypass it and call
  // HTMLPropertyGroup.GetDescriptionHTML(), but GS isn't quite there yet.
  string Substitute(void)
  {
    string body = "";

    if (handlers.size())
    {
      body = body + handlers[0].GetDescriptionHTML();
      int i;
      for (i = 1; i < handlers.size(); i++)
        body = body + "<br>" + handlers[i].GetDescriptionHTML();
    }

    return body;
  }

  public string GetDescriptionHTML(void)
  {
    StringTable strTable = Constructors.GetTrainzStrings();
    string htmlPage = "";

    // radio buttons
    htmlPage = htmlPage + "<font color=#000000><p>" +
                 HTMLWindow.RadioButton(Link("filtertrains-off"), !filterTrains) + strTable.GetString("interface-consist-check-html0") +
               "</font></p>";

    htmlPage = htmlPage + "<p>" +
                 HTMLWindow.RadioButton(Link("filtertrains-on"), filterTrains) +
               strTable.GetString("interface-consist-check-html1") + "</p>";

    if (filterTrains)
    {
      htmlPage = htmlPage + "<br>" +
        HTMLWindow.MakeTable(
          HTMLWindow.MakeRow(
            HTMLWindow.MakeCell("", "width=50") +
            HTMLWindow.MakeCell(
              HTMLWindow.MakeTable(
                HTMLWindow.MakeRow(
                  HTMLWindow.MakeCell(Substitute())
                ),
                "cellpadding=20 border=1 bgcolor=#FFAD0059 bordercolor=#00000059"
              )
            )
          )
        );
    }

    return "<font color=#000000>" + htmlPage + "</font><br><br><br>";
  }

  //
  // Determines if the given train matches this filter selection
  //
  public bool DoesMatch(Train train, bool checkType)
  {
    // failure if train is not valid
    if (!train)
      return false;

    int i;
    for (i = 0; i < handlers.size(); i++)
    {
      SpecificVehiclesInfo info = cast<SpecificVehiclesInfo> handlers[i];
      if (info)
      {
        if (checkType)
        {
          if (!info.DoesMatchAndExlcude(train))
          {
//            Interface.Log("##--> TrainHelperInfo.DoesMatch> failed on '" + info.typeName + "' check");
            return false;
          }
        }
        else
        {
          if (!info.DoesMatchAnd(train))
          {
  //          Interface.Log("##--> TrainHelperInfo.DoesMatch> failed on '" + info.typeName + "' check");
            return false;
          }
        }
      }
    }

    // gotten this far, so train must have filtered through sucessfully
    Interface.Log("# TrainFilterInfoStrict.DoesMatch> Train matchup successfull!");
    return true;
  }

};

//
// Consist Check Rule
//  - Sets the COMPLETE flag if the designated train matches a specified consist description.
//  - Clears the COMPLETE flag if designated train no longer matches the specified consist description.
//
class ConsistCheckRule isclass ConditionalScenarioBehavior
{
  CheckBoxHandler       m_veryStrictHandler;
  TrainFilterInfoStrict m_trainFilterInto;
  HTMLPropertyGroup     m_group;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // HTML info helpers
    m_trainFilterInto = new TrainFilterInfoStrict ();
    m_trainFilterInto.Init();

    m_veryStrictHandler = new CheckBoxHandler();
    m_veryStrictHandler.Init(me.GetAsset(), "strict-check");

    m_group = new HTMLPropertyGroup();
    m_group.AddHandler(m_veryStrictHandler, "strictCheck/");
    m_group.AddHandler(m_trainFilterInto, "traindef/");

    SetPropertyHandler(m_group);
  }

  thread void ThreadPollCondition(void)
  {
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    // if rule is disabled, just get out of here without doing anything
    if (!m_trainFilterInto.DoesFilterTrains())
    {
      Interface.Log("# ConsistCheckRule.ThreadPollCondition> Rule not configured to do anything, terminating now!");
      SetComplete(true);
      m_pollingThreadRunning = false;
      return;
    }

    Interface.Log("# ConsistCheckRule.ThreadPollCondition> Starting rule...");
// m_trainFilterInto.DebugLog();

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    wait()
    {
      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()) // and  m_runOnlyOnceHandler.boolValue)
        {
          Interface.Log("# ConsistCheckRule.MainMsgThread> INFO: Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        // dw: temporary measure until Decouple messaging is fixed....
        ruleSet = GetConditionResult();

        if (ruleSet)
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
//            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

  //void DebugTrainLog(Train train);

  //
  // Returns true if any train matching the criteria of this rule.
  //
  bool GetConditionResult(void)
  {
    Train[] trains = World.GetTrainList();
    int i;
    for (i = 0; i < trains.size(); i++)
    {
//      DebugTrainLog(trains[i]);
      if (m_trainFilterInto.DoesMatch(trains[i], m_veryStrictHandler.GetBoolValue()))
      {
        Interface.Log("# ConsistCheckRule.GetConditionResult> Rule complete, filter match for train found!");
        return true;
      }
    }

    return false;
  }

/*  void DebugTrainLog(Train train)
  {
    Interface.Log("##### DebugTrainLog, consist is:");
    Vehicle[] vehicles = train.GetVehicles();
    int i;
    for (i = 0; i < vehicles.size(); i++)
      Interface.Log(" --> " + i + ": '" + vehicles[i].GetLocalisedName() + "'");
  }*/

};


Control Type
[Rules]

Control Type Rule

config.txt:

﻿
username            "Control Type"
kind              "behavior"
kuid              <kuid:-16:2030>
script              "behaviour"
class             "ControlTypeRule"
string-table {
  html_description1       "Current control method is <a href=live://property/control-method>Cab mode</a>."
  html_description2       "Current control method is <a href=live://property/control-method>DCC mode</a>."
  html_description3       "Current control method is <a href=live://property/control-method>Ask user</a>."
  driver_default_msg        "Defaulting to DCC mode for user train."
  description         "Set the control method (DCC mode or Cab mode) and realism."
}
icon-texture            "control_type.texture"
username-de           "Control Type"
string-table-de {
  html_description1       "Aktuelle Steuerung ist <a href=live://property/control-method>Fahrerstandsmodus</a>."
  html_description2       "Aktuelle Steuerung ist <a href=live://property/control-method>DCC-Modus</a>."
  html_description3       "Aktuelle Steuerung ist <a href=live://property/control-method>User fragen</a>."
  driver_default_msg        "Zurück zum DCC-Modus für den Zug des Benutzers."
  description         "Steuerungs-Methode (DCC- oder Führerstands-Modus) und Realismus auswählen."
}
username-it           "Regole di controllo"
string-table-it {
  html_description1       "L'attuale metodo di controllo è <a href=live://property/control-method>Modalità Cabina</a>."
  html_description2       "L'attuale metodo di controllo è <a href=live://property/control-method>Modalità CCD</a>."
  html_description3       "L'attuale metodo di controllo è <a href=live://property/control-method>Chiedi all'utente</a>."
  driver_default_msg        "Modalità CCD predefinita per il treno utente."
}
username-es           "Tipo de control"
string-table-es {
  html_description1       "El método de control actual es <a href=live://property/control-method>Modo de Cabina</a>."
  html_description2       "El método de control actual es <a href=live://property/control-method>Modo DCC</a>."
  html_description3       "El método de control actual es <a href=live://property/control-method>Preguntar al usuario</a>."
  driver_default_msg        "Predeterminando modo DCC para el tren del usuario."
  description         "Configura el realismo y el método de control (modo DCC o modo Cabina)."
}
username-pl           "Zasady typu sterowania"
string-table-pl {
  html_description1       "Bieżąca metoda sterowania to <a href=live://property/control-method>tryb z lokomotywy</a>."
  html_description2       "Bieżąca metoda sterowania to <a href=live://property/control-method>tryb bezpośredni</a>."
  html_description3       "Bieżąca metoda sterowania to <a href=live://property/control-method>Zapytaj użytkownika</a>."
  driver_default_msg        "Domyślnie – tryb bezpośredni w przypadku pociągu gracza."
}
username-cz           "Způsob ovládání"
string-table-cz {
  html_description1       "Aktuální způsob ovládání je <a href=live://property/control-method>stanoviště</a>."
  html_description2       "Aktuální způsob ovládání je <a href=live://property/control-method>DCC ovladač</a>."
  html_description3       "Aktuální způsob ovládání je <a href=live://property/control-method>dotázat se</a>."
  driver_default_msg        "Standardní ovládání pro uživatelský vlak je DCC ovladač."
  description         "Nastav způsob ovládání (DCC ovladač nebo stanoviště) a realitu hry."
}
username-ru           "Способ управления"
description-ru            "Выбор способа управления (Цифровое управление или режим кабины) и степени реализма."
string-table-ru {
  html_description1       "Используется способ управления: кабина."
  html_description2       "Используется способ управления: цифровое."
  html_description3       "Используется способ управления: спросить игрока."
  driver_default_msg        "По умолчанию выбрано упрощенное управление."
  description         "Выбор способа управления (Цифровое управление или режим кабины) и степени реализма."
}
username-fr           "Type de contrôle"
string-table-fr {
  html_description1       "Méthode de contrôle actuelle : <a href=live://property/control-method>mode Cabine</a>."
  html_description2       "Méthode de contrôle actuelle : <a href=live://property/control-method>mode DCC</a>."
  html_description3       "Méthode de contrôle actuelle : <a href=live://property/control-method>Demander à l'utilisateur</a>."
  driver_default_msg        "Activation du mode DCC par défaut pour le train de l'utilisateur."
  description         "Permet de sélectionner la méthode de contrôle (mode DCC ou Cabine) et le niveau de réalisme."
}

behavior.gs:

//
// behaviour.gs
//
//  Copyright (C) 2003-2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Rule that allows the control mode for a profile to be set (DCC or Cab).
//
class ControlTypeRule isclass ScenarioBehavior
{
  // control mode setting - 1 for DCC (default), 0 for Cab, 2 for user-select
  int controlMethod = 1;

  // Called to allow user to select control mode themselves.
  thread void UserSelectControlMode(void);

  //
  // ScenarioBehavior methods
  //

  //
  // Pause/unpause this rule.  When unpaused, reset control mode of Trainz environment to
  // whatever this rule is currently set to.
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      // immediately hide the existing browser
      PostMessage(me, "ControlTypeRule", "Close", 0.0);
    }
    else if (!IsComplete())
    {
      if (controlMethod == 0)
      {
        // Cab
        Interface.Log("# ControlTypeRule.Pause> activating 'Cab' mode");
        World1.SetDCCMode(0);
        World1.SetDerailLevel(2);
        SetComplete(true);
      }
      else if (controlMethod == 1)
      {
        // DCC
        Interface.Log("# ControlTypeRule.Pause> activating 'DCC' mode");
        World1.SetDCCMode(1);
        World1.SetDerailLevel(0);
        SetComplete(true);
      }
      else
      {
        // User select
        Interface.Log("# ControlTypeRule.Pause> requesting user selection...");
        UserSelectControlMode();
      }
    }
  }

  //
  // PropertyObject methods
  //

  //
  // Sets the control method of this rule from the given database.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);

      // ceeb030919: driver now adds this rule by default, so we want it to use
      // ask-user method if nothing is specified.
    if (soup.CountTags() == 0)
      controlMethod = 2;

    else
      controlMethod = soup.GetNamedTagAsInt("ControlTypeRule.controlMethod");
  }

  //
  // Gets the control method of this rule and saves it to a new database.
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("ControlTypeRule.controlMethod", controlMethod);

    return soup;
  }

  //
  // Returns HTML code with link that allows control mode to be changed.
  //
  public string GetDescriptionHTML(void)
  {
    string controlMethodStr;
    StringTable strTable = GetAsset().GetStringTable();
    if (controlMethod == 0)
      controlMethodStr = "html_description1";
    else if (controlMethod == 1)
      controlMethodStr = "html_description2";
    else
      controlMethodStr = "html_description3";

    return "<html><body><font color=#000000>" + strTable.GetString(controlMethodStr) + "<br></font></body></html>";
  }

  //
  // Always returns "link" - only property type used in this small rule.
  //
  string GetPropertyType(string p_propertyID)
  {
    return "link";
  }

  //
  // Acts on a link. If link is control-method, than control mode is switched.
  //
  void LinkPropertyValue(string p_propertyID)
  {
    if (p_propertyID == "control-method")
    {
      controlMethod = (controlMethod + 1) % 3;
      World1.SetDCCMode(controlMethod);
    }
  }

  //
  // Ask the user select the control mode.
  //
  thread void UserSelectControlMode(void)
  {
    Message msg;
    Browser browser = Constructors.NewBrowser();
    browser.SetScrollEnabled(false);
    browser.LoadHTMLFile(GetAsset(), "query.html");
    StringTable strTable = GetAsset().GetStringTable();

    // wait for user to select a mode...
    wait ()
    {
      // user has chosen DCC control mode
      on "Browser-URL", "live://DCC", msg:
      {
        if (msg.src != browser)
        {
          msg.src = null;
          continue;
        }

        Interface.Log("# ControlTypeRule> INFO: DCC mode selected!");

        // in DCC mode, we make it easy with physics and derailments
        World1.SetDCCMode(true);
        World1.SetDerailLevel(0);
        SetComplete(true);
        break;
      }

      // user has chosen Cabin control mode
      on "Browser-URL", "live://Cabin", msg:
      {
        if (msg.src != browser)
        {
          msg.src = null;
          continue;
        }

        Interface.Log("# ControlTypeRule> INFO: Cabin mode selected!");

        // in Cabin control mode, we use proper physics and hard derail mode
        World1.SetDCCMode(false);
        World1.SetDerailLevel(2);
        SetComplete(true);
        break;
      }

      // default to DCC if user closes window without choosing...
      on "Browser-Closed", "", msg :
      {
        if (msg.src != browser)
        {
          msg.src = null;
          continue;
        }

        Interface.Print(strTable.GetString("driver_default_msg"));

        Interface.Log("# ControlTypeRule> INFO: Window closed, defaulting to DCC mode!");

        // in DCC mode, we make it easy with physics and derailments
        World1.SetDCCMode(true);
        World1.SetDerailLevel(0);
        SetComplete(true);
        break;
      }

      on "ControlTypeRule", "Close":
        // this rule has become paused, abort!
        break;
    }
  }

};


Coupler Breakage HUD
[Rules]

Coupler Breakage HUD Rule

config.txt:

﻿
username            "Coupler Breakage HUD"
kind              "behavior"
kuid              <kuid:-16:289734>
script              "CouplerBreakageRule"
class             "CouplerBreakageRule"
icon-texture            "CouplerBreakageRule.texture"
kuid-table {
  coupler-breakage-hud        <kuid:-16:18853>
}
string-table {
  description         "Controls coupler breakage options"
  html_description        "The Coupler Breakage HUD displays warnings about coupler stress and breakage."
  show-hud          "Show the Coupler Breakage Display"
  hide-hud          "Hide the Coupler Breakage Display"
}
username-fr           "ATH de rupture d'attelage"
string-table-fr {
  description         "Contrôle les options de rupture d'attelage"
  html_description        "L'ATH rupture d'attelage affiche des messages d'alerte concernant la tension et la rupture d'attelage."
  show-hud          "Afficher la rupture d'attelage"
  hide-hud          "Masquer la rupture d'attelage"
}

CouplerBreakageRule.gs:

//
// CouplerBreakageRule.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "Browser.gs"
include "common.gs"
include "Library.gs"
//include "ListItemPropertyHandler.gs"

class CouplerBreakageRule isclass ScenarioBehavior
{
  StringTable stringTable;
  bool m_showHUD = true;
  Library couplerBreakageHUD;
  //ListPropertyHandler m_properties;

  public void Init(Asset self)
  {
    inherited(self);

    stringTable = self.GetStringTable();
    couplerBreakageHUD = World.GetLibrary( self.LookupKUIDTable("coupler-breakage-hud") );

    //m_properties.Init(self, "CouplerBreakageRule");
  }

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused)
    {
      if (m_showHUD)
        couplerBreakageHUD.LibraryCall("show", null, null);
      else
        couplerBreakageHUD.LibraryCall("hide", null, null);
    }
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("CouplerBreakageRule.showHUD", m_showHUD);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    m_showHUD = soup.GetNamedTagAsBool("CouplerBreakageRule.showHUD", true);

    if (!IsPaused())
    {
      if (m_showHUD)
        couplerBreakageHUD.LibraryCall("show", null, null);
      else
        couplerBreakageHUD.LibraryCall("hide", null, null);
    }
  }

  //
  // Returns HTML description.
  //
  public string GetDescriptionHTML(void)
  {
    string body = "<html><body><font color=#000000>";

    body = body + "<p>" + stringTable.GetString("html_description") + "</p>";

    body = body + "<p>" + HTMLWindow.RadioButton("live://property/show-hud", m_showHUD)
      + stringTable.GetString("show-hud") + "</p>";

    body = body + "<p>" + HTMLWindow.RadioButton("live://property/hide-hud", !m_showHUD)
      + stringTable.GetString("hide-hud") + "</p>";

    body = body + "</font></body></html>";

    return body;
  }

  //
  string GetPropertyType(string propertyID)
  {
    return "link";
  }

  void LinkPropertyValue(string propertyID)
  {
    if (propertyID == "show-hud")
      m_showHUD = true;

    if (propertyID == "hide-hud")
      m_showHUD = false;
  }
};


Derailment Realism
[Rules]

Derailment Realism Rule

config.txt:

﻿
username            "Derailment Realism"
kind              "behavior"
kuid              <kuid:-3:10150>
script              "RealismRule"
class             "RealismRule"
string-table {
  derail_desc_0         "None"
  derail_desc_1         "Arcade"
  derail_desc_2         "Realistic"
  derail_list_0         "None"
  derail_list_1         "Arcade"
  derail_list_2         "Realistic"
  derail_type_name        "Derailment Realism"
  derail_type_desc        "The derailment realism level."
  description_html        "Set derailment realism to $0."
  property_name         "Property '$0'"
  description         "Specify the derailment realism mode."
}
icon-texture            "realism.texture"
username-de           "Entgleisungs-Realismus"
string-table-de {
  derail_desc_0         "Keins"
  derail_desc_1         "Arcade"
  derail_desc_2         "Realistisch"
  derail_list_0         "Keins"
  derail_list_1         "Arcade"
  derail_list_2         "Realistisch "
  derail_type_name        "Realistische Entgleisungsdarstellung"
  derail_type_desc        "Grad der realistischen Entgleisungsdarstellung."
  description_html        "Entgleisungs-Realismus auf $0 setzen."
  property_name         "Eigentum '$0'"
  description         "Geben Sie den Entgleisungs-Realismus-Modus an."
}
username-it           "Regole deragliamento realistico"
string-table-it {
  derail_desc_0         "Nessuno"
  derail_desc_1         "Arcade"
  derail_desc_2         "Realistico"
  derail_list_0         "Nessuno"
  derail_list_1         "Arcade"
  derail_list_2         "Realistico"
  derail_type_name        "Realismo deragliamento"
  derail_type_desc        "Livello realismo deragliamento."
  description         "Imposta realismo deragliamento a $0."
  property_name         "Possedimenti '$0'"
}
username-es           "Realismo de descarrilamiento"
string-table-es {
  derail_desc_0         "Ninguno"
  derail_desc_1         "Arcade"
  derail_desc_2         "Realista"
  derail_list_0         "Ninguno"
  derail_list_1         "Arcade"
  derail_list_2         "Realista"
  derail_type_name        "Realismo del descarrilamiento"
  derail_type_desc        "El nivel de realismo del descarrilamiento."
  description_html        "Establecer el realismo del descarrilamiento en $0."
  property_name         "Propiedad '$0'"
  description         "Especifica el modo del realismo del descarrilamiento."
}
username-pl           "Zasady realizmu wykolejeń"
string-table-pl {
  derail_desc_0         "Brak"
  derail_desc_1         "Względne"
  derail_desc_2         "Realistyczne"
  derail_list_0         "Brak"
  derail_list_1         "Względne"
  derail_list_2         "Realistyczne"
  derail_type_name        "Realizm wykolejeń"
  derail_type_desc        "Poziom realizmu wykolejania się pociągów."
  description         "Ustaw realism wykolejeń na $0."
  property_name         "Obiekt '$0'"
}
username-cz           "Pravděpodobnost vykolejení"
string-table-cz {
  derail_desc_0         "žádná"
  derail_desc_1         "nízká"
  derail_desc_2         "realistická"
  derail_list_0         "žádná"
  derail_list_1         "nízká"
  derail_list_2         "realistická"
  derail_type_name        "Pravděpodobnost vykolejení"
  derail_type_desc        "Úroveň pravděpodobnosti vykolejení vlaku."
  description_html        "Nastavit pravděpodobnost vykolejení na $0."
  property_name         "Hodnota '$0'"
  description         "Nastav úroveň pravděpodobnosti vykolejení."
}
username-ru           "Реализм схода с рельсов"
description-ru            "Установить реализм схода с рельсов: $0."
string-table-ru {
  derail_desc_0         "нет"
  derail_desc_1         "аркадный"
  derail_desc_2         "реалистичный"
  derail_list_0         "нет"
  derail_list_1         "аркадный"
  derail_list_2         "реалистичный"
  derail_type_name        "Реализм схода с рельсов"
  derail_type_desc        "Уровень реалистичности схода с рельсов."
  description_html        "Установить реализм схода с рельсов: $0."
  property_name         "Свойство '$0'."
  description         "Установить реализм схода с рельсов: $0."
}
username-fr           "Niveau de déraillement"
string-table-fr {
  derail_desc_0         "Aucun"
  derail_desc_1         "Arcade"
  derail_desc_2         "Réaliste"
  derail_list_0         "Aucun"
  derail_list_1         "Arcade"
  derail_list_2         "Réaliste"
  derail_type_name        "Niveau de déraillement"
  derail_type_desc        "Le niveau de déraillement."
  description_html        "Règle le niveau de déraillement sur $0."
  property_name         "Propriété '$0'"
  description         "Spécifie le mode du niveau de déraillement."
}

RealismRule.gs:

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"

class RealismRule isclass ScenarioBehavior
{
  int derailType = 0;

  //
  // PropertyObject methods
  //

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    derailType = soup.GetNamedTagAsInt("RealismRule.type");
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("RealismRule.type", derailType);

    return soup;
  }

  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      SetComplete(true);

      World1.SetDerailLevel(derailType);
    }
  }

  public string GetDescriptionHTML(void)
  {
    StringTable stringTable = GetAsset().GetStringTable();
    string typeStr = "<a href=live://property/type>" + stringTable.GetString("derail_desc_" + derailType) + "</a>";

    return "<html><body><font color=#000000>" + stringTable.GetString1("description_html", typeStr) + "</font></body></html>";
  }

  string GetPropertyType(string p_propertyID)
  {
    return "list";
  }

  string GetPropertyName(string p_propertyID)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    if (p_propertyID == "type")
    {
      return stringTable.GetString("derail_type_name");
    }

    return stringTable.GetString1("property_name", p_propertyID);
  }

  string GetPropertyDescription(string p_propertyID)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    if (p_propertyID == "type")
    {
      return stringTable.GetString("derail_type_desc");
    }

    return "";
  }

  public string[] GetPropertyElementList(string p_propertyID)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    int i;
    string [] result = new string[0];

    if (p_propertyID == "type")
    {
      for (i = 0; i < 8; ++i)
        result[i] = stringTable.GetString("derail_list_"+i);
    }

    return result;
  }

  void SetPropertyValue(string p_propertyID, string p_value, int p_index)
  {
    // Get index of resulting property.
    if (p_propertyID == "type")
    {
      if (p_index < 0 or p_index > 2)
        p_index = 0;

      derailType = p_index;
    }
  }
};


Disabled HUD Icon Notification
[Rules]

Disabled HUD Icon Notification Rule

config.txt:

﻿
username            "Disabled HUD Icon Notification"
kind              "behavior"
kuid              <kuid:-18:1210>
script              "DisabledHUDIconNotify"
class             "DisabledHUDIconNotify"
icon-texture            "disabled_hud_icon_notify.texture"
string-table {
  description         "Waits for a disabled HUD Panel icon to be clicked"
  description_info_any        "to do"
  disabled-run-once-html-checkbox     "Trigger rule once"
  disabled-run-once-html-prefix     "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=1></td><td><font color=#000000>"
  disabled-run-once-html-sufix      "</font></td></tr></table>"
  disabled-hud-icon-html-property-true    "Rule is triggered when $0any$1 disabled HUD panel icon is clicked."
  disabled-hud-icon-html-property-false   "Rule is triggered when any $0one of the following$1 HUD panel icons is disabled and clicked."
  disabled-hud-icon-html-prefix     "<table cellpadding=0 cellspacing=0><tr><td width=3></td><td><font color=#000000>"
  disabled-hud-icon-html-sufix      "</font></td></tr></table>"
  panel-bottom-right-display-name     "Bottom Right Menu:"
  panel-bottom-right-html-prefix      "<table cellpadding=0 cellspacing=0><tr><td width=3></td><td><font color=#000000>"
  panel-bottom-right-html-sufix     "</font></td></tr></table>"
  panel-bottom-right-item0      "btn/message"
  panel-bottom-right-item1      "btn/minimap"
  panel-bottom-right-item2      "btn/commodities"
  panel-bottom-right-item3      "btn/decouple"
  panel-bottom-right-item4      "btn/waybills"
  panel-bottom-right-item5      "btn/schedule"
  panel-bottom-right-item6      "btn/help"
  panel-bottom-right-item-btn/message   "Messages"
  panel-bottom-right-item-btn/minimap   "Map"
  panel-bottom-right-item-btn/commodities   "Commodities"
  panel-bottom-right-item-btn/decouple    "Decoupling"
  panel-bottom-right-item-btn/waybills    "Waybill"
  panel-bottom-right-item-btn/schedule    "View Schedule"
  panel-bottom-right-item-btn/help    "View Driver Help"
  panel-camera-controls-display-name    "Camera Controls:"
  panel-camera-controls-html-prefix   "<table cellpadding=0 cellspacing=0><tr><td width=3></td><td><font color=#000000>"
  panel-camera-controls-html-sufix    "</font></td></tr></table>"
  panel-camera-controls-item0     "view-0"
  panel-camera-controls-item1     "view-1"
  panel-camera-controls-item2     "view-2"
  panel-camera-controls-item3     "view-3"
  panel-camera-controls-item-view-0   "Cab View"
  panel-camera-controls-item-view-1   "External View"
  panel-camera-controls-item-view-2   "Tracking View"
  panel-camera-controls-item-view-3   "Free Roaming"
  panel-dcc-controls-display-name     "DCC Controls:"
  panel-dcc-controls-html-prefix      "<table cellpadding=0 cellspacing=0><tr><td width=3></td><td><font color=#000000>"
  panel-dcc-controls-html-sufix     "</font></td></tr></table><br><br>"
  panel-dcc-controls-item0      "button/pants"
  panel-dcc-controls-item1      "button/lights"
  panel-dcc-controls-item2      "button/horn"
  panel-dcc-controls-item3      "button/stop"
  panel-dcc-controls-item-button/pants    "Pantographs"
  panel-dcc-controls-item-button/lights   "Lights"
  panel-dcc-controls-item-button/horn   "Horn"
  panel-dcc-controls-item-button/stop   "Stop"
}
username-fr           "Notification d'icône ATH désactivée"
string-table-fr {
  description         "Attend que l'on clique sur une icône désactivée du panneau ATH"

  disabled-run-once-html-checkbox     "Déclencher la règle une fois"

  disabled-hud-icon-html-property-true    "La règle se déclenche lorsque l'on clique sur $0n'importe quelle$1 icône ATH désactivée."
  disabled-hud-icon-html-property-false   "La règle se déclenche lorsque l'on clique sur $0l'une des icônes ATH$1 désactivées suivantes."

  panel-bottom-right-display-name     "Menu inférieur droit :"
  panel-bottom-right-item-btn/message   "Messages"
  panel-bottom-right-item-btn/minimap   "Carte"
  panel-bottom-right-item-btn/commodities   "Marchandises"
  panel-bottom-right-item-btn/decouple    "Dételage"
  panel-bottom-right-item-btn/waybills    "Feuille de route"
  panel-bottom-right-item-btn/schedule    "Voir horaire"
  panel-bottom-right-item-btn/help    "Voir aide Conducteur"

  panel-camera-controls-display-name    "Commandes de la caméra :"
  panel-camera-controls-item-view-0   "Vue cabine"
  panel-camera-controls-item-view-1   "Vue extérieure"
  panel-camera-controls-item-view-2   "Vue poursuite"
  panel-camera-controls-item-view-3   "Caméra libre"

  panel-dcc-controls-display-name     "Commandes DCC :"
  panel-dcc-controls-item-button/pants    "Pantographes"
  panel-dcc-controls-item-button/lights   "Phares"
  panel-dcc-controls-item-button/horn   "Sirène"
  panel-dcc-controls-item-button/stop   "Arrêt"
}

DisabledHUDIconNotify.gs:

//
// DisabledHUDIconNotify.gs
//
//  Copyright (C) 2004-2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"

class DisabledHUDIconNotify isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler          m_runOnlyOnceHandler;
  GenericBoolHandler       m_anySpecificHandler;
  CheckListPropertyHandler m_bottomRightHandler, m_cameraControlsHandler, m_dccControlsHandler;
  HTMLPropertyGroup        m_groupHandler;

  bool ValidateURL(string urlMsg);

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property handler stuff
    m_runOnlyOnceHandler = new CheckBoxHandler();
    m_runOnlyOnceHandler.Init(me.GetAsset(), "disabled-run-once");

    m_anySpecificHandler = new GenericBoolHandler();
    m_anySpecificHandler.Init(me.GetAsset(), "disabled-hud-icon");

    m_bottomRightHandler = new CheckListPropertyHandler();
    m_bottomRightHandler.Init(me.GetAsset(), "panel-bottom-right");

    m_cameraControlsHandler = new CheckListPropertyHandler();
    m_cameraControlsHandler.Init(me.GetAsset(), "panel-camera-controls");

    m_dccControlsHandler = new CheckListPropertyHandler();
    m_dccControlsHandler.Init(me.GetAsset(), "panel-dcc-controls");

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_runOnlyOnceHandler, "runOnce");
    m_groupHandler.AddHandler(m_anySpecificHandler, "anySpecific");
    m_groupHandler.AddHandler(m_bottomRightHandler, "bottomRight");
    m_groupHandler.AddHandler(m_cameraControlsHandler, "cameraControls");
    m_groupHandler.AddHandler(m_dccControlsHandler, "dccControls");

    SetPropertyHandler(m_groupHandler);
  }

  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    wait()
    {
      on "Browser-URL", "", msg:
      {
        if (IsPaused())
        {
          msg.src = null;
          break;
        }

        // do rule check and post timer update for check to be processed as needed
        ruleSet = ValidateURL(msg.minor);

        PostMessage(me, "Timer", "Tick", 0.0);
        msg.src = null;
        continue;
      }

      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()  and  m_runOnlyOnceHandler.GetBoolValue())
        {
          Interface.Log("# DisabledHUDIconNotify.MainMsgThread> Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (ruleSet)
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
//            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

  bool ValidateURL(string urlMsg)
  {
    if (urlMsg  and  (urlMsg.size() > 16))
    {
      if (TrainUtil.HasPrefix(urlMsg, "live://") and  TrainUtil.HasSufix(urlMsg, "/disabled"))
      {
        string ourURL = urlMsg[7, urlMsg.size()-9];

        // this is where we allow for the any disabled button URL (if rule is set to do this)
        if (m_anySpecificHandler.GetBoolValue())
        {
          Interface.Log("# DisabledHUDIconNotify.ValidateURL> Rule conditions satisfied with '" + urlMsg + "', any disabled URL is allowed.");
          return true;
        }

        if ((m_bottomRightHandler.ItemExistsChecked(ourURL, true) >= 0)  or
            (m_cameraControlsHandler.ItemExistsChecked(ourURL, true) >= 0)  or
            (m_dccControlsHandler.ItemExistsChecked(ourURL, true) >= 0))
        {
          Interface.Log("# DisabledHUDIconNotify.ValidateURL> Rule conditions satisfied with '" + urlMsg + "', in list and checked.");
          return true;
        }
      }
    }

    return false;
  }

};


Display Custom HUD
[Rules]

Display Custom HUD Rule

config.txt:

﻿
username            "Display Custom HUD"
kind              "behavior"
kuid              <kuid:-3:10206>
script              "DisplayCustomHUD"
class             "DisplayCustomHUD"
icon-texture            "DisplayCustomHUD.texture"
kuid-table {
  script-hud          <kuid:-18:1200>
}
string-table {
  show-hud          "Show the Custom Heads up Display"
  hide-hud          "Hide the Custom Heads up Display"
  html_description
  description         "Show or hide the Custom Heads up Display"
}
username-de           "Benutzerdefiniertes HUD anzeigen"
string-table-de {
  show-hud          "Das benutzerdefinierte HUD anzeigen"
  hide-hud          "Das benutzerdefinierte HUD verbergen"
  html_description
  description         "Das benutzerdefinierte HUD anzeigen/verbergen"
}
username-it           "Display Custom HUD"
string-table-it {
  show-hud          "Show the Custom Heads up Display"
  hide-hud          "Hide the Custom Heads up Display"
  html_description
  description         "Show or hide the Custom Heads up Display"
}
username-es           "Mostrar visor personalizado"
string-table-es {
  show-hud          "Mostrar el visor personalizado"
  hide-hud          "Ocultar el visor personalizado"
  html_description
  description         "Muestra u oculta el visor personalizado"
}
username-pl           "Display Custom HUD"
string-table-pl {
  show-hud          "Show the Custom Heads up Display"
  hide-hud          "Hide the Custom Heads up Display"
  html_description
  description         "Show or hide the Custom Heads up Display"
}
username-cz           "Zobrazit uživatelský informační panel"
string-table-cz {
  show-hud          "Zobrazit uživatelský informační panel"
  hide-hud          "Skrýt uživatelský informační panel"
  html_description
  description         "Zobrazit/skrýt uživatelský informační panel"
}
username-ru           "Показать Панель Управления"
description-ru            "Показать или скрыть Панель управления"
string-table-ru {
  show-hud          "Показать Панель управления"
  hide-hud          "Скрыть Панель управления"
  description         "Показать или скрыть Панель управления"
}
username-fr           "Afficher l'ATH personnalisé"
string-table-fr {
  show-hud          "Afficher l'ATH personnalisé"
  hide-hud          "Masquer l'ATH personnalisé"
  html_description
  description         "Affiche ou masque l'ATH personnalisé"
}

DisplayCustomHUD.gs:

//
// DisplayCustomHUD.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "Browser.gs"
include "common.gs"
include "Library.gs"

class DisplayCustomHUD isclass ScenarioBehavior
{
  StringTable stringTable;
  bool m_showHUD = true;
  Library scriptHUD;

  public void Init(Asset self)
  {
    inherited(self);

    stringTable = self.GetStringTable();
    scriptHUD = World.GetLibrary( self.LookupKUIDTable("script-hud") );
  }

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused)
    {
      if (m_showHUD)
        scriptHUD.LibraryCall("show", null, null);
      else
        scriptHUD.LibraryCall("hide", null, null);
    }
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("DisplayCustomHUD.showHUD", m_showHUD);

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    m_showHUD = soup.GetNamedTagAsBool("DisplayCustomHUD.showHUD", true);
  }

  //
  // Returns HTML description.
  //
  public string GetDescriptionHTML(void)
  {
    string body = "<html><body><font color=#000000>";

    body = body + "<p>" + stringTable.GetString("html_description") + "</p>";

    body = body + "<p>" + HTMLWindow.RadioButton("live://property/show-hud", m_showHUD)
      + stringTable.GetString("show-hud") + "</p>";

    body = body + "<p>" + HTMLWindow.RadioButton("live://property/hide-hud", !m_showHUD)
      + stringTable.GetString("hide-hud") + "</p>";

    body = body + "</font></body></html>";

    return body;
  }

  //
  string GetPropertyType(string propertyID)
  {
    return "link";
  }

  void LinkPropertyValue(string propertyID)
  {
    if (propertyID == "show-hud")
      m_showHUD = true;

    if (propertyID == "hide-hud")
      m_showHUD = false;
  }
};


Display HTML
[Rules]

Display HTML Rule

config.txt:

﻿
username            "Display HTML"
kind              "behavior"
kuid              <kuid:-16:2031>
script              "behaviour"
class             "DisplayHTMLRule"
string-table {
  html_description        "Display page <a href=live://property/page>$0</a> of html asset <a href=live://property/asset>$1</a> in a new in-game window."
  description         "Display a page from a HTML asset in a browser window."
  description_info        "Display page <i>''$0''</i> of html asset <i>''$1''</i> in a new in-game window."
  display-name-page       "HTML page name"
  display-desc-page       "Name of HTML page without the .html extension"
  display-name-asset        "HTML asset"
  display-desc-asset        "HTML asset where the page can be found"
  click_to_select         "<i>click to select</i>"
}
icon-texture            "html_type.texture"
username-de           "HTML anzeigen"
string-table-de {
  html_description        "Zeigt Seite <a href=live://property/page>$0</a> mit html-Objekt<a href=live://property/asset>$1</a> in einem neuen In-Game-Fenster an."
  click_to_select         "<i>Zur Auswahl klicken</i>"
}
username-it           "Visualizza regole HTML"
string-table-it {
  html_description        "Visualizza la pagina <a href=live://property/page>$0</a> dell'asset html <a href=live://property/asset>$1</a> in una nuova finestra."
  click_to_select         "<i>clicca per selezionare</i>"
}
username-es           "Mostrar HTML"
string-table-es {
  html_description        "Mostrar página <a href=live://property/page>$0</a> de componente html <a href=live://property/asset>$1</a> en una ventana nueva del juego."
  click_to_select         "<i>clic para seleccionar</i>"
}
username-pl           "Zasady wyświetlania HTML"
string-table-pl {
  html_description        "Wyświetl stronę <a href=live://property/page>$0</a> w formacie html <a href=live://property/asset>$1</a> w nowym oknie gry."
  click_to_select         "<i>kliknij, by wybrać</i>"
}
username-cz           "Zobrazit HTML"
string-table-cz {
  html_description        "Zobrazit stránku <a href=live://property/page>$0</a> html součásti <a href=live://property/asset>$1</a> v novém herním okně."
  click_to_select         "<i>kliknutím zvol</i>"
}
username-ru           "Показать HTML"
string-table-ru {
  html_description        "Показывать страницу $0 элементов html $1 в новом игровом окне."
  click_to_select         "кликните для выбора"
}
username-fr           "Afficher HTML"
string-table-fr {
  html_description        "Affiche la page <a href=live://property/page>$0</a> de l'objet html <a href=live://property/asset>$1</a> dans une nouvelle fenêtre de jeu."
  click_to_select         "<i>cliquez pour sélectionner</i>"
}

behaviour.gs:

//
// behaviour.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Rule that displays a HTML page from a HTML asset in a Browser window.
//
// This rule operates by loading the HTML page in a window once it has started. It then waits
// for the browser window to close and will then be complete.
//
class DisplayHTMLRule isclass ScenarioBehavior
{
  KUID HTMLAssetKUID;
  string pageName = "index";

  thread void DisplayHTML(void);

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.  When unpaused, reset control mode of Trainz environment to
  // whatever this rule is currently set to.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      // immediately hide the existing browser
      PostMessage(me, "DisplayHTMLRule", "Close", 0.0);
    }
    else if (!IsComplete())
    {
      DisplayHTML();
    }
  }

  //
  // PropertyObject methods
  //

  // Sets the propeties of this rule from the given soup database.
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    HTMLAssetKUID = soup.GetNamedTagAsKUID("DisplayHTMLRule.HTMLAssetKUID");
    pageName = soup.GetNamedTag("DisplayHTMLRule.pageName");
    if (!pageName or !pageName.size())
      pageName = "index";
  }

  // Packs the properties of this rule up into a soup database.
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    if (HTMLAssetKUID)
    {
      soup.SetNamedTag("DisplayHTMLRule.HTMLAssetKUID", HTMLAssetKUID);
      soup.SetNamedTag("DisplayHTMLRule.pageName", pageName);
    }

    return soup;
  }

  string GetPropertyName(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "page")
      return strTable.GetString("display-name-page");

    if (propertyID == "asset")
      return strTable.GetString("display-name-asset");

    return inherited(propertyID);
  }

  string GetPropertyDescription(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "page")
      return strTable.GetString("display-desc-page");

    if (propertyID == "asset")
      return strTable.GetString("display-desc-asset");

    return inherited(propertyID);
  }

  // Returns HTML code with link that allows control mode to be changed.
  public string GetDescriptionHTML(void)
  {
    string currentAssetName;
    StringTable strTable = GetAsset().GetStringTable();

    Asset asset;

    if (HTMLAssetKUID)
      asset = World.FindAsset(HTMLAssetKUID);

    if (asset)
      currentAssetName = asset.GetLocalisedName();
    else
      currentAssetName = strTable.GetString("click_to_select");

    return "<html><body><font color=#000000>"
      + strTable.GetString2("html_description", pageName + ".html", currentAssetName)
      + "<br></font></body></html>";
  }

  // gets the type for the named property:
  //  * "page"  - string property that refers to the html page filename (minus the .html extension)
  //  * "asset" - list property that refers to a list of all available html assets
  public string GetPropertyType(string propertyID)
  {
    if (propertyID == "page")
      return "string";

    if (propertyID == "asset")
      return "list,1";

    return "";
  }

  // gets a list of all available HTML assets to choose from
  public string[] GetPropertyElementList(string propertyID)
  {
    int i;
    Asset[] assets = World.GetAssetList("html-asset");
    string[] ret = new string[assets.size()];

    for (i = 0; i < assets.size(); i++)
      ret[i] = assets[i].GetLocalisedName();

    return ret;
  }

  // Sets the value of the 'asset' property
  public void SetPropertyValue(string p_propertyID, string p_value, int p_index)
  {
    Asset[] assets = World.GetAssetList("html-asset");
    Asset asset = assets[p_index];

    HTMLAssetKUID = asset.GetKUID();
  }

  // Sets the value of the 'page' string property.
  void SetPropertyValue(string propertyID, string value)
  {
    if (!value or !value.size())
      pageName = "index";
    else
      pageName = value;
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    Asset asset;

    if (HTMLAssetKUID)
      asset = World.FindAsset(HTMLAssetKUID);

    if (asset)
      return strTable.GetString2("description_info", pageName + ".html", asset.GetLocalisedName());

    return inherited();
  }

  //
  // Main thread that runs this rule.
  //
  thread void DisplayHTML(void)
  {
    if (!HTMLAssetKUID)
    {
      Interface.Log("# DisplayHTMLRule.DisplayHTML> ERROR: Invalid asset selected!");
      return;
    }

    Message msg;
    Browser browser = Constructors.NewBrowser();

    Asset asset = World.FindAsset(HTMLAssetKUID);
    if (!asset)
    {
      Interface.Log("# DisplayHTMLRule.DisplayHTML> ERROR: Unable to load requested HTML asset!");
      return;
    }

    browser.LoadHTMLFile(asset, pageName + ".html");

    wait ()
    {
      on "Browser-Closed", "", msg:
      {
        if (msg.src != browser)
        {
          msg.src = null;
          continue;
        }

        SetComplete(true);
        break;
      }

      on "DisplayHTMLRule", "Close":
        // this rule has become paused, abort!
        break;
    }
  }

};


Display HTML Pages
[Rules]

Display HTML Pages Rule

config.txt:

﻿
username            "Display HTML Pages"
kind              "behavior"
kuid              <kuid:-18:1234>
script              "DisplayHTMLPages"
class             "DisplayHTMLPages"
icon-texture            "html_pages_type.texture"
string-table {
  description         "Creates a browser to display the listed HTML files in order as a navigatable sequence of pages."
  description_html        "Creates a browser to display the listed HTML files in order as a navigatable sequence of pages."
  page-list-display-name        "Creates a browser to display the listed HTML files in order as a navigatable sequence of pages.<br>"
  page-list-html-prefix       "<table border=0 cellspacing=0 cellpadding=0><tr height=1></tr><tr><td width=4></td><td><font color=#000000>"
  page-list-html-sufix        "</font></td></tr></table>"
  page-list-html-table-row-odd      "bgcolor=#CCCCAA22"
  page-list-html-table-row-even     "bgcolor=#CCCCAA44"
  page-list-column0       "<font color=#000000><i>HTML File</i></font>&nbsp;&nbsp;"
  page-list-column1       "<font color=#000000><i>Source Asset</i></font>&nbsp;&nbsp;"
  page-list-delete        "<font color=#000000>Remove</font>"
  page-list-add         "Add Page"
  page-list-name-add        "HTML Asset"
  page-list-desc-add        "HTML Asset where the page can be found"
  page-list-name-pagename       "HTML Page Name"
  page-list-desc-pagename       "Name of HTML page without the .html extension"
  page-list-add-all       "Add All"
  page-list-add-all-tooltip     "Adds all of the HTML files from the designated asset"
  page-list-name-add-all        "HTML asset"
  page-list-desc-add-all        "HTML asset to add all files from"
  page-list-delete-all        "Delete All"
  page-list-delete-all-tooltip      "Delete all files from the list"
  page-item-html-prefix       "<td bgcolor=#00000011>"
  page-item-html-sufix        "</td>"
  page-item-name-pagename       "HTML Page Name"
  page-item-desc-pagename       "Name of HTML page without the .html extension"
  browser-param-display-name      "Set browser parameters:"
  browser-param-html-prefix     "<table border=0 cellspacing=0 cellpadding=0><tr><td width=3></td><td><font color=#000000>"
  browser-param-html-sufix      "</font></td></tr></table>"
  browser-param-html-between-items    " "
  browser-param-item-progressivenav   "<font color=#000000>Prevent user from exiting browser until all pages viewed</font>"
  browser-param-item-enableclose      "<font color=#000000>Disable closing of browser window by user</font>"
  browser-param-item-enablescroll     "<font color=#000000>Disable browser window scrolling</font>"
  browser-param-item-windowvisible    "<font color=#000000>Make browser window invisible</font>"
  browser-param-item-windowposition   "<font color=#000000>Set position - Under Consutrction!!!</font>"
  browser-param-item-windowsize     "<font color=#000000>Set size - Under Consutrction!!!</font>"
  hidden-button-html-property     "<font color=#000000>Use the page $0 from asset HTML $1 as the hidden button.</font>"
  hidden-button-name-pagename     "HTML Page Name"
  hidden-button-desc-pagename     "Name of HTML page without the .html extension"
  hidden-button-name-pageasset      "HTML Asset"
  hidden-button-desc-pageasset      "HTML Asset where the page can be found"
  hidden-button-blank-string      "<i>click to select</i>"
  hidden-button-html-prefix     "<table border=0 cellspacing=0 cellpadding=0><tr><td width=3></td><td><font color=#000000>"
  hidden-button-html-sufix      "</font></td></tr></table><br><br>"
}
kuid-table {
  displayhtmlpageslib       <kuid:-18:1245>
}
username-fr           "Affichage pages HTML"
string-table-fr {
  description         "Crée un navigateur pour afficher les fichiers HTML de la liste, dans l'ordre, comme une séquence de pages à parcourir."
  description_html        "Crée un navigateur pour afficher les fichiers HTML de la liste, dans l'ordre, comme une séquence de pages à parcourir."
  page-list-display-name        "Crée un navigateur pour afficher les fichiers HTML de la liste, dans l'ordre, comme une séquence de pages à parcourir.<br>"
  page-list-html-prefix       "<table border=0 cellspacing=0 cellpadding=0><tr height=1></tr><tr><td width=4></td><td><font color=#000000>"
  page-list-html-sufix        "</font></td></tr></table>"
  page-list-html-table-row-odd      "bgcolor=#CCCCAA22"
  page-list-html-table-row-even     "bgcolor=#CCCCAA44"
  page-list-column0       "<font color=#000000><i>Fichier HTML</i></font>&nbsp;&nbsp;"
  page-list-column1       "<font color=#000000><i>Création source</i></font>&nbsp;&nbsp;"
  page-list-delete        "<font color=#000000>Effacer</font>"
  page-list-add         "Ajouter page"
  page-list-name-add        "Création HTML"
  page-list-desc-add        "Création HTML dans laquelle trouver la page"
  page-list-name-pagename       "Nom page HTML"
  page-list-desc-pagename       "Nom page HTML sans l'extension .html"
  page-list-add-all       "Tout ajouter"
  page-list-add-all-tooltip     "Ajoute tous les fichiers HTML de la création désignée"
  page-list-name-add-all        "Création HTML"
  page-list-desc-add-all        "Création HTML à partir de laquelle ajouter tous les fichiers"
  page-list-delete-all        "Tout effacer"
  page-list-delete-all-tooltip      "Effacer tous les fichiers de la liste"
  page-item-html-prefix       "<td bgcolor=#00000011>"
  page-item-html-sufix        "</td>"
  page-item-name-pagename       "Nom de la page HTML"
  page-item-desc-pagename       "Nom de la page HTML sans l'extension .html"
  browser-param-display-name      "Définir paramètres navigateur :"
  browser-param-html-prefix     "<table border=0 cellspacing=0 cellpadding=0><tr><td width=3></td><td><font color=#000000>"
  browser-param-html-sufix      "</font></td></tr></table>"
  browser-param-html-between-items    " "
  browser-param-item-progressivenav   "<font color=#000000>Empêcher le joueur de quitter le navigateur avant qu'il n'ait visualisé toutes les pages</font>"
  browser-param-item-enableclose      "<font color=#000000>Désactiver la fermeture du navigateur par l'utilisateur</font>"
  browser-param-item-enablescroll     "<font color=#000000>Désactiver le défilement dans le navigateur</font>"
  browser-param-item-windowvisible    "<font color=#000000>Rendre la fenêtre du navigateur invisible</font>"
  browser-param-item-windowposition   "<font color=#000000>Définir position : en construction !!!</font>"
  browser-param-item-windowsize     "<font color=#000000>Définir taille : en construction !!!</font>"
  hidden-button-html-property     "<font color=#000000>Utiliser la page $0 de la création HTML $1 comme bouton masqué.</font>"
  hidden-button-name-pagename     "Nom page HTML"
  hidden-button-desc-pagename     "Nom page HTML sans l'extension .html"
  hidden-button-name-pageasset      "Création HTML"
  hidden-button-desc-pageasset      "Création HTML dans laquelle trouver la page"
  hidden-button-blank-string      "<i>cliquez pour sélectionner</i>"
  hidden-button-html-prefix     "<table border=0 cellspacing=0 cellpadding=0><tr><td width=3></td><td><font color=#000000>"
  hidden-button-html-sufix      "</font></td></tr></table><br><br>"
}

DisplayHTMLPages.gs:

//
// DisplayHTMLPages.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "ListItemPropertyHandler.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// List item for a HTML page.
//
class HTMLPageListItem isclass ConfigAssetHandler
{
  // Name of page to display (minus the .html extension) + the asset where it can be located.
  string m_pageName = "index";
  Asset m_htmlAsset = null;

  // work-around...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  public Asset GetHTMLAsset(void) { return m_htmlAsset; }
  public void  SetHTMLAsset(Asset newAsset) { m_htmlAsset = newAsset; }

  public string GetPageName(void) { return m_pageName; }
  public void   SetPageName(string newPageName) { m_pageName = newPageName; }

  //
  // Property Handler method implementations
  //

  public string GetPropertyType(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "pageName")
      return "string";

    return inherited(propertyID);
  }

  //
  // Gets HTML code describing this list item as two table cells (one cell for page name, other for
  // the asset)
  //
  public string GetDescriptionHTML(void)
  {
    string htmlPage = "<font color='#000000'>" + HREF("pageName") + m_pageName + ".html</a>&nbsp;&nbsp;</font></td>" +
                      "<td bgcolor=#00000011><font color=#000000>" + m_htmlAsset.GetLocalisedName() + "&nbsp;&nbsp;</font>";
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  //
  // Allows the page name to be set through this interface method.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    string property = PropStripPrefix(propertyID, "");
    if ((property == "pageName") and (value.GetType() == value.STRING_TYPE))
      m_pageName = value.AsString();
    else
      inherited(propertyID, value);
  }

  public string GetPropertyValue(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "pageName")
      return m_pageName;

    return inherited(propertyID);
  }

  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("HTMLPageListItem.pageName", m_pageName);

    if (m_htmlAsset)
      soup.SetNamedTag("HTMLPageListItem.htmlAsset", m_htmlAsset.GetKUID());

    return soup;
  }

  public string GetPropertyName(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "pageName")
      return m_assetStrTable.GetString(m_configPrefix + "-name-pagename");

    return inherited(propertyID);
  }

  public string GetPropertyDescription(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "pageName")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-pagename");

    return inherited(propertyID);
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    string newPageName = soup.GetNamedTag("HTMLPageListItem.pageName");
    if (newPageName.size())
      m_pageName = newPageName;
//    if (!m_pageName.size())
//      m_pageName = soup.GetNamedTag("HTMLPageListItem.pageName");

    KUID htmlAssetKUID = soup.GetNamedTagAsKUID("HTMLPageListItem.htmlAsset");
    if (htmlAssetKUID)
      m_htmlAsset = World.FindAsset(htmlAssetKUID);
  }

};

//
// List handler for a list of HTML pages + their associated asset
//
class HTMLPageListHandler isclass GenericListHandler
{
  int m_prefixCounter = 0; // accemelator used for saving/item ID purposes

  // work-around...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix);

  Asset FindAsset(string assetName);
  public void AddItem(string itemDisplayName, Asset htmlSrcAsset);

  //
  // Private method implementations
  //

  public void Init(Asset asset, string newConfigPrefix)
  {
    inherited(asset, newConfigPrefix);
    m_prefix = "page-list-handler/";
  }

  //
  // Adds a new item to the list. Method well create appropriate sub-handler for it.
  //
  public void AddItem(string itemDisplayName)
  {
    // find the selected asset
    Asset chosenAsset = FindAsset(itemDisplayName);
    if (!chosenAsset) // not likely to happen (maybe even being paranoid) but just being safe
    {
      Interface.Log("# DisplayHTMLPages.AddItem> ERROR: Can't finde HTML asset '" + itemDisplayName + "'");
      return;
    }

    // create the new item, initialised with the chosen asset
    HTMLPageListItem newItem = new HTMLPageListItem();
    newItem.Init(m_hostAsset, "page-item");
    newItem.SetHTMLAsset(chosenAsset);

    // item handler prefix is based on a prefixCounter
    me.AddHandler(newItem, (string)m_prefixCounter);
    m_prefixCounter++;
  }

  public void AddItem(string itemName, Asset htmlSrcAsset)
  {
    if (htmlSrcAsset)
    {
      // create the new item, initialised with the chosen asset
      HTMLPageListItem newItem = new HTMLPageListItem();
      newItem.Init(m_hostAsset, "page-item");
      newItem.SetHTMLAsset(htmlSrcAsset);
      newItem.SetPageName(itemName);

      // item handler prefix is based on a prefixCounter
      me.AddHandler(newItem, (string)m_prefixCounter);
      m_prefixCounter++;
    }
  }

  Asset FindAsset(string assetName)
  {
    // find the selected asset
    Asset[] assets = World.GetAssetList("html-asset");
    int i;

    for (i = 0; i < assets.size(); i++)
      if (assets[i].GetLocalisedName() == assetName)
        return assets[i];

    return null;
  }

  //
  // Property Handler methods
  //

  // special allowance for add-all
  public string[] GetPropertyElementList(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if ((property == "add")  or  (property == "add-all"))
    {
      Asset[] assets = World.GetAssetList("html-asset");
      string[] retStrList = new string[assets.size()];

      int i;
      for (i = 0; i < assets.size(); i++)
        retStrList[i] = assets[i].GetLocalisedName();

      return retStrList;
    }
    return inherited(propertyID);
  }

  // special allowance for add-all
  public string GetPropertyType(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "add-all")
      return "list";

    return inherited(propertyID);
  }

  // special allowance for add-all
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    string property = PropStripPrefix(propertyID, "");

    if (property == "add-all")
    {
      Asset chosenAsset = FindAsset(value.AsString());
      if (chosenAsset)
      {
        StringTable chosenStrTable = chosenAsset.GetStringTable();
        int i;
        while (true)
        {
          string currentName = chosenStrTable.GetString("html-page-" + (string)i);
          if (currentName.size())
            AddItem(currentName, chosenAsset);
          else
            break;

          i++;
        }
      }
    }
    else
      inherited(propertyID, value);
  }

  public string GetPropertyName(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "add-all")
      return m_assetStrTable.GetString(m_configPrefix + "-name-" + "add-all");

    return inherited(propertyID);
  }

  public string GetPropertyDescription(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "add-all")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-" + "add-all");

    return inherited(propertyID);
  }

  //
  // Re-creates the list of page items from the given soup.
  // Called by GenericListHandler.SetProperties() so no need to call yourself.
  //
  void ConstructHandlers(Soup listItemsSoup)
  {
    int i;
    for (i = 0; i < listItemsSoup.CountTags(); i++)
    {
      // construct and initialize the new item
      HTMLPageListItem newItem = new HTMLPageListItem();
      newItem.Init(m_hostAsset, "page-item");

      // get the sub-soup to set the item up with
      string prefixTag = listItemsSoup.GetIndexedTagName(i);
      Soup itemSoup = listItemsSoup.GetNamedSoup(prefixTag);
      newItem.SetProperties(itemSoup);

      // add the newly created item handler to this list group handler
      AddHandler(newItem, prefixTag);
    }
  }

  //
  // As each list item manages its own asset/name properties and items are handled by the parent
  // method, only the prefix counter is set from here.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);
    m_prefixCounter = soup.GetNamedTagAsInt("HTMLPageListHandler.prefixCounter");
  }

  //
  // As each list item manages its own asset/name properties and items are handled by the parent
  // method, only the prefix counter is saved here.
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();
    soup.SetNamedTag("HTMLPageListHandler.prefixCounter", m_prefixCounter);
    return soup;
  }

};

class ShowHideButtonHandler isclass HTMLPageListItem
{
  // work-around...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  Asset FindAsset(string assetName);

  //
  public string GetDescriptionHTML(void)
  {
    string assetName;
    if (!m_htmlAsset)
      assetName = m_assetStrTable.GetString(m_configPrefix + "-blank-string");
    else
      assetName = m_htmlAsset.GetLocalisedName();

    string htmlPage = m_assetStrTable.GetString2(m_configPrefix + "-html-property",
                                                 HREF("pageName") + m_pageName + ".html</a>",
                                                 HREF("pageAsset") + assetName + "</a>");
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  //
  public string GetPropertyType(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "pageAsset")
      return "list,1";

    return inherited(propertyID);
  }

  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    if (PropStripPrefix(propertyID, "") == "pageAsset")
    {
      string assetName = value.AsString();
      Asset newAsset = FindAsset(value.AsString());
      if (newAsset)
        m_htmlAsset = newAsset;
    }
    else
      inherited(propertyID, value);
  }

  public string GetPropertyValue(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "pageAsset")
      if (m_htmlAsset)
        return m_htmlAsset.GetLocalisedName();

    return inherited(propertyID);
  }

  public string GetPropertyName(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "pageAsset")
      return m_assetStrTable.GetString(m_configPrefix + "-name-pageasset");

    return inherited(propertyID);
  }

  public string GetPropertyDescription(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "pageAsset")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-pageasset");

    return inherited(propertyID);
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "pageAsset")
    {
      string[] retList = new string[0];
      Asset[] assets = World.GetAssetList("html-asset");
      int i;
      for (i = 0; i < assets.size(); i++)
        retList[i] = assets[i].GetLocalisedName();

      return retList;
    }

    return inherited(propertyID);
  }

  Asset FindAsset(string assetName)
  {
    // find the selected asset
    Asset[] assets = World.GetAssetList("html-asset");
    int i;

    for (i = 0; i < assets.size(); i++)
      if (assets[i].GetLocalisedName() == assetName)
        return assets[i];

    return null;
  }

};

//
// Rule that displays a HTML page from a HTML asset in a Browser window.
//
// This rule operates by loading the HTML page in a window once it has started. It then waits for the
// browser window to close and will then be complete.
//
class DisplayHTMLPages isclass ScenarioBehavior
{
  HTMLPageListHandler   m_pageListHandler;
  CheckListGroupHandler m_checkListHandler;
  ShowHideButtonHandler m_showHideButtonHandler;
  HTMLPropertyGroup     m_groupHandler;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property handler stuff
    m_pageListHandler = new HTMLPageListHandler();
    m_pageListHandler.Init(me.GetAsset(), "page-list");

    // browser paramater handling - checklist contain paramaters grouping
    m_checkListHandler = new CheckListGroupHandler();
    m_checkListHandler.Init(me.GetAsset(), "browser-param");

    m_checkListHandler.AddItem("progressiveNav", false);
    m_checkListHandler.AddItem("enableClose", false);
    m_checkListHandler.AddItem("enableScroll", false);
    m_checkListHandler.AddItem("windowVisible", false);

    // dw: these two are not ready yet...
    m_checkListHandler.AddItem("windowPosition", false);
    m_checkListHandler.AddItem("windowSize", false);

    // hidden button handler
    m_showHideButtonHandler = new ShowHideButtonHandler();
    m_showHideButtonHandler.Init(me.GetAsset(), "hidden-button");

    // global group handler
    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_pageListHandler, "pageList/");
    m_groupHandler.AddHandler(m_checkListHandler, "paramCheck/");
    m_groupHandler.AddHandler(m_showHideButtonHandler, "hiddenButton/");

    SetPropertyHandler(m_groupHandler);
  }

  //
  // When unpaused, ???
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        Interface.Log("# DisplayHTMLPages.Pause> unpaused and in driver, sending request(s) to library module...");
        KUID kuid = GetAsset().LookupKUIDTable("displayHTMLPagesLib");
        Library displayHTMLPagesLib = World.GetLibrary(kuid);

        if (displayHTMLPagesLib)
        {
          // prepare library call paramaters for the pages list
          int i, tempSize = m_pageListHandler.CountHandlers();
          GSObject[] objectParam = new GSObject[0];
          string[] stringParam = new string[0];
          HTMLPageListItem tempItem;

          for (i = 0; i < tempSize; i++)
          {
            tempItem = cast<HTMLPageListItem> m_pageListHandler.GetItem(i);
            stringParam[i] = tempItem.GetPageName();
            objectParam[i] = tempItem.GetHTMLAsset();
          }

          displayHTMLPagesLib.LibraryCall("CreatePageSession", stringParam, objectParam);

          // done the creation bit, now send thourgh any options/paramaters as needed....
          stringParam = new string[0];
          int p = 0;
          if (m_checkListHandler.GetSetting(0))  // progressive navigation check
            stringParam[p++] = m_checkListHandler.GetSettingName(0) + "/" + m_checkListHandler.GetSetting(0);

          if (m_checkListHandler.GetSetting(1))  // block closure of browser window checked
            stringParam[p++] = m_checkListHandler.GetSettingName(1) + "/" + !m_checkListHandler.GetSetting(1);

          if (m_checkListHandler.GetSetting(2))  // block scrolling in browser window checked
            stringParam[p++] = m_checkListHandler.GetSettingName(2) + "/" + !m_checkListHandler.GetSetting(2);

          if (m_checkListHandler.GetSetting(3))  // block closure of browser window checked
            stringParam[p++] = m_checkListHandler.GetSettingName(3) + "/" + !m_checkListHandler.GetSetting(3);

          if (stringParam.size())
            displayHTMLPagesLib.LibraryCall("SetBrowserParameters", stringParam, null);

          // next up is to tell the sequence browser manager what the show/hide button is (if specified)
          objectParam = new GSObject[0];
          stringParam = new string[0];

          if (m_showHideButtonHandler.GetHTMLAsset()  and  m_showHideButtonHandler.GetPageName())
          {
            stringParam[0] = m_showHideButtonHandler.GetPageName();
            stringParam[1] = "HelpButton";
            objectParam[0] = m_showHideButtonHandler.GetHTMLAsset();

// Interface.Log("### DisplayHTMLPAges.Pause> doing library call to set up the 'show hide button' thingy...");
            displayHTMLPagesLib.LibraryCall("SetShowHideButton", stringParam, objectParam);
          }

        }
        else
          Interface.Log("# DisplayHTMLPages.Pause> ERROR: Unable to open library 'displayHTMLPagesLib' library!");
      }

      SetComplete(true);
    }
  }

};


Display Video
[Rules]

Display Video Rule

config.txt:

﻿
username            "Display Video"
kind              "behavior"
kuid              <kuid:-16:4000>
script              "behaviour"
class             "DisplayVideoRule"
string-table {
  html_description        "Display page <a href=live://property/page>$0</a> of html asset <a href=live://property/asset>$1</a> in a new in-game window."
  description         "Display a page from a HTML asset in a browser window."
  description_info        "Display page '<i>$0</i>' of html asset '<i>$1</i>' in a new in-game window."
  display-name-page       "HTML page name"
  display-desc-page       "Name of HTML page without the .html extension"
  display-name-asset        "HTML asset"
  display-desc-asset        "HTML asset where the page can be found"
  click_to_select         "<i>click to select</i>"
}
icon-texture            "video_type.texture"
username-de           "Video anzeigen"
string-table-de {
  html_description        "Zeigt Seite <a href=live://property/page>$0</a> mit Video-Objekt<a href=live://property/asset>$1</a> in einem neuen In-Game-Fenster an."
  click_to_select         "<i>Zur Auswahl klicken</i>"
}
username-it           "Visualizza regole Video"
string-table-it {
  html_description        "Visualizza la pagina <a href=live://property/page>$0</a> dell'asset Video <a href=live://property/asset>$1</a> in una nuova finestra."
  click_to_select         "<i>clicca per selezionare</i>"
}
username-es           "Mostrar Video"
string-table-es {
  html_description        "Mostrar página <a href=live://property/page>$0</a> de componente Video <a href=live://property/asset>$1</a> en una ventana nueva del juego."
  click_to_select         "<i>clic para seleccionar</i>"
}
username-pl           "Zasady wyświetlania Video"
string-table-pl {
  html_description        "Wyświetl stronę <a href=live://property/page>$0</a> w formacie Video <a href=live://property/asset>$1</a> w nowym oknie gry."
  click_to_select         "<i>kliknij, by wybrać</i>"
}
username-cz           "Zobrazit Video"
string-table-cz {
  html_description        "Zobrazit stránku <a href=live://property/page>$0</a> Video součásti <a href=live://property/asset>$1</a> v novém herním okně."
  click_to_select         "<i>kliknutím zvol</i>"
}
username-ru           "Показать Video"
string-table-ru {
  html_description        "Показывать страницу $0 элементов Video $1 в новом игровом окне."
  click_to_select         "кликните для выбора"
}
username-fr           "Afficher Video"
string-table-fr {
  html_description        "Affiche la page <a href=live://property/page>$0</a> de l'objet Video <a href=live://property/asset>$1</a> dans une nouvelle fenêtre de jeu."
  click_to_select         "<i>cliquez pour sélectionner</i>"
}

DisplayVideoRule.gs:

//
// behaviour.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Rule that displays a HTML page from a HTML asset in a Browser window.
//
// This rule operates by loading the HTML page in a window once it has started. It then waits
// for the browser window to close and will then be complete.
//
class DisplayVideoRule isclass ScenarioBehavior
{
  KUID HTMLAssetKUID;
  string pageName = "index";

  thread void DisplayHTML(void);

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.  When unpaused, reset control mode of Trainz environment to
  // whatever this rule is currently set to.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      // immediately hide the existing browser
      PostMessage(me, "DisplayVideoRule", "Close", 0.0);
    }
    else if (!IsComplete())
    {
      DisplayHTML();
    }
  }

  //
  // PropertyObject methods
  //

  // Sets the propeties of this rule from the given soup database.
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    HTMLAssetKUID = soup.GetNamedTagAsKUID("DisplayVideoRule.HTMLAssetKUID");
    pageName = soup.GetNamedTag("DisplayVideoRule.pageName");
    if (!pageName or !pageName.size())
      pageName = "index";
  }

  // Packs the properties of this rule up into a soup database.
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    if (HTMLAssetKUID)
    {
      soup.SetNamedTag("DisplayVideoRule.HTMLAssetKUID", HTMLAssetKUID);
      soup.SetNamedTag("DisplayVideoRule.pageName", pageName);
    }

    return soup;
  }

  string GetPropertyName(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "page")
      return strTable.GetString("display-name-page");

    if (propertyID == "asset")
      return strTable.GetString("display-name-asset");

    return inherited(propertyID);
  }

  string GetPropertyDescription(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "page")
      return strTable.GetString("display-desc-page");

    if (propertyID == "asset")
      return strTable.GetString("display-desc-asset");

    return inherited(propertyID);
  }

  // Returns HTML code with link that allows control mode to be changed.
  public string GetDescriptionHTML(void)
  {
    string currentAssetName;
    StringTable strTable = GetAsset().GetStringTable();

    Asset asset;

    if (HTMLAssetKUID)
      asset = World.FindAsset(HTMLAssetKUID);

    if (asset)
      currentAssetName = asset.GetLocalisedName();
    else
      currentAssetName = strTable.GetString("click_to_select");

    return "<html><body><font color=#000000>"
      + strTable.GetString2("html_description", pageName + ".html", currentAssetName)
      + "<br></font></body></html>";
  }

  // gets the type for the named property:
  //  * "page"  - string property that refers to the html page filename (minus the .html extension)
  //  * "asset" - list property that refers to a list of all available html assets
  public string GetPropertyType(string propertyID)
  {
    if (propertyID == "page")
      return "string";

    if (propertyID == "asset")
      return "list";

    return "";
  }

  // gets a list of all available HTML assets to choose from
  public string[] GetPropertyElementList(string propertyID)
  {
    int i;
    Asset[] assets = World.GetAssetList("html-asset");
    string[] ret = new string[assets.size()];

    for (i = 0; i < assets.size(); i++)
      ret[i] = assets[i].GetLocalisedName();

    return ret;
  }

  // Sets the value of the 'asset' property
  public void SetPropertyValue(string p_propertyID, string p_value, int p_index)
  {
    Asset[] assets = World.GetAssetList("html-asset");
    Asset asset = assets[p_index];

    HTMLAssetKUID = asset.GetKUID();
  }

  // Sets the value of the 'page' string property.
  void SetPropertyValue(string propertyID, string value)
  {
    if (!value or !value.size())
      pageName = "index";
    else
      pageName = value;
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    Asset asset;

    if (HTMLAssetKUID)
      asset = World.FindAsset(HTMLAssetKUID);

    if (asset)
      return strTable.GetString2("description_info", pageName + ".html", asset.GetLocalisedName());

    return inherited();
  }

  //
  // Main thread that runs this rule.
  //
  thread void DisplayHTML(void)
  {
    Message msg;
    Browser browser = Constructors.NewBrowser();

    Asset asset = World.FindAsset(HTMLAssetKUID);
    if (!asset)
    {
      Interface.Log("DisplayVideoRule.UserSelectControlMode> unable to load requested HTML asset");
      return;
    }

    browser.LoadHTMLFile(asset, pageName + ".html");

    wait ()
    {
      on "Browser-Closed", "", msg:
      {
        if (msg.src != browser)
        {
          msg.src = null;
          continue;
        }

        SetComplete(true);
        break;
      }

      on "DisplayVideoRule", "Close":
        // this rule has become paused, abort!
        break;

      on "DisplayVideoRule", "ResetValues":
      {
        browser.SetElementProperty("videoplayer", "control-rewind", "0");
        browser.SetElementProperty("videoplayer", "control-play", "0");
        browser.SetElementProperty("videoplayer", "control-pause", "0");
        browser.SetElementProperty("videoplayer", "control-stop", "0");
        continue;
      }

      on "Browser-URL", "live://property/video-rewind", msg:
      {
        if (msg.src == browser)
        {
          browser.SetElementProperty("videoplayer", "control-command", "1");
          continue;
        }
      }

      on "Browser-URL", "live://property/video-play", msg:
      {
        if (msg.src == browser)
        {
          browser.SetElementProperty("videoplayer", "control-command", "2");
          continue;
        }
      }

      on "Browser-URL", "live://property/video-pause", msg:
      {
        if (msg.src == browser)
        {
          browser.SetElementProperty("videoplayer", "control-command", "3");
          continue;
        }
      }

      on "Browser-URL", "live://property/video-stop", msg:
      {
        if (msg.src == browser)
        {
          browser.SetElementProperty("videoplayer", "control-command", "4");
          continue;
        }
      }

    }
  }

};


Driver Command
[Rules]

Driver Command Rule

config.txt:

﻿
username            "Driver Command"
kind              "behavior"
kuid              <kuid:-3:10057>
script              "DriverCommandRule"
class             "DriverCommandRule"
string-table {
  html_description2       "<b>Driver Command Rule</b><br><br>
<b>The ticked commands will be available in Driver:</b><br>"
  no-description          "<i>No description provided.</i>"
  description         "Specify which commands will be available for the drivers."
}
icon-texture            "command_type.texture"
kuid-table {
  drive-to-command        <kuid:-3:10058>
  load-command          <kuid:-3:10076>
  unload-command          <kuid:-3:10077>
  couple-command          <kuid:-3:10081>
  decouple-command        <kuid:-3:10082>
  drive-to-trackmark-command      <kuid:-3:10149>
  drive-via-trackmark-command     <kuid:-3:10209>
  wait-for-command        <kuid:-3:10090>
  drive-schedule-command        <kuid:-3:10186>
  runaround-command       <kuid:-3:10083>
  notify-command          <kuid:-3:10078>
}
username-de           "Fahrer-Befehl"
string-table-de {
  html_description2       "<b>Fahrer-Befehlsregel</b><br><br>

<b>Die angehakten Befehle stehen im Fahrer-Modus zur Verfügung:</b><br>"
  no-description          "<i>Keine Beschreibung verfügbar.</i>"
  description         "Geben Sie an, welche Befehle den Fahrern zur Verfügung stehen sollen."
}
username-it           "Regole macchinista"
string-table-it {
  html_description1       "<a href=live://property/add-object>Aggiungi ordine macchinista </a><br><br>"
  html_description2       "<b>Regola ordine del macchinista</b><br><br>

<b>The following commands will be available in Driver:</b><br>"
  html_description3       "rimuovi"
  property_name_add       "Aggiungi ordine macchinista"
  property_desc_add       "Seleziona ordine macchinista da aggiungere."
}
username-es           "Órdenes del maquinista"
string-table-es {
  html_description2       "<b>Regla de órdenes al maquinista</b><br><br>

<b>Las órdenes marcadas estarán disponibles en Maquinista:</b><br>"
  no-description          "<i>No se proporciona descripción.</i>"
  description         "Especifica qué órdenes estarán disponibles para los maquinistas."
}
username-pl           "Zasady poleceń maszynisty"
string-table-pl {
  html_description1       "<a href=live://property/add-object>Dodaj polecenie maszynisty</a><br><br>"
  html_description2       "<b>Zasada poleceń maszynisty</b><br><br>

<b>Poniższe polecenia będą dostępne dla maszynisty:</b><br>"
  html_description3       "usuń"
  property_name_add       "Dodaj polecenie maszynisty"
  property_desc_add       "Wybierz polecenie maszynisty, które chcesz dodać."
}
username-cz           "Příkazy strojvůdcům"
string-table-cz {
  html_description2       "<b>Pravidlo příkazů strojvůdcům</b><br><br>

<b>Zaškrtnuté příkazy budou dostupné v módu Strojvůdce:</b><br>"
  no-description          "<i>Popis není dostupný.</i>"
  description         "Zadej příkazy, které budou dostupné v módu Strojvůdce."
}
username-ru           "Команды машинисту"
description-ru            "Задать команды, доступные машинисту."
string-table-ru {
  no-description          "Описание отсутствует."
  description         "Задать команды, доступные машинисту."
}
username-fr           "Ordres du conducteur"
string-table-fr {
  html_description2       "<b>Règle d'ordres du conducteur</b><br><br>
<b>Les ordres cochés seront disponibles en Conducteur:</b><br>"
  no-description          "<i>Pas de description disponible.</i>"
  description         "Définit les ordres disponibles pour les conducteurs."
}

DriverCommandRule.gs:

//
// DriverCommandRule.gs
//
//  Copyright (C) 2002 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"

//
// This rule allows the scenario-designer to edit the driver commands available in a profile.
//
class DriverCommandRule isclass ScenarioBehavior
{
  KUID[] driverCommands;  // array of KUIDs of the driver commands currently in this rule
  bool isDefault = true;      // set to true if this rule's properties have not been customised

  //
  // Resets the commands in the Trainz world to the ones this rule has.  Called by Pause()
  // when this behavior is unpaused to reset driver commands.
  //
  void CreateCommandsNow(void);

  void FillDefaults(void);

  //
  // ScenarioBehavior methods
  //

  //
  // Initialization method that sets the driver command array to being empty.
  //
  public void Init(Asset p_self)
  {
    inherited(p_self);

    driverCommands = new KUID[0];
  }

  //
  // Pause/unpause this behavior.  When unpaused, CreateCommandsNow() is called to reset
  // driver commands.
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused)
      CreateCommandsNow();
  }

  //
  // PropertyObject methods
  //

  //
  // Initializes the driver commands list of this rule from the given database.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    //
    // Clear any existing data
    //
    driverCommands = new KUID[0];

    //
    // Reload from the specified soup
    //
    Soup commands = soup.GetNamedSoup("commands");

    int i, count = commands.CountTags();
    for (i = 0; i < count; i++)
    {
      Soup commandInfo = commands.GetNamedSoup((string)i);
      driverCommands[i] = commandInfo.GetNamedTagAsKUID("kuid");
    }
    Interface.Log("DriverCommandRule.SetProperties> " + driverCommands.size() + " commands loaded");

    isDefault = !count and !soup.GetNamedTagAsInt("DriverCommandRule.modified");

      // this is a helper in case someone needs to know what commands are available
      // it may cause inconsistancies if multiple DriverCommandRules are present!
      // THIS IS A HACK - DONT RELY ON THIS IF AT ALL POSSIBLE
    if (World.GetCurrentModule() == World.SURVEYOR_MODULE)
      CreateCommandsNow();
  }

  //
  // Saves the KUIDs of the driver commands in this rule to a database and returns it.
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    Soup commands = Constructors.NewSoup();
    int i, count = driverCommands.size();
    for (i = 0; i < count; i++)
    {
      Soup commandInfo = Constructors.NewSoup();
      commandInfo.SetNamedTag("kuid", driverCommands[i]);
      commands.SetNamedSoup((string)i, commandInfo);
    }
    soup.SetNamedSoup("commands", commands);

    soup.SetNamedTag("DriverCommandRule.modified", !isDefault);

    Interface.Log("DriverCommandRule.GetProperties> " + driverCommands.size() + " commands saved");

    return soup;
  }

  public bool ListContainsKUID(KUID[] list, KUID it)
  {
    int i;
    for (i = 0; i < list.size(); i++)
      if (list[i] == it)
        return true;

    return false;
  }

  public bool ListRemoveKUID(KUID[] list, KUID it)
  {
    int i;
    for (i = 0; i < list.size(); i++)
      if (list[i] == it)
      {
        list[i, i+1] = null;
        return true;
      }

    return false;
  }

  public void ListAddKUID(KUID[] list, KUID it)
  {
    list[list.size()] = it;
  }

  //
  // Returns HTML code with hyperlinks that allows commands in this rule to be added/deleted.
  //
  public string GetDescriptionHTML(void)
  {
    if (isDefault)
      FillDefaults();

    StringTable strTable = GetAsset().GetStringTable();
    string list = "";
    int i;

    list = list + "<table>";

    Asset[] commandAssets = World.GetAssetList("DriverCommand");

    for (i = 0; i < commandAssets.size(); i++)
    {
      Asset commandAsset = commandAssets[i];
      KUID commandKUID = commandAsset.GetKUID();
      string commandName = commandAsset.GetName();
      string commandIcon = commandKUID.GetHTMLString();
      string description = commandAsset.GetStringTable().GetString("description");
      string url = "live://property/" + (string)i;
      string link = "<a href='" + url + "'>";

      if (description.size())
        description = BrowserInterface.Quote(description);
      else
        description = strTable.GetString("no-description");

      list = list + "<tr>";

      list = list + "<td>" + link;
      list = list + HTMLWindow.CheckBox( url, ListContainsKUID(driverCommands, commandKUID) );
      /*if (ListContainsKUID(driverCommands, commandKUID))
        list = list + "<img src='checkbox-on.tga'>";
      else
        list = list + "<img src='checkbox-off.tga'>";*/
      list = list + "</td>";

      list = list + "<td>" + link;
      list = list + "<img kuid='" + commandIcon + "' width=48 height=48>";
      list = list + "</a></td>";

      list = list + "<td>" + link;
      list = list + "<font color=#000000>" + BrowserInterface.Quote(commandName) + "</font></a><br>";
      list = list + "<font color=#000000 size=-4>" + description + "</font>";
      list = list + "</td>";

      list = list + "</tr>";

    }

/*

    for (i = 0; i < driverCommands.size(); i++)
    {
      Asset commandAsset = World.FindAsset(driverCommands[i]);
      KUID kuid = commandAsset.GetKUID();
      string icon = kuid.GetHTMLString();

      string commandName;

      if (commandAsset)
        commandName = commandAsset.GetName();
      else
        commandName = "<not installed>";

      list = list + "<tr><td width=5></td><td>";
      list = list + "<img kuid='" + icon + "' width=32 height=32> </td><td width=5></td><td><font color=#000000>" + BrowserInterface.Quote(commandName) + "</font>";
      list = list + "</td>";
      list = list + "<td width=5></td><td>";
      list = list + "<font color=#000000><a href=live://property/" + ((string)i) + ">" + strTable.GetString("html_description3") + "</a></font>";
      list = list + "</td></tr>";
    }
    */

    list = list + "</table>";

    //if (driverCommands.size() < 20)
//      list = list + strTable.GetString("html_description1");

    return "<html><body><font color=#000000>" + strTable.GetString("html_description2") + list + "</font></body></html>";
  }

  //
  // Gets user-friendly readable name for the named property.
  //
  string GetPropertyName(string p_propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();
    //if (p_propertyID == "add-object")
    //  return strTable.GetString("property_name_add");

    return "<null>";
  }

  //
  // Gets user-friendly readable description of named property.
  //
  string GetPropertyDescription(string p_propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();
    //if (p_propertyID == "add-object")
    //  return strTable.GetString("property_desc_add");

    return "<null>";
  }

  //
  // Gets the type for the named property.
  //
  string GetPropertyType(string p_propertyID)
  {
    //if (p_propertyID == "add-object")
    //  return "list";

    return "link";
  }

  //
  // Called by SetPropertValue and GetPropertyElementList to get the names of all of the
  // commands in the array.
  //
  /*void GetCommandNameKUIDList(string[] names, KUID[] kuids)
  {
    Asset[] commandAssets = World.GetAssetList("DriverCommand");

    int i, out = 0;
    for (i = 0; i < commandAssets.size(); i++)
    {
      KUID kuid = commandAssets[i].GetKUID();
      int n;

      for (n = 0; n < driverCommands.size(); n++)
        if (driverCommands[n] == kuid or driverCommands[n].GetName() == commandAssets[i].GetName() )
        {
          kuid = null;
          break;
        }

      if (kuid)
      {
        if (names)
          names[out] = commandAssets[i].GetName();
        if (kuids)
          kuids[out] = kuid;

        out++;
      }
    }
  }*/

  //
  // Sets the value of the named property.
  //
  /*void SetPropertyValue(string p_propertyID, string p_value)
  {
    if (p_propertyID == "add-object")
    {
      string[] names = new string[0];
      KUID[] kuids = new KUID[0];

      GetCommandNameKUIDList(names, kuids);
      int i;

      for (i = 0; i < names.size(); i++)
        if (names[i] == p_value)
        {
          driverCommands[driverCommands.size()] = kuids[i];
          return;
        }
    }
  }*/

  //
  // Respond to a hyper-link click on the named property.
  //
  void LinkPropertyValue(string p_propertyID)
  {
    isDefault = false;

    int index = Str.ToInt(p_propertyID);
    //driverCommands[index, index + 1] = null;

    Asset[] commandAssets = World.GetAssetList("DriverCommand");
    KUID commandKUID = commandAssets[index].GetKUID();

    if (ListRemoveKUID(driverCommands, commandKUID))
    {
      // an item was removed
    }
    else
    {
      // add an item
      ListAddKUID(driverCommands, commandKUID);
    }

      // this is a helper in case someone needs to know what commands are available
      // it may cause inconsistancies if multiple DriverCommandRules are present!
      // THIS IS A HACK - DONT RELY ON THIS IF AT ALL POSSIBLE
    CreateCommandsNow();
  }

  //
  // Gets a list of elements the user can select for the named property.
  //
  public string[] GetPropertyElementList(string p_propertyID)
  {
    string[] ret = new string[0];

    //if (p_propertyID == "add-object")
    //  GetCommandNameKUIDList(ret, null);

    return ret;
  }

  //
  // Resets the commands in the Trainz world to the ones this rule has.  Called by Pause()
  // when this behavior is unpaused to reset driver commands.
  //
  void CreateCommandsNow(void)
  {
    if (isDefault)
      FillDefaults();

    //
    // Reset the driver commands list
    //
    int i, count = driverCommands.size();

    DriverCommand[] dcs = World.GetDriverCommandList();
    for (i = 0; i < dcs.size(); i++)
      World.RemoveDriverCommand(dcs[i]);

    Interface.Log("DriverCommandRule.CreateCommandsNow> " + dcs.size() + " commands removed");

    for (i = 0; i < count; i++)
    {
      Asset commandAsset = World.FindAsset(driverCommands[i]);

      if (commandAsset)
        World.AddDriverCommand(commandAsset);
    }

    Interface.Log("DriverCommandRule.CreateCommandsNow> " + driverCommands.size() + " commands added");
  }

  void FillDefaults(void)
  {
    Asset asset = GetAsset();

    driverCommands = new KUID[11];

    driverCommands[0] = asset.LookupKUIDTable("drive-to-command");
    driverCommands[1] = asset.LookupKUIDTable("drive-to-trackmark-command");
    driverCommands[2] = asset.LookupKUIDTable("drive-via-trackmark-command");
    driverCommands[3] = asset.LookupKUIDTable("drive-schedule-command");
    driverCommands[4] = asset.LookupKUIDTable("load-command");
    driverCommands[5] = asset.LookupKUIDTable("unload-command");
    driverCommands[6] = asset.LookupKUIDTable("couple-command");
    driverCommands[7] = asset.LookupKUIDTable("decouple-command");
    driverCommands[8] = asset.LookupKUIDTable("runaround-command");
    driverCommands[9] = asset.LookupKUIDTable("wait-for-command");
    driverCommands[10] = asset.LookupKUIDTable("notify-command");

    isDefault = true;
  }

  public void AppendDependencies(KUIDList io_dependencies)
  {
    inherited(io_dependencies);

    int i;
    for (i = 0; i < driverCommands.size(); i++)
      io_dependencies.AddKUID(driverCommands[i]);
  }

};


Driver Command Check
[Rules]

Driver Command Check Rule

config.txt:

﻿
username            "Driver Command Check"
kind              "behavior"
kuid              <kuid:-18:1251>
script              "DriverCommandCheckRule"
class             "DriverCommandCheckRule"
icon-texture            "driver_command_check.texture"
string-table {
  description         "Verifies the driver commands of a driver character."
  driver-cmd-run-once-html-checkbox   "Trigger rule once"
  driver-cmd-run-once-html-prefix     "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=1></td><td><font color=#000000>"
  driver-cmd-run-once-html-sufix      "</font></td></tr></table>"
  driver-char-asset-type        "drivercharacter"
  driver-char-asset-html-property     "Driver character to watch the commands list of: $0"
  driver-char-blank-string      "<i>click to select</i>"
  driver-char-html-prefix       "<table cellpadding=0 cellspacing=0><tr><td width=3></td><td><font color=#000000>"
  driver-char-html-sufix        "</font></td></tr></table>"
  driver-char-name-assetname      "Drivers"
  driver-char-desc-assetname      "Driver Characters"
  commands-list-display-name      "Wait for a driver character to have a command list that matches this:<br>"
  commands-list-blank-string      "<i>click to select</i>"
  commands-list-html-prefix     "<table cellpadding=0 cellspacing=0><tr><td width=4></td><td><font color=#000000>"
  commands-list-html-sufix      "</font></td></tr></table><br><br>"
  commands-list-html-table-row-odd    "bgcolor=#CCCCAA22"
  commands-list-html-table-row-even   "bgcolor=#CCCCAA44"
  commands-list-column0       "<font color=#000000><i>Driver Command</i></font>&nbsp;&nbsp;"
  commands-list-delete        "<font color=#000000>Remove</font>"
  commands-list-add       "Add Driver Command"
  commands-list-name-add        "Driver Commands"
  commands-list-desc-add        "Driver command to add to list"
  commands-list-add-all       "Add All"
  commands-list-add-all-tooltip     "Add all driver commands to list"
  commands-list-delete-all      "Delete All"
  commands-list-delete-all-tooltip    "Delete all driver commands from list"
  command-list-item-asset-type      "drivercommand"
  command-list-item-asset-html-property   "$0"
  command-list-item-html-prefix     "<td bgcolor=#00000011><font color=#000000>"
  command-list-item-html-sufix      "&nbsp;&nbsp;</font></td>"
  command-list-item-name-assetname    "Driver Commands"
  command-list-item-desc-assetname    "Select a driver command"
}
username-fr           "Vérification ordre au conducteur"
string-table-fr {
  description         "Verifies the driver commands of a driver character."

  driver-cmd-run-once-html-checkbox   "Vérifie les ordres donnés à un conducteur spécifique."

  driver-char-asset-html-property     "Conducteur spécifique dont vous voulez vérifier les ordres : $0"
  driver-char-blank-string      "<i>Cliquez pour sélectionner</i>"
  driver-char-name-assetname      "Conducteurs"
  driver-char-desc-assetname      "Conducteurs spécifiques"

  commands-list-display-name      "Attendre qu'un conducteur spécifique ait une liste d'ordres correspondant à :<br>"
  commands-list-blank-string      "<i>Cliquez pour sélectionner</i>"
  commands-list-column0       "<font color=#000000><i>Ordre au conducteur</i></font>&nbsp;&nbsp;"
  commands-list-delete        "<font color=#000000>Retirer</font>"
  commands-list-add       "Ajouter ordre au conducteur"
  commands-list-name-add        "Ordres au conducteur"
  commands-list-desc-add        "Ordres au conducteur à ajouter à la liste"
  commands-list-add-all       "Ajouter tout"
  commands-list-add-all-tooltip     "Ajouter tous les ordres au conducteur à la liste"
  commands-list-delete-all      "Tout effacer"
  commands-list-delete-all-tooltip    "Effacer tous les ordres au conducteur de la liste"
  command-list-item-name-assetname    "Ordres au conducteur"
  command-list-item-desc-assetname    "Sélectionner un ordre au conducteur"
}

DriverCommandCheckRule.gs:

//
// DriverCommandCheckRule.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"
include "ListItemPropertyHandler.gs"
include "HTMLPropertyHandler.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"
include "DriverCommands.gs"
include "DriverCommand.gs"

//
// Extends the generic list handler to be a list of junctions.
//
class DriverCommandsListHandler isclass GenericListHandler
{
  int m_prefixCounter = 0; // accumelator used for saving/item ID purposes

  // work-around...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  Asset FindAsset(string assetName);

  //
  // Adds a new item to the list. Method well create appropriate sub-handler for it.
  //
  public void AddItem(string itemDisplayName)
  {
    // find the selected asset
    Asset chosenAsset = FindAsset(itemDisplayName);
    if (!chosenAsset) // not likely to happen (maybe even being paranoid) but just being safe
    {
      Interface.Log("# DriverCommandsListHandler.AddItem> ERROR: Can't find HTML asset '" + itemDisplayName + "'");
      return;
    }

    // create the new item, initialised with the chosen asset
    EnumeratedAssetHandler newItem = new EnumeratedAssetHandler();
    newItem.Init(m_hostAsset, "command-list-item");

    newItem.SetAsset(chosenAsset);

    // item handler prefix is based on a prefixCounter
    me.AddHandler(newItem, (string)m_prefixCounter);
    m_prefixCounter++;
  }

  Asset FindAsset(string assetName)
  {
    // find the selected asset
    Asset[] assets = World.GetAssetList("drivercommand");
    int i;

    for (i = 0; i < assets.size(); i++)
      if (assets[i].GetLocalisedName() == assetName)
        return assets[i];

    return null;
  }

  //
  // Property Handler methods
  //

  // special allowance for add-all
  public string[] GetPropertyElementList(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if ((property == "add")  or  (property == "add-all"))
    {
      Asset[] assets = World.GetAssetList("drivercommand");
      string[] retStrList = new string[assets.size()];

      int i;
      for (i = 0; i < assets.size(); i++)
        retStrList[i] = assets[i].GetLocalisedName();

      return retStrList;
    }
    return inherited(propertyID);
  }

  //
  // Re-creates the list of page items from the given soup.
  // Called by GenericListHandler.SetProperties() so no need to call yourself.
  //
  void ConstructHandlers(Soup listItemsSoup)
  {
    int i;
    for (i = 0; i < listItemsSoup.CountTags(); i++)
    {
      // construct and initialize the new item
      EnumeratedAssetHandler newItem = new EnumeratedAssetHandler();
      newItem.Init(m_hostAsset, "command-list-item");

      // get the sub-soup to set the item up with
      string prefixTag = listItemsSoup.GetIndexedTagName(i);
      Soup itemSoup = listItemsSoup.GetNamedSoup(prefixTag);
      newItem.SetProperties(itemSoup);

      // add the newly created item handler to this list group handler
      AddHandler(newItem, prefixTag);
    }
  }

  //
  // As each list item manages its own asset/name properties and items are handled by the parent
  // method, only the prefix counter is set from here.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);
    m_prefixCounter = soup.GetNamedTagAsInt("HTMLPageListHandler.prefixCounter");
  }

  //
  // As each list item manages its own asset/name properties and items are handled by the parent
  // method, only the prefix counter is saved here.
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();
    soup.SetNamedTag("HTMLPageListHandler.prefixCounter", m_prefixCounter);
    return soup;
  }

};

//
// Waits until the target driver has a commadn queue matching this rule's definition.
// Once that has been achieved, this rule completes itself without running any children.
//
// Every time the driver command check rule changes, it will be verified. If the verification
// fails, the child rules will be executed simultanously.
//
class DriverCommandCheckRule isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler            m_runOnlyOnceHandler;
  EnumeratedAssetHandler     m_driverCharacterHandler;
  DriverCommandsListHandler  m_driverCommandsHandler;
  HTMLPropertyGroup          m_groupHandler;

  bool m_childrenRunning = false;

  // local specific variables
  string[] m_prevCommandCache = new string[0];

  // method definitions
  int GetCheckResult(void);
  DriverCharacter GetDriverCharacter(void);
  string[] GetDriverCommandNames(DriverCharacter driver);

  bool VerifyCommands(string[] currentCommands);
  void ResetCmdCache(string[] currentCommands);

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property handler stuff
    m_runOnlyOnceHandler = new CheckBoxHandler();
    m_runOnlyOnceHandler.Init(me.GetAsset(), "driver-cmd-run-once");

    m_driverCharacterHandler = new EnumeratedAssetHandler();
    m_driverCharacterHandler.Init(me.GetAsset(), "driver-char");

    m_driverCommandsHandler = new DriverCommandsListHandler();
    m_driverCommandsHandler.Init(me.GetAsset(), "commands-list");

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_runOnlyOnceHandler, "runOnce/");
    m_groupHandler.AddHandler(m_driverCharacterHandler, "driverName/");
    m_groupHandler.AddHandler(m_driverCommandsHandler, "driverCommands/");

    SetPropertyHandler(m_groupHandler);
  }

  //
  // rescan our kiddies and update our progress
  //
  void UpdateChildren(Message notUsed)
  {
    // once we have completed, don't retry (unless we are reset)
    if (IsComplete()  or  IsPaused())
      return;

    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      if (child[i].WasComplete())
        child[i].Pause(true);
      else
      {
        // if he's already unpaused, this wont do any harm.
        child[i].Pause(false);
        return;
      }

    // If we got this far, all our children have completed.
    // This doesn't mean that they're currently complete; we dont go back to make sure.
    m_childrenRunning = false;
//    SetComplete(true);
  }

  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;

//Interface.Log("# DriverCommandCheckRule.ThreadPollCondition> Starting main thread on object '" + me.GetAsset().GetLocalisedName() + "':'" + me.GetId() + "'");

    // prepare driver cache (for first run, it is set to the initial commands of the driver, so the first
    // comparison won't fire off the child rules
    DriverCharacter driver = GetDriverCharacter();
    if (driver)
    {
      string[] currentCommands = GetDriverCommandNames(driver);
      ResetCmdCache(currentCommands);
    }

    // kick off the thread cycle
    PostMessage(me, "Timer", "Tick", 0.0);

// prepare cache based on current driver

    wait()
    {
      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()  and  m_runOnlyOnceHandler.GetBoolValue())
        {
          Interface.Log("# DriverCommandCheckRule.ThreadPollCondition> INFO: Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          if (m_runOnlyOnceHandler.GetBoolValue())
          {
            Interface.Log("# DriverCommandCheckRule.ThreadPollCondition> Rule is complete AND this is a run-once rule, so finish now?????????");
      //      break;
          }

          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 0.5); // 1.0 seconds delay wasn't really quick enough
          continue;
        }

        // has the commands list changed from last time?
        int checkResult = GetCheckResult();

        // rule's requirements are not fulfilled, but there was a change on the drivers list, so run child rules
        if (checkResult == 1)
        {
          Interface.Log("# DriverCommandCheckRule.ThreadPollCondition> INFO: Commands change detected, but is still incorrect, running child rules...");

          // if no children are running, then run them...
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
          }
        }

        // rule's requiresment are fulfilled so we can complete
        else if (checkResult == 2)
        {
          Interface.Log("# DriverCommandCheckRule.ThreadPollCondition> INFO: Rule command requirements fulfilled, completing rule!");
          SetComplete(true);
//          break;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 0.5);  // 1 second wasn't really quick enough
        continue;
      }
    } // wait

    m_pollingThreadRunning = false;
  }

  int GetCheckResult(void)
  {
    // find our driver and his/her list of commands
    DriverCharacter driver = GetDriverCharacter();
    string[] currentCommands = GetDriverCommandNames(driver);

    // check if the commands of the driver have changed from the previous occassion. If not, we assume nothing has
    // happened/needs to be done
    if (TrainUtil.CompareStrLists(currentCommands, m_prevCommandCache))
    {
      ResetCmdCache(currentCommands);
      return 0;
    }

    // otherwise, a change has occurred and we need to evaulate that and see if it is true or not
    else
    {
      // if we find a set of commands on a driver that matches, we return now - the first one found will
      // count as having passed the rule, thus any further possible matches will be ignored and no
      // further checks will take place
      if (VerifyCommands(currentCommands))
      {
        Router.PostMessage(me.GetId(), Router.MESSAGE_BROADCAST, "DriverCommandCheck", "Done", 0.0);
        Interface.Log("# DriverCommandCheckRule.GetCheckResult> Driver '" + driver.GetLocalisedName() + "' has matching commands, rule conditions met!");

        ResetCmdCache(currentCommands);
        return 2;
      }

      Interface.Log("# DriverCommandCheckRule.GetCheckResult> Driver '" + driver.GetLocalisedName() + "' command list has changed but not to this rule's requirements!");

      ResetCmdCache(currentCommands);
      return 1; // temp

          // is the driver's current commands list smaller than last time?
/*      if (currentCommands.size() < m_prevCommandCache.size())
      {
        Interface.Log("### Current commands list has shrunk since last check and doesn't match anyway, do nothing...");
        ResetCmdCache(currentCommands);
        return 0;
      }*/
/*    else if (currentCommands.size() > m_prevCommandCache.size())
      {
        Interface.Log("### Current commands list has expanded since last check and doesn't match, do something...");
        ResetCmdCache(currentCommands);
        return 1;
      }*/
/*    if (currentCommands.size() != m_driverCommandsHandler.CountItems())
      {
        Router.PostMessage(me.GetId(), Router.MESSAGE_BROADCAST, "DriverCommandCheck", "Fail", 0.0);
        return 1;
      } */

    }

    ResetCmdCache(currentCommands);
    return 0;
  }

  //
  // Gets the driver character that matches the asset selected. The first driver of that character asset
  // type encountered will be returned.
  //
  // Otherwise whatever drivers[0] happens to be as an alternative? (or null?)
  //
  DriverCharacter GetDriverCharacter(void)
  {
    DriverCharacter[] drivers = World.GetDriverCharacterList();
    int i;
    for (i = 0; i < drivers.size(); i++)
      if (drivers[i].GetAsset() == m_driverCharacterHandler.GetSelectedAssetRef())
        return drivers[i];

    return null;
  }

  string[] GetDriverCommandNames(DriverCharacter driver)
  {
    string[] retList = new string[0];
    if (driver)
    {
      DriverCommands driverCommands = driver.GetDriverCommands();
      if (driverCommands)
      {
        DriverScheduleCommand[] driverScheduleCommands = driverCommands.GetDriverScheduleCommands();
        int p;
        for (p = 0; p < driverScheduleCommands.size(); p++)
          retList[p] = driverScheduleCommands[p].GetDriverCommand().GetAsset().GetName();
      }
    }

    return retList;
  }

  //
  // Compares the list of given commands against this rule's command list handler. Returns true
  // if they match perfectly, false otherwise.
  //
  bool VerifyCommands(string[] currentCommands)
  {
    // no need to check further if the is a different amount
    if (currentCommands.size() != m_driverCommandsHandler.CountItems())
      return false;

    // do initial check on list
    int i;
    for (i = 0; i < currentCommands.size(); i++)
    {
      EnumeratedAssetHandler tempHandler = cast<EnumeratedAssetHandler> m_driverCommandsHandler.GetItem(i);
      if (tempHandler)
      {
        string handlerItemName = tempHandler.GetAssetName();
        if (handlerItemName != currentCommands[i])
        {
          Router.PostMessage(me.GetId(), Router.MESSAGE_BROADCAST, "DriverCommandCheck", "Fail", 0.0);
          return false;
        }
      }
    }

    return true;
  }

  // reset previous cache for next time
  void ResetCmdCache(string[] currentCommands)
  {
    m_prevCommandCache = new string[0];
    int q;
    for (q = 0; q < currentCommands.size(); q++)
      m_prevCommandCache[q] = currentCommands[q];
  }

};


Driver Main Menu Options
[Rules]

Driver Main Menu Options Rule

config.txt:

﻿
username            "Driver Main Menu Options"
kind              "behavior"
kuid              <kuid:-18:1211>
script              "DriverMainMenuOptions"
class             "DriverMainMenuOptions"
icon-texture            "driver_mainmenu_options.texture"
string-table {
  description_info_true       "<i>Show</i> the <i>Driver Main Menu Bar</i>."
  description_info_false        "<i>Hide</i> the <i>Driver Main Menu Bar</i>."
  driver-menu-onoff-html-property-true    "$0Show$1 the Driver Main Menu Bar."
  driver-menu-onoff-html-property-false   "$0Hide$1 the Driver Main Menu Bar."
  driver-menu-onoff-html-prefix     "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=3></td><td><font color=#000000>"
  driver-menu-onoff-html-sufix      "</font></td></tr></table>"
}
username-fr           "Options du menu principal du Conducteur"
string-table-fr {
  description_info_true       "<i>Afficher</i> la <i>barre du menu principal du Conducteur</i>."
  description_info_false        "<i>Masquer</i> la <i>barre du menu principal du Conducteur</i>."

  driver-menu-onoff-html-property-true    "$0Afficher$1 la barre du menu principal du Conducteur."
  driver-menu-onoff-html-property-false           "$0Masquer$1 la barre du menu principal du Conducteur."
}

DriverMainMenuOptions.gs:

//
// DriverMainMenuOptions.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "Interface.gs"

//
// Rule that enables/disables the specified buttons from the Driver Main Menu (located in the top-left
// corner of the Driver screen). Once the buttons are set, the rule completes.
//
class DriverMainMenuOptions isclass ScenarioBehavior
{
  // HTML property handler stuff
  GenericBoolHandler m_driverMenuHandler;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property handler stuff
    m_driverMenuHandler = new GenericBoolHandler();
    m_driverMenuHandler.Init(me.GetAsset(), "driver-menu-onoff");
    m_driverMenuHandler.SetBoolValue(true);

    SetPropertyHandler(m_driverMenuHandler);
  }

  //
  // When unpaused, set the main menu options as needed (in driver only)
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        Interface.Log("# DriverMainMenuOption.Pause> Setting visibility of Driver Main Menu visibility to: " + (string)m_driverMenuHandler.GetBoolValue());
        Interface.ShowDriverButtonMenu(m_driverMenuHandler.GetBoolValue());
      }
      SetComplete(true);
    }

  }

  public string GetDescription(void)
  {
    return GetAsset().GetStringTable().GetString("description_info_" + (string)m_driverMenuHandler.GetBoolValue());
  }

};


Driver Setup
[Rules]

Driver Setup Rule

config.txt:

﻿
username            "Driver Setup"
kind              "behavior"
kuid              <kuid:-16:2025>
script              "DriverSetupRule"
class             "DriverSetupRule"
string-table {
  html_no_vehicles_warning      "<font color=#FF0000>Warning: no valid, named, locomotives are available for driver placement.</font>"
  html_description_missing_asset      "<i>missing asset</i>"
  html_description_not_named      "<i>not named</i>"
  html_description_vehicle_remove     "remove"
  html_description_add_driver     "<a href=live://property/add-object>Add another Driver</a><br>"
  html_description        "<b>Driver Setup Rule</b><br><br>
<b>The following drivers will be available:</b><br><br>"
  html_description_1        "<font size=-2>Click on a driver photo to change drivers.</font><br>"
  str_property_name1        "Add new Driver"
  str_property_name2        "Select character"
  str_property_name3        "Select vehicle"
  str_property_name4        "Rename Driver"
  str_property_desc1        "Select Driver character"
  str_property_desc2        "Select Driver's vehicle"
  str_property_desc3        "Edit Driver's name"
  description         "Create the list of drivers for this session, and assign them their orders."
}
icon-texture            "driver_setup_type.texture"
username-de           "Fahrer-Setup"
string-table-de {
  html_no_vehicles_warning      "<font color=#FF0000>Warnung: Es sind keine gültigen, benannten Lokomotiven vorhanden, denen ein Fahrer zugewiesen werden kann.</font>"
  html_description_missing_asset      "<i>fehlender Gegenstand</i>"
  html_description_not_named      "<i>nicht benannt</i>"
  html_description_vehicle_remove     "entfernen"
  html_description_add_driver     "<a href=live://property/add-object>Add another Driver</a><br>"
  html_description        "<b>Fahrer-Setup-Regel</b><br><br>

<b>Die folgenden Fahrer werden verfügbar sein:</b><br><br>"
  html_description_1        "<font size=-2>Klicken Sie auf das Foto eines Fahrers, um den Fahrer zu wechseln.</font><br>"
  str_property_name1        "Neuen Fahrer hinzufügen"
  str_property_name2        "Charakter auswählen"
  str_property_name3        "Fahrzeug auswählen"
  str_property_name4        "Fahrer neu benennen"
  str_property_desc1        "Fahrercharakter auswählen"
  str_property_desc2        "Fahrzeug für Fahrer auswählen"
  str_property_desc3        "Fahrername bearbeiten"
  description         "Liste der Fahrer für diese Sitzung erstellen und diesen Befehle zuweisen."
}
username-it           "Regole impostazione macchinista"
string-table-it {
  html_description_missing_asset      "<i>oggetto mancante</i>"
  html_description_not_named      "<i>non rinominato</i>"
  html_description_vehicle_remove     "rimuovi"
  html_description_add_driver     "<a href=live://property/add-object>Aggiungi un altro macchinista</a><br><br>"
  html_description        "<b>Impostazioni regole macchinista</b><br><br>

<b>Sono disponibili i seguenti macchinisti:</b><br>"
  str_property_name1        "Aggiungi nuovo macchinista"
  str_property_name2        "Seleziona personaggio"
  str_property_name3        "Seleziona veicolo"
  str_property_name4        "Rinomina macchinista"
  str_property_desc1        "Seleziona personaggio macchinista"
  str_property_desc2        "Seleziona veicolo macchinista"
  str_property_desc3        "Modifica nome macchinista"
}
username-es           "Configuración del maquinista"
string-table-es {
  html_no_vehicles_warning      "<font color=#FF0000>Atención: no hay disponibles locomotoras designadas ni válidas para el emplazamiento del maquinista.</font>"
  html_description_missing_asset      "<i>falta componente</i>"
  html_description_not_named      "<i>sin nombre</i>"
  html_description_vehicle_remove     "eliminar"
  html_description_add_driver     "<a href=live://property/add-object>Añadir otro maquinista</a><br>"
  html_description        "<b>Regla de configuración del maquinista</b><br><br>

<b>The following drivers will be available:</b><br><br>"
  html_description_1        "<font size=-2>Clic en la foto de un maquinista para cambiarlo.</font><br>"
  str_property_name1        "Añadir nuevo maquinista"
  str_property_name2        "Seleccionar personaje"
  str_property_name3        "Seleccionar vehículo"
  str_property_name4        "Renombrar maquinista"
  str_property_desc1        "Selecciona el personaje del maquinista"
  str_property_desc2        "Selecciona el vehículo del maquinista"
  str_property_desc3        "Edita el nombre del maquinista"
  description         "Crea la lista de maquinistas para esta sesión y asígnales órdenes."
}
username-pl           "Zasady konfiguracji maszynisty"
string-table-pl {
  html_description_missing_asset      "<i>brak elementu</i>"
  html_description_not_named      "<i>brak nazwy</i>"
  html_description_vehicle_remove     "usuń"
  html_description_add_driver     "<a href=live://property/add-object>Dodaj następnego maszynistę</a><br><br>"
  html_description        "<b>Zasady konfiguracji maszynisty</b><br><br>

<b>Dostępni będą następujący maszyniści:</b><br>"
  str_property_name1        "Dodaj nowego maszynistę"
  str_property_name2        "Wybierz postać"
  str_property_name3        "Wybierz pojazd"
  str_property_name4        "Zmień dane maszynisty"
  str_property_desc1        "Wybierz postać maszynisty"
  str_property_desc2        "Wybierz postać maszynisty"
  str_property_desc3        "Zmodyfikuj personalia maszynisty"
}
username-cz           "Vytvoření strojvůdce"
string-table-cz {
  html_no_vehicles_warning      "<font color=#FF0000>Varování: nejsou dostupné žádné lokomotivy pro umístění strojvůdce.</font>"
  html_description_missing_asset      "<i>chybějící součást</i>"
  html_description_not_named      "<i>beze jména</i>"
  html_description_vehicle_remove     "odstranit"
  html_description_add_driver     "<a href=live://property/add-object>Přidat dalšího strojvůdce</a><br>"
  html_description        "<b>Pravidlo vytvoření strojvůdce</b><br><br>

<b>K dispozici jsou ti následující strojvůdci:</b><br><br>"
  html_description_1        "<font size=-2>Pro změnu strojvůdce klikni na jeho fotografii.</font><br>"
  str_property_name1        "Přidat nového strojvůdce"
  str_property_name2        "Zvol postavu"
  str_property_name3        "Zvol lokomotivu"
  str_property_name4        "Přejmenuj strojvůdce"
  str_property_desc1        "Zvol postavu"
  str_property_desc2        "Zvol lokomotivu"
  str_property_desc3        "Uprav jméno strojvůdce"
  description         "Vytvoř seznam strojvůdců pro tuto hru a zadej jim příkazy."
}
username-ru           "Список машинистов"
description-ru            "Создать список машинистов для данной сессии и выдать им указания."
string-table-ru {
  html_no_vehicles_warning      "Внимание: полноценные именованые локомотивы отсутствуют. Машинисту нечем управлять."
  html_description_missing_asset      "недостающий элемент"
  html_description_not_named      "нет имени"
  html_description_vehicle_remove     "убрать"
  html_description_add_driver     " Добавить машиниста

"
  html_description_1        "Для смены машиниста щелкните по его фотографии.
"
  str_property_name1        "Добавить машиниста"
  str_property_name2        "Выбрать персонаж"
  str_property_name3        "Выбрать поезд"
  str_property_name4        "Изменить имя"
  str_property_desc1        "Выбрать персонаж"
  str_property_desc2        "Выбрать поезд"
  str_property_desc3        "Изменить имя"
  description         "Создать список машинистов для данной сессии и выдать им указания."
}
username-fr           "Configuration conducteur"
string-table-fr {
  html_no_vehicles_warning      "<font color=#FF0000>Avertissement : aucune locomotive nommée valide n'est disponible pour y placer ce conducteur.</font>"
  html_description_missing_asset      "<i>objet manquant</i>"
  html_description_not_named      "<i>sans nom</i>"
  html_description_vehicle_remove     "Retirer"
  html_description_add_driver     "<a href=live://property/add-object>Ajoute un nouveau conducteur</a><br>"
  html_description        "<b>Règle de configuration conducteur</b><br><br>

<b>Les conducteurs suivants seront disponibles :</b><br><br>"
  html_description_1        "<font size=-2>Cliquez sur le portrait d'un conducteur pour en changer.</font><br>"
  str_property_name1        "Ajouter un nouveau conducteur"
  str_property_name2        "Sélectionner un personnage"
  str_property_name3        "Sélectionner un véhicule"
  str_property_name4        "Renommer un conducteur"
  str_property_desc1        "Permet de sélectionner le conducteur"
  str_property_desc2        "Permet de sélectionner le véhicule du conducteur"
  str_property_desc3        "Permet de modifier le nom du conducteur"
  description         "Créé la liste de conducteurs pour cette session et leur assigne leurs ordres."
}

DriverSetupRule.gs:

include "ScenarioBehavior.gs"
include "World.gs"
include "Browser.gs"

//
// DriverSetupRule
//
// This rule allows the scenario-designer to assign Drivers to Vehicles. The drivers are created
// whenever this rule becomes un-paused (usually at the beginning of the Driver session.).
//
class DriverSetupRule isclass ScenarioBehavior
{
  string[] driverVehicle;  // array of vehicles to assign drivers to
  KUID[] driverKuid;
  string[] driverName;
  DriverCommands[] driverCommands;
  bool isDefault = true;      // set to true if this rule's properties have not been customised

  thread void CreateDriversNow(void);
  void FillDefaults(void);

  //
  // ScenarioBehavior methods
  //

  public void Init(Asset p_self)
  {
    inherited(p_self);
    driverVehicle = new string[0];
    driverKuid = new KUID[0];
    driverName = new string[0];
    driverCommands = new DriverCommands[0];
    //commands = Constructors.NewDriverCommands();
  }

  //
  // PropertyObject methods
  //

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    //
    // Clear any existing data
    //
    driverVehicle = new string[0];
    driverKuid = new KUID[0];
    driverName = new string[0];
    driverCommands = new DriverCommands[0];

    //
    // Reload from the specified soup
    //
    Soup drivers = soup.GetNamedSoup("drivers");

    int i, count = drivers.CountTags();
    for (i = 0; i < count; i++)
    {
      Soup driverInfo = drivers.GetNamedSoup((string)i);
      driverVehicle[i] = driverInfo.GetNamedTag("vehicle");
      driverKuid[i] = driverInfo.GetNamedTagAsKUID("driver");
      driverName[i] = driverInfo.GetNamedTag("name");

      Soup driverCommandsProperties = driverInfo.GetNamedSoup("driver-commands");
      driverCommands[i] = Constructors.NewDriverCommands();
      driverCommands[i].SetProperties(driverCommandsProperties);
    }

    isDefault = !count and !soup.GetNamedTagAsInt("DriverSetupRule.modified");
  }

  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused)
      CreateDriversNow();
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    Soup drivers = Constructors.NewSoup();
    int i, count = driverVehicle.size();
    for (i = 0; i < count; i++)
    {
      Soup driverInfo = Constructors.NewSoup();
      driverInfo.SetNamedTag("vehicle", driverVehicle[i]);
      driverInfo.SetNamedTag("driver", driverKuid[i]);
      driverInfo.SetNamedTag("name", driverName[i]);

      Soup driverCommandsProperties = driverCommands[i].GetProperties();
      driverInfo.SetNamedSoup("driver-commands", driverCommandsProperties);

      if (driverCommands[i].GetDriverScheduleCommands().size())
        isDefault = false;

      drivers.SetNamedSoup((string)i, driverInfo);

    }

    if (isDefault)
      // don't bother saving anything out
      return soup;

    soup.SetNamedSoup("drivers", drivers);
    soup.SetNamedTag("DriverSetupRule.modified", true);

    return soup;
  }

  public string GetDescriptionHTML(void)
  {
    if (isDefault)
      FillDefaults();

    StringTable strTable = GetAsset().GetStringTable();
  string vehicles = "<br><table width=100%>";
    int i;

    if (driverVehicle.size() != 0)
      vehicles = strTable.GetString("html_description_1") + vehicles;

    Vehicle[] vehiclesArray = World.GetVehicleList();
    int validCount = 0;
    for (i = 0; i < vehiclesArray.size(); i++)
    {
      string name = vehiclesArray[i].GetName();

      if (name and name.size() and cast<Locomotive>(vehiclesArray[i]))
        validCount++;
    }

    if (!validCount)
      vehicles = strTable.GetString("html_no_vehicles_warning") + vehicles;

    for (i = 0; i < driverVehicle.size(); i++)
    {
      KUID kuid = driverKuid[i];
      string kuidString;
      if (kuid)
        kuidString = "<img kuid='" + kuid.GetHTMLString() + "' width=32 height=32>";
      else
        kuidString = strTable.GetString("html_description_missing_asset");

      string name = driverName[i];

      if (!name or name.size() == 0)
        name = strTable.GetString("html_description_not_named");
      else
        name = BrowserInterface.Quote(name);

      string bgcolor;
      if (i % 2)
        bgcolor = "#DDDDDD80";
      else
        bgcolor = "#FFFFBB80";

      vehicles = vehicles +
        "<tr bgcolor="+bgcolor+">" +
          "<td><font color=#000000>" +
            "<a href=live://property/driver/" + ((string)i) + ">" +
              kuidString +
            "</a>" +
          "</font></td>" +
          "<td><font color=#000000>" +
            "<a href=live://property/vehicle/" + ((string)i) + ">" +
              BrowserInterface.Quote(driverVehicle[i]) +
            "</a>" +
          "</font></td>" +
          "<td><font color=#000000>" +
            "<a href=live://property/name/" + ((string)i) + ">" +
              name +
            "</a>" +
          "</font></td>" +
          "<td width=5></td>" +
          "<td><font color=#000000>" +
            "<a href=live://property/remove/" + ((string)i) + ">" +
              strTable.GetString("html_description_vehicle_remove") +
            "</a>" +
          "</font></td>" +
        "</tr>";

      vehicles = vehicles + "<tr bgcolor="+bgcolor+"><td></td><td colspan=4 width=100%><trainz-object style='driver-order-bar' width=100% height=80 id='dcb"
        + (string)i + "'></trainz-object></td></tr>";
    }

    vehicles = vehicles + "</table>";

    //if (driverVehicle.size() < 7)
      vehicles = vehicles + strTable.GetString("html_description_add_driver");

    return  "<html><body><font color=#000000>" + strTable.GetString("html_description") + vehicles + "<br><br></font></body></html>";
  }

  public void PropertyBrowserRefresh(Browser browser)
  {
    inherited(browser);

    int i;
    for (i = 0; i < driverCommands.size(); i++)
      browser.SetElementObjectProperty("dcb" + (string)i, "driver-commands", cast<object> driverCommands[i]);
  }

  string GetPropertyName(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

  if (propertyID == "add-object")
      return strTable.GetString("str_property_name1");

    if (propertyID[0, 7] == "driver/")
      return strTable.GetString("str_property_name2");

    if (propertyID[0, 8] == "vehicle/")
      return strTable.GetString("str_property_name3");

    if (propertyID[0, 5] == "name/")
      return strTable.GetString("str_property_name4");

    return "<null>";
  }

  string GetPropertyDescription(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

  if (propertyID[0, 7] == "driver/")
    return strTable.GetString("str_property_desc1");

  if (propertyID[0, 8] == "vehicle/")
    return strTable.GetString("str_property_desc2");

  if (propertyID[0, 5] == "name/")
    return strTable.GetString("str_property_desc3");

    return "<null>";
  }

  string GetPropertyType(string propertyID)
  {
    if (propertyID == "add-object")
      return "list,1";

    if (propertyID[0, 7] == "driver/")
      return "list,1";

    if (propertyID[0, 8] == "vehicle/")
      return "list,1";

    if (propertyID[0, 5] == "name/")
      return "string";

    return "link";
  }

  void SetPropertyValue(string propertyID, string value)
  {
    if (propertyID[0, 5] == "name/")
    {
      string strIndex = propertyID;
      strIndex[0, 5] = null;
      int index = Str.ToInt(strIndex);

      driverName[index] = value;

      isDefault = false;
    }
  }

  void SetPropertyValue(string propertyID, string value, int valueIndex)
  {
    if (propertyID[0, 8] == "vehicle/")
    {
      string strIndex = propertyID;
      strIndex[0, 8] = null;
      int index = Str.ToInt(strIndex);

      driverVehicle[index] = value;

      isDefault = false;
    }

    if (propertyID[0, 7] == "driver/")
    {
      string strIndex = propertyID;
      strIndex[0, 7] = null;
      int index = Str.ToInt(strIndex);

      Asset driverAsset = World.GetAssetList("drivercharacter")[valueIndex];
      driverKuid[index] = driverAsset.GetKUID();
      driverName[index] = driverAsset.GetLocalisedName();

      isDefault = false;
    }

    if (propertyID == "add-object")
    {
      Asset driverAsset = World.GetAssetList("drivercharacter")[valueIndex];

      driverVehicle[driverVehicle.size()] = "vehicle";
      driverKuid[driverKuid.size()] = driverAsset.GetKUID();
      driverName[driverName.size()] = driverAsset.GetLocalisedName();
      driverCommands[driverCommands.size()] = Constructors.NewDriverCommands();

      isDefault = false;
      return;
    }
  }

  void LinkPropertyValue(string propertyID)
  {
  /*
    if (propertyID == "add-object")
    {
      Asset driverAsset = World.GetAssetList("drivercharacter")[0];

      driverVehicle[driverVehicle.size()] = "vehicle";
      driverKuid[driverKuid.size()] = driverAsset.GetKUID();
      driverName[driverName.size()] = driverAsset.GetLocalisedName();

      return;
    }
    */

    if (propertyID[0, 7] == "remove/")
    {
      string strIndex = propertyID;
      strIndex[0, 7] = null;
      int index = Str.ToInt(strIndex);

      driverVehicle[index, index+1] = null;
      driverKuid[index, index+1] = null;
      driverName[index, index+1] = null;
      driverCommands[index, index+1] = null;

      isDefault = false;
    }
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    string[] ret = new string[0];

    if (propertyID[0, 8] == "vehicle/")
    {
      Vehicle[] vehicles = World.GetVehicleList();

      int i, out = 0;
      for (i = 0; i < vehicles.size(); i++)
      {
        string name = vehicles[i].GetName();

        if (name and name.size() and cast<Locomotive>(vehicles[i]))
        {
          int n;
          for (n = 0; n < driverVehicle.size(); n++)
            if (driverVehicle[n] == name)
            {
              name = null;
              break;
            }

          if (name)
            ret[out++] = name;
        }
      }
    }

    if ((propertyID[0, 7] == "driver/") or (propertyID[0,11] == "add-object"))
    {
      Asset[] drivers = World.GetAssetList("drivercharacter");

      int i;
      for (i = 0; i < drivers.size(); i++)
        ret[i] = drivers[i].GetLocalisedName();
    }

    return ret;
  }

  // Reset the drivers list.
  // (ceeb040331 made this threaded in case someone issues a DriverSchedule rule immed after a 'Drive To Schedule' command)
  thread void CreateDriversNow(void)
  {
    if (isDefault)
      FillDefaults();

    // allow a timeslice to go by before we do anything
    // this allows any other rules which need to execute first to do their stuff.
    PostMessage(me, "DriverSetupRule.Timer", "Tick", 0.0f);
    wait()
    {
    on "DriverSetupRule.Timer", "Tick":
      break;
    }
    //

    int i, count = driverVehicle.size();

    DriverCharacter[] dcs = World.GetDriverCharacterList();
    for (i = 0; i < dcs.size(); i++)
      World.RemoveDriverCharacter(dcs[i]);

    bool first = true;

    for (i = 0; i < count; i++)
    {
      Vehicle vehicle = cast<Vehicle>(Router.GetGameObject(driverVehicle[i]));
      Asset asset;
      DriverCharacter dc;
      KUID kuid = driverKuid[i];

      if (kuid)
        asset = World.FindAsset(kuid);
      if (asset)
        dc = World.AddDriverCharacter(asset);

      if (dc)
      {
        if (vehicle)
          dc.SetLocation(vehicle);

        if (driverName[i] and driverName[i].size())
          dc.SetLocalisedName(driverName[i]);

        dc.SetDriverCommands(driverCommands[i]);
        dc.SetRunningCommands(true);
      }

      if (first and vehicle)
      {
        first = false;
        World.SetCamera(vehicle, World.CAMERA_EXTERNAL);
        World.SetCameraAngle(78, -17, 142);
      }
    }

    Router.PostMessage(me.GetId(), Router.MESSAGE_BROADCAST, "DriverSetup", "CharactersDone", 0.0);

    SetComplete(true);
  }

  //
  // Reset our configuration to a "default" based on the current layout.
  //
  void FillDefaults(void)
  {
    driverVehicle = new string[0];
    driverKuid = new KUID[0];
    driverName = new string[0];
    driverCommands = new DriverCommands[0];

    Train[] trainList = World.GetTrainList();
    Asset[] driversList = World.GetAssetList("DriverCharacter");
    int driverIndex = 0;

    if (!driversList.size())
    {
      Interface.Log("DriverSetupRule.FillDefaults> no drivers available");
      return;
    }

    int i;
    for (i = 0; i < trainList.size(); i++)
    {
      Train train = trainList[i];
      Locomotive loco = train.GetFrontmostLocomotive();

      if (!loco)
        continue;

      Asset driverAsset = driversList[driverIndex];
      driverIndex = (driverIndex + 1) % driversList.size();

      driverVehicle[driverVehicle.size()] = loco.GetName();
      driverKuid[driverKuid.size()] = driverAsset.GetKUID();
      driverName[driverName.size()] = driverAsset.GetLocalisedName();
      driverCommands[driverCommands.size()] = Constructors.NewDriverCommands();
    }

    isDefault = true;
  }

  public void AppendDependencies(KUIDList io_dependencies)
  {
    inherited(io_dependencies);

    int i;
    for (i = 0; i < driverKuid.size(); i++)
    {
      io_dependencies.AddKUID(driverKuid[i]);
      driverCommands[i].AppendDependencies(io_dependencies);
    }
  }

};


Enable/Disable Driver Commands
[Rules]

Enable/Disable Driver Commands Rule

config.txt:

﻿
username            "Enable/Disable Driver Commands"
kind              "behavior"
kuid              <kuid:-18:1236>
script              "EnableDisableDriverCommands"
class             "EnableDisableDriverCommands"
icon-texture            "enabledisable_driver_commands.texture"
string-table {
  description         "Enable/disable specific driver commands on certain drivers."
  description_html        "Enable/disable specific driver commands on certain drivers."
  driver-cmd-mode-html-property-true    "<font color=#000000>$0Enable$1 the following driver commands for all driver characters on trains that match the criteria further below:</font>"
  driver-cmd-mode-html-property-false   "<font color=#000000>$0Disable$1 the following driver commands for all driver characters on trains that match the criteria further below:</font>"
  driver-cmd-mode-html-bool-true      "enabled"
  driver-cmd-mode-html-bool-false     "disabled"
  driver-cmd-mode-html-prefix     "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=4></td><td><font color=#000000>"
  driver-cmd-mode-html-sufix      "</font></td></tr>"
  driver-cmd-list-asset-type      "drivercommand"
  driver-cmd-list-display-name
  driver-cmd-list-html-prefix     "<tr><td width=4></td><td><font color=#000000>"
  driver-cmd-list-html-sufix      "</font></td></tr></table>"
}
kuid-table {
  driver_module         <kuid:-16:10240>
  driver-setup-rule       <kuid:-16:2025>
}
username-fr           "Activation/Désactivation des ordres au conducteur""
string-table-fr {
  description         "Active/Désactive certains ordres au conducteur pour des conducteurs spécifiques."
  description_html        "Active/Désactive certains ordres au conducteur pour des conducteurs spécifiques."

  driver-cmd-mode-html-property-true    "<font color=#000000>$0Active$1 tous les ordres au conducteur suivants, pour tous les conducteurs de trains correspondant aux critères ci-après :</font>"
  driver-cmd-mode-html-property-false   "<font color=#000000>$0Désactive$1 tous les ordres au conducteur suivants, pour tous les conducteurs de trains correspondant aux critères ci-après :</font>"
  driver-cmd-mode-html-bool-true      "activé"
  driver-cmd-mode-html-bool-false     "désactivé"
}

EnableDisableDriverCommands.gs:

//
// EnableDisableHUDIcons.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "TrainHelperInfo.gs"
include "ScenarioBehavior.gs"

//
// Extends AssetCheckListHandler to provide the driver command descriptions as tooltips on each checkbox link.
// This is mainly to prevent confusion when you have commands with the same/similar names.
//
class DriverCmdCheckListHandler isclass AssetCheckListHandler
{
  // crude workarounds, but needed :-/
  public void Init(Asset asset, string itemPrefix) { inherited(asset, itemPrefix); }

  string GetAssetURL(int assetIndex)
  {
    if (m_assetList[assetIndex])
    {
      string toolTip = m_assetList[assetIndex].GetStringTable().GetString("description");
      if (toolTip.size())
        return Link("itemSetting/" + assetIndex + "' tooltip='" + toolTip);
    }

    return Link("itemSetting/" + assetIndex);
  }

  public string GetDescriptionHTML(void)
  {
    string htmlBody = "";
    if (m_displayName.size())
      htmlBody = m_displayName + "<br>";

    int i;
    for (i = 0; i < m_itemSettings.size(); i++)
      htmlBody = htmlBody + HTMLWindow.CheckBox(GetAssetURL(i), m_itemSettings[i])
                          + " " + m_assetList[i].GetLocalisedName() + "<br>";

    return m_htmlPrefix + htmlBody + m_htmlSufix;
  }

};

//
// Rule that enables/disables the designated commands and completes once that is done without running any
// child rules.
//
class EnableDisableDriverCommands isclass ScenarioBehavior
{
  // HTML property handler stuff
  GenericBoolHandler        m_enableDisableHandler;
  DriverCmdCheckListHandler m_driverCommandsHandler;
  TrainHelperInfo           m_trainFilterInfo;
  HTMLPropertyGroup         m_groupHandler;

  thread void ApplyToTrains(void);

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property info handler stuff
    m_enableDisableHandler = new GenericBoolHandler();
    m_enableDisableHandler.Init(me.GetAsset(), "driver-cmd-mode", true);

    m_driverCommandsHandler = new DriverCmdCheckListHandler();
    m_driverCommandsHandler.Init(me.GetAsset(), "driver-cmd-list");

    m_trainFilterInfo = new TrainHelperInfo();
    m_trainFilterInfo.Init();

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_enableDisableHandler, "enableDisableMode/");
    m_groupHandler.AddHandler(m_driverCommandsHandler, "driverCharacter/");
    m_groupHandler.AddHandler(m_trainFilterInfo, "trainfilter/");

    SetPropertyHandler(m_groupHandler);
  }

  //
  // When unpaused, set the options as needed (in driver only)
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        Interface.Log("# EnableDisableDriverCommands.Pause> Unpaused and in driver, '" + m_enableDisableHandler.GetBoolDisplayValue() + " driver commands...");
        ApplyToTrains();
      }
  }

  thread void ApplyToTrains(void)
  {
    KUID driverSetupKUID = me.GetAsset().LookupKUIDTable("driver-setup-rule");
    if (!driverSetupKUID)
    {
      Interface.Log("# EnableDisableDriverCommands.ApplyToTrains> ERROR: can't find KUID for 'driver-setup-rule' in config file!");
      return;
    }

    // is there a DriverSetup rule? If so, and it is still running, wait for it to complete.
    ScenarioBehavior[] sessionRules = World.GetBehaviors();
    int i;
    for (i = 0; i < sessionRules.size(); i++)
      if (sessionRules[i].GetAsset().GetKUID() == driverSetupKUID)
      {
        if (!sessionRules[i].IsComplete())
          wait()
          {
            on "DriverSetup", "CharactersDone":
              break;
          }

        break;
      }

    // prepare stuff so we can enable/disable the driver commands
    Train[] trains = World.GetTrainList();
    Asset[] allowedCommands = m_driverCommandsHandler.GetSettingAssets(m_enableDisableHandler.GetBoolValue());
    KUID[] allowedCommandsKUID = new KUID[0];

    for (i = 0; i < allowedCommands.size(); i++)
      allowedCommandsKUID[i] = allowedCommands[i].GetKUID();

    // perform actual enabling/disabling on all drivers that can be found
    for (i = 0; i < trains.size(); i++)
      if (m_trainFilterInfo.DoesMatch(trains[i]))
      {
        // match found, check if this train has a driver...
        DriverCharacter trainDriver = trains[i].GetActiveDriver();
        if (trainDriver)
        {
          Interface.Log("# EnableDisableDriverCommands.ApplyToTrain> " + m_enableDisableHandler.GetBoolDisplayValue() + " commands for driver: '" + trainDriver.GetLocalisedName() + "'");
          trainDriver.SetDriverCommandFilter(allowedCommandsKUID);
        }
      }

    SetComplete(true);
  }

};


Enable/Disable HUD Icons
[Rules]

Enable/Disable HUD Icons Rule

config.txt:

﻿
username            "Enable/Disable HUD Icons"
kind              "behavior"
kuid              <kuid:-18:1212>
script              "EnableDisableHUDIcons"
class             "EnableDisableHUDIcons"
icon-texture            "enabledisable_hud_icons.texture"
string-table {
  description         "Enables or disables HUD icons."
  description_html        "Enables or disables HUD icons."
  hud-icons-enable-html-property-true   "$0Enable$1 the following HUD icons:"
  hud-icons-enable-html-property-false    "$0Disable$1 the following HUD icons:"
  hud-icons-enable-html-prefix      "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=3></td><td><font color=#000000>"
  hud-icons-enable-html-sufix     "</font></td></tr></table>"
  panel-bottom-right-display-name     "Bottom Right Menu:"
  panel-bottom-right-html-prefix      "<table cellpadding=0 cellspacing=0><tr><td width=3></td><td><font color=#000000>"
  panel-bottom-right-html-sufix     "</font></td></tr></table>"
  panel-bottom-right-item0      "message"
  panel-bottom-right-item1      "minimap"
  panel-bottom-right-item2      "commodities"
  panel-bottom-right-item3      "decouple"
  panel-bottom-right-item4      "waybills"
  panel-bottom-right-item5      "schedule"
  panel-bottom-right-item6      "help"
  panel-bottom-right-item-message     "Messages"
  panel-bottom-right-item-minimap     "Map"
  panel-bottom-right-item-commodities   "Commodities"
  panel-bottom-right-item-decouple    "Decoupling"
  panel-bottom-right-item-waybills    "Waybill"
  panel-bottom-right-item-schedule    "View Schedule"
  panel-bottom-right-item-help      "View Driver Help"
  panel-camera-controls-display-name    "Camera Controls:"
  panel-camera-controls-html-prefix   "<table cellpadding=0 cellspacing=0><tr><td width=3></td><td><font color=#000000>"
  panel-camera-controls-html-sufix    "</font></td></tr></table>"
  panel-camera-controls-item0     "cab_View"
  panel-camera-controls-item1     "chase_View"
  panel-camera-controls-item2     "traking_View"
  panel-camera-controls-item3     "free_roaming_View"
  panel-camera-controls-item-cab_view   "Cab View"
  panel-camera-controls-item-chase_view   "Chase View"
  panel-camera-controls-item-traking_view   "Tracking View"
  panel-camera-controls-item-free_roaming_view  "Free Roaming"
  panel-dcc-controls-display-name     "DCC Controls:"
  panel-dcc-controls-html-prefix      "<table cellpadding=0 cellspacing=0><tr><td width=3></td><td><font color=#000000>"
  panel-dcc-controls-html-sufix     "</font></td></tr></table><br><br>"
  panel-dcc-controls-item0      "pants"
  panel-dcc-controls-item1      "lights"
  panel-dcc-controls-item2      "horn"
  panel-dcc-controls-item3      "stop"
  panel-dcc-controls-item-pants     "Pantographs"
  panel-dcc-controls-item-lights      "Lights"
  panel-dcc-controls-item-horn      "Horn"
  panel-dcc-controls-item-stop      "Stop"
}
kuid-table {
  driver_module         <kuid:-16:10240>
}
username-fr           "Activation/Désactivation d'icônes ATH"
string-table-fr {
  description         "Active ou désactive des icônes ATH."
  description_html        "Active ou désactive des icônes ATH."

  hud-icons-enable-html-property-true   "$0Actives$1 les icônes ATH suivantes :"
  hud-icons-enable-html-property-false    "$0Désactive$1 les icônes ATH suivantes :"

  panel-bottom-right-display-name     "Menu inférieur droit :"
  panel-bottom-right-item-message     "Message"
  panel-bottom-right-item-minimap     "Carte"
  panel-bottom-right-item-commodities   "Marchandises"
  panel-bottom-right-item-decouple    "Dételage"
  panel-bottom-right-item-waybills    "Feuille de route"
  panel-bottom-right-item-schedule    "Voir horaire"
  panel-bottom-right-item-help      "Voir aide conducteur"

  panel-camera-controls-display-name    "Commandes de la caméra :"
  panel-camera-controls-item-cab_view   "Vue cabine"
  panel-camera-controls-item-chase_view   "Vue extérieure"
  panel-camera-controls-item-traking_view   "Vue poursuite"
  panel-camera-controls-item-free_roaming_view  "Caméra libre"

  panel-dcc-controls-display-name     "Commandes DCC :"
  panel-dcc-controls-item-pants     "Pantographes"
  panel-dcc-controls-item-lights      "Phares"
  panel-dcc-controls-item-horn      "Sirène"
  panel-dcc-controls-item-stop      "Arrêt"
}

EnableDisableHUDIcons.gs:

//
// EnableDisableHUDIcons.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"

//
// ??
//
class EnableDisableHUDIcons isclass ScenarioBehavior
{
  // HTML property handler stuff
  HTMLPropertyGroup        m_enableDisableHUDIconsHandler;
  GenericBoolHandler       m_enableDisableHandler;
  CheckListPropertyHandler m_bottomRightHandler, m_cameraControlsHandler, m_dccControlsHandler;

//  void CallLibrary(CheckListPropertyHandler theHandler);
  thread void CallLibrary(CheckListPropertyHandler theHandler);

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property info handler stuff
    m_enableDisableHandler = new GenericBoolHandler();
    m_enableDisableHandler.Init(me.GetAsset(), "hud-icons-enable", true);

    m_bottomRightHandler = new CheckListPropertyHandler();
    m_bottomRightHandler.Init(me.GetAsset(), "panel-bottom-right");

    m_cameraControlsHandler = new CheckListPropertyHandler();
    m_cameraControlsHandler.Init(me.GetAsset(), "panel-camera-controls");

    m_dccControlsHandler = new CheckListPropertyHandler();
    m_dccControlsHandler.Init(me.GetAsset(), "panel-dcc-controls");

    m_enableDisableHUDIconsHandler = new HTMLPropertyGroup();
    m_enableDisableHUDIconsHandler.AddHandler(m_enableDisableHandler, "enableDisableMode/");
    m_enableDisableHUDIconsHandler.AddHandler(m_bottomRightHandler, "bottomRightMenu/");
    m_enableDisableHUDIconsHandler.AddHandler(m_cameraControlsHandler, "cameraControls/");
    m_enableDisableHUDIconsHandler.AddHandler(m_dccControlsHandler, "dccControls/");

    SetPropertyHandler(m_enableDisableHUDIconsHandler);
  }

  //
  // When unpaused. set the options as needed (in driver only?)
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        Interface.Log("# EnableDisableHUDIcons.Pause> unpaused and in driver, setting HUD panel button states");

        CallLibrary(m_bottomRightHandler);
        CallLibrary(m_cameraControlsHandler);
        CallLibrary(m_dccControlsHandler);
      }

      SetComplete(true);
    }
  }

//  void CallLibrary(CheckListPropertyHandler theHandler)
  thread void CallLibrary(CheckListPropertyHandler theHandler)
  {
    // library to access driver module
    KUID driverModuleKUID = me.GetAsset().LookupKUIDTable("driver_module");

    if (driverModuleKUID)
    {
      Library driverModuleLib = World.GetLibrary(driverModuleKUID);

      if (driverModuleLib)
      {
        string[] libParam = new string[1];

        // we use the prefix as the panel name so it matches the Library call requirements
        libParam[0] = theHandler.GetConfigPrefix();

        // get list of panel items to enable/disable
        string[] checkedItemsList = theHandler.GetSettingNames(true);
        libParam[1,] = checkedItemsList;

        // special bit for camera controls only!
        if (theHandler == m_cameraControlsHandler)
        {
          int i;
          for (i = 1; i < libParam.size(); i++)
            libParam[i] = TrainUtil.StrSubst(libParam[i], "_", " ");
        }

        // enable or disable?
        string hideShow = "enable-panel-item";
        if (!m_enableDisableHandler.GetBoolValue())
          hideShow = "disable-panel-item";

        driverModuleLib.LibraryCall(hideShow, libParam, null);
      }
      else
        Interface.Log("# EnableDisableHUDIcons.CallLibrary> ERROR: unable to find KUID for library asset 'driver_module'");
    }
    else
      Interface.Log("# EnableDisableHUDIcons.CallLibrary> ERROR: unable to load library asset 'driver_module'");

//    SetComplete(true);
  }

};


End Scenario
[Rules]

End Scenario Rule

config.txt:

﻿
kind              "behavior"
kuid              <kuid:-19:12198>
username            "End Scenario"
icon-texture            "icon.texture"
script              "EndScenario"
class             "EndScenario"
string-table {
  description         "When this rule is executed, the Session will end."
}
username-cz           "Konec scénáře"
string-table-cz {
  description         "Když je pravidlo spuštěno, hra je ukončena."
}
username-ru           "End Scenario"
string-table-ru {
  description         "When this rule is executed, the Session will end."
}
username-fr           "Fin de scénario"
string-table-fr {
  description         "Lorsque cette règle s'exécute, la session se termine."
}

EndScenario.gs:

include "ScenarioBehavior.gs"
include "World.gs"
include "SessionVariables.gs"

class EndScenario isclass ScenarioBehavior
{
  public void Init(Asset asset)
  {
    inherited(asset);

    SetStateFlags(DOES_COMPLETE, true);
  }

  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      World.EndScenario(0.0f);
      SetComplete(true);
    }
  }

  public string GetDescriptionHTML(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    string body = "<html><body><font color=#000000><p><b>End Scenario</b></p>";

    body = body + strTable.GetString0("description");

    body = body + "</font></body></html>";

    return body;
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string properties;

    properties = strTable.GetString0("description");

    return properties;
  }

};


Flash HUD Icon
[Rules]

Flash HUD Icon Rule

config.txt:

﻿
username            "Flash HUD Icon"
kind              "behavior"
kuid              <kuid:-18:1213>
script              "FlashHUDIcon"
class             "FlashHUDIcon"
icon-texture            "flash_hud_icon.texture"
string-table {
  description         "Flashes an icon on a Driver HUD panel."
  description_info_flashtime      "Flash the <i>''$0''</i> icon on the <i>''$1''</i> HUD Panel for <i>$2</i> seconds."
  description_info_startstop      "<i>$0</i> flashing the <i>''$1''</i> icon on the <i>''$2''</i> HUD panel."
  flash-icon-display-name       "<table cellspacing=0 cellpadding=0 border=0><tr><td width=1></td><td><font color=#000000>This rule flashes a HUD panel icon for a set duration of time or instructs a HUD panel icon to start/stop flashing.</font></td></tr></table>"
  flash-icon-html-prefix        "<table cellspacing=0 cellpadding=0 border=0><tr height=1></tr><tr><td width=3></td><td>"
  flash-icon-html-sufix       "</td></tr></table>"
  flash-icon-html-between-items     "<br>"
  flash-icon-time-html-property     "Flash the $0 icon on the $1 HUD Panel for a period of $2 seconds."
  flash-icon-time-html-prefix     "<font color=#000000>"
  flash-icon-time-html-sufix      "</font>"
  flash-icon-time-blank-string      "<i>click to select</i>"
  flash-icon-time-empty-sub-list      "Choose a HUD panel first!"
  flash-icon-time-name-duration     "Flash duration (seconds)"
  flash-icon-time-desc-duration     "Duration of icon flash in seconds"
  flash-icon-time-name-itemname     "HUD Panel"
  flash-icon-time-desc-itemname     "HUD Panel to flash icon on"
  flash-icon-time-name-subitem      "Icon"
  flash-icon-time-desc-subitem      "Icon to flash"
  flash-icon-time-item0       "panel-bottom-right"
  flash-icon-time-item1       "panel-camera-controls"
  flash-icon-time-item2       "panel-dcc-controls"
  flash-icon-time-item3       "driver-main-menu"
  flash-icon-onoff-html-property      "$0 flashing the $1 icon on the $2 HUD panel."
  flash-icon-onoff-html-prefix      "<font color=#000000>"
  flash-icon-onoff-html-sufix     "</font>"
  flash-icon-onoff-blank-string     "<i>click to select</i>"
  flash-icon-onoff-empty-sub-list     "Choose a HUD panel first!"
  flash-icon-onoff-html-true      "Start"
  flash-icon-onoff-html-false     "Stop"
  flash-icon-onoff-name-itemname      "HUD Panel"
  flash-icon-onoff-desc-itemname      "HUD Panel to flash icon on"
  flash-icon-onoff-name-subitem     "Icon"
  flash-icon-onoff-desc-subitem     "Icon to flash"
  flash-icon-onoff-item0        "panel-bottom-right"
  flash-icon-onoff-item1        "panel-camera-controls"
  flash-icon-onoff-item2        "panel-dcc-controls"
  flash-icon-onoff-item3        "driver-main-menu"
  panel-bottom-right        "Bottom Right Menu"
  panel-camera-controls       "Camera Controls"
  panel-dcc-controls        "DCC Controls"
  driver-main-menu        "Driver Main Menu"
  panel-bottom-right-item0      "message"
  panel-bottom-right-item1      "minimap"
  panel-bottom-right-item2      "commodities"
  panel-bottom-right-item3      "decouple"
  panel-bottom-right-item4      "waybills"
  panel-bottom-right-item5      "schedule"
  panel-bottom-right-item6      "help"
  panel-bottom-right-item-message     "Messages"
  panel-bottom-right-item-minimap     "Map"
  panel-bottom-right-item-commodities   "Commodities"
  panel-bottom-right-item-decouple    "Decoupling"
  panel-bottom-right-item-waybills    "Waybill"
  panel-bottom-right-item-schedule    "View Schedule"
  panel-bottom-right-item-help      "View Driver Help"
  panel-camera-controls-item0     "cab_View"
  panel-camera-controls-item1     "chase_View"
  panel-camera-controls-item2     "traking_View"
  panel-camera-controls-item3     "free_roaming_View"
  panel-camera-controls-item-cab_view   "Cab View"
  panel-camera-controls-item-chase_view   "Chase View"
  panel-camera-controls-item-traking_view   "Tracking View"
  panel-camera-controls-item-free_roaming_view  "Free Roaming"
  panel-dcc-controls-item0      "pants"
  panel-dcc-controls-item1      "lights"
  panel-dcc-controls-item2      "horn"
  panel-dcc-controls-item3      "stop"
  panel-dcc-controls-item-pants     "Pantographs"
  panel-dcc-controls-item-lights      "Lights"
  panel-dcc-controls-item-horn      "Horn"
  panel-dcc-controls-item-stop      "Stop"
  driver-main-menu-item0        "exit"
  driver-main-menu-item1        "pause"
  driver-main-menu-item2        "save"
  driver-main-menu-item3        "performance"
  driver-main-menu-item4        "metric-imp"
  driver-main-menu-item5        "find"
  driver-main-menu-item6        "help"
  driver-main-menu-item-exit      "Exit"
  driver-main-menu-item-pause     "Pause"
  driver-main-menu-item-save      "Save"
  driver-main-menu-item-performance   "Performance Settings"
  driver-main-menu-item-metric-imp    "Imperial/Metric"
  driver-main-menu-item-find      "Find"
  driver-main-menu-item-help      "On Screen Help"
}
kuid-table {
  driver_module         <kuid:-16:10240>
}
username-fr           "Clignotement icône ATH"
string-table-fr {
  description         "Fait clignoter une icône de panneau ATH du Conducteur."
  description_info_flashtime      "Flash the <i>''$0''</i> icon on the <i>''$1''</i> HUD Panel for <i>$2</i> seconds."
  description_info_startstop      "Fait clignoter l'icône <i>''$0''</i> du panneau ATH <i>''$1''</i> pendant <i>$2</i> secondes."

  flash-icon-display-name       "<table cellspacing=0 cellpadding=0 border=0><tr><td width=1></td><td><font color=#000000>Cette règle fait clignoter une icône de panneau ATH pendant une durée déterminée ou donne l'ordre à une icône ATH de commencer/stopper le clignotement.</font></td></tr></table>"

  flash-icon-time-html-property     "Fait clignoter l'icône $0 sur le panneau ATH $1 pendant $2 secondes."
  flash-icon-time-blank-string      "<i>Cliquez pour sélectionner</i>"
  flash-icon-time-empty-sub-list      "Choisissez d'abord un panneau ATH !"
  flash-icon-time-name-duration     "Durée du clignotement (secondes)"
  flash-icon-time-desc-duration     "Durée du clignotement de l'icône en secondes"
  flash-icon-time-name-itemname     "Panneau ATH"
  flash-icon-time-desc-itemname     "Panneau ATH de l'icône à faire clignoter"
  flash-icon-time-name-subitem      "Icône"
  flash-icon-time-desc-subitem      "Icône à faire clignoter"

  flash-icon-onoff-html-property      "$0 clignotement de l'icône $1 du panneau ATH $2."
  flash-icon-onoff-blank-string     "<i>Cliquez pour sélectionner</i>"
  flash-icon-onoff-empty-sub-list     "Choisissez d'abord un panneau ATH !"
  flash-icon-onoff-html-true      "Début"
  flash-icon-onoff-html-false     "Fin"
  flash-icon-onoff-name-itemname      "Panneau ATH"
  flash-icon-onoff-desc-itemname      "Panneau ATH de l'icône à faire clignoter"
  flash-icon-onoff-name-subitem     "Icône"
  flash-icon-onoff-desc-subitem     "Icône à faire clignoter"

  panel-bottom-right        "Menu inférieur droit"
  panel-camera-controls       "Commandes de la caméra"
  panel-dcc-controls        "Commandes DCC"
  driver-main-menu        "Menu principal du conducteur"

  panel-bottom-right-item-message     "Marchandises"
  panel-bottom-right-item-minimap     "Dételage"
  panel-bottom-right-item-commodities   "Commodities"
  panel-bottom-right-item-decouple    "Dételage"
  panel-bottom-right-item-waybills    "Feuille de route"
  panel-bottom-right-item-schedule    "Voir horaire"
  panel-bottom-right-item-help      "Voir aide Conducteur"

  panel-camera-controls-item-cab_view   "Vue cabine"
  panel-camera-controls-item-chase_view   "Vue extérieure"
  panel-camera-controls-item-traking_view   "Vue poursuite"
  panel-camera-controls-item-free_roaming_view  "Caméra libre"

  panel-dcc-controls-item-pants     "Pantographes"
  panel-dcc-controls-item-lights      "Phares"
  panel-dcc-controls-item-horn      "Sirène"
  panel-dcc-controls-item-stop      "Arrêt"

  driver-main-menu-item-exit      "Quitter"
  driver-main-menu-item-pause     "Pause"
  driver-main-menu-item-save      "Sauvegarder"
  driver-main-menu-item-performance   "Paramètres performance"
  driver-main-menu-item-metric-imp    "Imperial/Métrique"
  driver-main-menu-item-find      "Rechercher"
  driver-main-menu-item-help      "Aide à l'écran"
}

FlashHUDIcon.gs:

//
// FlashHUDIcon.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "World.gs"

//
// Handler property class
//
class FlashHUDIconTimeHandler isclass EnumeratedMultiPropertyHandler
{
  // duration of flashing in seconds (we don't allow smaller intervals, only in increments of entire seconds)
  int m_duration = 1;

  public int GetDuration() { return m_duration; }

  // work-around... crude but it's what we need :-|
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  //
  // Property Handler methods
  //

  public string GetDescriptionHTML(void)
  {
    string htmlPage = m_assetStrTable.GetString3(m_configPrefix + "-html-property",
                                                 HREF("subItem") + GetSubItemFull() + "</a>",
                                                 HREF("itemName") + GetItemFull() + "</a>",
                                                 HREF("duration") + (string)m_duration + "</a>");
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  public string GetPropertyType(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "duration")
      return "int,1,20,1"; // limit of 60 or more?

    return inherited(propertyID);
  }

  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    if (PropStripPrefix(propertyID, "") == "duration")
    {
      m_duration = value.AsInt();
      if (m_duration < 1) // being careful not to get a negative duration
        m_duration = 1;
      return;
    }

    inherited(propertyID, value);
  }

  //
  // Gets a readable text name for the specified property.
  //
  public string GetPropertyName(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "duration")
      return m_assetStrTable.GetString(m_configPrefix + "-name-duration");

    return inherited(propertyID);
  }

  //
  // Gets a readable text description for the named property.
  //
  public string GetPropertyDescription(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "duration")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-duration");

    return inherited(propertyID);
  }

  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("FlashHUDIconTimeHandler.duration", m_duration);
    return soup;
  }

  public void SetProperties(Soup soup)
  {
    m_duration = soup.GetNamedTagAsInt("FlashHUDIconTimeHandler.duration");
    inherited(soup);
  }

};

//
// Handler with properties to switch a HUD panel on/off.
//
class FlashHUDIconOnOffHandler isclass EnumeratedMultiPropertyHandler
{
  // indicates whether we are starting or stopping the flashing of
  bool m_startStop = true;

  public bool   GetStartStop() { return m_startStop; }
  public string GetStartStopStr() { return m_assetStrTable.GetString(m_configPrefix + "-html-" + (string)m_startStop); }

  // work-around... crude but it's what we need :-|
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  //
  // Property Handler methods
  //

  //
  // Gets a description of this handler's properties as a hyperlinked HMTL page.
  //
  public string GetDescriptionHTML(void)
  {
    string htmlPage = m_assetStrTable.GetString3(m_configPrefix + "-html-property",
                                                 HREF("startStop") + GetStartStopStr() + "</a>",
                                                 HREF("subItem") + GetSubItemFull() + "</a>",
                                                 HREF("itemName") + GetItemFull() + "</a>");
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  //
  // Gets the type of the named property.
  //
  public string GetPropertyType(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "startStop")
      return "link";

    return inherited(propertyID);
  }

  //
  // Sets value of named property.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    if (PropStripPrefix(propertyID, "") == "startStop")
    {
      m_startStop = !m_startStop;
      return;
    }

    inherited(propertyID, value);
  }

  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("FlashHUDIconRule.startStop", m_startStop);
    return soup;
  }

  public void SetProperties(Soup soup)
  {
    m_startStop = soup.GetNamedTagAsBool("FlashHUDIconRule.startStop");
    inherited(soup);
  }

};

//
// Rule that flashes a HUD panel either for a set duration of time or switching the flashing on/off.
//
class FlashHUDIcon isclass ScenarioBehavior
{
  // HTML property handler stuff
  FlashHUDIconTimeHandler  m_flashIconTimeHandler;   // handler for flashing an icon for a duration of time (in seconds)
  FlashHUDIconOnOffHandler m_flashIconOnOffHandler;  // handler for instruction to start/stop flashing of an icon
  RadioButtonGroupHandler  m_radioGroupHandler;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);

    // property info handler stuff
    m_flashIconTimeHandler = new FlashHUDIconTimeHandler();
    m_flashIconTimeHandler.Init(me.GetAsset(), "flash-icon-time");

    m_flashIconOnOffHandler = new FlashHUDIconOnOffHandler();
    m_flashIconOnOffHandler.Init(me.GetAsset(), "flash-icon-onoff");

    m_radioGroupHandler = new RadioButtonGroupHandler();
    m_radioGroupHandler.Init(me.GetAsset(), "flash-icon");
    m_radioGroupHandler.AddHandler(m_flashIconTimeHandler, "time");
    m_radioGroupHandler.AddHandler(m_flashIconOnOffHandler, "onOff");

    SetPropertyHandler(m_radioGroupHandler);
  }

  //
  // When unpaused, setup the HUD panels for flashing as property handlers specify (in Driver only)
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
//        Interface.Log("# FlashHUDIcon.Pause> INFO: Unpaused and in Driver, rule can now start...");

        // library to access driver module
        KUID driverModuleKUID = me.GetAsset().LookupKUIDTable("driver_module");
        Library driverModuleLib = World.GetLibrary(driverModuleKUID);

        if (driverModuleLib)
        {
          if (m_flashIconTimeHandler == m_radioGroupHandler.GetSelectedSubHandler())
          {
            if (m_flashIconTimeHandler.IsSubEnumSet())
            {
              string[] libParam = new string[0];
              libParam[0] = m_flashIconTimeHandler.GetItem();      // panel to flash icon on
              libParam[1] = m_flashIconTimeHandler.GetSubItem();   // icon to flash
              libParam[2] = m_flashIconTimeHandler.GetDuration();  // duration of flash (seconds)

              Interface.Log("# FlashHUDIcon.Pause> INFO: Sending request to flash HUD icon '" + libParam[1] + "' on panel '" + libParam[0] + "' for " + libParam[2] + " seconds!");

              driverModuleLib.LibraryCall("flash-panel-icon-time", libParam, null);
            }
            else
              Interface.Log("# FlashHUDIcon.Pause> ERROR: No valid icon/panel selected in rule properties for timed flash!");
          }

          else if (m_flashIconOnOffHandler == m_radioGroupHandler.GetSelectedSubHandler())
          {
            if (m_flashIconOnOffHandler.IsSubEnumSet())
            {
              string[] libParam = new string[0];
              libParam[0] = m_flashIconOnOffHandler.GetItem(); // panel to flash icon on (or stop flashing of)
              libParam[1] = m_flashIconOnOffHandler.GetSubItem();
              libParam[2] = (string)(m_flashIconOnOffHandler.GetStartStop() == true);

              Interface.Log("# FlashHUDIcon.Pause> INFO: Sending request to '" + m_flashIconOnOffHandler.GetStartStopStr() + "' flashing HUD icon '" + libParam[1] + "' on panel '" + libParam[0] + "'");

              driverModuleLib.LibraryCall("flash-panel-icon-onoff", libParam, null);
            }
            else
              Interface.Log("# FlashHUDIcon.Pause> ERROR: No valid icon/panel selected in rule properties for start/stop flash!");
          }
          else
            Interface.Log("# FlashHUDIcon.Pause> ERROR: Rule set to invalid/unknown sub-handler!");
        }
        else
          Interface.Log("# FlashHUDIcon.Pause> ERROR: Unable to find library 'driver_module'!");
      }
      SetComplete(true);
    }
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if ((m_flashIconTimeHandler == m_radioGroupHandler.GetSelectedSubHandler())  and
         m_flashIconTimeHandler.IsSubEnumSet())
      return strTable.GetString3("description_info_flashtime", m_flashIconTimeHandler.GetSubItemFull(),
                                 m_flashIconTimeHandler.GetItemFull(), m_flashIconTimeHandler.GetDuration());

    if ((m_flashIconOnOffHandler == m_radioGroupHandler.GetSelectedSubHandler())  and
         m_flashIconOnOffHandler.IsSubEnumSet())
      return strTable.GetString3("description_info_startstop", m_flashIconOnOffHandler.GetStartStopStr(),
                                 m_flashIconOnOffHandler.GetSubItemFull(), m_flashIconOnOffHandler.GetItemFull());

    return inherited();
  }

};


Flash HUD Panel
[Rules]

Flash HUD Panel Rule

config.txt:

﻿
username            "Flash HUD Panel"
kind              "behavior"
kuid              <kuid:-18:1214>
script              "FlashHUDPanelRule"
class             "FlashHUDPanelRule"
icon-texture            "flash_hud_panel.texture"
string-table {
  description         "Flashes a specific Driver HUD Panel."
  description_info_flashtime      "Flashes the <i>''$0''</i> HUD Panel for <i>$1</> seconds."
  description_info_onoff        "<i>$0</i> flashing the <i>''$1''</i> HUD Panel."
  description_info_waitclick      "Flashes the <i>''$0''</i> HUD Panel until clicked."
  flash-panel-group-display-name      "<table cellspacing=0 cellpadding=0 border=0><tr><td width=1></td><td><font color=#000000>This rule either flashes a specific HUD Panel for a set duration of time or instructs a specific HUD Panel to start/stop flashing.</font></td></tr></table>"
  flash-panel-group-html-prefix     "<table cellspacing=0 cellpadding=0 border=0><tr height=1></tr><tr><td width=3></td><td>"
  flash-panel-group-html-sufix      "</td></tr></table>"
  flash-panel-group-html-between-items    "<br>"
  flash-panel-time-html-property      "Flash the $0 HUD Panel for a period of $1 seconds."
  flash-panel-time-html-prefix      "<font color=#000000>"
  flash-panel-time-html-sufix     "</font>"
  flash-panel-time-blank-string     "<i>click to select</i>"
  flash-panel-time-name-duration      "Flash duration (seconds)"
  flash-panel-time-desc-duration      "Duration of flash in seconds"
  flash-panel-time-name-itemname      "HUD Panel"
  flash-panel-time-desc-itemname      "HUD Panel to flash"
  flash-panel-time-item0        "panel-bottom-right"
  flash-panel-time-item1        "panel-cabin-controls"
  flash-panel-time-item2        "panel-camera-controls"
  flash-panel-time-item3        "panel-dcc-controls"
  flash-panel-time-item4        "driver-main-menu"
  flash-panel-time-item5        "panel-speed-time-display"
  flash-panel-onoff-html-property     "$0 flashing the $1 HUD Panel."
  flash-panel-onoff-html-prefix     "<font color=#000000>"
  flash-panel-onoff-html-sufix      "</font>"
  flash-panel-onoff-blank-string      "<i>click to select</i>"
  flash-panel-onoff-html-true     "Start"
  flash-panel-onoff-html-false      "Stop"
  flash-panel-onoff-name-itemname     "HUD Panel"
  flash-panel-onoff-desc-itemname     "HUD Panel to start/stop flashing"
  flash-panel-onoff-item0       "panel-bottom-right"
  flash-panel-onoff-item1       "panel-cabin-controls"
  flash-panel-onoff-item2       "panel-camera-controls"
  flash-panel-onoff-item3       "panel-dcc-controls"
  flash-panel-onoff-item4       "driver-main-menu"
  flash-panel-onoff-item5       "panel-speed-time-display"
  panel-bottom-right        "Bottom Right Menu"
  panel-cabin-controls        "Cabin Controls"
  panel-camera-controls       "Camera Controls"
  panel-dcc-controls        "DCC Controls"
  driver-main-menu        "Driver Main Menu"
  panel-speed-time-display      "Speed and Time Display"
}
kuid-table {
  driver_module         <kuid:-16:10240>
}
username-fr           "Clignotement panneau ATH"
string-table-fr {
  description         "Fait clignoter un panneau ATH spécifique du conducteur."
  description_info_flashtime      "Fait clignoter le panneau ATH <i>''$0''</i> pendant <i>$1</> secondes."
  description_info_onoff        "<i>$0</i> clignotement du panneau ATH <i>''$1''</i>."
  description_info_waitclick      "Fait clignoter le panneau ATH <i>''$0''</i> jusqu'à ce que l'on clique dessus."

  flash-panel-group-display-name      "<table cellspacing=0 cellpadding=0 border=0><tr><td width=1></td><td><font color=#000000>Cette règle fait clignoter un panneau ATH spécifique pendant une durée déterminée ou commande le début/la fin du clignotement d'un panneau ATH.</font></td></tr></table>"

  flash-panel-time-html-property      "Fait clignoter le panneau ATH $0 pendant $1 secondes."
  flash-panel-time-blank-string     "<i>Cliquez pour sélectionner</i>"
  flash-panel-time-name-duration      "Flash duration (seconds)"
  flash-panel-time-desc-duration      "Durée du clignotement (secondes)"
  flash-panel-time-name-itemname      "Panneau ATH"
  flash-panel-time-desc-itemname      "Panneau ATH à faire clignoter"

  flash-panel-onoff-html-property     "$0 clignotement du panneau ATH $1."
  flash-panel-onoff-blank-string      "<i>Cliquez pour sélectionner</i>"
  flash-panel-onoff-html-true     "Début"
  flash-panel-onoff-html-false      "Fin"
  flash-panel-onoff-name-itemname     "Panneau ATH"
  flash-panel-onoff-desc-itemname     "Panneau ATH à faire clignoter/arrêter"

  panel-bottom-right        "Menu inférieur droit"
  panel-cabin-controls        "Commandes cabine"
  panel-camera-controls       "Commandes caméra"
  panel-dcc-controls        "Commandes DCC"
  driver-main-menu        "Menu principal conducteur"
  panel-speed-time-display      "Affichage vitesse et temps"
}

FlashHUDPanelRule.gs:

//
// FlashHUDPanelRule.gs
//
//  Copyright (C) 2004-2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "Library.gs"
include "World.gs"

//
// Property handler class.
// Properties specify that a set HUD panel is to flash for a set duration of time in seconds.
//
class FlashHUDPanelTimeHandler isclass EnumeratedPropertyHandler
{
  // duration of flashing in seconds (we don't allow smaller intervals ATM)
  int m_duration = 1;

  // Get the duration
  public int GetDuration() { return m_duration; }

  // workaround...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  //
  // Property handler methods methods
  //

  //
  // Gets HTML page describing this handler's property configuration
  //
  public string GetDescriptionHTML(void)
  {
    string htmlPage = m_assetStrTable.GetString2(m_configPrefix + "-html-property",
                                                 HREF("itemName") + GetItemFull() + "</a>",
                                                 HREF("duration") + (string)m_duration + "</a>");
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  //
  // Gets the type of the named property.
  //
  public string GetPropertyType(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "duration")
      return "int,1,20,1"; // limit of 60 or more?

    return inherited(propertyID);
  }

  //
  // Sets value of the named property.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    if (PropStripPrefix(propertyID, "") == "duration")
    {
      m_duration = value.AsInt();
      if (m_duration < 1) // being careful not to get a negative duration
        m_duration = 1;
    }
    else
      inherited(propertyID, value);
  }

  //
  // Gets a readable text name for the specified property.
  //
  public string GetPropertyName(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "duration")
      return m_assetStrTable.GetString(m_configPrefix + "-name-duration");

    return inherited(propertyID);
  }

  //
  // Gets a readable text description for the named property.
  //
  public string GetPropertyDescription(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "duration")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-duration");

    return inherited(propertyID);
  }

  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("FlashHUDPanelRule.duration", m_duration);
    return soup;
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);
    m_duration = soup.GetNamedTagAsInt("FlashHUDPanelRule.duration");
  }
};

//
// Property handler class.
// Properties specify that a set HUD panel is to start/stop flashing (switch mode, not time duration).
//
class FlashHUDPanelOnOffHandler isclass EnumeratedPropertyHandler
{
  // indicates whether we are starting or stopping the flashing of
  bool m_startStop = true;

  public bool   GetStartStop() { return m_startStop; }
  public string GetStartStopStr() { return m_assetStrTable.GetString(m_configPrefix + "-html-" + (string)m_startStop); }

  // work-around... crude but it's what we need :-|
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  //
  // Property Handler methods
  //

  public string GetDescriptionHTML(void)
  {
    string htmlPage = m_assetStrTable.GetString2(m_configPrefix + "-html-property",
                                      HREF("startStop") + GetStartStopStr() + "</a>",
                                      HREF("itemName") + GetItemFull() + "</a>");
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  public string GetPropertyType(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "startStop")
      return "link";

    return inherited(propertyID);
  }

  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    if (PropStripPrefix(propertyID, "") == "startStop")
    {
      m_startStop = !m_startStop;
      return;
    }
    inherited(propertyID, value);
  }

  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("FlashHUDPanelOnOffHandler.startStop", m_startStop);
    return soup;
  }

  public void SetProperties(Soup soup)
  {
    m_startStop = soup.GetNamedTagAsBool("FlashHUDPanelOnOffHandler.startStop");
    inherited(soup);
  }
};

class FlashHUDPanelRule isclass ScenarioBehavior
{
  // HTML property handler stuff
  FlashHUDPanelTimeHandler  m_flashHUDPanelTimeHandler;
  FlashHUDPanelOnOffHandler m_flashHUDPanelOnOffHandler;
  RadioButtonGroupHandler   m_radioGroupHandler;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);

    // property info handler stuff
    m_flashHUDPanelTimeHandler = new FlashHUDPanelTimeHandler();
    m_flashHUDPanelTimeHandler.Init(me.GetAsset(), "flash-panel-time");

    m_flashHUDPanelOnOffHandler = new FlashHUDPanelOnOffHandler();
    m_flashHUDPanelOnOffHandler.Init(me.GetAsset(), "flash-panel-onoff");

    m_radioGroupHandler = new RadioButtonGroupHandler();
    m_radioGroupHandler.Init(me.GetAsset(), "flash-panel-group");
    m_radioGroupHandler.AddHandler(m_flashHUDPanelTimeHandler, "time");
    m_radioGroupHandler.AddHandler(m_flashHUDPanelOnOffHandler, "onOff");

    SetPropertyHandler(m_radioGroupHandler);
  }

  //
  // When unpaused, set the options as needed
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
//        Interface.Log("# FlashHUDPanel.Pause> INFO: Unpaused and in Driver, rule can now start...");

        // library to access driver module
        KUID driverModuleKUID = me.GetAsset().LookupKUIDTable("driver_module");
        Library driverModuleLib = World.GetLibrary(driverModuleKUID);
        if (driverModuleLib)
        {
          if (m_flashHUDPanelTimeHandler == m_radioGroupHandler.GetSelectedSubHandler())
          {
            if (m_flashHUDPanelTimeHandler.IsEnumSet())
            {
              string[] libParam = new string[0];
              libParam[0] = m_flashHUDPanelTimeHandler.GetItem();
              libParam[1] = (string)m_flashHUDPanelTimeHandler.GetDuration();

              Interface.Log("# FlashHUDPanel.Pause> INFO: Sending request to flash panel '" + libParam[0] + "' for " + libParam[1] + " seconds!");

              driverModuleLib.LibraryCall("flash-panel-time", libParam, null);
            }
            else
              Interface.Log("# FlashHUDPanel.Pause> ERROR: No valid panel selected in rule properties for timed flash!");
          }
          else if (m_flashHUDPanelOnOffHandler == m_radioGroupHandler.GetSelectedSubHandler())
          {
            if (m_flashHUDPanelOnOffHandler.IsEnumSet())
            {
              string[] libParam = new string[0];
              libParam[0] = m_flashHUDPanelOnOffHandler.GetItem();
              libParam[1] = (string)m_flashHUDPanelOnOffHandler.GetStartStop();

              Interface.Log("# FlashHUDPanel.Pause> INFO: Sending request to '" + m_flashHUDPanelOnOffHandler.GetStartStopStr() + "' flashing HUD panel '" + libParam[1] + "'!");

              driverModuleLib.LibraryCall("flash-panel-onoff", libParam, null);
            }
            else
              Interface.Log("# FlashHUDPanel.Pause> ERROR: No valid panel selected in rule properties for start/stop flash!");
          }
          else
            Interface.Log("# FlashHUDPanel.Pause> ERROR: Rule set to invalid/unknown sub-handler!");
        }
        else
          Interface.Log("# FlashHUDPanel.Pause> ERROR: Can't load library 'driverModule'!");
      }

      SetComplete(true);
    }
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if ((m_flashHUDPanelTimeHandler == m_radioGroupHandler.GetSelectedSubHandler())  and
         m_flashHUDPanelTimeHandler.IsEnumSet())
      return strTable.GetString2("description_info_flashtime", m_flashHUDPanelTimeHandler.GetItemFull(),
                                 m_flashHUDPanelTimeHandler.GetDuration());

    if ((m_flashHUDPanelOnOffHandler == m_radioGroupHandler.GetSelectedSubHandler())  and
         m_flashHUDPanelOnOffHandler.IsEnumSet())
      return strTable.GetString2("description_info_onoff", m_flashHUDPanelOnOffHandler.GetStartStopStr(),
                                 m_flashHUDPanelOnOffHandler.GetItemFull());

    return inherited();
  }

};


Message Popup
[Rules]

Message Popup Rule

config.txt:

﻿
username            "Message Popup"
kind              "behavior"
kuid              <kuid:-18:1263>
script              "MessagePopupRule"
class             "MessagePopupRule"
icon-texture            "message_popup.texture"
string-table {
  description         "Displays a pop-up message in a browser window and waits for it to be closed."
  description_info        "Displays a pop-up message in a browser window and waits for it to be closed."
  group-handler-html-prefix     "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=3></td><td><font color=#000000>"
  group-handler-html-sufix      "</font></td></tr></table><br><br><br>"
  popup-selection-display-name      "Create a pop-up messgae box window from:"
  popup-selection-html-prefix     "<font color=#000000>"
  popup-selection-html-sufix      "</font>"
  popup-selection-html-between-items    " "
  popup-selection-item-msgboxasset    "null"
  popup-selection-item-msgboxtext     "null"
  msg-box-asset-html-property     "Use the page $0 from the HTML asset $1 for a pop-up message box."
  msg-box-asset-blank-string      "<i>click to select</i>"
  msg-box-asset-html-prefix     "<font color=#000000>"
  msg-box-asset-html-sufix      "</font><br>"
  msg-box-asset-name-pagename     "HTML page name"
  msg-box-asset-desc-pagename     "Name of HTML page without the .html extension"
  msg-box-asset-name-pageasset      "HTML asset"
  msg-box-asset-desc-pageasset      "Select HTML asset to load a page from"
  msg-box-text-html-property      "Use the string table entry $0 from the HTML asset $1 as the contents for a pop-up message box."
  msg-box-text-blank-string     "<i>click to select</i>"
  msg-box-text-html-prefix      "<font color=#000000>"
  msg-box-text-html-sufix       "</font>"
  msg-box-text-name-pagename      "String table entry"
  msg-box-text-desc-pagename      "Name of string table entry"
  msg-box-text-name-pageasset     "HTML asset"
  msg-box-text-desc-pageasset     "Asset where string table entry can be found"
}
username-fr           "Fenêtre de message"
string-table-fr {
  description         "Affiche une fenêtre de message dans votre navigateur jusqu'à ce que vous la fermiez."
  description_info        "Affiche une fenêtre de message dans la fenêtre du navigateur, jusqu'à ce que vous la fermiez."

  popup-selection-display-name      "Créer une fenêtre de message à partir de :"

  msg-box-asset-html-property     "Utiliser la page $0 de l'élément $1 comme boîte de message."
  msg-box-asset-blank-string      "<i>Cliquez pour sélectionner</i>"
  msg-box-asset-name-pagename     "Nom de la page HTML"
  msg-box-asset-desc-pagename     "Nom de la page HTML sans l'extension .html"
  msg-box-asset-name-pageasset      "Elément HTML"
  msg-box-asset-desc-pageasset      "Sélectionner un élément HTML à partir duquel charger une page"

  msg-box-text-html-property      "Utiliser l'entrée de string-table $0 de l'élément HTML $1 comme contenu de la boîte de message."
  msg-box-text-blank-string     "<i>Cliquez pour sélectionner</i>"
  msg-box-text-name-pagename      "Entrée de string table"
  msg-box-text-desc-pagename      "Nom de l'entrée de string table"
  msg-box-text-name-pageasset     "Elément HTML"
  msg-box-text-desc-pageasset     "Elément HTML dans lequel trouver l'entrée de string table"
}

MessagePopupRule.gs:

//
// MessagePopupRule.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"

//
// HTML page thingy
//
class HTMLMessageAssetItem isclass ConfigAssetHandler
{
  // Name of page to display (minus the .html extension) + the asset where it can be located.
  string m_pageName = "index";
  Asset  m_htmlAsset = null;

  // work-around...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  public Asset GetHTMLAsset(void) { return m_htmlAsset; }
  public void  SetHTMLAsset(Asset newAsset) { m_htmlAsset = newAsset; }

  public string GetPageName(void) { return m_pageName; }
  public void   SetPageName(string newPageName) { m_pageName = newPageName; }

  Asset FindAsset(string assetName);

  //
  // Property Handler method implementations
  //

  public string GetPropertyType(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "pageName")
      return "string";

    if (property == "pageAsset")
      return "list,1";

    return inherited(propertyID);
  }

  //
  // Gets HTML code describing this list item as two table cells (one cell for page name, other for
  // the asset)
  //
  public string GetDescriptionHTML(void)
  {
    string assetName;
    if (!m_htmlAsset)
      assetName = m_assetStrTable.GetString(m_configPrefix + "-blank-string");
    else
      assetName = m_htmlAsset.GetLocalisedName();

    string htmlPage = m_assetStrTable.GetString2(m_configPrefix + "-html-property",
                                                 HREF("pageName") + m_pageName + ".html</a>",
                                                 HREF("pageAsset") + assetName + "</a>");
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  //
  // Allows the page name to be set through this interface method.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    string property = PropStripPrefix(propertyID, "");
    if ((property == "pageName") and (value.GetType() == value.STRING_TYPE))
      m_pageName = value.AsString();

    else if (property == "pageAsset")
    {
      string assetName = value.AsString();
      Asset newAsset = FindAsset(value.AsString());
      if (newAsset)
        m_htmlAsset = newAsset;
    }

    else
      inherited(propertyID, value);
  }

  public string GetPropertyValue(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "pageName")
      return m_pageName;

    if (property == "pageAsset")
      if (m_htmlAsset)
        return m_htmlAsset.GetLocalisedName();

    return inherited(propertyID);
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "pageAsset")
    {
      string[] retList = new string[0];
      Asset[] assets = World.GetAssetList("html-asset");
      int i;
      for (i = 0; i < assets.size(); i++)
        retList[i] = assets[i].GetLocalisedName();

      return retList;
    }

    return inherited(propertyID);
  }

  //
  // Gets a readable text name for the specified property.
  //
  public string GetPropertyName(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "pageName")
      return m_assetStrTable.GetString(m_configPrefix + "-name-pageName");

    if (property == "pageAsset")
      return m_assetStrTable.GetString(m_configPrefix + "-name-pageAsset");

    return inherited(propertyID);
  }

  //
  // Gets a readable text description for the named property.
  //
  public string GetPropertyDescription(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "pageName")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-pageName");

    if (property == "pageAsset")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-pageAsset");

    return inherited(propertyID);
  }

  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("HTMLPageListItem.pageName", m_pageName);

    if (m_htmlAsset)
      soup.SetNamedTag("HTMLPageListItem.htmlAsset", m_htmlAsset.GetKUID());

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    string newPageName = soup.GetNamedTag("HTMLPageListItem.pageName");
    if (newPageName.size())
      m_pageName = newPageName;

    KUID htmlAssetKUID = soup.GetNamedTagAsKUID("HTMLPageListItem.htmlAsset");
    if (htmlAssetKUID)
      m_htmlAsset = World.FindAsset(htmlAssetKUID);
  }

  // find the asset by name
  Asset FindAsset(string assetName)
  {
    Asset[] assets = World.GetAssetList("html-asset");
    int i;

    for (i = 0; i < assets.size(); i++)
      if (assets[i].GetLocalisedName() == assetName)
        return assets[i];

    return null;
  }

};

class HTMLMessageTextItem isclass HTMLMessageAssetItem
{
  // work-around...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  //
  // Property Handler method implementations
  //

  public string GetDescriptionHTML(void)
  {
    string assetName;
    if (!m_htmlAsset)
      assetName = m_assetStrTable.GetString(m_configPrefix + "-blank-string");
    else
      assetName = m_htmlAsset.GetLocalisedName();

    string htmlPage = m_assetStrTable.GetString2(m_configPrefix + "-html-property",
                                                 HREF("pageName") + m_pageName + "</a>",
                                                 HREF("pageAsset") + assetName + "</a>");
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

};

//
// Waits for a derailment to occur in the Trainz world.
//
class MessagePopupRule isclass ScenarioBehavior
{
  // HTML property handler stuff
  ConfigAssetGroupHandler m_groupHandler;
  RadioButtonGroupHandler m_radioGroupHandler;
  HTMLMessageAssetItem    m_msgBoxHTMLAssetHandler;
  HTMLMessageTextItem     m_msgBoxHTMLTextHandler;

  thread void ManageBrowser(void);

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);

    // property info handler stuff
    m_msgBoxHTMLAssetHandler = new HTMLMessageAssetItem();
    m_msgBoxHTMLAssetHandler.Init(me.GetAsset(), "msg-box-asset");

    m_msgBoxHTMLTextHandler = new HTMLMessageTextItem();
    m_msgBoxHTMLTextHandler.Init(me.GetAsset(), "msg-box-text");

    m_radioGroupHandler = new RadioButtonGroupHandler();
    m_radioGroupHandler.Init(me.GetAsset(), "popup-selection");
    m_radioGroupHandler.AddHandler(m_msgBoxHTMLAssetHandler, "msgBoxAsset");
    m_radioGroupHandler.AddHandler(m_msgBoxHTMLTextHandler, "msgBoxText");

    m_groupHandler = new ConfigAssetGroupHandler();
    m_groupHandler.Init(me.GetAsset(), "group-handler");
    m_groupHandler.AddHandler(m_radioGroupHandler, "popupChoices/");

    SetPropertyHandler(m_groupHandler);
  }

  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
      // immediately hide the existing browser
      PostMessage(me, "MessagePopupRule", "Close", 0.0);

    else if (!IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
        ManageBrowser();
    }
  }

  thread void ManageBrowser(void)
  {
    Browser browser = Constructors.NewBrowser();
    browser.SetCloseEnabled(false); // we rely on a particular type of URL to close this browser
    browser.SetWindowStyle(Browser.STYLE_DEFAULT);
    browser.SetWindowPosition(96, 117);

    if (m_msgBoxHTMLAssetHandler == m_radioGroupHandler.GetSelectedSubHandler()  and  m_msgBoxHTMLTextHandler.GetHTMLAsset())
    {
      Interface.Log("# MessagePopupRule.ManageBrowser> INFO: Loading page '" + m_msgBoxHTMLAssetHandler.GetPageName() + ".html' from asset '" + m_msgBoxHTMLAssetHandler.GetHTMLAsset().GetLocalisedName() + "'.");
      browser.SetWindowSize(400, 350);
      browser.SetScrollEnabled(true);
      browser.LoadHTMLFile(m_msgBoxHTMLAssetHandler.GetHTMLAsset(), m_msgBoxHTMLAssetHandler.GetPageName() + ".html");
    }
    else if (m_msgBoxHTMLTextHandler == m_radioGroupHandler.GetSelectedSubHandler()  and  m_msgBoxHTMLTextHandler.GetHTMLAsset())
    {
      string browserText = m_msgBoxHTMLTextHandler.GetHTMLAsset().GetStringTable().GetString(m_msgBoxHTMLTextHandler.GetPageName());
      if (browserText.size())
      {
        Interface.Log("# MessagePopupRule.ManageBrowser> INFO: Loading text from string entry '" + m_msgBoxHTMLTextHandler.GetPageName() + "' in HTML asset " + m_msgBoxHTMLTextHandler.GetHTMLAsset().GetLocalisedName() + "' into a message box.");
        browser.SetWindowSize(400, 130);
        browser.SetScrollEnabled(false);
        browser.SetParam(0, browserText);
        browser.LoadHTMLFile(me.GetAsset(), "msgbox.html");
      }
      else
      {
        Interface.Log("# MessagePopupRule.ManageBrowser> ERROR: String table entry '" + m_msgBoxHTMLTextHandler.GetPageName() + "' in HTML asset '" + m_msgBoxHTMLTextHandler.GetHTMLAsset().GetLocalisedName() + " is empty/absent!");
        SetComplete(true);
        return;
      }
    }
    else
    {
      Interface.Log("# MessagePopupRule.ManageBrowser> ERROR: Host asset for message box is not valid!");
      SetComplete(true);
      return;
    }

    Message msg;
    wait()
    {
      on "Browser-URL", "live://pages/messagepopup/done", msg:
      {
        if (msg.src != browser)
        {
          msg.src = null;
          continue;
        }

        Interface.Log("# MessagePopupRule.ManageBrowser> INFO: Done URL detected, closing browser and completing rule!");
        break;
      }

      on "MessagePopupRule", "Close", msg:
      {
        if (msg.src != me)
          continue;

        Interface.Log("# MessagePopupRule.ManageBrowser> INFO: Rule paused, terminating browser session!");
        break;
      }
    }

    browser = null;
    SetComplete(true);
  }

};


Minimap Options
[Rules]

Minimap Options Rule

config.txt:

﻿
username            "Minimap Options"
kind              "behavior"
kuid              <kuid:-18:1215>
script              "MinimapOptions"
class             "MinimapOptions"
icon-texture            "minimap_options.texture"
string-table {
  description         "Sets the options for the minimap."
  description_html        "Sets the options for the minimap."
  minimap-display-name        "Types of items to display on the Minimap when viewed:"
  minimap-html-prefix       "<table border='0' cellspacing='0' cellpadding='0'><tr height=1><td></td><td></td></tr><tr><td width=4></td><td><font color=#000000>"
  minimap-html-sufix        "</font></td></tr></table><br><br>"
  minimap-item0         "map-background"
  minimap-item1         "gradients"
  minimap-item2         "junctions"
  minimap-item3         "signals"
  minimap-item4         "triggers"
  minimap-item5         "trackmarks"
  minimap-item6         "trackside-labels"
  minimap-item7         "terrain-objects"
  minimap-item8         "industry-names"
  minimap-item9         "named-objects"
  minimap-item10          "consist"
  minimap-item-map-background     "Map Textures"
  minimap-item-gradients        "Gradients"
  minimap-item-junctions        "Junctions"
  minimap-item-signals        "Signals"
  minimap-item-triggers       "Triggers"
  minimap-item-trackmarks       "Markers"
  minimap-item-trackside-labels     "Trackside Labels"
  minimap-item-terrain-objects      "Terrain Objects"
  minimap-item-industry-names     "Industry Names"
  minimap-item-named-objects      "Named Objects"
  minimap-item-consist        "Consists"
}
username-fr           "Options de la mini-carte"
string-table-fr {
  description         "Définit les options de la mini-carte."
  description_html        "Définit les options de la mini-carte."

  minimap-display-name        "Types d'éléments à afficher dans la mini-carte :"

  minimap-item-map-background     "Textures de carte"
  minimap-item-gradients        "Inclinaisons"
  minimap-item-junctions        "Aiguillages"
  minimap-item-signals        "Signaux"
  minimap-item-triggers       "Déclencheurs"
  minimap-item-trackmarks       "Repères"
  minimap-item-trackside-labels     "Noms des voies"
  minimap-item-terrain-objects      "Objets terrain"
  minimap-item-industry-names     "Industries"
  minimap-item-named-objects      "Objets définis"
  minimap-item-consist        "Convois"
}

MinimapOptions.gs:

//
// MinimapOptions.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"

//
// ??
//
class MinimapOptions isclass ScenarioBehavior
{
  // HTML property handler stuff
  CheckListPropertyHandler miniMapOptionsHandler;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);

    // property info handler stuff
    miniMapOptionsHandler = new CheckListPropertyHandler();
    miniMapOptionsHandler.Init(me.GetAsset(), "minimap");
//    miniMapOptionsHandler.Init(me.GetAsset(), "minimap", );
    SetPropertyHandler(miniMapOptionsHandler);

    SetStateFlags(DOES_COMPLETE, true);
  }

  //
  // When unpaused. set the options as needed (in driver only?)
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        Interface.Log("# MinimapOptions.Pause> rule unpaused and in Driver, setting MiniMap options...");

        bool[] settings = miniMapOptionsHandler.GetSettings();
        int i;
        for (i = 0; i < settings.size(); i++)
        {
/*          if (!settings[i])
            Interface.Log("## MinimapOptions> Disabling map item " + i + " 'display-" + miniMapOptionsHandler.GetSettingName(i) + "'");
          else
            Interface.Log("## MinimapOptions> Enabling map item " + i + " 'display-" + miniMapOptionsHandler.GetSettingName(i) + "'");*/

          // config prefixes are equivalent to the paramaters SetElementProperty uses
          Interface.SetElementProperty("minimap", "display-" + miniMapOptionsHandler.GetSettingName(i), (string)settings[i]);
        }
      }

      SetComplete(true);
    }
  }

};


Multiple Junction Alignment Check
[Rules]

Multiple Junction Alignment Check Rule

config.txt:

﻿
username            "Multiple Junction Alignment Check"
kind              "behavior"
kuid              <kuid:-18:1216>
script              "MultiJunctionAlignCheck"
class             "MultiJunctionAlignCheck"
icon-texture            "multi_junction_align_check.texture"
string-table {
  description         "Checks multiple junctions are in alignment."
  description_html        "Checks that multiple junctions are in alignment."
  multi-junc-mode-html-property-true    "Wait until $0all$1 of the following junctions is set to its corresponding set state:"
  multi-junc-mode-html-property-false   "Wait until $0any one$1 of the following junctions is set to its corresponding set state:"
  multi-junc-mode-html-prefix     "<table cellspacing=0 cellpadding=0><tr height=1></tr><tr><td width=4></td><td><font color=#000000>"
  multi-junc-mode-html-sufix      "</font></td></tr></table>"
  multi-junc-align-column0      "<font color=#000000><i>Junction</i>&nbsp;&nbsp;</font>"
  multi-junc-align-column1      "<font color=#000000><i>Setting</i>&nbsp;&nbsp;</font>"
  multi-junc-align-html-prefix      "<table cellspacing=0 cellpadding=0><tr><td width=4></td><td><font color=#000000>"
  multi-junc-align-html-sufix     "</font></td></tr></table>"
  multi-junc-align-html-table-row-even    "bgcolor=#CCCCAA22"
  multi-junc-align-html-table-row-odd   "bgcolor=#CCCCAA44"
  multi-junc-align-delete       "<font color=#000000>Remove</font>"
  multi-junc-align-add        "Add Junction"
  multi-junc-align-name-add     "Junctions"
  multi-junc-align-desc-add     "Select junction to watch from list"
  multi-junc-align-add-all      "Add All"
  multi-junc-align-add-all-tooltip    "Adds all available junctions to list"
  multi-junc-align-delete-all     "Delete All"
  multi-junc-align-delete-all-tooltip   "Deletes all junctions from list"
  junction-item-html-prefix     "<td bgcolor=#00000011>"
  junction-item-html-sufix      "</td>"
  multi-junc-setting-html-property    "$0"
  multi-junc-setting-blank-string     "<i>click to select</i>"
  multi-junc-setting-html-prefix      "<font color=#000000>"
  multi-junc-setting-html-sufix     "</font>"
  multi-junc-setting-name-itemname    "Junction setting"
  multi-junc-setting-desc-itemname    "Junction setting to wait for"
  multi-junc-setting-item0      "multi-junc-setting-left"
  multi-junc-setting-item1      "multi-junc-setting-center"
  multi-junc-setting-item2      "multi-junc-setting-right"
  multi-junc-setting-item3      "multi-junc-setting-any"
  multi-junc-setting-left       "Left"
  multi-junc-setting-center     "Center"
  multi-junc-setting-right      "Right"
  multi-junc-setting-any        "Any"
}
username-fr           "Vérification de l'alignement de jonctions multiples"
string-table-fr {
  description         "Vérifie que des jonctions multiples sont alignées."
  description_html        "Vérifie que des jonctions multiples sont alignées."

  multi-junc-mode-html-property-true    "Attend que $0toutes$1 les jonctions suivantes correspondent à l'orientation définie :"
  multi-junc-mode-html-property-false   "Attend que $0n'importe laquelle$1 des jonctions suivantes corresponde à l'orientation définie :"

  multi-junc-align-column0      "<font color=#000000><i>Jonction</i>&nbsp;&nbsp;</font>"
  multi-junc-align-column1      "<font color=#000000><i>Réglage</i>&nbsp;&nbsp;</font>"
  multi-junc-align-delete       "<font color=#000000>Retirer</font>"
  multi-junc-align-add        "Ajouter jonction"
  multi-junc-align-name-add     "Jonctions"
  multi-junc-align-desc-add     "Sélectionner dans la liste une jonction à surveiller"
  multi-junc-align-add-all      "Tout ajouter"
  multi-junc-align-add-all-tooltip    "Ajoute toutes les jonctions disponibles à la liste"
  multi-junc-align-delete-all     "Tout effacer"
  multi-junc-align-delete-all-tooltip   "Efface toutes les jonctions de la liste"

  multi-junc-setting-blank-string     "<i>Cliquez pour sélectionner</i>"
  multi-junc-setting-name-itemname    "Orientation de jonction"
  multi-junc-setting-desc-itemname    "Orientation de jonction à attendre"
  multi-junc-setting-left       "Gauche"
  multi-junc-setting-center     "Centre"
  multi-junc-setting-right      "Droite"
  multi-junc-setting-any        "Aucune"
}

MultiJunctionAlignCheck.gs:

//
// MultiJunctionAlignCheck.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"
include "common.gs"

//
// A junction item for use in a list handler.
//
class JunctionListItem isclass ConfigAssetGroupHandler
{
  string m_junctionName = "";
  EnumeratedPropertyHandler m_junctionChoiceEnumHandler;

  // Junction verification method
  public bool VerifyMe(string changedJunction);

  //
  // Initialization method that creates the enumerated sub-handler for mananging the junction's
  // state setting.
  //
  public void Init(Asset asset, string newConfigPrefix)
  {
    inherited(asset, newConfigPrefix);

    // add the enumerated handler for use on choosing junction settings
    m_junctionChoiceEnumHandler = new EnumeratedPropertyHandler();
    m_junctionChoiceEnumHandler.Init(asset, "multi-junc-setting", 4);

    me.AddHandler(m_junctionChoiceEnumHandler, "juncState/");
  }

  //
  // Returns true if the junction matches the set specification of this handler, false otherwise.
  //
  public bool VerifyMe(string changedJunction)
  {
    // make sure this handler has been set, otherwise it will fail the test
    if (!m_junctionChoiceEnumHandler.IsEnumSet())
    {
      Interface.Log("# JunctionListItem.VerifyMe> ERROR: junction '" + m_junctionName + "' doesn't have a desired state set!");
      return false;
    }

    // verify the junction
    Junction junction = cast<Junction> Router.GetGameObject(m_junctionName);
    if (!junction)
    {
      Interface.Log("# JunctionListItem.VerifyMe> Error, junction '" + m_junctionName + "' is invalid!");
      return false;
    }

    // junction setting needed is any, so as long as it is changed, it counts as having been set
    if ((m_junctionChoiceEnumHandler.GetItemIndex() == 3)  and  (changedJunction == m_junctionName))
      return true;

    // determine if the junction is not in the required direction, if not it is false
    if (junction.GetDirection() != m_junctionChoiceEnumHandler.GetItemIndex())
      return false;

    // if we get this far, the junction has been changed as required, so success
    return true;
  }

  //
  // Property methods
  //

  //
  // Gets HTML table cells that describe the junction and it's state setting.
  //
  public string GetDescriptionHTML(void)
  {
    string htmlPage = "<font color=#000000>" + m_junctionName + "</font>&nbsp;&nbsp;</td>" +
                      "<td>" + m_junctionChoiceEnumHandler.GetDescriptionHTML() + "&nbsp;&nbsp;";
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  //
  // Allows the junction name to be set through this interface method.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    if (PropStripPrefix(propertyID, "") == "junctionName")
      m_junctionName = value.AsString();
    else
      inherited(propertyID, value);
  }

  //
  // Allows the junction name to be obtained through this interface method.
  //
  public string GetPropertyValue(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "junctionName")
      return m_junctionName;

    return inherited(propertyID);
  }

  //
  // Return properties of this object in a soup.
  //
  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("JunctionListItem.junctionName", m_junctionName);

    // sub-soup for the junction state
    soup.SetNamedSoup("JunctionListItem.junctionSetting", m_junctionChoiceEnumHandler.GetProperties());

    return soup;
  }

  //
  // Initialize this object from the given properties soup.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);
    m_junctionName = soup.GetNamedTag("JunctionListItem.junctionName");

    // restore handler for the junction settings
    m_junctionChoiceEnumHandler.SetProperties(soup.GetNamedSoup("JunctionListItem.junctionSetting"));
  }

};

//
// Extends the generic list handler to be a list of junctions.
//
class JunctionListHandler isclass GenericListHandler
{
  // workaround...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  // verification methods to test junctions
  public bool VerifyJunction(string junctionName);

  public bool VerifyAll(string changedJunction);
  public bool VerifyOne(string changedJunction);

  //
  // Adds a new item to the list.  Method well create appropriate sub-handler for it.
  //
  public void AddItem(string itemDisplayName)
  {
    JunctionListItem newItem = new JunctionListItem();
    newItem.Init(m_hostAsset, "junction-item");

    // handler prefix is junction name with spaces substituted with '-'
    string itemPrefix = TrainUtil.StrSubst(itemDisplayName, " ", "-");
    itemPrefix = itemPrefix + "/";

    me.AddHandler(newItem, itemPrefix);

    // set the junctionName property
    PropertyValue xvalue = new PropertyValue();
    xvalue.Set(itemDisplayName);
    newItem.SetPropertyValue(newItem.Prop("junctionName"), xvalue);
  }

  public bool JunctionAlreadyInList(string juncName)
  {
    int i;
    for (i = 0; i < handlers.size(); i++)
      if (juncName == handlers[i].GetPropertyValue(handlers[i].Prop("junctionName")))
        return true;

    return false;
  }

  //
  // Gets list of elements to choose from for the named property
  //
  public string[] GetPropertyElementList(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "add")
    {
      string[] retStrList = new string[0];
      Junction[] junctions = World.GetJunctionList();
      int i, p = 0;
      for (i = 0; i < junctions.size(); i++)
        if (!JunctionAlreadyInList(junctions[i].GetName()))
          retStrList[p++] = junctions[i].GetName();

      return retStrList;
    }

    return inherited(propertyID);
  }

  void ConstructHandlers(Soup listItemsSoup)
  {
    int i;
    for (i = 0; i < listItemsSoup.CountTags(); i++)
    {
      JunctionListItem newItem = new JunctionListItem();
      newItem.Init(m_hostAsset, "junction-item");

      string prefixTag = listItemsSoup.GetIndexedTagName(i);

      Soup itemSoup = listItemsSoup.GetNamedSoup(prefixTag);
      newItem.SetProperties(itemSoup);

      AddHandler(newItem, prefixTag);
    }
  }

  //
  // Verifies that the named junction is set (ture) or not (false)
  //
  public bool VerifyJunction(string junctionName)
  {
    string itemPrefix = TrainUtil.StrSubst(junctionName, " ", "-");
    JunctionListItem juncHandler = cast <JunctionListItem> FindHandler(itemPrefix);

    if (juncHandler)
      if (juncHandler.VerifyMe(junctionName))
        return true;

    return false;
  }

  //
  // Verifies if all junctions in the list are set to their required state.
  //
  public bool VerifyAll(string changedJunction)
  {
    int i;
    for (i = 0; i < handlers.size(); i++)
    {
      JunctionListItem juncHandler = cast <JunctionListItem> handlers[i];
      if (!juncHandler)
        return false;

      if (!juncHandler.VerifyMe(changedJunction))
        return false;
    }

    return true;
  }

  //
  // Verifies if at least one of the junctions in the list is set to its required state.
  //
  public bool VerifyOne(string changedJunction)
  {
    int i;
    for (i = 0; i < handlers.size(); i++)
    {
      JunctionListItem juncHandler = cast <JunctionListItem> handlers[i];
      if (!juncHandler)
        return false;

      if (juncHandler.VerifyMe(changedJunction))
        return true;
    }

    return false;
  }

};

//
// This rule operates in a wait cycle thread. Everytime a message of type "Junction", "Toggled" occurs,
// the rule's settings will be checked.  If satisfied, the thread ends and the rule becomes complete.
//
class MultiJunctionAlignCheck isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler      m_runOnlyOnceHandler;
  GenericBoolHandler   m_multiJunctModeHandler;
  JunctionListHandler  m_junctionListHandler;
  HTMLPropertyGroup    m_groupHandler;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property handler stuff
    m_multiJunctModeHandler = new GenericBoolHandler();
    m_multiJunctModeHandler.Init(me.GetAsset(), "multi-junc-mode");

    m_junctionListHandler = new JunctionListHandler();
    m_junctionListHandler.Init(me.GetAsset(), "multi-junc-align");

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_multiJunctModeHandler, "multiJunc/");
    m_groupHandler.AddHandler(m_junctionListHandler, "juncList/");

    SetPropertyHandler(m_groupHandler);
  }

  thread void ThreadPollCondition(void)
  {
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    wait()
    {
      on "Junction", "Toggled", msg:
      {
        if (IsPaused())
          break;

        Junction junction = cast<Junction> msg.src;
        if (!junction)
        {
          Interface.Log("# MultiJunctionAlignCheck.ThreadPollCondition> ERROR: Junction object reference failure.");
          PostMessage(me, "Timer", "Tick", 0.0);
          continue;
        }

        // do rule check (allows for both AND + OR logic - depending on rule handler setting
        if ((m_multiJunctModeHandler.GetBoolValue()  and  m_junctionListHandler.VerifyAll(junction.GetLocalisedName())) or
            (!m_multiJunctModeHandler.GetBoolValue()  and  m_junctionListHandler.VerifyOne(junction.GetLocalisedName())))
        {
          ruleSet = true;
          if (ruleSet)
            Interface.Log("# MultiJunctionAlignCheck.ThreadPollCondition> INFO: Junctions all set to required state, rule conditions satisfied!");
        }

        PostMessage(me, "Timer", "Tick", 0.0);
        continue;
      }

      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()) // and multiJuncAlignHandler.m_runOnlyOnce)
        {
          Interface.Log("# MultiJunctionAlignCheck.ThreadPollCondition> I have already been completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (ruleSet)
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
//            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

};


Multiple Resource Check
[Rules]

Multiple Resource Check Rule

config.txt:

﻿
username            "Mutiple Resource Check"
kind              "behavior"
kuid              <kuid:-18:1256>
script              "MultiResourceCheckRule"
class             "MultiResourceCheckRule"
icon-texture            "multi_resource_check.texture"
string-table {
  description         "Multiple resource check rule."
  description_html        "Multiple resource check rule."
  multi-rule-html-prefix        "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=4></td><td>"
  multi-rule-html-sufix       "</td></tr></table>"
  resource-check-html-display-string    "Wait for the designated queues from the listed vehicles/industries to collectively $1 having $2 units of $0 products."
  resource-check-blank-product      "<i>click to select</i>"
  resource-check-queueexceed-true     "reach/exceed"
  resource-check-queueexceed-false    "fall below"
  resource-check-name-producttype     "Product Type"
  resource-check-desc-producttype     "Select a product type from the list"
  resource-check-name-amount      "Amount"
  resource-check-desc-amount      "Amount of product units"
  resource-check-html-prefix      "<font color=#000000>"
  resource-check-html-sufix     "</font>"
  object-list-display-name      "<br>"
  object-list-html-prefix       "<font color=#000000>"
  object-list-html-sufix        "</font>"
  object-list-html-table-row-even     "bgcolor=#CCCCAA22"
  object-list-html-table-row-odd      "bgcolor=#CCCCAA44"
  object-list-column0       "<font color=#000000><i>Object</i></font>&nbsp;&nbsp;&nbsp;"
  object-list-column1       "<font color=#000000><i>Queue</i></font>&nbsp;&nbsp;&nbsp;"
  object-list-delete        "<font color=#000000>Remove</font>"
  object-list-add         "Add Object"
  object-list-name-add        "Object"
  object-list-desc-add        "Select a target object from the list"
  object-item-name-targetqueue      "Queues"
  object-item-desc-targetqueue      "Select a queue from the list"
  object-item-blank-targetqueue     "<i>click to select</i>"
  object-item-no-queues       "No queues!"
  object-item-html-prefix       "<td bgcolor=#00000011>"
  object-item-html-sufix        "</td>"
}
username-fr           "Vérification ressources multiples"
string-table-fr {
  description         "Règle de vérification des ressources multiples."
  description_html        "Règle de vérification des ressources multiples."

  resource-check-html-display-string    "Attend que les files d'attentes désignées dans la liste des véhicules/industries $1 toutes $2 unités de $0."
  resource-check-blank-product      "<i>Cliquez pour sélectionner</i>"
  resource-check-queueexceed-true     "atteignent/dépassent"
  resource-check-queueexceed-false    "n'atteignent plus
  resource-check-name-producttype     "Type de produit"
  resource-check-desc-producttype     "Sélectionner un type de produit dans la liste"
  resource-check-name-amount      "Quantité"
  resource-check-desc-amount      "Quantité en unités"

  object-list-column0       "<font color=#000000><i>Objet</i></font>&nbsp;&nbsp;&nbsp;"
  object-list-column1       "<font color=#000000><i>File</i></font>&nbsp;&nbsp;&nbsp;"
  object-list-delete        "<font color=#000000>Retirer</font>"
  object-list-add         "Ajouter Objet"
  object-list-name-add        "Objet"
  object-list-desc-add        "Sélectionner un objet cible dans la liste"
  object-item-name-targetqueue      "Files"
  object-item-desc-targetqueue      "Sélectionner une file dans la liste"
  object-item-blank-targetqueue     "<i>Cliquez pour sélectionner</i>"
  object-item-no-queues       "Pas de file !"
}

MultiResourceCheckRule.gs:

//
// MultiResourceCheckRule.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"
include "common.gs"

//
// Simple crude cut-n-paste handler that has product type, quantity and comparison type values.
//
class ResourceCheckHandler isclass ConfigAssetHandler
{
  public bool  m_queueExceed = true;  // true to complete when queue climbs above setting, false if it falls below
  public Asset m_productType;
  public int   m_amount = 0;

  //
  // Method definitions
  //
  Asset FindAsset(string assetName);

  //
  // Private member method implementations
  //

  Asset FindAsset(string assetName)
  {
    Asset[] products = World.GetAssetList("product");
    int i;
    for (i = 0; i < products.size(); i++)
      if (products[i].GetLocalisedName() == assetName)
        return products[i];

    return null;
  }

  //
  // Property handler methods
  //

  public string GetDescriptionHTML(void)
  {
    string exceedMode = m_assetStrTable.GetString(m_configPrefix + "-queueExceed-" + (string)m_queueExceed);

    string productName = "";
    if (m_productType)
      productName = m_productType.GetLocalisedName();
    else
      productName = m_assetStrTable.GetString(m_configPrefix + "-blank-product");

    string htmlPage = m_assetStrTable.GetString3(m_configPrefix + "-html-display-string",
                                                 HREF("productType") + productName + "</a>",
                                                 HREF("queueExceed") + exceedMode + "</a>",
                                                 HREF("amount") + m_amount + "</a>");

    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  public string GetPropertyName(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "productType")
      return m_assetStrTable.GetString(m_configPrefix + "-name-productType");

    if (property == "amount")
      return m_assetStrTable.GetString(m_configPrefix + "-name-amount");

    return inherited(propertyID);
  }

  public string GetPropertyDescription(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "productType")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-productType");

    if (property == "amount")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-amount");

    return inherited(propertyID);
  }

  public string GetPropertyType(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "queueExceed")
      return "link";

    if (property == "productType")
      return "list,1";

    if (property == "amount")
      return "int,0,200000,1"; // should have value limits?

    return "";
  }

  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "queueExceed")
      m_queueExceed = !m_queueExceed;

    else if (property == "productType")
      m_productType = FindAsset(value.AsString());

    else if (property == "amount")
      m_amount = value.AsInt();

    else
      inherited(propertyID, value);
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "productType")
    {
      string[] retList = new string[0];
      Asset[] products = World.GetAssetList("product");
      int i;
      for (i = 0; i < products.size(); i++)
        retList[i] = products[i].GetLocalisedName();

      return retList;
    }

    return inherited(propertyID);
  }

  //
  // Return properties of this object in a soup.
  //
  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("ResourceCheckHandler.queueExceed", m_queueExceed);
    soup.SetNamedTag("ResourceCheckHandler.amount", m_amount);

    if (m_productType)
      soup.SetNamedTag("ResourceCheckHandler.productType", m_productType.GetKUID());

    return soup;
  }

  //
  // Initialize this object from the given properties soup.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);
    m_queueExceed = soup.GetNamedTagAsBool("ResourceCheckHandler.queueExceed", true);
    m_amount = soup.GetNamedTagAsInt("ResourceCheckHandler.amount", 0);

    KUID tempKUID = soup.GetNamedTagAsKUID("ResourceCheckHandler.productType");
    if (tempKUID)
      m_productType = World.FindAsset(tempKUID);
  }

};

//
// An object item for use in a list handler.
//
class ObjectListItem isclass ConfigAssetHandler
{
  MapObject    m_objectRef;
  ProductQueue m_targetQueue;

  //
  // Member function definitions
  //

  // workaround...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  public int CountProducts(Asset productType);

  bool SetObjectRef(string objectName);
  bool SetTargetQueue(string queueName);

  //
  // Private member function implementation.
  //

  // counts the amount of products of the given type in the target objects queues
  public int CountProducts(Asset productType)
  {
    if (!m_targetQueue)
    {
      Interface.Log("# ObjectListItem.CountProducts> ERROR: No target queue selected for this object!");
      return 0;
    }

    // special case for an empty queue, just return straight away - no need to check things like product assets etc.
    if (m_targetQueue.GetQueueCount() == 0)
      return 0;

    if (productType)
    {
      ProductFilter filter = Constructors.NewProductFilter();
      filter.AddProduct(productType);
      return m_targetQueue.CountProductMatching(filter);
    }

    return 0;
  }

  bool SetObjectRef(string objectName)
  {
    if (!objectName  or  !objectName.size())
    {
      Interface.Log("# ObjectListItem.SetObjectRef> ERROR: Invalid name provided!");
      return false;
    }

    MapObject newMapObject = cast<MapObject> Router.GetGameObject(objectName);
    if (!newMapObject)
    {
      Interface.Log("# ObjectListItem.SetObjectRef> ERROR: Can't find map object '" + objectName + "'");
      return false;
    }

    m_objectRef = newMapObject;
    m_targetQueue = null; // reset as object has changed
    return true;
  }

  bool SetTargetQueue(string queueName)
  {
    if (!queueName  or  !queueName.size())
      m_targetQueue = null;

    if (m_objectRef)
    {
      ProductQueue[] queues = m_objectRef.GetQueues();
      int i, out = 0;
      for (i = 0; i < queues.size(); i++)
        if (queues[i].GetQueueName() == queueName)
        {
          m_targetQueue = queues[i];
          return true;
        }
    }

    return false;
  }

  //
  // Property methods
  //

  //
  // Gets HTML table cells that describe the object and the selected queue
  //
  public string GetDescriptionHTML(void)
  {
    string targetQueueName = "";
    if (m_targetQueue)
      targetQueueName = m_targetQueue.GetQueueName();
    else
      targetQueueName = m_assetStrTable.GetString(m_configPrefix + "-blank-targetqueue");

    string objectName = "null";
    if (m_objectRef)
      objectName = m_objectRef.GetLocalisedName();

    return m_htmlPrefix + "<font color=#000000>" + objectName + "</font>&nbsp;&nbsp;</td>"
                        + "<td bgcolor=#00000011><font color=#000000>" + HREF("targetQueue") + targetQueueName + "</a></font>&nbsp;&nbsp;" + m_htmlSufix;
  }

  //
  // Allows the junction name to be set through this interface method.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "objectName")
      SetObjectRef(value.AsString());

    else if (property == "targetQueue")
      SetTargetQueue(value.AsString());

    else
      inherited(propertyID, value);
  }

  //
  // Allows the object name or target queue name to be obtained through this property method.
  //
  public string GetPropertyValue(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "objectName")
    {
      if (m_objectRef)
        return m_objectRef.GetLocalisedName();

      return "null";
    }

    if (property == "targetQueue")
    {
      if (m_targetQueue)
        return m_targetQueue.GetQueueName();

      return "";
    }

    return inherited(propertyID);
  }

  //
  // ??
  //
  public string[] GetPropertyElementList(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "targetQueue")
    {
      if (m_objectRef)
      {
        string[] retList = new string[0];
        ProductQueue[] queues = m_objectRef.GetQueues();

        int i, out = 0;
        for (i = 0; i < queues.size(); i++)
        {
          string name = queues[i].GetQueueName();
          if (name  and  name.size())
            retList[out++] = name;
        }

        // give an error message if no queues
        if (!retList.size())
          retList[0] = m_assetStrTable.GetString(m_configPrefix + "-no-queues");

        return retList;
      }
    }

    return inherited(propertyID);
  }

  //
  // ??
  //
  public string GetPropertyType(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "targetQueue")
      return "list,1";

    return inherited(propertyID);
  }

  //
  // ??
  //
  public string GetPropertyName(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "targetQueue")
      return m_assetStrTable.GetString(m_configPrefix + "-name-targetQueue");

    return inherited(propertyID);
  }

  //
  // ??
  //
  public string GetPropertyDescription(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "targetQueue")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-targetQueue");

    return inherited(propertyID);
  }

  //
  // Return properties of this object in a soup.
  //
  public Soup GetProperties()
  {
    Soup soup = inherited();

    // only save names to soup if objects exist
    if (m_objectRef)
    {
      soup.SetNamedTag("ObjectListItem.objectName", m_objectRef.GetLocalisedName());
      if (m_targetQueue)
        soup.SetNamedTag("ObjectListItem.targetQueue", m_targetQueue.GetQueueName());
    }

    return soup;
  }

  //
  // Initialize this object from the given properties soup.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);
    string tempObjectName = soup.GetNamedTag("ObjectListItem.objectName");
    SetObjectRef(tempObjectName);

    if (m_objectRef)
    {
      string tempQueueName = soup.GetNamedTag("ObjectListItem.targetQueue");
      SetTargetQueue(tempQueueName);
    }
  }

};

//
// Extends the generic list handler to be a list of junctions.
//
class ObjectListHandler isclass GenericListHandler
{
  // workaround...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  public bool ObjectAlreadyInList(string objectName);
  public bool CheckObjectQueues(bool checkMode, int amount, Asset productType);

  //
  // Adds a new item to the list.  Method well create appropriate sub-handler for it.
  //
  public void AddItem(string itemDisplayName)
  {
    ObjectListItem newItem = new ObjectListItem();
    newItem.Init(m_hostAsset, "object-item");

    // handler prefix is vehicle name with spaces substituted with '-'
    string itemPrefix = TrainUtil.StrSubst(itemDisplayName, " ", "-");
    itemPrefix = itemPrefix + "/";

    me.AddHandler(newItem, itemPrefix);

    // set the vehicleName property
    PropertyValue xvalue = new PropertyValue();
    xvalue.Set(itemDisplayName);
    newItem.SetPropertyValue(newItem.Prop("objectName"), xvalue);
  }

  //
  // Determines if the named item is already in this list.
  //
  public bool ObjectAlreadyInList(string objectName)
  {
    int i;
    for (i = 0; i < handlers.size(); i++)
      if (objectName == handlers[i].GetPropertyValue(handlers[i].Prop("objectName")))
        return true;

    return false;
  }

  //
  // Checks all of the target objects for a collective total and compares that against the past
  // in requirements to determine the result.
  //
  public bool CheckObjectQueues(bool checkMode, int amount, Asset productType)
  {
    if (!productType)
    {
      Interface.Log("# ObjectListHandler.CheckObjectQueues> ERROR: Invalid product type provided!");
      return true;
    }

    int accumelator = 0;
    int i;
    for (i = 0; i < handlers.size(); i++)
    {
      ObjectListItem tempItem = cast<ObjectListItem> handlers[i];
      if (tempItem)
        accumelator = accumelator + tempItem.CountProducts(productType);
    }

    // once accumelator has tallied up all target objects, check this combined total agains't the
    // parameters passed in (ie settings from the resource check handler)
    if (checkMode  and  (accumelator >= amount))
    {
      Interface.Log("# MultiResourceCheckRule> Rule satisfied with collective total of " + accumelator + " >= to " + amount);
      return true;
    }

    if (!checkMode)
    {
      if (accumelator < amount)
      {
        Interface.Log("# MultiResourceCheckRule> Rule satisfied with collective total of " + accumelator + " < amount of " + amount);
        return true;
      }

      if ((amount == 0)  and  (accumelator == 0))
      {
        Interface.Log("# MultiResourceCheckRule> Rule satisfied with collective total of 0 and amount of 0");
        return true;
      }
    }

    return false;
  }

  //
  // Gets list of elements to choose from for the named property
  //
  public string[] GetPropertyElementList(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "add")
    {
      string[] retStrList = new string[0];

      // do the vehicles
      Vehicle[] vehicles = World.GetVehicleList();
      int i, p = 0;
      for (i = 0; i < vehicles.size(); i++)
        if (!ObjectAlreadyInList(vehicles[i].GetLocalisedName()))
          retStrList[p++] = vehicles[i].GetLocalisedName();

      // then the industries
      GameObject[] industries = World.GetIndustryList();
      for (i = 0; i < industries.size(); i++)
      {
        Industry tempIndustry = cast <Industry> industries[i];
        if (tempIndustry)
          if (!ObjectAlreadyInList(tempIndustry.GetLocalisedName()))
            retStrList[p++] = tempIndustry.GetLocalisedName();
      }

      return retStrList;
    }

    return inherited(propertyID);
  }

  void ConstructHandlers(Soup listItemsSoup)
  {
    int i;
    for (i = 0; i < listItemsSoup.CountTags(); i++)
    {
      ObjectListItem newItem = new ObjectListItem();
      newItem.Init(m_hostAsset, "object-item");

      string prefixTag = listItemsSoup.GetIndexedTagName(i);

      Soup itemSoup = listItemsSoup.GetNamedSoup(prefixTag);
      newItem.SetProperties(itemSoup);

      AddHandler(newItem, prefixTag);
    }
  }

};

//
// ??
//
class MultiResourceCheckRule isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  ResourceCheckHandler    m_resourceCheckHandler;
  ObjectListHandler       m_objectListHandler;
  ConfigAssetGroupHandler m_groupHandler;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property handler stuff
    m_resourceCheckHandler = new ResourceCheckHandler();
    m_resourceCheckHandler.Init(me.GetAsset(), "resource-check");

    m_objectListHandler = new ObjectListHandler();
    m_objectListHandler.Init(me.GetAsset(), "object-list");

    m_groupHandler = new ConfigAssetGroupHandler();
    m_groupHandler.Init(me.GetAsset(), "multi-rule");
    m_groupHandler.AddHandler(m_resourceCheckHandler, "resourceCheck/");
    m_groupHandler.AddHandler(m_objectListHandler, "objectList/");

    SetPropertyHandler(m_groupHandler);
  }

  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    wait()
    {
      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()) //  and  m_runOnlyOnceHandler.GetBoolValue())
        {
          Interface.Log("# WaitMinimapScreen.MainMsgThread> Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (GetConditionResult())
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
//            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

  //
  // From ConditionalScenarioBeahvior
  //
  bool GetConditionResult(void)
  {
    return m_objectListHandler.CheckObjectQueues(m_resourceCheckHandler.m_queueExceed,
                                                 m_resourceCheckHandler.m_amount,
                                                 m_resourceCheckHandler.m_productType);
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string propertyStr = "description";

/*    if (resourceCheckInfo.ValidSettings())
    {
      if (resourceCheckInfo.m_watchType)
        propertyStr = propertyStr + "_info_industry";
      else
        propertyStr = propertyStr + "_info_vehicle";

      string waitAction = strTable.GetString("description_info_complete_" + (string)resourceCheckInfo.m_queueExceed);
      return strTable.GetString5(propertyStr, resourceCheckInfo.queueName, resourceCheckInfo.targetObjectName,
                                 waitAction, resourceCheckInfo.amount, resourceCheckInfo.productKUID.GetName());
    }*/

    return inherited();
  }

};


Objective Clear
[Rules]

Objective Clear Rule

config.txt:

﻿
username            "Objective Clear"
kind              "behavior"
kuid              <kuid:-19:2040>
script              "ObjectiveClear"
class             "ObjectiveClearRule"
string-table {
  description         "Clears out the objective list."
  html_description        "This rule will clear the objective list."
}
kuid-table {
  button-bar          <kuid:-19:10197>
  objective-list          <kuid:-19:10198>
}
icon-texture            "icon.texture"
username-de           "Aufträge löschen"
string-table-de {
  html_description        "Diese Regel leert die Auftragsliste."
}
username-it           "Objective Clear"
string-table-it {
  html_description        "This rule will clear the objective list."
}
username-es           "Borrar objetivos"
string-table-es {
  html_description        "Esta regla borrará la lista de objetivos."
}
username-pl           "Objective Clear"
string-table-pl {
  html_description        "This rule will clear the objective list."
}
username-cz           "Smazat úkoly"
string-table-cz {
  html_description        "Toto pravidlo vymaže celý seznam úkolů."
}
username-ru           "Снять все задания"
description-ru            "Это правило убирает все задания из списка заданий."
string-table-ru {
  html_description        "Это правило убирает все задания из списка заданий."
}
username-fr           "Remise à zéro des objectifs"
string-table-fr {
  html_description        "Réinitialise la liste des objectifs."
}

ObjectiveClear.gs:

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"
include "ObjectiveList.gs"

//
// Rule that displays a HTML browser.
//
class ObjectiveClearRule isclass ScenarioBehavior
{
  void ObjectiveClear(void);

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.  When unpaused, reset control mode of Trainz environment to
  // whatever this rule is currently set to.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      // immediately hide the existing browser
      PostMessage(me, "ObjectiveClearRule", "Close", 0.0);
    }
    else if (!IsComplete())
    {
      ObjectiveClear();
    }
  }

  //
  // PropertyObject methods
  //

  // Sets the propeties of this rule from the given database.
  public void SetProperties(Soup soup)
  {
    inherited(soup);

  }

  // Packs properties of this rule up into a database.
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    return soup;
  }

  // Returns HTML code with link that allows control mode to be changed.
  public string GetDescriptionHTML(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    return "<html><body><font color=#000000>"
      + strTable.GetString0("html_description")
      + "<br></font></body></html>";
  }

  // Ask the user select the control mode.
  void ObjectiveClear(void)
  {
    // New objective
    KUID kuid = GetAsset().LookupKUIDTable("objective-list");
    Library libObjectiveList = World.GetLibrary(kuid);
    if (libObjectiveList)
    {
      ObjectiveList ojbList = cast <ObjectiveList> libObjectiveList;
      if (ojbList)
        ojbList.ClearObjectives();
    }

    SetComplete(true);
  }

};


Objective New Rule
[Rules]

Objective New Rule

config.txt:

﻿
username            "Objective New"
kind              "behavior"
kuid              <kuid:-19:2039>
script              "objectivenew"
class             "ObjectiveNewRule"
string-table {
  description         "Adds a new objective to the objective list."
  description_info        "Adds new objective '<i>$0</i>' to the objective list."
  html_description        "Objective Name: <a href=live://property/objectiveName>$0</a><BR>Objective Unique ID: <a href=live://property/objectiveUID>$1</a><BR>Objective Asset: <a href=live://property/objectiveAsset>$2</a>"
  click_to_select         "<i>click to select</i>"
}
kuid-table {
  button-bar          <kuid:-19:10197>
  objective-list          <kuid:-19:10198>
}
icon-texture            "icon.texture"
username-de           "Neuer Auftrag"
string-table-de {
  description         "Fügt neuen Auftrag '$0' der Auftragsliste hinzu."
  html_description        "Auftrags-Name: <a href=live://property/objectiveName>$0</a><BR>Auftrag Unique ID: <a href=live://property/objectiveUID>$1</a><BR>OAuftrag: <a href=live://property/objectiveAsset>$2</a>"
  click_to_select         "<i>für Auswahl klicken</i>"
}
username-it           "Objective New"
string-table-it {
  description         "Adds new objective '$0' to the objective list."
  html_description        "Objective Name: <a href=live://property/objectiveName>$0</a><BR>Objective Unique ID: <a href=live://property/objectiveUID>$1</a><BR>Objective Asset: <a href=live://property/objectiveAsset>$2</a>"
  click_to_select         "<i>click to select</i>"
}
username-es           "Nuevo objetivo"
string-table-es {
  description         "Añade el nuevo objetivo '$0' a la lista de objetivos."
  html_description        "Nombre del objetivo: <a href=live://property/objectiveName>$0</a><BR>ID única del objetivo: <a href=live://property/objectiveUID>$1</a><BR>Componente objetivo: <a href=live://property/objectiveAsset>$2</a>"
  click_to_select         "<i>clic para seleccionar</i>"
}
username-pl           "Objective New"
string-table-pl {
  description         "Adds new objective '$0' to the objective list."
  html_description        "Objective Name: <a href=live://property/objectiveName>$0</a><BR>Objective Unique ID: <a href=live://property/objectiveUID>$1</a><BR>Objective Asset: <a href=live://property/objectiveAsset>$2</a>"
  click_to_select         "<i>click to select</i>"
}
username-cz           "Nový úkol"
string-table-cz {
  description         "Přidá nový úkol '$0' do seznamu."
  html_description        "Název úkolu: <a href=live://property/objectiveName>$0</a><BR>ID úkolu: <a href=live://property/objectiveUID>$1</a><BR>Součást úkolu: <a href=live://property/objectiveAsset>$2</a>"
  click_to_select         "<i>kliknutím zvol</i>"
}
username-ru           "Новое задание"
description-ru            "Добавить новое задание '$0' в список заданий."
string-table-ru {
  description         "Добавить новое задание '$0' в список заданий."
  html_description        "Имя задания: $0Уникальный номер задания: $1Набор задания: $2"
  click_to_select         "щелкните для выбора"
}
username-fr           "Nouvel objectif"
string-table-fr {
  description         "Ajoute le nouvel objectif '$0' à la liste d'objectifs."
  html_description        "Nom de l'objectif : <a ref=live://property/objectiveName>$0</a><BR>Identifiant de l'objectif : <a href=live://property/objectiveUID>$1</a><BR>Objectif : <a href=live://property/objectiveAsset>$2</a>"
  click_to_select         "<i>cliquez pour sélectionner</i>"
}

objectivenew.gs:

//
// ObjectiveNew.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"
include "ObjectiveList.gs"

//
// Rule that displays a HTML browser.
//
class ObjectiveNewRule isclass ScenarioBehavior
{
  string objectiveName = "";
  string objectiveUniqueID = "";
  Asset objectiveAsset = null;

  void ObjectiveNew(void);

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.  When unpaused, reset control mode of Trainz environment to
  // whatever this rule is currently set to.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      // immediately hide the existing browser
      PostMessage(me, "ObjectiveNewRule", "Close", 0.0);
    }
    else if (!IsComplete())
    {
      ObjectiveNew();
    }
  }

  //
  // PropertyObject methods
  //

  // Sets the propeties of this rule from the given database.
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    objectiveName = soup.GetNamedTag("ObjectiveNewRule.objectiveName");
    objectiveUniqueID = soup.GetNamedTag("ObjectiveNewRule.objectiveUniqueID");
    KUID kuid = soup.GetNamedTagAsKUID("ObjectiveNewRule.objectiveAsset");
    if (kuid)
      objectiveAsset = World.FindAsset(kuid);
  }

  // Packs properties of this rule up into a database.
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("ObjectiveNewRule.objectiveName", objectiveName);
    soup.SetNamedTag("ObjectiveNewRule.objectiveUniqueID", objectiveUniqueID);
    if (objectiveAsset)
      soup.SetNamedTag("ObjectiveNewRule.objectiveAsset", objectiveAsset.GetKUID());

    return soup;
  }

  // Returns HTML code with link that allows control mode to be changed.
  public string GetDescriptionHTML(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string currentAssetName = strTable.GetString("click_to_select");
    string objName = strTable.GetString("click_to_select");
    string objID = strTable.GetString("click_to_select");

    if (objectiveName != "")
      objName = objectiveName;

    if (objectiveUniqueID != "")
      objID = objectiveUniqueID;

    string assetIcon = strTable.GetString("click_to_select");
    if (objectiveAsset)
    {
      KUID kuid = objectiveAsset.GetKUID();
      assetIcon = kuid.GetHTMLString();

      assetIcon = HTMLWindow.MakeImage(assetIcon, true, 32, 32);

    }

    return "<html><body><font color=#000000>"
      + strTable.GetString3("html_description", objName, objID, assetIcon)
      + "<br></font></body></html>";
  }

  //
  // Returns a text description
  //
  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (objectiveName != "")
      return strTable.GetString1("description_info", objectiveName);

    return strTable.GetString("description");
  }

  public string GetPropertyType(string propertyID)
  {
    if (propertyID == "objectiveAsset")
      return "list";

    if (propertyID == "objectiveUID")
      return "string";

    if (propertyID == "objectiveName")
      return "string";

    return "";
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    int i;
    Asset[] assets = World.GetAssetList("texture");
    string[] ret = new string[assets.size()];

    for (i = 0; i < assets.size(); i++)
      ret[i] = assets[i].GetLocalisedName();

    return ret;
  }

  public void SetPropertyValue(string p_propertyID, string p_value, int p_index)
  {
    Asset[] assets = World.GetAssetList("texture");
    objectiveAsset = assets[p_index];
  }

  void SetPropertyValue(string propertyID, string value)
  {
    if (propertyID == "objectiveUID")
      objectiveUniqueID = value;
    if (propertyID == "objectiveName")
      objectiveName = value;
  }

  // Ask the user select the control mode.
  void ObjectiveNew(void)
  {
    // New objective
    KUID kuid = GetAsset().LookupKUIDTable("objective-list");
    Library libObjectiveList = World.GetLibrary(kuid);
    if (libObjectiveList)
    {
      ObjectiveList ojbList = cast <ObjectiveList> libObjectiveList;
      if (ojbList)
        ojbList.AddObjective(objectiveUniqueID, objectiveName, objectiveAsset);
    }

    SetComplete(true);
  }

};


Objective Remove
[Rules]

Objective Remove Rule

config.txt:

﻿
username            "Objective Remove"
kind              "behavior"
kuid              <kuid:-19:2041>
script              "ObjectiveRemove"
class             "ObjectiveRemoveRule"
string-table {
  description         "Removes the specified objective form the objective list."
  description_info        "Removes the objective with the unique ID of <i>$0</i> from the objective list."
  html_description        "Objective Unique ID: <a href=live://property/objectiveUID>$0</a>"
  click_to_select         "<i>click to select</i>"
}
kuid-table {
  button-bar          <kuid:-19:10197>
  objective-list          <kuid:-19:10198>
}
icon-texture            "icon.texture"
username-de           "Auftrag entfernen"
string-table-de {
  html_description        "Auftrag Unique ID: <a href=live://property/objectiveUID>$0</a>"
  click_to_select         "<i>für Auswahl klicken</i>"
}
username-it           "Objective Remove"
string-table-it {
  html_description        "Objective Unique ID: <a href=live://property/objectiveUID>$0</a>"
  click_to_select         "<i>click to select</i>"
}
username-es           "Quitar objetivo"
string-table-es {
  html_description        "Id única del objetivo: <a href=live://property/objectiveUID>$0</a>"
  click_to_select         "<i>clic para seleccionar</i>"
}
username-pl           "Objective Remove"
string-table-pl {
  html_description        "Objective Unique ID: <a href=live://property/objectiveUID>$0</a>"
  click_to_select         "<i>click to select</i>"
}
username-cz           "Odstranit úkol"
string-table-cz {
  html_description        "ID úkolu: <a href=live://property/objectiveUID>$0</a>"
  click_to_select         "<i>kliknutím zvol</i>"
}
username-ru           "Удалить задание"
string-table-ru {
  html_description        "Уникальный номер задания: $0"
  click_to_select         "щелкните для выбора"
}
username-fr           "Retirer objectif"
string-table-fr {
  html_description        "Identifiant de l'objectif : <a href=live://property/objectiveUID>$0</a>"
  click_to_select         "<i>cliquez pour sélectionner</i>"
}

ObjectiveRemove.gs:

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"
include "ObjectiveList.gs"

//
// Rule that displays a HTML browser.
//
class ObjectiveRemoveRule isclass ScenarioBehavior
{
  string objectiveUniqueID = "";

  void ObjectiveRemove(void);

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.  When unpaused, reset control mode of Trainz environment to
  // whatever this rule is currently set to.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      // immediately hide the existing browser
      PostMessage(me, "ObjectiveRemoveRule", "Close", 0.0);
    }
    else if (!IsComplete())
    {
      ObjectiveRemove();
    }
  }

  //
  // PropertyObject methods
  //

  // Sets the propeties of this rule from the given database.
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    objectiveUniqueID = soup.GetNamedTag("ObjectiveRemoveRule.objectiveUniqueID");
  }

  // Packs properties of this rule up into a database.
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("ObjectiveRemoveRule.objectiveUniqueID", objectiveUniqueID);

    return soup;
  }

  // Returns HTML code with link that allows control mode to be changed.
  public string GetDescriptionHTML(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string objID = strTable.GetString("click_to_select");

    if (objectiveUniqueID != "")
      objID = objectiveUniqueID;

    return "<html><body><font color=#000000>"
      + strTable.GetString1("html_description", objID)
      + "<br></font></body></html>";
  }

  public string GetPropertyType(string propertyID)
  {
    if (propertyID == "objectiveUID")
      return "string";

    return "";
  }

  void SetPropertyValue(string propertyID, string value)
  {
    if (propertyID == "objectiveUID")
      objectiveUniqueID = value;
  }

  // Ask the user select the control mode.
  void ObjectiveRemove(void)
  {
    // New objective
    KUID kuid = GetAsset().LookupKUIDTable("objective-list");
    Library libObjectiveList = World.GetLibrary(kuid);
    if (libObjectiveList)
    {
      ObjectiveList ojbList = cast <ObjectiveList> libObjectiveList;
      if (ojbList)
        ojbList.RemoveObjective(objectiveUniqueID);
    }

    SetComplete(true);
  }

  //
  // Returns a text description
  //
  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (objectiveUniqueID != "")
      return strTable.GetString1("description_info", objectiveUniqueID);

    return strTable.GetString("description");
  }
};


Online Chat
[Rules]

Online Chat Rule

config.txt:

﻿
username            "Online Chat"
kind              "behavior"
kuid              <kuid:-16:287429>
script              "OnlineChatRule"
class             "OnlineChatRule"
icon-texture            "OnlineChatRule.texture"
string-table {
  description         "Gives access to the online chat interface."
}
kuid-table {
  driver-module         <kuid:-16:10240>
  oachat            <kuid:-16:287430>
}
username-fr           "Discussion en ligne"
string-table-fr {
  description         "Permet d'accéder à l'interface de discussion en ligne."
}

Online Chat.gs:

//
// OnlineChatRule.gs
//
//  Copyright (C) 2004-2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "common.gs"
include "OAChat.gs"
include "Browser.gs"

class ChatWindow
{
    // the profile name of the local user
  public string localProfileName;

    // the profile name of the buddy which this ChatWindow reflects
  public string profileName;

    // the browser corresponding to this ChatWindow
  public Browser browser;

    // our parent rule
  ScenarioBehavior onlineChatRule;

    // construct this ChatWindow
  public void Init(ScenarioBehavior rule, string localName, string name);

    // regenerate the HTML for this ChatWindow's browser
  public void UpdateHTML(void);

    // add an incoming message from the remote user
  public void AddIncomingMessage(string message);

    // add an outgoing message to the remote user
  public void AddOutgoingMessage(string message);

    // return and erase the text entry
  public string CaptureText(void);

    // notify this ChatWindow of the current buddy status
  public void SetBuddyStatus(int status);

  //
  // PRIVATE IMPLEMENTATION
  //

  string messages = "";
  int buddyStatus = OnlineGroup.USER_STATUS_UNKNOWN;

  public void Init(ScenarioBehavior rule, string localName, string name)
  {
    localProfileName = localName;
    profileName = name;
    onlineChatRule = rule;

    browser = Constructors.NewBrowser();
    browser.SetWindowSize(400, 350);
    browser.SetWindowGrow(200, 150, 10000, 10000);
    //AddHandler(browser, "Browser-URL", "", "OnBrowserURL");

    UpdateHTML();
  }

  public void UpdateChatText(void)
  {
    string header = "<HTML><BODY><font color=#000000>";
    string footer = "</font></BODY></HTML>";
    string chat = messages;
    browser.SetElementProperty("chat", "html", header + chat + footer);
    browser.SetElementProperty("chat", "scroll", 1000000.f);
  }

  public void UpdateHTML(void)
  {
    string saveText = browser.GetElementProperty("textbox", "text");

    string outerHeader = "<HTML><BODY><font color=#000000>";
    string outerFooter = "</font></BODY></HTML>";
    string outerTitle = "<p><b>Chat with " + profileName + "</b></p>";
    string outerBody = "<p><trainz-object style=browser id='chat' width=100% height=-50></trainz-object></p>";
    string outerTextbox = "<p><a href='live://chat-text/'><trainz-object style='text-line' id='textbox' width=100% height=30 background='text-background.tga' align=left></trainz-object></a></p>";
    browser.LoadHTMLString(onlineChatRule.GetAsset(),
      outerHeader + outerTitle + outerBody + outerTextbox + outerFooter);

    browser.SetElementProperty("textbox", "max-chars", "400");
    //browser.SetElementProperty("textbox", "focused", "true");

    browser.SetElementProperty("textbox", "text", saveText);

    UpdateChatText();
  }

  public void AddIncomingMessage(string message)
  {
    if (message == "")
      return;

    if (messages != "")
      messages = messages + "<br>";
    messages = messages + BrowserInterface.Quote("<" + profileName + "> ");
    messages = messages + BrowserInterface.Quote(message);

    UpdateChatText();
  }

  public void AddOutgoingMessage(string message)
  {
    if (message == "")
      return;

    if (messages != "")
      messages = messages + "<br>";

    messages = messages + "<font color=#404000>" + BrowserInterface.Quote("<" + localProfileName + "> " + message) + "</font>";
    UpdateChatText();
  }

  public void NotifySystemMessage(string message)
  {
    if (messages != "")
      messages = messages + "<br>";

    messages = messages + "<font color=#888888>* " + BrowserInterface.Quote(message) + "</font>";
    UpdateChatText();
  }

  public string CaptureText(void)
  {
    string ret = browser.GetElementProperty("textbox", "text");
    browser.SetElementProperty("textbox", "text", "");

    return ret;
  }

  public void SetBuddyStatus(int status)
  {
    if (buddyStatus == status)
      return;

    if (buddyStatus != OnlineGroup.USER_STATUS_UNKNOWN)
    {
      if (status == OnlineGroup.USER_STATUS_OFFLINE)
        NotifySystemMessage(profileName + " has gone offline.");
      else if (buddyStatus == OnlineGroup.USER_STATUS_OFFLINE)
        NotifySystemMessage(profileName + " is now online.");
    }

    buddyStatus = status;
  }
};

class BuddyInfoWindow
{

    // the profile name of the buddy which this BuddyInfoWindow reflects
  public string profileName;

    // the browser corresponding to this BuddyInfoWindow
  public Browser browser;

    // our parent rule
  ScenarioBehavior onlineChatRule;

    // the chat library
  OAChat oachat;

    // construct this BuddyInfoWindow
  public void Init(ScenarioBehavior rule, OAChat oachat, string name);

    // regenerate the HTML for this BuddyInfoWindow's browser
  public void UpdateHTML(void);

  //
  // INTERNAL IMPLEMENTATION
  //

  public void Init(ScenarioBehavior rule, OAChat oachatLibrary, string name)
  {
    profileName = name;
    onlineChatRule = rule;
    oachat = oachatLibrary;

    browser = Constructors.NewBrowser();
    browser.SetWindowSize(150, 200);
    //browser.SetWindowGrow(100, 50, 10000, 10000);
    //AddHandler(browser, "Browser-URL", "", "OnBrowserURL");

    UpdateHTML();
  }

  public void UpdateHTML(void)
  {
    string pageHeader = "<HTML><BODY><font color=#000000><p>Buddy info for <b>" + profileName + "</b></p><br>";
    string pageFooter = "</font></BODY></HTML>";

    int buddyStyle = oachat.GetBuddyStyle(oachat.GetBuddyIndex(profileName));

    string pageBody =
      "<p>" + HTMLWindow.RadioButton("live://buddy-info/friend", buddyStyle == BuddyInfo.STYLE_BUDDY) + "Friend</p>" +
      //"<p>" + HTMLWindow.RadioButton("live://buddy-info/acquaintance", buddyStyle == BuddyInfo.STYLE_TEMPORARY) + "<font color=#00000088>Acquaintance</font></p>" +
      "<p>" + HTMLWindow.RadioButton("live://buddy-info/ignored", buddyStyle == BuddyInfo.STYLE_IGNORED) + "Ignored</p>" +
      "<br>" +
      "<p><a href='live://buddy-info/remove'>Remove buddy</a></p>";

    browser.LoadHTMLString(onlineChatRule.GetAsset(), pageHeader + pageBody + pageFooter);
  }
};

class BroadcastWindow
{
  public Browser browser;

    // construct this BroadcastWindow
  public void Init(ScenarioBehavior rule, OAChat oachat);

    // return and erase the text entry
  public string CaptureText(void);

  //
  // IMPLEMENTATION
  //

  public void Init(ScenarioBehavior onlineChatRule, OAChat oachat)
  {
    browser = Constructors.NewBrowser();
    browser.SetWindowSize(400, 350);

    string outerHeader = "<HTML><BODY><font color=#000000>";
    string outerFooter = "</font></BODY></HTML>";
    string outerTitle = "<p><b>Broadcast to online buddies</b></p>";
    string outerBody = "<p><a href='live://broadcast-text/'><trainz-object style='text-line' id='textbox' width=100% height=30 background='text-background.tga'></trainz-object></a></p>";
    browser.LoadHTMLString(onlineChatRule.GetAsset(),
      outerHeader + outerTitle + outerBody + outerFooter);

    browser.SetElementProperty("textbox", "max-chars", "200");
  }

  public string CaptureText(void)
  {
    string ret = browser.GetElementProperty("textbox", "text");
    browser.SetElementProperty("textbox", "text", "");

    return ret;
  }

};

class OnlineChatRule isclass ScenarioBehavior
{
  Browser hudPanel;
  Browser buddyListBrowser;
  OAChat oachat;
  bool hudEnabled = true;
  ChatWindow[] chatWindowList = new ChatWindow[0];
  BuddyInfoWindow[] buddyInfoWindowList = new BuddyInfoWindow[0];
  BroadcastWindow broadcastWindow;

  bool m_filterFriends = true;
  bool m_filterOnline = true;
  bool m_filterInvites = true;
  bool m_filterBanned = true;

  public void Init(Asset asset);

  void ConstructHudPanel(void);
  void CloseHudPanel(void);
  void UpdateHudHTML(void);

  void ConstructBuddyListBrowser(void);
  void CloseBuddyListBrowser(void);
  void UpdateBuddyListBrowser(void);

  void OnBrowserURL(Message msg);
  public string LibraryCall(string function, string[] stringParam, GSObject[] objectParam);
  public Soup GetProperties(void);
  public void SetProperties(Soup soup);
  void UpdateHUDActive(void);

  public ChatWindow GetChatWindow(string profileName);
  public ChatWindow FindChatWindow(string profileName);
  public BuddyInfoWindow GetBuddyInfoWindow(string profileName);
  public BuddyInfoWindow FindBuddyInfoWindow(string profileName);

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);

    oachat = cast<OAChat> World.GetLibrary(asset.LookupKUIDTable("oachat"));

    AddHandler(me, "Browser-Closed", "", "OnBrowserClosed");
    AddHandler(me, "Browser-URL", "live://chat-text/", "OnChatTextEnter");
    AddHandler(me, "Browser-URL", "live://broadcast-text/", "OnBroadcastTextEnter");
    AddHandler(me, "Browser-URL", "live://buddy-info/friend", "OnClickBuddyInfo");
    AddHandler(me, "Browser-URL", "live://buddy-info/acquaintance", "OnClickBuddyInfo");
    AddHandler(me, "Browser-URL", "live://buddy-info/ignored", "OnClickBuddyInfo");
    AddHandler(me, "Browser-URL", "live://buddy-info/remove", "OnClickBuddyInfo");

    AddHandler(oachat, "OAChat.Message", "", "OnOAChatMessage");
    AddHandler(oachat, "OAChat", "UsersChange", "OnOAChatUsersChange");
    AddHandler(oachat, "OAChat", "StatusChange", "OnOAChatStatusChange");
  }

  //
  // Pause/unpause this rule.
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    UpdateHUDActive();
  }

  //
  bool hudActive = false;

  void ActivateHUD(void)
  {
    if (hudActive)
      return;
    hudActive = true;

    ConstructHudPanel();
  }

  void DeactivateHUD(void)
  {
    if (!hudActive)
      return;
    hudActive = false;

    CloseBuddyListBrowser();
    CloseHudPanel();
  }

  void UpdateHUDActive(void)
  {
    if (hudEnabled)
      if (!IsPaused())
        if (World.GetCurrentModule() == World.DRIVER_MODULE)
        {
          ActivateHUD();
          return;
        }

    DeactivateHUD();
  }

  void ConstructHudPanel(void)
  {
    if (hudPanel)
    {
      UpdateHudHTML();
      return;
    }

    int width = Interface.GetDisplayWidth();
    hudPanel = Constructors.NewBrowser();
    hudPanel.SetWindowStyle(Browser.STYLE_NO_FRAME);
    hudPanel.SetCloseEnabled(false);
    hudPanel.SetWindowRect(width - 183,100,width,100+44);

    AddHandler(hudPanel, "Browser-URL", "", "OnBrowserURL");

    UpdateHudHTML();

    //
    // Add this browser to the DriverModule's custom HUD list
    //
    Library driverModule = World.GetLibrary( GetAsset().LookupKUIDTable("driver-module") );
    GameObject[] objectParam = new GameObject[1];
    objectParam[0] = hudPanel;
    driverModule.LibraryCall("add-hud", null, objectParam);
  }

  void CloseHudPanel(void)
  {
    if (!hudPanel)
      return;

    //
    // Remove this browser from the DriverModule's custom HUD list
    //
    Library driverModule = World.GetLibrary( GetAsset().LookupKUIDTable("driver-module") );
    GameObject[] objectParam = new GameObject[1];
    objectParam[0] = hudPanel;
    driverModule.LibraryCall("remove-hud", null, objectParam);

    hudPanel = null;
  }

  void UpdateHudHTML(void)
  {
    if (!hudPanel)
      return;

    bool isUserOnline = oachat.GetOnlineStatus();

    string bodyText = "<HTML><BODY><img src='hud-background.tga'></BODY></HTML> <HTML><BODY><font color=#000000><TABLE inherit-font><TR>";

    string buddyListTooltip;
    if (isUserOnline)
      buddyListTooltip = "Toggle buddy list";
    else
      buddyListTooltip = "Offline";

    bodyText = bodyText + "<TD><a href='live://buddy-list/' tooltip='" + buddyListTooltip + "'>";

    if (isUserOnline)
      bodyText = bodyText + "<IMG SRC='images/status-idle.tga' width=40 height=40></a></TD>";
    else
      bodyText = bodyText + "<IMG SRC='images/status-offline.tga' width=40 height=40></a></TD>";

    int friendsOnline = 0;
    int acquaintancesOnline = 0;
    int friendsOffline = 0;

    int i;
    for (i = 0; i < oachat.CountBuddies(); i++)
    {
      int userStatus = oachat.GetBuddyStatus(i);
      int buddyStyle = oachat.GetBuddyStyle(i);

      if (buddyStyle == BuddyInfo.STYLE_BUDDY)
      {
        if (userStatus == OnlineGroup.USER_STATUS_OFFLINE)
          friendsOffline++;
        else
          friendsOnline++;
      }
      else if (buddyStyle == BuddyInfo.STYLE_TEMPORARY)
      {
        acquaintancesOnline++;
      }
    }

    bodyText = bodyText + "<TD><nowrap><IMG src='images/stat-friends.tga' width=32 height=32>" + friendsOnline + "</nowrap></TD>";
    bodyText = bodyText + "<TD><nowrap><IMG src='images/stat-acquaintances.tga' width=32 height=32>" + acquaintancesOnline + "</nowrap></TD>";
    bodyText = bodyText + "<TD><nowrap><IMG src='images/stat-offline-friends.tga' width=32 height=32>" + friendsOffline + "</nowrap></TD>";

    bodyText = bodyText + "</TR></TABLE></FONT></BODY></HTML>";
    hudPanel.LoadHTMLString(GetAsset(), bodyText);
  }

  //
  // Create a new browser if needed
  //
  void ConstructBuddyListBrowser(void)
  {
    if (buddyListBrowser)
    {
      UpdateBuddyListBrowser();
      return;
    }

      // only allow the user to open the 'buddy list' if we are online
    if (!oachat.GetOnlineStatus())
    {
      // hint that we would like a connection
      oachat.Connect();
      return;
    }

    //int width = Interface.GetDisplayWidth();
    buddyListBrowser = Constructors.NewBrowser();
    //buddyListBrowser.SetWindowStyle(Browser.STYLE_NO_FRAME);
    buddyListBrowser.SetCloseEnabled(true);
    buddyListBrowser.SetScrollEnabled(true);
    buddyListBrowser.SetWindowRect(100,100,100+300,100+314);
    buddyListBrowser.SetWindowGrow(100+300,100+314, 100+300,10000);

    //AddHandler(buddyListBrowser, "Browser-URL", "", "OnBrowserURL");

    UpdateBuddyListBrowser();
  }

  //
  //
  void CloseBuddyListBrowser(void)
  {
    if (!buddyListBrowser)
      return;

    buddyListBrowser = null;
  }

  //
  void UpdateBuddyListBrowser(void)
  {
    if (!buddyListBrowser)
      return;

    string header = "<HTML><BODY><font color=#000000>";
    string footer = "</font></BODY></HTML>";
    int i;

    string buddyListText = "<p><b>Contact List</b></p>";
    buddyListText = buddyListText + "<p>";
    buddyListText = buddyListText + HTMLWindow.CheckBox("live://filter-friends/", m_filterFriends) + "<IMG src='images/filter-friends.tga'>   ";
    buddyListText = buddyListText + HTMLWindow.CheckBox("live://filter-online/", m_filterOnline) + "<IMG src='images/filter-online.tga'>   ";
    buddyListText = buddyListText + HTMLWindow.CheckBox("live://filter-invites/", m_filterInvites) + "<IMG src='images/filter-invites.tga'>   ";
    buddyListText = buddyListText + HTMLWindow.CheckBox("live://filter-banned/", m_filterBanned) + "<IMG src='images/filter-banned.tga'>";
    buddyListText = buddyListText + "</p>";

    // "buddies" sub-browser
    string buddyText = "<html><body><font color=#000000><table width=100% inherit-font><tr><td width=10></td><td></td></tr>"; //  bgcolor=#FFFFFF80
    for (i = 0; i < oachat.CountBuddies(); i++)
    {
      string iconTooltip = "Chat";
      string lineText = "<tr><td></td><td><a href='live://buddy/#" + i + "' tooltip='" + iconTooltip + "'>";
      int userStatus = oachat.GetBuddyStatus(i);
      string buddyProfileName = oachat.GetBuddyProfileName(i);

      ChatWindow buddyChatWindow = FindChatWindow(buddyProfileName);
      if (buddyChatWindow)
        buddyChatWindow.SetBuddyStatus(userStatus);

      BuddyInfoWindow buddyInfoWindow = FindBuddyInfoWindow(buddyProfileName);
      if (buddyInfoWindow)
        buddyInfoWindow.UpdateHTML();

      int buddyStyle = oachat.GetBuddyStyle(i);
      bool showBuddy = true;

      if (buddyStyle == BuddyInfo.STYLE_BUDDY)
      {
        showBuddy = m_filterFriends;
      }
      else if (buddyStyle == BuddyInfo.STYLE_TEMPORARY)
      {
        showBuddy = m_filterOnline;
      }
      else if (buddyStyle == BuddyInfo.STYLE_IGNORED)
      {
        showBuddy = m_filterBanned;
      }
      else if (buddyStyle == BuddyInfo.STYLE_INVITE)
      {
        showBuddy = m_filterInvites;
      }
      else
      {
        showBuddy = true;
      }

      if (showBuddy)
      {
        if (oachat.HasBuddyQueuedMessage(i))
          lineText = lineText + "<img src='images/contact-invite.tga' width=20 height=20> ";
        else if (buddyStyle == BuddyInfo.STYLE_IGNORED)
          lineText = lineText + "<img src='images/contact-ignored.tga' width=20 height=20> ";
        else if (userStatus == OnlineGroup.USER_STATUS_OFFLINE)
          lineText = lineText + "<img src='images/contact-offline.tga' width=20 height=20> ";
        else if (buddyStyle == BuddyInfo.STYLE_BUDDY)
          lineText = lineText + "<img src='images/contact-friend.tga' width=20 height=20> ";
        else if (buddyStyle == BuddyInfo.STYLE_TEMPORARY)
          lineText = lineText + "<img src='images/contact-acquaintance.tga' width=20 height=20> ";
        else if (buddyStyle == BuddyInfo.STYLE_INVITE)
          lineText = lineText + "<img src='images/contact-request.tga' width=20 height=20> ";

        lineText = lineText + buddyProfileName + "</a></td>";

        string infoTooltip = "View buddy info";
        lineText = lineText + "<td><a href='live://info/#" + i + "' tooltip='" + infoTooltip + "'><img src='images/info.tga' width=20 height=20></a></td>";

        lineText = lineText + "</tr>";

        buddyText = buddyText + lineText;
      }
    }
    buddyText = buddyText + "</table></body></html>";

    buddyListText = buddyListText + "<p><trainz-object style=browser id='buddylist' width=100% height=-65></trainz-object></p>";

    buddyListText = buddyListText + "<p><table><tr>";
    buddyListText = buddyListText + "<td><a href='live://broadcast/' tooltip='Broadcast message'><img src='images/send-broadcast.tga'></a></td>";
    buddyListText = buddyListText + "<td><a href='live://invite/' tooltip='Add buddy'><img src='images/send-invite.tga'></a></td>";
    buddyListText = buddyListText + "<td><trainz-object style='text-line' id='invite' width=160 height=20 background='text-background.tga'></trainz-object></td>";
    buddyListText = buddyListText + "</tr></table></p>";

    // todo buddyListBrowser.LoadHTMLFile(me.GetAsset(), "CabControlsSteamHUD.html");
    buddyListBrowser.LoadHTMLString(GetAsset(), header + buddyListText + footer);
    buddyListBrowser.SetElementProperty("invite", "max-chars", "20");
    buddyListBrowser.SetElementProperty("buddylist", "html", buddyText);
  }

  //
  void BroadcastText(string message)
  {
    int i;
    for (i = 0; i < chatWindowList.size(); i++)
    {
      ChatWindow chat = chatWindowList[i];

      string profileName = chat.profileName;
      chat.AddOutgoingMessage(message);
      oachat.SendMessage(profileName, message);
    }
  }

  //
  //
  void OnBrowserURL(Message msg)
  {
    if (!hudActive)
      return;
    if (buddyListBrowser != msg.src  and  hudPanel != msg.src)
      return;

    if (msg.minor[0, 14] == "live://buddy/#")
    {
      // click on one of our buddies
      int index = Str.ToInt(msg.minor[14,]);
      string buddyProfileName = oachat.GetBuddyProfileName(index);
      GetChatWindow(buddyProfileName);
    }

    else if (msg.minor[0, 13] == "live://info/#")
    {
      // click on one of our buddies' info buttons
      int index = Str.ToInt(msg.minor[13,]);
      string buddyProfileName = oachat.GetBuddyProfileName(index);
      GetBuddyInfoWindow(buddyProfileName);
    }

    else if (msg.minor == "live://invite/")
    {
      // click on our 'invite' button

      string inviteProfileName = buddyListBrowser.GetElementProperty("invite", "text");
      buddyListBrowser.SetElementProperty("invite", "text", "");
      oachat.AddBuddy(inviteProfileName, BuddyInfo.STYLE_INVITE);
    }

    else if (msg.minor == "live://broadcast/")
    {
      // click on our 'broadcast' button
      /*

      string broadcastString = buddyListBrowser.GetElementProperty("invite", "text");
      buddyListBrowser.SetElementProperty("invite", "text", "");

      BroadcastText(broadcastString);
      */
      if (broadcastWindow)
      {
        broadcastWindow.browser.BringToFront();
      }
      else
      {
        broadcastWindow = new BroadcastWindow();
        broadcastWindow.Init(me, oachat);
      }
    }

    else if (msg.minor == "live://buddy-list/")
    {
      // click on our 'buddy list' toggle

      if (!buddyListBrowser)
        ConstructBuddyListBrowser();
      else
        CloseBuddyListBrowser();
    }

    else if (msg.minor == "live://filter-friends/")
    {
      m_filterFriends = !m_filterFriends;
      UpdateBuddyListBrowser();
    }

    else if (msg.minor == "live://filter-online/")
    {
      m_filterOnline = !m_filterOnline;
      UpdateBuddyListBrowser();
    }

    else if (msg.minor == "live://filter-invites/")
    {
      m_filterInvites = !m_filterInvites;
      UpdateBuddyListBrowser();
    }

    else if (msg.minor == "live://filter-banned/")
    {
      m_filterBanned = !m_filterBanned;
      UpdateBuddyListBrowser();
    }
  }

  void OnBrowserClosed(Message msg)
  {
    int i;

      // check to see whether one of our ChatWindow browsers have been closed; if so, get rid of the ChatWindow
    for (i = 0; i < chatWindowList.size(); i++)
      if (chatWindowList[i].browser == msg.src)
      {
        chatWindowList[i, i+1] = null;
        break;
      }

      // check to see whether one of our BuddyInfo browsers have been closed; if so, get rid of the BuddyInfo
    for (i = 0; i < buddyInfoWindowList.size(); i++)
      if (buddyInfoWindowList[i].browser == msg.src)
      {
        buddyInfoWindowList[i, i+1] = null;
        break;
      }

      // buddy list?
    if (msg.src == buddyListBrowser)
      buddyListBrowser = null;

    if (broadcastWindow  and  msg.src == broadcastWindow.browser)
      broadcastWindow = null;
  }

  void OnChatTextEnter(Message msg)
  {
    int i;

      // check to see whether one of our ChatWindow browsers has been edited
    for (i = 0; i < chatWindowList.size(); i++)
      if (chatWindowList[i].browser == msg.src)
      {
        string message = chatWindowList[i].CaptureText();
        string profileName = chatWindowList[i].profileName;

        chatWindowList[i].AddOutgoingMessage(message);
        oachat.SendMessage(profileName, message);
        break;
      }
  }

  void OnBroadcastTextEnter(Message msg)
  {
    if (broadcastWindow  and  msg.src == broadcastWindow.browser)
    {
      string message = broadcastWindow.CaptureText();
      broadcastWindow = null;

      BroadcastText(message);
    }
  }

  void OnClickBuddyInfo(Message msg)
  {
    int i;
    for (i = 0; i < buddyInfoWindowList.size(); i++)
      if (buddyInfoWindowList[i].browser == msg.src)
      {
        if (msg.minor == "live://buddy-info/friend")
          oachat.SetBuddyStyle(oachat.GetBuddyIndex(buddyInfoWindowList[i].profileName), BuddyInfo.STYLE_BUDDY);

        //else if (msg.minor == "live://buddy-info/acquaintance")
        //  oachat.SetBuddyStyle(oachat.GetBuddyIndex(buddyInfoWindowList[i].profileName), BuddyInfo.STYLE_TEMPORARY);

        else if (msg.minor == "live://buddy-info/ignored")
          oachat.SetBuddyStyle(oachat.GetBuddyIndex(buddyInfoWindowList[i].profileName), BuddyInfo.STYLE_IGNORED);

        else if (msg.minor == "live://buddy-info/remove")
        {
          oachat.RemoveBuddy(buddyInfoWindowList[i].profileName);
          buddyInfoWindowList[i, i+1] = null;
        }

        return;
      }
  }

  void DispatchMessagesToChatWindow(ChatWindow chat)
  {
    string profileName = chat.profileName;

    while (1)
    {
      string message = oachat.GetBuddyQueuedMessage(profileName);
      if (message == "")
        break;

      chat.AddIncomingMessage(message);
    }

    //chat.UpdateHTML();
  }

  void OnOAChatMessage(Message msg)
  {
    // is this a message which should go in one of our ChatWindows?
    int i;

    Interface.Log("OnOAChatMessage");

    for (i = 0; i < chatWindowList.size(); i++)
      if (chatWindowList[i].profileName == msg.minor)
      {
        DispatchMessagesToChatWindow(chatWindowList[i]);
        return;
      }

    // otherwise, we now have a nice message icon that needs displaying
    UpdateBuddyListBrowser();
  }

  void OnOAChatUsersChange(Message msg)
  {
    UpdateHudHTML();
    UpdateBuddyListBrowser();
  }

  void OnOAChatStatusChange(Message msg)
  {
    UpdateHudHTML();

    if (!oachat.GetOnlineStatus())
    {
      CloseBuddyListBrowser();

      // todo: notify each of the chat windows
    }
  }

  public ChatWindow GetChatWindow(string profileName)
  {
    if (profileName == "")
      return null;

    int i;
    for (i = 0; i < chatWindowList.size(); i++)
      if (chatWindowList[i].profileName == profileName)
      {
        chatWindowList[i].browser.BringToFront();
        return chatWindowList[i];
      }

    // for now, automatically spawn a new ChatWindow
    ChatWindow chat = new ChatWindow();
    chat.Init(me, oachat.GetLocalUserProfileName(), profileName);
    chatWindowList[chatWindowList.size()] = chat;
    DispatchMessagesToChatWindow(chat);
    return chat;
  }

  public ChatWindow FindChatWindow(string profileName)
  {
    if (profileName == "")
      return null;

    int i;
    for (i = 0; i < chatWindowList.size(); i++)
      if (chatWindowList[i].profileName == profileName)
        return chatWindowList[i];

    return null;
  }

  public BuddyInfoWindow GetBuddyInfoWindow(string profileName)
  {
    if (profileName == "")
      return null;

    int i;
    for (i = 0; i < buddyInfoWindowList.size(); i++)
      if (buddyInfoWindowList[i].profileName == profileName)
      {
        buddyInfoWindowList[i].browser.BringToFront();
        return buddyInfoWindowList[i];
      }

    // for now, automatically spawn a new BuddyInfoWindow
    BuddyInfoWindow info = new BuddyInfoWindow();
    info.Init(me, oachat, profileName);
    buddyInfoWindowList[buddyInfoWindowList.size()] = info;
    return info;
  }

  public BuddyInfoWindow FindBuddyInfoWindow(string profileName)
  {
    if (profileName == "")
      return null;

    int i;
    for (i = 0; i < buddyInfoWindowList.size(); i++)
      if (buddyInfoWindowList[i].profileName == profileName)
        return buddyInfoWindowList[i];

    return null;
  }

  //
  //
  public string LibraryCall(string function, string[] stringParam, GSObject[] objectParam)
  {
    string ret;

    if (function == "show")
    {
      hudEnabled = true;

      UpdateHUDActive();

      return ret;
    }

    if (function == "hide")
    {
      hudEnabled = false;

      UpdateHUDActive();

      return ret;
    }

    return inherited(function, stringParam, objectParam);
  }

  //
  // Save properties to the soup
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    // save state of browser
    soup.SetNamedTag("CabControlsHUD.enabledState", hudEnabled);

    return soup;
  }

  //
  // Initialise from properties including the hide/show state
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    // determine if we need to recreate the HUD browser (ie enabled/disabled)
    bool enabledHUD = soup.GetNamedTagAsBool("CabControlsHUD.enabledState", hudEnabled);
    if (enabledHUD)
      LibraryCall("show", null, null);
    else
      LibraryCall("hide", null, null);

  }
};


Ordered List
[Rules]

Ordered List Rule

config.txt:

﻿
username            "Ordered List"
kind              "behavior"
kuid              <kuid:-16:2033>
script              "OrderedListRule"
class             "OrderedListRule"
string-table {
  html_description        "Child rules (indented directly under this rule) will be executed in order."
  html_repeats          "This process will repeat <a href=live://property/repeats>$0</a> time(s)."
  html_infinite         "This process will repeat forever."
  description         "Child rules will be executed in order once this rule starts."
  description-repeats       "This process will repeat $0 times."
  description-infinite        "This process will repeat forever."
  ;
  repeats_name          "Number of repeats"
  repeats_description       "Number of times this rule will repeat across the child rules."
}
icon-texture            "folder_type.texture"
username-de           "Geordnete Liste"
string-table-de {
  html_description        "Tochterregeln (direkt unter dieser Regel platziert) werden in Reihenfolge ausgeführt."
  html_repeats          "Dieser Prozess wird <a href=live://property/repeats>$0</a> mal wiederholt."
  html_infinite         "Dieser Prozess wird unendlich oft wiederholt."
  description         "Tochterregeln werden in Reihenfolge ausgeführt, sobald diese Regel ausgelöst wird."
  description-repeats       "Dieser Prozess wird $0 Mal wiederholt."
  description-infinite        "Dieser Prozwess wird unendlich oft wiederholt."
  ;
  repeats_name          "Anzahl der Wiederholungen"
  repeats_description       "Wie oft diese Regel über den Tochterregeln ausgeführt wird."
}
username-it           "Elenco ordinato"
string-table-it {
  html_description        "Le regole secondarie, rientrate rispetto a quella principale, saranno eseguite solo dopo aver avviato quest'ultima."
}
username-es           "Lista ordenada"
string-table-es {
  html_description        "Las reglas subsidiarias (tabuladas bajo esta regla) se llevarán a cabo por orden."
  html_repeats          "Este proceso se repetirá <a href=live://property/repeats>$0</a> vez(veces)."
  html_infinite         "Este proceso se repetirá siempre."
  description         "Las reglas subsidiarias se llevarán a cabo por orden cuando empiece esta regla."
  description-repeats       "Este proceso se repetirá $0 veces."
  description-infinite        "Este proceso se repetirá siempre."
  ;
  repeats_name          "Número de repeticiones"
  repeats_description       "Número de veces que esta regla se repetirá por las reglas subsidiarias."
}
username-pl           "Lista sekwencyjna"
string-table-pl {
  html_description        "Dziecięce zasady podrzędne w stosunku do niniejszej zasady będą wykonywane kolejno, gdy tylko niniejsza zasada zostanie zainicjowana."
}
username-cz           "Pevný seznam"
string-table-cz {
  html_description        "Podpravidla (jenž jsou součástí tohoto pravidla) budou prováděna v následujícím pořadí."
  html_repeats          "Celý proces bude <a href=live://property/repeats>$0</a>x zopakován."
  html_infinite         "Celý proces bude nekonečně opakován."
  description         "Podpravidla budou provedena v zadaném pořadí po spuštění tohoto pravidla."
  description-repeats       "Celý proces bude $0 x zopakován."
  description-infinite        "Celý proces bude nekonečně opakován."
  ;
  repeats_name          "Počet opakování"
  repeats_description       "Počet opakování tohoto pravidla se všemi podpravidly."
}
username-ru           "Упорядоченный список"
description-ru            "Подправила будут выполнятся последовательно."
string-table-ru {
  html_description        "Подправила с установленным отступом, находящиеся под этим правилом, будут выполняться по порядку, как только начнет выполняться это правило."
  html_repeats          "Правило будет повторено $0 раз."
  html_infinite         "Правило будет вечно повторяться."
  description         "Подправила будут выполнятся последовательно."
  description-repeats       "Повторить $0 раз."
  description-infinite        "Повторять бесконечно."
  repeats_name          "Число повторов"
  repeats_description       "Количество повторений выполнения всех подправил."
}
username-fr           "Liste ordonnée"
string-table-fr {
  html_description        "Les sous-règles (dépendant directement de cette règle) s'exécuteront dans l'ordre."
  html_repeats          "Ce processus se répètera <a href=live://property/repeats>$0</a> fois."
  html_infinite         "Ce processus se répètera à l'infini."
  description         "Les sous-règles s'exécuteront dans l'ordre une fois cette règle activée."
  description-repeats       "Le processus se répète $0 fois."
  description-infinite        "Le processus se répète à l'infini."
  ;
  repeats_name          "Nombre de répétitions"
  repeats_description       "Nombre de fois que cette règle se répètera avant d'activer à nouveau ses sous-règles."
}

behaviour.gs:

//
// OrderedListRule.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Executes each child behavior in order.
//
class OrderedListRule isclass ScenarioBehavior
{
  void PauseChildren(void);
  void ResetChildren(void);
  void UpdateChildren(Message notUsed);

  int repeats = 1;      // use 0 for infinite, default is 1 (one cycle)
  int repeatsCount = 0; // always starts at 0, not used if rule operates on infinite cycle

  public void Init(Asset p_self)
  {
    inherited(p_self);

    // if one of our children is updated, we want to know about it
    AddHandler(me, "ScenarioBehavior", "Touch", "UpdateChildren");
  }

  //
  // Resets this rule's repeats counter as we have to allow for this rule to be a child rule
  // to a parent list rule
  //
  public void Reset(void)
  {
     inherited();
     repeatsCount = 0;
  }

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      PauseChildren();
    }
    else
    {
      ResetChildren();
      UpdateChildren(null);
    }
  }

  // pause all our children
  void PauseChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Pause(true);
  }

  // clear the was-complete flag on all our kiddies
  void ResetChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Reset();
  }

  //
  // rescan our kiddies and update our progress
  //
  void UpdateChildren(Message notUsed)
  {
    // once we have completed, don't retry (unless we are reset)
    if (IsComplete())
      return;

    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      if (child[i].WasComplete())
        child[i].Pause(true);
      else
      {
        // if he's already unpaused, this wont do any harm.
        child[i].Pause(false);
        return;
      }

    // If we got this far, all our children have completed and thus one cycle of the ordered
    // list rule is completed.
    //
    // This doesn't mean that they're currently complete; we dont go back to make sure.
    //

    // if repeats is valid positive integer, than we don't cycle infinitely
    if (repeats > 0)
    {
      // increments repeatsCount as one cycle of ordered list has been completed
      repeatsCount++;

      // if the counter equals amount of repeats, than this rule is totally complete
      if (repeatsCount == repeats)
        SetComplete(true);
    }

    // reset children for next cycle
    ResetChildren();
    PostMessage(me, "ScenarioBehavior", "Touch", 0.0);
  }

  //
  // Properties methods
  //

  //
  // Sets the repeats amount and repeats count (so we can restore from saved session)
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    repeats = soup.GetNamedTagAsInt("ordered-list-rule.repeats", 1);
    repeatsCount = soup.GetNamedTagAsInt("ordered-list-rule.repeats-count", 0);
  }

  //
  // Gets the amount of repeats cycles of this rule (as well as how many have been executed
  // already so they can be saved from a session) and saves to a new soup database.
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("ordered-list-rule.repeats", repeats);
    soup.SetNamedTag("ordered-list-rule.repeats-counter", repeatsCount);

    return soup;
  }

  //
  // Returns HTML description.
  //
  public string GetDescriptionHTML(void)
  {
    string body = "<html><body><font color=#000000>";

    StringTable stringtable = GetAsset().GetStringTable();

    body = body + "<p>" + stringtable.GetString("html_description") + "</p>";

    body = body + "<p>" + HTMLWindow.RadioButton("live://property/set-repeats", repeats > 0) + stringtable.GetString1("html_repeats", (string)repeats) + "</p>";

    body = body + "<p>" + HTMLWindow.RadioButton("live://property/infinite", repeats == 0) + stringtable.GetString("html_infinite") + "</p>";

    body = body + "</font></body></html>";

    return body;
  }

  //
  // Returns a text description
  //
  public string GetDescription(void)
  {
    string description = GetAsset().GetStringTable().GetString("description");

    if (repeats > 1)
      description = description + " " + GetAsset().GetStringTable().GetString1("description-repeats", (string)repeats);
    else if (repeats == 0)
      description = description + " " + GetAsset().GetStringTable().GetString("description-infinite");

    return description;
  }

  //
  // Always returns int in range of 0 to 10000 (0 is for inifinte cycle)
  //
  string GetPropertyType(string propertyID)
  {
    if (propertyID == "set-repeats")
      return "link";

    if (propertyID == "infinite")
      return "link";

    return "int,0,10000,1";
  }

  //
  // Gets repeats property as a string
  //
  string GetPropertyValue(string p_propertyID)
  {
    return (string)repeats;
  }

  //
  // Gets name of this property
  //
  string GetPropertyName(string p_propertyID)
  {
    return GetAsset().GetStringTable().GetString("repeats_name");
  }

  //
  // Gets description of the repeats property
  //
  string GetPropertyDescription(string p_propertyID)
  {
    return GetAsset().GetStringTable().GetString("repeats_description");
  }

  //
  // Sets the amount of repeats to given value (only property, so no checking)
  //
  void SetPropertyValue(string p_propertyID, int p_value)
  {
    repeats = p_value;
  }

  void LinkPropertyValue(string propertyID)
  {
    if (propertyID == "set-repeats")
      repeats = 1;

    if (propertyID == "infinite")
      repeats = 0;
  }

};


Play Sound
[Rules]

Play Sound Rule

config.txt:

﻿
username            "Play Sound"
kind              "behavior"
kuid              <kuid:-3:10157>
script              "playwaverule"
class             "PlayWaveRule"
string-table {
  html_description        "Play the wave file <a href=live://property/wavefile>$0</a> of HTML asset <a href=live://property/asset>$1</a><br><br>Rule completes when: <a href=live://property/sleepmode>$2</a>"
  html_description_sleep_true     "sound has just started"
  html_description_sleep_false      "sound has finished playing"
  click_to_select         "<i>click to select</i>"
  display-name-wavefile       "Sound file name"
  display-desc-wavefile       "Name of sound file without the .wav extension"
  display-name-asset        "HTML asset"
  display-desc-asset        "HTML asset where the sound file can be found"
  description         "Plays a .wav sound file."
  description_info        "Plays the <i>''$0.wav''</i> wave sound file of HTML asset <i>''$1''</i>."
}
icon-texture            "wave_type.texture"
username-de           "Sound abspielen"
string-table-de {
  html_description        "Wave-Datei abspielen <a href=live://property/wavefile>$0</a> of html asset <a href=live://property/asset>$1</a><br><br>Rule completes when: <a href=live://property/sleepmode>$2</a>"
  html_description_sleep_true     "Sound hat grade angefangen"
  html_description_sleep_false      "Sound wurde abgespielt"
  click_to_select         "<i>Zur Auswahl klicken</i>"
}
username-it           "Regola suona file wave"
string-table-it {
  html_description        "Esegui il file wave <a href=live://property/wavefile>$0</a> dell'asset html <a href=live://property/asset>$1</a>"
  click_to_select         "<i>clicca per selezionare</i>"
}
username-es           "Reproducir sonido"
string-table-es {
  html_description        "Reproducir ondas <a href=live://property/wavefile>$0</a> de componente html <a href=live://property/asset>$1</a><br><br>La regla se completa cuando: <a href=live://property/sleepmode>$2</a>"
  html_description_sleep_true     "el sonido acaba de empezar"
  html_description_sleep_false      "el sonido ha terminado de reproducirse"
  click_to_select
}
username-pl           "Zasady odtwarzania dźwięku"
string-table-pl {
  html_description        "Odtwórz plik wave <a href=live://property/wavefile>$0</a> elementu html <a href=live://property/asset>$1</a>"
  click_to_select         "<i>kliknij, aby wybrać</i>"
}
username-cz           "Přehrát zvuk"
string-table-cz {
  html_description        "Přehrát zvuk <a href=live://property/wavefile>$0</a> html součásti <a href=live://property/asset>$1</a><br><br>Pravidlo bude ukončeno, jakmile: <a href=live://property/sleepmode>$2</a>"
  html_description_sleep_true     "přehrávání započne"
  html_description_sleep_false      "bude přehrávání zvuku ukončeno"
  click_to_select         "<i>klikni pro volbu</i>"
}
username-ru           "Проиграть звук"
string-table-ru {
  html_description        "Проиграть звук $0 элемента html $1"
  html_description_sleep_true     "звук еще играет"
  html_description_sleep_false      "звук проигран"
  click_to_select         "Кликните для выбора"
}
username-fr           "Jouer un son"
string-table-fr {
  html_description        "Ecouter le fichier wave <a href=live://property/wavefile>$0</a> de l'objet html <a href=live://property/asset>$1</a><br><br>La règle s'active lorsque : <a href=live://property/sleepmode>$2</a>"
  html_description_sleep_true     "la piste sonore vient d'être lancée"
  html_description_sleep_false      "la piste sonore est terminée"
  click_to_select         "<i>cliquez pour sélectionner</i>"
}

playwaverule.gs:

//
// PlayWaveRule.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Rule that displays a Wave browser.
//
class PlayWaveRule isclass ScenarioBehavior
{
  KUID HTMLAssetKUID;
  string waveName = "default";
  bool sleepMode  = true;

  thread void PlayWave(void);

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.  When unpaused, reset control mode of Trainz environment to
  // whatever this rule is currently set to.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
      PlayWave();
  }

  //
  // PropertyObject methods
  //

  // Sets the propeties of this rule from the given database.
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    HTMLAssetKUID = soup.GetNamedTagAsKUID("PlayWaveRule.HTMLAssetKUID");
    waveName = soup.GetNamedTag("PlayWaveRule.waveName");
    if (!waveName or !waveName.size())
      waveName = "index";

    if (soup.GetIndexForNamedTag("PlayWaveRule.sleepMode") < 0)
      // default of true which is to play sound and complete rule straight away
      // (this was defualt pre-SP2 TRS2004 behavior)
      sleepMode = true;
    else
      sleepMode = soup.GetNamedTagAsInt("PlayWaveRule.sleepMode");
  }

  // Packs properties of this rule up into a database.
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    if (HTMLAssetKUID)
    {
      soup.SetNamedTag("PlayWaveRule.HTMLAssetKUID", HTMLAssetKUID);
      soup.SetNamedTag("PlayWaveRule.waveName", waveName);
      soup.SetNamedTag("PlayWaveRule.sleepMode", sleepMode);
    }

    return soup;
  }

  string GetPropertyName(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "wavefile")
      return strTable.GetString("display-name-wavefile");

    if (propertyID == "asset")
      return strTable.GetString("display-name-asset");

    return inherited(propertyID);
  }

  string GetPropertyDescription(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "wavefile")
      return strTable.GetString("display-desc-wavefile");

    if (propertyID == "asset")
      return strTable.GetString("display-desc-asset");

    return inherited(propertyID);
  }

  // Returns HTML code with link that allows control mode to be changed.
  public string GetDescriptionHTML(void)
  {
    string currentAssetName, sleepModeStr;
    StringTable strTable = GetAsset().GetStringTable();

    Asset asset;

    if (HTMLAssetKUID)
      asset = World.FindAsset(HTMLAssetKUID);

    if (asset)
      currentAssetName = asset.GetLocalisedName();
    else
      currentAssetName = strTable.GetString("click_to_select");

    if (sleepMode)
      sleepModeStr = strTable.GetString("html_description_sleep_true");
    else
      sleepModeStr = strTable.GetString("html_description_sleep_false");

    return "<html><body><table border='0' cellspacing='0' cellpadding='0'><tr height='1'></tr><tr><td width=3></td><td><font color=#000000>" +
             strTable.GetString3("html_description", waveName + ".wav", currentAssetName, sleepModeStr) +
           "</font></td></tr></table><br><br><br></body></html>";
  }

  // Acts on a link. If link is control-method, than control mode is switched.
  void LinkPropertyValue(string p_propertyID)
  {
    if (p_propertyID == "sleepmode")
      sleepMode = !sleepMode; // invert boolean flag to swithc between modes
  }

  public string GetPropertyType(string propertyID)
  {
    if (propertyID == "wavefile")
      return "string";

    if (propertyID == "asset")
      return "list,1";

    if (propertyID == "sleepmode");
      return "link";

    return "";
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    int i;
    Asset[] assets = World.GetAssetList("html-asset");
    string[] ret = new string[assets.size()];

    for (i = 0; i < assets.size(); i++)
      ret[i] = assets[i].GetLocalisedName();

    return ret;
  }

  public void SetPropertyValue(string p_propertyID, string p_value, int p_index)
  {
    Asset[] assets = World.GetAssetList("html-asset");
    Asset asset = assets[p_index];

    HTMLAssetKUID = asset.GetKUID();
  }

  void SetPropertyValue(string propertyID, string value)
  {
    if (!value or !value.size())
      waveName = "index";
    else
      waveName = value;
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    Asset asset;

    if (HTMLAssetKUID)
      asset = World.FindAsset(HTMLAssetKUID);

    if (asset)
      return strTable.GetString2("description_info", waveName, asset.GetLocalisedName());

    return inherited();
  }

  // Play the wav file (when unpaused)
  thread void PlayWave(void)
  {
    if (HTMLAssetKUID)
    {
      Asset asset = World.FindAsset(HTMLAssetKUID);
      if (!asset)
      {
        Interface.Log("PlayWaveRule.UserSelectControlMode> unable to load requested HTML asset");
        return;
      }

      float duration = World.Play2DSound(asset, waveName + ".wav");

      Interface.Log("# PlayWaveRule.PlayWave> INFO: playing sound '" + waveName + ".wav' from html asset '" + asset.GetLocalisedName() + "'");

      if (!sleepMode)
      {
        Sleep(duration);
        Interface.Log("# PlayWaveRule.PlayWave> INFO: rule completing after '" + waveName + ".wav' has finished (" + duration + " seconds)");
      }
    }
    else
      Interface.Log("# PlayWaveRule.PlayWave> ERROR: invalid asset selected!");

    SetComplete(true);
  }

};


Power Station
[Rules]

Power Station Rule

config.txt:

﻿
username            "Power Station Rule"
kind              "behavior"
kuid              <kuid:-16:2024>
script              "test"
class             "PowerStationRule"
string-table {
  msg_power_station_on        "Power station is providing electricity"
  msg_power_station_off       "Power station has stopped providing electricity"
  str_property_name1        "Power Station object"
  str_property_name2        "Add new powered object"
  str_property_description1     "Select the Power Station object which will provide power."
  str_property_description2     "Select a scriptlet object which will require power."
  html_description_not_selected     "None selected"
  html_description        "
  <table><tr><td width=100%><font color=#000000><b>Power Station Rule</b><br><br>
  Power Station: <a href=live://property/powerstation>$0</a><br><br>
  <b>Consumers:</b><br>
  $1
  <a href=live://property/add-object>Add object</a><br><br>
  </font></td></tr></table>"
}
icon-texture            "power_station_type.texture"
username-de           "Kraftwerk-Regel"
string-table-de {
  msg_power_station_on        "Kraftwerk liefert Elektrizität."
  msg_power_station_off       "Kraftwerk hat die Stromversorgung gestoppt."
  str_property_name1        "Kraftwerk "
  str_property_name2        "Neues Kraftwerk hinzufügen."
  str_property_description1     "Wählen Sie ein Kraftwerk zur Stromerzeugung aus."
  str_property_description2     "Wählen Sie ein programmiertes Objekt aus, welches Strom benötigt."
  html_description_not_selected     "Keine Auswahl getroffen"
  html_description        "<table><tr><td width=100%><font color=#000000><b>Kraftwerks-Regel</b><br><br> Kraftwerk: <a href=live://property/powerstation>$0</a><br><br> <b>Verbraucher:</b><br> $1 <a href=live://property/add-object>Objekt hinzufügen</a><br><br> </font></td></tr></table>"
}
username-it           "Regole centrale energetica"
string-table-it {
  msg_power_station_on        "La centrale elettrica sta erogando l'elettricità"
  msg_power_station_off       "La centrale elettrica ha smesso di fornire elettricità"
  str_property_name1        "Oggetto Centrale elettrica"
  str_property_name2        "Aggiungi nuovo oggetto alimentato"
  str_property_description1     "Seleziona l'oggetto della Centrale elettrica che fornirà elettricità."
  str_property_description2     "Seleziona un oggetto scriptlet che richiede alimentazione."
  html_description_not_selected     "Nessun oggetto"
  html_description        "

<table><tr><td width=100%><font color=#000000><b>Regola Centrale elettrica</b><br><br>

Centrale elettrica: <a href=live://property/powerstation>$0</a><br><br>

<b>Utilizzatori:</b><br>

$1

<a href=live://property/add-object>Aggiungi oggetto</a><br><br>

</font></td></tr></table>"
}
username-es           "Regla de central eléctrica"
string-table-es {
  msg_power_station_on        "La central eléctrica está suministrando electricidad."
  msg_power_station_off       "La central eléctrica ha dejado de suministrar energia"
  str_property_name1        "Reglas de central eléctrica"
  str_property_name2        "Añadir nuevo objeto"
  str_property_description1     "Selecto la objeto central eléctrica"
  str_property_description2     "Selecto un objeto que requerirá eléctrica."
  html_description_not_selected     "Ninguna seleccionada"
  html_description        "

<table><tr><td width=100%><font color=#000000><b>Reglas de central eléctrica</b><br><br>

Central eléctrica: <a href=live://property/powerstation>$0</a><br><br>

<b>Consumidor:</b><br>

$1 <a href=live://property/add-object>Añadir objeto</a><br><br>

</font></td></tr></table>"
}
username-pl           "Zasady elektrowni"
string-table-pl {
  msg_power_station_on        "Elektrownia dostarcza energię"
  msg_power_station_off       "Elektrownia przestała dostarczać energię"
  str_property_name1        "Obiekt elektrowni"
  str_property_name2        "Dodaj nowy zasilany obiekt"
  str_property_description1     "Wybierz obiekt elektrowni, który będzie dostarczać elektryczność."
  str_property_description2     "Wybierz obiekt skryptowy, który będzie wymagać zasilania."
  html_description_not_selected     "Nie wybrano żadnego obiektu"
  html_description        "

<table><tr><td width=100%><font color=#000000><b>Zasady elektrowni</b><br><br>

Elektrownia: <a href=live://property/powerstation>$0</a><br><br>

<b>Konsumenci:</b><br>

$1

<a href=live://property/add-object>Dodaj obiekt</a><br><br>

</font></td></tr></table>"
}
username-cz           "Pravidlo elektráren"
string-table-cz {
  msg_power_station_on        "Elektrárna vyrábí elektřinu"
  msg_power_station_off       "Elektrárna zastavila výrobu elektřiny"
  str_property_name1        "Objekt elektrárny"
  str_property_name2        "Přidat nový napájený objekt"
  str_property_description1     "Zvol elektrárnu, která bude dodávat elektřinu."
  str_property_description2     "Zvol objekt, který bude potřebovat dodávky elektřiny."
  html_description_not_selected     "Nic nebylo zvoleno"
  html_description        "

<table><tr><td width=100%><font color=#000000><b>Pravidlo elektráren</b><br><br>

Elektrárna: <a href=live://property/powerstation>$0</a><br><br>

<b>Spotřebitelé:</b><br>

$1

<a href=live://property/add-object>Přidat objekt</a><br><br>

</font></td></tr></table>"
}
username-ru           "Правило электростанций"
string-table-ru {
  msg_power_station_on        "ТЭЦ вырабатывает электричество"
  msg_power_station_off       "ТЭЦ прекратила вырабатывать электричество"
  str_property_name1        "Электростанция"
  str_property_name2        "Добавить новый объект"
  str_property_description1     "Выберите электростанцию, которая будет вырабатывать электричество."
  str_property_description2     "Выберите объект, которому требуется электричество."
  html_description_not_selected     "нет"
}
username-fr           "Centrale électrique"
string-table-fr {
  msg_power_station_on        "Le centrale électrique est opérationelle "
  msg_power_station_off       "Le centrale électrique n'est plus opérationelle"
  str_property_name1        "Objet centrale électrique "
  str_property_name2        "Ajouter un nouvel objet requérant l'électricité"
  str_property_description1     "Sélectionner l'objet centrale électrique produisant l'électricité"
  str_property_description2     "Sélectionner un nouvel objet requérant l'électricité"
  html_description_not_selected     "Aucun sélectionné"
  html_description        "
  <table><tr><td width=100%><font color=#000000><b>Régler la centrale électrique </b><br><br>
  électrique: <a href=live://property/powerstation>$0</a><br><br>
  <b>consommateurs:</b><br>
  $1
  <a href=live://property/add-object>Add object</a><br><br>
  </font></td></tr></table>"
}

test.gs:

//
// PowerStationRule.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "Browser.gs"

//
// PowerStationRule for use in profiles.
//
// Monitors a power station industry and sends out messages to any industry
// associated with this rule (through Surveyor Profile Editor)
//
class PowerStationRule isclass ScenarioBehavior
{
  string powerstationName;  // Name of power station to monitor.
  string[] objectName;      // List of industries to forward on messages to.
  StringTable strTable;

  //
  // ScenarioBehavior methods
  //

  void NotifyObjects(bool isStarted)
  {
    int i, count = objectName.size();

    for (i = 0; i < count; i++)
    {
      Industry obj = cast<Industry>(Router.GetGameObject(objectName[i]));

      if (obj)
        if (!isStarted)
          SendMessage(obj, "Scriptlet-Enabled", "0");
        else
          SendMessage(obj, "Scriptlet-Enabled", "1");

      /*
      if (obj)
      {
        string[] processes = obj.GetProcessNameList();
        int p;

        for (p = 0; p < processes.size(); p++)
          obj.SetProcessEnabled(processes[p], isStarted);
      }
      */
    }
  }

  thread void PowerStationMonitor(void)
  {
    while (1)
    {
      if (IsPaused())
      {
        wait()
        {
          on "PowerStationMonitor", "Reset":
            break;
        }
      }

      else
      {
        Industry obj = cast<Industry>(Router.GetGameObject(powerstationName));

        if (obj)
        {
          bool started = (obj.GetProcessEnabled("coal_consumer") and obj.GetProcessStarted("coal_consumer"));

          NotifyObjects(started);

          Sniff(obj, "Process-Start", null, true);
          Sniff(obj, "Process-Stop", null, true);
        }
        else
          NotifyObjects(false);

        wait()
        {
          on "Process-Start", "":
            Interface.Print(strTable.GetString("msg_power_station_on"));
            NotifyObjects(true);
            continue;
          on "Process-Stop", "":
            Interface.Print(strTable.GetString("msg_power_station_off"));
            NotifyObjects(false);
            continue;
          on "PowerStationMonitor", "Reset":
            break;
        }

        if (obj)
        {
          Sniff(obj, "Process-Start", null, false);
          Sniff(obj, "Process-Stop", null, false);
        }
      }
    }
  }

  public void Init(Asset p_self)
  {
    inherited(p_self);

    powerstationName = "";
    objectName = new string[0];
    strTable = GetAsset().GetStringTable();

    PowerStationMonitor();
  }

  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    // this is called from native code- we must use PostMessage() instead of SendMessage()
    PostMessage(me, "PowerStationMonitor", "Reset", 0);
  }

  //
  // PropertyObject methods
  //

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    powerstationName = soup.GetNamedTag("power-station");

    Soup objects = soup.GetNamedSoup("objects");

    int i, count = objects.CountTags();
    objectName = new string[count];
    for (i = 0; i < count; i++)
      objectName[i] = objects.GetNamedTag((string)i);

    // this is called from native code- we must use PostMessage() instead of SendMessage()
    PostMessage(me, "PowerStationMonitor", "Reset", 0);
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("power-station", powerstationName);

    Soup objects = Constructors.NewSoup();
    int i, count = objectName.size();
    for (i = 0; i < count; i++)
      objects.SetNamedTag((string)i, objectName[i]);
    soup.SetNamedSoup("objects", objects);

    return soup;
  }

  public string GetDescriptionHTML(void)
  {
    string objects = "";
    int i;
    string stationName;

    if (powerstationName and powerstationName.size())
      stationName = "'" + BrowserInterface.Quote(powerstationName) + "'";
    else
      stationName = strTable.GetString("html_description_not_selected");

    for (i = 0; i < objectName.size(); i++)
      objects = objects + "  <a href=live://property/" + ((string)i) + ">" + BrowserInterface.Quote(objectName[i]) + "</a><br>";

    return "<html><body><font color=#000000>" + strTable.GetString2("html_description", stationName, objects) + "</font></body></html>";
  }

  string GetPropertyName(string p_propertyID)
  {
    if (p_propertyID == "powerstation")
      return strTable.GetString("str_property_name1");

    if (p_propertyID == "add-object")
      return strTable.GetString("str_property_name2");

    return "<null>";
  }

  string GetPropertyDescription(string p_propertyID)
  {
    if (p_propertyID == "powerstation")
      return strTable.GetString("str_property_description1");

    if (p_propertyID == "add-object")
      return strTable.GetString("str_property_description2");

    return "<null>";
  }

  string GetPropertyType(string p_propertyID)
  {
    if (p_propertyID == "powerstation")
      return "list,1";

    if (p_propertyID == "add-object")
      return "list,1";

    return "link";
  }

  public string GetPropertyValue(string p_propertyID)
  {
    if (p_propertyID == "powerstation")
      return "";

    if (p_propertyID == "add-object")
      return "";

    return "";
  }

  void SetPropertyValue(string p_propertyID, string p_value)
  {
    if (p_propertyID == "powerstation")
    {
      powerstationName = p_value;
    }
    else if (p_propertyID == "add-object")
    {
      objectName[objectName.size()] = p_value;
    }

    // this is called from native code- we must use PostMessage() instead of SendMessage()
    PostMessage(me, "PowerStationMonitor", "Reset", 0);
  }

  void LinkPropertyValue(string p_propertyID)
  {
    int index = Str.ToInt(p_propertyID);
    objectName[index, index+1] = null;

    // this is called from native code- we must use PostMessage() instead of SendMessage()
    PostMessage(me, "PowerStationMonitor", "Reset", 0);
  }

  public string[] GetPropertyElementList(string p_propertyID)
  {
    string[] ret = new string[0];
    GameObject[] industries = World.GetIndustryList();

    if (p_propertyID == "powerstation")
    {
      int i, out = 0;
      for (i = 0; i < industries.size(); i++)
      {
        string name = industries[i].GetName();

        if (name and name.size())
          ret[out++] = name;
      }
    }

    else if (p_propertyID == "add-object")
    {
      int i, out = 0;
      for (i = 0; i < industries.size(); i++)
      {
        string name = industries[i].GetName();

        if (name and name.size())
        {
          int n;
          for (n = 0; n < objectName.size(); n++)
            if (objectName[n] == name)
            {
              name = null;
              break;
            }

          if (name)
            ret[out++] = name;
        }
      }
    }

    return ret;
  }

};


Progressive List
[Rules]

Progressive List Rule

config.txt:

﻿
username            "Progressive List"
kind              "behavior"
kuid              <kuid:-18:1202>
script              "ProgressiveListRule"
class             "ProgressiveListRule"
string-table {
  html_description        "The first child rule (indented directly under this rule) is executed on the first run. With each successive run, the next child rule is chosen. <a href=live://property/progress-mode>$0</a>"
  description         "The first child rules is executed on the first run, etc."
  description_progress_mode     "Mode this rule is to operate in"
  description_mode0       "After the last child has been executed, the first child is chosen again."
  description_mode1       "When the last child has been reached, it will be used for all successive runs."
  description_mode2       "After the last child has been executed, successive runs will do nothing."
}
icon-texture            "folder_type.texture"
username-de           "Listen Reihenfolge"
string-table-de {
  html_description        "Die erste Tochterregel wird beim ersten Lauf ausgeführt. Bei jedem weiteren Lauf wird die jeweils nächste Tcochterregl ausgewählt. <a href=live://property/progress-mode>$0</a>"
  description         "Die erste Tochterregel wird beim ertsen Lauf ausgeführt, usw."
  description_progress_mode     "Modus in dem diese Regel ausgeführt werden soll"
  description_mode0       "Nachdem die letzte Tochterregel ausgeführt wurde, wird wieder die erste ausgewählt."
  description_mode1       "Nachdem die letzte Tochterregel ausgeführt wurde, wird diese für alle weiteren Läufe ausgewählt."
  description_mode2       "Nachdem die letzte Tochterregel ausgeführt wurde, wird bei weiteren Läufen keine Regel ausgeführt."
}
username-it           "Progressive List"
string-table-it {
  html_description        "The first child rule (indented directly under this rule) is executed on the first run. With each successive run, the next child rule is chosen. <a href=live://property/progress-mode>$0</a>"
  description         "The first child rules is executed on the first run, etc."
  description_progress_mode     "Mode this rule is to operate in"
  description_mode0       "After the last child has been executed, the first child is chosen again."
  description_mode1       "When the last child has been reached, it will be used for all successive runs."
  description_mode2       "After the last child has been executed, successive runs will do nothing."
}
username-es           "Lista progresiva"
string-table-es {
  html_description        "La primera regla subsidiaria (tabulada directamente bajo esta regla) se lleva a cabo en la primera ejecución. En cada ejecución sucesiva se pasa a la siguiente regla subsidiaria. <a href=live://property/progress-mode>$0</a>"
  description         "La primera regla subsidiaria se lleva a cabo en la primera ejecución, etc."
  description_progress_mode     "Modo en que esta regla ha de funcionar en"
  description_mode0       "Tras llevar a cabo la última regla subsidiaria, se vuelve a la primera."
  description_mode1       "Cuando se llegue a la última regla subsidiaria, se usará ésta para todas las ejecuciones sucesivas."
  description_mode2       "Tras llevar a cabo la última regla subsidiaria, las ejecuciones sucesivas no harán nada."
}
username-pl           "Progressive List"
string-table-pl {
  html_description        "The first child rule (indented directly under this rule) is executed on the first run. With each successive run, the next child rule is chosen. <a href=live://property/progress-mode>$0</a>"
  description         "The first child rules is executed on the first run, etc."
  description_progress_mode     "Mode this rule is to operate in"
  description_mode0       "After the last child has been executed, the first child is chosen again."
  description_mode1       "When the last child has been reached, it will be used for all successive runs."
  description_mode2       "After the last child has been executed, successive runs will do nothing."
}
username-cz           "Progresivní seznam"
string-table-cz {
  html_description        "Při prvním spuštění tohoto pravidla bude použito jeho první podpravidlo. Při každém dalším spuštění pak bude vždy použito podpravidlo následující podpravidlu naposled použitému. <a href=live://property/progress-mode>$0</a>"
  description         "První podpravidlo bude spuštěno při první aktivaci, atd."
  description_progress_mode     "Mód, ve kterém bude toto pravidlo používáno"
  description_mode0       "Po vykonání posledního podpravidla bude znovu použito podpravidlo první."
  description_mode1       "Po vykonání posledního podpravidla bude toto používáno donekonečna."
  description_mode2       "Po vykonání posledního podpravidla nebude již používáno žádné."
}
username-ru           "Последовательный список"
description-ru            "Первое подправило будет выполнено при первом запуске итд итп"
string-table-ru {
  html_description        "Первое подправило (расположенное непосредственно под этим правилом) будет выполнено при первом запуске. После каждого удачного запуска будет выбрано следующее подправило. $0"
  description         "Первое подправило будет выполнено при первом запуске итд итп"
  description_progress_mode     "Режим работы правила"
  description_mode0       "После успешного выполнения последнего подправила будет снова выполнено первое подправило."
  description_mode1       "После успешного достижения последнего подправила оно будет использовано для всех последующих запусков правила."
  description_mode2       "После успешного выполнения последнего подправила все последующие запуски правила не будут ничего делать."
}
username-fr           "Liste progressive"
string-table-fr {
  html_description        "La première sous-règle (dépendant directement de cette règle) s'exécute au premier lancement. A chaque nouveau lancement, la sous-règle suivante s'exécute. <a href=live://property/progress-mode>$0</a>"
  description         "La première sous-règle s'exécute au premier lancement, etc."
  description_progress_mode     "Le mode d'exécution de cette règle"
  description_mode0       "Après l'exécution de la dernière sous-règle, tout reprend depuis le départ."
  description_mode1       "Une fois rendu à la dernière sous-règle, celle-ci s'exécute à chaque nouveau lancement."
  description_mode2       "Passée l'exécution de la dernière sous-règle, les lancements suivants n'ont plus aucun effet."
}

ProgressiveListRule.gs:

//
// ProgressiveListRule.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Executes each child rule behavior one after the other (ie when child rule 0 is COMPLETE, we
// start child rule 1 and son on. This means only one child rule is ever running at one time.
//
// Three different modes are supported by this rule that determine if (and when) this rule is
// considered to be finished (avoid confusion with complete - each progress of a child rule
// puts this rule into a COMPLETE state!)
//  0 - cycle progressively through child rules indefinitely (ie reach final rule and reset
//      back to first rule for next list complete cycle)
//  1 - keep replaying final child rule indefinitely
//  2 - cycle through all child rules once in order and don't run through any again, even if
//      parent object unpuases this object again
//
class ProgressiveListRule isclass ScenarioBehavior
{
  void PauseChildren(void);
  void ResetChildren(void);
  void UpdateChildren(Message notUsed);

  int progress     = 0;  // how far have we progressed down the child rules?
  int progressMode = 0;  // mode that determines how cycle of this rule operates (see class description)

  public void Init(Asset p_self)
  {
    inherited(p_self);

    // if one of our children is updated, we want to know about it
    AddHandler(me, "ScenarioBehavior", "Touch", "UpdateChildren");
  }

  public void Reset(void)
  {
    inherited();
    ResetChildren();
  }

  //
  // ScenarioBehavior methods
  //

  //
  // Pause/unpause this rule.
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    ScenarioBehavior[] child = GetChildBehaviors();

    if (paused)
    {
      if (progress < child.size())
      {
        if (child[progress].IsComplete())
        {
          Interface.Log("# ProgressiveListRule.Pause> - Child rule '" + child[progress].GetName() + "' on iteration #" + progress + " has completed!");
          SetComplete(true);
        }
      }

      // we gave reached end of progressive cycle, decide what to do depending on mode
      else
      {
        // determine what to do depending on mode
        if (progressMode == 0)
        {
          Interface.Log("# ProgressiveListRule.Pause> Progress mode is 0, restart cycle of this rule...");

          // reset progress counter to the start for on-going cycle
          progress = 0;
          ResetChildren();
        }
        else if (progressMode == 1)
        {
          Interface.Log("# ProgressiveListRule.Pause> Progress mode is 1, repeat final child rule indefinitely.");

          // decrement progress counter so final child is repeated again
          progress--;
          child[progress].Reset();
        }
        else if (progressMode == 2)
        {
          // finish off the rule ad cycle through child rules has been completed
          Interface.Log("# ProgressiveListRule.Pause> Progress mode is 2, finish this rule off now permantly!");
          SetComplete(true);
        }
      }

    }
    else
    {
      if (progress < child.size())
      {
        Interface.Log("# ProgressiveListRule.Pause> Starting child rule #" + progress + " - (" + child[progress].GetAsset().GetLocalisedName() + ")");
        child[progress].Reset();
        child[progress].Pause(false);
      }
    }

  }

  //
  // pause all our children
  //
  void PauseChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Pause(true);
  }

  //
  // clear the was-complete flag on all our kiddies
  //
  void ResetChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Reset();
  }

  //
  //
  //
  void UpdateChildren(Message notUsed)
  {
    ScenarioBehavior[] child = GetChildBehaviors();
    if (progress < child.size())
      if (child[progress].IsComplete())
      {
        Interface.Log("# ProgressiveListRule.UpdateChildren> - child #" + progress + " (" + child[progress].GetAsset().GetLocalisedName() + ") has completed!");
        child[progress].Pause(true);
        progress++;
        SetComplete(true);
      }

  }

  //
  // Properties methods
  //

  //
  // ?
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);
    progress     = soup.GetNamedTagAsInt("progressive-list-rule.progress");
    progressMode = soup.GetNamedTagAsInt("progressive-list-rule.progress-mode");
  }

  //
  // ?
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();
    soup.SetNamedTag("progressive-list-rule.progress", progress);
    soup.SetNamedTag("progressive-list-rule.progress-mode", progressMode);
    return soup;
  }

  //
  // Returns HTML description.
  //
  public string GetDescriptionHTML(void)
  {
    StringTable stringTable = GetAsset().GetStringTable();
    string modeStr = stringTable.GetString("description_mode" + (string)progressMode);

    return "<html><body><font color=#000000>" + stringTable.GetString1("html_description", modeStr) + "</font></body></html>";
  }

  //
  // Returns a text description
  //
  public string GetDescription(void)
  {
    return GetAsset().GetStringTable().GetString("description");
  }

  //
  // Always returns "link" - only property type used in this small rule.
  //
  string GetPropertyType(string p_propertyID)
  {
    return "link";
  }

  //
  // Acts on a link. If link is control-method, than control mode is switched.
  //
  void LinkPropertyValue(string p_propertyID)
  {
    if (p_propertyID == "progress-mode")
      progressMode = (progressMode + 1) % 3;
  }

  //
  // Gets description of the mode property
  //
  string GetPropertyDescription(string p_propertyID)
  {
    return GetAsset().GetStringTable().GetString("description_progress_mode");
  }

  //
  // Gets name of this property
  //
  string GetPropertyName(string p_propertyID)
  {
    return GetAsset().GetStringTable().GetString("description_progress_mode");
  }

};


Random List
[Rules]

Random List Rule

config.txt:

﻿
username            "Random List"
kind              "behavior"
kuid              <kuid:-18:1203>
script              "RandomListRule"
class             "RandomListRule"
string-table {
  html_description        "One of the child rules indented under this rule will be executed randomly and once the child rule is complete, this rule will be complete."
  description         "One of the child rules indented under this rule will be executed randomly."
}
icon-texture            "folder_type.texture"
username-de           "Liste zufällig ausführen"
string-table-de {
  html_description        "Eine der zugeordneten Tochterreglen wird per Zufall ausgewählt und ausgeführt. Sobald diese Tochterregel ausgeführt wurde, ist diese Regel erfüllt."
  description         "Eine der zugeordneten Tochterreglen wird per Zufall ausgewählt und ausgeführt."
}
username-it           "Random List"
string-table-it {
  html_description
  description
}
username-es           "Lista aleatoria"
string-table-es {
  html_description        "Una de las reglas subsidiarias tabuladas bajo esta regla se llevará a cabo aleatoriamente y, cuando se haya completado, la regla quedará terminada."
  description         "Se llevará a cabo al azar una de las reglas subsidiarias tabuladas bajo esta regla."
}
username-pl           "Random List"
string-table-pl {
  html_description        "One of the child rules indented under this rule will be executed randomly and once the child rule is complete, this rule will be complete."
  description         "One of the child rules indented under this rule will be executed randomly."
}
username-cz           "Náhodný seznam"
string-table-cz {
  html_description        "Při aktivaci tohoto pravidla bude vždy nádhodně použito jedno z podpravidel v něm zahrnuté."
  description         "Při aktivaci tohoto pravidla bude nádhodně použito jedno z jeho podpravidel."
}
username-ru           "Случайный список"
description-ru            "Одно из подправил, расположеных под этим правилом, будет случайным образом выбрано и запущено."
string-table-ru {
  html_description        "Одно из подправил, расположеных под этим правилом, будет случайным образом выбрано и запущено, и после выполнения подправила это правило будет считаться выполненым."
  description         "Одно из подправил, расположеных под этим правилом, будет случайным образом выбрано и запущено."
}
username-fr           "Liste aléatoire"
string-table-fr {
  html_description        "L'une des sous-règles dépendant de cette règle est exécutée aléatoirement. Une fois la sous-règle exécutée, la règle est considérée comme activée."
  description         "L'une des sous-règles dépendant de cette règle est exécutée aléatoirement."
}

RandomListRule.gs:

//
// RandomListRule.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Executes each child behavior in order.
//
class RandomListRule isclass ScenarioBehavior
{
  void PauseChildren(void);
  void ResetChildren(void);
  void UpdateChildren(Message notUsed);

  int randomChild = -1; // index to random child task (-1 means it hasn't been chosen yet)

  public void Init(Asset p_self)
  {
    inherited(p_self);

    // if one of our children is updated, we want to know about it
    AddHandler(me, "ScenarioBehavior", "Touch", "UpdateChildren");
  }

  //
  // Resets this rule's repeats counter as we have to allow for this rule to be a child rule
  // to a parent list rule
  //
  public void Reset(void)
  {
     inherited();
     randomChild = -1;
  }

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      PauseChildren();
    }
    else
    {
      ResetChildren();
      UpdateChildren(null);
    }
  }

  //
  // pause all our children
  //
  void PauseChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Pause(true);
  }

  //
  // clear the was-complete flag on all our kiddies
  //
  void ResetChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Reset();
  }

  //
  // rescan our kiddies and update our progress
  //
  void UpdateChildren(Message notUsed)
  {
    // once we have completed, don't retry (unless we are reset)
    if (IsComplete())
      return;

    // not completed, choose child rule randomly and run it
    ScenarioBehavior[] child = GetChildBehaviors();

    // have we chosen a random number and started a child rule yet?
    if (randomChild < 0)
    {
      // choose random child rule and unpause it
      randomChild = Math.Rand(0, child.size());
      child[randomChild].Pause(false);
//      Interface.Log("RandomListRule.UpdateChildren() - started child rule #" + randomChild + "(" + child[randomChild].GetName() + ")");
    }
    // yes, we have started the random child rule, so check its progress...
    else
    {
      if(!child[randomChild].WasComplete())
      {
        child[randomChild].Pause(true);
        SetComplete(true);
//        Interface.Log("RandomListRule.UpdateChildren() - child rule #" + randomChild + "("  + child[randomChild].GetName() + ") finished, completing this parent rule");
      }
    }

  }

  //
  // Properties methods
  //

  //
  // Saves the randomly chosen task index (in child array) so this rule can be saved when
  // still in progress.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);
    randomChild = soup.GetNamedTagAsInt("random-list-rule.random-child");
  }

  //
  // Gets this rule into a soup so it can be saved by a session.  Here, we ensure the
  // random child rule index is saved.
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();
    soup.SetNamedTag("random-list-rule.random-child", randomChild);
    return soup;
  }

  //
  // Returns HTML description of this rule.
  //
  public string GetDescriptionHTML(void)
  {
    return "<html><body><font color=#000000>" + GetAsset().GetStringTable().GetString("html_description") + "</font></body></html>";
  }

  //
  // Returns a text description
  //
  public string GetDescription(void)
  {
    return GetAsset().GetStringTable().GetString("description");
  }

};


Reset List
[Rules]

Reset List Rule

config.txt:

﻿
username            "Reset List"
kind              "behavior"
kuid              <kuid:-18:1204>
script              "ResetListRule"
class             "ResetListRule"
string-table {
  html_description        "Resets and starts all child rules in an ongoing infinite cycle."
  description         "Resets and starts all child rules in an ongoing infinite cycle."
}
icon-texture            "folder_type.texture"
username-de           "Liste zurücksetzen"
string-table-de {
  html_description        "Setzt die Liste zurück und führt alle Tochterregeln in einem unendlichen Kreislauf aus."
  description         "Setzt die Liste zurück und führt alle Tochterregeln in einem unendlichen Kreislauf aus."
}
username-it           "Reset List Rule"
string-table-it {
  html_description
  description
}
username-es           "Restaurar lista"
string-table-es {
  html_description        "Restaura y reinicia todas las reglas en un ciclo infinito."
  description         "Restaura y reinicia todas las reglas en un ciclo infinito."
}
username-pl           "Reset List"
string-table-pl {
  html_description        "Resets and starts all child rules in an ongoing infinite cycle."
  description         "Resets and starts all child rules in an ongoing infinite cycle."
}
username-cz           "Resetovat seznam"
string-table-cz {
  html_description        "Resetuje seznam podpravidel v nekonečném cyklu."
  description         "Resetuje seznam podpravidel v nekonečném cyklu"
}
username-ru           "Сброс списка"
description-ru            "Сбрасывает и запускает все подправила в постоянном бесконечном цикле."
string-table-ru {
  html_description        "Сбрасывает и запускает все подправила в постоянном бесконечном цикле."
  description         "Сбрасывает и запускает все подправила в постоянном бесконечном цикле."
}
username-fr           "Remise à zéro de la liste"
string-table-fr {
  html_description        "Réinitialise et exécute toutes les sous-règles en boucle."
  description         "Réinitialise et exécute toutes les sous-règles en boucle."
}

ResetListRule.gs:

//
// ResetListRule.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// When unpaused, all child rules are unpaused and this rule will reset and restart any
// child rule that is complete.
//
class ResetListRule isclass ScenarioBehavior
{
  void PauseChildren(void);
  void ResetChildren(void);
  void UpdateChildren(Message notUsed);

  //
  // ScenarioBehavior methods
  //

  public void Init(Asset p_self)
  {
    inherited(p_self);

    // if one of our children is updated, we want to know about it
    AddHandler(me, "ScenarioBehavior", "Touch", "UpdateChildren");
  }

  public void Reset(void)
  {
    inherited();
    ResetChildren();
  }

  //
  // Pause/unpause this rule.
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      PauseChildren();
    }
    else
    {
      // when unpaused, reset all child rules and unpause them
      ResetChildren();

      ScenarioBehavior[] child = GetChildBehaviors();
      int i;

      for (i = 0; i < child.size(); i++)
        child[i].Pause(false);

      UpdateChildren(null);
    }
  }

  //
  // pause all our children
  //
  void PauseChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Pause(true);
  }

  //
  // clear the was-complete flag on all our kiddies
  //
  void ResetChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Reset();
  }

  //
  // rescan our kiddies and update our progress
  //
  void UpdateChildren(Message notUsed)
  {
    // once we have completed, don't retry (unless we are reset) - note this rule should never
    // really be complete anyway
    if (IsComplete())
      return;

    // iterate through each rule, if it is complete, reset and restart it again
    ScenarioBehavior[] child = GetChildBehaviors();
    int i;

    for (i = 0; i < child.size(); i++)
    {
      // if complete, reset and restart child rule again
      if (child[i].IsComplete())
      {
        child[i].Reset();
        child[i].Pause(false);
      }
      else
        child[i].Pause(false); // keep it going, this won't hurt it
    }
  }

  //
  // Properties methods
  //

  //
  // Returns HTML description of this rule.
  //
  public string GetDescriptionHTML(void)
  {
    return "<html><body><font color=#000000>" + GetAsset().GetStringTable().GetString("html_description") + "</font></body></html>";
  }

  //
  // Returns a text description
  //
  public string GetDescription(void)
  {
    return GetAsset().GetStringTable().GetString("description");
  }

};


Resource Check
[Rules]

Resource Check Rule

config.txt:

﻿
username            "Resource Check"
kind              "behavior"
kuid              <kuid:-18:1208>
script              "ResourceCheckRule"
class             "ResourceCheckRule"
icon-texture            "resource_check_rule.texture"
string-table {
  description_html        "Activates when specified resource requirements have been met."
  description         "Activates when specified resource requirements have been met."
  description_info_industry     "Waits until queue <i>''$0''</i> in industry <i>''$1''</i> <i>$2</i> <i>$3</i> units of product <i>''$4''</i>."
  description_info_vehicle      "Waits until queue <i>''$0''</i> in vehicle <i>''$1''</i> <i>$2</i> <i>$3</i> units of product <i>''$4''</i>."
  description_info_complete_true      "reaches/exceeds"
  description_info_complete_false     "has less than"
  resource_check_industry       "<b>Industry: </b> <a href=live://property/industryname tooltip='tooltip'>$0</a><br>"
  resource_check_none       "<i>click to select</i>"
  resource_check_complete       "<b>Rule completes when queue: </b> <a href=live://property/complete tooltip='tooltip'>$0</a><br>"
  resource_check_complete_true      "reaches/exceeds required amount"
  resource_check_complete_false     "falls below required amount"
  resource_check_queue        "<b>Queue Requirements</b><br>"
  resource_check_row_queue      "<tr><td><b>Queue:</b></td><td><a href=live://property/queuename tooltip='tool tip'>$0</td></tr>"
  resource_check_row_product      "<tr><td><b>Product:</b></td><td><a href=live://property/producttype tooltip='tool tip'>$0</a></td></tr>"
  resource_check_row_amount     "<tr><td><b>Amount:</b></td><td><a href=live://property/productamount tooltip='tool tip'>$0</a></td></tr>"
}
username-de           "Resourcen-Überprüfungs-Regel"
string-table-de {
  description_html        "Aktiviert, wenn die angegebenen Ressourcen-Vorgaben erfüllt sind."
  description         "Aktiviert, wenn die angegebenen Ressourcen-Vorgaben erfüllt sind."
  resource_check_industry       "<b>Industrie: </b> <a href=live://property/industryname tooltip='tooltip'>$0</a><br>"
  resource_check_none       "<i>zur Auswahl klicken</i>"
  resource_check_complete       "<b>Regel erfüllt wenn Warteschlange: </b> <a href=live://property/complete tooltip='tooltip'>$0</a><br>"
  resource_check_complete_true      "die benötigte Menge erreicht/übersteigt"
  resource_check_complete_false     "unter die benötigte Menge fällt"
  resource_check_queue        "<b>Warteschlangen-Voraussetzungen</b><br>"
  resource_check_row_queue      "<tr><td><b>Queue:</b></td><td><a href=live://property/queuename tooltip='tool tip'>$0</td></tr>"
  resource_check_row_product      "<tr><td><b>Product:</b></td><td><a href=live://property/producttype tooltip='tool tip'>$0</a></td></tr>"
  resource_check_row_amount     "<tr><td><b>Amount:</b></td><td><a href=live://property/productamount tooltip='tool tip'>$0</a></td></tr>"
}
username-it           "Resource Check Rule"
string-table-it {
  description_html        "Activates when specified resource requirements have been met."
  description         "Activates when specified resource requirements have been met."
  resource_check_industry       "<b>Industry: </b> <a href=live://property/industryname tooltip='tooltip'>$0</a><br>"
  resource_check_none       "<i>click to select</i>"
  resource_check_complete       "<b>Rule completes when queue: </b> <a href=live://property/complete tooltip='tooltip'>$0</a><br>"
  resource_check_complete_true      "reaches/exceeds required amount"
  resource_check_complete_false     "falls below required amount"
  resource_check_queue        "<b>Queue Requirements</b><br>"
  resource_check_row_queue      "<tr><td><b>Queue:</b></td><td><a href=live://property/queuename tooltip='tool tip'>$0</td></tr>"
  resource_check_row_product      "<tr><td><b>Product:</b></td><td><a href=live://property/producttype tooltip='tool tip'>$0</a></td></tr>"
  resource_check_row_amount     "<tr><td><b>Amount:</b></td><td><a href=live://property/productamount tooltip='tool tip'>$0</a></td></tr>"
}
username-es           "Regla de comprobación de recursos"
string-table-es {
  description_html        "Se activa al cumplirse los requisitos especificados para el recurso."
  description         "Se activa al cumplirse los requisitos especificados para el recurso."
  resource_check_industry       "<b>Industria: </b> <a href=live://property/industryname tooltip='tooltip'>$0</a><br>"
  resource_check_none       "<i>clic para seleccionar</i>"
  resource_check_complete       "<b>La regla se completa cuando la cola: </b> <a href=live://property/complete tooltip='tooltip'>$0</a><br>"
  resource_check_complete_true      "alcanza/supera la cantidad requerida"
  resource_check_complete_false     "queda por debajo de la cantidad requerida"
  resource_check_queue        "<b>Requisitos de la cola</b><br>"
  resource_check_row_queue      "<tr><td><b>Cola:</b></td><td><a href=live://property/queuename tooltip='tool tip'>$0</td></tr>"
  resource_check_row_product      "<tr><td><b>Producto:</b></td><td><a href=live://property/producttype tooltip='tool tip'>$0</a></td></tr>"
  resource_check_row_amount     "<tr><td><b>Cantidad:</b></td><td><a href=live://property/productamount tooltip='tool tip'>$0</a></td></tr>"
}
username-pl           "Resource Check Rule"
string-table-pl {
  description_html        "Activates when specified resource requirements have been met."
  description         "Activates when specified resource requirements have been met."
  resource_check_industry       "<b>Industry: </b> <a href=live://property/industryname tooltip='tooltip'>$0</a><br>"
  resource_check_none       "<i>click to select</i>"
  resource_check_complete       "<b>Rule completes when queue: </b> <a href=live://property/complete tooltip='tooltip'>$0</a><br>"
  resource_check_complete_true      "reaches/exceeds required amount"
  resource_check_complete_false     "falls below required amount"
  resource_check_queue        "<b>Queue Requirements</b><br>"
  resource_check_row_queue      "<tr><td><b>Queue:</b></td><td><a href=live://property/queuename tooltip='tool tip'>$0</td></tr>"
  resource_check_row_product      "<tr><td><b>Product:</b></td><td><a href=live://property/producttype tooltip='tool tip'>$0</a></td></tr>"
  resource_check_row_amount     "<tr><td><b>Amount:</b></td><td><a href=live://property/productamount tooltip='tool tip'>$0</a></td></tr>"
}
username-cz           "Pravidlo kontroly stavu surovin"
string-table-cz {
  description_html        "K aktivaci tohoto pravidla dojde při splnění zadaného požadavku na stav surovin."
  description         "K aktivaci tohoto pravidla dojde při splnění zadaného požadavku na stav surovin."
  resource_check_industry       "<b>Průmysl: </b> <a href=live://property/industryname tooltip='tooltip'>$0</a><br>"
  resource_check_none       "<i>kliknutím zvol</i>"
  resource_check_complete       "<b>Pravidlo bude splněno tehdy, když: </b> <a href=live://property/complete tooltip='tooltip'>$0</a><br>"
  resource_check_complete_true      "stav surovin dosáhne či přesáhne zadanou hodnotu"
  resource_check_complete_false     "stav surovin spadne pod zadanou hodnotu"
  resource_check_queue        "<b>Požadavky na suroviny</b><br>"
  resource_check_row_queue      "<tr><td><b>Fronta:</b></td><td><a href=live://property/queuename tooltip='tool tip'>$0</td></tr>"
  resource_check_row_product      "<tr><td><b>Surovina:</b></td><td><a href=live://property/producttype tooltip='tool tip'>$0</a></td></tr>"
  resource_check_row_amount     "<tr><td><b>Množství:</b></td><td><a href=live://property/productamount tooltip='tool tip'>$0</a></td></tr>"
}
username-ru           "Проверка ресурса"
description-ru            "Это правило активируется, когда выполняются заданные условия на ресурсы."
string-table-ru {
  description_html        "Это правило активируется, когда выполняются заданные условия на ресурсы."
  description         "Это правило активируется, когда выполняются заданные условия на ресурсы."
  resource_check_industry       "Индустрия: $0
"
  resource_check_none       "щелкните, чтобы выбрать"
  resource_check_complete       "Правило выполнено, если: $0
"
  resource_check_complete_true      "достигает или выше заданного значения"
  resource_check_complete_false     "ниже заданного значения"
  resource_check_queue        "Параметры очереди
"
  resource_check_row_queue      "Очередь"
}
username-fr           "Règle de vérification des ressources"
string-table-fr {
  description_html        "S'active lorsque les paramètres de ressources spécifiés sont remplis."
  description         "S'active lorsque les paramètres de ressources spécifiés sont remplis."
  resource_check_industry       "<b>Industrie : </b> <a href=live://property/industryname tooltip='tooltip'>$0</a><br>"
  resource_check_none       "<i>cliquez pour sélectionner</i>"
  resource_check_complete       "<b>Règle activée lorsque la file d'attente : </b> <a href=live://property/complete tooltip='tooltip'>$0</a><br>"
  resource_check_complete_true      "atteint/excède la quantité requise"
  resource_check_complete_false     "est inférieure à la quantité requise"
  resource_check_queue        "<b>Conditions de la file d'attente</b><br>"
  resource_check_row_queue      "<tr><td><b>File d'attente :</b></td><td><a href=live://property/queuename tooltip='tool tip'>$0</td></tr>"
  resource_check_row_product      "<tr><td><b>Produit :</b></td><td><a href=live://property/producttype tooltip='tool tip'>$0</a></td></tr>"
  resource_check_row_amount     "<tr><td><b>Quantité :</b></td><td><a href=live://property/productamount tooltip='tool tip'>$0</a></td></tr>"
}

ResourceCheckRule.gs:

//
// ResourceCheckRule.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ConditionalScenarioBehavior.gs"
include "ConsistHelperInfo.gs"
include "common.gs"

//
// Extends LoadHelperInfo to have functioanlity to have a particular game object so you
// can choose from range of products and queues on a list and the amount is restricted to
// boundaries of the queue.
//
class ResourceCheckInfo isclass LoadHelperInfo
{
  public bool m_watchType   = true;  // true to watch an industry. false for a vehicle
  public bool m_queueExceed = true;  // true to complete when queue climbs above setting, false if it falls below

  public string targetObjectName = "";

  // method definitions
  public int  GetMaxProducts(void);
  public bool DoesMatch(void);

  public bool ValidSettings(void);

  //
  // Properties methods
  //

  //
  // Gets HTML page describing this object
  //
  public string GetDescriptionHTML(void)
  {
    StringTable coreStrings = Constructors.GetTrainzStrings();

    // radio buttons
    string industryCheck = "<p>" + HTMLWindow.RadioButton(Link("watch-industry"), m_watchType)
                                 + coreStrings.GetString("interface-resource-check-html0") + "</p>";

    string vehicleCheck  = "<p>" + HTMLWindow.RadioButton(Link("watch-vehicle"), !m_watchType)
                                 + coreStrings.GetString("interface-resource-check-html1") + "</p>";

    // target object selection
    MapObject worldObject = cast<MapObject> Router.GetGameObject(targetObjectName);
    if (!worldObject)
      targetObjectName = coreStrings.GetString("interface-helper-blank-string");

    string targetObject = coreStrings.GetString("interface-resource-check-html2") +
                          HTMLWindow.MakeLink(Link("targetobject"), targetObjectName) + "<br>";

    // queue radio buttons + info
    string queueState = "<p>" + HTMLWindow.RadioButton(Link("queue-exceed"), m_queueExceed)
                              + coreStrings.GetString("interface-resource-check-html3") + "</p>" +
                        "<p>" + HTMLWindow.RadioButton(Link("queue-below"), !m_queueExceed)
                              + coreStrings.GetString("interface-resource-check-html4") + "</p>";

    string queueInfo = HTMLWindow.StartIndent(20) +
                         targetObject + inherited() + queueState + "<br>" +
                       HTMLWindow.EndIndent();

    // construct final HTML arrangement
    string htmlPage = "";
    if (m_watchType)
      htmlPage = industryCheck + queueInfo + vehicleCheck;
    else
      htmlPage = industryCheck + "<br>" + vehicleCheck + queueInfo;

    htmlPage = "<font color=#000000>" + htmlPage + "</font><br><br><br>";

    return htmlPage;
  }

  //
  // Get user-friendly name for given property.
  //
  public string GetPropertyName(string propertyID)
  {
    StringTable coreStrings = Constructors.GetTrainzStrings();
    string strippedPropStr = PropStripPrefix(propertyID, "");
    string[] tokens = Str.Tokens(strippedPropStr, "/");

    if ((tokens[0] == "watch-vehicle") or (tokens[0] == "watch-industry"))
      return coreStrings.GetString("interface-resource-propname0");

    if ((tokens[0] == "queue-exceed") or (tokens[0] == "queue-below"))
      return coreStrings.GetString("interface-resource-propname1");

    if (tokens[0] == "targetobject")
      return coreStrings.GetString("interface-resource-propname2");

    return inherited(propertyID);
  }

  //
  // Get readable description to use as tooltip for named property.
  //
  public string GetPropertyDescription(string propertyID)
  {
    StringTable coreStrings = Constructors.GetTrainzStrings();
    string strippedPropStr = PropStripPrefix(propertyID, "");
    string[] tokens = Str.Tokens(strippedPropStr, "/");

    if ((tokens[0] == "watch-vehicle") or (tokens[0] == "watch-industry"))
      return coreStrings.GetString("interface-resource-propdesc0");

    if ((tokens[0] == "queue-exceed") or (tokens[0] == "queue-below"))
      return coreStrings.GetString("interface-resource-propdesc1");

    if (tokens[0] == "targetobject")
      return coreStrings.GetString("interface-resource-propdesc2");

    return inherited(propertyID);
  }

  //
  // Gets type for named property.
  //
  public string GetPropertyType(string propertyID)
  {
    string strippedPropStr = PropStripPrefix(propertyID, "");
    string[] tokens = Str.Tokens(strippedPropStr, "/");

    if ((tokens[0] == "watch-vehicle") or (tokens[0] == "watch-industry"))
      return "link";

    if ((tokens[0] == "queue-exceed") or (tokens[0] == "queue-below"))
      return "link";

    if (tokens[0] == "targetobject")
      return "list,1";

    // override from LoadHelperInfo so we can have a list for selecting product type rather than text entry
    if (tokens[0] == "product")
      return "list,1";

    // override from LoadHelperInfo so we can have a list for selecting a queue rather than text entry
    if (tokens[0] == "queue")
      return "list,1";

    // override from LoadHelperInfo so we can set limit to queue's maximum size
    if (tokens[0] == "amount")
    {
      int maxsize = GetMaxProducts();
      if (maxsize >= 0)
        return "int,1," + (string)maxsize + ",1";
    }

    return inherited(propertyID);
  }

  //
  // Sets value of named property.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    string strippedPropStr = PropStripPrefix(propertyID, "");
    string[] tokens = Str.Tokens(strippedPropStr, "/");

    if ((tokens[0] == "watch-vehicle") or (tokens[0] == "watch-industry"))
    {
      m_watchType = !m_watchType;

      // reset the queue stuff
      queueName   = "";
      productKUID = null;
      amount      = 0;
    }
    else if ((tokens[0] == "queue-exceed") or (tokens[0] == "queue-below"))
    {
      m_queueExceed = !m_queueExceed;
    }
    else if (tokens[0] == "targetobject")
    {
      targetObjectName = value.AsString();

      // reset all queue thingies as we moved to another industry
      productKUID = null;
      queueName   = "";
      amount      = 0;
    }
    // override from LoadHelperInfo so we can have a list for selecting product type rather than text entry
    // temp: do we need to override for this? - optmisation perhaps
    else if ((tokens[0] == "product") and (value.GetType() == PropertyValue.INDEX_TYPE))
    {
      string productName = value.AsString();

      MapObject worldObject = cast<MapObject> Router.GetGameObject(targetObjectName);
      if (worldObject)
      {
        ProductQueue queue = worldObject.GetQueue(queueName);
        if (queue)
        {
          ProductFilter filter = queue.GetProductFilter();
          Asset[] allowableProducts = filter.GetProducts();
          int i;
          for (i = 0; i < allowableProducts.size(); i++)
          {
            if (productName == allowableProducts[i].GetName())
            {
              productKUID = allowableProducts[i].GetKUID();
              break;
            }
          }

        }
      }
      // reset amount for new product type (needed ?)
      amount      = 0;
    }
    // override from LoadHelperInfo so we can have a list for selecting a queue rather than text entry
    else if ((tokens[0] == "queue") and (value.GetType() == PropertyValue.INDEX_TYPE))
    {
      queueName = value.AsString();

      // reset product stuff as we have changed queue
      productKUID = null;
      amount      = 0;
    }
    else
    {
      inherited(propertyID, value);
    }
  }

  //
  // Gets list of elements to choose from for the named property
  //
  public string[] GetPropertyElementList(string propertyID)
  {
    string strippedPropStr = PropStripPrefix(propertyID, "");
    string[] tokens = Str.Tokens(strippedPropStr, "/");
    string[] retString = new string[0];

    // TODO:
    //  dw - verify industry/vehicle actually has 1 or more queues in it before appending to returned list?
    //       ATM, an empty list is returned and they will have nothing to choose and instead will close
    //       window and notihng changes.

    // compile list of industries (excluding the current one - if any)
    if (tokens[0] == "targetobject")
    {
      // industries
      if (m_watchType)
      {
        GameObject[] industries = World.GetIndustryList();
        int i, out = 0;
        for (i = 0; i < industries.size(); i++)
        {
          string name = industries[i].GetName();
          if (name and name.size())
           if (targetObjectName != name)
              retString[out++] = name;
        }
      }
      // vehicles
      else
      {
        Vehicle[] vehicles = World.GetVehicleList();
        int i, out = 0;
        for (i = 0; i < vehicles.size(); i++)
        {
          string name = vehicles[i].GetName();
          if (name and name.size())
           if (targetObjectName != name)
              retString[out++] = name;
        }
      }
    }
    // get list of queues in the industry (if any)
    else if (tokens[0] == "queue")
    {
      MapObject worldObject = cast<MapObject> Router.GetGameObject(targetObjectName);
      if (worldObject)
      {
        ProductQueue[] queues = worldObject.GetQueues();

        int i, out = 0;
        for (i = 0; i < queues.size(); i++)
        {
          string name = queues[i].GetQueueName();
          if (name and name.size())
            retString[out++] = name;
        }
      }
    }
    // get a list of valid products the designated queue can allow...
    else if (tokens[0] == "product")
    {
      MapObject worldObject = cast<MapObject> Router.GetGameObject(targetObjectName);
      if (worldObject)
      {
        ProductQueue queue = worldObject.GetQueue(queueName);
        if (queue)
        {
          ProductFilter filter = queue.GetProductFilter();
          Asset[] allowableProducts = filter.GetProducts();
          int i, out = 0;
          for (i = 0; i < allowableProducts.size(); i++)
            retString[out++] = allowableProducts[i].GetName();
        }
      }
    }

    return retString;
  }

  //
  // Return properties of this object in a soup
  //
  public Soup GetProperties()
  {
    Soup soup = inherited();

    soup.SetNamedTag("target-object", targetObjectName);
    soup.SetNamedTag("watch-type", m_watchType);
    soup.SetNamedTag("queue-exceed", m_queueExceed);

    return soup;
  }

  //
  // Initialize this object from the given properties soup
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    targetObjectName = soup.GetNamedTag("target-object");
    m_watchType      = soup.GetNamedTagAsBool("watch-type", true);
    m_queueExceed    = soup.GetNamedTagAsBool("queue-exceed", true);

    if (targetObjectName == "")
      targetObjectName = Constructors.GetTrainzStrings().GetString("interface-helper-blank-string");
  }

  //
  // Other methods
  //

  //
  // Gets maximum amount of products for current queue if possible (-1 otherwise)
  //
  public int GetMaxProducts(void)
  {
    MapObject worldObject = cast<MapObject> Router.GetGameObject(targetObjectName);
    if (worldObject)
    {
      ProductQueue queue = worldObject.GetQueue(queueName);
      if (queue)
        return queue.GetQueueSize();
    }

    return -1;
  }

  //
  // Determines if the queue description has a match with the target object
  //
  public bool DoesMatch(void)
  {
    // get handle to game object...
    MapObject targetObject = cast<MapObject> Router.GetGameObject(targetObjectName);
    if (targetObject)
    {
      // get handle to the currently watched queue
      ProductQueue queue = targetObject.GetQueue(queueName);
      if (queue)
      {
        // special case, when 0, we don't know about proudct types
        if (queue.GetQueueCount() == 0)
          if (!m_queueExceed  and  (amount > 0))
          {
            Interface.Log("# ResourceCheckInfo.DoesMatch> INFO: Queue '" + queueName + "' in object '" + targetObjectName + "' is empty and required amount is less than " + amount + ", rule satisfied!");
            return true;
          }

        Asset[] products = queue.GetProductList();
        int i;
        for (i = 0; i < products.size(); i++)
        {
          // find the product, if found put into filter and check
          if (products[i].GetName() == productKUID.GetName())
          {
            // product found, is required quantity present? - create filter to check
            ProductFilter filter = Constructors.NewProductFilter();
            filter.AddProduct(products[i]);

            if (( m_queueExceed and (queue.CountProductMatching(filter) >= amount)) or
                (!m_queueExceed and (queue.CountProductMatching(filter) < amount)))
            {
              Interface.Log("# ResourceCheckInfo.DoesMatch> INFO: Queue '" + queueName + "' in object '" + targetObjectName + "' has " + queue.CountProductMatching(filter) + " (less than " + amount + ") '" + productKUID.GetName() + "' products, rule condition satisfied");
              return true;
            }
          }
        }
      }
    }

    return false;
  }

  public bool ValidSettings(void)
  {
    if (queueName.size()  and  targetObjectName.size()  and productKUID)
      return true;

    return false;
  }

};

//
// Resource Check Rule
//  - Sets the COMPLETE flag when the designated industry has more than (or, less than)
//    a certain amount of a specified product type.
//  - Clears the COMPLETE flag when this is no longer the case.
//
class ResourceCheckRule isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  ResourceCheckInfo resourceCheckInfo;
  HTMLPropertyGroup group;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
//    SetStateFlags(DOES_COMPLETE, true);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property info handler stuff
    resourceCheckInfo = new ResourceCheckInfo();

    group = new HTMLPropertyGroup();
    group.AddHandler(resourceCheckInfo, "queueinfo/");

    SetPropertyHandler(group);
  }

  thread void ThreadPollCondition(void)
  {
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    wait()
    {
      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()) //  and  m_runOnlyOnceHandler.boolValue)
        {
          Interface.Log("# ResourceCheckRule.MainMsgThread> INFO: Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        // dw: temporary measure until Decouple messaging is fixed....
//        ruleSet = GetConditionResult();
        if (GetConditionResult())
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
//            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

  //
  // From ConditionalScenarioBeahvior
  //
  bool GetConditionResult(void)
  {
    return resourceCheckInfo.DoesMatch();
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string propertyStr = "description";

    if (resourceCheckInfo.ValidSettings())
    {
      if (resourceCheckInfo.m_watchType)
        propertyStr = propertyStr + "_info_industry";
      else
        propertyStr = propertyStr + "_info_vehicle";

      string waitAction = strTable.GetString("description_info_complete_" + (string)resourceCheckInfo.m_queueExceed);
      return strTable.GetString5(propertyStr, resourceCheckInfo.queueName, resourceCheckInfo.targetObjectName,
                                 waitAction, resourceCheckInfo.amount, resourceCheckInfo.productKUID.GetName());
    }

    return inherited();
  }

};


Schedule Rule
[Rules]

Schedule Rule

config.txt:

﻿
username            "Schedule Rule"
kind              "behavior"
kuid              <kuid:-3:10185>
script              "ScheduleRule"
class             "ScheduleRule"
string-table {
  description         "Allows a schedule of timed events to be applied to a train."
  html_rule_title         "Current Train: "
  html_description1       "Insert destination"
  html_description2       "<b>Schedule Rule</b><br><br>
<b>The following events are on the schedule:</b><br>"
  html_description3       "Select Train"
  html_description4       "Insert trackmark"
  html_industry_tt        "Industry Destination"
  html_trackname_tt       "Track name"
  html_command_tt         "Command: "
  html_none_tt          "None"
  html_arrival_time_tt        "Arrival Time"
  html_depart_time_tt       "Departure Time"
  html_remove_tt          "Remove"
  html_no_industry_tt       "Industry does not exist!"
  html_no_trackmark_tt        "Trackmark does not exist!"
  str_property_name0        "Select Train"
  str_property_name1        "Select Destination"
  str_property_name2        "Select Track name"
  str_property_name3        "Select Command"
  str_property_name4        "Select Arrival Time"
  str_property_name5        "Select Departure Time"
  str_property_name6        "Select Trackmark"
  str_property_desc0        "Select a train"
  str_property_desc1        "Select a destination"
  str_property_desc2        "Select a track name"
  str_property_desc3        "Select a command"
  str_property_desc4        "Select an arrival time"
  str_property_desc5        "Select a departure time"
  str_property_desc6        "Select a trackmark"
}
kuid-table {
  drive-to-trackmark        <kuid:-3:10149>
}
icon-texture            "schedule.texture"
username-de           "Fahrplan-Regel"
string-table-de {
  html_rule_title         "momentaner Zug: "
  html_description1       "Ziel eintragen"
  html_description2       "<b>Fahrplan-Regel</b><br><br>

<b>Die folgenden Ereignisse stehen auf dem Fahrplan:</b><br>"
  html_description3       "Zug auswählen"
  html_description4       "Streckenmarkierung einfügen"
  html_industry_tt        "Industrielles Ziel"
  html_trackname_tt       "Streckenname"
  html_command_tt         "Befehl: "
  html_none_tt          "Kein"
  html_arrival_time_tt        "Ankunftszeit"
  html_depart_time_tt       "Abfahrtszeit"
  html_remove_tt          "Entfernen"
  html_no_industry_tt       "Industrie existiert nicht!"
  html_no_trackmark_tt        "Streckenmarkierung existiert nicht!"
  str_property_name0        "Zug wählen"
  str_property_name1        "Ziel wählen"
  str_property_name2        "Streckenname wählen"
  str_property_name3        "Befehl wählen"
  str_property_name4        "Ankunftszeit wählen"
  str_property_name5        "Abfahrtszeit wählen"
  str_property_name6        "Streckenmarkierung wählen"
  str_property_desc0        "Zug wählen"
  str_property_desc1        "Wählen Sie ein Ziel"
  str_property_desc2        "Wählen Sie einenn Streckennamen"
  str_property_desc3        "Wählen Sie einen Befehl"
  str_property_desc4        "Wählen Sie eine Ankunftszeit"
  str_property_desc5        "Wählen Sie eine Abfahrtszeit"
  str_property_desc6        "Wählen Sie eine Streckenmarkierung"
}
username-it           "Schedule Rule"
string-table-it {
  html_rule_title         "Current Train: "
  html_description1       "Insert destination"
  html_description2       "<b>Schedule Rule</b><br><br>

<b>The following events are on the schedule:</b><br>"
  html_description3       "Select Train"
  html_description4       "Insert trackmark"
  html_industry_tt        "Industry Destination"
  html_trackname_tt       "Track name"
  html_command_tt         "Command: "
  html_none_tt          "None"
  html_arrival_time_tt        "Arrival Time"
  html_depart_time_tt       "Departure Time"
  html_remove_tt          "Remove"
  html_no_industry_tt       "Industry does not exist!"
  html_no_trackmark_tt        "Trackmark does not exist!"
  str_property_name0        "Select Train"
  str_property_name1        "Select Destination"
  str_property_name2        "Select Track name"
  str_property_name3        "Select Command"
  str_property_name4        "Select Arrival Time"
  str_property_name5        "Select Departure Time"
  str_property_name6        "Select Trackmark"
  str_property_desc0        "Select a train"
  str_property_desc1        "Select a destination"
  str_property_desc2        "Select a track name"
  str_property_desc3        "Select a command"
  str_property_desc4        "Select an arrival time"
  str_property_desc5        "Select a departure time"
  str_property_desc6        "Select a trackmark"
}
username-es           "Regla de programa"
string-table-es {
  html_rule_title         "Tren actual: "
  html_description1       "Insertar destino"
  html_description2       "<b>Regla de programa</b><br><br>

<b>Establecer horario de los siguientes eventos:</b><br>"
  html_description3       "Seleccionar tren"
  html_description4       "Insertar marca viaria"
  html_industry_tt        "Industria de destino"
  html_trackname_tt       "Nombre de la vía"
  html_command_tt         "Orden: "
  html_none_tt          "Ninguna"
  html_arrival_time_tt        "Hora de llegada"
  html_depart_time_tt       "Hora de salida"
  html_remove_tt          "Quitar"
  html_no_industry_tt       "Tal industria no existe"
  html_no_trackmark_tt        "Tal marca viaria no existe"
  str_property_name0        "Seleccionar tren"
  str_property_name1        "Seleccionar destino"
  str_property_name2        "Seleccionar nombre de la vía"
  str_property_name3        "Seleccionar orden"
  str_property_name4        "Seleccionar hora de llegada"
  str_property_name5        "Seleccionar hora de salida"
  str_property_name6        "Seleccionar marca viaria"
  str_property_desc0        "Selecciona un tren"
  str_property_desc1        "Selecciona un destino"
  str_property_desc2        "Selecciona un nombre de vía"
  str_property_desc3        "Selecciona una orden"
  str_property_desc4        "Selecciona una hora de llegada"
  str_property_desc5        "Selecciona una hora de salida"
  str_property_desc6        "Selecciona una marca viaria"
}
username-pl           "Schedule Rule"
string-table-pl {
  html_rule_title         "Current Train: "
  html_description1       "Insert destination"
  html_description2       "<b>Schedule Rule</b><br><br>

<b>The following events are on the schedule:</b><br>"
  html_description3       "Select Train"
  html_description4       "Insert trackmark"
  html_industry_tt        "Industry Destination"
  html_trackname_tt       "Track name"
  html_command_tt         "Command: "
  html_none_tt          "None"
  html_arrival_time_tt        "Arrival Time"
  html_depart_time_tt       "Departure Time"
  html_remove_tt          "Remove"
  html_no_industry_tt       "Industry does not exist!"
  html_no_trackmark_tt        "Trackmark does not exist!"
  str_property_name0        "Select Train"
  str_property_name1        "Select Destination"
  str_property_name2        "Select Track name"
  str_property_name3        "Select Command"
  str_property_name4        "Select Arrival Time"
  str_property_name5        "Select Departure Time"
  str_property_name6        "Select Trackmark"
  str_property_desc0        "Select a train"
  str_property_desc1        "Select a destination"
  str_property_desc2        "Select a track name"
  str_property_desc3        "Select a command"
  str_property_desc4        "Select an arrival time"
  str_property_desc5        "Select a departure time"
  str_property_desc6        "Select a trackmark"
}
username-cz           "Pravidlo jízdního řádu"
string-table-cz {
  html_rule_title         "Aktuální vlak: "
  html_description1       "Zadej cíl"
  html_description2       "<b>Pravidlo jízdního řádu</b><br><br>

<b>V jízdním řádu jsou zadány následující události:</b><br>"
  html_description3       "Vložit vlak"
  html_description4       "Vložit traťovou značku"
  html_industry_tt        "Průmyslový cíl"
  html_trackname_tt       "Název tratě"
  html_command_tt         "Příkaz: "
  html_none_tt          "Žádný"
  html_arrival_time_tt        "Pravidelný příjezd"
  html_depart_time_tt       "Pravidelný odjezd"
  html_remove_tt          "Odstranit"
  html_no_industry_tt       "Průmyslová stavba neexistuje!"
  html_no_trackmark_tt        "Traťová značka neexistuje!"
  str_property_name0        "Zvol vlak"
  str_property_name1        "Zvol cíl"
  str_property_name2        "Zvol název tratě"
  str_property_name3        "Zvol příkaz"
  str_property_name4        "Nastav pravidelný příjezd"
  str_property_name5        "Nastav pravidelný odjezd"
  str_property_name6        "Zvol traťovou značku"
  str_property_desc0        "Zvol vlak"
  str_property_desc1        "Zvol cíl"
  str_property_desc2        "Zvol název tratě"
  str_property_desc3        "Zvol příkaz"
  str_property_desc4        "Nastav pravidelný příjezd"
  str_property_desc5        "Nastav pravidelný odjezd"
  str_property_desc6        "Zvol traťovou značku"
}
username-ru           "Расписание"
string-table-ru {
  html_rule_title         "Текущий состав: "
  html_description1       "Указать место назначения"
  html_description2       "Расписание

В расписании следующие записи:
"
  html_description3       "Выбрать состав"
  html_description4       "Выбрать указатель"
  html_industry_tt        "Индустрия назначения"
  html_trackname_tt       "Имя пути"
  html_command_tt         "Команда: "
  html_none_tt          "Нет"
  html_arrival_time_tt        "Время прибытия"
  html_depart_time_tt       "Время отправления"
  html_remove_tt          "Удалить"
  html_no_industry_tt       "Индустрия не существует!"
  html_no_trackmark_tt        "Указатель не существует!"
  str_property_name0        "Выбрать Состав"
  str_property_name1        "Выбрать Место назначения"
  str_property_name2        "Выбрать Имя пути"
  str_property_name3        "Выбрать Команду"
  str_property_name4        "Выбрать Время прибытия"
  str_property_name5        "Выбрать Время отправления"
  str_property_name6        "Выбрать Указатель"
  str_property_desc0        "Выбрать состав"
  str_property_desc1        "Выбрать место назначения"
  str_property_desc2        "Выбрать имя пути"
  str_property_desc3        "Выбрать команду"
  str_property_desc4        "Выбрать время прибытия"
  str_property_desc5        "Выбрать время отправления"
  str_property_desc6        "Выбрать указатель"
}
username-fr           "Règle des horaires"
string-table-fr {
  html_rule_title         "Train actuel :"
  html_description1       "Choix d'une destination"
  html_description2       "<b>Règle des horaires</b><br><br>

<b>Les évènements suivants sont prévus :</b><br>"
  html_description3       "Sélection d'un train"
  html_description4       "Ajout d'un marqueur de voie"
  html_industry_tt        "Industrie de destination"
  html_trackname_tt       "Nom de voie"
  html_command_tt         "Ordre : "
  html_none_tt          "Aucun"
  html_arrival_time_tt        "Horaire d'arrivée"
  html_depart_time_tt       "Horaire de départ"
  html_remove_tt          "Retirer"
  html_no_industry_tt       "L'industrie n'existe pas !"
  html_no_trackmark_tt        "Le marqueur de voie n'existe pas !"
  str_property_name0        "Sélectionner un train"
  str_property_name1        "Sélectionner une destination"
  str_property_name2        "Sélectionner un nom de voie"
  str_property_name3        "Sélectionner un ordre"
  str_property_name4        "Sélectionner l'horaire d'arrivée"
  str_property_name5        "Sélectionner l'horaire de départ"
  str_property_name6        "Sélectionner le marqueur de voie"
  str_property_desc0        "Sélectionne un train"
  str_property_desc1        "Sélectionne une destination"
  str_property_desc2        "Sélectionne un nom de voie"
  str_property_desc3        "Sélectionne un ordre"
  str_property_desc4        "Sélectionne l'heure d'arrivée"
  str_property_desc5        "Sélectionne l'heure de départ"
  str_property_desc6        "Sélectionne un marqueur de voie"
}

ScheduleRule.gs:

//
// ScheduleRule.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "Browser.gs"
include "KUID.gs"
include "ScheduleRule_TrainTimetable.gs"

//
// This rule allows the scenario-designer to edit the driver commands available in a profile.
//
class ScheduleRule isclass ScenarioBehavior
{
  string trainName;
  TrainTimetableItem[] schedule;
  //int currentItem;

  void StopScheduleNow(void);
  void StartScheduleNow(void);
  int isRunning = 0;
  int currentScheduleItem = 0;
  int inScenery = 0;
  bool scheduleComplete = false;

    // set to 1 if you want to see a whole pile of debug messages
    // this can be useful for debugging this rule, or other rules/commands which interact with this rule
  int debugScheduleRule = 0;

  //
  // Public Accessors
  //

  // Returns a bool that determines if the user has arrived and stopped at the destination, at least once
  public bool GetArrivedAtDestination(void);

  // Returns a bool that determines if the train is late to arrive (or was late) depending on if GetArrivedAtDestination is true or false
  public bool GetIsLate(void);

  // Returns a bool that determines if the train is currently still at the destination.
  public bool GetIsAtDestination(void);

  //
  // PRIVATE IMPLEMENTATION
  //
  string GetHumanReadableNameFromTrackName(string trackName, string industryName);
  string GetRealTrackNameFromHumanReadableName(string humanReadable, string industryName);
  thread void ScheduleMonitor(void);

  //
  // Initialization method that sets the driver command array to being empty.
  //
  public void Init(Asset p_self)
  {
    inherited(p_self);

    schedule = new TrainTimetableItem[0];
    //trainName = "";
    //currentItem = 0;
  }

  //
  // Pause/unpause this behavior.  When unpaused, CreateCommandsNow() is called to reset
  // driver commands.
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
      StopScheduleNow();
    else
      StartScheduleNow();
  }

  //
  // PropertyObject methods
  //

  //
  // Initializes the driver commands list of this rule from the given database.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    //
    // Clear any existing data
    //
    schedule = new TrainTimetableItem[0];
    //currentItem = 0;

    //
    // Reload from the specified soup
    //
    Soup configSchedule = soup.GetNamedSoup("ScheduleRule.schedule");

    int i, count = configSchedule.CountTags();
    for (i = 0; i < count; i++)
    {
      TrainTimetableItem item = new TrainTimetableItem();
      Soup configItem = configSchedule.GetNamedSoup((string)i);

      item.mode = configItem.GetNamedTagAsInt("mode");
      if (item.mode == 0)
        item.mode = TrainTimetableItem.MODE_INDUSTRY;
      item.command = configItem.GetNamedTagAsKUID("command");
      item.destinationName = configItem.GetNamedTag("destinationName");
      item.trackName = configItem.GetNamedTag("trackName");

      item.arrivalTime = configItem.GetNamedTagAsFloat("arrivalTime");
      item.departureTime = configItem.GetNamedTagAsFloat("departureTime");

      item.msgLateSent = configItem.GetNamedTagAsFloat("msgLateSent");
      item.msgEarlySent = configItem.GetNamedTagAsFloat("msgEarlySent");
      item.arrivedAtDestination = configItem.GetNamedTagAsFloat("arrivedAtDestination");
      item.arrivedLate = configItem.GetNamedTagAsFloat("arrivedLate");
      item.departEarly = configItem.GetNamedTagAsFloat("departEarly");
      item.arriveEarly = configItem.GetNamedTagAsFloat("arriveEarly");

      schedule[i] = item;
    }

    currentScheduleItem = soup.GetNamedTagAsInt("ScheduleRule.currentScheduleItem");
    trainName = soup.GetNamedTag("ScheduleRule.trainName");

    if (!IsPaused())
      StartScheduleNow();
  }

  //
  // Saves the KUIDs of the driver commands in this rule to a database and returns it.
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    Soup configSchedule = Constructors.NewSoup();
    int i, count = schedule.size();
    for (i = 0; i < count; i++)
    {
      Soup configItem = Constructors.NewSoup();
      TrainTimetableItem item = schedule[i];

      configItem.SetNamedTag("mode", item.mode);
      configItem.SetNamedTag("command", item.command);
      configItem.SetNamedTag("destinationName", item.destinationName);
      configItem.SetNamedTag("trackName", item.trackName);

      configItem.SetNamedTag("arrivalTime", item.arrivalTime);
      configItem.SetNamedTag("departureTime", item.departureTime);

      configItem.SetNamedTag("msgLateSent", item.msgLateSent);
      configItem.SetNamedTag("msgEarlySent", item.msgEarlySent);
      configItem.SetNamedTag("arrivedAtDestination", item.arrivedAtDestination);
      configItem.SetNamedTag("arrivedLate", item.arrivedLate);
      configItem.SetNamedTag("departEarly", item.departEarly);
      configItem.SetNamedTag("arriveEarly", item.arriveEarly);

      configSchedule.SetNamedSoup((string)i, configItem);
    }
    soup.SetNamedSoup("ScheduleRule.schedule", configSchedule);

    soup.SetNamedTag("ScheduleRule.currentScheduleItem", currentScheduleItem);
    soup.SetNamedTag("ScheduleRule.trainName", trainName);

    return soup;
  }

  string GetAnalogClockObject(int hours, int minutes, int seconds)
  {
    return "<trainz-object style=clock id='message'
            face-texture='clock_face.tga'
            seconds-texture='clock_seconds.tga'
            minutes-texture='clock_minutes.tga'
            hours-texture='clock_hours.tga'

            seconds-visible='1'
            minutes-visible='1'
            hours-visible='1'

            seconds='" + seconds + "'
            minutes='" + minutes + "'
            hours='" + hours + "'

            width=64 height=64></trainz-object>";
  }

  //
  // Returns HTML code with hyperlinks that allows commands in this rule to be added/deleted.
  //
  public string GetDescriptionHTML(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string list = "";
    int i;

    list = list + "<table inherit-font>";
    list = list + "<tr><td>" + strTable.GetString("html_rule_title");

    if (trainName and trainName.size() > 0)
      list = list + " <a href=live://property/select-train>" + trainName + "</a><br><br>";
    else
      list = list + " <a href=live://property/select-train>" + strTable.GetString("html_description3") + "</a><br><br>";

    list = list + "</td></tr></table>";

    // Allow inserting...
    list = list + "  <a href=live://property/add-destination/0>" + strTable.GetString("html_description1") + "</a><br>";
    list = list + "  <a href=live://property/add-destination-tm/0>" + strTable.GetString("html_description4") + "</a><br>";
    for (i = 0; i < schedule.size(); i++)
    {
      if (schedule[i])
      {
        Industry industry = cast<Industry>(Router.GetGameObject(schedule[i].destinationName));
        TrackMark trackMark = cast<TrackMark>(Router.GetGameObject(schedule[i].destinationName));
        Asset commandAsset = null;
        if (schedule[i].command)
          commandAsset = World.FindAsset(schedule[i].command);
        KUID kuid;
        string icon = "";
        string commandicon;
        if (industry)
        {
          kuid = industry.GetAsset().GetKUID();
          icon = kuid.GetHTMLString();
        }
        if (trackMark)
        {
          kuid = GetAsset().LookupKUIDTable("drive-to-trackmark");
          icon = kuid.GetHTMLString();
        }
        if (commandAsset)
        {
          if (schedule[i].command)
            commandicon = schedule[i].command.GetHTMLString();
        }

        //list = list + "<tr><td width=5></td>";
        if (industry or trackMark)
        {
          Asset core = Constructors.GetTrainzAsset();
          string commandHTML = "";
          string commandNameHTML = "";
          if (commandAsset)
          {
            commandHTML     = HTMLWindow.MakeFontColorBlack( HTMLWindow.MakeLink( "live://property/command/" + ((string)i), HTMLWindow.MakeImage(commandicon, true, 32, 32), strTable.GetString("html_command_tt") + commandAsset.GetName() ) );
            commandNameHTML = HTMLWindow.MakeFontColorBlack( HTMLWindow.MakeLink( "live://property/command/" + ((string)i), commandAsset.GetName(), strTable.GetString("html_command_tt") + commandAsset.GetName() ) );
          }
          else
          {
            KUID kuidInvalid = core.LookupKUIDTable("invalid-command");
            string imgInvalidString = kuidInvalid.GetHTMLString();

            commandHTML = HTMLWindow.MakeFontColorBlack( HTMLWindow.MakeLink( "live://property/command/" + ((string)i), HTMLWindow.MakeImage(imgInvalidString, true, 32, 32), strTable.GetString("html_command_tt") + " " + strTable.GetString("html_none_tt") ) );
            commandNameHTML = HTMLWindow.MakeFontColorBlack( HTMLWindow.MakeLink( "live://property/command/" + ((string)i), strTable.GetString("html_none_tt"), strTable.GetString("html_command_tt") + " " + strTable.GetString("html_none_tt") ) );
          }

          KUID kuidRemove = core.LookupKUIDTable("imgRemove");
          string removeString = kuidRemove.GetHTMLString();

          string trackHTML = "";
          if (schedule[i].mode == TrainTimetableItem.MODE_INDUSTRY)
            trackHTML = HTMLWindow.MakeRow(
                          HTMLWindow.MakeCell(
                            HTMLWindow.MakeLink( "live://property/trackName/" + ((string)i), HTMLWindow.MakeImage("trackrail_icon.tga", false, 32, 32), strTable.GetString("html_trackname_tt") )
                          ) +
                          HTMLWindow.MakeCell(
                            HTMLWindow.MakeLink( "live://property/trackName/" + ((string)i), BrowserInterface.Quote(GetHumanReadableNameFromTrackName(schedule[i].trackName, schedule[i].destinationName)), strTable.GetString("html_trackname_tt") )
                          )
                        );

          list = list + HTMLWindow.MakeTable(
                          HTMLWindow.MakeRow(
                            HTMLWindow.MakeCell( HTMLWindow.MakeLink( "live://property/destinationName/" + ((string)i), BrowserInterface.Quote(schedule[i].destinationName), strTable.GetString("html_industry_tt") ), "colspan=6" )
                          , "bgcolor=#C9880059")
                          + HTMLWindow.MakeRow(
                            HTMLWindow.MakeCell( HTMLWindow.MakeLink( "live://property/destinationName/" + ((string)i), HTMLWindow.MakeImage( icon, true, 64, 64 ), strTable.GetString("html_industry_tt") ) ) +
                            HTMLWindow.MakeCell( "", "width=10" )+
                            HTMLWindow.MakeCell( HTMLWindow.MakeLink( "live://property/arrivalTime/" + ((string)i), GetAnalogClockObject( HTMLWindow.GetHoursFromFloat(schedule[i].arrivalTime), HTMLWindow.GetMinutesFromFloat(schedule[i].arrivalTime), HTMLWindow.GetSecondsFromFloat(schedule[i].arrivalTime) ), strTable.GetString("html_arrival_time_tt") ) ) +
                            HTMLWindow.MakeCell( "", "width=10" )+
                            HTMLWindow.MakeCell( HTMLWindow.MakeLink( "live://property/departureTime/" + ((string)i), GetAnalogClockObject( HTMLWindow.GetHoursFromFloat(schedule[i].departureTime), HTMLWindow.GetMinutesFromFloat(schedule[i].departureTime), HTMLWindow.GetSecondsFromFloat(schedule[i].departureTime) ), strTable.GetString("html_depart_time_tt") ) ) +

                            HTMLWindow.MakeCell( "", "width=10" )+

                            HTMLWindow.MakeCell(
                              HTMLWindow.MakeTable(
                                HTMLWindow.MakeRow(
                                  HTMLWindow.MakeCell(
                                    commandHTML
                                  ) +
                                  HTMLWindow.MakeCell(
                                    commandNameHTML
                                  )
                                ) +
                                trackHTML
                              , "inherit-font")
                            )
                          ) +
                          HTMLWindow.MakeRow(
                            HTMLWindow.MakeCell( "" ) +
                            HTMLWindow.MakeCell( "", "width=10" )+
                            HTMLWindow.MakeCell( HTMLWindow.MakeLink( "live://property/arrivalTime/" + ((string)i), BrowserInterface.Quote(HTMLWindow.GetFloatAsTimeString(schedule[i].arrivalTime)), strTable.GetString("html_arrival_time_tt") ) ) +
                            HTMLWindow.MakeCell( "", "width=10" )+
                            HTMLWindow.MakeCell( HTMLWindow.MakeLink( "live://property/departureTime/" + ((string)i), BrowserInterface.Quote(HTMLWindow.GetFloatAsTimeString(schedule[i].departureTime)), strTable.GetString("html_depart_time_tt") ) ) +
                            HTMLWindow.MakeCell( "", "width=10" )+
                            HTMLWindow.MakeCell( "", "width=100%" ) +
                            HTMLWindow.MakeCell( HTMLWindow.MakeLink( "live://property/remove/" + ((string)i), HTMLWindow.MakeImage(removeString, true, 32, 32), strTable.GetString("html_remove_tt") ), "width=32" )
                          )
                        , "bgcolor=#FFAD0059 width=100% bordercolor=#00000059 inherit-font"
                        )
                        + HTMLWindow.MakeTable( HTMLWindow.MakeRow( HTMLWindow.MakeCell( "" ) ), "height=4" );

        }
        else
        {
          list = list + "<table><tr>";
          list = list + "<td> </td><td width=5></td>";
          list = list + "<td><font color=#000000 size=2><a tooltip='" + strTable.GetString("html_industry_tt") + "' href=live://property/destinationName/" + ((string)i) + ">" + BrowserInterface.Quote(schedule[i].destinationName) + "</a></font></td><td width=5></td>";
          if (schedule[i].mode == TrainTimetableItem.MODE_INDUSTRY)
            list = list + "<td><font color=#000000>" + strTable.GetString("html_no_industry_tt") + "</font></td><td width=5></td>";
          if (schedule[i].mode == TrainTimetableItem.MODE_TRACKMARK)
            list = list + "<td><font color=#000000>" + strTable.GetString("html_no_trackmark_tt") + "</font></td><td width=5></td>";
          list = list + "<td><font color=#000000><a tooltip='" + strTable.GetString("html_remove_tt") + "' href=live://property/remove/" + ((string)i) + ">" + strTable.GetString("html_remove_tt") + "</a></font></td><td width=5></td>";

          list = list + "</tr><tr>";

          list = list + "<tr><td width=5></td>";
          list = list + "<td width=32></td><td width=5></td>";
          list = list + "<td><font color=#000000> </font></td><td width=5></td>";
          list = list + "<td><font color=#000000> </font></td><td width=5></td>";
          list = list + "<td><font color=#000000> </font></td>";
          list = list + "</tr>";

          list = list + "</tr></table>";
        }
      }

      // Allow inserting...
      list = list + "  <a href=live://property/add-destination/" + (i + 1) + ">" + strTable.GetString("html_description1") + "</a><br>";
      list = list + "  <a href=live://property/add-destination-tm/" + (i + 1) + ">" + strTable.GetString("html_description4") + "</a><br>";
    }
    list = list + "<br>";

    return "<html><body><font color=#000000>" + strTable.GetString("html_description2") + list + "</font></body></html>";

  }

  //
  // Gets user-friendly readable name for the named property.
  //
  string GetPropertyName(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID[0, 16] == "add-destination/")
      return strTable.GetString("html_description1");
    if (propertyID == "select-train")
      return strTable.GetString("str_property_name0");
    if (propertyID[0, 16] == "destinationName/")
      return strTable.GetString("str_property_name1");
    if (propertyID[0, 10] == "trackName/")
      return strTable.GetString("str_property_name2");
    if (propertyID[0, 8] == "command/")
      return strTable.GetString("str_property_name3");
    if (propertyID[0, 12] == "arrivalTime/")
      return strTable.GetString("str_property_name4");
    if (propertyID[0, 14] == "departureTime/")
      return strTable.GetString("str_property_name5");
    if (propertyID[0, 19] == "add-destination-tm/")
      return strTable.GetString("str_property_name6");

    return "<null>";
  }

  //
  // Gets user-friendly readable description of named property.
  //
  string GetPropertyDescription(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID[0, 16] == "add-destination/")
      return strTable.GetString("str_property_desc1");
    if (propertyID == "select-train")
      return strTable.GetString("str_property_desc0");
    if (propertyID[0, 16] == "destinationName/")
      return strTable.GetString("str_property_desc1");
    if (propertyID[0, 10] == "trackName/")
      return strTable.GetString("str_property_desc2");
    if (propertyID[0, 8] == "command/")
      return strTable.GetString("str_property_desc3");
    if (propertyID[0, 12] == "arrivalTime/")
      return strTable.GetString("str_property_desc4");
    if (propertyID[0, 14] == "departureTime/")
      return strTable.GetString("str_property_desc5");
    if (propertyID[0, 19] == "add-destination-tm/")
      return strTable.GetString("str_property_desc6");

    return "<null>";
  }

  //
  // Gets the type for the named property.
  //
  string GetPropertyType(string propertyID)
  {
    if (propertyID[0, 16] == "add-destination/")
      return "list,1";
    if (propertyID[0, 19] == "add-destination-tm/")
      return "list,1";
    if (propertyID == "select-train")
      return "list,1";

    if (propertyID[0, 16] == "destinationName/")
      return "list,1";

    if (propertyID[0, 10] == "trackName/")
      return "list,1";

    if (propertyID[0, 8] == "command/")
      return "list,1";

    if (propertyID[0, 12] == "arrivalTime/")
      return "string";

    if (propertyID[0, 14] == "departureTime/")
      return "string";

    return "link";
  }

  //
  // Called by SetPropertValue and GetPropertyElementList to get the names of all of the
  // industries in the array.
  //
  void GetIndustryNameList(string[] names)
  {
    GameObject[] commandAssets = World.GetIndustryList();

    int i, out = 0;

    for (i = 0; i < commandAssets.size(); i++)
    {
      string name = commandAssets[i].GetName();

      if (names)
      {
        names[out] = name;
        out++;
      }
    }
  }

  //
  // Called by SetPropertValue and GetPropertyElementList to get the names of all of the
  // trackmarks in the array.
  //
  void GetTrackmarkNameList(string[] names)
  {
    TrackMark[] commandAssets = World.GetTrackMarkList();

    int i, out = 0;

    for (i = 0; i < commandAssets.size(); i++)
    {
      string name = commandAssets[i].GetName();

      if (names)
      {
        names[out] = name;
        out++;
      }
    }
  }

  //
  // Called by SetPropertValue and GetPropertyElementList to get the names of all of the
  // trains in the array.
  //
  void GetTrainNameList(string[] names)
  {
    Vehicle[] vehicles = World.GetVehicleList();

    int i, out = 0;
    for (i = 0; i < vehicles.size(); i++)
    {
      Locomotive loco = cast<Locomotive>(vehicles[i]);

      if (loco)
      {
        string name = vehicles[i].GetName();

        if (names)
        {
          names[out] = name;
          out++;
        }
      }
    }
  }

  //
  // Called by SetPropertValue and GetPropertyElementList to get the names of all of the
  // current industry destinations in the array.
  //
  void GetIndustryDestinationNameList(string[] names, string industryName)
  {

    string[] destNames;
    string[] destTracks;
    destNames = new string[0];
    destTracks = new string[0];

    Industry industry = cast<Industry>(Router.GetGameObject(industryName));

    if (industry)
    {
      industry.AppendDriverDestinations(destNames, destTracks);
      int l;
      int out;
      for (l = 0; l < destNames.size(); l++)
      {
        names[out] = destNames[l];
        out++;
      }
    }
  }

  string GetRealTrackNameFromHumanReadableName(string humanReadable, string industryName)
  {

    string[] destNames;
    string[] destTracks;
    destNames = new string[0];
    destTracks = new string[0];

    Industry industry = cast<Industry>(Router.GetGameObject(industryName));
    if (!industry)
      return "";

    industry.AppendDriverDestinations(destNames, destTracks);
    int l;
    int out;
    for (l = 0; l < destNames.size(); l++)
    {
      if (destNames[l] == humanReadable)
      {
        return destTracks[l];
      }
    }
    return "";
  }

  string GetHumanReadableNameFromTrackName(string trackName, string industryName)
  {
    StringTable strTable = GetAsset().GetStringTable();

    string[] destNames;
    string[] destTracks;
    destNames = new string[0];
    destTracks = new string[0];

    Industry industry = cast<Industry>(Router.GetGameObject(industryName));
    if (!industry)
      return strTable.GetString("html_none_tt");

    industry.AppendDriverDestinations(destNames, destTracks);
    int l;
    int out;
    for (l = 0; l < destNames.size(); l++)
    {
      if (destTracks[l] == trackName)
      {
        return destNames[l];
      }
    }
    return strTable.GetString("html_none_tt");
  }

  //
  // Called by SetPropertValue and GetPropertyElementList to get the names of all of the
  // current industry destinations in the array.
  //
  void GetCommandNameList(string[] names)
  {
    // TODO:
    Asset[] commands = World.GetAssetList("drivercommand");
    int l;
    int out;

    // Add 'None'
    if (names)
    {
      names[out] = "None";
      out++;
    }

    for (l = 0; l < commands.size(); l++)
    {
      names[out] = commands[l].GetName();
      out++;
    }
  }

  void GetCommandNameKUIDList(string[] names, KUID[] kuids)
  {
    Asset[] commandAssets = World.GetAssetList("DriverCommand");

    int i, out = 0;
    for (i = 0; i < commandAssets.size(); i++)
    {
      KUID kuid = commandAssets[i].GetKUID();
      int n;

      if (kuid)
      {
        if (names)
          names[out] = commandAssets[i].GetName();
        if (kuids)
          kuids[out] = kuid;

        out++;
      }
    }
  }

  void SetPropertyValue(string propertyID, string value, int valueIndex)
  {
    if (propertyID[0, 16] == "add-destination/")
    {
      string strIndex = propertyID;
      strIndex[0, 16] = null;
      int index = Str.ToInt(strIndex);

      TrainTimetableItem[] newItem = new TrainTimetableItem[0];
      newItem[0] = new TrainTimetableItem();
      newItem[0].mode = TrainTimetableItem.MODE_INDUSTRY;
      newItem[0].destinationName = value;
      newItem[0].command = null;
      newItem[0].trackName = "None";
      newItem[0].arrivalTime = HTMLWindow.GetTimeStringAsFloat("1000");
      newItem[0].departureTime = HTMLWindow.GetTimeStringAsFloat("1001");

      schedule[index, index] = newItem;
    }

    if (propertyID[0, 19] == "add-destination-tm/")
    {
      string strIndex = propertyID;
      strIndex[0, 19] = null;
      int index = Str.ToInt(strIndex);

      TrainTimetableItem[] newItem = new TrainTimetableItem[0];
      newItem[0] = new TrainTimetableItem();
      newItem[0].mode = TrainTimetableItem.MODE_TRACKMARK;
      newItem[0].destinationName = value;
      newItem[0].command = null;
      newItem[0].trackName = "None";
      newItem[0].arrivalTime = HTMLWindow.GetTimeStringAsFloat("1000");
      newItem[0].departureTime = HTMLWindow.GetTimeStringAsFloat("1001");

      schedule[index, index] = newItem;
    }

    if (propertyID == "select-train")
    {
      trainName = value;
    }

    if (propertyID[0, 16] == "destinationName/")
    {
      string strIndex = propertyID;
      strIndex[0, 16] = null;
      int index = Str.ToInt(strIndex);

      schedule[index].destinationName = value;
      // Also reset the trackName, otherwise it might refer to a non-existant one.
      schedule[index].trackName = "None";
    }

    if (propertyID[0, 10] == "trackName/")
    {
      string strIndex = propertyID;
      strIndex[0, 10] = null;
      int index = Str.ToInt(strIndex);

      // value is in human-readable, get machine readable ;)
      schedule[index].trackName = GetRealTrackNameFromHumanReadableName(value, schedule[index].destinationName);
    }

    if (propertyID[0, 8] == "command/")
    {
      string strIndex = propertyID;
      strIndex[0, 8] = null;
      int index = Str.ToInt(strIndex);

      string[] names = new string[0];
      KUID[] kuids = new KUID[0];

      GetCommandNameKUIDList(names, kuids);
      int i;

      for (i = 0; i < names.size(); i++)
        if (names[i] == value)
        {
          schedule[index].command = kuids[i];
          return;
        }

      schedule[index].command = null;
    }

  }

  void SetPropertyValue(string propertyID, string value)
  {
    if (propertyID[0, 12] == "arrivalTime/")
    {
      string strIndex = propertyID;
      strIndex[0, 12] = null;
      int index = Str.ToInt(strIndex);

      schedule[index].arrivalTime = HTMLWindow.GetTimeStringAsFloat(value);
    }

    if (propertyID[0, 14] == "departureTime/")
    {
      string strIndex = propertyID;
      strIndex[0, 14] = null;
      int index = Str.ToInt(strIndex);

      schedule[index].departureTime = HTMLWindow.GetTimeStringAsFloat(value);
    }
  }

  //
  // Respond to a hyper-link click on the named property.
  //
  void LinkPropertyValue(string propertyID)
  {
    if (propertyID[0, 7] == "remove/")
    {
      string strIndex = propertyID;
      strIndex[0, 7] = null;
      int index = Str.ToInt(strIndex);
      schedule[index,index + 1] = null;
    }
  }

  //
  // Gets a list of elements the user can select for the named property.
  //
  public string[] GetPropertyElementList(string propertyID)
  {
    string[] ret = new string[0];
    if (propertyID[0, 16] == "add-destination/")
      GetIndustryNameList(ret);

    if (propertyID[0, 19] == "add-destination-tm/")
      GetTrackmarkNameList(ret);

    if (propertyID == "select-train")
      GetTrainNameList(ret);

    if (propertyID[0, 16] == "destinationName/")
    {
      string strIndex = propertyID;
      strIndex[0, 16] = null;
      int index = Str.ToInt(strIndex);

      if (schedule[index].mode == TrainTimetableItem.MODE_INDUSTRY or schedule[index].mode == 0)
        GetIndustryNameList(ret);
      if (schedule[index].mode == TrainTimetableItem.MODE_TRACKMARK)
        GetTrackmarkNameList(ret);
    }

    if (propertyID[0, 10] == "trackName/")
    {
      string strIndex = propertyID;
      strIndex[0, 10] = null;
      int index = Str.ToInt(strIndex);

      GetIndustryDestinationNameList(ret, schedule[index].destinationName);
    }

    if (propertyID[0, 8] == "command/")
      GetCommandNameList(ret);

    //if (propertyID[0, 12] == "arrivalTime/")
    //  return "float";

    //if (propertyID[0, 14] == "departureTime/")
    //  return "float";

    return ret;
  }

  void StopScheduleNow(void)
  {
    // Setting this flag to false will ensure that the ScheduleMonitor ends
    if (isRunning == 1)
      isRunning = -1;
  }

  void StartScheduleNow(void)
  {
    if (isRunning != 1)
    {
      isRunning = 1;
      ScheduleMonitor();    // Ensure its only run once
    }
  }

  public string GetCurrentStopAsString()
  {
    return schedule[currentScheduleItem].destinationName;
  }

  public Industry GetCurrentStopAsIndustry()
  {
    return cast<Industry>(Router.GetGameObject(schedule[currentScheduleItem].destinationName));
  }

  public bool IsAtCurrentDestination()
  {
    return inScenery > 0;
  }

  thread void ScheduleMonitor(void)
  {
    Locomotive vehicle = cast<Locomotive>(Router.GetGameObject(trainName));
    if (debugScheduleRule)
      Interface.Log("<<DEBUG>> Watching vehicle: " + trainName);
    if (!vehicle)
    {
      isRunning = 0;
      return;
    }

    Train train = vehicle.GetMyTrain();

    ScheduleRule_TrainTimetable timetable = new ScheduleRule_TrainTimetable();
    timetable.scheduleRule = me;
    timetable.train = train;

    train.SetTrainTimetable(timetable);
    Sniff(vehicle, "SceneryTrigger", null, true);
    Sniff(train, "Train", "StoppedMoving", true);
    Sniff(train, "TrackMark", null, true);
    Sniff(train, "Train", "Cleanup", true);

    Message msg;
    while (!scheduleComplete  and  (isRunning == 1))
    {
      // Wait for the current Schedule Item to be completed.
      GameObject industry = Router.GetGameObject(schedule[currentScheduleItem].destinationName);
      if (!industry)
        // error, abort.
        break;

      if (debugScheduleRule)
        Interface.Log("<<DEBUG>> Start of scheduleComplete WHILE loop.");
      PostMessage(me, "TrainTimetable", "Tick", 1.0f);

      wait()
      {
        on "TrainTimetable", "Tick", msg:
        {
          float diff = 0.0f;
          float arriveDiff = 0.0f;
          // Is the time past midday?
          diff = World.GetGameTime() - schedule[currentScheduleItem].departureTime;
          arriveDiff = World.GetGameTime() - schedule[currentScheduleItem].arrivalTime;

            // if it's half a day or more in front of the current time, then assume it's actually from the previous 'day'.
          if (diff >= 0.5f)
            diff = diff - 1.0f;
            //
          if (arriveDiff >= 0.5f)
            arriveDiff = arriveDiff - 1.0f;

          if (arriveDiff >= 0.0f)
          {
            // The arrival time has passed...
            // If they are not at the destination, and the time has passed, and the late message hasn't been sent, then send one.
            if (!schedule[currentScheduleItem].arrivedAtDestination and !schedule[currentScheduleItem].msgLateSent)
            {
              // Send message to train to allow other scripts to detect lateness
              schedule[currentScheduleItem].msgLateSent = true;
              PostMessage(train, "TrainTimetable", "Late", 0.0f);
              PostMessage(train, "TrainTimetable", "Touch", 0.1f);
              if (debugScheduleRule)
                Interface.Log("<<DEBUG>> Late");
            }

            if (schedule[currentScheduleItem].arrivedAtDestination)
            {
              if (schedule[currentScheduleItem].msgLateSent)
              {
                if (!schedule[currentScheduleItem].arrivedLate)
                {
                  schedule[currentScheduleItem].arrivedLate = true;
                  PostMessage(train, "TrainTimetable", "Late-Arrival", 0.0f);
                  PostMessage(train, "TrainTimetable", "Touch", 0.1f);
                  if (debugScheduleRule)
                    Interface.Log("<<DEBUG>> Train arrived, but was late");
                }
              }

              if (schedule[currentScheduleItem].arrivedAtDestination)
              {
                if (!IsAtCurrentDestination())
                {
                  // Is it in the scenery, and the depart time has passed??
                  if (diff >= 0.0f)
                  {
                    // They waited till proper depart time...
                    if (!schedule[currentScheduleItem].departOnTime and !schedule[currentScheduleItem].departEarly)
                    {
                      schedule[currentScheduleItem].departOnTime = true;
                      PostMessage(train, "TrainTimetable", "Ontime-Departure", 0.0f);
                      PostMessage(train, "TrainTimetable", "Touch", 0.1f);
                      if (debugScheduleRule)
                        Interface.Log("<<DEBUG>> Train is in scenery and stayed there till Departure time");
                    }

                    inScenery = 0;
                    // Tell schedule that the departure time has now expired.
                    if (debugScheduleRule)
                      Interface.Log("<<DEBUG>> Informing script that Departure Time has expired, and that it can continue with next schedule item");
                    PostMessage(me, "Schedule", "DepartureTimeExpire", 0.0f);
                    continue;
                  }
                  else
                  {
                    // They departed early
                    if (!schedule[currentScheduleItem].departEarly)
                    {
                      schedule[currentScheduleItem].departEarly = true;
                      PostMessage(train, "TrainTimetable", "Early-Departure", 0.0f);
                      PostMessage(train, "TrainTimetable", "Touch", 0.1f);
                      if (debugScheduleRule)
                        Interface.Log("<<DEBUG>> Train already left scenery, without waiting for departure time");
                    }
                  }
                }
                else
                {
                  if (diff >= 0.0f)
                  {
                    inScenery = 0;
                    PostMessage(me, "Schedule", "DepartureTimeExpire", 0.0f);
                    continue;
                  }
                }
              }
            }
          }

          if (debugScheduleRule)
            Interface.Log("<<DEBUG>> Departure time has not yet passed, setting check for 1 second later");
          PostMessage(me, "TrainTimetable", "Tick", 1.0f);
          continue;
        }

        on "Schedule", "DepartureTimeExpire", msg:
        {
          //Interface.Log("<<DEBUG>> Departure time has passed, incrementing schedule item to " + (string)currentScheduleItem + 1);
          // We are in the correct scenery object.
          //Interface.Print("Train has arrived at scheduled location: " + schedule[currentScheduleItem].destinationName);
          if (debugScheduleRule)
            Interface.Log("<<DEBUG>> currentScheduleItem = " + (string)currentScheduleItem);
          currentScheduleItem = currentScheduleItem + 1;
          if (debugScheduleRule)
            Interface.Log("<<DEBUG>> currentScheduleItem After inc = " + (string)currentScheduleItem);
          if (currentScheduleItem >= schedule.size())
          {
            if (debugScheduleRule)
              Interface.Log("<<DEBUG>> No more schedule items, Terminating Schedule");
            //Interface.Print("Entire Schedule is complete.");
            currentScheduleItem = 0;
            scheduleComplete = true;
            PostMessage(train, "TrainTimetable", "Touch", 0.1f);

          }
          break;
        }
        on "SceneryTrigger", "Enter", msg:
        {
          // wrong industry?
          if (msg.src == industry)
          {
            if (debugScheduleRule)
              Interface.Log("<<DEBUG>> Train entered the correct scenery for the current schedule item");
            inScenery = inScenery + 1;
            schedule[currentScheduleItem].arrivedAtDestination = true;

            // Did they arrive early?
            float arriveDiff = 0.0f;
            arriveDiff = World.GetGameTime() - schedule[currentScheduleItem].arrivalTime;
            if (arriveDiff >= 0.5f)
              arriveDiff = arriveDiff - 1.0f;
            if (arriveDiff < 0.0f)
            {
              // Yup.
              schedule[currentScheduleItem].arriveEarly = true;
              if (!schedule[currentScheduleItem].msgEarlySent)
                PostMessage(train, "TrainTimetable", "Early-Arrival", 0.0f);
              schedule[currentScheduleItem].msgEarlySent = true;
            }

            PostMessage(train, "TrainTimetable", "Touch", 0.1f);
            //break;
          }
          else
            if (debugScheduleRule)
              Interface.Log("<<DEBUG>> Train entered the wrong scenery for the current schedule item");
          continue;
        }

        on "SceneryTrigger", "Leave", msg:
        {
          if (msg.src == industry)
          {
            inScenery = inScenery - 1;
            if (inScenery < 0)
              inScenery = 0;
            if (debugScheduleRule)
              Interface.Log("<<DEBUG>> Train is no longer in the correct scenery for the current schedule item");
            PostMessage(train, "TrainTimetable", "Touch", 0.1f);
          }
          continue;
        }

        on "TrackMark", "Enter", msg:
        {
          if (msg.src == industry)
          {
            inScenery = inScenery + 1;
            schedule[currentScheduleItem].arrivedAtDestination = true;

            // Did they arrive early?
            float arriveDiff = 0.0f;
            arriveDiff = World.GetGameTime() - schedule[currentScheduleItem].arrivalTime;
            if (arriveDiff >= 0.5f)
              arriveDiff = arriveDiff - 1.0f;
            if (arriveDiff < 0.0f)
            {
              // Yup.
              schedule[currentScheduleItem].arriveEarly = true;
              if (!schedule[currentScheduleItem].msgEarlySent)
                PostMessage(train, "TrainTimetable", "Early-Arrival", 0.0f);
              schedule[currentScheduleItem].msgEarlySent = true;
            }

            PostMessage(train, "TrainTimetable", "Touch", 0.1f);
          }
          continue;
        }

        on "TrackMark", "Leave", msg:
        {
          if (msg.src == industry)
          {
            inScenery = inScenery - 1;
            if (inScenery < 0)
              inScenery = 0;
            PostMessage(train, "TrainTimetable", "Touch", 0.1f);
          }
          continue;
        }

        on "Train", "Cleanup":
        {
          // the train is being deleted- shut down now.
          break;
        }

        /*
        // Removed this code and moved arrivedAtDestination = true; above to trigger enter, so that they can just drive thru the object
        on "Train", "StoppedMoving", msg:
        {
          if (inScenery)
          {
            Interface.Log("<<DEBUG>> Train stopped moving and is in correct scenery");
            arrivedAtDestination = true;
          }
          else
            Interface.Log("<<DEBUG>> Train stopped moving and is not in the correct scenery");
          continue;
        }
      */
      }

      PostMessage(train, "TrainTimetable", "Touch", 0.0f);
    }

    Sniff(vehicle, "SceneryTrigger", null, false);
    Sniff(train, "Train", "StoppedMoving", false);
    Sniff(train, "TrackMark", null, false);
    Sniff(train, "Train", "Cleanup", false);

    train.ClearTrainTimetable(me);
    //Interface.Log("<<DEBUG>> Touch: Informing scripts to update their display as something may have changed");
    //PostMessage(train, "TrainTimetable", "Touch", 0.0f);
    isRunning = 0;
  }

  public TrainTimetableItem GetCurrentTimetableItem(void)
  {
    if (!schedule)
      return null;

    if (currentScheduleItem >= schedule.size())
      return null;

    if (scheduleComplete)
      return null;

    return schedule[currentScheduleItem];
  }

  public bool GetArrivedAtDestination(void)
  {
    return schedule[currentScheduleItem].arrivedAtDestination;
  }

  public bool GetIsLate(void)
  {
    return schedule[currentScheduleItem].msgLateSent;
  }

  public bool GetIsAtDestination(void)
  {
    return inScenery > 0;
  }

  public TrainTimetableItem[] GetCurrentTimetable(int hintMaxDesired)
  {
    return schedule;
  }

};

ScheduleRule_TrainTimetable.gs:

include "ScheduleRule.gs"
include "TrainTimetable.gs"
include "Train.gs"

//
// Our TrainTimetable derived class.
// Allows the Train to query our timetabling information.
//
class ScheduleRule_TrainTimetable isclass TrainTimetable
{
  public ScheduleRule scheduleRule;
  public Train train;

  public ScenarioBehavior GetTimetableRule(void)
  {
    return cast<ScenarioBehavior> scheduleRule;
  }

  public Train GetTrain(void)
  {
    return train;
  }

  public TrainTimetableItem GetCurrentTimetableItem(void)
  {
    return scheduleRule.GetCurrentTimetableItem();
  }

  public bool GetArrivedAtDestination(void)
  {
    return scheduleRule.GetArrivedAtDestination();
  }

  public bool GetIsLate(void)
  {
    return scheduleRule.GetIsLate();
  }

  public bool GetIsAtDestination(void)
  {
    return scheduleRule.GetIsAtDestination();
  }

  public TrainTimetableItem[] GetCurrentTimetable(int hintMaxDesired)
  {
    return scheduleRule.GetCurrentTimetable(hintMaxDesired);
  }

};


Set Camera
[Rules]

Set Camera Rule

config.txt:

﻿
username            "Set Camera"
kind              "behavior"
kuid              <kuid:-18:1253>
script              "SetCameraRule"
class             "SetCameraRule"
icon-texture            "set_camera.texture"
string-table {
  description         "Sets the target object and properties of the camera."
  description_info        "Sets the target object and properties of the camera."
  set-camera-display-name       "Perform the following operations on the in-game camera:<br>"
  set-camera-html-prefix        "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=3></td><td><font color=#000000>"
  set-camera-html-sufix       "</font></td></tr></table>"
  set-camera-html-between-items     "<br>"
  set-camera-item-cameratarget      "null"
  set-camera-item-cameramode      "null"
  set-camera-item-cameraflags     "null"
  camera-view-html-property     "Change the camera view mode to: $0"
  camera-view-blank-string      "<i>click to select</i>"
  camera-view-html-prefix       "<font color=#000000>"
  camera-view-html-sufix        "</font>"
  camera-view-name-itemname     "Camera Mode"
  camera-view-desc-itemname     "View mode to change camera to"
  camera-view-item0       "camera-view-item-internal"
  camera-view-item1       "camera-view-item-external"
  camera-view-item2       "camera-view-item-tracking"
  camera-view-item3       "camera-view-item-roaming"
  camera-view-item-internal     "Cab View"
  camera-view-item-external     "External View"
  camera-view-item-tracking     "Tracking View"
  camera-view-item-roaming      "Free Roaming"
  camera-target-display-name      "Set the target object of the camera to:"
  camera-target-html-prefix     "<font color=#000000>"
  camera-target-html-sufix      "</font>"
  camera-target-html-between-items    " "
  camera-target-item-vehicle      "null"
  camera-target-item-junction     "null"
  target-vehicle-object-html-property   "<font color=#000000>Vehicle: $0</font>"
  target-vehicle-object-type      "traincar"
  target-vehicle-blank-string     "<i>click to select</i>"
  target-vehicle-html-prefix      "<font color=#000000>"
  target-vehicle-html-sufix     "</font>"
  target-vehicle-name-gameobjectname    "Vehicle"
  target-vehicle-desc-gameobjectname    "Vehicle camera is to focus on"
  target-junction-object-html-property    "<font color=#000000>Junction: $0</font>"
  target-junction-object-type     "junction"
  target-junction-blank-string      "<i>click to select</i>"
  target-junction-html-prefix     "<font color=#000000>"
  target-junction-html-sufix      "</font>"
  target-junction-name-gameobjectname   "Junction"
  target-junction-desc-gameobjectname   "Junction camera is to focus on"
  camera-flags-display-name     "Set the camera flags to enable/disable user access to:"
  camera-flags-html-prefix      "<font color=#000000>"
  camera-flags-html-sufix       "</font>"
  camera-flags-item0        "internal"
  camera-flags-item1        "external"
  camera-flags-item2        "tracking"
  camera-flags-item3        "roaming"
  camera-flags-item4        "switchview"
  camera-flags-item5        "switchvehicle"
  camera-flags-item6        "switchtrain"
  camera-flags-item7        "adjust"
  camera-flags-item-internal      "Internal view mode"
  camera-flags-item-external      "External view mode"
  camera-flags-item-tracking      "Tracking view mode"
  camera-flags-item-roaming     "Roaming view mode"
  camera-flags-item-switchview      "View switching"
  camera-flags-item-switchvehicle     "Vehicle view switching"
  camera-flags-item-switchtrain     "Train view switching"
  camera-flags-item-adjust      "Camera adjustments (zoom, pan etc.)"
}
kuid-table {
  driver_module         <kuid:-16:10240>
}
username-fr           "Placement de la caméra"
string-table-fr {
  description         "Définit l'objet cible et les propriétés de la caméra."
  description_info        "Définit l'objet cible et les propriétés de la caméra."

  set-camera-display-name       "Réalise les opérations suivantes sur la caméra intégrée :<br>"

  camera-view-html-property     "Passer à la vision : $0"
  camera-view-blank-string      "<i>Cliquez pour sélectionner</i>"
  camera-view-name-itemname     "Mode caméra"
  camera-view-desc-itemname     "Voir le mode de caméra à adopter"
  camera-view-item-internal     "Vue cabine"
  camera-view-item-external     "Vue extérieure"
  camera-view-item-tracking     "Vue poursuite"
  camera-view-item-roaming      "Caméra libre"

  camera-target-display-name      "Définir l'objet cible de la caméra sur :"

  target-vehicle-object-html-property   "<font color=#000000>Vehicle: $0</font>"
  target-vehicle-blank-string     "<i>Cliquez pour sélectioner</i>"
  target-vehicle-name-gameobjectname    "Véhicule"
  target-vehicle-desc-gameobjectname    "Focaliser la caméra du véhicule sur"

  target-junction-object-html-property    "<font color=#000000>Aiguillage : $0</font>"
  target-junction-blank-string      "<i>Cliquez pour sélectioner</i>"
  target-junction-name-gameobjectname   "Aiguillage"
  target-junction-desc-gameobjectname   "Focaliser la caméra de l'aiguillage sur"

  camera-flags-display-name     "Définir les marqueurs de la caméra pour activer/désactiver l'accès utilisateur à :"
  camera-flags-item-internal      "Mode vue intérieure"
  camera-flags-item-external      "Mode vue extérieure"
  camera-flags-item-tracking      "Mode vue poursuite"
  camera-flags-item-roaming     "Mode vue libre"
  camera-flags-item-switchview      "Changement vue"
  camera-flags-item-switchvehicle     "Changement vue véhicule"
  camera-flags-item-switchtrain     "Changement vue train"
  camera-flags-item-adjust      "Réglages caméra (zoom, panoramique, etc.)"
}

SetCameraRule.gs:

//
// SetCameraRule.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"
include "World.gs"

//
// Rule that sets various properties of the game camera.
//
class SetCameraRule isclass ScenarioBehavior
{
  // HTML property handler stuff
  CheckListGroupHandler        m_checkListGroupHandler;
  EnumeratedPropertyHandler    m_cameraModeHandler;
  RadioButtonGroupHandler      m_cameraTargetHandler;
  EnumeratedGameObjectHandler  m_targetVehicleHandler;
  EnumeratedGameObjectHandler  m_targetJunctionHandler;
  CheckListPropertyHandler     m_cameraFlagsHandler;

  thread void SetCameraProperties(void);

  //
  // Initialize parent object and data ymembers
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property info handler stuff

    // camera mode selection
    m_cameraModeHandler = new EnumeratedPropertyHandler();
//    m_cameraModeHandler.Init(me.GetAsset(), "camera-view");
    m_cameraModeHandler.Init(me.GetAsset(), "camera-view", 4);

    // target object selection (both vehicle and junction)
    m_targetVehicleHandler = new EnumeratedGameObjectHandler();
    m_targetVehicleHandler.Init(me.GetAsset(), "target-vehicle");

    m_targetJunctionHandler = new EnumeratedGameObjectHandler();
    m_targetJunctionHandler.Init(me.GetAsset(), "target-junction");

    m_cameraTargetHandler = new RadioButtonGroupHandler();
    m_cameraTargetHandler.Init(me.GetAsset(), "camera-target");
    m_cameraTargetHandler.AddHandler(m_targetVehicleHandler, "vehicle");
    m_cameraTargetHandler.AddHandler(m_targetJunctionHandler, "junction");

    // properties flags
    m_cameraFlagsHandler = new CheckListPropertyHandler();
    m_cameraFlagsHandler.Init(me.GetAsset(), "camera-flags");
    m_cameraFlagsHandler.SetAll(true); // all items are checked (enabled) by default

    m_checkListGroupHandler = new CheckListGroupHandler();
    m_checkListGroupHandler.Init(me.GetAsset(), "set-camera");
    m_checkListGroupHandler.AddHandler(m_cameraTargetHandler, "cameraTarget");
    m_checkListGroupHandler.AddHandler(m_cameraModeHandler, "cameraMode");
    m_checkListGroupHandler.AddHandler(m_cameraFlagsHandler, "cameraFlags");

    SetPropertyHandler(m_checkListGroupHandler);
  }

  //
  // When unpaused. set the options as needed (in driver only?)
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
        SetCameraProperties();
  }

  thread void SetCameraProperties(void)
  {
    // target vehicle/junction
    if (m_checkListGroupHandler.GetSetting(0))
    {
      // find out what the target object is
      MapObject targetObject = null;
      if (m_targetVehicleHandler == m_cameraTargetHandler.GetSelectedSubHandler())
        targetObject = cast<MapObject> m_targetVehicleHandler.GetGameObject();
      else if (m_targetJunctionHandler == m_cameraTargetHandler.GetSelectedSubHandler())
        targetObject = cast<MapObject> m_targetJunctionHandler.GetGameObject();
      else
        Interface.Log("# SetCameraRule.SetCameraProperties> ERROR: invalid target object handler!");

      // once target object is found, set the camera to it
      if (targetObject)
      {
        if (World.UserSetCamera(targetObject))
        {
          Interface.Log("# SetCameraRule.SetCameraProperties> INFO: Setting camera to object '" + targetObject.GetLocalisedName() + "'!");

          // wait for the camera change to take affect before proceding...
          Message msg;
          wait()
          {
            on "Camera", "Target-Changed", msg:
            {
              if (cast<MapObject>msg.src == targetObject)
                break;
            }
          }
        }
        else
          Interface.Log("# SetCameraRule.SetCameraProperties> ERROR: Unable to focus camera on game object '" + targetObject.GetLocalisedName() + "'!");
      }
      else
        Interface.Log("# SetCameraRule.SetCameraProperties> ERROR: Invalid target object selected!");
    }

    // camera view mode
    if (m_checkListGroupHandler.GetSetting(1))
    {
      int cameraMode = -1;

      if (m_cameraModeHandler.GetItemIndex() == 0)       cameraMode = World.CAMERA_INTERNAL;
      else if (m_cameraModeHandler.GetItemIndex() == 1)  cameraMode = World.CAMERA_EXTERNAL;
      else if (m_cameraModeHandler.GetItemIndex() == 2)  cameraMode = World.CAMERA_TRACKING;
      else if (m_cameraModeHandler.GetItemIndex() == 3)  cameraMode = World.CAMERA_ROAMING;

      if (cameraMode >= 0)
      {
        Interface.Log("# SetCameraRule.SetCameraProperties> INFO: Setting camera mode to: '" + m_cameraModeHandler.GetItemFull() + "'");
        World.SetCameraMode(cameraMode);
      }
      else
        Interface.Log("# SetCameraRule.SetCameraProperties> ERROR: Invalid camera mode selected!");
    }

    // camera flag settings
    if (m_checkListGroupHandler.GetSetting(2))
    {
      int cameraFlags = 0;

      if (m_cameraFlagsHandler.GetSetting(0))  cameraFlags = cameraFlags | World.CAMERA_INTERNAL;
      if (m_cameraFlagsHandler.GetSetting(1))  cameraFlags = cameraFlags | World.CAMERA_EXTERNAL;
      if (m_cameraFlagsHandler.GetSetting(2))  cameraFlags = cameraFlags | World.CAMERA_TRACKING;
      if (m_cameraFlagsHandler.GetSetting(3))  cameraFlags = cameraFlags | World.CAMERA_ROAMING;
      if (m_cameraFlagsHandler.GetSetting(4))  cameraFlags = cameraFlags | World.CAMERA_SWITCH_VIEWS;
      if (m_cameraFlagsHandler.GetSetting(5))  cameraFlags = cameraFlags | World.CAMERA_SWITCH_VEHICLES;
      if (m_cameraFlagsHandler.GetSetting(6))  cameraFlags = cameraFlags | World.CAMERA_SWITCH_TRAINS;
      if (m_cameraFlagsHandler.GetSetting(7))  cameraFlags = cameraFlags | World.CAMERA_LOCKED;

      if (cameraFlags)
      {
        Interface.Log("# SetCameraRule.SetCameraProperties> INFO: Setting camera flags!");
        World.SetCameraFlags(cameraFlags);
      }
    }

    SetComplete(true);
  }

};


Set Coupler Masks
[Rules]

Set Coupler Masks Rule

config.txt:

﻿
username            "Set Coupler Masks"
kind              "behavior"
kuid              <kuid:-18:1255>
script              "SetCouplerMasksRule"
class             "SetCouplerMasksRule"
icon-texture            "set_coupler_masks.texture"
string-table {
  description         "Set the coupler masks on the selected vehicles."
  description_html        "Set the coupler masks on the selected vehicles."
  coupler-mask-display-name     "Set the coupling and decoupling masks for the following vehicles:<br>"
  coupler-mask-html-prefix      "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=4></td><td><font color=#000000>"
  coupler-mask-html-sufix       "</font></td></tr></table>"
  coupler-mask-html-table-row-odd     "bgcolor=#CCCCAA22"
  coupler-mask-html-table-row-even    "bgcolor=#CCCCAA44"
  coupler-mask-column0        "<font color=#000000><i>Vehicle</i>&nbsp;&nbsp;</font>"
  coupler-mask-column1        "<font color=#000000><i>Coupling Mask</i>&nbsp;&nbsp;</font>"
  coupler-mask-column2        "<font color=#000000><i>Decoupling Mask</i>&nbsp;&nbsp;</font>"
  coupler-mask-delete       "<font color=#000000>Remove</font>"
  coupler-mask-add        "Add Vehicle"
  coupler-mask-name-add       "Vehicles"
  coupler-mask-desc-add       "Select a vehicle from the list"
  coupler-mask-delete-all       "Delete All"
  coupler-mask-delete-all-tooltip     "Delete all vehicles in the list"
  coupler-mask-add-all        "Add All"
  coupler-mask-add-all-tooltip      "Add all vehicles to list"
  vehicle-item-html-prefix      "<td bgcolor=#00000011>"
  vehicle-item-html-sufix       "</td>"
  coupling-front-html-property-true   "Front: $0Locked$1"
  coupling-front-html-property-false    "Front: $0Unlocked$1"
  coupling-front-html-bool-tooltip    "Enable/disable front coupling"
  coupling-front-html-prefix      "<font color=#000000>"
  coupling-front-html-sufix     "</font>&nbsp;&nbsp;<br>"
  coupling-back-html-property-true    "Back: $0Locked$1"
  coupling-back-html-property-false   "Back: $0Unlocked$1"
  coupling-back-html-bool-tooltip     "Enable/disable back coupling"
  coupling-back-html-prefix     "<font color=#000000>"
  coupling-back-html-sufix      "</font>&nbsp;&nbsp;"
  decoupling-front-html-property-true   "Front: $0Locked$1"
  decoupling-front-html-property-false    "Front: $0Unlocked$1"
  decoupling-front-html-bool-tooltip    "Enable/disable front decoupling"
  decoupling-front-html-prefix      "<font color=#000000>"
  decoupling-front-html-sufix     "</font>&nbsp;&nbsp;<br>"
  decoupling-back-html-property-true    "Back: $0Locked$1"
  decoupling-back-html-property-false   "Back: $0Unlocked$1"
  decoupling-back-html-bool-tooltip   "Enable/disable back coupling"
  decoupling-back-html-prefix     "<font color=#000000>"
  decoupling-back-html-sufix      "</font>&nbsp;&nbsp;"
}
username-fr           "Définition des masques d'attelage"
string-table-fr {
  description         "Définit les masques d'attelage pour les véhicules sélectionnés."
  description_html        "Définit les masques d'attelage pour les véhicules sélectionnés."

  coupler-mask-display-name     "Définit les masques d'attelage et de dételage pour les véhicules suivants :<br>"

  coupler-mask-column0        "<font color=#000000><i>Véhicule</i>&nbsp;&nbsp;</font>"
  coupler-mask-column1        "<font color=#000000><i>Masque d'attelage</i>&nbsp;&nbsp;</font>"
  coupler-mask-column2        "<font color=#000000><i>Masque de dételage</i>&nbsp;&nbsp;</font>"

  coupler-mask-delete       "<font color=#000000>Retirer</font>"
  coupler-mask-add        "Ajouter véhicule"
  coupler-mask-name-add       "Véhicules"
  coupler-mask-desc-add       "Sélectionner un véhicule dans la liste"
  coupler-mask-delete-all       "Tout effacer"
  coupler-mask-delete-all-tooltip     "Supprimer tous les véhicules de la liste"
  coupler-mask-add-all        "Tout ajouter"
  coupler-mask-add-all-tooltip      "Ajouter tous les véhicules à la liste"

  coupling-front-html-property-true   "Avant : $0verrouillé$1"
  coupling-front-html-property-false    "Avant : $0déverrouillé$1"
  coupling-front-html-bool-tooltip    "Enable/disable front coupling"

  coupling-back-html-property-true    "Arrière : $0verrouillé$1"
  coupling-back-html-property-false   "Arrière : $0déverrouillé$1"
  coupling-back-html-bool-tooltip     "Active/Désactive attelage arrière"

  decoupling-front-html-property-true   "Avant : $0verrouillé$1"
  decoupling-front-html-property-false    "Avant : $0déverrouillé$1"
  decoupling-front-html-bool-tooltip    "Active/Désactive dételage avant"

  decoupling-back-html-property-true    "Arrière : $0verrouillé$1"
  decoupling-back-html-property-false   "Arrière : $0déverrouillé$1"
  decoupling-back-html-bool-tooltip   "Active/Désactive attelage arrière"
}

SetCouplerMasksRule.gs:

//
// SetCouplerMasksRule.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"
include "common.gs"

//
// A junction item for use in a list handler.
//
class VehicleListItem isclass ConfigAssetGroupHandler
{
  string m_vehicleName = "";

  // mask mode handlers for the vehicle
  GenericBoolHandler m_couplingFrontHandler, m_couplingBackHandler;
  GenericBoolHandler m_decouplingFrontHandler, m_decouplingBackHandler;

  // Vehicle coupler mask setting method
  public bool SetMyCouplerMasks(void);

  //
  // Initialization method that creates the enumerated sub-handler for mananging the junction's
  // state setting.
  //
  public void Init(Asset asset, string newConfigPrefix)
  {
    inherited(asset, newConfigPrefix);

    // add sub-handler for coupler mask
    m_couplingFrontHandler = new GenericBoolHandler();
    m_couplingFrontHandler.Init(asset, "coupling-front");

    m_couplingBackHandler = new GenericBoolHandler();
    m_couplingBackHandler.Init(asset, "coupling-back");

    m_decouplingFrontHandler = new GenericBoolHandler();
    m_decouplingFrontHandler.Init(asset, "decoupling-front");

    m_decouplingBackHandler = new GenericBoolHandler();
    m_decouplingBackHandler.Init(asset, "decoupling-back");

    me.AddHandler(m_couplingFrontHandler, "couplingFront/");
    me.AddHandler(m_couplingBackHandler, "couplingBack/");
    me.AddHandler(m_decouplingFrontHandler, "decouplingFront/");
    me.AddHandler(m_decouplingBackHandler, "decouplingBack/");
  }

  //
  // ??
  //
  public bool SetMyCouplerMasks(void)
  {
    Vehicle vehicle = cast<Vehicle> Router.GetGameObject(m_vehicleName);

    if (!vehicle)
    {
      Interface.Log("# VehicleListItem.SetMyCouplerMask> ERROR: Uanble to find vehicle: '" + m_vehicleName + "'");
      return false;
    }

//    string coupF, coupB, decoupF, decoupB;
//    coupF = coupB = decoupF = decoupB = "L";

    // set the coupling mask
    int couplingMask = vehicle.COUPLE_NONE;
    if (!m_couplingFrontHandler.GetBoolValue())
    {
//      coupF = "U";
      couplingMask = couplingMask | vehicle.COUPLE_FRONT;
    }
    if (!m_couplingBackHandler.GetBoolValue())
    {
//      coupB = "U";
      couplingMask = couplingMask | vehicle.COUPLE_BACK;
    }
    vehicle.SetCouplingMask(couplingMask);

    // set the decoupling mask
    int decouplingMask = vehicle.COUPLE_NONE;
    if (!m_decouplingFrontHandler.GetBoolValue())
    {
//      decoupF = "U";
      decouplingMask = decouplingMask | vehicle.COUPLE_FRONT;
    }
    if (!m_decouplingBackHandler.GetBoolValue())
    {
//      decoupB = "U";
      decouplingMask = decouplingMask | vehicle.COUPLE_BACK;
    }
    vehicle.SetDecouplingMask(decouplingMask);

    // Coup[front:L,back:U] Decoup[front:U,back:L]
//    string maskOutputStr = "Coup[front:" + coupF + ",back:" + coupB + "] Decoup[front:" + decoupF + ",back:" + decoupB + "]";
//    Interface.Log("   -> Set coupler masks of vehicle '" + vehicle.GetLocalisedName() + "' to " + maskOutputStr);

    return true;
  }

  //
  // Property methods
  //

  //
  // Gets HTML table cells that describe the vehicle and it's coupler mask settings.
  //
  public string GetDescriptionHTML(void)
  {
//    string htmlPage = "<td bgcolor=#00000011><font color=#000000>" +
//                      "<img kuid=" + m_driverKUID.GetHTMLString() + "> " + m_vehicleName +
    string htmlPage = "<font color=#000000>" + m_vehicleName + "&nbsp;&nbsp;</font></td>" +

                      "<td bgcolor=#00000011><font color=#000000>" +
                        m_couplingFrontHandler.GetDescriptionHTML() + m_couplingBackHandler.GetDescriptionHTML() +
                      "</font></td>" +

                      "<td bgcolor=#00000011><font color=#000000>" +
                        m_decouplingFrontHandler.GetDescriptionHTML() + m_decouplingBackHandler.GetDescriptionHTML() +
                      "</font>";

    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  //
  // Allows the junction name to be set through this interface method.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    if (PropStripPrefix(propertyID, "") == "vehicleName")
      m_vehicleName = value.AsString();

    else
      inherited(propertyID, value);
  }

  //
  // Allows the junction name to be obtained through this interface method.
  //
  public string GetPropertyValue(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "vehicleName")
      return m_vehicleName;

    return inherited(propertyID);
  }

  //
  // Return properties of this object in a soup.
  //
  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("VehicleListItem.vehicleName", m_vehicleName);

    // sub-soups for the coupler mask settings
    soup.SetNamedSoup("VehicleListItem.couplingFront", m_couplingFrontHandler.GetProperties());
    soup.SetNamedSoup("VehicleListItem.couplingBack", m_couplingBackHandler.GetProperties());
    soup.SetNamedSoup("VehicleListItem.decouplingFront", m_decouplingFrontHandler.GetProperties());
    soup.SetNamedSoup("VehicleListItem.decouplingBack", m_decouplingBackHandler.GetProperties());

    return soup;
  }

  //
  // Initialize this object from the given properties soup.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    m_vehicleName = soup.GetNamedTag("VehicleListItem.vehicleName");

    // restore sub handlers for coupler mask settings
    m_couplingFrontHandler.SetProperties(soup.GetNamedSoup("VehicleListItem.couplingFront"));
    m_couplingBackHandler.SetProperties(soup.GetNamedSoup("VehicleListItem.couplingBack"));
    m_decouplingFrontHandler.SetProperties(soup.GetNamedSoup("VehicleListItem.decouplingFront"));
    m_decouplingBackHandler.SetProperties(soup.GetNamedSoup("VehicleListItem.decouplingBack"));
  }

};

//
// Extends the generic list handler to be a list of junctions.
//
class VehicleListHandler isclass GenericListHandler
{
  //
  // Method definitions
  //

  // workaround...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  public bool VehicleAlreadyInList(string vehicleName);
  public void SetCouplerMasks(void);

  //
  // Method implementations
  //

  public void SetCouplerMasks(void)
  {
    int i;
    for (i = 0; i < handlers.size(); i++)
    {
      VehicleListItem tempItem = cast<VehicleListItem> handlers[i];
      if (tempItem)
        tempItem.SetMyCouplerMasks();
    }
  }

  //
  // Adds a new item to the list.  Method well create appropriate sub-handler for it.
  //
  public void AddItem(string itemDisplayName)
  {
    VehicleListItem newItem = new VehicleListItem();
    newItem.Init(m_hostAsset, "vehicle-item");

    // handler prefix is vehicle name with spaces substituted with '-'
    string itemPrefix = TrainUtil.StrSubst(itemDisplayName, " ", "-");
    itemPrefix = itemPrefix + "/";

    me.AddHandler(newItem, itemPrefix);

    // set the vehicleName property
    PropertyValue xvalue = new PropertyValue();
    xvalue.Set(itemDisplayName);
    newItem.SetPropertyValue(newItem.Prop("vehicleName"), xvalue);
  }

  public bool VehicleAlreadyInList(string vehicleName)
  {
    int i;
    for (i = 0; i < handlers.size(); i++)
      if (vehicleName == handlers[i].GetPropertyValue(handlers[i].Prop("vehicleName")))
        return true;

    return false;
  }

  //
  // Gets list of elements to choose from for the named property
  //
  public string[] GetPropertyElementList(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "add")
    {
      string[] retStrList = new string[0];
      Vehicle[] vehicles = World.GetVehicleList();
      int i, p = 0;
      for (i = 0; i < vehicles.size(); i++)
        if (!VehicleAlreadyInList(vehicles[i].GetLocalisedName()))
          retStrList[p++] = vehicles[i].GetLocalisedName();

      return retStrList;
    }

    return inherited(propertyID);
  }

  void ConstructHandlers(Soup listItemsSoup)
  {
    int i;
    for (i = 0; i < listItemsSoup.CountTags(); i++)
    {
      VehicleListItem newItem = new VehicleListItem();
      newItem.Init(m_hostAsset, "vehicle-item");

      string prefixTag = listItemsSoup.GetIndexedTagName(i);

      Soup itemSoup = listItemsSoup.GetNamedSoup(prefixTag);
      newItem.SetProperties(itemSoup);

      AddHandler(newItem, prefixTag);
    }
  }

};

//
// ??
//
class SetCouplerMasksRule isclass ScenarioBehavior
{
  // HTML property handler stuff
  VehicleListHandler  m_vehicleListHandler;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property handler stuff
    m_vehicleListHandler = new VehicleListHandler();
    m_vehicleListHandler.Init(me.GetAsset(), "coupler-mask");

    SetPropertyHandler(m_vehicleListHandler);
  }

  //
  // When unpaused, set the coupler masks on the vehicles as the handler's configuration defines
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        Interface.Log("# SetCouplerMasksRule.Pause> INFO: Unpaused and in Driver, setting coupling masks...");
        m_vehicleListHandler.SetCouplerMasks();
        SetComplete(true);
      }
    }
  }

};


Set Helper Icon Size
[Rules]

Set Helper Icon Size Rule

config.txt:

﻿
username            "Set Helper Icon Size"
kind              "behavior"
kuid              <kuid:-18:1264>
script              "SetHelperIconSizeRule"
class             "SetHelperIconSizeRule"
icon-texture            "set_helper_icon_size.texture"
string-table {
  description         "Sets the size of helper icons such as the junction lever arrows."
  description_info        "Sets the size of helper icons such as the junction lever arrows."
  group-handler-html-prefix     "<table cellspacing=0 cellpadding=0><tr><td width=3></td><td><font color=#000000>"
  group-handler-html-sufix      "</font></td></tr></table><br><br><br>"
  size-ratio/html-pre       "Scale juntion lever arrows to be "
  size-ratio/html-post        " % smaller than default."
  size-ratio/name         "Scale Ratio"
  size-ratio/description        "Percentage to reduce default icon size by"
}
kuid-table {
  displayhtmlpageslib       <kuid:-18:1245>
}
username-fr           "Définition de la taille de l'icône de l'assistant"
string-table-fr {
  description         "Définit la taille des icônes d'assistance comme les flèches de levier d'aiguillage."
  description_info        "Définit la taille des icônes d'assistance comme les flèches de levier d'aiguillage."

  size-ratio/html-pre       "Redimensionner les flèches de levier d'aiguillage pour qu'elles soient "
  size-ratio/html-post        "% inférieures à la taille par défaut."
  size-ratio/name         "Coefficient de redimensionnement"
  size-ratio/description        "Pourcentage de réduction de la taille par défaut"
}

SetHelperIconSizeRule.gs:

//
// SetHelperIconSizeRule.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "ListItemPropertyHandler.gs"
include "HTMLPropertyHandler.gs"
include "World.gs"
include "interface.gs"

//
// The generic number handler stolen from the Vehicle Physics rule
//
class NumberValueHandler isclass HTMLPropertyHandler
{
  StringTable  stringTable;
  public float numberValue;
  public float minValue, maxValue, stepValue;

  public void Init(Asset asset, float min, float max, float step, float defaultValue)
  {
    stringTable = asset.GetStringTable();
    minValue = min;
    maxValue = max;
    stepValue = step;
    numberValue = defaultValue;
  }

  public string GetDescriptionHTML(void)
  {
    string numberString = numberValue;
    Str.TrimRight(numberString, "0");
    if (numberString == "")
      numberString = "0";
    else if (numberString[numberString.size() - 1] == '.')
      numberString[numberString.size()-1, ] = null;

    return
      stringTable.GetString( GetPrefix() + "html-pre" ) +
      HREF("value") +
      numberString +
      "</a>" +
      stringTable.GetString( GetPrefix() + "html-post" );
  }

  public string GetPropertyName(string propertyID)
  {
    return stringTable.GetString( GetPrefix() + "name" );
  }

  public string GetPropertyDescription(string propertyID)
  {
    return stringTable.GetString( GetPrefix() + "description" );
  }

  public string GetPropertyType(string propertyID)
  {
    return "float," + minValue + "," + maxValue + "," + stepValue;
  }

  public string GetPropertyValue(string propertyID)
  {
    return (string)numberValue;
  }

  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    numberValue = value.AsFloat();
  }

  public PropertyValue GetPropertyAttribute(string propertyID, string attribute)
  {
    if (propertyID != GetPrefix())
      return inherited(propertyID, attribute);

    PropertyValue ret = new PropertyValue();

    if (attribute == "value")
      ret.Set(numberValue);
    else
      return inherited(propertyID, attribute);

    return ret;
  }

  public void SetPropertyAttribute(string propertyID, string attribute, PropertyValue value)
  {
    if (propertyID != GetPrefix())
    {
      inherited(propertyID, attribute, value);
      return;
    }

    if (attribute == "value")
      numberValue = value.AsFloat();
    else
      inherited(propertyID, attribute, value);
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);
    numberValue = soup.GetNamedTagAsFloat("number");
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();
    soup.SetNamedTag("number", numberValue);
    return soup;
  }

};

//
// ??
//
class SetHelperIconSizeRule isclass ScenarioBehavior
{
  ConfigAssetGroupHandler m_groupHandler;
  NumberValueHandler      m_sizeHandler;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property handler stuff...
    m_sizeHandler = new NumberValueHandler();
    m_sizeHandler.Init(me.GetAsset(), 50.0f, 100.0f, 1.0f, 100.0f);

    m_groupHandler = new ConfigAssetGroupHandler();
    m_groupHandler.Init(me.GetAsset(), "group-handler");
    m_groupHandler.AddHandler(m_sizeHandler, "size-ratio/");

    SetPropertyHandler(m_groupHandler);
  }

  //
  // When unpaused, ???
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        // do stuff...
        Interface.Log("# SetLeverArrowSizeRule.Pause> Setting scale of helper icons to ratio of: " + (string)(m_sizeHandler.numberValue/100));
        Interface.SetHelperIconScale(m_sizeHandler.numberValue/100);
        SetComplete(true);
      }
  }

};


Set HTML Pages
[Rules]

Set HTML Pages Rule

config.txt:

﻿
username            "Set HTML Pages"
kind              "behavior"
kuid              <kuid:-18:1244>
script              "SetHTMLPagesRule"
class             "SetHTMLPagesRule"
icon-texture            "set_html_pages.texture"
string-table {
  description         "Instructs the <i>Display HTML Pages</i> rule to perform to perform specific operations."
  description_info_operation      "Sends a <i>''$0''</i> instruction to the <i>Display HTML Pages</i> sequence browser."
  description_info_setpage      "Instructs the <i>Display HTML Pages</i> sequence browser to display the page <i>''$0''</i> from its list."
  description_info_param        "Sets the properties of the <i>Display HTML Pages</i> sequence browser."
  description_info_flags        "Sets the flag properties of the page <i>''$0''</i> for use when shown in the <i>Display HTML Pages</i> browser."
  description_info_msg_asset      "Instructs the <i>Display HTML Pages</i> sequence browser to display the page <i>''$0.html''</i> of HTML asset <i>''$1''</i> in a pop-up window."
  description_info_msg_text     "Instructs the <i>Display HTML Pages</i> sequence browser to display the text entry <i>''$0''</i> from the string table of HTML asset <i>''$1''</i> in a pop-up window."
  page-group-display-name       "Operations to perform on the <i>Display HTML Pages</i> sequence browser:<br>"
  page-group-item-browserparam      "<font color=#000000>Set browser parameters:</font>"
  page-group-html-prefix        "<table border='0' cellspacing='0' cellpadding='0'><tr height='1'><tr><td width=3></td><td><font color=#000000>"
  page-group-html-between-items     "<br>"
  page-group-html-sufix       "</font></td></tr></table><br><br><br>"
  page-group-item-pageoperation     "null"
  page-group-item-setpage       "null"
  page-group-item-pageflags     "null"
  page-group-item-msgboxhtml      "null"
  page-group-item-msgboxtext      "null"
  page-operation-html-property      "Instructs the sequence browser to: $0"
  page-operation-blank-string     "<i>click to select</i>"
  page-operation-html-prefix      "<font color=#000000>"
  page-operation-html-sufix     "</font><br>"
  page-operation-name-itemname      "Page operations"
  page-operation-desc-itemname      "Choose an operation command"
  page-operation-item0        "page-operation-close"
  page-operation-item1        "page-operation-done"
  page-operation-item2        "page-operation-prev"
  page-operation-item3        "page-operation-next"
  page-operation-item4        "page-operation-first"
  page-operation-item5        "page-operation-last"
  page-operation-item6        "page-operation-hide"
  page-operation-item7        "page-operation-show"
  page-operation-close        "Close"
  page-operation-done       "Done check button"
  page-operation-prev       "Previous page"
  page-operation-next       "Next page"
  page-operation-first        "First page"
  page-operation-last       "Last page"
  page-operation-hide       "Hide window"
  page-operation-show       "Show window"
  set-page-display-1        "Instructs the sequence browser to open the page $0 from its current settings."
  set-page-blank-0        "index"
  set-page-name-string/0        "HTML page name"
  set-page-desc-string/0        "Name of HTML page without the .html extension"
  set-page-html-prefix        "<font color=#000000>"
  set-page-html-sufix       "</font><br>"
  browser-options-html-prefix     " "
  browser-options-html-sufix      "<br>"
  browser-close-html-property-true    "$0Enable$1 closing of the browser window by the user."
  browser-close-html-property-false   "$0Disable$1 closing of the browser window by the user."
  browser-close-html-checkbox     "Disable closing of sequence browser window?"
  browser-close-html-prefix     "<font color=#000000>"
  browser-close-html-sufix      "</font><br>"
  browser-scroll-html-property-true   "$0Enable$1 scrolling on the sequence browser window."
  browser-scroll-html-property-false    "$0Disable$1 scrolling on the sequence browser window."
  browser-scroll-html-checkbox      "Disable scrolling on the sequence browser window?"
  browser-scroll-html-prefix      "<font color=#000000>"
  browser-scroll-html-sufix     "</font><br>"
  browser-visible-html-property-true    "$0Show$1 the sequence browser window."
  browser-visible-html-property-false   "$0Hide$1 the sequence browser window."
  browser-visible-html-checkbox     "Hide the sequence browser window?"
  browser-visible-html-prefix     "<font color=#000000>"
  browser-visible-html-sufix      "</font>"
  page-flags-html-prefix        "<font color=#000000>"
  page-flags-html-sufix       "</font>"
  page-flags-name-display-1     "Set the following flags for the page named $0"
  page-flags-name-blank-0       "index"
  page-flags-name-html-prefix     "<font color=#000000>"
  page-flags-name-html-sufix      "</font><br>"
  page-flags-name-name-string/0     "HTML page name"
  page-flags-name-desc-string/0     "Name of HTML page without the .html extension"
  page-flags-check-html-prefix      "<font color=#000000>"
  page-flags-check-html-sufix     "</font>"
  page-flags-check-display-name     "null"
  page-flags-check-item0        "doneclose"
  page-flags-check-item1        "noclose"
  page-flags-check-item2        "noscroll"
  page-flags-check-item3        "spare1"
  page-flags-check-item4        "spare2"
  page-flags-check-item5        "spare3"
  page-flags-check-item6        "spare4"
  page-flags-check-item7        "spare5"
  page-flags-check-item-doneclose     "Hide/close window on 'done' action"
  page-flags-check-item-noclose     "Window has no 'done' button"
  page-flags-check-item-noscroll      "Disable scrolling (not implemented yet)"
  page-flags-check-item-spare1      "Spare setting 1"
  page-flags-check-item-spare2      "Spare setting 2"
  page-flags-check-item-spare3      "Spare setting 3"
  page-flags-check-item-spare4      "Spare setting 4"
  page-flags-check-item-spare5      "Spare setting 5"
  msg-box-asset-html-property     "Use the page $0 from the HTML asset $1 for a pop-up message box."
  msg-box-asset-blank-string      "<i>click to select</i>"
  msg-box-asset-html-prefix     "<font color=#000000>"
  msg-box-asset-html-sufix      "</font><br>"
  msg-box-asset-name-pagename     "HTML page name"
  msg-box-asset-desc-pagename     "Name of HTML page without the .html extension"
  msg-box-asset-name-pageasset      "HTML asset"
  msg-box-asset-desc-pageasset      "Select HTML asset to load a page from"
  msg-box-text-html-property      "Use the string table entry $0 from the HTML asset $1 as the contents for a pop-up message box."
  msg-box-text-blank-string     "<i>click to select</i>"
  msg-box-text-html-prefix      "<font color=#000000>"
  msg-box-text-html-sufix       "</font>"
  msg-box-text-name-pagename      "String table entry"
  msg-box-text-desc-pagename      "Name of string table entry"
  msg-box-text-name-pageasset     "HTML asset"
  msg-box-text-desc-pageasset     "Asset where string table entry can be found"
}
kuid-table {
  displayhtmlpageslib       <kuid:-18:1245>
}
username-fr           "Définition de pages HTML"
string-table-fr {
  description         "Instructs the <i>Display HTML Pages</i> rule to perform to perform specific operations."
  description_info_operation                                                    "Envoie une instruction <i>''$0''</i> au navigateur de séquence <i>Affichage de pages HTML</i>."
  description_info_setpage                                                        "Commande au navigateur de séquence <i>Affichage de pages HTML</i> d'afficher la page <i>''$0''</i> dans sa liste."
  description_info_param                                                            "Définit les propriétés du navigateur de séquence <i>Affichage de pages HTML</i>."
  description_info_flags                                                            "Définit les propriétés marquées de la page <i>''$0''</i> à utiliser dans le navigateur <i>Affichage de pages HTML</i>."
  description_info_msg_asset                                                    "Commande au navigateur de séquence <i>Affichage de pages HTML</i> d'afficher la page <i>''$0.html''</i> de l'élément HTML <i>''$1''</i> dans la fenêtre qui apparaît."
  description_info_msg_text                                                      "Commande au navigateur de séquence <i>Affichage de pages HTML</i> d'afficher le texte <i>''$0''</i> de la string table de l'élément HTML <i>''$1''</i> dans une fenêtre d'affichage."

  page-group-display-name       "Opérations à réaliser dans le navigateur de séquence <i>Affichage de pages HTML</i> :<br>"
  page-group-item-browserparam      "<font color=#000000>Définir les paramètres de navigateur :</font>"

  page-operation-html-property      "Commande au navigateur de séquence de : $0"
  page-operation-blank-string     "<i>Cliquez pour sélectionner</i>"
  page-operation-name-itemname      "Opérations de page"
  page-operation-desc-itemname      "Choisir un ordre d'opération"
  page-operation-close        "Fermer"
  page-operation-done       "Bouton Terminé"
  page-operation-prev       "Page précédente"
  page-operation-next       "Page suivante"
  page-operation-first        "Première page"
  page-operation-last       "Dernière page"
  page-operation-hide       "Masquer fenêtre"
  page-operation-show       "Afficher fenêtre"

  set-page-display-1        "Commande au navigateur de séquence d'ouvrir la page $0 avec ses paramètres actuels."
  set-page-name-string/0        "Nom page HTML"
  set-page-desc-string/0        "Nom de la page HTML sans l'extension .html"

  browser-close-html-property-true    "$0Activer$1 la fermeture de la fenêtre du navigateur par l'utilisateur."
  browser-close-html-property-false   "$0Désactiver$1 la fermeture de la fenêtre du navigateur par l'utilisateur."
  browser-close-html-checkbox     "Désactiver la fermeture de la fenêtre du navigateur de séquence ?"

  browser-scroll-html-property-true   "$0Activer$1 le défilement dans la fenêtre du navigateur de séquence."
  browser-scroll-html-property-false    "$0Désactiver$1 le défilement dans la fenêtre du navigateur de séquence."
  browser-scroll-html-checkbox      "Désactiver le défilement dans la fenêtre du navigateur de séquence ?"

  browser-visible-html-property-true    "$0Afficher$1 la fenêtre du navigateur de séquence."
  browser-visible-html-property-false   "$0Masquer$1 la fenêtre du navigateur de séquence."
  browser-visible-html-checkbox     "Masquer la fenêtre du navigateur de séquence ?"

  page-flags-name-display-1     "Définir les marqueurs suivants pour la page intitulée $0"

  page-flags-name-name-string/0     "Nom page HTML"
  page-flags-name-desc-string/0     "Nom de la page HTML sans l'extension .html"

  page-flags-check-item-doneclose     "Masquer/Fermer la fenêtre avec l'action 'Terminé"
  page-flags-check-item-noclose     "La fenêtre n'a pas de bouton 'Terminé"
  page-flags-check-item-noscroll      "Désactiver le défilement (pas encore appliqué)"
  page-flags-check-item-spare1      "Paramètre de secours 1"
  page-flags-check-item-spare2      "Paramètre de secours 2"
  page-flags-check-item-spare3      "Paramètre de secours 3"
  page-flags-check-item-spare4      "Paramètre de secours 4"
  page-flags-check-item-spare5      "Paramètre de secours 5"

  msg-box-asset-html-property     "Utiliser la page $0 de l'élément HTML $1 pour la boîte de message."
  msg-box-asset-blank-string      "<i>Cliquez pour sélectionner</i>"
  msg-box-asset-name-pagename     "Nom page HTML"
  msg-box-asset-desc-pagename     "Nom de la page HTML sans l'extension .html"
  msg-box-asset-name-pageasset      "Elément HTML"
  msg-box-asset-desc-pageasset      "Sélectionner l'élément HTML à partir duquel charger la page"

  msg-box-text-html-property      "Utiliser l'entrée de string table $0 de l'élément HTML $1 comme contenu de la boîte de dialogue."
  msg-box-text-blank-string     "<i>Cliquez pour sélectionner</i>"
  msg-box-text-name-pagename      "Entrée de String table"
  msg-box-text-desc-pagename      "Nom de l'entrée de string table"
  msg-box-text-name-pageasset     "Elément HTML"
  msg-box-text-desc-pageasset     "Elément dans lequel trouver l'entrée de string table"
}

SetHTMLPagesRule.gs:

//
// SetHTMLPagesRule.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "ListItemPropertyHandler.gs"
include "HTMLPropertyHandler.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Extends the GenericStringHandler to append ".html" as a sufix to each string.
//
class GenericHTMLStringHandler isclass GenericStringHandler
{
  public string GetStringDisplayValue(int valueIndex) { return inherited(valueIndex) + ".html"; }
};

//
// HTML page thingy
//
class HTMLMessageAssetItem isclass ConfigAssetHandler
{
  // Name of page to display (minus the .html extension) + the asset where it can be located.
  string m_pageName = "index";
  Asset  m_htmlAsset = null;

  // work-around...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  public Asset GetHTMLAsset(void) { return m_htmlAsset; }
  public void  SetHTMLAsset(Asset newAsset) { m_htmlAsset = newAsset; }

  public string GetPageName(void) { return m_pageName; }
  public void   SetPageName(string newPageName) { m_pageName = newPageName; }

  Asset FindAsset(string assetName);

  //
  // Property Handler method implementations
  //

  public string GetPropertyType(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "pageName")
      return "string";

    if (property == "pageAsset")
      return "list,1";

    return inherited(propertyID);
  }

  //
  // Gets HTML code describing this list item as two table cells (one cell for page name, other for
  // the asset)
  //
  public string GetDescriptionHTML(void)
  {
    string assetName;
    if (!m_htmlAsset)
      assetName = m_assetStrTable.GetString(m_configPrefix + "-blank-string");
    else
      assetName = m_htmlAsset.GetLocalisedName();

    string htmlPage = m_assetStrTable.GetString2(m_configPrefix + "-html-property",
                                                 HREF("pageName") + m_pageName + ".html</a>",
                                                 HREF("pageAsset") + assetName + "</a>");
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  //
  // Allows the page name to be set through this interface method.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    string property = PropStripPrefix(propertyID, "");
    if ((property == "pageName") and (value.GetType() == value.STRING_TYPE))
      m_pageName = value.AsString();

    else if (property == "pageAsset")
    {
      string assetName = value.AsString();
      Asset newAsset = FindAsset(value.AsString());
      if (newAsset)
        m_htmlAsset = newAsset;
    }

    else
      inherited(propertyID, value);
  }

  public string GetPropertyValue(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "pageName")
      return m_pageName;

    if (property == "pageAsset")
      if (m_htmlAsset)
        return m_htmlAsset.GetLocalisedName();

    return inherited(propertyID);
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "pageAsset")
    {
      string[] retList = new string[0];
      Asset[] assets = World.GetAssetList("html-asset");
      int i;
      for (i = 0; i < assets.size(); i++)
        retList[i] = assets[i].GetLocalisedName();

      return retList;
    }

    return inherited(propertyID);
  }

  //
  // Gets a readable text name for the specified property.
  //
  public string GetPropertyName(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "pageName")
      return m_assetStrTable.GetString(m_configPrefix + "-name-pageName");

    if (property == "pageAsset")
      return m_assetStrTable.GetString(m_configPrefix + "-name-pageAsset");

    return inherited(propertyID);
  }

  //
  // Gets a readable text description for the named property.
  //
  public string GetPropertyDescription(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "pageName")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-pageName");

    if (property == "pageAsset")
      return m_assetStrTable.GetString(m_configPrefix + "-desc-pageAsset");

    return inherited(propertyID);
  }

  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("HTMLPageListItem.pageName", m_pageName);

    if (m_htmlAsset)
      soup.SetNamedTag("HTMLPageListItem.htmlAsset", m_htmlAsset.GetKUID());

    return soup;
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    string newPageName = soup.GetNamedTag("HTMLPageListItem.pageName");
    if (newPageName.size())
      m_pageName = newPageName;

    KUID htmlAssetKUID = soup.GetNamedTagAsKUID("HTMLPageListItem.htmlAsset");
    if (htmlAssetKUID)
      m_htmlAsset = World.FindAsset(htmlAssetKUID);
  }

  // find the asset by name
  Asset FindAsset(string assetName)
  {
    Asset[] assets = World.GetAssetList("html-asset");
    int i;

    for (i = 0; i < assets.size(); i++)
      if (assets[i].GetLocalisedName() == assetName)
        return assets[i];

    return null;
  }

};

class HTMLMessageTextItem isclass HTMLMessageAssetItem
{
  // work-around...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  //
  // Property Handler method implementations
  //

  public string GetDescriptionHTML(void)
  {
    string assetName;
    if (!m_htmlAsset)
      assetName = m_assetStrTable.GetString(m_configPrefix + "-blank-string");
    else
      assetName = m_htmlAsset.GetLocalisedName();

    string htmlPage = m_assetStrTable.GetString2(m_configPrefix + "-html-property",
                                                 HREF("pageName") + m_pageName + "</a>",
                                                 HREF("pageAsset") + assetName + "</a>");
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

};

//
// ??
//
class SetHTMLPagesRule isclass ScenarioBehavior
{
  RadioButtonGroupHandler   m_radioGroupHandler;
  EnumeratedPropertyHandler   m_pageOperationHandler;
  GenericHTMLStringHandler    m_setPageHandler;
  ConfigAssetGroupHandler     m_browserParametersHandler;
  GenericBoolHandler            m_enableDisableClose, m_enableDisableScrolling, m_showHideBrowserHandler;
//  GenericNumberHandler          m_widthHeightHandler, m_positionHandler;
  ConfigAssetGroupHandler     m_setPageFlagsHandler;
  GenericHTMLStringHandler      m_pageFlagNameHandler;
  CheckListPropertyHandler      m_pageFlagSettingHandler;
  HTMLMessageAssetItem        m_msgBoxHTMLAssetHandler;
  HTMLMessageTextItem         m_msgBoxHTMLTextHandler;

  void CallDisplayLibrary(void);

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property handler stuff...

    // 1st option for radio group is enumeration of operations that can be performed on the browser sequence

    PropertyValue[] pageOpParam = new PropertyValue[1];
    pageOpParam[0] = new PropertyValue();
    pageOpParam[0].Set(8);

    m_pageOperationHandler = new EnumeratedPropertyHandler();
//    m_pageOperationHandler.Init(me.GetAsset(), "page-operation");
    m_pageOperationHandler.Init(me.GetAsset(), "page-operation", 8);

    // 2nd option for radio button group is set sequence page by name
    m_setPageHandler = new GenericHTMLStringHandler();
    m_setPageHandler.Init(me.GetAsset(), "set-page", 1);

    // 3rd option for radio button group is collection of various handlers for things like open/close, scrolling,
    // visiblity, width/heaight and screen position etc.
    m_enableDisableClose = new GenericBoolHandler();
    m_enableDisableClose.Init(me.GetAsset(), "browser-close");
    m_enableDisableClose.SetBoolValue(true);

    m_enableDisableScrolling = new GenericBoolHandler();
    m_enableDisableScrolling.Init(me.GetAsset(), "browser-scroll");
    m_enableDisableScrolling.SetBoolValue(true);

    m_showHideBrowserHandler = new GenericBoolHandler();
    m_showHideBrowserHandler.Init(me.GetAsset(), "browser-visible");
    m_showHideBrowserHandler.SetBoolValue(true);

    m_browserParametersHandler = new ConfigAssetGroupHandler(); // group handler for 3rd option
    m_browserParametersHandler.Init(me.GetAsset(), "browser-options");
    m_browserParametersHandler.AddHandler(m_enableDisableClose, "close/");
    m_browserParametersHandler.AddHandler(m_enableDisableScrolling, "scroll/");
    m_browserParametersHandler.AddHandler(m_showHideBrowserHandler, "visible/");

    // 4th option for radio button group is checklist of flags to apply to a specific page in the pages sequence
    m_pageFlagNameHandler = new GenericHTMLStringHandler();
    m_pageFlagNameHandler.Init(me.GetAsset(), "page-flags-name", 1);

    // flag settings list
    PropertyValue[] paramArray = new PropertyValue[1];
    paramArray[0] = new PropertyValue();
    paramArray[0].Set(8);

    m_pageFlagSettingHandler = new CheckListPropertyHandler();
    m_pageFlagSettingHandler.Init(me.GetAsset(), "page-flags-check", paramArray);
    m_pageFlagSettingHandler.SetAll(false);

    m_setPageFlagsHandler = new ConfigAssetGroupHandler();
    m_setPageFlagsHandler.Init(me.GetAsset(), "page-flags");
    m_setPageFlagsHandler.AddHandler(m_pageFlagNameHandler, "name/");
    m_setPageFlagsHandler.AddHandler(m_pageFlagSettingHandler, "setting/");

    // 5th option for radio button group is a message box based
    m_msgBoxHTMLAssetHandler = new HTMLMessageAssetItem();
    m_msgBoxHTMLAssetHandler.Init(me.GetAsset(), "msg-box-asset");

    // 6th option for radio button group is a message box based
    m_msgBoxHTMLTextHandler = new HTMLMessageTextItem();
    m_msgBoxHTMLTextHandler.Init(me.GetAsset(), "msg-box-text");

    // radio button group encapsulates all various options of this rule (we can easily add to this without
    // risking breaking existing usages of this rule)
    m_radioGroupHandler = new RadioButtonGroupHandler();
    m_radioGroupHandler.Init(me.GetAsset(), "page-group");

    m_radioGroupHandler.AddHandler(m_pageOperationHandler, "pageOperation");
    m_radioGroupHandler.AddHandler(m_setPageHandler, "setPage");
    m_radioGroupHandler.AddHandler(m_browserParametersHandler, "browserParam");
    m_radioGroupHandler.AddHandler(m_setPageFlagsHandler, "pageFlags");
    m_radioGroupHandler.AddHandler(m_msgBoxHTMLAssetHandler, "msgBoxHTML");
    m_radioGroupHandler.AddHandler(m_msgBoxHTMLTextHandler, "msgBoxText");

    SetPropertyHandler(m_radioGroupHandler);
  }

  //
  // When unpaused, ???
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        CallDisplayLibrary();
        SetComplete(true);
      }
  }

  void CallDisplayLibrary(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("displayHTMLPagesLib");
    Library displayHTMLPagesLib = World.GetLibrary(kuid);

    if (displayHTMLPagesLib)
    {
      // 1st radio button - a selected page operation is performed on the browser sequence
      if (m_pageOperationHandler == m_radioGroupHandler.GetSelectedSubHandler())
      {
        if (m_pageOperationHandler.IsEnumSet())
        {
          string[] stringParam = new string[1];
          stringParam[0] = m_pageOperationHandler.GetItem()[m_pageOperationHandler.GetConfigPrefix().size()+1,];

          Interface.Log("# SetHTMLPagesRule.Pause> INFO, '" + m_pageOperationHandler.GetConfigPrefix() + "': instructing the sequence browser to perform a '" + stringParam[0] + "' operation");
          displayHTMLPagesLib.LibraryCall("PageOperation", stringParam, null);
        }
        else
          Interface.Log("# SetHTMLPagesRule.Pause> ERROR, '" + m_pageOperationHandler.GetConfigPrefix() + "': no valid page operation selected!");
      }

      // 2nd radio button - the named page is travelled to in the browser sequence
      else if (m_setPageHandler == m_radioGroupHandler.GetSelectedSubHandler())
      {
        string[] stringParam = new string[1];
        stringParam[0] = m_setPageHandler.GetStringValue(0);

        Interface.Log("# SetHTMLPagesRule.Pause> INFO, '" + m_setPageHandler.GetConfigPrefix() + "': instructing sequence browser to load page '" + stringParam[0] + ".html'");

        displayHTMLPagesLib.LibraryCall("SetPageName", stringParam, null);
      }

      // 3rd radio button - paramters for the sequence browser
      else if (m_browserParametersHandler == m_radioGroupHandler.GetSelectedSubHandler())
      {
        string[] stringParam = new string[3];

        stringParam[0] = "enableClose/" + (string)m_enableDisableClose.GetBoolValue();
        stringParam[1] = "enableScroll/" + (string)m_enableDisableScrolling.GetBoolValue();
        stringParam[2] = "windowVisible/" + (string)m_showHideBrowserHandler.GetBoolValue();

        // dw: these are still under construction
//            stringParam[3] = "windowPosition/" +  (string)m_widthHeightHandler.GetNumValue(0);  (string)m_widthHeightHandler.GetNumValue(1);
//            stringParam[4] = "windowSize/" +      (string)m_positionHandler.GetNumValue(0);  (string)m_positionHandler.GetNumValue(1);

        Interface.Log("# SetHTMLPagesRule.Pause> INFO, '" + m_pageFlagNameHandler.GetConfigPrefix() + "': Setting browser parameters for Display HTML Pages browser.");
        displayHTMLPagesLib.LibraryCall("SetBrowserParameters", stringParam, null);
      }

      // 4th radio button - sets the flags of a particular flag in the Display HTML Pages sequence
      else if (m_setPageFlagsHandler == m_radioGroupHandler.GetSelectedSubHandler())
      {
        int flags = m_pageFlagSettingHandler.GetSettingsAsFlags();
        Interface.Log("# SetHTMLPagesRule.Pause> INFO, '" + m_pageFlagNameHandler.GetConfigPrefix() + "': Setting flags for page '" + m_pageFlagNameHandler.GetStringValue(0) + "' in sequence browser to: " + flags);

        string[] stringParam = new string[2];
        stringParam[0] = m_pageFlagNameHandler.GetStringValue(0);
        stringParam[1] = (string)flags;

        displayHTMLPagesLib.LibraryCall("SetPageFlags", stringParam, null);
      }

      // 5th radio button - message box based on page file name + asset
      else if (m_msgBoxHTMLAssetHandler == m_radioGroupHandler.GetSelectedSubHandler())
      {
        if (m_msgBoxHTMLAssetHandler.GetHTMLAsset()  and  m_msgBoxHTMLAssetHandler.GetPageName().size())
        {
          string[] stringParam = new string[1];
          GSObject[] objectParam = new GSObject[1];

          stringParam[0] = m_msgBoxHTMLAssetHandler.GetPageName();
          objectParam[0] = m_msgBoxHTMLAssetHandler.GetHTMLAsset();

          Interface.Log("# SetHTMLPagesRule.Pause> INFO, '" + m_msgBoxHTMLAssetHandler.GetConfigPrefix() + "': Sending an asset message box");
          displayHTMLPagesLib.LibraryCall("MessageBox", stringParam, objectParam);
        }
        else
          Interface.Log("# SetHTMLPagesRule.Pause> ERROR, '" + m_msgBoxHTMLAssetHandler.GetConfigPrefix() + "': Invalid message box asset/page name!");
      }

      // 6th radio button - message box based on string-table as HTML source
      else if (m_msgBoxHTMLTextHandler == m_radioGroupHandler.GetSelectedSubHandler())
      {
        if (m_msgBoxHTMLTextHandler.GetHTMLAsset()  and  m_msgBoxHTMLTextHandler.GetPageName().size())
        {
          string[] stringParam = new string[1];
          stringParam[0] = m_msgBoxHTMLTextHandler.GetHTMLAsset().GetStringTable().GetString(m_msgBoxHTMLTextHandler.GetPageName());

          if (stringParam[0].size())
          {
            Interface.Log("# SetHTMLPagesRule.Pause> INFO, '" + m_msgBoxHTMLTextHandler.GetConfigPrefix() + "': Sending a text message of '" + stringParam[0] + "'");
            displayHTMLPagesLib.LibraryCall("MessageBox", stringParam, null);
          }
          else
            Interface.Log("# SetHTMLPagesRule.Pause> ERROR, '" + m_msgBoxHTMLTextHandler.GetConfigPrefix() + "': Asset '" + m_msgBoxHTMLTextHandler.GetHTMLAsset().GetLocalisedName() + "' has no string-table entry named '" + m_msgBoxHTMLTextHandler.GetPageName() + "'!");
        }
        else
          Interface.Log("# SetHTMLPagesRule.Pause> ERROR, '" + m_msgBoxHTMLTextHandler.GetConfigPrefix() + "': Invalid message box asset/page name!");
      }

      // unknown sub=handler in radio button group (unlikely to happen though)
      else
        Interface.Log("# SetHTMLPagesRule.Pause> ERROR: Rule set to invalid/unknown sub-handler.");
    }
    else
      Interface.Log("# SetHTMLPagesRule.Pause> ERROR: Unable to open library 'DisplayHTMLPagesLib'");

  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if ((m_pageOperationHandler == m_radioGroupHandler.GetSelectedSubHandler())  and
         m_pageOperationHandler.IsEnumSet())
      return strTable.GetString1("description_info_operation", m_pageOperationHandler.GetItemFull());

    if (m_setPageHandler == m_radioGroupHandler.GetSelectedSubHandler())
      return strTable.GetString1("description_info_setpage", m_setPageHandler.GetStringDisplayValue(0));

    if (m_browserParametersHandler == m_radioGroupHandler.GetSelectedSubHandler())
      return strTable.GetString("description_info_param");

    if (m_setPageFlagsHandler == m_radioGroupHandler.GetSelectedSubHandler())
      return strTable.GetString1("description_info_flags", m_pageFlagNameHandler.GetStringDisplayValue(0));

    if (m_msgBoxHTMLAssetHandler == m_radioGroupHandler.GetSelectedSubHandler())
      return strTable.GetString2("description_info_msg_asset", m_msgBoxHTMLAssetHandler.GetPageName(), m_msgBoxHTMLAssetHandler.GetHTMLAsset().GetLocalisedName());

    if (m_msgBoxHTMLTextHandler == m_radioGroupHandler.GetSelectedSubHandler())
      return strTable.GetString2("description_info_msg_text", m_msgBoxHTMLTextHandler.GetPageName(), m_msgBoxHTMLTextHandler.GetHTMLAsset().GetLocalisedName());

    return inherited();
  }

};


Set Junctions
[Rules]

Set Junctions Rule

config.txt:

﻿
username            "Set Junctions"
kind              "behavior"
kuid              <kuid:-18:1237>
script              "SetJunctionsRule"
class             "SetJunctionsRule"
icon-texture            "set_junctions.texture"
string-table {
  description         "Sets the selected junctions to a specific state."
  description_html        "Sets the selected junctions to a specific state."
  set-junctions-display-name      "Set the following junctions to a specific state:<br>"
  set-junctions-html-prefix     "<table border='0' cellspacing='0' cellpadding='0'><tr height=1><td colspan=2></td></tr><tr><td width=4></td><td><font color=#000000>"
  set-junctions-html-sufix      "</font></td></tr></table><br><br>"
  set-junctions-html-table-row-odd    "bgcolor=#CCCCAA22"
  set-junctions-html-table-row-even   "bgcolor=#CCCCAA44"
  set-junctions-html-property     "$0"
  set-junctions-blank-string      "<i>click to select</i>"
  set-junctions-add       "Add Junction"
  set-junctions-name-add        "Junctions"
  set-junctions-desc-add        "Junction to add to the list"
  set-junctions-add-all       "Add All"
  set-junctions-add-all-tooltip     "Adds all junctions on the map to the list"
  set-junctions-delete-all      "Delete All"
  set-junctions-delete-all-tooltip    "Deletes all junction from the list"
  set-junctions-column0       "<font color=#000000><i>Junction</i></font>&nbsp;&nbsp;"
  set-junctions-column1       "<font color=#000000><i>Setting</i></font>&nbsp;&nbsp;"
  set-junctions-column2       "<font color=#000000><i>Locked</i></font>&nbsp;&nbsp;"
  set-junctions-delete        "<font color=#000000>Remove</font>"
  junction-item-html-prefix     "<td bgcolor=#00000011>"
  junction-item-html-sufix      "</td>"
  junction-setting-html-property      "$0"
  junction-setting-blank-string     "<i>click to select</i>"
  junction-setting-name-itemname      "Junction setting"
  junction-setting-desc-itemname      "Setting to change the junction to"
  junction-setting-html-prefix      "<font color=#000000>"
  junction-setting-html-sufix     "</font>"
  junction-setting-item0        "junction-setting-left"
  junction-setting-item1        "junction-setting-center"
  junction-setting-item2        "junction-setting-right"
  junction-setting-item3        "junction-setting-none"
  junction-setting-left       "Left"
  junction-setting-center       "Center"
  junction-setting-right        "Right"
  junction-setting-none       "Don't change"
  junction-lock-html-property-true    "$0locked$1"
  junction-lock-html-property-false   "$0unlocked$1"
  junction-lock-html-bool-true      "locked"
  junction-lock-html-bool-false     "unlocked"
  junction-lock-html-prefix     "<font color=#000000>"
  junction-lock-html-sufix      "</font>"
}
username-fr           "Définition d'aiguillage"
string-table-fr {
  description         "Définit une orientation spécifique pour l'aiguillage sélectionné."
  description_html        "Définit une orientation spécifique pour l'aiguillage sélectionné."

  set-junctions-display-name      "Définit une orientation spécifique pour les aiguillages suivants :<br>"

  set-junctions-blank-string      "<i>Cliquez pour sélectionner</i>"
  set-junctions-add       "Ajouter aiguillage"
  set-junctions-name-add        "Aiguillages"
  set-junctions-desc-add        "Aiguillage à ajouter à la liste"
  set-junctions-add-all       "Tout ajouter"
  set-junctions-add-all-tooltip     "Ajoute tous les aiguillages sur la carte à la liste"
  set-junctions-delete-all      "Tout supprimer"
  set-junctions-delete-all-tooltip    "Supprime tous les aiguillages de la liste"
  set-junctions-column0       "<font color=#000000><i>Aiguillage</i></font>&nbsp;&nbsp;"
  set-junctions-column1       "<font color=#000000><i>Orientation</i></font>&nbsp;&nbsp;"
  set-junctions-column2       "<font color=#000000><i>Verrouillé</i></font>&nbsp;&nbsp;"
  set-junctions-delete        "<font color=#000000>Retirer</font>"

  junction-setting-blank-string     "<i>Cliquez pour sélectionner</i>"
  junction-setting-name-itemname      "Paramètre d'aiguillage"
  junction-setting-desc-itemname      "Nouveau paramètre d'aiguillage"

  junction-setting-left       "Gauche"
  junction-setting-center       "Centre"
  junction-setting-right        "Droite"
  junction-setting-none       "Idem"

  junction-lock-html-property-true    "$0verrouillé$1"
  junction-lock-html-property-false   "$0déverrouillé$1"
  junction-lock-html-bool-true      "verrouillé"
  junction-lock-html-bool-false     "verrouillé"
}

SetJunctionsRule.gs:

//
// SetJunctionsRule.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "Junction.gs"
include "ConditionalScenarioBehavior.gs"
include "common.gs"

//
// A junction item for use in a list handler.
//
class JunctionListItem isclass ConfigAssetGroupHandler
{
  // name of target junction
  string m_junctionName = "";

  // sub handlers for junction choice (enumeration of [left | right | centre | none]) and lock state (bool lock/unlocked)
  EnumeratedPropertyHandler m_junctionChoiceEnumHandler;
  GenericBoolHandler        m_junctionLockHandler;

  public int GetJunctionSetting(string settingName);

  //
  // Initialization method that creates the enumerated sub-handler for mananging the junction's state setting.
  //
  public void Init(Asset asset, string newConfigPrefix)
  {
    inherited(asset, newConfigPrefix);

    // add the enumerated handler for use on choosing junction settings
    m_junctionChoiceEnumHandler = new EnumeratedPropertyHandler();
    m_junctionChoiceEnumHandler.Init(asset, "junction-setting", 4);

    m_junctionLockHandler = new GenericBoolHandler();
    m_junctionLockHandler.Init(asset, "junction-lock", true);

    me.AddHandler(m_junctionChoiceEnumHandler, "juncState/");
    me.AddHandler(m_junctionLockHandler, "juncLock/");
  }

  //
  // Property methods
  //

  //
  // Gets HTML table cells that describe the junction, it's state setting and locked state.
  //
  public string GetDescriptionHTML(void)
  {
    string htmlPage = "<font color=#000000>" + m_junctionName + "</font></td>&nbsp;&nbsp;" +
                      "<td bgcolor=#00000011>" + m_junctionChoiceEnumHandler.GetDescriptionHTML() + "&nbsp;&nbsp;</td>" +
                      "<td bgcolor=#00000011>" + m_junctionLockHandler.GetDescriptionHTML() + "&nbsp;&nbsp;";
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  //
  // Allows the junction name to be set through this interface method.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    string property = PropStripPrefix(propertyID, "");
    if ((property == "junctionName") and (value.GetType() == value.STRING_TYPE))
      m_junctionName = value.AsString();
    else
      inherited(propertyID, value);
  }

  //
  // Allows the junction name to be obtained through this interface method.
  //
  public string GetPropertyValue(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "junctionName")
      return m_junctionName;

    return inherited(propertyID);
  }

  //
  // Return properties of this object in a soup.
  //
  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("JunctionListItem.junctionName", m_junctionName);

    // sub-soups for the junction state + locked setting handlers
    soup.SetNamedSoup("JunctionListItem.junctionSetting", m_junctionChoiceEnumHandler.GetProperties());
    soup.SetNamedSoup("JunctionListItem.junctionLock", m_junctionLockHandler.GetProperties());

    return soup;
  }

  //
  // Initialize this object from the given properties soup.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);
    m_junctionName = soup.GetNamedTag("JunctionListItem.junctionName");

    // once sub-handlers are recreated, initialize them from the soup
    m_junctionChoiceEnumHandler.SetProperties(soup.GetNamedSoup("JunctionListItem.junctionSetting"));
    m_junctionLockHandler.SetProperties(soup.GetNamedSoup("JunctionListItem.junctionLock"));
  }

  public void SetJunction()
  {
    Junction junction = cast<Junction> Router.GetGameObject(m_junctionName);
    if (junction)
    {
      if (m_junctionChoiceEnumHandler.IsEnumSet())
      {
//        Interface.Log("   - INFO: Setting junction '" + m_junctionName + "' to '" + m_junctionChoiceEnumHandler.GetItemFull() + "' with lock state of '" + m_junctionLockHandler.GetBoolDisplayValue() + "'");
        junction.SetDirection(GetJunctionSetting(m_junctionChoiceEnumHandler.GetItem()));
      }
//      else
//        Interface.Log("   - INFO: Setting lock state of junction '" + m_junctionName + "' to '" + m_junctionLockHandler.GetBoolDisplayValue() + "'");

      junction.AllowManualControl(!m_junctionLockHandler.GetBoolValue());
    }
    else
      Interface.Log("   - ERROR: unable to find junction '" + m_junctionName + "'");
  }

  public int GetJunctionSetting(string settingName)
  {
    string strippedSetting = TrainUtil.GetAfter(settingName, "-");

    if (strippedSetting == "left")
      return Junction.DIRECTION_LEFT;

    if ((strippedSetting == "forward")  or  (settingName == "center"))
      return Junction.DIRECTION_FORWARD;

    if (strippedSetting == "right")
      return Junction.DIRECTION_RIGHT;

// these modes are not cattered for right now
//  return Junction.DIRECTION_BACKWARD;
//  return Junction.DIRECTION_NONE;

    return -1;
  }

};

//
// Extends the generic list handler to be a list of junctions.
//
class JunctionListHandler isclass GenericListHandler
{
  // work-arounds...crude but it's what we need :-|
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }
  public void SetPrefix(string prefix) { inherited(prefix); }

  //
  // Adds a new item to the list.  Method well create appropriate sub-handler for it.
  //
  public void AddItem(string itemDisplayName)
  {
    JunctionListItem newItem = new JunctionListItem();
    newItem.Init(m_hostAsset, "junction-item");

    // handler prefix is junction name with spaces substituted with '-'
    string itemPrefix = TrainUtil.StrSubst(itemDisplayName, " ", "-");
    itemPrefix = itemPrefix + "/";

    me.AddHandler(newItem, itemPrefix);

    // set the junctionName property
    PropertyValue xvalue = new PropertyValue();
    xvalue.Set(itemDisplayName);
    newItem.SetPropertyValue(newItem.Prop("junctionName"), xvalue);
  }

  public bool JunctionAlreadyInList(string juncName)
  {
    int i;
    for (i = 0; i < handlers.size(); i++)
      if (juncName == handlers[i].GetPropertyValue(handlers[i].Prop("junctionName")))
        return true;

    return false;
  }

  //
  // Gets list of elements to choose from for the named property
  //
  public string[] GetPropertyElementList(string propertyID)
  {
    string property = PropStripPrefix(propertyID, "");
    if (property == "add")
    {
      string[] retStrList = new string[0];
      Junction[] junctions = World.GetJunctionList();

      int i, p = 0;
      for (i = 0; i < junctions.size(); i++)
        if (!JunctionAlreadyInList(junctions[i].GetName()))
          retStrList[p++] = junctions[i].GetName();

      return retStrList;
    }

    return inherited(propertyID);
  }

  //
  // Re-create a list of junction handlers from the given soup (called by GenericListHandler.SetProperties()
  //
  void ConstructHandlers(Soup listItemsSoup)
  {
    int i;
    for (i = 0; i < listItemsSoup.CountTags(); i++)
    {
      JunctionListItem newItem = new JunctionListItem();
      newItem.Init(m_hostAsset, "junction-item");

      string prefixTag = listItemsSoup.GetIndexedTagName(i);

      Soup itemSoup = listItemsSoup.GetNamedSoup(prefixTag);
      newItem.SetProperties(itemSoup);

      AddHandler(newItem, prefixTag);
    }
  }

  //
  // Instructs each junction item to set its junction to the associated settings it contains
  //
  public void SetJunctions(void)
  {
    int i;
    for (i = 0; i < handlers.size(); i++)
    {
      JunctionListItem junctionItem = cast<JunctionListItem> handlers[i];
      if (junctionItem)
        junctionItem.SetJunction();
      else
        Interface.Log("# JunctionListHandler.SetJunctions> ERROR: Invalid junction list item!");
    }
  }

};

//
// This rule operates in a wait cycle thread. Everytime a message of type "Junction", "Toggled" occurs,
// the rule's settings will be checked.  If satisfied, the thread ends and the rule becomes complete.
//
class SetJunctionsRule isclass ScenarioBehavior
{
  // HTML property handler stuff
  JunctionListHandler  junctionListHandler;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property handler stuff
    junctionListHandler = new JunctionListHandler();

    junctionListHandler.SetPrefix("junctionsList/");
    junctionListHandler.Init(me.GetAsset(), "set-junctions");

    SetPropertyHandler(junctionListHandler);
  }

  //
  // When unpaused. set the options as needed (in driver only?)
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        Interface.Log("# SetJunctionsRule.Pause> INFO: unpaused and in driver, setting junctions...");
        junctionListHandler.SetJunctions();
      }

      SetComplete(true);
    }
  }

};


Show/Hide HUD Panel
[Rules]

Show/Hide HUD Panel Rule

config.txt:

﻿
username            "Show/Hide HUD Panel"
kind              "behavior"
kuid              <kuid:-18:1217>
script              "ShowHideHUDPanel"
class             "ShowHideHUDPanel"
icon-texture            "showhide_hud_panel.texture"
string-table {
  description         "Shows or hides a HUD panel."
  description_html        "Shows or hides a HUD panel."
  description_info_true       "Shows the <i>''$0''</i> HUD panel."
  description_info_false        "Hides the <i>''$0''</i> HUD panel."
  show-hide-panel-html-property-true    "$0Show$1 the $2 HUD Panel."
  show-hide-panel-html-property-false   "$0Hide$1 the $2 HUD Panel."
  show-hide-panel-html-prefix     "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=4></td><td><font color=#000000>"
  show-hide-panel-html-sufix      "</font></td></tr></table>"
  show-hide-panel-blank-string      "<i>click to select</i>"
  show-hide-panel-name-itemname     "HUD Panel"
  show-hide-panel-desc-itemname     "HUD Panel to show/hide"
  show-hide-panel-name-showhide     "Show/Hide state"
  show-hide-panel-desc-showhide     "Shows or hides a HUD Panel"
  show-hide-panel-item0       "panel-bottom-right"
  show-hide-panel-item1       "panel-cabin-controls"
  show-hide-panel-item2       "panel-camera-controls"
  show-hide-panel-item3       "panel-dcc-controls"
  show-hide-panel-item4       "panel-speed-time-display"
  panel-bottom-right        "Bottom Right Menu"
  panel-cabin-controls        "Cabin Controls"
  panel-camera-controls       "Camera Controls"
  panel-dcc-controls        "DCC Controls"
  panel-speed-time-display      "Speed and Time Display"
}
kuid-table {
  driver_module         <kuid:-16:10240>
}
username-fr           "Afficher/Masquer panneau ATH"
string-table-fr {
  description         "Affiche ou masque un panneau ATH."
  description_html        "Affiche ou masque un panneau ATH."
  description_info_true       "Affiche le panneau ATH <i>''$0''</i>."
  description_info_false        "Masque le panneau ATH <i>''$0''</i>."

  show-hide-panel-html-property-true    "$0Affiche$1 le panneau ATH $2."
  show-hide-panel-html-property-false   "$0Masque$1 le panneau ATH $2."

  show-hide-panel-blank-string      "<i>Cliquez pour sélectionner</i>"
  show-hide-panel-name-itemname     "Panneau ATH"
  show-hide-panel-desc-itemname     "Panneau ATH à afficher/masquer"
  show-hide-panel-name-showhide     "Afficher/Masquer statut"
  show-hide-panel-desc-showhide     "Affiche ou masque un panneau ATH"

  panel-bottom-right        "Menu inférieur droit"
  panel-cabin-controls        "Commandes cabine"
  panel-camera-controls       "Commandes caméra"
  panel-dcc-controls        "Commandes DCC"
  panel-speed-time-display      "Affichage vitesse et temps"
}

ShowHideHUDPanel.gs:

//
// ShowHideHUDPanel.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "Library.gs"
include "World.gs"

//
// Handler property class
//
class ShowHideHUDPanelHandler isclass EnumeratedPropertyHandler
{
  bool m_showHide = true;  // are we showing are hiding the hud panel(s)? true to show, false to hide

  public bool GetShowHide() { return m_showHide; }

  // workaround...crude but it's what we need :(
  public void Init(Asset asset, string newConfigPrefix) { inherited(asset, newConfigPrefix); }

  //
  // Properties methods
  //

  //
  // Gets HTML page describing this object
  //
  public string GetDescriptionHTML(void)
  {
    string htmlPage = m_assetStrTable.GetString3(m_configPrefix + "-html-property-" + (string)m_showHide,
                                                 HREF("showHide"), "</a>", HREF("itemName") + GetItemFull() + "</a>");
    return m_htmlPrefix + htmlPage + m_htmlSufix;
  }

  //
  // Gets type for named property.
  //
  public string GetPropertyType(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "showHide")
      return "link";

    return inherited(propertyID);
  }

  //
  // Sets value of named property.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    if (PropStripPrefix(propertyID, "") == "showHide")
      m_showHide = !m_showHide;
    else
      inherited(propertyID, value);
  }

  //
  // Return properties of this object in a soup
  //
  public Soup GetProperties()
  {
    Soup soup = inherited();
    soup.SetNamedTag("ShowHideHUDPanel.showHide", m_showHide);
    return soup;
  }

  //
  // Initialize this object from the given properties soup
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);
    m_showHide = soup.GetNamedTagAsBool("ShowHideHUDPanel.showHide");
  }

};

class ShowHideHUDPanel isclass ScenarioBehavior
{
  // HTML property handler stuff
  ShowHideHUDPanelHandler m_showHideHUDPanelHandler;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property info handler stuff
    m_showHideHUDPanelHandler = new ShowHideHUDPanelHandler();
    m_showHideHUDPanelHandler.Init(me.GetAsset(), "show-hide-panel");

    SetPropertyHandler(m_showHideHUDPanelHandler);
  }

  //
  // When unpaused. set the options as needed (in driver only?)
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        Interface.Log("# ShowHideHUDPanel.Pause> unpaused and in driver, show/hide is '" +
                      m_showHideHUDPanelHandler.GetShowHide() + "' and the item panel is '" +
                      m_showHideHUDPanelHandler.GetItem() + "'");

        // library to access driver module
        KUID driverModuleKUID = me.GetAsset().LookupKUIDTable("driver_module");
        Library driverModuleLib = World.GetLibrary(driverModuleKUID);

        if (driverModuleLib)
        {
          string[] libParam = new string[1];
          libParam[0] = m_showHideHUDPanelHandler.GetItem();

          if (m_showHideHUDPanelHandler.GetShowHide())
            driverModuleLib.LibraryCall("show-panel", libParam, null);
          else
            driverModuleLib.LibraryCall("hide-panel", libParam, null);
        }
      }

      SetComplete(true);
    }
  }

  public string GetDescription(void)
  {
    if (m_showHideHUDPanelHandler.IsEnumSet())
      return GetAsset().GetStringTable().GetString1("description_info_" + (string)m_showHideHUDPanelHandler.GetShowHide(), m_showHideHUDPanelHandler.GetItemFull());

    return inherited();
  }

};


Show/Hide Minimap
[Rules]

Show/Hide Minimap Rule

config.txt:

﻿
username            "Show/Hide Minimap"
kind              "behavior"
kuid              <kuid:-18:1248>
script              "ShowHideMinimap"
class             "ShowHideMinimap"
icon-texture            "show_hide_minimap.texture"
string-table {
  description_info_true       "<i>Show</i> the Driver Minimap window."
  description_info_false        "<i>Hide</i> the Driver Minimap window."
  minimap-onoff-html-property-true    "$0Show$1 the Driver Minimap window."
  minimap-onoff-html-property-false   "$0Hide$1 the Driver Minimap window."
  minimap-onoff-html-prefix     "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=4></td><td><font color=#000000>"
  minimap-onoff-html-sufix      "</font></td></tr></table>"
}
username-fr           "Afficher/Masquer la mini-carte"
string-table-fr {
  description_info_true       "<i>Affiche</i> la fenêtre de la mini-carte du conducteur."
  description_info_false        "<i>Masque</i> la fenêtre de la mini-carte du conducteur."

  minimap-onoff-html-property-true    "$0Afficher$1 la mini-carte du conducteur."
  minimap-onoff-html-property-false   "$0Masquer$1 la mini-carte du conducteur."
}

ShowHideMinimap.gs:

//
// ShowHideMinimap.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "Interface.gs"

//
// Rule that enables/disables the specified buttons from the Driver Main Menu (located in the top-left
// corner of the Driver screen). Once the buttons are set, the rule completes.
//
class ShowHideMinimap isclass ScenarioBehavior
{
  // HTML property handler stuff
  GenericBoolHandler m_showMiniMapHandler;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    SetStateFlags(DOES_COMPLETE, true);

    // property handler stuff
    m_showMiniMapHandler = new GenericBoolHandler();
    m_showMiniMapHandler.Init(me.GetAsset(), "minimap-onoff");
    m_showMiniMapHandler.SetBoolValue(true);

    SetPropertyHandler(m_showMiniMapHandler);
  }

  //
  // When unpaused, set the main menu options as needed (in driver only)
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      if (World.GetCurrentModule() == World.DRIVER_MODULE)
      {
        Interface.Log("# ShowHideMinimap.Pause> Setting visibility of Driver Mini-map to: " + (string)m_showMiniMapHandler.GetBoolValue());
        Interface.SetMapView(m_showMiniMapHandler.GetBoolValue());
      }
      SetComplete(true);
    }

  }

  public string GetDescription(void)
  {
    return GetAsset().GetStringTable().GetString("description_info_" + (string)m_showMiniMapHandler.GetBoolValue());
  }

};


Simultaneous List
[Rules]

Simultaneous List Rule

config.txt:

﻿
username            "Simultaneous List"
kind              "behavior"
kuid              <kuid:-18:1201>
script              "SimultaneousListRule"
class             "SimultaneousListRule"
string-table {
  html_description        "Child rules are executed simultaneously once this rules starts. Rule completes when <a href=live://property/simultaneous-mode>$0</a>."
  description         "Child rules are executed simultaneously once this rules starts."
  description_mode0       "all child rules have reached a completed state"
  description_mode1       "all child rules have reached a 'was completed' state"
  description_mode2       "one of the child rules has completed"
}
icon-texture            "folder_type.texture"
username-de           "Simultane Liste"
string-table-de {
  html_description        "Tochterregeln werden gleichzeitig ausgeführt, sobald diese Regel ausgelöst wird. Regel wird beendet wenn <a href=live://property/simultaneous-mode>$0</a>."
  description         "Tochterregeln werden gleichzeitig ausgeführt, sobald diese Regel ausgelöst wird."
  description_mode0       "alle Tochterregeln den Ausgeführt-Status erreicht haben"
  description_mode1       "alle Tochterregeln den Wurde-Ausgeführt-Status"
  description_mode2       "eine der Tochterregeln vollständig ausgeführt wurden"
}
username-it           "Elenco ordinato"
string-table-it {
  html_description
  description
  description_mode0
  description_mode1
  description_mode2
}
username-es           "Lista simultánea"
string-table-es {
  html_description        "Las reglas subsidiarias se llevan a cabo a la vez en cuanto empiezan estas reglas. La regla se completa cuando <a href=live://property/simultaneous-mode>$0</a>."
  description         "Las reglas subsidiarias se llevan a cabo a la vez en cuanto empiezan estas reglas."
  description_mode0       "todas las reglas subsidiarias se completan"
  description_mode1       "todas las reglas subsidiarias llegan al estado completado"
  description_mode2       "una de las reglas subsidiarias se ha completado"
}
username-pl           "Simultaneous List"
string-table-pl {
  html_description        "Child rules are executed simultaneously once this rules starts. Rule completes when <a href=live://property/simultaneous-mode>$0</a>."
  description         "Child rules are executed simultaneously once this rules starts."
  description_mode0       "all child rules have reached a completed state"
  description_mode1       "all child rules have reached a 'was completed' state"
  description_mode2       "one of the child rules has completed"
}
username-cz           "Souběžný seznam"
string-table-cz {
  html_description        "Při aktivaci tohoto pravidla budou současně spuštěna všechna v něm obsažená podpravidla. Pravidlo bude naplněno tehdy, když <a href=live://property/simultaneous-mode>$0</a>."
  description         "Po aktivaci tohoto pravidla budou všechna jeho podpravidla spuštěna současně."
  description_mode0       "všechna podporavidla dosáhnou stavu 'dokončeno'"
  description_mode1       "všechna podporavidla dosáhnou stavu 'bylo dokončeno'"
  description_mode2       "bude dokončeno jedno z podpravidel"
}
username-ru           "Параллельный список"
description-ru            "Подправила начнут выполняться параллельно при запуске данного правила."
string-table-ru {
  html_description        "Подправила начнут выполняться параллельно при запуске данного правила. Правило будет выполнено, когда $0."
  description         "Подправила начнут выполняться параллельно при запуске данного правила."
  description_mode0       "все подправила будут выполнены"
  description_mode1       "все подправила достигнут состояния 'были выполнены'"
  description_mode2       "одно из подправил будет выполнено"
}
username-fr           "Liste simultanée"
string-table-fr {
  html_description        "Les sous-règles s'exécutent simultanément au déclenchement de cette règle. La règle s'active lorsque <a href=live://property/simultaneous-mode>$0</a>."
  description         "Les sous-règles s'exécutent simultanément à l'activation de cette règle."
  description_mode0       "toutes les sous-règles ont été accomplies."
  description_mode1       "toutes les sous-règles ont atteint l'état 'ont été accomplies'"
  description_mode2       "l'une des sous-règle a été accomplie."
}

SimultaneousListRule.gs:

//
// SimultaneousListRule.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Once started this rule executes all child rules simultaneously.  How the rule is completed depends on its
// mode setting and there are 3 such modes:
//  0 - rule completes when all children have reached a COMPLETE state
//  1 - rule completes when all children have reached a WAS_COMPLETE state
//  2 - rule completes once the first child rule completes.  Any other remainging children will be reset.
//
// The mode is set in the rule's properties interface.
//
// Note: The entire list of child rules will be reset if this rule is paused.
//
class SimultaneousListRule isclass ScenarioBehavior
{
  void PauseChildren(void);
  void ResetChildren(void);
  void UpdateChildren(Message notUsed);

  // mode this rule operates in (see main class description for info)
  int simultaneousMode = 0;

  public void Init(Asset p_self)
  {
    inherited(p_self);

    // if one of our children is updated, we want to know about it
    AddHandler(me, "ScenarioBehavior", "Touch", "UpdateChildren");
  }

  //
  // Resets this rule - we have to allow for this rule to be a child rule to a parent list rule
  //
  public void Reset(void)
  {
    inherited();
    ResetChildren(); // reset child rules
  }

  //
  // ScenarioBehavior methods
  //

  //
  // Pause/unpause this rule.
  //
  // When unpaused, all child rules will be reset and unpaused.
  // When paused, all child rules will be paused.
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      PauseChildren();
    }
    else
    {
      ResetChildren();

      ScenarioBehavior[] child = GetChildBehaviors();
      int i;

      for (i = 0; i < child.size(); i++)
        // unpause all child rules.
        child[i].Pause(false);

      UpdateChildren(null);
    }
  }

  // pause all our children
  void PauseChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Pause(true);
  }

  //
  // clear the was-complete flag on all our kiddies
  //
  void ResetChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Reset();
  }

  //
  // rescan our kiddies and update our progress
  //
  void UpdateChildren(Message notUsed)
  {
    // once we have completed, don't retry (unless we are reset)
    if (IsComplete())
      return;

    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

/*    for (i = 0; i < child.size(); i++)
      if (!child[i].WasComplete())
      {
        // if he's already unpaused, this wont do any harm.
        child[i].Pause(false);
        return;
      }
      else
        child[i].Pause(true);*/

    // rule completes when all child rules are "COMPLETE"
    if (simultaneousMode == 0)
    {
      for (i = 0; i < child.size(); i++)
        if (!child[i].IsComplete())
          return;
    }

    // rule completes when all child rules are "WAS_COMPLETE"
    else if (simultaneousMode == 1)
    {
      for (i = 0; i < child.size(); i++)
        if (!child[i].WasComplete())
          return;
    }

    // rule completes when all child rules are "WAS_COMPLETE"
    else if (simultaneousMode == 2)
    {
      bool oneChildComplete = false;
      for (i = 0; i < child.size(); i++)
        if (child[i].IsComplete())
        {
          Interface.Log("# SimultaneousListRule> Child rule " + i + ": '" + child[i].GetAsset().GetName() + "' was first to complete, list rule now completing!");
          oneChildComplete = true;
          break;
        }

      if (!oneChildComplete)
        return;
    }
    else
      Interface.Log("# SimultaneousListRule> ERROR: Unknown rule mode: " + simultaneousMode);

    // get this far, than  we must be complete
    SetComplete(true);

    // reset children for next cycle
    ResetChildren();
    PostMessage(me, "ScenarioBehavior", "Touch", 0.0);
  }

  //
  // Property methods
  //

  //
  // Sets the mode of this rule (so we can restore from saved session)
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);
    simultaneousMode = soup.GetNamedTagAsInt("simultaneous-list-rule.simultaneous-mode");
  }

  //
  // Gets the mode of this rule from soup database so session can be saved
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();
    soup.SetNamedTag("simultaneous-list-rule.simultaneous-mode", simultaneousMode);
    return soup;
  }

  //
  // Returns HTML description.
  //
  public string GetDescriptionHTML(void)
  {
    StringTable stringTable = GetAsset().GetStringTable();
    string modeStr = stringTable.GetString("description_mode" + (string)simultaneousMode);

    return "<html><body><font color=#000000>" + stringTable.GetString1("html_description", modeStr) + "</font></body></html>";
  }

  //
  // Returns a text description
  //
  public string GetDescription(void)
  {
    return GetAsset().GetStringTable().GetString("description");
  }

  //
  // Always returns "link" - only property type used in this small rule.
  //
  string GetPropertyType(string p_propertyID)
  {
    return "link";
  }

  //
  // Acts on a link. If link is control-method, than control mode is switched.
  //
  void LinkPropertyValue(string p_propertyID)
  {
    if (p_propertyID == "simultaneous-mode")
      simultaneousMode = (simultaneousMode + 1) % 3;
  }

  //
  // Gets name of this property
  //
  string GetPropertyName(string p_propertyID)
  {
    return GetAsset().GetStringTable().GetString("description");
  }

  //
  // Gets description of the mode property
  //
  string GetPropertyDescription(string p_propertyID)
  {
    return GetAsset().GetStringTable().GetString("description");
  }

};


Startup Options
[Rules]

Startup Options Rule

config.txt:

﻿
username            "Startup Options"
kind              "behavior"
kuid              <kuid:-16:10212>
script              "StartupOptions"
class             "StartupOptions"
kuid-table {
  control-mode          <kuid:-16:2030>
}
string-table {
  html_description1       "Current control method is <a href=live://property/control-method>Cab mode</a>."
  html_description2       "Current control method is <a href=live://property/control-method>DCC mode</a>."
  html_description3       "Current control method is <a href=live://property/control-method>Ask user</a>."
  driver_default_msg        "Defaulting to DCC mode for user train."
  derail_desc_0         "None"
  derail_desc_1         "Arcade"
  derail_desc_2         "Realistic"
  derail_list_0         "None"
  derail_list_1         "Arcade"
  derail_list_2         "Realistic"
  derail_type_name        "Derailment Realism"
  derail_type_desc        "The derailment realism level."
  derail_description        "Set derailment realism to $0."
  weather_desc_0          "Clear"
  weather_desc_1          "Cloudy"
  weather_desc_2          "Drizzle"
  weather_desc_3          "Rain"
  weather_desc_4          "Stormy"
  weather_desc_5          "Light Snow"
  weather_desc_6          "Medium Snow"
  weather_desc_7          "Heavy Snow"
  weather_list_0          "Clear"
  weather_list_1          "Cloudy"
  weather_list_2          "Drizzle"
  weather_list_3          "Rain"
  weather_list_4          "Stormy"
  weather_list_5          "Light Snow"
  weather_list_6          "Medium Snow"
  weather_list_7          "Heavy Snow"
  changeability_desc_0        "No"
  changeability_desc_1        "Periodic"
  changeability_desc_2        "Extreme"
  changeability_list_0        "Off"
  changeability_list_1        "Periodic"
  changeability_list_2        "Extreme"
  weather_cond_name       "Weather Condition"
  weather_cond_desc       "The type of weather"
  weather_chng_name       "Weather Changeability"
  weather_chng_desc       "The rate at which the weather will change"
  weather_description       "Set weather to $0 with $1 changeability."
  time_rate_0         "Default"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Time Hour"
  time_hour_desc          "Hour of the day"
  time_mins_name          "Time Minute"
  time_mins_desc          "Minute of the hour"
  time_rate_name          "Time Rate"
  time_rate_desc          "Set time to $0:$1 with a rate of $2."
  description         "Specifies the starting options for the session."
  onscreen_help_text        "Show in-game help."
  onscreen_help_name        "In-game help"
  onscreen_help_desc        "Show extra in-game information for junctions, etc."
}
icon-texture            "StartupOptions.texture"
username-de           "Start-Optionen"
string-table-de {
  html_description1       "Aktuelle Steuerung ist <a href=live://property/control-method>Fahrerstandsmodus</a>."
  html_description2       "Aktuelle Steuerung ist <a href=live://property/control-method>DCC-Modus</a>."
  html_description3       "Aktuelle Steuerung ist <a href=live://property/control-method>User fragen</a>."
  driver_default_msg        "Setzt Benutzerzug automatisch auf DCC-Modus."
  derail_desc_0         "Keins"
  derail_desc_1         "Arcade"
  derail_desc_2         "Realistisch"
  derail_list_0         "Keins"
  derail_list_1         "Arcade"
  derail_list_2         "Realistisch "
  derail_type_name        "Realistische Entgleisungsdarstellung"
  derail_type_desc        "Grad der realistischen Entgleisungsdarstellung."
  derail_description        "Setzt Grad der realistischen Entgleisungsdarstellung auf $0."
  weather_desc_0          "Sonnig"
  weather_desc_1          "Bewölkt"
  weather_desc_2          "Nieselregen"
  weather_desc_3          "Regen"
  weather_desc_4          "Sturm"
  weather_desc_5          "Leichter Schneefall"
  weather_desc_6          "Mittlerer Schneefall"
  weather_desc_7          "Schwerer Schneefall"
  weather_list_0          "Sonnig"
  weather_list_1          "Bewölkt"
  weather_list_2          "Nieselregen"
  weather_list_3          "Regen"
  weather_list_4          "Sturm"
  weather_list_5          "Leichter Schneefall"
  weather_list_6          "Mittlerer Schneefall"
  weather_list_7          "Schwerer Schneefall"
  changeability_desc_0        "Keine"
  changeability_desc_1        "Periodische"
  changeability_desc_2        "Extreme"
  changeability_list_0        "Keine"
  changeability_list_1        "Periodische"
  changeability_list_2        "Extreme"
  weather_cond_name       "Wetterbedingungen"
  weather_cond_desc       "Die Art des Wetters"
  weather_chng_name       "Wechselhaftigkeit des Wetters"
  weather_chng_desc       "Die Wahrscheinlichkeit, nach der das Wetter sich ändern wird"
  weather_description       "Setze Wetter auf $0 an, mit $1 Wechselhaftigkeit."
  time_rate_0         "Voreinstellung"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Stunden"
  time_hour_desc          "Tageszeit"
  time_mins_name          "Minuten"
  time_mins_desc          "Minuten einer Stunde"
  time_rate_name          "Stundenlohn"
  time_rate_desc          "Zeit wird auf $0:$1 gesetzt, mit einem Satz von $2."
  description         "Legt die Anfangs-Optionen für diese Sitzung fest."
  onscreen_help_text        "Im-Spiel-Hilfe anzeigen."
  onscreen_help_name        "Im-Spiel-Hilfe"
  onscreen_help_desc        "Zusätzliche Im-Spiel-Informationen über Weichen, etc. anzeigen"
}
username-it           "Startup Options"
string-table-it {
  html_description1       "L'attuale metodo di controllo è <a href=live://property/control-method>Modalità Cabina</a>."
  html_description2       "L'attuale metodo di controllo è <a href=live://property/control-method>Modalità CCD</a>."
  html_description3       "L'attuale metodo di controllo è <a href=live://property/control-method>Chiedi all'utente</a>."
  driver_default_msg        "Modalità CCD predefinita per il treno utente."
  derail_desc_0         "Nessuno"
  derail_desc_1         "Arcade"
  derail_desc_2         "Realistico"
  derail_list_0         "Nessuno"
  derail_list_1         "Arcade"
  derail_list_2         "Realistico"
  derail_type_name        "Realismo deragliamento"
  derail_type_desc        "Livello realismo deragliamento."
  derail_description        "Set derailment realism to $0."
  weather_desc_0          "Sereno"
  weather_desc_1          "Nuvoloso"
  weather_desc_3          "Pioggia"
  weather_desc_4          "Tempesta"
  weather_desc_5          "Neve leggera"
  weather_desc_6          "Neve media"
  weather_desc_7          "Neve abbondante"
  weather_list_0          "Sereno"
  weather_list_1          "Nuvoloso"
  weather_list_2          "Pioviggine"
  weather_list_3          "Pioggia"
  weather_list_4          "Tempesta"
  weather_list_5          "Neve leggera"
  weather_list_6          "Neve media"
  weather_list_7          "Neve abbondante"
  changeability_desc_0        "No"
  changeability_desc_1        "Periodica"
  changeability_desc_2        "Estrema"
  changeability_list_0        "Nessuna"
  changeability_list_1        "Periodica"
  changeability_list_2        "Estrema"
  weather_cond_name       "Condizioni meteo"
  weather_cond_desc       "Tipo di tempo"
  weather_chng_name       "Variabilità del tempo"
  weather_chng_desc       "La frequenza con la quale il tempo varia"
  weather_description       "Imposta il meteo su $0 con variabilità $1."
  time_rate_0         "Predefinito"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Ora"
  time_hour_desc          "Ora del giorno"
  time_mins_name          "Minuto"
  time_mins_desc          "Minuto nell'ora"
  time_rate_name          "Frequenza"
  time_rate_desc          "Imposta l'ora a $0:$1 con una frequenza di $2."
  description         "Specifies the starting options for the session."
  onscreen_help_text        "Show in-game help."
  onscreen_help_name        "In-game help"
  onscreen_help_desc        "Show extra in-game information for junctions, etc."
}
username-es           "Opciones de inicio"
string-table-es {
  html_description1       "El método de control actual es <a href=live://property/control-method>Modo de Cabina</a>."
  html_description2       "El método de control actual es <a href=live://property/control-method>Modo DCC</a>."
  html_description3       "El método de control actual es <a href=live://property/control-method>Preguntar al usuario</a>."
  driver_default_msg        "Predeterminando modo DCC para el tren del usuario."
  derail_desc_0         "Ninguno"
  derail_desc_1         "Arcade"
  derail_desc_2         "Realista"
  derail_list_0         "Ninguno"
  derail_list_1         "Arcade"
  derail_list_2         "Realista"
  derail_type_name        "Realismo del descarrilamiento"
  derail_type_desc        "El nivel de realismo del descarrilamiento."
  derail_description        "Establecer el realismo del descarrilamiento en $0."
  weather_desc_0          "Despejado"
  weather_desc_1          "Nuboso"
  weather_desc_2          "Llovizna"
  weather_desc_3          "Lluvia"
  weather_desc_4          "Tormentoso"
  weather_desc_5          "Aguanieve"
  weather_desc_6          "Nevada"
  weather_desc_7          "Nevada intensa"
  weather_list_0          "Despejado"
  weather_list_1          "Nuboso"
  weather_list_2          "Llovizna"
  weather_list_3          "Lluvia"
  weather_list_4          "Tormentoso"
  weather_list_5          "Aguanieve"
  weather_list_6          "Nevada"
  weather_list_7          "Nevada intensa"
  changeability_desc_0        "No"
  changeability_desc_1        "Periódica"
  changeability_desc_2        "Total"
  changeability_list_0        "No"
  changeability_list_1        "Periódica"
  changeability_list_2        "Total"
  weather_cond_name       "Estado climático"
  weather_cond_desc       "El tipo de tiempo"
  weather_chng_name       "Mutabilidad climática"
  weather_chng_desc       "El ritmo al que cambiará el clima"
  weather_description       "Poner el clima en $0 con mutabilidad $1."
  time_rate_0         "Por defecto"
  time_rate_1         "x1"
  time_rate_2         "x2"
  time_rate_3         "x4"
  time_rate_4         "x8"
  time_rate_5         "x16"
  time_rate_6         "x32"
  time_rate_7         "x60"
  time_rate_8         "x120"
  time_rate_9         "x240"
  time_rate_10          "x360"
  time_rate_11          "x480"
  time_rate_12          "x720"
  time_rate_13          "x960"
  time_rate_14          "x1200"
  time_rate_15          "x1440"
  time_hour_name          "Tiempo, hora"
  time_hour_desc          "Hora del día"
  time_mins_name          "Tiempo, minuto"
  time_mins_desc          "Minuto de la hora"
  time_rate_name          "Transcurso del tiempo:"
  time_rate_desc          "Poner la hora en $0:$1 con un transcurso de $2."
  description         "Especifica las opciones de inicio de la sesión"
  onscreen_help_text        "Mostrar ayuda del juego."
  onscreen_help_name        "Ayuda del juego"
  onscreen_help_desc        "Muestra información adicional del juego para cruces, desvíos, etc."
}
username-pl           "Startup Options"
string-table-pl {
  html_description1       "Current control method is <a href=live://property/control-method>Cab mode</a>."
  html_description2       "Current control method is <a href=live://property/control-method>DCC mode</a>."
  html_description3       "Current control method is <a href=live://property/control-method>Ask user</a>."
  derail_desc_0         "None"
  derail_desc_1         "Arcade"
  derail_desc_2         "Realistic"
  derail_list_0         "None"
  derail_list_1         "Arcade"
  derail_list_2         "Realistic"
  derail_type_name        "Derailment Realism"
  derail_type_desc        "The derailment realism level."
  derail_description        "Set derailment realism to $0."
  weather_desc_0          "Clear"
  weather_desc_1          "Cloudy"
  weather_desc_2          "Drizzle"
  weather_desc_3          "Rain"
  weather_desc_4          "Stormy"
  weather_desc_5          "Light Snow"
  weather_desc_6          "Medium Snow"
  weather_desc_7          "Heavy Snow"
  weather_list_0          "Clear"
  weather_list_1          "Cloudy"
  weather_list_2          "Drizzle"
  weather_list_3          "Rain"
  weather_list_4          "Stormy"
  weather_list_5          "Light Snow"
  weather_list_6          "Medium Snow"
  weather_list_7          "Heavy Snow"
  changeability_desc_0        "No"
  changeability_desc_1        "Periodic"
  changeability_desc_2        "Extreme"
  changeability_list_0        "Off"
  changeability_list_1        "Periodic"
  changeability_list_2        "Extreme"
  weather_cond_name       "Weather Condition"
  weather_cond_desc       "The type of weather"
  weather_chng_name       "Weather Changeability"
  weather_chng_desc       "The rate at which the weather will change"
  weather_description       "Set weather to $0 with $1 changeability."
  time_rate_0         "Default"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Time Hour"
  time_hour_desc          "Hour of the day"
  time_mins_name          "Time Minute"
  time_mins_desc          "Minute of the hour"
  time_rate_name          "Time Rate"
  time_rate_desc          "Set time to $0:$1 with a rate of $2."
}
username-cz           "Počáteční hodnoty"
string-table-cz {
  html_description1       "Aktuální způsob ovládání je <a href=live://property/control-method>Cab mode</a>."
  html_description2       "Aktuální způsob ovládání je <a href=live://property/control-method>DCC mode</a>."
  html_description3       "Aktuální způsob ovládání je <a href=live://property/control-method>Ask user</a>."
  driver_default_msg        "Standardní ovládání pro uživatelský vlak je DCC ovladač."
  derail_desc_0         "žádná"
  derail_desc_1         "nízká"
  derail_desc_2         "realistická"
  derail_list_0         "žádná"
  derail_list_1         "nízká"
  derail_list_2         "realistická"
  derail_type_name        "Pravděpodobnost vykolejení"
  derail_type_desc        "Úroveň pravděpodobnosti vykolejení vlaku."
  derail_description        "Nastaví pravděpodobnost vykolejení na hodnotu $0."
  weather_desc_0          "Jasno"
  weather_desc_1          "Oblačno"
  weather_desc_2          "Mrholení"
  weather_desc_3          "Déšť"
  weather_desc_4          "Bouře"
  weather_desc_5          "Sněhové přeháňky"
  weather_desc_6          "Sněžení"
  weather_desc_7          "Sněhová bouře"
  weather_list_0          "Jasno"
  weather_list_1          "Oblačno"
  weather_list_2          "Mrholení"
  weather_list_3          "Déšť"
  weather_list_4          "Bouře"
  weather_list_5          "Sněhové přeháňky"
  weather_list_6          "Sněžení"
  weather_list_7          "Sněhová bouře"
  changeability_desc_0        "Žádné"
  changeability_desc_1        "Pravidelné"
  changeability_desc_2        "Extrémní"
  changeability_list_0        "Vypnuto"
  changeability_list_1        "Pravidlené"
  changeability_list_2        "Extrémní"
  weather_cond_name       "Počasí"
  weather_cond_desc       "Druh počasí"
  weather_chng_name       "Proměnlivost počasí"
  weather_chng_desc       "Pravděpodobnost změny počasí"
  weather_description       "Nastaví počasí na $0 s $1 proměnlivostí."
  time_rate_0         "Standardní"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Hodina"
  time_hour_desc          "Hodina"
  time_mins_name          "Minuta"
  time_mins_desc          "Minuta"
  time_rate_name          "Rychlost plynutí času"
  time_rate_desc          "Nastaví čas na $0:$1 a rychlost jeho plynutí na $2."
  description         "Definuje počáteční hodnoty pro aktuální hru."
  onscreen_help_text        "Zobrazí herní nápovědu."
  onscreen_help_name        "Herní nápověda"
  onscreen_help_desc        "Zobrazí doplňkové informace pro výhybky apod."
}
username-ru           "Опции запуска"
description-ru            "Опции начала сессии."
string-table-ru {
  html_description1       "Текущий метод управления - Режим кабины."
  html_description2       "Текущий метод управления - Упрощенное управление."
  html_description3       "Текущий метод управления - Спросить пользователя."
  driver_default_msg        "По умолчанию установлено цифровое управление."
  derail_desc_0         "Упрощенный"
  derail_desc_1         "Игровой"
  derail_desc_2         "Реальный"
  derail_list_0         "Упрощенный"
  derail_list_1         "Игровой"
  derail_list_2         "Реальный"
  derail_type_name        "Реализм схода с рельсов"
  derail_type_desc        "Уровень реализма схода с рельсов."
  derail_description        "Установить реализм схода с рельсов в '$0'."
  weather_desc_0          "Ясно"
  weather_desc_1          "Облачно"
  weather_desc_2          "Изморось"
  weather_desc_3          "Дождь"
  weather_desc_4          "Непогода"
  weather_desc_5          "Слабый снег"
  weather_desc_6          "Снег"
  weather_desc_7          "Метель"
  weather_list_0          "Ясно"
  weather_list_1          "Облачно"
  weather_list_2          "Изморось"
  weather_list_3          "Дождь"
  weather_list_4          "Непогода"
  weather_list_5          "Слабый снег"
  weather_list_6          "Снег"
  weather_list_7          "Метель"
  changeability_desc_0        "Без изменения"
  changeability_desc_1        "Периодическая"
  changeability_desc_2        "Крайне изменчивая"
  changeability_list_0        "Без изменения"
  changeability_list_1        "Периодическая"
  changeability_list_2        "Крайне изменчивая"
  weather_cond_name       "Климат"
  weather_cond_desc       "Тип погоды"
  weather_chng_name       "Изменчивость погоды"
  weather_chng_desc       "Скорость, с которой будет меняться погода"
  weather_description       "Установить тип погоды '$0' с моделью поведения '$1'."
  time_rate_0         "По умолчанию"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Час"
  time_hour_desc          "Час дня"
  time_mins_name          "Минута"
  time_mins_desc          "Минута в часе"
  time_rate_name          "Скорость игрового времени"
  time_rate_desc          "Установит время $0:$1 со скоростью игрового времени $2."
  description         "Опции начала сессии."
  onscreen_help_text        "Показывать справку во время игры."
  onscreen_help_name        "Справка во время игры"
  onscreen_help_desc        "Показывать дополнительную информацию о стрелакх итд итп."
}
username-fr           "Options de démarrage"
string-table-fr {
  html_description1       "Méthode de contrôle actuelle : <a href=live://property/control-method>mode Cabine</a>."
  html_description2       "Méthode de contrôle actuelle : <a href=live://property/control-method>mode DCC</a>."
  html_description3       "Méthode de contrôle actuelle : <a href=live://property/control-method>Demander à l'utilisateur</a>."
  driver_default_msg        "Mode DCC activé par défaut pour le train de l'utilisateur."
  derail_desc_0         "Aucun"
  derail_desc_1         "Arcade"
  derail_desc_2         "Réaliste"
  derail_list_0         "Aucun"
  derail_list_1         "Arcade"
  derail_list_2         "Réaliste"
  derail_type_name        "Niveau de déraillement"
  derail_type_desc        "Le niveau de déraillement."
  derail_description        "Règle le niveau de déraillement sur $0."
  weather_desc_0          "Clair"
  weather_desc_1          "Nuageux"
  weather_desc_2          "Bruine"
  weather_desc_3          "Pluie"
  weather_desc_4          "Tempête"
  weather_desc_5          "Neige légère"
  weather_desc_6          "Neige moyenne"
  weather_desc_7          "Neige abondante"
  weather_list_0          "Clair"
  weather_list_1          "Nuageux"
  weather_list_2          "Bruine"
  weather_list_3          "Pluie"
  weather_list_4          "Tempête"
  weather_list_5          "Neige légère"
  weather_list_6          "Neige moyenne"
  weather_list_7          "Neige abondante"
  changeability_desc_0        "Aucun"
  changeability_desc_1        "Périodique"
  changeability_desc_2        "Fréquent"
  changeability_list_0        "Aucun"
  changeability_list_1        "Périodique"
  changeability_list_2        "Fréquent"
  weather_cond_name       "Conditions météorologiques"
  weather_cond_desc       "Le type de temps"
  weather_chng_name       "Variation météo"
  weather_chng_desc       "La fréquence des variations météo."
  weather_description       "Temps réglé sur $0 avec une fréquence de variation de $1"
  time_rate_0         "Par défaut"
  time_rate_1         "x1"
  time_rate_2         "x2"
  time_rate_3         "x4"
  time_rate_4         "x8"
  time_rate_5         "x16"
  time_rate_6         "x32"
  time_rate_7         "x60"
  time_rate_8         "x120"
  time_rate_9         "x240"
  time_rate_10          "x360"
  time_rate_11          "x480"
  time_rate_12          "x720"
  time_rate_13          "x960"
  time_rate_14          "x1200"
  time_rate_15          "x1440"
  time_hour_name          "Temps heure"
  time_hour_desc          "Heure du jour"
  time_mins_name          "Temps minute"
  time_mins_desc          "Minute de l'heure"
  time_rate_name          "Rythme du temps"
  time_rate_desc          "Règle le temps sur $0:$1 avec un rythme de $2."
  description         "Définit les options de démarrage pour la session."
  onscreen_help_text        "Affiche l'aide en cours de jeu."
  onscreen_help_name        "Aide en cours de jeu"
  onscreen_help_desc        "Affiche les informations supplémentaires en cours de partie concernant les jonctions, etc."
}

StartupOptions.gs:

//
// StartupOptions.gs
//
//  Copyright (C) 2003-2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Rule that allows the control mode for a profile to be set (DCC or Cab).
//
class StartupOptions isclass ScenarioBehavior
{
  // control mode setting - 1 for DCC (default), 0 for Cab, 2 for user-select
  int controlMethod = 2;
  int weatherType = 0;
  int weatherChangeability = 0;

  int hour=10;
  int mins=0;
  int rate=1;

  int derailType = 0;

  bool m_showOnscreenHelp = true;

  // Called to allow user to select control mode themselves.
  thread void UserSelectControlMode(void);

  //
  // ScenarioBehavior methods
  //

  //
  // Pause/unpause this rule.  When unpaused, reset control mode of Trainz environment to
  // whatever this rule is currently set to.
  //
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      // immediately hide the existing browser
      PostMessage(me, "ControlTypeRule", "Close", 0.0);
    }
    else if (!IsComplete())
    {
      //
      // Weather
      //
      World.SetWeather(weatherType, weatherChangeability);

      //
      // Time and Rate
      //

      // Calculate time as a value from 0 to 1, where 0 is midday and 0.5 is midnight.
      float time;
      if (hour < 12)
        time = 0.5 + hour / 24.0 + mins / 1440.0;
      else
        time = (hour - 12) / 24.0 + mins / 1440.0;

      World.SetGameTime(time);

      // Set time rate if not default rate.
      if (rate > 0)
        World.SetGameTimeRate(rate-1);
      else // set to default of 1X (0)
        World.SetGameTimeRate(rate);

      //
      // Derailment Realism
      //
      World1.SetDerailLevel(derailType);

      //
      // Onscreen Help
      //
      Interface.ShowOnScreenHelp(m_showOnscreenHelp);

      //
      // Control Type
      //

      if (controlMethod == 0)
      {
        // Cab
        Interface.Log("# StartupOptionsRule.Pause> activating 'Cab' mode");
        World1.SetDCCMode(0);
        //World1.SetDerailLevel(2);
        SetComplete(true);
      }
      else if (controlMethod == 1)
      {
        // DCC
        Interface.Log("# StartupOptionsRule.Pause> activating 'DCC' mode");
        World1.SetDCCMode(1);
        //World1.SetDerailLevel(0);
        SetComplete(true);
      }
      else
      {
        // User select
        Interface.Log("# StartupOptionsRule.Pause> requesting user selection");
        UserSelectControlMode();
      }
    }
  }

  //
  // PropertyObject methods
  //

  //
  // Sets the control method of this rule from the given database.
  //
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    controlMethod = soup.GetNamedTagAsInt("StartupOptions.controlMethod", controlMethod);

    weatherType = soup.GetNamedTagAsInt("StartupOptions.weatherType", weatherType);
    weatherChangeability = soup.GetNamedTagAsInt("StartupOptions.changeability", weatherChangeability);

    hour = soup.GetNamedTagAsInt("StartupOptions.hour", hour);
    mins = soup.GetNamedTagAsInt("StartupOptions.mins", mins);
    rate = soup.GetNamedTagAsInt("StartupOptions.rate", rate);

    derailType = soup.GetNamedTagAsInt("StartupOptions.derailType", derailType);

    m_showOnscreenHelp = soup.GetNamedTagAsBool("StartupOptions.showOnscreenHelp", m_showOnscreenHelp);
  }

  //
  // Gets the control method of this rule and saves it to a new database.
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("StartupOptions.controlMethod", controlMethod);

    soup.SetNamedTag("StartupOptions.weatherType", weatherType);
    soup.SetNamedTag("StartupOptions.changeability", weatherChangeability);

    soup.SetNamedTag("StartupOptions.hour", hour);
    soup.SetNamedTag("StartupOptions.mins", mins);
    soup.SetNamedTag("StartupOptions.rate", rate);

    soup.SetNamedTag("StartupOptions.derailType", derailType);

    soup.SetNamedTag("StartupOptions.showOnscreenHelp", m_showOnscreenHelp);

    return soup;
  }

  //
  // Returns HTML code with link that allows control mode to be changed.
  //
  public string GetDescriptionHTML(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string body = "<html><body><font color=#000000>";

    string controlMethodStr;
    if (controlMethod == 0)
      controlMethodStr = "html_description1";
    else if (controlMethod == 1)
      controlMethodStr = "html_description2";
    else
      controlMethodStr = "html_description3";

    body = body + "<p>" + strTable.GetString(controlMethodStr) + "</p>";

    string typeStr = "<a href=live://property/type>" + strTable.GetString("weather_desc_" + weatherType) + "</a>";
    string changeabilityStr = "<a href=live://property/changeability>" + strTable.GetString("changeability_desc_" + weatherChangeability) + "</a>";

    body = body + "<p>" + strTable.GetString2("weather_description", typeStr, changeabilityStr) + "</p>";

    string rateStr = "<a href=live://property/rate>" + strTable.GetString("time_rate_" + rate) + "</a>";
    string timeStr = "<a href=live://property/hour>" + hour + "</a>";

    string minsStr = "<a href=live://property/mins>";
    if (mins < 10) minsStr = minsStr + "0";
    minsStr = minsStr + mins + "</a>";

    body = body + "<p>" + strTable.GetString3("time_rate_desc", timeStr, minsStr, rateStr) + "</p>";

    string derailStr = "<a href=live://property/derailment>" + strTable.GetString("derail_desc_" + derailType) + "</a>";
    body = body + "<p>" + strTable.GetString1("derail_description", derailStr) + "</p>";

    body = body + "<p>" + HTMLWindow.CheckBox("live://property/onscreen-help", m_showOnscreenHelp) + strTable.GetString("onscreen_help_text") + "</p>";

    body = body + "</font></body></html>";
    return body;
  }

  //
  //
  string GetPropertyType(string p_propertyID)
  {
    if (p_propertyID == "control-method")
      return "link";

    if (p_propertyID == "type")
      return "list";
    if (p_propertyID == "changeability")
      return "list";

    if (p_propertyID == "hour")
      return "int,0,23,1";

    if (p_propertyID == "mins")
      return "int,0,59,1";

    if (p_propertyID == "rate")
      return "list";

    if (p_propertyID == "derailment")
      return "list";

    if (p_propertyID == "onscreen-help")
      return "link";

    return "null";
  }

  //
  // Acts on a link. If link is control-method, than control mode is switched.
  //
  void LinkPropertyValue(string p_propertyID)
  {
    if (p_propertyID == "control-method")
    {
      controlMethod = (controlMethod + 1) % 3;
      World1.SetDCCMode(controlMethod);
    }
    else if (p_propertyID == "onscreen-help")
    {
      m_showOnscreenHelp = !m_showOnscreenHelp;
    }
  }

  string GetPropertyName(string p_propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (p_propertyID == "type")
      return strTable.GetString("weather_cond_name");

    if (p_propertyID == "changeability")
      return strTable.GetString("weather_chng_name");

    if (p_propertyID == "hour")
      return strTable.GetString("time_hour_name");

    if (p_propertyID == "mins")
      return strTable.GetString("time_mins_name");

    if (p_propertyID == "rate")
      return strTable.GetString("time_rate_name");

    if (p_propertyID == "derailment")
      return strTable.GetString("derail_type_name");

    if (p_propertyID == "onscreen-help")
      return strTable.GetString("onscreen_help_name");

    return strTable.GetString1("property_name", p_propertyID);
  }

  string GetPropertyDescription(string p_propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (p_propertyID == "control-method")
      return strTable.GetString("control_method_desc");

    if (p_propertyID == "type")
      return strTable.GetString("weather_cond_desc");

    if (p_propertyID == "changeability")
      return strTable.GetString("weather_chng_desc");

    if (p_propertyID == "hour")
      return strTable.GetString("time_hour_desc");

    if (p_propertyID == "mins")
      return strTable.GetString("time_mins_desc");

    if (p_propertyID == "rate")
      return strTable.GetString("time_rate_desc");

    if (p_propertyID == "derailment")
      return strTable.GetString("derail_type_desc");

    if (p_propertyID == "onscreen-help")
      return strTable.GetString("onscreen_help_desc");

    return "";
  }

  public string[] GetPropertyElementList(string p_propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    int i;
    string [] result = new string[0];

    if (p_propertyID == "type")
    {
      for (i = 0; i < 8; ++i)
        result[i] = strTable.GetString("weather_list_"+i);
    }

    else if (p_propertyID == "changeability")
    {
      for (i = 0; i < 3; ++i)
        result[i] = strTable.GetString("changeability_list_"+i);
    }

    else if (p_propertyID == "rate")
    {
      int i;
      for (i = 0; i < 16; ++i)
        result[i] = strTable.GetString("time_rate_" + i);
    }

    else if (p_propertyID == "derailment")
    {
      for (i = 0; i < 8; ++i)
        result[i] = strTable.GetString("derail_list_"+i);
    }

    return result;
  }

  void SetPropertyValue(string p_propertyID, string p_value, int p_index)
  {
    // Get index of resulting property.
    if (p_propertyID == "type")
    {
      if (p_index < 0 or p_index > 7)
        p_index = 0;

      weatherType = p_index;
    }

    else if (p_propertyID == "changeability")
    {
      if (p_index < 0 or p_index > 2)
        p_index = 0;

      weatherChangeability = p_index;
    }

    else if (p_propertyID == "rate")
    {
      if (p_index < 0 or p_index > 15)
        p_index = 0;

      rate = p_index;
    }

    else if (p_propertyID == "derailment")
    {
      if (p_index < 0 or p_index > 2)
        p_index = 0;

      derailType = p_index;
    }
  }

  void SetPropertyValue(string p_propertyID, int p_value)
  {
    if (p_propertyID == "hour")
    {
      if (p_value < 0 or p_value > 23)
        p_value = 0;

      hour = p_value;
    }

    else if (p_propertyID == "mins")
    {
      if (p_value < 0 or p_value > 59)
        p_value = 0;

      mins = p_value;
    }
  }

  string GetPropertyValue(string p_propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    string result = "";
    if (p_propertyID == "hour")
    {
      result = hour;
    }
    else if (p_propertyID == "mins")
    {
      result = mins;
    }
    else if (p_propertyID == "rate")
    {
      result = strTable.GetString("time_rate_" + rate);
    }

    return result;
  }

  //
  // Ask the user select the control mode.
  //
  thread void UserSelectControlMode(void)
  {
    Message msg;
    Browser browser = Constructors.NewBrowser();
    browser.SetScrollEnabled(false);
    browser.LoadHTMLFile(GetAsset().FindAsset("control-mode"), "query.html");
    StringTable strTable = GetAsset().GetStringTable();

    // wait for user to select a mode...
    wait ()
    {
      // user has chosen DCC control mode
      on "Browser-URL", "live://DCC", msg:
      {
        if (msg.src != browser)
        {
          msg.src = null;
          continue;
        }

        Interface.Log("# StartupOptionsRule> INFO: DCC mode selected!");

        // in DCC mode, we make it easy with physics and derailments
        World1.SetDCCMode(true);
        //World1.SetDerailLevel(0);
        SetComplete(true);
        break;
      }

      // user has chosen Cabin control mode
      on "Browser-URL", "live://Cabin", msg:
      {
        if (msg.src != browser)
        {
          msg.src = null;
          continue;
        }

        Interface.Log("# StartupOptionsRule> INFO: Cabin mode selected!");

        // in Cabin control mode, we use proper physics and hard derail mode
        World1.SetDCCMode(false);
        //World1.SetDerailLevel(2);
        SetComplete(true);
        break;
      }

      // default to DCC if user closes window without choosing...
      on "Browser-Closed", "", msg :
      {
        if (msg.src != browser)
        {
          msg.src = null;
          continue;
        }

        Interface.Print(strTable.GetString("driver_default_msg"));
        Interface.Log("# StartupOptionsRule> INFO: Window closed, defaulting to DCC mode!");

        // in DCC mode, we make it easy with physics and derailments
        World1.SetDCCMode(true);
        //World1.SetDerailLevel(0);
        SetComplete(true);
        break;
      }

      on "ControlTypeRule", "Close":
        // this rule has become paused, abort!
        break;
    }
  }

};


Time and Rate
[Rules]

Time and Rate Rule

config.txt:

﻿
username            "Time and Rate"
kind              "behavior"
kuid              <kuid:-3:10113>
script              "TimeRateRule"
class             "TimeRateRule"
string-table {
  time_rate_0         "Default"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Time Hour"
  time_hour_desc          "Hour of the day"
  time_mins_name          "Time Minute"
  time_mins_desc          "Minute of the hour"
  time_rate_name          "Time Rate"
  time_rate_desc          "The rate at which the days will pass"
  description         "Set time to $0:$1 with a rate of $2."
  property_name         "Property '$0'"
}
icon-texture            "time_type.texture"
username-de           "Zeit und Geschwindigkeit"
string-table-de {
  time_rate_0         "Voreinstellung"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Stunden"
  time_hour_desc          "Tageszeit"
  time_mins_name          "Minuten"
  time_mins_desc          "Minuten einer Stunde"
  time_rate_name          "Stundenlohn"
  time_rate_desc          "Die Rate, mit der die Tage vergehen."
  description         "Zeit wird auf $0:$1 gesetzt, mit einem Satz von $2."
  property_name         "Eigentum '$0'"
}
username-it           "Regola tempo e frequenza"
string-table-it {
  time_rate_0         "Predefinito"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Ora"
  time_hour_desc          "Ora del giorno"
  time_mins_name          "Minuto"
  time_mins_desc          "Minuto nell'ora"
  time_rate_name          "Frequenza"
  time_rate_desc          "La frequenza con la quale il giorno scorre"
  description         "Imposta l'ora a $0:$1 con una frequenza di $2."
  property_name         "Proprietà '$0'"
}
username-es           "Tiempo y transcurso"
string-table-es {
  time_rate_0         "Por defecto"
  time_rate_1         "x1"
  time_rate_2         "x2"
  time_rate_3         "x4"
  time_rate_4         "x8"
  time_rate_5         "x16"
  time_rate_6         "x32"
  time_rate_7         "x60"
  time_rate_8         "x120"
  time_rate_9         "x240"
  time_rate_10          "x360"
  time_rate_11          "x480"
  time_rate_12          "x720"
  time_rate_13          "x960"
  time_rate_14          "x1200"
  time_rate_15          "x1440"
  time_hour_name          "Tiempo, hora"
  time_hour_desc          "Hora del día"
  time_mins_name          "Tiempo, minuto"
  time_mins_desc          "Minuto de la hora"
  time_rate_name          "Transcurso del tiempo:"
  time_rate_desc          "El ritmo al que transcurren los días"
  description         "Poner la hora en $0:$1 con un transcurso de $2."
  property_name         "Propiedad '$0'"
}
username-pl           "Zasady upływu czasu"
string-table-pl {
  time_rate_0         "Domyślny"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Godzina"
  time_hour_desc          "Godzina doby"
  time_mins_name          "Minuta"
  time_mins_desc          "Minuta godziny"
  time_rate_name          "Tempo upływu czasu"
  time_rate_desc          "Tempo upływu czasu, czyli szybkość mijania dni"
  description         "Ustaw godzinę $0:$1 z tempem upływu czasu $2."
  property_name         "Obiekt '$0'"
}
username-cz           "Pravidlo času"
string-table-cz {
  time_rate_0         "Standardní"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Hodina"
  time_hour_desc          "Hodina"
  time_mins_name          "Minuta"
  time_mins_desc          "Minuta"
  time_rate_name          "Rychlost plynutí času"
  time_rate_desc          "Rychlost, jakou ve hře plyne čas."
  description         "Nastaví čas na $0:$1 a rychlost jeho plynutí na $2."
  property_name         "Hodnota '$0'"
}
username-ru           "Время и скорость"
description-ru            "Установить время на $0:$1 со скоростью $2."
string-table-ru {
  time_rate_0         "По умолчанию"
  time_rate_1         "1x"
  time_rate_2         "2x"
  time_rate_3         "4x"
  time_rate_4         "8x"
  time_rate_5         "16x"
  time_rate_6         "32x"
  time_rate_7         "60x"
  time_rate_8         "120x"
  time_rate_9         "240x"
  time_rate_10          "360x"
  time_rate_11          "480x"
  time_rate_12          "720x"
  time_rate_13          "960x"
  time_rate_14          "1200x"
  time_rate_15          "1440x"
  time_hour_name          "Время: часы"
  time_hour_desc          "Часы"
  time_mins_name          "Время: минуты"
  time_mins_desc          "Минуты"
  time_rate_name          "Скорость времени"
  time_rate_desc          "Скорость течения времени"
  description         "Установить время на $0:$1 со скоростью $2."
  property_name         "Свойство '$0'"
}
username-fr           "Temps et rythme"
string-table-fr {
  time_rate_0         "Par défaut"
  time_rate_1         "x1"
  time_rate_2         "x2"
  time_rate_3         "x4"
  time_rate_4         "x8"
  time_rate_5         "x16"
  time_rate_6         "x32"
  time_rate_7         "x60"
  time_rate_8         "x120"
  time_rate_9         "x240"
  time_rate_10          "x360"
  time_rate_11          "x480"
  time_rate_12          "x720"
  time_rate_13          "x960"
  time_rate_14          "x1200"
  time_rate_15          "x1440"
  time_hour_name          "Temps heure"
  time_hour_desc          "Heure du jour"
  time_mins_name          "Temps minute"
  time_mins_desc          "Minute de l'heure"
  time_rate_name          "Rythme du temps"
  time_rate_desc          "Le rythme auquel les jours passent"
  description         "Règle le temps sur $0:$1 avec un rythme de $2."
  property_name         "Propriété '$0'"
}

TimeRateRule.gs:

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Asset.gs"

class TimeRateRule isclass ScenarioBehavior
{
  Asset asset;

  int hour=10;
  int mins=0;
  int rate=1;

  //
  // PropertyObject methods
  //

  public void Init(Asset p_self)
  {
    asset = p_self;
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    hour = soup.GetNamedTagAsInt("TimeRateRule.hour");
    mins = soup.GetNamedTagAsInt("TimeRateRule.mins");
    rate = soup.GetNamedTagAsInt("TimeRateRule.rate");
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("TimeRateRule.hour", hour);
    soup.SetNamedTag("TimeRateRule.mins", mins);
    soup.SetNamedTag("TimeRateRule.rate", rate);

    return soup;
  }

  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      SetComplete(true);

      // Calculate time as a value from 0 to 1, where 0 is midday and 0.5 is midnight.
      float time;
      if (hour < 12)
        time = 0.5 + hour / 24.0 + mins / 1440.0;
      else
        time = (hour - 12) / 24.0 + mins / 1440.0;

      World.SetGameTime(time);

      // Set time rate if not default rate.
      if (rate > 0)
        World.SetGameTimeRate(rate-1);
      else // set to default of 1X (0)
        World.SetGameTimeRate(rate);
    }
  }

  public string GetDescriptionHTML(void)
  {
    StringTable stringTable = asset.GetStringTable();
    string rateStr = "<a href=live://property/rate>" + stringTable.GetString("time_rate_" + rate) + "</a>";

    string timeStr = "<a href=live://property/hour>" + hour + "</a>";

    string minsStr = "<a href=live://property/mins>";
    if (mins < 10) minsStr = minsStr + "0";
    minsStr = minsStr + mins + "</a>";

    return "<html><body><font color=#000000>" + stringTable.GetString3("description", timeStr, minsStr, rateStr) + "</font></body></html>";
  }

  public string GetDescription(void)
  {
    StringTable stringTable = asset.GetStringTable();

    string rateStr = stringTable.GetString("time_rate_" + rate);

    string timeStr = hour;
    string minsStr = "";
    if (mins < 10)
      minsStr = minsStr + "0";
    minsStr = minsStr + mins;

    return stringTable.GetString3("description", timeStr, minsStr, rateStr);
  }

  string GetPropertyType(string p_propertyID)
  {
    if (p_propertyID == "hour")
    {
      return "int,0,23,1";
    }
    else if (p_propertyID == "mins")
    {
      return "int,0,59,1";
    }
    else if (p_propertyID == "rate")
    {
      return "list";
    }

    return "string";
  }

  string GetPropertyName(string p_propertyID)
  {
    StringTable stringTable = asset.GetStringTable();

    if (p_propertyID == "hour")
    {
      return stringTable.GetString("time_hour_name");
    }
    else if (p_propertyID == "mins")
    {
      return stringTable.GetString("time_mins_name");
    }
    else if (p_propertyID == "rate")
    {
      return stringTable.GetString("time_rate_name");
    }

    return stringTable.GetString1("property_name", p_propertyID);
  }

  string GetPropertyDescription(string p_propertyID)
  {
    StringTable stringTable = asset.GetStringTable();

    if (p_propertyID == "hour")
    {
      return stringTable.GetString("time_hour_desc");
    }
    else if (p_propertyID == "mins")
    {
      return stringTable.GetString("time_mins_desc");
    }
    else if (p_propertyID == "rate")
    {
      return stringTable.GetString("time_rate_desc");
    }

    return "";
  }

  public string[] GetPropertyElementList(string p_propertyID)
  {
    StringTable stringTable = asset.GetStringTable();

    string [] result = new string[0];

    if (p_propertyID == "rate")
    {
      int i;
      for (i = 0; i < 16; ++i)
        result[i] = stringTable.GetString("time_rate_" + i);
    }

    return result;
  }

  string GetPropertyValue(string p_propertyID)
  {
    string result = "";
    if (p_propertyID == "hour")
    {
      result = hour;
    }
    else if (p_propertyID == "mins")
    {
      result = mins;
    }
    else if (p_propertyID == "rate")
    {
      StringTable stringTable = asset.GetStringTable();
      result = stringTable.GetString("time_rate_" + rate);
    }

    return result;
  }

  void SetPropertyValue(string p_propertyID, int p_value)
  {
    if (p_propertyID == "hour")
    {
      if (p_value < 0 or p_value > 23)
        p_value = 0;

      hour = p_value;
    }
    else if (p_propertyID == "mins")
    {
      if (p_value < 0 or p_value > 59)
        p_value = 0;

      mins = p_value;
    }
  }

  void SetPropertyValue(string p_propertyID, string p_value, int p_index)
  {
    // Get index of resulting property.
    if (p_propertyID == "rate")
    {
      if (p_index < 0 or p_index > 15)
        p_index = 0;

      rate = p_index;
    }
  }
};


Trigger Check
[Rules]

Trigger Check Rule

config.txt:

﻿
username            "Trigger Check"
kind              "behavior"
kuid              <kuid:-18:1206>
script              "TriggerCheckRule"
class             "TriggerCheckRule"
icon-texture            "trigger_check_rule.texture"
string-table {
  description_html        "Waits for train to enter a designated trigger."
  description         "Waits for train to enter a designated trigger."
  description_info_any        "Waits for any train to enter one of the designated triggers."
  description_info_filter       "Waits for a train matching specific criteria to enter one of the designated triggers."
  description_info_any_trigs      "Waits for any train to enter one of the following triggers: $0"
  description_info_filter_trigs     "Waits for a train matching specific criteria to enter one of the following triggers: $0"
  html_triggers         "<b>Triggers</b><br>"
  html_add_trigger        "<a href='live://property/addtrigger'>Add Trigger</a>"
  html_trig_table_top       "<tr><td><b>Trigger Name</b></td><td></td></tr>"
  html_trig_table_row       "<tr><td>$0</td><td><a href='live://property/removetrigger/$0'>Delete</a></td></tr>"
}
username-de           "Auslöser-Überprüfung"
string-table-de {
  description_html        "Wartet darauf, dass der Zug den zugewiesenen Auslöser erreicht."
  description         "Wartet darauf, dass der Zug den zugewiesenen Auslöser erreicht."
  html_triggers         "<b>Auslöser</b><br>"
  html_add_trigger        "<a href='live://property/addtrigger'>Auslöser Hinzufügen</a>"
  html_trig_table_top       "<tr><td><b>Auslöser-Name</b></td><td></td></tr>"
  html_trig_table_row       "<tr><td>$0</td><td><a href='live://property/removetrigger/$0'>Entfernen</a></td></tr>"
}
username-it           "Trigger Check"
string-table-it {
  description_html        "Waits for train to be in the designated trigger."
  description         "Waits for train to be in the designated trigger."
  html_triggers         "<b>Triggers</b><br>"
  html_add_trigger        "<a href='live://property/addtrigger'>Add Trigger</a>"
  html_trig_table_top       "<tr><td><b>Trigger Name</b></td><td></td></tr>"
  html_trig_table_row       "<tr><td>$0</td><td><a href='live://property/removetrigger/$0'>Delete</a></td></tr>"
}
username-es           "Comprobar activadores"
string-table-es {
  description_html        "Espera a que el tren esté en el activador designado."
  description         "Espera a que el tren esté en el activador designado."
  html_triggers         "<b>Activadores</b><br>"
  html_add_trigger        "<a href='live://property/addtrigger'>Añadir activador</a>"
  html_trig_table_top       "<tr><td><b>Nombre del activador</b></td><td></td></tr>"
  html_trig_table_row       "<tr><td>$0</td><td><a href='live://property/removetrigger/$0'>Borrar</a></td></tr>"
}
username-pl           "Trigger Check"
string-table-pl {
  description_html        "Waits for train to be in the designated trigger."
  description         "Waits for train to be in the designated trigger."
  html_triggers         "<b>Triggers</b><br>"
  html_add_trigger        "<a href='live://property/addtrigger'>Add Trigger</a>"
  html_trig_table_top       "<tr><td><b>Trigger Name</b></td><td></td></tr>"
  html_trig_table_row       "<tr><td>$0</td><td><a href='live://property/removetrigger/$0'>Delete</a></td></tr>"
}
username-cz           "Kontrola aktivátoru"
string-table-cz {
  description_html        "Čeká, až se na definovaném aktivátoru bude nacházet vlak."
  description         "Čeká, až se na definovaném aktivátoru bude nacházet vlak."
  html_triggers         "<b>Aktivátory</b><br>"
  html_add_trigger        "<a href='live://property/addtrigger'>Přidat aktivátor</a>"
  html_trig_table_top       "<tr><td><b>Název aktivátoru</b></td><td></td></tr>"
  html_trig_table_row       "<tr><td>$0</td><td><a href='live://property/removetrigger/$0'>Smazat</a></td></tr>"
}
username-ru           "Ждать поезд"
description-ru            "Ждать поезд в указанном месте."
string-table-ru {
  description_html        "Ждать поезд в указанном месте."
  description         "Ждать поезд в указанном месте."
  html_triggers         "Места
"
  html_add_trigger        "Добавить место"
  html_trig_table_top       "Место"
}
username-fr           "Activation d'un interrupteur"
string-table-fr {
  description_html        "Attend qu'un train atteigne l'interrupteur indiqué."
  description         "Attend qu'un train atteigne l'interrupteur indiqué."

  description_info_any        "Waits for any train to enter one of the designated triggers."
  description_info_filter       "Waits for a train matching specific criteria to enter one of the desiginated triggers."
  description_info_any_trigs      "Waits for any train to enter one of the following triggers: $0"
  description_info_filter_trigs     "Waits for a train matching specific criteria to enter one of the following triggers: $0"

  html_triggers         "<b>Interrupteurs</b><br>"
  html_add_trigger        "<a href='live://property/addtrigger'>Ajouter interrupteur</a>"
  html_trig_table_top       "<tr><td><b>Nom de l'interrupteur</b></td><td></td></tr>"
  html_trig_table_row       "<tr><td>$0</td><td><a
href='live://property/removetrigger/$0'>Supprimer</a></td></tr>"
}

TriggerCheckRule.gs:

//
// TriggerCheckRule.gs
//
//  Copyright (C) 2004-2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ConditionalScenarioBehavior.gs"
include "TrainHelperInfo.gs"
include "common.gs"

//
// Property handler for TriggerCheckRule, manages a list of triggers
//
class TriggerCheckRuleInfo isclass HTMLPropertyHandler
{
  // list of triggers (localised object names)
  public string[] m_triggersList = new string[0];

  public bool m_runOnlyOnce = false;

  // true - rules are waited for through to completion
  // false - disrupt child rules when train leaves trigger, even if they are still running
  public bool m_childRuleStop = false;

  public bool m_directionalMode = false; // is direction-mode activated (generally, it's not used, so false by default)
  public bool m_trackDirection  = true;  // relative to track (true - train is same direction as track, false for opposite direction)

  //
  // Property handler methods
  //

  public string GetDescriptionHTML(void)
  {
    StringTable coreStrings = Constructors.GetTrainzStrings();
    string htmlPage = "";

    // checkbox for run once
    htmlPage = htmlPage + HTMLWindow.CheckBox(Link("runOnlyOnce"), m_runOnlyOnce) + " " + coreStrings.GetString("interface-helper-trigger-once") + "<br>";

    // checkbox for child rule stop/wait mode
    htmlPage = htmlPage + HTMLWindow.CheckBox(Link("childRuleStop"), m_childRuleStop) + " " + coreStrings.GetString("interface-helper-trigger-check-child") + "<br>";

    // checkbox for directional mode
    string trackDirection = coreStrings.GetString1("interface-helper-trigger-direction-" + (string)m_trackDirection, Link("trackDirection"));
    htmlPage = htmlPage + HTMLWindow.CheckBox(Link("directionalMode"), m_directionalMode) + " " + trackDirection + "<br><br>";

    // title bit
    htmlPage = htmlPage + "<table border='0' cellspacing='0' cellpadding='0'><tr><td width=3></td><td><font color=#000000>" +
               HTMLWindow.MakeBold(coreStrings.GetString("interface-helper-trigger")) + "<br>";

    // triggers table
    int listSize = m_triggersList.size();
    if (listSize > 0)
    {
      htmlPage = htmlPage + HTMLWindow.StartTable("cellpadding=2 cellspacing=2");
      int i;
      for (i = 0; i < listSize; i++)
      {
        string deleteLink = HREF("delete/" + (string)i) +
                            coreStrings.GetString("interface-helper-delete") +
                            HTMLWindow.EndLink();

        htmlPage = htmlPage + HTMLWindow.StartRow("")
                            + HTMLWindow.StartCell("") + "<font color=#000000>" + m_triggersList[i] + "</font>" + HTMLWindow.EndCell()
                            + HTMLWindow.StartCell("") + "<font color=#000000>" + deleteLink + "</font>" + HTMLWindow.EndCell()
                            + HTMLWindow.EndRow();
      }
      htmlPage = htmlPage + HTMLWindow.EndTable() + "<br>";
    }

    // add triggers link
    htmlPage = htmlPage + HREF("add")
                        + coreStrings.GetString("interface-helper-add-trigger")
                        + HTMLWindow.EndLink()
                        + "</font></td></tr></table>";

    htmlPage = "<table border='0' cellspacing='0' cellpadding='0'><tr height='1'></tr><tr><td width=1></td><td><font color=#000000>" +
                 htmlPage +
               "</font></td></tr></table><br>";

    return htmlPage;
  }

  //
  // Gets user friendle name of the given property.
  //
  public string GetPropertyName(string propertyID)
  {
    string strippedPropStr = PropStripPrefix(propertyID, "");
        string[] tokens = Str.Tokens(strippedPropStr, "/");
    StringTable coreStrings = Constructors.GetTrainzStrings();

    if (tokens[0] == "add")
      return coreStrings.GetString("interface-helper-add-trigger");

    else if (tokens[0] == "delete")
      return coreStrings.GetString("interface-helper-delete");

    return inherited(propertyID);
  }

  //
  // Gets description of the named property.
  //
  public string GetPropertyDescription(string propertyID)
  {
    string strippedPropStr = PropStripPrefix(propertyID, "");
    string[] tokens = Str.Tokens(strippedPropStr, "/");
    StringTable coreStrings = Constructors.GetTrainzStrings();

    if (tokens[0] == "add")
      return coreStrings.GetString("interface-helper-trigger-add-desc");

    else if (tokens[0] == "delete")
      return coreStrings.GetString("interface-helper-trigger-del-desc");

    return inherited(propertyID);
  }

  //
  // Gets link type for the given property
  //
  public string GetPropertyType(string propertyID)
  {
    string strippedPropStr = PropStripPrefix(propertyID, "");
    string[] tokens = Str.Tokens(strippedPropStr, "/");

    if (tokens[0] == "add")
      return "list,1";

    else if (tokens[0] == "delete")
      return "link";

    else if (tokens[0] == "runOnlyOnce")
      return "link";

    else if (tokens[0] == "childRuleStop")
      return "link";

    else if (tokens[0] == "directionalMode")
      return "link";

    else if (tokens[0] == "trackDirection")
      return "link";

    return inherited(propertyID);
  }

  //
  // Sets the named property to a new value.
  //
  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    string strippedPropStr = PropStripPrefix(propertyID, "");
    string[] tokens = Str.Tokens(strippedPropStr, "/");

    if ((tokens[0] == "add")  and  (value.GetType() == PropertyValue.INDEX_TYPE))
      m_triggersList[m_triggersList.size()] = value.AsString();

    else if ((tokens[0] == "delete")  and  (value.GetType() == PropertyValue.NULL_TYPE))
    {
      int triggerIndex = Str.ToInt(tokens[1]);
      m_triggersList[triggerIndex, triggerIndex+1] = null;
    }

    else if (tokens[0] == "runOnlyOnce")
      m_runOnlyOnce = !m_runOnlyOnce;

    else if (tokens[0] == "childRuleStop")
      m_childRuleStop = !m_childRuleStop;

    else if (tokens[0] == "directionalMode")
      m_directionalMode = !m_directionalMode;

    else if (tokens[0] == "trackDirection")
      m_trackDirection = !m_trackDirection;

    else
      inherited(propertyID, value);

  }

  //
  // Gets list of available triggers not already in list for a list that the
  // use can select from.
  //
  public string[] GetPropertyElementList(string propertyID)
  {
    string[] retString = new string[0];
    string strippedPropStr = PropStripPrefix(propertyID, "");
    string[] tokens = Str.Tokens(strippedPropStr, "/");

    if (tokens[0] == "add")
    {
      // get list of triggers and if not already in this rule, put in list array
      Trigger[] triggers = World.GetTriggerList();

      int i, out = 0;
      for (i = 0; i < triggers.size(); i++)
        if (triggers[i])
        {
          string triggerName = triggers[i].GetLocalisedName();
          if (triggerName and triggerName.size())
            if (!TrainUtil.AlreadyThereStr(m_triggersList, triggerName))
              retString[out++] = triggerName;
        }
    }
    else
      retString = inherited(propertyID);

    return retString;
  }

  //
  // Initialise triggers list from soup database
  //
  public void SetProperties(Soup soup)
  {
    m_triggersList = new string[0];

    Soup triggersSoup = soup.GetNamedSoup(Prop("triggerslist"));

    int i, out = 0;
    for (i = 0; i < triggersSoup.CountTags(); i++)
      m_triggersList[out++] = triggersSoup.GetNamedTag((string)i);

    m_runOnlyOnce   = soup.GetNamedTagAsBool("runOnlyOnce", false);
    m_childRuleStop = soup.GetNamedTagAsBool("childRuleStop", false);

    m_directionalMode = soup.GetNamedTagAsBool("directionalMode", false);
    m_trackDirection  = soup.GetNamedTagAsBool("trackDirection", true);

    inherited(soup);
  }

  //
  // Save triggers list to soup database
  //
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    // triggers list
    Soup triggersSoup = Constructors.NewSoup();
    int i;
    for (i = 0; i < m_triggersList.size(); i++)
      triggersSoup.SetNamedTag((string)i, m_triggersList[i]);

    soup.SetNamedSoup(Prop("triggerslist"), triggersSoup);

    soup.SetNamedTag("runOnlyOnce", m_runOnlyOnce);
    soup.SetNamedTag("childRuleStop", m_childRuleStop);

    soup.SetNamedTag("directionalMode", m_directionalMode);
    soup.SetNamedTag("trackDirection", m_trackDirection);

    return soup;
  }

};

//
// Trigger Check Rule
//  - Sets the COMPLETE flag while a train is in the designated trigger(s).
//  - Clears the COMPLETE flag after the train(s) leave the designated trigger(s).
//
// Editable options include list of triggers and train filter.
//
class TriggerCheckRule isclass ConditionalScenarioBehavior
{
  HTMLPropertyGroup    group;
  TrainHelperInfo      trainFilterInfo;
  TriggerCheckRuleInfo triggerCheckRuleInfo;

  bool m_isActivated     = false;
  bool m_childrenRunning = false;

  Train[] m_trains = new Train[0];

  //
  // Method definitions
  //

  bool DirectionalCheck(Train train);
  void SniffTriggers(bool enable);

  // train list management methods
  void AddTrain(Train addMeTrain);
  void RemoveTrain(Train removeMeTrain);
  int  TrainAlreadyInList(Train findMeTrain);

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // ensure info helpers are set up for this rule
    triggerCheckRuleInfo = new TriggerCheckRuleInfo();
    trainFilterInfo = new TrainHelperInfo();
    trainFilterInfo.Init();

    group = new HTMLPropertyGroup();
    group.AddHandler(triggerCheckRuleInfo, "triggerslist/");
    group.AddHandler(trainFilterInfo, "trainfilter/");

    SetPropertyHandler(group);
  }

  //
  // Overridden from ConditionalScenarioBeahvior to allow for message processing of triggers.
  //
  thread void ThreadPollCondition(void)
  {
    m_childrenRunning = false;
    m_trains = new Train[0];
    Message msg;

    SniffTriggers(true);

    wait()
    {
      on "Object", "", msg:
      {
        if (IsPaused())
          break;

        if (WasComplete() and triggerCheckRuleInfo.m_runOnlyOnce)
          break;

        Trigger trigger = cast<Trigger> msg.dst;
        Train   train   = cast<Train> msg.src;

        // valid train and trigger
        if (trigger and train)
        {
          // if the trigger is one of ours and train matches the train filter, investigate further
          if (TrainUtil.AlreadyThereStr(triggerCheckRuleInfo.m_triggersList, trigger.GetLocalisedName())  and
              trainFilterInfo.DoesMatch(train))
          {
            // adjust count depending on whether it was an enter/exit
            if ((msg.minor == "Enter")  and ((TrainAlreadyInList(train) < 0)  and
                (!triggerCheckRuleInfo.m_directionalMode  or  DirectionalCheck(train))))
              AddTrain(train);

            else if ((msg.minor == "Leave")  and  (TrainAlreadyInList(train) >= 0))
              RemoveTrain(train);

            // do rule check - if there is 1 or more train in trigger
            if (m_trains.size())
            {
              // we don't re-run child rule stuff if another train joins an already activated rule
              if (!m_isActivated)
              {
                m_isActivated = true;

                Interface.Log("# TriggerCheckRule.ThreadPollCondition> Rule satisfied on trigger: '" + trigger.GetName() + "'");

                // rule satisfied, if no children are running, then run them...
                if (!m_childrenRunning)
                {
                  m_childrenRunning = true;
                  ResetChildren();
//                  UpdateChildren(null);
                  UnpauseChildren();
                }
              }
            }

            // (trainsInTriggers <= 0) - no trains are left in trigger(s), rule is no longer activated
            else
            {
              m_isActivated = false;

              // if children are still running and this rule is set to wait for children to complete, do nothing!
              if (m_childrenRunning  and  triggerCheckRuleInfo.m_childRuleStop)
                continue;

              // kill off the kiddies...
              PauseChildren();
              m_childrenRunning = false;

              // complete if this is a run once rule
              if (triggerCheckRuleInfo.m_runOnlyOnce)
                SetComplete(true);
            }

          } // if trigger in this rule's list and train matches filter
        } // if valid train and trigger objects

        continue;
      }
    } // wait

    SniffTriggers(false);
    m_pollingThreadRunning = false;
  }

  //
  // ?
  //
  bool DirectionalCheck(Train train)
  {
    bool trainForward = (train.GetVelocity() > 0.0);
    Vehicle[] vehicles = train.GetVehicles();
    Vehicle leadVehicle;
    if (trainForward)
      leadVehicle = vehicles[0];
    else
      leadVehicle = vehicles[vehicles.size()-1];

    if (leadVehicle)
      if (((leadVehicle.GetVelocity() > 0.0)  and  triggerCheckRuleInfo.m_trackDirection)  or
          ((leadVehicle.GetVelocity() <= 0.0)  and  !triggerCheckRuleInfo.m_trackDirection))
            return true;

    return false;
  }

  //
  // Enable/disable message sniffing on triggers
  //
  void SniffTriggers(bool enable)
  {
    int i;
    for (i = 0; i < triggerCheckRuleInfo.m_triggersList.size(); i++)
    {
      Trigger trig = cast<Trigger>(Router.GetGameObject(triggerCheckRuleInfo.m_triggersList[i]));
      if (trig)
        Sniff(trig, "Object", "", enable);
    }
  }

  //
  //
  //
  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string descriptionEntry = "description_info_any";
//    string descriptionString = "_any";
    string descriptionString = "";

    // any/specific trains
    if (trainFilterInfo.DoesFilterTrains())
      descriptionEntry = "description_info_any";

    // list triggers - only if we have a handful, otherwise, go generic with triggers plural
    int listSize = triggerCheckRuleInfo.m_triggersList.size();
    if ((listSize > 0)  and  (listSize < 6))
    {
      string triggerNames = "";
      int i;
      for (i = 0; i < listSize; i++)
        triggerNames = triggerNames + "<i>''" + triggerCheckRuleInfo.m_triggersList[i] + "''</i>,";

      triggerNames = triggerNames[,triggerNames.size()-1]; // trim final comma

      descriptionEntry = descriptionEntry + "_trigs";
      descriptionString = strTable.GetString1(descriptionEntry, triggerNames);

      if (descriptionString.size())
        return descriptionString;
    }

    descriptionString = strTable.GetString(descriptionEntry);
    if (descriptionString.size())
        return descriptionString;

    return inherited();
  }

  int TrainAlreadyInList(Train findMeTrain)
  {
    if (!findMeTrain)
      return -1;

    int i;
    for (i = 0; i < m_trains.size(); i++)
      if (m_trains[i] == findMeTrain)
        return i;

    return -1;
  }

  void AddTrain(Train addMeTrain)
  {
    m_trains[m_trains.size()] = addMeTrain;
  }

  void RemoveTrain(Train removeMeTrain)
  {
    int i;
    for (i = 0; i < m_trains.size(); i++)
      if (m_trains[i] == removeMeTrain)
      {
        m_trains[i, i+1] = null;
        break;
      }
  }

};


Trigger Rule
[Rules]

Trigger Rule

config.txt:

﻿
username            "Trigger Rule"
kind              "behavior"
kuid              <kuid:-3:10153>
script              "triggerrule"
class             "TriggerRule"
string-table {
  str_property_name1        "Trigger Object"
  str_property_name2        "Add new train object"
  html_description_not_selected     "None selected"
  html_description_any_train      "Any Train<br>"
  html_description        "<table><tr><td width=100%><font color=#000000><b>Trigger Rule</b><br><br>
  Trigger: <a href=live://property/trigger>$0</a><br><br>
  <b>Trains that will activate this trigger:</b><br>
  $1
  <a href=live://property/add-object>Add train</a><br><br>
  </font></td></tr></table>"
  description         "Wait for one of the designated trains to enter a trigger."
  description_info        "Wait for one of the designated trains to enter trigger '<i>$0</i>'."
}
icon-texture            "trigger_type.texture"
username-de           "Auslöser-Regel"
string-table-de {
  str_property_name1        "Auslöse-Objekt"
  str_property_name2        "Neues Zugobjekt wurde hinzugefügt"
  html_description_not_selected     "Nichts ausgewählt"
  html_description_any_train      "Jeder Zug<br>"
  html_description        "<table><tr><td width=100%><font color=#000000><b>Auslöse-Regel</b><br><br>

Auslöser: <a href=live://property/trigger>$0</a><br><br>

<b>Züge, die diesen Auslöser aktivieren:</b><br>

$1

<a href=live://property/add-object>Zug hinzufügen</a><br><br>

</font></td></tr></table>"
}
username-it           "Regola attivatore"
string-table-it {
  str_property_name1        "Oggetto Trigger"
  str_property_name2        "Aggiungi nuovo oggetto treno"
  html_description_not_selected     "Nessun oggetto"
  html_description_any_train      "Qualsiasi treno<br>"
  html_description        "<table><tr><td width=100%><font color=#000000><b>Regola Trigger</b><br><br>

Trigger: <a href=live://property/trigger>$0</a><br><br>

<b>Treni che attivano questo trigger:</b><br>

$1

<a href=live://property/add-object>Aggiungi treno</a><br><br>

</font></td></tr></table>"
}
username-es           "Regla de activador"
string-table-es {
  str_property_name1        "Objeto activador"
  str_property_name2        "Añadir nuevo tren objeto"
  html_description_not_selected     "Nada seleccionado"
  html_description_any_train      "Cualquier tren<br>"
  html_description        "<table><tr><td width=100%><font color=#000000><b>Regla de activador</b><br><br>

Activador: <a href=live://property/trigger>$0</a><br><br>

<bTrenes que harán saltar este activador:</b><br>

$1

<a href=live://property/add-object>Añadir tren</a><br><br>

</font></td></tr></table>"
}
username-pl           "Zasady wyzwalaczy"
string-table-pl {
  str_property_name1        "Uaktywnij obiekt"
  str_property_name2        "Dodaj nowy pociąg"
  html_description_not_selected     "Nie wybrano żadnego obiektu"
  html_description_any_train      "Dowolny pociąg<br>"
  html_description        "<table><tr><td width=100%><font color=#000000><b>Zasady wyzwalaczy</b><br><br>

Wyzwalacz: <a href=live://property/trigger>$0</a><br><br>

<b>Pociągi, które uaktywnią ten wyzwalacz:</b><br>

$1

<a href=live://property/add-object>Dodaj pociąg</a><br><br>

</font></td></tr></table>"
}
username-cz           "Pravidlo aktivátoru"
string-table-cz {
  str_property_name1        "Aktivovat objekt"
  str_property_name2        "Přidat nový vlakový objekt"
  html_description_not_selected     "Nic nebylo zvoleno"
  html_description_any_train      "Libovolný vlak<br>"
  html_description        "<table><tr><td width=100%><font color=#000000><b>Pravidlo aktivátoru</b><br><br>

Aktivátor: <a href=live://property/trigger>$0</a><br><br>

<b>Vlaky, které aktivují tento objekt:</b><br>

$1

<a href=live://property/add-object>Přidat vlak</a><br><br>

</font></td></tr></table>"
}
username-ru           "Метка"
string-table-ru {
  str_property_name1        "Метка"
  str_property_name2        "Добавить поезд"
  html_description_not_selected     "Не выбрано"
  html_description_any_train      "Любой поезд
"
}
username-fr           "Règle de déclenchement"
string-table-fr {
  str_property_name1        "Objet déclencheur"
  str_property_name2        "Ajouter un nouveau train"
  html_description_not_selected     "Aucune sélection"
  html_description_any_train      "Tout Train<br>"
  html_description        "<table><tr><td width=100%><font color=#000000><b>Règle de déclenchement</b><br><br>

Déclencheur: <a href=live://property/trigger>$0</a><br><br>

<b>Le train qui activera le déclencheur:</b><br>

$1

<a href=live://property/add-object>Ajouter un train</a><br><br>

</font></td></tr></table>"
}

triggerrule.gs:

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"

//
// Executes each child behavior in order.
//
class TriggerRule isclass ScenarioBehavior
{
  string triggerName;
  string[] trainNames;
  StringTable strTable;
  bool hasTriggered = false;

  void PauseChildren(void);
  void ResetChildren(void);
  void UpdateChildren(Message notUsed);

  thread void TriggerMonitor(void);

  public void Init(Asset p_self)
  {
    inherited(p_self);

      // if one of our children is updated, we want to know about it
    AddHandler(me, "ScenarioBehavior", "Touch", "UpdateChildren");
    strTable = GetAsset().GetStringTable();

    triggerName = "";
    trainNames = new string[0];

    TriggerMonitor();
  }

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.
  public void Pause(bool paused)
  {

    if (paused == IsPaused())
      return;

    Trigger trig;
    trig = cast<Trigger>(Router.GetGameObject(triggerName));
    if (trig)
    {
      if (paused)
        Sniff(trig, "Object", "", false);
      else
        Sniff(trig, "Object", "", true);

    }

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
      PauseChildren();
    }
    else
    {
      ResetChildren();
      //UpdateChildren(null);
    }
  }

    // pause all our children
  void PauseChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Pause(true);
  }

    // clear the was-complete flag on all our kiddies
  void ResetChildren(void)
  {
    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      child[i].Reset();
  }

    // rescan our kiddies and update our progress
  void UpdateChildren(Message notUsed)
  {
    if (!hasTriggered)
      return;

      // once we have completed, don't retry (unless we are reset)
    if (IsComplete())
      return;

    int i;
    ScenarioBehavior[] child = GetChildBehaviors();

    for (i = 0; i < child.size(); i++)
      if (!child[i].WasComplete())
      {
          // if he's already unpaused, this wont do any harm.
        child[i].Pause(false);
        return;
      }

    //
    // If we got here, all our children were completed
    // This doesn't mean that they're currently complete; we dont go back to make sure.
    //

    SetComplete(true);
    hasTriggered = false;
  }

  // Returns HTML description.
  public string GetDescriptionHTML(void)
  {
    int i;
    string curTriggerName = "";
    string curTrains = "";

    if (triggerName and triggerName.size())
      curTriggerName = "'" + BrowserInterface.Quote(triggerName) + "'";
    else
      curTriggerName = strTable.GetString("html_description_not_selected");

    if (!trainNames or !trainNames.size())
      curTrains = strTable.GetString("html_description_any_train");

    for (i = 0; i < trainNames.size(); i++)
      curTrains = curTrains + "  <a href=live://property/" + ((string)i) + ">" + BrowserInterface.Quote(trainNames[i]) + "</a><br>";

    return "<html><body><font color=#000000>" + strTable.GetString2("html_description", curTriggerName, curTrains) + "</font></body></html>";
  }

  public string GetDescription(void)
  {
    if (triggerName and triggerName.size())
      return strTable.GetString1("description_info", triggerName);

    return inherited();
  }

  string GetPropertyName(string p_propertyID)
  {
    if (p_propertyID == "trigger")
      return strTable.GetString("str_property_name1");

    if (p_propertyID == "add-object")
      return strTable.GetString("str_property_name2");

    return "<null>";
  }

  string GetPropertyDescription(string p_propertyID)
  {
    if (p_propertyID == "trigger")
      return strTable.GetString("str_property_description1");

    if (p_propertyID == "add-object")
      return strTable.GetString("str_property_description2");

    return "<null>";
  }

  string GetPropertyType(string p_propertyID)
  {
    if (p_propertyID == "trigger")
      return "list,1";

    if (p_propertyID == "add-object")
      return "list,1";

    return "link";
  }

  public string GetPropertyValue(string p_propertyID)
  {
    if (p_propertyID == "trigger")
      return "";

    if (p_propertyID == "add-object")
      return "";

    return "";
  }

  void SetPropertyValue(string p_propertyID, string p_value)
  {
    if (p_propertyID == "trigger")
    {
        Trigger trig;
        if (triggerName and triggerName.size())
        {
          trig = cast<Trigger>(Router.GetGameObject(triggerName));
          if (trig)
            Sniff(trig, "Object", "", false);
        }
        triggerName = p_value;
        trig = cast<Trigger>(Router.GetGameObject(triggerName));
        if (trig)
          Sniff(trig, "Object", "", true);
    }
    else if (p_propertyID == "add-object")
    {
      trainNames[trainNames.size()] = p_value;
    }

  }

  void LinkPropertyValue(string p_propertyID)
  {
    int index = Str.ToInt(p_propertyID);
    trainNames[index, index+1] = null;

  }

  public string[] GetPropertyElementList(string p_propertyID)
  {
    string[] ret = new string[0];
    Trigger[] triggers = World.GetTriggerList();
    Vehicle[] vehicles = World.GetVehicleList();

    if (p_propertyID == "trigger")
    {
      int i, out = 0;
      for (i = 0; i < triggers.size(); i++)
      {
        if (triggers[i])
        {
          string name = triggers[i].GetLocalisedName();

          if (name and name.size())
            ret[out++] = name;
        }
      }
    }

    else if (p_propertyID == "add-object")
    {
      int i, out = 0;
      for (i = 0; i < vehicles.size(); i++)
      {
        string name = vehicles[i].GetName();

        if (name and name.size() and cast<Locomotive>(vehicles[i]))
        {
          int n;
          for (n = 0; n < trainNames.size(); n++)
            if (trainNames[n] == name)
            {
              name = null;
              break;
            }

          if (name)
            ret[out++] = name;
        }
      }
    }

    return ret;
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);
    Trigger trig;

    if (triggerName and triggerName.size())
    {
      trig = cast<Trigger>(Router.GetGameObject(triggerName));
      if (trig)
        Sniff(trig, "Object", "", false);
    }

    triggerName = soup.GetNamedTag("triggerName");
    Soup objects = soup.GetNamedSoup("objects");
    int value = soup.GetNamedTagAsInt("triggered");
    if (value)
      hasTriggered = true;
    else
      hasTriggered = false;

    int i, count = objects.CountTags();
    trainNames = new string[count];
    for (i = 0; i < count; i++)
      trainNames[i] = objects.GetNamedTag((string)i);

    if (triggerName and triggerName.size())
    {
      trig = cast<Trigger>(Router.GetGameObject(triggerName));
      if (trig)
        Sniff(trig, "Object", "", true);
    }

  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("triggerName", triggerName);

    Soup objects = Constructors.NewSoup();
    int i, count = trainNames.size();
    for (i = 0; i < count; i++)
      objects.SetNamedTag((string)i, trainNames[i]);
    soup.SetNamedSoup("objects", objects);

    if (hasTriggered)
      soup.SetNamedTag("triggered", 1);
    else
      soup.SetNamedTag("triggered", 0);

    return soup;
  }

  thread void TriggerMonitor(void)
  {
    while (1)
    {
      wait()
      {
        on "Object", "Enter":
          if (!IsPaused())
          {
            hasTriggered = true;
            UpdateChildren(null);
          }
          continue;
        on "Object", "Leave":
          SetComplete(false);
          continue;
      }
    }
  }

};


Variable Check
[Rules]

Variable Check Rule

config.txt:

﻿
kuid              <kuid:-3:10201>
kind              "behavior"
username            "Variable Check"
script              "VariableCheckRule"
class             "VariableCheckRule"
string-table {
  html-rule-name          "Variable Check"
  check-action0         "is less than"
  check-action1         "is less than or equal to"
  check-action2         "is equal to"
  check-action3         "is greater than or equal to"
  check-action4         "is greater than"
  check-action5         "is not equal to"
  check-action          "Unknown test"
  html-cond-text-prefix       "Test that "
  html-cond-text-suffix       "This condition will be evaluated only once. Changes that occur after the check has been made will not affect this rule."
  html-cond-text-suffix1        "This condition will be evaluated only once. Changes that occur after the check has been made will not affect this rule."
  description         "If variable <i>'$0'</i> $1 <i>$2</i>, the child rules will be executed in order."
  property-name0          "Action"
  property-name1          "Amount"
  property-name2          "Time interval"
  property-name3          "Variable name"
  property-desc0          "The modification to perform"
  property-desc1          "The amount by which to modify the specified variable"
  property-desc2          "The duration of the action"
  property-desc3          "The name of the variable which is to be modified"
}
icon-texture            "icon.texture"
kuid-table {
  sessionvariables        <kuid:-3:10197>
}
username-de           "Variablen-Überprüfung"
string-table-de {
  html-rule-name          "Variablen-Überprüfung"
  check-action0         "ist kleiner als"
  check-action1         "ist kleiner oder gleich"
  check-action2         "ist gleich"
  check-action3         "ist größer gleich"
  check-action4         "ist größer als"
  check-action5         "ist ungleich"
  check-action          "unbekannter Test"
  html-cond-text-prefix       "Überprüfen ob "
  html-cond-text-suffix       "Diese Bedingung wird nur einmalig überprüft. Änderungen die sich nach dieser Überprüfung ergeben beeinflussen diese Regel nicht."
  description         "Wenn $0 $1 $2, werden die Tochterregeln in Reihenfolge ausgeführt."
  property-name0          "Aktion"
  property-name1          "Menge"
  property-name2          "Zeitintervall"
  property-name3          "Variablenname"
  property-desc0          "Die durchzuführende Änderung"
  property-desc1          "Der Betrga um den die angegebene Variable geändert werden soll"
  property-desc2          "Die Dauer der Aktion"
  property-desc3          "Der Name der Variablen die geändert werden soll"
}
username-it           "Variable Check"
string-table-it {
  html-rule-name          "Variable Check"
  check-action0         "is less than"
  check-action1         "is less than or equal to"
  check-action2         "is equal to"
  check-action3         "is greater than or equal to"
  check-action4         "is greater than"
  check-action5         "is not equal to"
  check-action          "Unknown test"
  html-cond-text-prefix       "Test that "
  html-cond-text-suffix       "This condition will be evaluated only once. Changes that occur after the check has been made will not affect this rule."
  description         "If $0 $1 $2, the child rules will be executed in order."
  property-name0          "Action"
  property-name1          "Amount"
  property-name2          "Time interval"
  property-name3          "Variable name"
  property-desc0          "The modification to perform"
  property-desc1          "The amount by which to modify the specified variable"
  property-desc2          "The duration of the action"
  property-desc3          "The name of the variable which is to be modified"
}
username-es           "Comprobar variables"
string-table-es {
  html-rule-name          "Comprobar variables"
  check-action0         "es menor que"
  check-action1         "es menor o igual que"
  check-action2         "es igual a"
  check-action3         "es mayor o igual que"
  check-action4         "es mayor que"
  check-action5         "no es igual a"
  check-action          "Comprobación desconocida"
  html-cond-text-prefix       "Comprobar que "
  html-cond-text-suffix       "Esta condición sólo se evaluará una vez. Los cambios que se hagan tras realizar la comprobación no afectarán a esta regla."
  description         "Si $0 $1 $2, las reglas subsidiarias se llevarán a cabo por orden."
  property-name0          "Acción"
  property-name1          "Cantidad"
  property-name2          "Intervalo de tiempo"
  property-name3          "Nombre de la variable"
  property-desc0          "La modificación a realizar"
  property-desc1          "La cantidad en que se modifica la variable especificada"
  property-desc2          "La duración de la acción"
  property-desc3          "El nombre de la variable a modificar"
}
username-pl           "Variable Check"
string-table-pl {
  html-rule-name          "Variable Check"
  check-action0         "is less than"
  check-action1         "is less than or equal to"
  check-action2         "is equal to"
  check-action3         "is greater than or equal to"
  check-action4         "is greater than"
  check-action5         "is not equal to"
  check-action          "Unknown test"
  html-cond-text-prefix       "Test that "
  html-cond-text-suffix       "This condition will be evaluated only once. Changes that occur after the check has been made will not affect this rule."
  description         "If $0 $1 $2, the child rules will be executed in order."
  property-name0          "Action"
  property-name1          "Amount"
  property-name2          "Time interval"
  property-name3          "Variable name"
  property-desc0          "The modification to perform"
  property-desc1          "The amount by which to modify the specified variable"
  property-desc2          "The duration of the action"
  property-desc3          "The name of the variable which is to be modified"
}
username-cz           "Kontrola proměnné"
string-table-cz {
  html-rule-name          "Kontrola proměnné"
  check-action0         "je menší než"
  check-action1         "je menší nebo rovna"
  check-action2         "je rovna"
  check-action3         "je vetší nebo rovna"
  check-action4         "je vetší než"
  check-action5         "není rovna"
  check-action          "Neznámý test"
  html-cond-text-prefix       "Zkontrolovat zda "
  html-cond-text-suffix       "Stav bude zkontrolován pouze jednou. Změny, ke kterým dojde až po této kontrole, nebudou mít na pravidlo žádný vliv."
  description         "Je-li $0 $1 $2, podpravidla budou spuštěna v zadaném pořadí."
  property-name0          "Akce"
  property-name1          "Hodnota"
  property-name2          "Časový interval"
  property-name3          "Název proměnné"
  property-desc0          "Prováděná změna"
  property-desc1          "Hodnota, o kterou bude změněna zvolená proměnná"
  property-desc2          "Délka trvání akce"
  property-desc3          "Název proměnné, která bude změněna"
}
username-ru           "Проверка переменной"
description-ru            "Если $0 $1 $2, то будут выполнены подправила."
string-table-ru {
  html-rule-name          "Проверка переменной"
  check-action0         "менее, чем"
  check-action1         "менее иои равно"
  check-action2         "равно"
  check-action3         "более или равно"
  check-action4         "более, чем"
  check-action5         "не равно"
  check-action          "Неизвестно"
  html-cond-text-prefix       "Проверить, что "
  html-cond-text-suffix       "Это выражение будет вычисленно только один раз. Все последующие изменения на него не подействуют."
  description         "Если $0 $1 $2, то будут выполнены подправила."
  property-name0          "Действие"
  property-name1          "Значение"
  property-name2          "Время"
  property-name3          "Имя переменной"
  property-desc0          "Тип изменения"
  property-desc1          "Значение изменения переменной"
  property-desc2          "Длительность"
  property-desc3          "Имя изменяемой переменной"
}
username-fr           "Vérification de variable"
string-table-fr {
  html-rule-name          "Vérification de variable"
  check-action0         "est inférieure à"
  check-action1         "est inférieure ou égale à"
  check-action2         "est égale à"
  check-action3         "est supérieure ou égale à"
  check-action4         "est supérieure à"
  check-action5         "est différente de"
  check-action          "Vérification inconnue"
  html-cond-text-prefix       "Vérifie que"
  html-cond-text-suffix       "Cette condition ne sera vérifiée qu'une seule fois. Les changements survenant après la vérification n'affecteront pas cette règle."
  description         "Si $0 $1 $2, les sous-règles seront exécutées dans l'ordre."
  property-name0          "Action"
  property-name1          "Valeur"
  property-name2          "Intervalle de temps"
  property-name3          "Nom de variable"
  property-desc0          "La modification à apporter"
  property-desc1          "La valeur de la modification à apporter à la variable"
  property-desc2          "La durée de l'action"
  property-desc3          "Le nom de la variable à modifier"
}

VariableCheckRule.gs:

include "ConditionalScenarioBehavior.gs"
include "SessionVariables.gs"

class VariableCheckRule isclass ConditionalScenarioBehavior
{
  string checkVariable = "score";
  int checkAmount = 1;
  int checkAction = 0;

  bool m_pollingBehavior = false;

  bool GetConditionResult(void);

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    checkVariable = soup.GetNamedTag("VariableCheckRule.checkVariable");
    checkAmount = soup.GetNamedTagAsInt("VariableCheckRule.checkAmount");
    checkAction = soup.GetNamedTagAsInt("VariableCheckRule.checkAction");
    m_pollingBehavior = soup.GetNamedTagAsInt("VariableCheckRule.m_pollingBehavior", false);

    if (!checkVariable.size())
      checkVariable = "score";
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("VariableCheckRule.checkVariable", checkVariable);
    soup.SetNamedTag("VariableCheckRule.checkAmount", checkAmount);
    soup.SetNamedTag("VariableCheckRule.checkAction", checkAction);
    soup.SetNamedTag("VariableCheckRule.m_pollingBehavior", m_pollingBehavior);

    return soup;
  }

  bool GetConditionResult(void)
  {
    KUID kuid = GetAsset().LookupKUIDTable("SessionVariables");
    SessionVariables lib = cast<SessionVariables> World.GetLibrary(kuid);

    int value = lib.GetVariableNumber(checkVariable);

    if (checkAction == 0)
      return (value < checkAmount);

    if (checkAction == 1)
      return (value <= checkAmount);

    if (checkAction == 2)
      return (value == checkAmount);

    if (checkAction == 3)
      return (value >= checkAmount);

    if (checkAction == 4)
      return (value > checkAmount);

    if (checkAction == 5)
      return (value != checkAmount);

    return false;
  }

  public string GetDescriptionHTML(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    string body = "<html><body><font color=#000000><p><b>" + strTable.GetString("html-rule-name") + "</b></p>";

    string propertyAction = "<a href=live://property/action>";
    string propertyAmount = "<a href=live://property/amount>" + (string)checkAmount + "</a>";
    string propertyVariable = "<a href=live://property/variable>" + checkVariable + "</a>";
    string properties;
    string actionString;

    if (checkAction >= 0 or checkAction <= 5)
    {
      actionString = strTable.GetString("check-action" + (string) checkAction);
    }
    else
    {
      actionString = "<i>" + strTable.GetString("check-action") + "</i>";
    }

    body = body + "<p>" + strTable.GetString("html-cond-text-prefix") + propertyVariable + "&nbsp;" +
      propertyAction + actionString + "</a>&nbsp;" + propertyAmount + "</p>";

    body = body + "<br>";

    if (!m_pollingBehavior)
      body = body + "<p><a href=live://property/polling>" + strTable.GetString("html-cond-text-suffix") + "</a></p>";
    else
      body = body + "<p><a href=live://property/polling>" + strTable.GetString("html-cond-text-suffix1") + "</a></p>";

    body = body + "</font></body></html>";

    return body;
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string properties;
    string actionString;

    if (checkAction >= 0 and checkAction <= 5)
    {
      actionString = strTable.GetString("check-action" + (string) checkAction);
    }
    else
    {
      actionString = strTable.GetString("check-action");
    }

    return strTable.GetString3("description", checkVariable, actionString, checkAmount);
  }

  string GetPropertyType(string propertyID)
  {
    if (propertyID == "action")
      return "list";
    else if (propertyID == "amount")
      return "int,1,10000,1";
    else if (propertyID == "time")
      return "int,1,60,1";
    else if (propertyID == "polling")
      return "link";

    return "string";
  }

  string GetPropertyName(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "action")
    {
      return strTable.GetString("property-name0");
    }
    else if (propertyID == "amount")
    {
      return strTable.GetString("property-name1");
    }
    else if (propertyID == "time")
    {
      return strTable.GetString("property-name2");
    }

     return strTable.GetString("property-name3");
  }

  string GetPropertyDescription(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "action")
    {
       return strTable.GetString("property-desc3");
    }
    else if (propertyID == "amount")
    {
       return strTable.GetString("property-desc3");
    }
    else if (propertyID == "time")
    {
       return strTable.GetString("property-desc3");
    }

     return strTable.GetString("property-desc3");
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    int i;
    string [] result = new string[0];

    if (propertyID == "action")
    {
      result[0] = strTable.GetString("check-action0");
      result[1] = strTable.GetString("check-action1");
      result[2] = strTable.GetString("check-action2");
      result[3] = strTable.GetString("check-action3");
      result[4] = strTable.GetString("check-action4");
      result[5] = strTable.GetString("check-action5");
    }

    return result;
  }

  void LinkPropertyValue(string propertyID)
  {
    m_pollingBehavior = !m_pollingBehavior;
  }

  void SetPropertyValue(string propertyID, string p_value, int p_index)
  {
    if (propertyID == "action")
    {
      checkAction = p_index;
    }
  }

  void SetPropertyValue(string propertyID, int value)
  {
    if (propertyID == "amount")
    {
      checkAmount = value;
    }
  }

  void SetPropertyValue(string propertyID, string value)
  {
    if (propertyID == "variable")
    {
      checkVariable = value;

      if (!checkVariable.size())
        checkVariable = "score";
    }
  }

  //
  // The following code is stolen from Ordered List Rule
  //

};


Variable Modify Continuous
[Rules]

Variable Modify Continuous Rule Rule

config.txt:

﻿
kind              "behavior"
kuid              <kuid:-3:10200>
username            "Variable Modify Continuous"
icon-texture            "icon.texture"
kuid-table {
  sessionvariables        <kuid:-3:10197>
}
script              "PenaltyRule"
class             "PenaltyRule"
string-table {
  description-info-action0      "$0<i>Add</i>$1 <i>$2</i> to variable <i>'$3'</i> every <i>$4</i> seconds"
  description-info-action1      "$0<i>Subtract</i>$1 <i>$2</i> from variable <i>'$3'</i> every <i>$4</i> seconds"
  description-info-action2      "$0<i>Change</i>$1 variable <i>'$2'</i> to <i>$3</i> every <i>$4</i> seconds"
  description-info-action3      "Unknown action"
  html-rule-title         "Modify Score"
  description-action0       "$0Add$1 $2 to $3 every $4 seconds"
  description-action1       "$0Subtract$1 $2 from $3 every $4 seconds"
  description-action2       "$0Change$1 $2 to $3 every $4 seconds"
  description-action3       "Unknown action"
  property-name0          "Action"
  property-name1          "Amount"
  property-name2          "Time interval"
  property-name3          "Variable name"
  property-description0       "The modification to perform"
  property-description1       "The amount by which to modify the specified variable"
  property-description2       "The duration of the action"
  property-description3       "The name of the variable which is to be modified"
  property-action0        "Add to variable"
  property-action1        "Subtract from variable"
  property-action2        "Change variable to"
}
username-de           "Variable Modify Continuous"
string-table-de {
  html-rule-title         "Punktzahl ändern"
  description-action0       "$0 $1 $2 alle $4 Sekunden zu $3 hinzufügen"
  description-action1       "$0 $1 $2 alle $4 Sekunden von $3 abziehen"
  description-action2       "$0 $1 $2 alle $4 Sekunden in $3 ändern"
  description-action3       "unbekannte Aktion"
  property-name0          "Aktion"
  property-name1          "Menge"
  property-name2          "Zeit-Intervall"
  property-name3          "Variablenname"
  property-description0       "Die auszuführende Änderung"
  property-description1       "Der Betrag, um den die angegeben Variable geändert werden soll"
  property-description2       "Die Dauer dieser Aktion"
  property-description3       "Der Name der Variablen die geändert werden soll"
  property-action0        "Zur Variablen hinzufügen"
  property-action1        "Von Variable abziehen"
  property-action2        "Variable ändern in"
}
username-it           "Variable Modify Continuous"
string-table-it {
  html-rule-title         "Modify Score"
  description-action0       "$0Add$1 $2 to $3 every $4 seconds"
  description-action1       "$0Subtract$1 $2 from $3 every $4 seconds"
  description-action2       "$0Change$1 $2 to $3 every $4 seconds"
  description-action3       "Unknown action"
  property-name0          "Action"
  property-name1          "Amount"
  property-name2          "Time interval"
  property-name3          "Variable name"
  property-description0       "The modification to perform"
  property-description1       "The amount by which to modify the specified variable"
  property-description2       "The duration of the action"
  property-description3       "The name of the variable which is to be modified"
  property-action0        "Add to variable"
  property-action1        "Subtract from variable"
  property-action2        "Change variable to"
}
username-es           "Modificación de continuidad de las variables"
string-table-es {
  html-rule-title         "Modificar puntuación"
  description-action0       "$0 Sumar $1 de $2 a $3 cada $4 segundos"
  description-action1       "$0 Restar $1 de $2 a $3 cada $4 segundos"
  description-action2       "$0 Cambiar $1 de $2 a $3 cada $4 segundos"
  description-action3       "Acción desconocida"
  property-name0          "Acción"
  property-name1          "Cantidad"
  property-name2          "Intervalo de tiempo"
  property-name3          "Nombre de la variable"
  property-description0       "La modificación a realizar"
  property-description1       "La cantidad en que se modifica la variable especificada"
  property-description2       "La duración de la acción"
  property-description3       "El nombre de la variable a modificar"
  property-action0        "Añadir a la variable"
  property-action1        "Quitar a la variable"
  property-action2        "Cambiar variable a"
}
username-pl           "Variable Modify Continuous"
string-table-pl {
  html-rule-title         "Modify Score"
  description-action0       "$0Add$1 $2 to $3 every $4 seconds"
  description-action1       "$0Subtract$1 $2 from $3 every $4 seconds"
  description-action2       "$0Change$1 $2 to $3 every $4 seconds"
  description-action3       "Unknown action"
  property-name0          "Action"
  property-name1          "Amount"
  property-name2          "Time interval"
  property-name3          "Variable name"
  property-description0       "The modification to perform"
  property-description1       "The amount by which to modify the specified variable"
  property-description2       "The duration of the action"
  property-description3       "The name of the variable which is to be modified"
  property-action0        "Add to variable"
  property-action1        "Subtract from variable"
  property-action2        "Change variable to"
}
username-cz           "Trvalá změna proměnných"
string-table-cz {
  html-rule-title         "Změnit hodnotu"
  description-action0       "$0Přičíst$1 $2 k $3 každých $4 sekund"
  description-action1       "$0Odečíst$1 $2 od $3 každých $4 sekund"
  description-action2       "$0Změnit$1 $2 na $3 každých $4 sekund"
  description-action3       "Neznámá akce"
  property-name0          "Akce"
  property-name1          "Množství"
  property-name2          "Časový interval"
  property-name3          "Název proměnné"
  property-description0       "Prováděná změna"
  property-description1       "Hodnota, o kterou bude změněna zvolená proměná"
  property-description2       "Délka prováděné akce"
  property-description3       "Název proměnné, která bude změněna"
  property-action0        "Přičíst k proměnné"
  property-action1        "Odečíst od proměnné"
  property-action2        "Změnit proměnnou na"
}
username-ru           "Непрерывное изменение переменной"
string-table-ru {
  html-rule-title         "Изменить значение"
  description-action0       "$0Добавить$1 $2 к $3 каждые $4 секунд"
  description-action1       "$0Вычесть$1 $2 из $3 каждые $4 секунд"
  description-action2       "$0Изменить$1 $2 на $3 каждые $4 секунд"
  description-action3       "Неизвестное действие"
  property-name0          "Действие"
  property-name1          "Значение"
  property-name2          "Интервал времени"
  property-name3          "Имя переменной"
  property-description0       "Тип изменения"
  property-description1       "Значение, на которое изменить указанную переменную"
  property-description2       "Длительность изменения"
  property-description3       "Имя изменяемой переменной"
  property-action0        "Добавить к переменной"
  property-action1        "Вычесть из переменной"
  property-action2        "Изменить переменную на"
}
username-fr           "Modification constante de variable"
string-table-fr {
  html-rule-title         "Modifier Score"
  description-action0       "$0Ajoute $1 $2 à $3 toutes les $4 secondes"
  description-action1       "$0Soustrait $1 $2 à $3 toutes les $4 secondes"
  description-action2       "$0Remplace $1 $2 par $3 toutes les $4 secondes"
  description-action3       "Action inconnue"
  property-name0          "Action"
  property-name1          "Valeur"
  property-name2          "Intervalle de temps"
  property-name3          "Nom de variable"
  property-description0       "La modification à effectuer"
  property-description1       " La valeur de la modification à apporter à la variable"
  property-description2       "La durée de l'action"
  property-description3       "Le nom de la variable à modifier"
  property-action0        "Ajouter à la variable"
  property-action1        "Soustraire à la variable"
  property-action2        "Remplacer la variable par"
}

PenaltyRule:

include "ScenarioBehavior.gs"
include "World.gs"
include "SessionVariables.gs"

class PenaltyRule isclass ScenarioBehavior
{
  string modifierVariable = "score";
  int modifierAmount = 1;
  int modifierAction = 0;
  int modifierTime = 1;
  bool runningModifierThread = false;

  thread void ThreadModifyScore(void);

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    modifierVariable = soup.GetNamedTag("PenaltyRule.modifierVariable");
    modifierAmount = soup.GetNamedTagAsInt("PenaltyRule.modifierAmount");
    modifierAction = soup.GetNamedTagAsInt("PenaltyRule.modifierAction");
    modifierTime = soup.GetNamedTagAsInt("PenaltyRule.modifierTime");

    if (!modifierVariable.size())
      modifierVariable = "score";

    if (modifierTime <= 0)
      modifierTime = 1;

    if (!IsPaused())
    {
      if (!runningModifierThread)
      {
        runningModifierThread = true;
        ThreadModifyScore();
      }
    }
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("PenaltyRule.modifierVariable", modifierVariable);
    soup.SetNamedTag("PenaltyRule.modifierAmount", modifierAmount);
    soup.SetNamedTag("PenaltyRule.modifierAction", modifierAction);
    soup.SetNamedTag("PenaltyRule.modifierTime", modifierTime);

    return soup;
  }

  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused)
    {
      if (!runningModifierThread)
      {
        runningModifierThread = true;
        ThreadModifyScore();
      }
    }
  }

  thread void ThreadModifyScore(void)
  {
    if (!modifierVariable)
      return;

    KUID kuid = GetAsset().LookupKUIDTable("SessionVariables");
    SessionVariables lib = cast<SessionVariables> World.GetLibrary(kuid);

    while (!IsPaused())
    {
      if (modifierAction == 0)
        lib.IncVariableNumber(modifierVariable, modifierAmount);
      else if (modifierAction == 1)
        lib.DecVariableNumber(modifierVariable, modifierAmount);
      else if (modifierAction == 2)
        lib.SetVariableNumber(modifierVariable, modifierAmount);
      else
      {
        Interface.Log("PenaltyRule.DoModifyScore> unknown action " + (string)modifierAction + " on variable " + modifierVariable);
        break;
      }

      Sleep(modifierTime);
    }

    runningModifierThread = false;
  }

  public string GetDescriptionHTML(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    string header = "<html><body><font color=#000000><p><b>" + strTable.GetString("html-rule-title") + "</b></p>";

    string propertyAction = "<a href=live://property/action>";
    string propertyAmount = "<a href=live://property/amount>" + (string)modifierAmount + "</a>";
    string propertyVariable = "<a href=live://property/variable>" + modifierVariable + "</a>";
    string properties;

    if (modifierAction == 0)
    {
      properties = strTable.GetString5("description-action0", propertyAction, "</a>&nbsp;", propertyAmount, propertyVariable, (string)modifierTime);
    }
    else if (modifierAction == 1)
    {
      properties = strTable.GetString5("description-action1", propertyAction, "</a>&nbsp;", propertyAmount, propertyVariable, (string)modifierTime);
    }
    else if (modifierAction == 2)
    {
      properties = strTable.GetString5("description-action2", propertyAction, "</a>&nbsp;", propertyVariable, propertyAmount, (string)modifierTime);
    }
    else
    {
      properties = propertyAction + "<i>" + strTable.GetString("description-action3") + "</i></a>";
    }

    properties = "<p>" + properties + "</p>";

    string footer = "</font></body></html>";

    return header + properties + footer;
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string properties;

    if (modifierAction == 0)
    {
      properties = strTable.GetString5("description-info-action0", "", "", (string)modifierAmount, modifierVariable, (string)modifierTime);
    }
    else if (modifierAction == 1)
    {
      properties = strTable.GetString5("description-info-action1", "", "", (string)modifierAmount, modifierVariable, (string)modifierTime);
    }
    else if (modifierAction == 2)
    {
      properties = strTable.GetString5("description-info-action2", "", "", modifierVariable, (string)modifierAmount, (string)modifierTime);
    }
    else
    {
      properties = strTable.GetString("description-info-action3");
    }

    return properties;
  }

  string GetPropertyType(string propertyID)
  {
    if (propertyID == "action")
      return "list";
    else if (propertyID == "amount")
      return "int,1,10000,1";
    else if (propertyID == "time")
      return "int,1,60,1";

    return "string";
  }

  string GetPropertyName(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "action")
    {
      return strTable.GetString("property-name0");
    }
    else if (propertyID == "amount")
    {
      return strTable.GetString("property-name1");
    }
    else if (propertyID == "time")
    {
      return strTable.GetString("property-name2");
    }

    return strTable.GetString("property-name3");
  }

  string GetPropertyDescription(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "action")
    {
      return strTable.GetString("property-description0");
    }
    else if (propertyID == "amount")
    {
      return strTable.GetString("property-description1");
    }
    else if (propertyID == "time")
    {
      return strTable.GetString("property-description2");
    }

    return strTable.GetString("property-description3");
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    int i;
    string [] result = new string[0];

    if (propertyID == "action")
    {
      result[0] = strTable.GetString("property-action0");
      result[1] = strTable.GetString("property-action1");
      result[2] = strTable.GetString("property-action2");
    }

    return result;
  }

  void SetPropertyValue(string propertyID, string p_value, int p_index)
  {
    if (propertyID == "action")
    {
      modifierAction = p_index;
    }
  }

  void SetPropertyValue(string propertyID, int value)
  {
    if (propertyID == "amount")
    {
      modifierAmount = value;
    }
    else if (propertyID == "time")
    {
      modifierTime = value;
    }
  }

  void SetPropertyValue(string propertyID, string value)
  {
    if (propertyID == "variable")
    {
      modifierVariable = value;

      if (!modifierVariable.size())
        modifierVariable = "score";
    }
  }

};


Variable Modify
[Rules]

Variable Modify Rule

config.txt:

﻿
kind              "behavior"
kuid              <kuid:-3:10198>
username            "Variable Modify"
icon-texture            "icon.texture"
kuid-table {
  sessionvariables        <kuid:-3:10197>
}
script              "ModifyScoreRule"
class             "ModifyScoreRule"
string-table {
  description-action0       "Add$0 $1 to variable <i>$2</i>"
  description-action1       "Subtract$0 $1 from variable <i>$2</i>"
  description-action2       "Change$0 variable $1 to <i>$2</i>"
  description-action3       "Unknown action"
  html-body-text-min        "Set the minimum value of $0 to "
  html-body-text-max        "Set the maximum value of $0 to "
  property-name0          "Action"
  property-name1          "Amount"
  property-name2          "Variable name"
  property-name3          "Minimum"
  property-name4          "Maximum"
  property-description0       "The modification to perform"
  property-description1       "The amount by which to modify the specified variable"
  property-description2       "The name of the variable which is to be modified"
  property-description3       "Limit the maximum value of the specified variable to"
  property-description4       "Limit the minimum value of the specified variable to"
  property-action-list0       "Add to variable"
  property-action-list1       "Subtract from variable"
  property-action-list2       "Change variable to"
  property-action-list3       "Change minimum to"
  property-action-list4       "Change maximum to"
  modify-score-title        "Modify Score"
}
username-de           "Variablen-Änderung"
string-table-de {
  description-action0       "$0 $1 zu $2 hinzufügen"

  description-action1       "$0 $1 von $2 abziehen"
  description-action2       "$0 $1 in $2 ändern"
  description-action3       "Unbekannte Aktion"
  html-body-text-min        "Den Minimalwert von $0 verändern in "
  html-body-text-max        "Den Maximalwert von $0 verändern in "
  property-name0          "Aktion"
  property-name1          "Menge"
  property-name2          "Variablenname"
  property-name3          "Minimum"
  property-name4          "Maximum"
  property-description0       "Die durchzuführende Änderung"
  property-description1       "Der Betrag um den die angegebene Variable geändert werden soll"
  property-description2       "Der Name der Variable die geändert werden soll"
  property-description3       "Den Maximalwert der angegebenen Variable begrenzen auf"
  property-description4       "Den Minimalwert der angegebenen Variable begrenzen auf"
  property-action-list0       "zur Variablen hinzufügen"
  property-action-list1       "von der Variablen abziehen"
  property-action-list2       "Variable ändern in"
  property-action-list3       "Minimum ändern in"
  property-action-list4       "Maximum ändern in"
}
username-it           "Variable Modify"
string-table-it {
  description-action0       "Add$0 $1 to $2"
  description-action1       "Subtract$0 $1 from $2"
  description-action2       "Change$0 $1 to $2"
  description-action3       "Unknown action"
  html-body-text-min        "Set the minimum value of $0 to "
  html-body-text-max        "Set the maximum value of $0 to "
  property-name0          "Action"
  property-name1          "Amount"
  property-name2          "Variable name"
  property-name3          "Minimum"
  property-name4          "Maximum"
  property-description0       "The modification to perform"
  property-description1       "The amount by which to modify the specified variable"
  property-description2       "The name of the variable which is to be modified"
  property-description3       "Limit the maximum value of the specified variable to"
  property-description4       "Limit the minimum value of the specified variable to"
  property-action-list0       "Add to variable"
  property-action-list1       "Subtract from variable"
  property-action-list2       "Change variable to"
  property-action-list3       "Change minimum to"
  property-action-list4       "Change maximum to"
}
username-es           "Modificación de variables"
string-table-es {
  description-action0       "Añadir $0 de $1 a $2"
  description-action1       "Quitar $0 de $1 a $2"
  description-action2       "Pasar $0 de $1 a $2"
  description-action3       "Acción desconocida"
  html-body-text-min        "Poner el valor mínimo de $0 a "
  html-body-text-max        "Poner el valor máximo de $0 a "
  property-name0          "Acción"
  property-name1          "Cantidad"
  property-name2          "Nombre de la variable"
  property-name3          "Mínimo"
  property-name4          "Máximo"
  property-description0       "La modificación a realizar"
  property-description1       "La cantidad en que se modifica la variable especificada"
  property-description2       "El nombre de la variable a modificar"
  property-description3       "El valor máximo de la variable especificada queda limitado a"
  property-description4       "El valor mínimo de la variable especificada queda limitado a"
  property-action-list0       "Añadir a la variable"
  property-action-list1       "Quitar a la variable"
  property-action-list2       "Cambiar variable a"
  property-action-list3       "Cambiar mínimo a"
  property-action-list4       "Cambiar máximo a"
}
username-pl           "Variable Modify"
string-table-pl {
  description-action0       "Add$0 $1 to $2"
  description-action1       "Subtract$0 $1 from $2"
  description-action2       "Change$0 $1 to $2"
  description-action3       "Unknown action"
  html-body-text-min        "Set the minimum value of $0 to "
  html-body-text-max        "Set the maximum value of $0 to "
  property-name0          "Action"
  property-name1          "Amount"
  property-name2          "Variable name"
  property-name3          "Minimum"
  property-name4          "Maximum"
  property-description0       "The modification to perform"
  property-description1       "The amount by which to modify the specified variable"
  property-description2       "The name of the variable which is to be modified"
  property-description3       "Limit the maximum value of the specified variable to"
  property-description4       "Limit the minimum value of the specified variable to"
  property-action-list0       "Add to variable"
  property-action-list1       "Subtract from variable"
  property-action-list2       "Change variable to"
  property-action-list3       "Change minimum to"
  property-action-list4       "Change maximum to"
}
username-cz           "Změna proměnných"
string-table-cz {
  description-action0       "Přičíst$0 $1 k $2"
  description-action1       "Odečíst$0 $1 z $2"
  description-action2       "Změnit$0 $1 na $2"
  description-action3       "Neznámá akce"
  html-body-text-min        "Nastav minimální hodnotu $0 na "
  html-body-text-max        "Nastav maximální hodnotu $0 na "
  property-name0          "Akce"
  property-name1          "Množství"
  property-name2          "Název proměnné"
  property-name3          "Minimální"
  property-name4          "Maximální"
  property-description0       "Prováděná změna"
  property-description1       "Hodnota, o kterou bude změněna zadaná proměná"
  property-description2       "Název proměnné, která bude změněna"
  property-description3       "Omezit maximální hodnotu zvolené proměnné na"
  property-description4       "Omezit minimální hodnotu zvolené proměnné na"
  property-action-list0       "Přičíst k proměnné"
  property-action-list1       "Odečíst od proměnné"
  property-action-list2       "Změnit proměnnou na"
  property-action-list3       "Změnit minimum na"
  property-action-list4       "Změnit maximum na"
}
username-ru           "Изменить переменную"
string-table-ru {
  description-action0       "Сложить$0 $1 и $2"
  description-action1       "Вычесть$0 $1 из $2"
  description-action2       "Изменить$0 $1 на $2"
  description-action3       "Неизвестное действие"
  html-body-text-min        "Установить минимальное значение $0 в "
  html-body-text-max        "Установить максимальное значение $0 в "
  property-name0          "Действие"
  property-name1          "Значение"
  property-name2          "Имя переменной"
  property-name3          "Минимум"
  property-name4          "Максимум"
  property-description0       "Выполнить модификацию"
  property-description1       "Значение, на которое изменить указанную переменную"
  property-description2       "Имя изменяемой переменной"
  property-description3       "Изменить максимальное значение переменной на"
  property-description4       "Изменить минимальное значение переменной на"
  property-action-list0       "Прибавить к переменной"
  property-action-list1       "Вычесть из переменной"
  property-action-list2       "Изменить переменную на"
  property-action-list3       "Изменить минимум на"
  property-action-list4       "Изменить максимум на"
}
username-fr           "Modification de variable"
string-table-fr {
  description-action0       "Ajoute $0 $1 à $2"
  description-action1       "Soustrait $0 $1 à $2"
  description-action2       "Modifie $0 $1 à $2"
  description-action3       "Action inconnue"
  html-body-text-min        "Régler la valeur minimum de $0 sur "
  html-body-text-max        "Régler la valeur maximum de $0 sur "
  property-name0          "Action"
  property-name1          "Valeur"
  property-name2          "Nom de variable"
  property-name3          "Minimum"
  property-name4          "Maximum"
  property-description0       "La modification à effectuer"
  property-description1       "La valeur de la modification à apporter à la variable"
  property-description2       "Le nom de la variable à modifier"
  property-description3       "Limite la valeur maximale de la variable spécifiée à"
  property-description4       "Limite la valeur minimale de la variable spécifiée à"
  property-action-list0       "Ajouter à la variable"
  property-action-list1       "Soustraire à la variable"
  property-action-list2       "'Remplacer la variable par'"
  property-action-list3       "Modifier le minimum par"
  property-action-list4       "Modifier le maximum par"
}

ModifyScoreRule.gs:

include "ScenarioBehavior.gs"
include "World.gs"
include "SessionVariables.gs"

class ModifyScoreRule isclass ScenarioBehavior
{
  string modifierVariable = "score";
  int modifierAmount = 1;
  int modifierAction = 0;

  bool m_hasMinimum = false;
  bool m_hasMaximum = false;
  int m_minimum = 100;
  int m_maximum = 100;

  void DoModifyScore(void);

  public void Init(Asset asset)
  {
    inherited(asset);

    SetStateFlags(DOES_COMPLETE, true);
  }

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    modifierVariable = soup.GetNamedTag("ModifyScoreRule.modifierVariable");
    modifierAmount = soup.GetNamedTagAsInt("ModifyScoreRule.modifierAmount");
    modifierAction = soup.GetNamedTagAsInt("ModifyScoreRule.modifierAction");

    m_minimum = soup.GetNamedTagAsInt("ModifyScoreRule.minimum");
    m_maximum = soup.GetNamedTagAsInt("ModifyScoreRule.maximum", 100);
    m_hasMinimum = soup.GetNamedTagAsBool("ModifyScoreRule.hasMinimum");
    m_hasMaximum = soup.GetNamedTagAsBool("ModifyScoreRule.hasMaximum");

    if (!modifierVariable.size())
      modifierVariable = "score";
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("ModifyScoreRule.modifierVariable", modifierVariable);
    soup.SetNamedTag("ModifyScoreRule.modifierAmount", modifierAmount);
    soup.SetNamedTag("ModifyScoreRule.modifierAction", modifierAction);

    soup.SetNamedTag("ModifyScoreRule.minimum", m_minimum);
    soup.SetNamedTag("ModifyScoreRule.maximum", m_maximum);
    soup.SetNamedTag("ModifyScoreRule.hasMinimum", m_hasMinimum);
    soup.SetNamedTag("ModifyScoreRule.hasMaximum", m_hasMaximum);

    return soup;
  }

  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      DoModifyScore();
      SetComplete(true);
    }
  }

  void DoModifyScore(void)
  {
    if (!modifierVariable)
      return;

    KUID kuid = GetAsset().LookupKUIDTable("SessionVariables");
    SessionVariables lib = cast<SessionVariables> World.GetLibrary(kuid);

    if (modifierAction == 0)
      lib.IncVariableNumber(modifierVariable, modifierAmount);
    else if (modifierAction == 1)
      lib.DecVariableNumber(modifierVariable, modifierAmount);
    else if (modifierAction == 2)
      lib.SetVariableNumber(modifierVariable, modifierAmount);
    else
      Interface.Log("ModifyScoreRule.DoModifyScore> unknown action " + (string)modifierAction + " on variable " + modifierVariable);

    if (m_hasMinimum)
      lib.SetVariableMinimum(modifierVariable, m_minimum);
    if (m_hasMaximum)
      lib.SetVariableMaximum(modifierVariable, m_maximum);
  }

  public string GetDescriptionHTML(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

//    string body = "<html><body><font color=#000000><p><b>Modify Score</b></p>";
    string body = "<html><body><font color=#000000><p><b>" + strTable.GetString("modify-score-title") + "</b></p>";

    string propertyAction = "<a href=live://property/action>";
    string propertyAmount = "<a href=live://property/amount>" + (string)modifierAmount + "</a>";
    string propertyVariable = "<a href=live://property/variable>" + modifierVariable + "</a>";
    string properties;

    if (modifierAction == 0)
    {
      properties = propertyAction + strTable.GetString3("description-action0", "</a>&nbsp;", propertyAmount, propertyVariable);
    }
    else if (modifierAction == 1)
    {
      properties = propertyAction + strTable.GetString3("description-action1", "</a>&nbsp;", propertyAmount, propertyVariable);
    }
    else if (modifierAction == 2)
    {
      properties = propertyAction + strTable.GetString3("description-action2", "</a>&nbsp;", propertyVariable, propertyAmount);
    }
    else
    {
      properties = propertyAction + "<i>" + strTable.GetString("description-action3") + "</i></a>";
    }

    body = body + "<p>" + properties + "</p>";

    body = body + "<br>";

    body = body + "<p>" + HTMLWindow.CheckBox("live://property/has-minimum", m_hasMinimum) +
      strTable.GetString1("html-body-text-min", propertyVariable) + "<a href='live://property/minimum'>" + m_minimum + "</a>.</p>";

    body = body + "<p>" + HTMLWindow.CheckBox("live://property/has-maximum", m_hasMaximum) +
      strTable.GetString1("html-body-text-max", propertyVariable) + "<a href='live://property/maximum'>" + m_maximum + "</a>.</p>";

    body = body + "</font></body></html>";

    return body;
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string properties;

    if (modifierAction == 0)
    {
      properties = strTable.GetString3("description-action0", "", (string)modifierAmount, modifierVariable);
    }
    else if (modifierAction == 1)
    {
      properties = strTable.GetString3("description-action1", "", (string)modifierAmount, modifierVariable);
    }
    else if (modifierAction == 2)
    {
      properties = strTable.GetString3("description-action2", "", modifierVariable, (string)modifierAmount);
    }
    else
    {
      properties = strTable.GetString("description-action3");
    }

    return properties;
  }

  string GetPropertyType(string propertyID)
  {
    if (propertyID == "action")
      return "list";
    else if (propertyID == "amount")
      return "int,1,10000,1";

    if (propertyID == "has-maximum")
      return "link";

    if (propertyID == "has-minimum")
      return "link";

    return "string";
  }

  string GetPropertyName(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "action")
    {
      return strTable.GetString("property-name0");
    }
    else if (propertyID == "amount")
    {
      return strTable.GetString("property-name1");
    }
    else if (propertyID == "variable")
    {
      return strTable.GetString("property-name2");
    }
    else if (propertyID == "minimum")
    {
      return strTable.GetString("property-name3");
    }
    else if (propertyID == "maximum")
    {
      return strTable.GetString("property-name4");
    }

    return "";
  }

  string GetPropertyDescription(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if (propertyID == "action")
    {
      return strTable.GetString("property-description0");
    }
    else if (propertyID == "amount")
    {
      return strTable.GetString("property-description1");
    }
    else if (propertyID == "variable")
    {
      return strTable.GetString("property-description2");
    }
    else if (propertyID == "minimum")
    {
      return strTable.GetString("property-description3");
    }
    else if (propertyID == "maximum")
    {
      return strTable.GetString("property-description4");
    }

    return "";
  }

  public string[] GetPropertyElementList(string propertyID)
  {
    StringTable strTable = GetAsset().GetStringTable();

    int i;
    string [] result = new string[0];

    if (propertyID == "action")
    {
      result[0] = strTable.GetString("property-action-list0");
      result[1] = strTable.GetString("property-action-list1");
      result[2] = strTable.GetString("property-action-list2");
    }

    return result;
  }

  void SetPropertyValue(string propertyID, string p_value, int p_index)
  {
    if (propertyID == "action")
    {
      modifierAction = p_index;
    }
  }

  void SetPropertyValue(string propertyID, int value)
  {
    if (propertyID == "amount")
    {
      modifierAmount = value;
    }
  }

  void SetPropertyValue(string propertyID, string value)
  {
    if (propertyID == "variable")
    {
      modifierVariable = value;

      if (!modifierVariable.size())
        modifierVariable = "score";
    }

    if (propertyID == "maximum")
      m_maximum = Str.ToInt(value);

    if (propertyID == "minimum")
      m_minimum = Str.ToInt(value);
  }

  void LinkPropertyValue(string propertyID)
  {
    if (propertyID == "has-maximum")
      m_hasMaximum = !m_hasMaximum;

    if (propertyID == "has-minimum")
      m_hasMinimum = !m_hasMinimum;
  }

};


Variable Show
[Rules]

Variable Show Rule

config.txt:

﻿
username            "Variable Show"
kind              "behavior"
kuid              <kuid:-3:10207>
script              "ShowVariableRule"
class             "ShowVariableRule"
kuid-table {
  script-hud          <kuid:-18:1200>
}
icon-texture            "icon.texture"
string-table {
  html_rule_title         "Show Variable"
  html_body_text0         "Add variable <a href='live://property/variable'>$0</a> to the custom HUD with the label "
  html_body_text1         "Remove variable <a href='live://property/variable'>$0</a> from the custom HUD."
  html_body_text2         "<p>Note that this will not cause the custom HUD to be displayed if it is not already visible. Use the <i>Display Custom HUD</i> rule to show or hide the custom HUD.</p>"
  description0          "Add variable <i>'$0'</i> to the custom HUD with label <i>$1</i>."
  description1          "Remove variable <i>$0</i> from the custom HUD."
  blank-none          "none"
  ;
}
username-de           "Variablen-Anzeige"
string-table-de {
  html_rule_title         "Variable anzeigen"
  html_body_text0         "Variable<a href='live://property/variable'>$0</a> dem benutzerdefinierten HUD hinzufügen "
  html_body_text1         "Variable <a href='live://property/variable'>$0</a> aus dem benutzerdefinierten HUD entfernen."
  html_body_text2         "<p>Beachten Sie, dass dies nicht zur Anzeige des benutzerdefinierten HUDs führt, falls dieses nicht bereits angezeigt wird. Verwenden Sie die <i>benutzerdefiniertes HUD anzeigen</i>-Regel, um das benutzerdefinierte HUD anzuzeigen oder zu verbergen.</p>"
  description0          "Variable $0 dem benutzerdefinierten HUD mit dem Label $1 hinzufügen."
  description1          "Variable $0 aus dem benutzerdefinierten HUD entfernen."
  ;
}
username-it           "Variable Show"
string-table-it {
  html_rule_title         "Show Variable"
  html_body_text0         "Add variable <a href='live://property/variable'>$0</a> to the custom HUD with the label "
  html_body_text1         "Remove variable <a href='live://property/variable'>$0</a> from the custom HUD."
  html_body_text2         "<p>Note that this will not cause the custom HUD to be displayed if it is not already visible. Use the <i>Display Custom HUD</i> rule to show or hide the custom HUD.</p>"
  description0          "Add variable $0 to the custom HUD with label $1."
  description1          "Remove variable $0 from the custom HUD."
  ;
}
username-es           "Mostrar variables"
string-table-es {
  html_rule_title         "Mostrar variables"
  html_body_text0         "Añadir variable <a href='live://property/variable'>$0</a> al visor personalizado con la etiqueta "
  html_body_text1         "Quitar variable <a href='live://property/variable'>$0</a> al visor personalizado."
  html_body_text2         "<p>ten en cuenta que esto no hará que aparezca el visor personalizado si éste aún no es visible. Usa la regla <i>Mostrar visor personalizado</i> para mostrarlo u ocultarlo.</p>"
  description0          "Añade la variable $0 al visor personalizado con la etiqueta $1."
  description1          "Quita la variable $0 del visor personalizado."
  ;
}
username-pl           "Variable Show"
string-table-pl {
  html_rule_title         "Show Variable"
  html_body_text0         "Add variable <a href='live://property/variable'>$0</a> to the custom HUD with the label "
  html_body_text1         "Remove variable <a href='live://property/variable'>$0</a> from the custom HUD."
  html_body_text2         "<p>Note that this will not cause the custom HUD to be displayed if it is not already visible. Use the <i>Display Custom HUD</i> rule to show or hide the custom HUD.</p>"
  description0          "Add variable $0 to the custom HUD with label $1."
  description1          "Remove variable $0 from the custom HUD."
  ;
}
username-cz           "Zobrazit proměnné"
string-table-cz {
  html_rule_title         "Zobrazit proměnné"
  html_body_text0         "Přidat proměnnou <a href='live://property/variable'>$0</a> na uživatelský panel pod označením "
  html_body_text1         "Odstranit proměnnou <a href='live://property/variable'>$0</a> z uživatelského panelu."
  html_body_text2         "<p>Pamatuj, že tímto nedojde k zobrazení uživatelského panelu v případě, že je nyní skryt. K zobrazení/skrytí panelu použij pravidlo <i>Zobrazit uživatelský informační panel</i>.</p>"
  description0          "Přidat proměnnou $0 na uživatelský panel pod označením $1."
  description1          "Odstranit proměnnou $0 z uživatelského panelu."
  ;
}
username-ru           "Переменная"
string-table-ru {
  html_rule_title         "Показать переменную"
  html_body_text0         "Добавить переменную $0 к Панели управления с меткой "
  html_body_text1         "Удалить переменную $0 из Панели управления."
  html_body_text2         "
Учтите, что это не вызовет отображения Панели управления, если она до этого не была видна. Используйте правило Показать Панель управления для отображения или скрытия Панели управления."
  description0          "Добавить переменную $0 к Панели управления с меткой $1."
  description1          "Удалить переменную $0 из Панели управления."
}
username-fr           "Affichage de variable"
string-table-fr {
  html_rule_title         "Afficher variable"
  html_body_text0         "Ajouter la variable <a href='live://property/variable'>$0</a> à l'ATH personnalisé accompagnée de la mention "
  html_body_text1         "Retirer la variable <a href='live://property/variable'>$0</a> de l'ATH personnalisé."
  html_body_text2         "<p>Notez bien que ces commandes n'ont aucune influence sur l'affichage de l'ATH. Utilisez la règle <i>Afficher ATH personnalisé</i> pour afficher ou masquer l'ATH.</p>"
  description0          "Ajoute la variable $0 à l'ATH personnalisé accompagnée de la mention $1."
  description1          "Retire la variable $0 de l'ATH personnalisé."
  ;
}

ShowVariableRule.gs:

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"
include "Browser.gs"
//include "ButtonBar.gs"
include "ObjectiveList.gs"

class ShowVariableRule isclass ScenarioBehavior
{
  string m_displayName = "Score";
  string m_variableName = "score";
  bool m_show = true;
  Asset objectiveAsset = null;

  void PerformShowVariable(void);

  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (paused)
    {
    }
    else if (!IsComplete())
    {
      PerformShowVariable();
    }
  }

  //
  // PropertyObject methods
  //

  // Sets the propeties of this rule from the given database.
  public void SetProperties(Soup soup)
  {
    inherited(soup);

    m_displayName = soup.GetNamedTag("ShowVariableRule.displayName");
    m_variableName = soup.GetNamedTag("ShowVariableRule.variableName");
    m_show = soup.GetNamedTagAsBool("ShowVariableRule.show", true);

    if (m_variableName == "")
      m_variableName = "score";
  }

  // Packs properties of this rule up into a database.
  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("ShowVariableRule.displayName", m_displayName);
    soup.SetNamedTag("ShowVariableRule.variableName", m_variableName);
    soup.SetNamedTag("ShowVariableRule.show", m_show);

    return soup;
  }

  // Returns HTML code with link that allows control mode to be changed.
  public string GetDescriptionHTML(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    string labName = m_displayName;
    if (labName == "")
      labName = "<i>" + strTable.GetString("blank-none") + "</i>";
    else
      labName = "'" + labName + "'";

    string body = "";

    body = body + "<p><b>" + strTable.GetString("html_rule_title") + "</b></p>";

    body = body + "<p>" + HTMLWindow.CheckBox("live://property/show", m_show) +
      strTable.GetString1("html_body_text0", m_variableName) + "<a href='live://property/label'>" + labName + "</a>.</p>";

    body = body + "<p>" + HTMLWindow.CheckBox("live://property/hide", !m_show) +
      strTable.GetString1("html_body_text1", m_variableName) + "</p>";

    body = body + "<br>";

    body = body + strTable.GetString("html_body_text2");

    return "<html><body><font color=#000000>" + body + "</font></body></html>";
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();
    string labName = m_displayName;
    if (labName == "")
      labName = "<i>" + strTable.GetString("blank-none") + "</i>";
    else
      labName = "'" + labName + "'";

    if (m_show)
      return strTable.GetString2("description0", m_variableName, labName);

    return strTable.GetString1("description1", m_variableName);
  }

  public string GetPropertyType(string propertyID)
  {
    if (propertyID == "variable")
      return "string";

    if (propertyID == "label")
      return "string";

    if (propertyID == "show")
      return "link";

    if (propertyID == "hide")
      return "link";

    return "null";
  }

  void SetPropertyValue(string propertyID, string value)
  {
    if (propertyID == "variable")
    {
      if (value == "")
        m_variableName = "score";
      else
        m_variableName = value;
    }

    if (propertyID == "label")
      m_displayName = value;
  }

  void LinkPropertyValue(string propertyID)
  {
    if (propertyID == "show")
      m_show = true;

    if (propertyID == "hide")
      m_show = false;
  }

  void PerformShowVariable(void)
  {
    // New objective
    KUID kuid = GetAsset().LookupKUIDTable("script-hud");
    Library scriptHUD = World.GetLibrary(kuid);

    if (m_show)
    {
      string[] params = new string[2];
      params[0] = m_displayName;
      params[1] = m_variableName;
      scriptHUD.LibraryCall("add-variable", params, null);
    }
    else
    {
      string[] params = new string[1];
      params[0] = m_variableName;
      scriptHUD.LibraryCall("remove-variable", params, null);
    }

    SetComplete(true);
  }

};


Vehicle Physics
[Rules]

Vehicle Physics Rule

config.txt:

﻿
username            "Vehicle Physics"
kind              "behavior"
kuid              <kuid:-16:280742>
script              "VehiclePhysicsRule"
class             "VehiclePhysicsRule"
icon-texture            "VehiclePhysicsRule.texture"
string-table {
  group-handler-html-prefix     "<table cellspacing=0 cellpadding=0><tr><td width=2></td><td><font color=#000000>"
  group-handler-html-sufix      "</font></td></tr></table>"
  notdefault-param-html-sufix     "<table cellspacing=0 cellpadding=0><tr><td width=2></td><td><font color=#ff0000>Warning! Adjusting these parameters may results in unpredicatable results. When in doubt, return them to the default (<img src='triangle-empty-red.tga'>) settings.</font></td></tr></table><br><br><br>"
  coupler-parameters-label      "<b>Coupler Parameters</b>"
  coupler-expansion/html-pre      "Couplers break at "
  coupler-expansion/html-post     " kN expansion force. "
  coupler-expansion/name        "Coupler expansion breakage"
  coupler-expansion/description     "Coupler breakage force"
  coupler-velocity/html-pre     "Couplers break when coupling above "
  coupler-velocity/html-post      " kph "
  coupler-velocity/name       "Couple speed breakage"
  coupler-velocity/description      "Coupler breakage speed"
  coupler-compression/html-pre      "Couplers break at "
  coupler-compression/html-post     " kN compression force "
  coupler-compression/name      "Coupler compression breakage"
  coupler-compression/description     "Coupler breakage force"
  coupler-breakage-hud-html-checkbox    "Show coupler breakage HUD"
  coupler-breakage-hud-html-prefix    "<font color=#000000>"
  coupler-breakage-hud-html-sufix     "</font><br>"
  wheelslip-parameters-label      "<b>Wheelslip Parameters</b>"
  traction-maxeffort/html-pre     "Maximum tractive effort adjusted by "
  traction-maxeffort/html-post      " % "
  traction-maxeffort/name       "Maximum tractive effort"
  traction-maxeffort/description      "Maximum tractive (%)"
  traction-wheelslip/html-pre     "Traction is reduced to "
  traction-wheelslip/html-post      " % while wheelslipping. "
  traction-wheelslip/name       "Wheelslip traction"
  traction-wheelslip/description      "Traction (%) while wheelslipping"
  traction-sanding/html-pre     "Traction boost is "
  traction-sanding/html-post      " % while sanding. "
  traction-sanding/name       "Traction boost"
  traction-sanding/description      "Traction boost (%) while sanding"
  sway-parameters-label       "<b>Sway Parameters</b>"
  cabsway-level/html-pre        "Cab sway level is set to "
  cabsway-level/html-post       " % "
  cabsway-level/name        "Cab sway"
  cabsway-level/description     "Cab sway (%)"
  description         "Overrides the default vehicle physics parameters."
}
kuid-table {
  coupler-breakage-hud        <kuid:-16:18853>
}
username-fr           "Spécificités techniques des véhicules"
string-table-fr {
  group-handler-html-prefix     "<table cellspacing=0 cellpadding=0><tr><td width=2></td><td><font color=#000000>"
  group-handler-html-sufix      "</font></td></tr></table>"
  notdefault-param-html-sufix     "<table cellspacing=0 cellpadding=0><tr><td width=2></td><td><font color=#ff0000>Attention ! Le réglage de ces paramètres peut donner des résultats inattendus. Si vous avez des doutes, reprenez les réglages par défaut (<img src='triangle-empty-red.tga'>).</font></td></tr></table><br><br><br>"
  coupler-parameters-label      "<b>Paramètres d'attelage</b>"
  coupler-expansion/html-pre      "Rupture d'attelage à "
  coupler-expansion/html-post     " kN de force d'expansion. "
  coupler-expansion/name        "Rupture d'expansion d'attelage"
  coupler-expansion/description     "Force de rupture d'attelage"
  coupler-velocity/html-pre     "Rupture d'attelage lorsque l'attelage s'effectue au-dessus de "
  coupler-velocity/html-post      " km/h "
  coupler-velocity/name       "Vitesse de rupture d'attelage"
  coupler-velocity/description      "Vitesse de rupture d'attelage"
  coupler-compression/html-pre      "Rupture d'attelage à "
  coupler-compression/html-post     " kN de force de compression "
  coupler-compression/name      "Rupture de compression d'attelage"
  coupler-compression/description     "Force de rupture d'attelage"
  coupler-breakage-hud-html-checkbox    "Afficher ATH de rupture d'attelage"
  coupler-breakage-hud-html-prefix    "<font color=#000000>"
  coupler-breakage-hud-html-sufix     "</font><br>"
  wheelslip-parameters-label      "<b>Paramètres de patinage</b>"
  traction-maxeffort/html-pre     "Effort de traction maximum ajusté de "
  traction-maxeffort/html-post      " % "
  traction-maxeffort/name       "Effort de traction maximum"
  traction-maxeffort/description      "Traction maximum (%)"
  traction-wheelslip/html-pre     "La traction est réduite à "
  traction-wheelslip/html-post      " % pendant le patinage. "
  traction-wheelslip/name       "Traction de patinage"
  traction-wheelslip/description      "Traction (%) pendant le patinage"
  traction-sanding/html-pre     "Augmentation de traction de "
  traction-sanding/html-post      " % avec le sablage. "
  traction-sanding/name       "Augmentation de traction"
  traction-sanding/description      "Augmentation de traction (%) lors du sablage"
  sway-parameters-label       "<b>Paramètres oscillation</b>"
  cabsway-level/html-pre        "Niveau d'oscillation de la cabine défini à "
  cabsway-level/html-post       " % "
  cabsway-level/name        "Oscillation cabine"
  cabsway-level/description     "Oscillation cabine (%)"
  description         "Dépasse les spécificités techniques par défaut du véhicule."
}

VehiclePhysicsRule.gs:

//
// VehiclePhysicsRule.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "ScenarioBehavior.gs"
include "World.gs"
include "Browser.gs"
include "common.gs"
include "Library.gs"
include "ListItemPropertyHandler.gs"
include "VehicleHelperInfo.gs"

class NumberValueHandler isclass HTMLPropertyHandler
{
  StringTable stringTable;
  public float numberValue;
  public float minValue, maxValue, stepValue;

  public void Init(Asset asset, float min, float max, float step)
  {
    stringTable = asset.GetStringTable();
    minValue = min;
    maxValue = max;
    stepValue = step;
    numberValue = minValue;
  }

  public string GetDescriptionHTML(void)
  {
    string numberString = numberValue;
    Str.TrimRight(numberString, "0");
    if (numberString == "")
      numberString = "0";
    else if (numberString[numberString.size() - 1] == '.')
      numberString[numberString.size()-1, ] = null;

    return
      stringTable.GetString( GetPrefix() + "html-pre" ) +
      HREF("value") +
      numberString +
      "</a>" +
      stringTable.GetString( GetPrefix() + "html-post" );
  }

  public string GetPropertyName(string propertyID)
  {
    return
      stringTable.GetString( GetPrefix() + "name" );
  }

  public string GetPropertyDescription(string propertyID)
  {
    return
      stringTable.GetString( GetPrefix() + "description" );
  }

  public string GetPropertyType(string propertyID)
  {
    return
      "float," + minValue + "," + maxValue + "," + stepValue;
  }

  public string GetPropertyValue(string propertyID)
  {
    return
      (string)numberValue;
  }

  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    numberValue = value.AsFloat();
  }

  public PropertyValue GetPropertyAttribute(string propertyID, string attribute)
  {
    if (propertyID != GetPrefix())
      return inherited(propertyID, attribute);

    PropertyValue ret = new PropertyValue();

    if (attribute == "value")
      ret.Set(numberValue);

    else
      return inherited(propertyID, attribute);

    return ret;
  }

  public void SetPropertyAttribute(string propertyID, string attribute, PropertyValue value)
  {
    if (propertyID != GetPrefix())
    {
      inherited(propertyID, attribute, value);
      return;
    }

    if (attribute == "value")
      numberValue = value.AsFloat();
    else
      inherited(propertyID, attribute, value);
  }

  public void SetProperties(Soup soup);
  public Soup GetProperties(void);

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    numberValue = soup.GetNamedTagAsFloat("number");
  }

  public Soup GetProperties(void)
  {
    Soup soup = Constructors.NewSoup();

    soup.SetNamedTag("number", numberValue);

    return soup;
  }
};

//
// This is for the new icon/default based HTML Henkmosnter wanted.
//
class NumberValueIconHandler isclass NumberValueHandler
{
  public float defaultValue;

  public void Init(Asset asset, float min, float max, float step, float newDefault)
  {
    Init(asset, min, max, step);
    numberValue = defaultValue = newDefault;
  }

  public string GetDescriptionHTML(void)
  {
    string numberString = numberValue;
    Str.TrimRight(numberString, "0");
    if (numberString == "")
      numberString = "0";
    else if (numberString[numberString.size() - 1] == '.')
      numberString[numberString.size()-1, ] = null;

    string defaultIcon = "";
    if (numberValue == defaultValue)
      defaultIcon = "<img src='triangle-filled.tga'>";
    else
      defaultIcon = HREF("reset-default") + "<img src='triangle-empty.tga'></a>";

    return
      stringTable.GetString( GetPrefix() + "html-pre" ) +
      HREF("value") +
      numberString +
      "</a>" +
      stringTable.GetString( GetPrefix() + "html-post" ) +
      defaultIcon + "<br>";
  }

  public PropertyValue GetPropertyAttribute(string propertyID, string attribute)
  {
    if (propertyID != GetPrefix())
      return inherited(propertyID, attribute);

    if (attribute == "notDefault")
    {
      PropertyValue ret = new PropertyValue();
      ret.Set(numberValue != defaultValue);
      return ret;
    }

    return inherited(propertyID, attribute);
  }

  public string GetPropertyType(string propertyID)
  {
    if (PropStripPrefix(propertyID, "") == "reset-default")
      return "link";

    return inherited(propertyID);
  }

  public void SetPropertyValue(string propertyID, PropertyValue value)
  {
    if (PropStripPrefix(propertyID, "") == "reset-default")
      numberValue = defaultValue;
    else
      inherited(propertyID, value);
  }

};

class TextLabelHandler isclass HTMLPropertyHandler
{
  StringTable stringTable;
  string localisedTextLabel;

  public void Init(Asset asset, string textLabelID)
  {
    stringTable = asset.GetStringTable();
    localisedTextLabel = stringTable.GetString(textLabelID);
  }

  public string GetDescriptionHTML(void)
  {
    return "<p>" + localisedTextLabel + "</p>";
  }
};

class DividerHandler isclass HTMLPropertyHandler
{
  public void Init(Asset asset)
  {
  }

  public string GetDescriptionHTML(void)
  {
    return "<br><TABLE><TR height=2><TD width=100% bgcolor=#000000BB> </TD></TR></TABLE>";
  }
};

static class GUI
{
  public HTMLPropertyHandler NewCheckbox(Asset asset, string prefix)
  {
    CheckBoxHandler item = new CheckBoxHandler();
    item.Init(asset, prefix, false);
//    item.SetAutoNameDesc(false); // auto name+desc finding from CheckBox's parent ConfigHandler isn't needed, switch off
    return cast<HTMLPropertyHandler>item;
  }

  public HTMLPropertyHandler NewNumberValue(Asset asset, float min, float max, float step)
  {
    NumberValueHandler item = new NumberValueHandler();
    item.Init(asset, min, max, step);
    return cast<HTMLPropertyHandler>item;
  }

  public HTMLPropertyHandler NewNumberValueIcon(Asset asset, float min, float max, float step, float defaultVal)
  {
    NumberValueIconHandler item = new NumberValueIconHandler();
    item.Init(asset, min, max, step, defaultVal);
    return cast<HTMLPropertyHandler> item;
  }

  public HTMLPropertyGroup NewGroupFrame(Asset asset)
  {
    HTMLPropertyGroup item = new HTMLPropertyGroup();
    item.hasFrame = true;
    return item;
  }

  public HTMLPropertyHandler NewDivider(Asset asset)
  {
    DividerHandler item = new DividerHandler();
    item.Init(asset);
    return cast<HTMLPropertyHandler>item;
  }

  public HTMLPropertyHandler NewTextLabel(Asset asset, string label)
  {
    TextLabelHandler item = new TextLabelHandler();
    item.Init(asset, label);
    return cast<HTMLPropertyHandler>item;
  }

  /*public TrainHelperInfo NewTrainHelper(Asset asset)
  {
    TrainHelperInfo ret = new TrainHelperInfo();
    ret.Init();
    return ret;
  }*/

  public VehicleHelperInfo NewVehicleHelper(Asset asset)
  {
    VehicleHelperInfo ret = new VehicleHelperInfo();
    ret.Init();
    return ret;
  }
};

class VehiclePhysicsRule isclass ScenarioBehavior
{
  StringTable stringTable;
  ConfigAssetGroupHandler mainPropertyHandler;
  VehicleHelperInfo vehicleHelper;
  CheckBoxHandler m_couplerBreakageHUDHandler;

  public void Init(Asset self)
  {
    inherited(self);
    stringTable = self.GetStringTable();

    // handler stuff...
    PropertyValue pv = new PropertyValue();

    mainPropertyHandler = new ConfigAssetGroupHandler();
    mainPropertyHandler.Init(me.GetAsset(), "group-handler");

    // train filter handler
    vehicleHelper = GUI.NewVehicleHelper(self);
    mainPropertyHandler.AddHandler(vehicleHelper, "trains");

    // Coupler Parameters
    mainPropertyHandler.AddHandler(GUI.NewDivider(self), "");
    mainPropertyHandler.AddHandler(GUI.NewTextLabel(self, "coupler-parameters-label"), "");

    // coupler parameters - expansion force/couplers break at
    mainPropertyHandler.AddHandler(GUI.NewNumberValueIcon(self, 100.0f, 10000.0f, 100.0f, 2500.0f), "coupler-expansion/");

    // coupler parameters - speed/couplers break at >
    mainPropertyHandler.AddHandler(GUI.NewNumberValueIcon(self, 1.0f, 10000.0f, 100.0f, 5.0f), "coupler-velocity/");

    // cehck box to enable/disable the coupler breakage HUD
    m_couplerBreakageHUDHandler = new CheckBoxHandler();
    m_couplerBreakageHUDHandler.Init(me.GetAsset(), "coupler-breakage-hud");
    mainPropertyHandler.AddHandler(m_couplerBreakageHUDHandler, "couplerHUD/");

    // wheelslip paramaters
    mainPropertyHandler.AddHandler(GUI.NewDivider(self), "");
    mainPropertyHandler.AddHandler(GUI.NewTextLabel(self, "wheelslip-parameters-label"), "");

    // wheelslip paramaters - tractive effort
    mainPropertyHandler.AddHandler(GUI.NewNumberValueIcon(self, 1.0f, 200.0f, 1.0f, 100.0f), "traction-maxeffort/");

    // wheelslip paramaters - % of traction available during wheelslip
    mainPropertyHandler.AddHandler(GUI.NewNumberValueIcon(self, 1.0f, 100.0f, 1.0f, 25.0f), "traction-wheelslip/");

    // wheelslip paramaters - percentage of traction gained by sanding
    mainPropertyHandler.AddHandler(GUI.NewNumberValueIcon(self, 0.0f, 100.0f, 1.0f, 10.0f), "traction-sanding/");

    // Sway Parameters
    mainPropertyHandler.AddHandler(GUI.NewDivider(self), "");
    mainPropertyHandler.AddHandler(GUI.NewTextLabel(self, "sway-parameters-label"), "");

    // sway parameters - cabin sway level
    mainPropertyHandler.AddHandler(GUI.NewNumberValueIcon(self, 0.0f, 100.0f, 1.0f, 10.0f), "cabsway-level/");

    SetPropertyHandler(mainPropertyHandler);
  }

// dw: we don't have visible/invidible values anymore, everything is there (as the Henkmeister specified)
/*  public void PropertyBrowserRefresh(Browser browser)
  {
    mainPropertyHandler.SetPropertyAttribute("coupler-compression/", "visible", mainPropertyHandler.GetPropertyAttribute("coupler-compression", "value"));
    mainPropertyHandler.SetPropertyAttribute("coupler-expansion/", "visible", mainPropertyHandler.GetPropertyAttribute("coupler-expansion", "value"));
    mainPropertyHandler.SetPropertyAttribute("coupler-velocity/", "visible", mainPropertyHandler.GetPropertyAttribute("coupler-velocity", "value"));
    mainPropertyHandler.SetPropertyAttribute("wheelslip/", "visible", mainPropertyHandler.GetPropertyAttribute("wheelslip", "value"));
    mainPropertyHandler.SetPropertyAttribute("sanding/", "visible", mainPropertyHandler.GetPropertyAttribute("sanding", "value"));
    mainPropertyHandler.SetPropertyAttribute("cab-sway/", "visible", mainPropertyHandler.GetPropertyAttribute("cab-sway", "value"));
    mainPropertyHandler.SetPropertyAttribute("max-TE/", "visible", mainPropertyHandler.GetPropertyAttribute("max-TE", "value"));

    inherited(browser);
  }*/

  //
  // ScenarioBehavior methods
  //

  // Pause/unpause this rule.
  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused)
    {
      // enact these settings
      Vehicle[] vehicleList = World.GetVehicleList();
      int i;
      for (i = 0; i < vehicleList.size(); i++)
      {
        Vehicle vehicle = vehicleList[i];
        if (vehicleHelper.DoesMatch(vehicle))
        {
          // coupler breaks at expansion force
          float couplerBreakageLimit = mainPropertyHandler.GetPropertyAttribute("coupler-expansion/", "value").AsFloat();
          vehicle.SetMaximumCouplerExpansionStress(couplerBreakageLimit * 1000);
          vehicle.SetCouplerBreakageEnabled(true);

          // a bad couple occurs when couplers are joined above a certain speed
          float badCoupleVelocity = mainPropertyHandler.GetPropertyAttribute("coupler-velocity/", "value").AsFloat();
          vehicle.SetMaximumCoupleVelocity( badCoupleVelocity / 3.6 );
          vehicle.SetCouplerBreakageEnabled(true);

          // maxium tractive effort ratio
          float maximumTractiveEffort = mainPropertyHandler.GetPropertyAttribute("traction-maxeffort/", "value").AsFloat();
          vehicle.SetMaximumTractiveEffort(maximumTractiveEffort * 0.01 * vehicle.GetDefaultMaximumTractiveEffort());

          // traction is reduced by a set value when wheels are slipping
          float wheelslipTraction = mainPropertyHandler.GetPropertyAttribute("traction-wheelslip/", "value").AsFloat();
          vehicle.SetWheelslipTractionMultiplier(wheelslipTraction * 0.01f);

          // traction is boost by a set value when sanding is enabled
          float sandingTraction = mainPropertyHandler.GetPropertyAttribute("traction-sanding/", "value").AsFloat();
          vehicle.SetSandingTractionMultiplier(1.0f + sandingTraction * 0.01f);

          // cabin sway level
          float cabSwayAmount = mainPropertyHandler.GetPropertyAttribute("cabsway-level/", "value").AsFloat();
          vehicle.SetCabinSwayAmount(cabSwayAmount * 0.01f);
        }
      }

      // send request to show/hide coupler breakage HUD as required
      Library couplerHUDLib = World.GetLibrary( me.GetAsset().LookupKUIDTable("coupler-breakage-hud") );
      if (couplerHUDLib)
      {
        if (m_couplerBreakageHUDHandler.GetBoolValue())
          couplerHUDLib.LibraryCall("show", null, null);
        else
          couplerHUDLib.LibraryCall("hide", null, null);
      }

      SetComplete(true);
    }
  }

  public string GetDescriptionHTML(void)
  {
    string htmlPage = inherited();

    // if any one of the value properties is not the default values, we put in this warning message
    if (mainPropertyHandler.GetPropertyAttribute("coupler-expansion/", "notDefault").AsBool()  or
        mainPropertyHandler.GetPropertyAttribute("coupler-velocity/", "notDefault").AsBool()   or
        mainPropertyHandler.GetPropertyAttribute("traction-maxeffort/", "notDefault").AsBool() or
        mainPropertyHandler.GetPropertyAttribute("traction-wheelslip/", "notDefault").AsBool() or
        mainPropertyHandler.GetPropertyAttribute("traction-sanding/", "notDefault").AsBool()   or
        mainPropertyHandler.GetPropertyAttribute("cabsway-level/", "notDefault").AsBool())
      htmlPage = htmlPage + stringTable.GetString("notdefault-param-html-sufix");

    return htmlPage;
  }

};


Wait for Camera View Mode
[Rules]

Wait for Camera View Mode Rule

config.txt:

﻿
username            "Wait for Camera View Mode"
kind              "behavior"
kuid              <kuid:-18:1218>
script              "WaitForCameraViewMode"
class             "WaitForCameraViewMode"
icon-texture            "wait_camera_view_mode.texture"
string-table {
  description         "Waits for the camera to be changed to the designated view."
  description_info        "Waits for the camera to be changed to the '<i>$0</i>' view."
  wait-camera-run-once-html-checkbox    "Trigger rule once"
  wait-camera-run-once-html-prefix    "<table border='0' cellspacing='0' cellpadding='0'><tr height='1'></tr><tr><td width=1></td><td><font color=#000000>"
  wait-camera-run-once-html-sufix     "</font></td></tr></table>"
  wait-camera-view-mode-html-property   "Wait for the camera to change to the $0 camera mode."
  wait-camera-view-mode-blank-string    "<i>click to select</i>"
  wait-camera-view-mode-html-prefix   "<table border='0' cellspacing='0' cellpadding='0'><tr><td width='4'></td><td><font color=#000000>"
  wait-camera-view-mode-html-sufix    "</font></td></tr></table>"
  wait-camera-view-mode-name-itemname   "Camera mode"
  wait-camera-view-mode-desc-itemname   "Camera mode to wait for"
  wait-camera-view-mode-item0     "wait-camera-view-mode-item-internal"
  wait-camera-view-mode-item1     "wait-camera-view-mode-item-external"
  wait-camera-view-mode-item2     "wait-camera-view-mode-item-tracking"
  wait-camera-view-mode-item3     "wait-camera-view-mode-item-roaming"
  wait-camera-view-mode-item-internal   "Cab View"
  wait-camera-view-mode-item-external   "External View"
  wait-camera-view-mode-item-tracking   "Tracking View"
  wait-camera-view-mode-item-roaming    "Free Roaming"
  wait-object-focus-html-prefix     "<table border=0 cellspacing=0 cellpadding=0><tr><td width=3></td><td>"
  wait-object-focus-html-sufix      "</td></tr></table><br><br><br>"
  wait-object-enable-html-checkbox    "Wait for the camera to target vehicle: "
  wait-object-enable-html-prefix      "<font color=#000000>"
  wait-object-enable-html-sufix     "</font>"
  wait-object-target-object-type      "traincar"
  wait-object-target-blank-string     "<i>click to select</i>"
  wait-object-target-object-html-property   "$0"
  wait-object-target-html-prefix      "<font color=#000000>"
  wait-object-target-html-sufix     "</font>"
  wait-object-target-name-gameobjectname    "Target Vehicle"
  wait-object-target-desc-gameobjectname    "Vehicle camera is to focus on"
}
kuid-table {
  driver_module         <kuid:-16:10240>
}
username-fr           "Attente d'un mode caméra"
string-table-fr {
  description         "Attend que la caméra passe à la vue choisie."
  description_info        "Attend que la caméra passe en '<i>$0</i>."

  wait-camera-run-once-html-checkbox    "Déclencher la règle une fois"

  wait-camera-view-mode-html-property   "Attend que la caméra passe en mode $0."
  wait-camera-view-mode-blank-string    "<i>Cliquez pour sélectionner</i>"
  wait-camera-view-mode-name-itemname   "Mode caméra"
  wait-camera-view-mode-desc-itemname   "Mode caméra attendu"

  wait-camera-view-mode-item-internal   "Vue cabine"
  wait-camera-view-mode-item-external   "Vue extérieure"
  wait-camera-view-mode-item-tracking   "Vue poursuite"
  wait-camera-view-mode-item-roaming    "Caméra libre"

  wait-object-enable-html-checkbox    "Attend que la caméra se focalise sur le véhicule : "
  wait-object-target-blank-string     "<i>Cliquez pour sélectionner</i>"
  wait-object-target-name-gameobjectname    "Véhicule à cibler"
  wait-object-target-desc-gameobjectname    "Focaliser la caméra sur le véhicule"
}

WaitForCameraViewMode.gs:

//
// WaitForCameraViewMode.gs
//
//  Copyright (C) 2004-2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"
include "World.gs"
include "common.gs"

//
// Rule that waits for the camera to be set to the specified node in Driver to be satisfied.
// Once satisfied, this rule is complete and all child rules will be executed (if any).
//
class WaitForCameraViewMode isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler             m_runOnlyOnceHandler;
  EnumeratedPropertyHandler   m_cameraModeHandler;
  CheckBoxHandler             m_waitObjectEnableHandler;
  EnumeratedGameObjectHandler m_waitObjectTargetHandler;
  ConfigAssetGroupHandler     m_waitGroupHandler;
  HTMLPropertyGroup           m_groupHandler;

  string[] m_compareNames = new string[0];

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data ymembers
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property info handler stuff
    m_runOnlyOnceHandler = new CheckBoxHandler();
    m_runOnlyOnceHandler.Init(me.GetAsset(), "wait-camera-run-once");

    m_cameraModeHandler = new EnumeratedPropertyHandler();
    m_cameraModeHandler.Init(me.GetAsset(), "wait-camera-view-mode", 4);

    m_waitObjectEnableHandler = new CheckBoxHandler();
    m_waitObjectEnableHandler.Init(me.GetAsset(), "wait-object-enable");

    m_waitObjectTargetHandler = new EnumeratedGameObjectHandler();
    m_waitObjectTargetHandler.Init(me.GetAsset(), "wait-object-target");

    m_waitGroupHandler = new ConfigAssetGroupHandler();
    m_waitGroupHandler.Init(me.GetAsset(), "wait-object-focus");
    m_waitGroupHandler.AddHandler(m_waitObjectEnableHandler, "enable/");
    m_waitGroupHandler.AddHandler(m_waitObjectTargetHandler, "target/");

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_runOnlyOnceHandler, "runOnceMode/");
    m_groupHandler.AddHandler(m_cameraModeHandler, "cameraMode/");
    m_groupHandler.AddHandler(m_waitGroupHandler, "waitTarget/");

    SetPropertyHandler(m_groupHandler);

    // set a comparison array for using against messages
    int i;
    for (i = 0; i < m_cameraModeHandler.GetItemCount(); i++)
    {
      m_compareNames[i] = m_cameraModeHandler.GetItem(i);
      m_compareNames[i] = m_compareNames[i][m_cameraModeHandler.GetConfigPrefix().size()+6,];
    }
  }

  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    wait()
    {
      on "Camera", "", msg:
      {
        if (IsPaused())
          break;

        // is this rule meant to detect a target change to specific vehicle?
        // (if so, we ignore what the set-mode setting is)
        if (msg.minor == "Target-Changed")
        {
          if (m_waitObjectEnableHandler.GetBoolValue())
          {
            if (msg.minor == "Target-Changed")
            {
              Vehicle cameraVehicle = cast<Vehicle> msg.src;
              Vehicle targetVehicle = cast<Vehicle> m_waitObjectTargetHandler.GetGameObject();
              if (cameraVehicle  and  targetVehicle)
              {
                if (cameraVehicle == targetVehicle)
                {
                  Interface.Log("# WaitForCameraViewMode.ThreadPollCondition> INFO: Rule condition of vehicle '" + targetVehicle.GetLocalisedName() + "' being focused on met!");
                  ruleSet = true;
                }
              }
            }
//            else
//              ruleSet = false;
          }

          PostMessage(me, "Timer", "Tick", 0.0);
          continue;
        }

        // otherwise, it is wait for camera mode
        else if (!m_waitObjectEnableHandler.GetBoolValue()  and  TrainUtil.HasSufix(msg.minor, "-View"))
        {
          // otherwise, we just check for the mode...
          string newMode = msg.minor;
          Str.TrimRight(newMode, "-View");
          Str.ToLower(newMode);

          // do rule check
          int validCameraMode = (m_compareNames[m_cameraModeHandler.GetItemIndex()] == newMode);
          if (validCameraMode)
          {
            Interface.Log("# WaitForCameraViewMode.ThreadPollCondition> INFO: Rule conditions of camera being changed to '" +
                          m_cameraModeHandler.GetItemFull() + "' view mode met!");
            ruleSet = true;
          }
        }

        PostMessage(me, "Timer", "Tick", 0.0);
        continue;

      }

      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()  and  m_runOnlyOnceHandler.GetBoolValue())
        {
//          Interface.Log("# WaitForCameraViewMode.ThreadPollCondition> Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (ruleSet)
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

  public string GetDescription(void)
  {
    if (m_cameraModeHandler.IsEnumSet())
      return GetAsset().GetStringTable().GetString1("description_info", m_cameraModeHandler.GetItemFull());

    return inherited();
  }

};


Wait for Click on HUD Icon
[Rules]

Wait for Click on HUD Icon Rule

config.txt:

﻿
username            "Wait for Click on HUD Icon"
kind              "behavior"
kuid              <kuid:-18:1219>
script              "WaitForClickOnHUDIcon"
class             "WaitForClickOnHUDIcon"
icon-texture            "wait_for_hud_icon_click.texture"
string-table {
  description         "Waits for a click on a HUD Icon."
  description_info        "Waits for a click on the <i>'$1'</i> icon on the <i>'$0'</i> HUD panel."
  wait-panel-run-once-html-checkbox   "Trigger rule once"
  wait-panel-run-once-html-prefix     "<table border='0' cellspacing='0' cellpadding='0'><tr height='1'></tr><tr><td width=1></td><td><font color=#000000>"
  wait-panel-run-once-html-sufix      "</font></td></tr></table>"
  wait-panel-icon-html-property     "Wait for a click on the $1 icon on the $0 HUD panel."
  wait-panel-icon-blank-string      "<i>click to select</i>"
  wait-panel-icon-empty-sub-list      "Choose a HUD panel first!"
  wait-panel-icon-html-prefix     "<table border='0' cellspacing='0' cellpadding='0'><tr><td width=4></td><td><font color=#000000>"
  wait-panel-icon-html-sufix      "</font></td></tr></table>"
  wait-panel-icon-name-itemname     "HUD Panel"
  wait-panel-icon-desc-itemname     "HUD Panel to flash icon on"
  wait-panel-icon-name-subitem      "Icon"
  wait-panel-icon-desc-subitem      "Icon to wait for a click on"
  wait-panel-icon-item0       "panel-bottom-right"
  wait-panel-icon-item1       "panel-camera-controls"
  wait-panel-icon-item2       "panel-dcc-controls"
  panel-bottom-right        "Bottom Right Menu"
  panel-camera-controls       "Camera Controls"
  panel-dcc-controls        "DCC Controls"
  panel-bottom-right-item0      "btn/message"
  panel-bottom-right-item1      "btn/minimap"
  panel-bottom-right-item2      "btn/commodities"
  panel-bottom-right-item3      "btn/decouple"
  panel-bottom-right-item4      "btn/waybills"
  panel-bottom-right-item5      "btn/schedule"
  panel-bottom-right-item6      "btn/help"
  panel-bottom-right-item-btn/message   "Messages"
  panel-bottom-right-item-btn/minimap   "Map"
  panel-bottom-right-item-btn/commodities   "Commodities"
  panel-bottom-right-item-btn/decouple    "Decoupling"
  panel-bottom-right-item-btn/waybills    "Waybill"
  panel-bottom-right-item-btn/schedule    "View Schedule"
  panel-bottom-right-item-btn/help    "View Driver Help"
  panel-camera-controls-item0     "view-0/"
  panel-camera-controls-item1     "view-1/"
  panel-camera-controls-item2     "view-2/"
  panel-camera-controls-item3     "view-3/"
  panel-camera-controls-item-view-0/    "Cab View"
  panel-camera-controls-item-view-1/    "External View"
  panel-camera-controls-item-view-2/    "Tracking View"
  panel-camera-controls-item-view-3/    "Free Roaming"
  panel-dcc-controls-item0      "dial/dcc"
  panel-dcc-controls-item1      "button/pants"
  panel-dcc-controls-item2      "button/lights"
  panel-dcc-controls-item3      "button/horn"
  panel-dcc-controls-item4      "button/stop"
  panel-dcc-controls-item-dial/dcc    "Speed Dial"
  panel-dcc-controls-item-button/pants    "Pantographs"
  panel-dcc-controls-item-button/lights   "Lights"
  panel-dcc-controls-item-button/horn   "Horn"
  panel-dcc-controls-item-button/stop   "Stop"
}
kuid-table {
  driver_module         <kuid:-16:10240>
}
username-fr           "Attente d'un clic sur une icône ATH"
string-table-fr {
  description         "Attend un clic sur une icône ATH."
  description_info        "Attend un clic sur l'icône <i>'$1'</i> du panneau ATH <i>'$0'</i>."

  wait-panel-run-once-html-checkbox   "Déclencher la règle une fois"

  wait-panel-icon-html-property     "Attendre un clic sur l'icône $1 du panneau ATH $0."
  wait-panel-icon-blank-string      "<i>Cliquez pour sélectionner</i>"
  wait-panel-icon-empty-sub-list      "Choisissez d'abord un panneau ATH !"
  wait-panel-icon-name-itemname     "Panneau ATH"
  wait-panel-icon-desc-itemname     "Panneau ATH sur lequel faire clignoter l'icône"
  wait-panel-icon-name-subitem      "Icône"
  wait-panel-icon-desc-subitem      "Icône pour laquelle attendre le clic"

  panel-bottom-right        "Menu inférieur droit"
  panel-camera-controls                     "Commandes caméra"
  panel-dcc-controls        "Commandes DCC"

  panel-bottom-right-item-btn/message   "Messages"
  panel-bottom-right-item-btn/minimap   "Carte"
  panel-bottom-right-item-btn/commodities   "Marchandises"
  panel-bottom-right-item-btn/decouple    "Dételage"
  panel-bottom-right-item-btn/waybills    "Feuille de route"
  panel-bottom-right-item-btn/schedule    "Voir horaire"
  panel-bottom-right-item-btn/help    "Voir aide Conducteur"

  panel-camera-controls-item-view-0/    "Vue cabine"
  panel-camera-controls-item-view-1/    "Vue extérieure"
  panel-camera-controls-item-view-2/    "Vue poursuite"
  panel-camera-controls-item-view-3/    "Caméra libre"

  panel-dcc-controls-item-dial/dcc    "Cadran vitesse"
  panel-dcc-controls-item-button/pants    "Pantographes"
  panel-dcc-controls-item-button/lights   "Phares"
  panel-dcc-controls-item-button/horn   "Sirène"
  panel-dcc-controls-item-button/stop   "Arrêt"
}

WaitForClickOnHUDIcon.gs:

//
// WaitForClickHUDIcon.gs
//
//  Copyright (C) 2004 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ConditionalScenarioBehavior.gs"
include "World.gs"
include "Asset.gs"
include "Library.gs"

//
// Waits for a click on the designate Driver HUD panel icon/item and completes executing any child
// rules.
//
class WaitForClickOnHUDIcon isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler                m_runOnlyOnceHandler;
  EnumeratedMultiPropertyHandler m_waitForClickHUDIconHandler;
  HTMLPropertyGroup              m_groupHandler;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property handler stuff
    m_runOnlyOnceHandler = new CheckBoxHandler();
    m_runOnlyOnceHandler.Init(me.GetAsset(), "wait-panel-run-once");

    m_waitForClickHUDIconHandler = new EnumeratedMultiPropertyHandler();
    m_waitForClickHUDIconHandler.Init(me.GetAsset(), "wait-panel-icon");

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_runOnlyOnceHandler, "runOnce/");
    m_groupHandler.AddHandler(m_waitForClickHUDIconHandler, "iconWait/");

    SetPropertyHandler(m_groupHandler);
  }

  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    wait()
    {
      on "Browser-URL", "", msg:
      {
        if (IsPaused())
        {
          msg.src = null;
          break;
        }

        // we don't have a URL to work with, move on
        if (msg.minor.size() < 8)
        {
          msg.src = null;
          continue;
        }

        // do rule check and post timer update for check to be processed as needed
        string retrievedURL = msg.minor[7,];
        ruleSet = (retrievedURL == m_waitForClickHUDIconHandler.GetSubItem());
        if (ruleSet)
          Interface.Log("# WaitForClickOnHUDIcon.MainMsgThread> Rule conditions of a '" +
                        m_waitForClickHUDIconHandler.GetSubItemFull() +
                        "' HUD icon click satisfied with URL of '" + msg.minor + "'");

        PostMessage(me, "Timer", "Tick", 0.0);
        msg.src = null;
        continue;
      }

      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()  and  m_runOnlyOnceHandler.GetBoolValue())
        {
          Interface.Log("# WaitForClickOnHUDIcon.MainMsgThread> Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (ruleSet)
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
//            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

  public string GetDescription(void)
  {
    if (m_waitForClickHUDIconHandler.IsSubEnumSet())
      return GetAsset().GetStringTable().GetString2("description_info",
               m_waitForClickHUDIconHandler.GetSubItemFull(),
               m_waitForClickHUDIconHandler.GetItemFull());

    return inherited();
  }

};


Wait for Derailment
[Rules]

Wait for Derailment Rule

config.txt:

﻿
username            "Wait for Derailment"
kind              "behavior"
kuid              <kuid:-18:1257>
script              "WaitDerailmentRule"
class             "WaitDerailmentRule"
icon-texture            "wait_derailment.texture"
string-table {
  description         "Waits for a derailment to occur."
  description_info        "Waits for a derailment to occur."
  derail-run-once-html-checkbox     "Trigger derailment watch once"
  derail-run-once-html-prefix     "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=1></td><td><font color=#000000>"
  derail-run-once-html-sufix      "</font></td></tr></table>"
}
username-fr           "Attente de déraillement"
string-table-fr {
  description         "Attend que survienne un déraillement."
  description_info        "Attend que survienne un déraillement."

  derail-run-once-html-checkbox     "Déclencher le suivi du déraillement une fois"
}

WaitDerailmentRule.gs:

//
// WaitDerailmentRule.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"

//
// Waits for a derailment to occur in the Trainz world.
//
class WaitDerailmentRule isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler m_runOnlyOnceHandler;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property info handler stuff
    m_runOnlyOnceHandler = new CheckBoxHandler();
    m_runOnlyOnceHandler.Init(me.GetAsset(), "derail-run-once");

    SetPropertyHandler(m_runOnlyOnceHandler);
  }

  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    wait()
    {
      on "Vehicle", "Derailed", msg:
      {
        if (IsPaused())
          break;

        Vehicle vehicle = cast<Vehicle> msg.src;
        if (vehicle)
        {
          // a derailment is always a derailment, regardless of when/where it happened
          ruleSet = true;
          Interface.Log("# WaitDerailmentRule.ThreadPollCondition> Derailment of vehicle '" + vehicle.GetLocalisedName() + "' detected, rule conditions met!");
        }

        PostMessage(me, "Timer", "Tick", 0.0);
        continue;
      }

      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()  and  m_runOnlyOnceHandler.GetBoolValue())
        {
          Interface.Log("# WaitDerailmentRule.ThreadPollCondition> Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (ruleSet)
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

};


Wait for Driver On/Off Train
[Rules]

Wait for Driver On/Off Train Rule

config.txt:

﻿
username            "Wait for Driver On/Off Train"
kind              "behavior"
kuid              <kuid:-18:1221>
script              "WaitForDriverOnOffTrain"
class             "WaitForDriverOnOffTrain"
icon-texture            "wait_for_driver_onoff_train.texture"
string-table {
  description         "Waits for driver to be on/off a train/vehicle."
  description_html        "Waits for driver to be on/off a train/vehicle."
  description_info_true       "Waits for a driver to get <i>on</i> a train."
  description_info_false        "Waits for a driver to get <i>off</i> a train."
  wait-driver-run-once-html-checkbox    "Trigger rule once"
  wait-driver-run-once-html-prefix    "<table cellspacing=0 cellpadding=0><tr height=1></tr><tr><td width=1></td><td><font color=#000000>"
  wait-driver-run-once-html-sufix     "</font></td></tr></table>"
  wait-driver-onoff-html-property-true    "Wait for a driver character to get $0on$1 a train that matches the following criteria:"
  wait-driver-onoff-html-property-false   "Wait for a driver character to get $0off$1 a train that matches the following criteria:"
  wait-driver-onoff-html-prefix     "<table cellspacing=0 cellpadding=0><tr><td width=4></td><td><font color=#000000>"
  wait-driver-onoff-html-sufix      "</font></td></tr></table>"
  wait-driver-onoff-html-bool-true    "on"
  wait-driver-onoff-html-bool-false   "off"
}
username-fr           "Attente montée/descente du conducteur"
string-table-fr {
  description         "Attend que le conducteur monte/descende du train/véhicule."
  description_html        "Attend que le conducteur monte/descende du train/véhicule."
  description_info_true       "Attend qu'un conducteur <i>monte</i> dans le train."
  description_info_false        "Attend qu'un conducteur <i>descende</i> du train."

  wait-driver-run-once-html-checkbox    "Déclencher la règle une fois"

  wait-driver-onoff-html-property-true    "Attend qu'un conducteur $0monte$1 dans un train répondant aux critères suivants :"
  wait-driver-onoff-html-property-false   "Attend qu'un conducteur $0descende$1 d'un train répondant aux critères suivants :"
  wait-driver-onoff-html-bool-true    "monter"
  wait-driver-onoff-html-bool-false   "descendre"
}

WaitForDriverOnOffTrain.gs:

//
// WaitForDriverOnOffTrain.gs
//
//  Copyright (C) 2004-2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"
include "TrainHelperInfo.gs"

//
// Waits for a driver to get on/off a train.
//
class WaitForDriverOnOffTrain isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler    m_runOnlyOnceHandler;
  GenericBoolHandler m_waitDriverOnOffHandler;
  TrainHelperInfo    m_trainFilterHandler;
  HTMLPropertyGroup  m_groupHandler;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  void SniffDrivers(bool sniffState);

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property handler stuff
    m_runOnlyOnceHandler = new CheckBoxHandler();
    m_runOnlyOnceHandler.Init(me.GetAsset(), "wait-driver-run-once");

    m_waitDriverOnOffHandler = new GenericBoolHandler();
    m_waitDriverOnOffHandler.Init(me.GetAsset(), "wait-driver-onoff");

    m_trainFilterHandler = new TrainHelperInfo();
    m_trainFilterHandler.Init();

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_runOnlyOnceHandler, "runOnce/");
    m_groupHandler.AddHandler(m_waitDriverOnOffHandler, "driverChar/");
    m_groupHandler.AddHandler(m_trainFilterHandler, "trainFilter/");

    SetPropertyHandler(m_groupHandler);
  }

  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    SniffDrivers(true);

    wait()
    {
      on "DriverCharacter", "Created", msg:
      {
        SniffDrivers(true);
        continue;
      }

      on "Train", "", msg:
      {
        if (IsPaused())
          break;

        DriverCharacter driver = cast<DriverCharacter> msg.dst;
        if (!driver)
          continue;

        Train train = msg.src;
        if (!train)
          continue;

        if ((m_waitDriverOnOffHandler.GetBoolValue()  and  (msg.minor == "DriverBoarded"))  or
            (!m_waitDriverOnOffHandler.GetBoolValue()  and  (msg.minor == "DriverLeft")))
        {
//          Interface.Log("### Driver detected (" + driver.GetLocalisedName() + "), now run filter...");

// dw: un-comment this to fix logic filter bug
//          if (m_trainFilterHandler.DoesMatch(train)) {

          ruleSet = true;
          Interface.Log("# WaitForDriverOnOffTrain.MainMsgThread> INFO: rule condition satisfied with driver '" + driver.GetLocalisedName() + "' getting '" + m_waitDriverOnOffHandler.GetBoolDisplayValue() + "' a train.");
        }

        PostMessage(me, "Timer", "Tick", 0.0);
        continue;
      }

      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()  and  m_runOnlyOnceHandler.GetBoolValue())
        {
          Interface.Log("# WaitForDriverOnOffTrain.MainMsgThread> Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (ruleSet)
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
//            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    SniffDrivers(false);
    m_pollingThreadRunning = false;
  }

  void SniffDrivers(bool sniffState)
  {
    DriverCharacter[] drivers = World.GetDriverCharacterList();
    int i;
    for (i = 0; i < drivers.size(); i++)
      Sniff(drivers[i], "Train", "", sniffState);
  }

  public string GetDescription(void)
  {
    return GetAsset().GetStringTable().GetString("description_info_" + (string)m_waitDriverOnOffHandler.GetBoolValue());
  }

};


Wait for HTML Pages
[Rules]

Wait for HTML Pages Rule

config.txt:

﻿
username            "Wait for HTML Pages"
kind              "behavior"
kuid              <kuid:-18:1246>
script              "WaitHTMLPagesRule"
class             "WaitHTMLPagesRule"
icon-texture            "wait_html_pages.texture"
string-table {
  description         "Waits for the <i>Display HTML Pages</i> sequence browser to open/close a specific HTML page."
  description_wait_open       "Waits for the <i>Display HTML Pages</i> sequence browser to open the <i>''$0''</i> HTML page."
  description_wait_done       "Waits for the <i>Display HTML Pages</i> sequence browser to close the <i>''$0''</i> HTML page."
  wait-pages-html-checkbox      "Trigger rule once"
  wait-pages-html-prefix        "<table border='0' cellspacing='0' cellpadding='0'><tr height='2'></tr><tr><td width=2></td><td><font color=#000000>"
  wait-pages-html-sufix       "</font></td></tr></table>"
  page-group-display-name       "Waits for the <i>Display HTML Pages Rule</i> sequence browser to:"
  page-group-html-prefix        "<table border='0' cellspacing='0' cellpadding='0'><tr><td width=4></td><td><font color=#000000>"
  page-group-html-sufix       "</font></td></tr></table><br><br><br>"
  page-group-html-between-items     " "
  page-group-item-waitpagedone      "null"
  page-group-item-waitpageopen      "null"
  wait-page-open-display-1      "open the page named $0"
  wait-page-open-blank-0        "index"
  wait-page-open-html-prefix      "<font color=#000000>"
  wait-page-open-html-sufix     "</font>"
  wait-page-open-name-string/0      "HTML page name"
  wait-page-open-desc-string/0      "Name of HTML page without the .html extension"
  wait-page-done-display-1      "close the page named $0"
  wait-page-done-blank-0        "index"
  wait-page-done-html-prefix      "<font color=#000000>"
  wait-page-done-html-sufix     "</font>"
  wait-page-done-name-string/0      "HTML page name"
  wait-page-done-desc-string/0      "Name of HTML page without the .html extension"
}
kuid-table {
  displayhtmlpageslib       <kuid:-18:1245>
}
username-fr           "Attente de pages HTML"
string-table-fr {
  description         "Attend que le navigateur de séquence <i>Affichage de pages HTML</i> ouvre/ferme une page HTML spécifique."
  description_wait_open       "Attend que le navigateur de séquence <i>Affichage de pages HTML</i> ouvre la page HTML <i>''$0''</i>."
  description_wait_done       "Attend que le navigateur de séquence <i>Affichage de pages HTML</i> ferme la page HTML <i>''$0''</i>."

  wait-pages-html-checkbox      "Déclencher la règle une fois"

  page-group-display-name       "Attend que le navigateur de séquence <i>Affichage des règles de pages HTML</i> :"

  wait-page-open-display-1      "Ouvrir la page intitulée $0"
  wait-page-open-name-string/0      "Nom page HTML"
  wait-page-open-desc-string/0      "Nom de la page HTML sans l'extension .html"

  wait-page-done-display-1      "Fermer la page intitulée $0"
  wait-page-done-name-string/0      "Nom page HTML"
  wait-page-done-desc-string/0      "Nom de la page HTML, sans l'extension .html"
}

WaitHTMLPagesRule.gs:

//
// WaitHTMLPageRules.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"

class GenericHTMLStringHandler isclass GenericStringHandler
{
  public string GetStringDisplayValue(int valueIndex) { return inherited(valueIndex) + ".html"; }
};

//
// Waits for the main menu in Driver (top left corner) to become visible/invisible. Once the visiblity
// state has been achieved, the rule ends.
//
class WaitHTMLPagesRule isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler          m_runOnlyOnceHandler;
  GenericHTMLStringHandler m_waitPageOpenHandler, m_waitPageDoneHandler;
  RadioButtonGroupHandler  m_radioGroupHandler;
  HTMLPropertyGroup        m_groupHandler;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property info handler stuff
    m_runOnlyOnceHandler = new CheckBoxHandler();
    m_runOnlyOnceHandler.Init(me.GetAsset(), "wait-pages");

    m_waitPageOpenHandler = new GenericHTMLStringHandler();
    m_waitPageOpenHandler.Init(me.GetAsset(), "wait-page-open", 1);

    m_waitPageDoneHandler = new GenericHTMLStringHandler();
    m_waitPageDoneHandler.Init(me.GetAsset(), "wait-page-done", 1);

    m_radioGroupHandler = new RadioButtonGroupHandler();
    m_radioGroupHandler.Init(me.GetAsset(), "page-group");
    m_radioGroupHandler.AddHandler(m_waitPageOpenHandler, "waitPageDone");
    m_radioGroupHandler.AddHandler(m_waitPageDoneHandler, "waitPageOpen");

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_runOnlyOnceHandler, "runOnce/");
    m_groupHandler.AddHandler(m_radioGroupHandler, "waitPage/");

    SetPropertyHandler(m_groupHandler);
  }

  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 1.0);
    Message msg;

    wait()
    {
      on "DisplayHTMLPagesRule", "", msg:
      {
        if (IsPaused())
          break;

        if (m_waitPageOpenHandler == m_radioGroupHandler.GetSelectedSubHandler())
        {
          // do rule check and post timer update for check to be processed as needed
          ruleSet = (msg.minor == m_waitPageOpenHandler.GetStringValue(0));
          if (ruleSet)
            Interface.Log("# WaitHTMLPagesRule.MainMsgThread> INFO: Rule conditions of '" +
                          m_waitPageOpenHandler.GetStringValue(0) + ".html' being displayed met!");
        }

        PostMessage(me, "Timer", "Tick", 0.0);
        continue;
      }

      on "DisplayHTMLPagesRuleDone", "", msg:
      {
        if (IsPaused())
          break;

        if (m_waitPageDoneHandler == m_radioGroupHandler.GetSelectedSubHandler())
        {
          // do rule check and post timer update for check to be processed as needed
          ruleSet = (msg.minor == m_waitPageDoneHandler.GetStringValue(0));
          if (ruleSet)
            Interface.Log("# WaitHTMLPagesRule.MainMsgThread> INFO: Rule conditions of '" +
                          m_waitPageDoneHandler.GetStringValue(0) + ".html' being closed and done met!");
        }

        PostMessage(me, "Timer", "Tick", 0.0);
        continue;
      }

      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()  and  m_runOnlyOnceHandler.GetBoolValue())
        {
          Interface.Log("# WaitHTMLPagesRule.MainMsgThread> INFO: Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (ruleSet)
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

  public string GetDescription(void)
  {
    StringTable strTable = GetAsset().GetStringTable();

    if ((m_waitPageOpenHandler == m_radioGroupHandler.GetSelectedSubHandler())  and
         m_waitPageOpenHandler.GetStringValue(0).size())
      return strTable.GetString1("description_wait_open", m_waitPageOpenHandler.GetStringDisplayValue(0));

    if ((m_waitPageDoneHandler == m_radioGroupHandler.GetSelectedSubHandler())  and
         m_waitPageDoneHandler.GetStringValue(0).size())
      return strTable.GetString1("description_wait_done", m_waitPageDoneHandler.GetStringDisplayValue(0));

    return inherited();
  }

};


Wait on Minimap Screen/Main Screen
[Rules]

Wait on Minimap Screen/Main Screen Rule

config.txt:

﻿
username            "Wait on MiniMap Screen/Main Screen"
kind              "behavior"
kuid              <kuid:-18:1222>
script              "WaitMinimapScreen"
class             "WaitMinimapScreen"
icon-texture            "wait_minimap_screen.texture"
string-table {
  description         "Waits for the MiniMap to open/close."
  description_info_true       "Waits for the MiniMap window to be <i>opened</i>."
  description_info_false        "Waits for the MiniMap window to be <i>closed</i>."
  minimap-run-once-html-checkbox      "Trigger rule once"
  minimap-run-once-html-bool-tooltip    "Rule waits for event once or continously"
  minimap-run-once-html-prefix      "<table cellpadding='0' cellspacing='0'><tr height='1'></tr><tr><td width='1'></td><td><font color=#000000>"
  minimap-run-once-html-sufix     "</font></td></tr></table>"
  wait-minimap-html-property-true     "Wait for the Mini-Map window to be $0opened$1."
  wait-minimap-html-property-false    "Wait for the Mini-Map window to be $0closed$1."
  wait-minimap-html-bool-tooltip      "Visibility state of MiniMap to wait for"
  wait-minimap-html-prefix      "<table cellpadding='0' cellspacing='0'><tr><td width='4'></td><td><font color=#000000>"
  wait-minimap-html-sufix       "</font></td></tr></table>"
}
username-fr           "Attente de l'écran mini-carte/menu principal"
string-table-fr {
  description         "Attend l'ouverture/fermeture de la mini-carte."
  description_info_true       "Attend l'<i>ouverture</i> de la mini-carte."
  description_info_false        "Attend la <i>fermeture</i> de la mini-carte."

  minimap-run-once-html-checkbox      "Déclencher la règle une fois"
  minimap-run-once-html-bool-tooltip    "La règle attend continuellement ou une seule fois l'évènement"

  wait-minimap-html-property-true     "Attend l'$0ouverture$1 de la mini-carte."
  wait-minimap-html-property-false    "Attend la $0fermeture$1 de la mini-carte."
  wait-minimap-html-bool-tooltip      "Visibilité de la mini-carte à attendre"
}

WaitMinimapScreen.gs:

//
// WaitMinimapScreen.gs
//
//  Copyright (C) 2004-2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"

//
// Waits for the minimap in Driver to either be opened or closed.
//
class WaitMinimapScreen isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler    m_runOnlyOnceHandler;
  GenericBoolHandler m_waitMinimapScreenHandler;
  HTMLPropertyGroup  m_groupHandler;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property info handler stuff
    m_runOnlyOnceHandler = new CheckBoxHandler();
    m_runOnlyOnceHandler.Init(me.GetAsset(), "minimap-run-once");

    m_waitMinimapScreenHandler = new GenericBoolHandler();
    m_waitMinimapScreenHandler.Init(me.GetAsset(), "wait-minimap");
    m_waitMinimapScreenHandler.SetBoolValue(true);

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_runOnlyOnceHandler, "runOnce/");
    m_groupHandler.AddHandler(m_waitMinimapScreenHandler, "waitMinimap/");

    SetPropertyHandler(m_groupHandler);
  }

  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    wait()
    {
      on "Interface-Event", "", msg:
      {
        if (IsPaused())
          break;

        // do rule check and post timer update for check to be processed as needed
        if ((m_waitMinimapScreenHandler.GetBoolValue()  and  (msg.minor == "MapViewOn")) or
            (!m_waitMinimapScreenHandler.GetBoolValue()  and  (msg.minor == "MapViewOff")))
        {
          Interface.Log("# WaitMinimapScreen.MainMsgThread> Rule conditions of map being shown/hidden (" +
                        (string)m_waitMinimapScreenHandler.GetBoolValue() + ") met!");
          ruleSet = true;
        }
        else
          ruleSet = false;

        PostMessage(me, "Timer", "Tick", 0.0);
        continue;
      }

      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()  and  m_runOnlyOnceHandler.GetBoolValue())
        {
          Interface.Log("# WaitMinimapScreen.MainMsgThread> Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (ruleSet)
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
//            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

  public string GetDescription(void)
  {
    return GetAsset().GetStringTable().GetString("description_info_" + (string)m_waitMinimapScreenHandler.GetBoolValue());
  }

};


Wait on Train Stop/Start
[Rules]

Wait on Train Stop/Start Rule

config.txt:

﻿
username            "Wait on Train Stop/Start"
kind              "behavior"
kuid              <kuid:-18:1226>
script              "WaitTrainStopStart"
class             "WaitTrainStopStart"
icon-texture            "wait_train_stopstart.texture"
string-table {
  description         "Waits for a train to stop/start."
  description_html        "Waits for a train to stop/start."
  wait-train-run-once-html-checkbox   "Trigger rule once"
  wait-train-run-once-html-prefix     "<table cellspacing=0 cellpadding=0><tr height=1></tr><tr><td width=1></td><td><font color=#000000>"
  wait-train-run-once-html-sufix      "</font></td></tr></table>"
  wait-start-stop-html-property-true    "Wait for a train that matches the following criteria to $0stop moving$1."
  wait-start-stop-html-property-false   "Wait for a train that matches the following criteria to $0start moving$1."
  wait-start-stop-html-prefix     "<table cellspacing=0 cellpadding=0><tr><td width=4></td><td><font color=#000000>"
  wait-start-stop-html-sufix      "</font></td></tr></table>"
  property_name_stop_start      "stop/start state"
  property_name_vehicle       "vehicle"
  property_description_stop_start     "stop/start wait state of this rule"
  property_description_vehicle      "name of vehicle in a train"
}
username-fr           "Attente arrêt/démarrage du train"
string-table-fr {
  description         "Attend l'arrêt/le démarrage du train."
  description_html        "Attend l'arrêt/le démarrage du train."

  wait-train-run-once-html-checkbox   "Déclencher la règle une fois"

  wait-start-stop-html-property-true    "Attendre que le train répondant aux critères suivants $0ne bouge plus$1."
  wait-start-stop-html-property-false   "Attendre que le train répondant aux critères suivants $0démarre$1."

  property_name_stop_start      "statut arrêt/marche"
  property_name_vehicle       "véhicule"
  property_description_stop_start     "statut arrêt/marche que la règle attend"
  property_description_vehicle      "nom d'un véhicule d'un train"
}

WaitTrainStopStart.gs:

//
// WaitTrainStopStart.gs
//
//  Copyright (C) 2004-2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ConditionalScenarioBehavior.gs"
include "ScenarioBehavior.gs"
include "TrainHelperInfo.gs"

//
// ??
//
class WaitTrainStopStart isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler    m_runOnlyOnceHandler;
  GenericBoolHandler m_stopStartHandler;
  TrainHelperInfo    m_trainFilterHandler;
  HTMLPropertyGroup  m_groupHandler;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  // definitions
  void SniffTrains(bool enable);
  bool ValidateTrain(Message trainMsg);

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property info handler stuff
    m_runOnlyOnceHandler = new CheckBoxHandler();
    m_runOnlyOnceHandler.Init(me.GetAsset(), "wait-train-run-once");

    m_stopStartHandler = new GenericBoolHandler();
    m_stopStartHandler.Init(me.GetAsset(), "wait-start-stop");

    m_trainFilterHandler = new TrainHelperInfo();
    m_trainFilterHandler.Init();

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_runOnlyOnceHandler, "runOnce/");
    m_groupHandler.AddHandler(m_stopStartHandler, "startStop/");
    m_groupHandler.AddHandler(m_trainFilterHandler, "trainFilter/");

    SetPropertyHandler(m_groupHandler);
  }

  //
  // ??
  //
  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    SniffTrains(true);

    PostMessage(me, "Timer", "Tick", 0.0);
    Message msg;

    wait()
    {
      on "Train", "", msg:
      {
        if (IsPaused())
          break;

        // do rule check
        if (ValidateTrain(msg))
          ruleSet = true;
        else
          ruleSet = false;

        PostMessage(me, "Timer", "Tick", 0.0);
        continue;
      }

      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()  and  m_runOnlyOnceHandler.GetBoolValue())
        {
          Interface.Log("# WaitTrainStopStart.ThreadPollCondition> Rule has already completed and is a run once-only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (ruleSet)
        {
//          Interface.Log("# WaitTrainStopStart.ThreadPollCondition> matching train found, rule condition satisfied!");
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
//            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    SniffTrains(false);
    m_pollingThreadRunning = false;
  }

  //
  // ??
  //
  bool ValidateTrain(Message trainMsg)
  {
    // get and check the train
    Train theTrain = cast<Train> trainMsg.src;
    if (!theTrain)
      return false;

    // train doesn't match filter
    if (!m_trainFilterHandler.DoesMatch(theTrain))
      return false;

    // train has stopped moving and matches rule requirements, validation successful
    if (m_stopStartHandler.GetBoolValue()  and  (trainMsg.minor == "StoppedMoving"))
    {
      Interface.Log("# WaitTrainStopStart> matching train stop detected, rule condition satisfied!");
      return true;
    }

    // train has started moving and matches rule requirements, validation successful
    if (!m_stopStartHandler.GetBoolValue()  and  (trainMsg.minor == "StartedMoving"))
    {
      Interface.Log("# WaitTrainStopStart> matching train starting detected, rule condition satisfied!");
      return true;
    }

    // train matches filter, but validation failed
    return false;
  }

  //
  // Enable/disalbing sniffing on all trains for the stopped/started messages (which the train
  // normally only sends to itself).
  //
  void SniffTrains(bool enable)
  {
    Train[] trains = World.GetTrainList();
    int i;
    for (i = 0; i < trains.size(); i++)
    {
      Sniff(trains[i], "Train", "StartedMoving", enable);
      Sniff(trains[i], "Train", "StoppedMoving", enable);
    }
  }

};


Wait on Waybill Screen/Main Screen
[Rules]

Wait on Waybill Screen/Main Screen Rule

config.txt:

﻿
username            "Wait on Waybill Screen/Main Screen"
kind              "behavior"
kuid              <kuid:-18:1249>
script              "WaitWaybillScreen"
class             "WaitWaybillScreen"
icon-texture            "wait_waybill_screen.texture"
string-table {
  description         "Waits for the Waybill window to open/close."
  description_info_true       "Waits for the Waybill window to be <i>opened</i>."
  description_info_false        "Waits for the Waybill window to be <i>closed</i>."
  waybill-run-once-html-checkbox      "Trigger rule once"
  waybill-run-once-html-prefix      "<table cellpadding=0 cellspacing=0><tr height=1></tr><tr><td width=1></td><td><font color=#000000>"
  waybill-run-once-html-sufix     "</font></td></tr></table>"
  wait-waybill-html-property-true     "Wait for the Waybill window to be $0opened$1."
  wait-waybill-html-property-false    "Wait for the Waybill window to be $0closed$1."
  wait-waybill-html-prefix      "<table cellpadding=0 cellspacing=0><tr><td width=4></td><td><font color=#000000>"
  wait-waybill-html-sufix       "</font></td></tr></table>"
}
username-fr           "Attente écran feuille de route/menu principal"
string-table-fr {
  description         "Attend l'ouverture/fermeture de la fenêtre de feuille de route."
  description_info_true       "Attend l'<i>ouverture</i> de la fenêtre de feuille de route."
  description_info_false        "Attend la <i>fermeture</i> de la fenêtre de feuille de route."

  waybill-run-once-html-checkbox      "Déclencher la règle une fois"

  wait-waybill-html-property-true     "Attendre l'$0ouverture$1 de la feuille de route."
  wait-waybill-html-property-false    "Attendre la $0fermeture$1 de la feuille de route."
}

WaitWaybillScreen.gs:

//
// WaitWaybillScreen.gs
//
//  Copyright (C) 2005 Auran Developments Pty Ltd
//  All Rights Reserved.
//

include "HTMLPropertyHandler.gs"
include "ListItemPropertyHandler.gs"
include "ScenarioBehavior.gs"
include "ConditionalScenarioBehavior.gs"

//
// Waits for the minimap in Driver to either be opened or closed.
//
class WaitWaybillScreen isclass ConditionalScenarioBehavior
{
  // HTML property handler stuff
  CheckBoxHandler    m_runOnlyOnceHandler;
  GenericBoolHandler m_waitWaybillScreenHandler;
  HTMLPropertyGroup  m_groupHandler;

  // threaded/child rule scenario behavior stuff
  bool m_childrenRunning = false;

  //
  // Initialize parent object and data members
  //
  public void Init(Asset asset)
  {
    inherited(asset);
    m_pollingBehavior = true;
    m_saveLoadRestart = true;

    // property info handler stuff
    m_runOnlyOnceHandler = new CheckBoxHandler();
    m_runOnlyOnceHandler.Init(me.GetAsset(), "waybill-run-once");

    m_waitWaybillScreenHandler = new GenericBoolHandler();
    m_waitWaybillScreenHandler.Init(me.GetAsset(), "wait-waybill");
    m_waitWaybillScreenHandler.SetBoolValue(true);

    m_groupHandler = new HTMLPropertyGroup();
    m_groupHandler.AddHandler(m_runOnlyOnceHandler, "runOnce/");
    m_groupHandler.AddHandler(m_waitWaybillScreenHandler, "waitWaybill/");

    SetPropertyHandler(m_groupHandler);
  }

  thread void ThreadPollCondition(void)
  {
    SetComplete(false);
    m_pollingThreadRunning = true;
    bool ruleSet = false;

    PostMessage(me, "Timer", "Tick", 1.0);
    Message msg;

    wait()
    {
      on "WaybillManager", "", msg:
      {
        if (IsPaused())
          break;

        // do rule check and post timer update for check to be processed as needed
        if ((m_waitWaybillScreenHandler.GetBoolValue()  and  (msg.minor == "WaybillsWindowShown")) or
            (!m_waitWaybillScreenHandler.GetBoolValue()  and  (msg.minor == "WaybillsWindowHidden")))
        {
          Interface.Log("# WaitWaybillScreen.MainMsgThread> Rule conditions of waybill window being shown/hidden (" +
                        (string)m_waitWaybillScreenHandler.GetBoolValue() + ") met!");
          ruleSet = true;
        }
        else
          ruleSet = false;

        PostMessage(me, "Timer", "Tick", 0.0);
        continue;
      }

      // update cycle
      on "Timer", "Tick":
      {
        if (IsPaused())
          break;

        if (WasComplete()  and  m_runOnlyOnceHandler.GetBoolValue())
        {
          Interface.Log("# WaitWaybillScreen.MainMsgThread> Rule has already completed and is a run-once only rule!");
          break;
        }

        // if our little rule is complete, we reset it
        if (IsComplete())
        {
          Reset();
          ResetChildren();
          m_childrenRunning = false;
          PostMessage(me, "Timer", "Tick", 1.0);
          continue;
        }

        if (ruleSet)
        {
          if (!m_childrenRunning)
          {
            m_childrenRunning = true;
            ResetChildren();
            UnpauseChildren();
            UpdateChildren(null);
          }
          ruleSet = false;
        }

        // send message with 1 second delay (for next time)
        PostMessage(me, "Timer", "Tick", 1.0);
        continue;
      }
    }

    m_pollingThreadRunning = false;
  }

  public string GetDescription(void)
  {
    return GetAsset().GetStringTable().GetString("description_info_" + (string)m_waitWaybillScreenHandler.GetBoolValue());
  }

};


Weather
[Rules]

Weather Rule

config.txt:

﻿
username            "Weather"
kind              "behavior"
kuid              <kuid:-3:10089>
script              "WeatherRule"
class             "WeatherRule"
string-table {
  weather_desc_0          "Clear"
  weather_desc_1          "Cloudy"
  weather_desc_2          "Drizzle"
  weather_desc_3          "Rain"
  weather_desc_4          "Stormy"
  weather_desc_5          "Light Snow"
  weather_desc_6          "Medium Snow"
  weather_desc_7          "Heavy Snow"
  weather_list_0          "Clear"
  weather_list_1          "Cloudy"
  weather_list_2          "Drizzle"
  weather_list_3          "Rain"
  weather_list_4          "Stormy"
  weather_list_5          "Light Snow"
  weather_list_6          "Medium Snow"
  weather_list_7          "Heavy Snow"
  changeability_desc_0        "No"
  changeability_desc_1        "Periodic"
  changeability_desc_2        "Extreme"
  changeability_list_0        "Off"
  changeability_list_1        "Periodic"
  changeability_list_2        "Extreme"
  weather_cond_name       "Weather Condition"
  weather_cond_desc       "The type of weather"
  weather_chng_name       "Weather Changeability"
  weather_chng_desc       "The rate at which the weather will change"
  description_text        "Set weather to $0 with $1 changeability."
  property_name         "Property '$0'"
  description         "Set the weather conditions."
}
icon-texture            "weather_type.texture"
username-de           "Wetter"
string-table-de {
  weather_desc_0          "Sonnig"
  weather_desc_1          "Bewölkt"
  weather_desc_2          "Nieselregen"
  weather_desc_3          "Regen"
  weather_desc_4          "Sturm"
  weather_desc_5          "Leichter Schneefall"
  weather_desc_6          "Mittlerer Schneefall"
  weather_desc_7          "Schwerer Schneefall"
  weather_list_0          "Sonnig"
  weather_list_1          "Bewülkt"
  weather_list_2          "Nieselregen"
  weather_list_3          "Regen"
  weather_list_4          "Sturm"
  weather_list_5          "Leichter Schneefall"
  weather_list_6          "Mittlerer Schneefall"
  weather_list_7          "Schwerer Schneefall"
  changeability_desc_0        "Keine"
  changeability_desc_1        "Periodische"
  changeability_desc_2        "Extreme"
  changeability_list_0        "Keine"
  changeability_list_1        "Periodische"
  changeability_list_2        "Extreme"
  weather_cond_name       "Wetterbedingungen"
  weather_cond_desc       "Die Art des Wetters"
  weather_chng_name       "Wechselhaftigkeit des Wetters"
  weather_chng_desc       "Die Wahrscheinlichkeit, nach der das Wetter sich ändern wird"
  description_text        "Setze Wetter auf $0 an, mit $1 Wechselhaftigkeit."
  property_name         "Eigentum '$0'"
  description         "Stellen Sie die Wetterbedingungen ein."
}
username-it           "Regole meteo"
string-table-it {
  weather_desc_0          "Sereno"
  weather_desc_1          "Nuvoloso"
  weather_desc_3          "Pioggia"
  weather_desc_4          "Tempesta"
  weather_desc_5          "Neve leggera"
  weather_desc_6          "Neve media"
  weather_desc_7          "Neve abbondante"
  weather_list_0          "Sereno"
  weather_list_1          "Nuvoloso"
  weather_list_2          "Pioviggine"
  weather_list_3          "Pioggia"
  weather_list_4          "Tempesta"
  weather_list_5          "Neve leggera"
  weather_list_6          "Neve media"
  weather_list_7          "Neve abbondante"
  changeability_desc_0        "No"
  changeability_desc_1        "Periodica"
  changeability_desc_2        "Estrema"
  changeability_list_0        "Nessuna"
  changeability_list_1        "Periodica"
  changeability_list_2        "Estrema"
  weather_cond_name       "Condizioni meteo"
  weather_cond_desc       "Tipo di tempo"
  weather_chng_name       "Variabilità del tempo"
  weather_chng_desc       "La frequenza con la quale il tempo varia"
  description         "Imposta il meteo su $0 con variabilità $1."
  property_name         "Proprieta '$0'"
}
username-es           "Clima"
string-table-es {
  weather_desc_0          "Despejado"
  weather_desc_1          "Nuboso"
  weather_desc_2          "Llovizna"
  weather_desc_3          "Lluvia"
  weather_desc_4          "Tormentoso"
  weather_desc_5          "Aguanieve"
  weather_desc_6          "Nevada"
  weather_desc_7          "Nevada intensa"
  weather_list_0          "Despejado"
  weather_list_1          "Nuboso"
  weather_list_2          "Llovizna"
  weather_list_3          "Lluvia"
  weather_list_4          "Tormentoso"
  weather_list_5          "Aguanieve"
  weather_list_6          "Nevada"
  weather_list_7          "Nevada intensa"
  changeability_desc_0        "No"
  changeability_desc_1        "Periódica"
  changeability_desc_2        "Total"
  changeability_list_0        "No"
  changeability_list_1        "Periódica"
  changeability_list_2        "Total"
  weather_cond_name       "Estado climático"
  weather_cond_desc       "El tipo de tiempo"
  weather_chng_name       "Mutabilidad climática"
  weather_chng_desc       "El ritmo al que cambiará el clima"
  description_text        "Pone el clima en $0 con mutabilidad $1."
  property_name         "Propiedad '$0'"
  description         "Configura las condiciones climáticas."
}
username-pl           "Zasady pogody"
string-table-pl {
  weather_desc_0          "Pogodnie"
  weather_desc_1          "Pochmurnie"
  weather_desc_2          "Mżawka"
  weather_desc_3          "Deszcz"
  weather_desc_4          "Burza"
  weather_desc_5          "Śnieżek"
  weather_desc_6          "Śnieg"
  weather_desc_7          "Śnieżyca"
  weather_list_0          "Pogodnie"
  weather_list_1          "Pochmurnie"
  weather_list_2          "Mżawka"
  weather_list_3          "Deszcz"
  weather_list_4          "Burza"
  weather_list_5          "Śnieżek"
  weather_list_6          "Śnieg"
  weather_list_7          "Śnieżyca"
  changeability_desc_0        "Nie"
  changeability_desc_1        "Okresowa"
  changeability_desc_2        "Skrajna"
  changeability_list_0        "Wył."
  changeability_list_1        "Okresowa"
  changeability_list_2        "Skrajna"
  weather_cond_name       "Warunki pogodowe"
  weather_cond_desc       "Typ pogody"
  weather_chng_name       "Zmienność pogody"
  weather_chng_desc       "Szybkość zmian warunków pogodowych"
  description         "Ustaw pogodę na '$0' ze zmiennością '$1'."
  property_name         "Obiekt '$0'"
}
username-cz           "Počasí"
string-table-cz {
  weather_desc_0          "Jasno"
  weather_desc_1          "Oblačno"
  weather_desc_2          "Mrholení"
  weather_desc_3          "Déšť"
  weather_desc_4          "Bouře"
  weather_desc_5          "Sněhové přeháňky"
  weather_desc_6          "Sněžení"
  weather_desc_7          "Sněhová bouře"
  weather_list_0          "Jasno"
  weather_list_1          "Oblačno"
  weather_list_2          "Mrholení"
  weather_list_3          "Déšť"
  weather_list_4          "Bouře"
  weather_list_5          "Sněhové přeháňky"
  weather_list_6          "Sněžení"
  weather_list_7          "Sněhová bouře"
  changeability_desc_0        "Žádné"
  changeability_desc_1        "Pravidelné"
  changeability_desc_2        "Extrémní"
  changeability_list_0        "Vypnuto"
  changeability_list_1        "Pravidlené"
  changeability_list_2        "Extrémní"
  weather_cond_name       "Počasí"
  weather_cond_desc       "Druh počasí"
  weather_chng_name       "Proměnlivost počasí"
  weather_chng_desc       "Pravděpodomnost změny počasí"
  description_text        "Nastaví počasí na $0 s $1 proměnlivostí."
  property_name         "Hodnota '$0'"
  description         "Nastavuje počasí."
}
username-ru           "Погода"
description-ru            "Установить тип погоды."
string-table-ru {
  weather_desc_0          "ясно"
  weather_desc_1          "облачно"
  weather_desc_2          "изморось"
  weather_desc_3          "дождь"
  weather_desc_4          "буря"
  weather_desc_5          "небольшой снег"
  weather_desc_6          "снег"
  weather_desc_7          "сильный снегопад"
  weather_list_0          "ясно"
  weather_list_1          "облачно"
  weather_list_2          "изморось"
  weather_list_3          "дождь"
  weather_list_4          "буря"
  weather_list_5          "небольшой снег"
  weather_list_6          "снег"
  weather_list_7          "сильный снегопад"
  changeability_desc_0        "нет"
  changeability_desc_1        "периодической"
  changeability_desc_2        "частой"
  changeability_list_0        "откл"
  changeability_list_1        "периодической"
  changeability_list_2        "частой"
  weather_cond_name       "Погодные условия"
  weather_cond_desc       "Тип погоды"
  weather_chng_name       "Переменчивость погоды"
  weather_chng_desc       "Скорость изменения погоды"
  description_text        "Установить погоду: $0 с переменчивостью: $1."
  property_name         "Свойство '$0'."
  description         "Установить погоду: $0 с переменчивостью: $1."
}
username-fr           "Météo"
string-table-fr {
  weather_desc_0          "Clair"
  weather_desc_1          "Nuageux"
  weather_desc_2          "Bruine"
  weather_desc_3          "Pluie"
  weather_desc_4          "Tempête"
  weather_desc_5          "Neige légère"
  weather_desc_6          "Neige moyenne"
  weather_desc_7          "Neige abondante"
  weather_list_0          "Clair"
  weather_list_1          "Nuageux"
  weather_list_2          "Bruine"
  weather_list_3          "Pluie"
  weather_list_4          "Tempête"
  weather_list_5          "Neige légère"
  weather_list_6          "Neige moyenne"
  weather_list_7          "Neige abondante"
  changeability_desc_0        "Aucun"
  changeability_desc_1        "Périodique"
  changeability_desc_2        "Fréquent"
  changeability_list_0        "Aucun"
  changeability_list_1        "Périodique"
  changeability_list_2        "Fréquent"
  weather_cond_name       "Conditions météorologiques"
  weather_cond_desc       "Le type de temps"
  weather_chng_name       "Variations météo"
  weather_chng_desc       "La fréquence des variations météo"
  description_text        "Règle le temps sur $0 avec un rythme de $1."
  property_name         "Propriété '$0'"
  description         "Définit les conditions météo."
}

WeatherRule.gs:

include "ScenarioBehavior.gs"
include "World.gs"
include "World1.gs"

class WeatherRule isclass ScenarioBehavior
{
  int weatherType = 0;
  int weatherChangeability = 0;

  //
  // PropertyObject methods
  //

  public void SetProperties(Soup soup)
  {
    inherited(soup);

    weatherType = soup.GetNamedTagAsInt("WeatherRule.type");
    weatherChangeability = soup.GetNamedTagAsInt("WeatherRule.changeability");
  }

  public Soup GetProperties(void)
  {
    Soup soup = inherited();

    soup.SetNamedTag("WeatherRule.type", weatherType);
    soup.SetNamedTag("WeatherRule.changeability", weatherChangeability);

    return soup;
  }

  public void Pause(bool paused)
  {
    if (paused == IsPaused())
      return;

    SetStateFlags(PAUSED, paused);

    if (!paused and !IsComplete())
    {
      World.SetWeather(weatherType, weatherChangeability);

      SetComplete(true);
    }
  }

  public string GetDescriptionHTML(void)
  {
    StringTable stringTable = GetAsset().GetStringTable();
    string typeStr = "<a href=live://property/type>" + stringTable.GetString("weather_desc_" + weatherType) + "</a>";
    string changeabilityStr = "<a href=live://property/changeability>" + stringTable.GetString("changeability_desc_" + weatherChangeability) + "</a>";

    // return "<html><body>" + stringTable.GetString2("description_text", typeStr, changeabilityStr) + "</body></html>";
    return "<html><body><font color=#000000>" + stringTable.GetString2("description_text", typeStr, changeabilityStr) + "</font></body></html>";
  }

  string GetPropertyType(string p_propertyID)
  {
    return "list";
  }

  string GetPropertyName(string p_propertyID)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    if (p_propertyID == "type")
    {
      return stringTable.GetString("weather_cond_name");
    }
    else if (p_propertyID == "changeability")
    {
      return stringTable.GetString("weather_chng_name");
    }

    return stringTable.GetString1("property_name", p_propertyID);
  }

  string GetPropertyDescription(string p_propertyID)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    if (p_propertyID == "type")
    {
      return stringTable.GetString("weather_cond_desc");
    }
    else if (p_propertyID == "changeability")
    {
      return stringTable.GetString("weather_chng_desc");
    }

    return "";
  }

  public string[] GetPropertyElementList(string p_propertyID)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    int i;
    string [] result = new string[0];

    if (p_propertyID == "type")
    {
      for (i = 0; i < 8; ++i)
        result[i] = stringTable.GetString("weather_list_"+i);
    }
    else if (p_propertyID == "changeability")
    {
      for (i = 0; i < 3; ++i)
        result[i] = stringTable.GetString("changeability_list_"+i);
    }

    return result;
  }

  void SetPropertyValue(string p_propertyID, string p_value, int p_index)
  {
    // Get index of resulting property.
    if (p_propertyID == "type")
    {
      if (p_index < 0 or p_index > 7)
        p_index = 0;

      weatherType = p_index;
    }
    else if (p_propertyID == "changeability")
    {
      if (p_index < 0 or p_index > 2)
        p_index = 0;

      weatherChangeability = p_index;
    }
  }
};


Vehicles
[Asset Source]

Vehicles

  • Coal Hopper
  • GATX Oil Tanker
  • Woodchip Gondola


Coal Hopper
[Vehicles]

Coal Hopper Vehicle

config.txt:

﻿
kind              "traincar"
kuid              <kuid:44179:60006>
bogey             100063
engine              0
name              "Coal_Hopper"
mass              15000
company             "MAM"
origin              "TRS2004"
enginespec            <kuid:-1:42004201>
script              "Hopper"
class             "Hopper"
soundscript {
  door_close {
    trigger         "door_close"
    nostartdelay        1
    repeat-delay        1
    distance        5,170
    sound {
      coupling_1.wav
    }
  }
}
mesh-table {
  default {
    mesh          "coal_hopper_body/coal_hopper_body.lm"
    auto-create       1
  }
  shadow {
    mesh          "coal_hopper_shadow/coal_hopper_shadow.pm"
  }
  load {
    mesh          "coal_hopper_body/load/load.pm"
    anim          "coal_hopper_body/load/load.kin"
    auto-create       1
    use-parent-bounds     1
    effects {
      product-texture {
        kind      "texture-replacement"
        texture     "load_map.texture"
      }
    }
  }
  left-door {
    mesh          "coal_hopper_body/unload_left/unload_left.im"
    anim          "coal_hopper_body/unload_left/unload_left.kin"
    auto-create       1
  }
  right-door {
    mesh          "coal_hopper_body/unload_right/unload_right.im"
    anim          "coal_hopper_body/unload_right/unload_right.kin"
    auto-create       1
  }
}
queues {
  load0 {
    size          54300
    initial-count       0
    animated-mesh       "load"
    product-kuid        <kuid:44179:60013>
    allowed-categories {
      0       <kuid:-3:10040>
    }
  }
}
smoke0 {
  ;           "vehicle unload"
  particle          "effect"
  attachment          "a.unload_left_pfx0"
  mode            "time"
  color           0,0,0,250
  rate            8
  velocity          2
  lifetime          2
  minsize           1
  maxsize           4
  enabled           0
}
smoke1 {
  ;           "vehicle unload"
  particle          "effect"
  attachment          "a.unload_left_pfx1"
  mode            "time"
  color           0,0,0,250
  rate            8
  velocity          2
  lifetime          2
  minsize           1
  maxsize           4
  enabled           0
}
smoke2 {
  ;           "vehicle unload"
  particle          "effect"
  attachment          "a.unload_right_pfx0"
  mode            "time"
  color           0,0,0,250
  rate            8
  velocity          2
  lifetime          2
  minsize           1
  maxsize           4
  enabled           0
}
smoke3 {
  ;           "vehicle unload"
  particle          "effect"
  attachment          "a.unload_right_pfx1"
  mode            "time"
  color           0,0,0,250
  rate            8
  velocity          2
  lifetime          2
  minsize           1
  maxsize           4
  enabled           0
}
description           "
Coal_Hopper

Length (over coupler):  12.4m
Width (overall):  2.8m
Height (overall):  3.9m
Bogie pivot centres:  7.4m
Bogie Wheelbase:  1.6m"
icon0             <kuid:-3:10164>
name-de             "Coal_Hopper"
description-de            "Coal_Hopper

Länge (über Kupplung): 12,4m

Weite (insgesamt): 2,8m

Höhe (insgesamt): 3,9m

Drehgestellmittenabstand: 7,4m

Drehgestell-Radstand: 1,6m"
name-it             "Carro a tramoggia per carbone"
description-it            "Carro a tramoggia per carbone

Lunghezza (agli accoppiatori): 12,4m
Larghezza (totale): 2,8m
Altezza (totale): 3,9m
Centro interperni: 7,4m
Passo carrelli: 1,6m"
name-es             "Tolva de carbón"
description-es            "Tolva de carbón

Largo (entreenganches): 12,4m
Ancho (total): 2,8m
Alto (total): 3,9m
Distancia entre centrosbogies: 7,4m
Empate de bogie: 1,6m"
name-pl             "Węglarka_samozsypna"
description-pl            "Węglarka Samozsypna Długość (z głowicą sprzęgu): 12.4m Szerokość (całkowita): 2.8m Wysokość (całkowita): 3.9m Rozstaw sworzni wózków zwrotnych: 7.4m Rozstaw osi w wózku zwrotnym: 1.6m"
name-cz             "Vůz na uhlí"
description-cz            "Vůz na uhlí

Délka (přes spřáhla): 12.4m
Šířka (průměrná): 2.8m
Výška (průměrná): 3.9m
Vzdálenost otočných čepů: 7.4m
Rozvor: 1.6m"
name-ru             "Хоппер_для_угля"
description-ru            "Хоппер для угля

Длина (с муфтами): 12,4 м
Ширина (общая): 2,8 м
Высота (общая): 3,9 м
База вагона: 7,4 м
База тележки: 1,6 м"
name-fr             "Wagon-trémie_charbon"
description-fr            "Wagon-trémie à charbon

Longueur (hors attelage) : 12,4 m

Largeur (hors tout) : 2,8 m

Hauteur (hors tout) : 3,9 m

Entre-axe de pivots de bogies : 7,4 m

Empattement d'un bogie : 1,6 m"

Hopper.gs:

//
// Hopper.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//
//

include "vehicle.gs"

//
// Hopper scriplet class.  No threads - only call overridden callbacks from Vehicle that
// are called by an Industry.
//
class Hopper isclass Vehicle
{
  // Play sound hopper is starting to be loaded.
  float BeginLoad(LoadingReport report)
  {
    Asset meAsset = GetAsset();
    World.PlaySound(meAsset, "coal_load1.wav", 1000.0f, 20.0f, 1000.0f, me, "");
    return 0.0;
  }

  // Activate particles and play a sound as the hopper is beginning to unload.
  float BeginUnload(LoadingReport report)
  {
    SetMeshAnimationState("left-door", true);
    SendMessage(me, "pfx", "+0+1");

    SetMeshAnimationState("right-door", true);
    SendMessage(me, "pfx", "+2+3");

    Asset meAsset = GetAsset();
    World.PlaySound(meAsset, "coal_dump1.wav", 1000.0f, 20.0f, 1000.0f, me, "");

    return 1.0;
  }

  // Deactivate particles and play a sound as the hopper is ending the unload operation.
  float EndUnload(LoadingReport report)
  {
    Sleep(1.0);

    SetMeshAnimationState("left-door", false);
    SendMessage(me, "pfx", "-0-1");

    SetMeshAnimationState("right-door", false);
    SendMessage(me, "pfx", "-2-3");

    return 1.0;
  }
};


GATX Oil Tanker
[Vehicles]

GATX Oil Tanker Vehicle

config.txt:

﻿
origin              "TRS2004"
kuid              <kuid:-3:10035>
engine              0
name              "GATX Oil Tanker"
mass              14000
company             "Oily Rag & Co"
bogey             100080
kind              "traincar"
enginespec            <kuid:-1:42004201>
script              "GATX_oilco"
class             "GATX_oilco"
queues {
  load {
    size          38800
    initial-count       0
    ;         "car to transport other liquids like water or milk"
    allowed-products {
      0       <kuid:-3:10010>
      1       <kuid:-3:10045>
      2       <kuid:-3:10011>
      3       <kuid:-3:10012>
    }
  }
}
mesh-table {
  default {
    auto-create       1
    mesh          "GATX_oilco_body/GATX_oilco_body.lm"
    effects {
      pipe-attachment-left {
        kind      "attachment"
        att     "a.loaderL"
      }
      pipe-attachment-right {
        kind      "attachment"
        att     "a.loaderR"
      }
    }
  }
  shadow {
    mesh          "GATX_oilco_shadow/GATX_oilco_shadow.pm"
  }
}
description           "

length: 37'4
width: 9'8
height: 13'9
bogie wheelbase: 5'6
bogie pivot centres: 27'2
"
icon0             <kuid:-3:10164>
name-de             "GATX Öltanker"
description-de            "Länge: 37'4

Breite: 9'8

Höhe: 13'9

Drehgestell-Radstand: 5'6

Drehgestellmittenabstand: 27'2"
name-it             "Cisterna petrolio GATX"
description-it            "Lunghezza: 37'4
Larghezza: 9'8
Altezza: 13'9
Passo carrelli: 5'6
Centro interperni: 27'2"
name-es             "Vagón cisterna GATX"
description-es            "Largo: 37'4
Ancho: 9'8
Alto: 13'9
Empate de bogie: 5'6
Distancia entre centros bogies: 27'2"
name-pl             "Cysterna GATX"
description-pl            "Długość: 37 stóp 4 cale Szerokość: 9 stóp 8 cali Wysokość: 13 stóp 9 cali Rozstaw osi w wózku zwrotnym: 5 stóp 6 cali Rozstaw sworzni wózków zwrotnych: 27 stóp 2 cale"
name-cz             "Cisterna GATX"
description-cz            "Délka: 37'4
Šířka: 9'8
Výška: 13'9
Rozvor náprav: 5'6
Vzdálenost otočných čepů: 27'2"
name-cn             "GATX Oil Tanker"
description-cn            "長：37'4 寬：9'8 高：13'9 台車軸距：5'6 台車軸心：27'2"
name-ru             "Цистерна GATX"
description-ru            "Длина: 37 фунтов 4 дюйма
Ширина: 9 фунтов 8 дюймов
Высота: 13 фунтов 9 дюймов
Колесная база тележки: 5 фунтов 6 дюймов
Расстояние между осями тележки: 27 фунтов 2 дюйма"
name-fr             "Wagon-citerne à pétrole GATX"
description-fr            "Longueur : 11,5 m

Largeur : 2,84 m

Hauteur : 4,2 m

Empattement d'un bogie : 1,65 m

Entre-axe de pivots de bogies : 8,3 m"

GATX_oilco.gs:

include "vehicle.gs"

class GATX_oilco isclass Vehicle
{

};


Woodchip Gondola
[Vehicles]

Woodchip Gondola Vehicle

config.txt:

﻿
kind              "traincar"
kuid              <kuid:-3:10063>
bogey             <kuid:-3:10064>
engine              0
name              "Woodchips_Gondola"
mass              20000
company             "Chippies Bits Ltd"
origin              "TRS2004"
enginespec            <kuid:-1:42004201>
script              "gondola"
class             "Gondola"
mesh-table {
  default {
    mesh          "woodchip_gondola_body/woodchip_gondola_body.lm"
    auto-create       1
  }
  shadow {
    mesh          "woodchip_gondola_shadow/woodchip_gondola_shadow.im"
  }
  load {
    mesh          "woodchip_gondola_body/load/load.im"
    anim          "woodchip_gondola_body/load/load.kin"
    auto-create       1
    use-parent-bounds     1
    effects {
      product-texture {
        kind      "texture-replacement"
        texture     "load_map.texture"
      }
    }
  }
}
queues {
  load0 {
    size          60500
    initial-count       0
    animated-mesh       "load"
    product-kuid        <kuid:-3:10002>
    allowed-categories {
      0       <kuid:-3:10040>
    }
  }
}
description           "
Woodchips Gondola

Company: Chippies Bits Ltd
Built:  1977-81ish
Length:  14.2m
Height:  2.74m
Width:  2.9m
Capacity: 52t
Wheel Diameter:  920mm
Bogie Centres:  10.6m"
icon0             <kuid:-3:10164>
name-fr             "Tombereau_copeaux"
description-fr            "Wagon tombereau à copeaux

Société : Chippies Bits Ltd

Construction : 1977 à 1981

Longueur : 14,2 m

Hauteur : 2,74 m

Largeur : 2,9 m

Capacité : 52 t

Diamètre des roues : 920 mm

Entre-axe de pivots de bogies : 10,6 m"
name-de             "Woodchips_Güterwagen_offen"
description-de            "Woodchips offener Güterwagen

Gesellschaft: Chippies Bits Ltd

Gebaut: ca. 1977-81

Länge: 14,2m

Höhe: 2,74m

Breite: 2,9m

Kapazität: 52t

Raddurchmesser: 920mm

Drehgestell-Mitten: 10,6m"
name-it             "Pianale_18.41 28/11/2003trucioli"
description-it            "Pianale trucioli

Società: Chippies Bits Ltd
Anno di costruzione: 1977-81 circa
Lunghezza: 14,2m
Altezza: 2,74m
Larghezza: 2,9m
Capienza: 52 tonnellate
Diametro ruote: 920mm
Centri carrello: 10,6m"
name-es             "Vag_abierto_restos_madera"
description-es            "Vagón abierto para el transportede restos de madera

Compañía: Chippies BitsLtd
Construcción: 1977-81
Largo: 14,2 m
Altura: 2,74 m
Ancho: 2,9 m
Volumen útil: 52 t
Diámetro de rueda: 920 mm
Entre centros bogies: 10,6 m"
name-pl             "Wagon_na_wióry"
description-pl            "Wagon do przewozu wiórów
Firma: Chippies Bits Ltd

Rok proukcji: ok. 1977-81
Długość: 14.2m
Wysokość: 2.74m
Szerokość: 2.9m
Ładowność: 52 ton
Średnica kół: 920mm
Rozstaw sworzni wózków zwrotnych: 10.6m"
name-cz             "Woodchips_Gondola"
description-cz            "Otevřený vůz na piliny

Společnost: Chippies Bits Ltd.
Rok výroby: 1977-81
Délka: 14.2m
Výška: 2.74m
Šířka: 2.9m
Kapacita: 52t
Průměr kol: 920mm
Vzdálenost otočných čepů: 10.6m"
name-cn             "Woodchips_Gondola"
description-cn            "Woodchips Gondol 製造公司：Chippies Bits Ltd 製造時間：1977-81ish 長：14.2m 高：2.74m 寬：2.9m 最高承載：52t 車輪直徑：920mm 台車軸心：10.6m"
name-ru             "Вагон для опилок"
description-ru            "Вагон для опилок

Компания: Chippies Bits Ltd
Годы выпуска: 1977-81
Длина: 14,2 м
Высота: 2,74 м
Ширина: 2,9 м
Вместимость: 52 т
Диаметр колес: 920 мм
База вагона: 10,6 мм"

gondola.gs:

//
// Gondola.gs
//
//  Copyright (C) 2003 Auran Developments Pty Ltd
//  All Rights Reserved.
//
//

include "vehicle.gs"

//
// Gondola scriplet class.  No threads - only call overridden callbacks from Vehicle that
// are called by an Industry.
//
class Gondola isclass Vehicle
{
  // Play sound Gondola is starting to be loaded.
  float BeginLoad(LoadingReport report)
  {
    Asset meAsset = GetAsset();
    World.PlaySound(meAsset, "coal_load1.wav", 1000.0f, 20.0f, 1000.0f, me, "");
    return 0.0;
  }

  // Activate particles and play a sound as the Gondola is beginning to unload.
  float BeginUnload(LoadingReport report)
  {
    Asset meAsset = GetAsset();
    World.PlaySound(meAsset, "coal_dump1.wav", 1000.0f, 20.0f, 1000.0f, me, "");

    return 1.0;
  }

  // Deactivate particles and play a sound as the Gondola is ending the unload operation.
  float EndUnload(LoadingReport report)
  {
    Sleep(1.0);

    return 1.0;
  }
};


Trainz Railroad Simulator 2006 User Activity Creation Guide Compound List

Here are the classes, structs, unions and interfaces with brief descriptions:
AiHornMsg
AITrainScope
Asset
AssetCheckListHandler
BaseIndustry
BaseIndustryInfo
BasePortal
Bogey
Browser
BrowserInterface
Buildable
Cabin
CabinControl
CabinControlSetting
CabinData
CheckBoxHandler
CheckListGroupHandler
CheckListPropertyHandler
Command
ConditionalScenarioBehavior
ConfigAssetGroupHandler
ConfigAssetHandler
ConsistHelperInfo
ConsistListHelper
Constructors
ControlSettingsManager
Crossing
CustomCommand
DefaultLocomotiveCabin
DefaultSteamCabin
DefaultSteamCabinData
DriverCharacter
DriverCommand
DriverCommands
DriverScheduleCommand
DriversInfo
EnumeratedAssetHandler
EnumeratedGameObjectHandler
EnumeratedMultiPropertyHandler
EnumeratedPropertyHandler
Flags
GameObject
GenericBoolHandler
GenericIndustry
GenericIntNumberHandler
GenericListHandler
GenericPassengerStation
GenericStringHandler
GSObject
GSTrackSearch
HTMLPropertyGroup
HTMLPropertyHandler
HTMLWindow
Industry
IndustryProcessInfo
IndustryProductInfo
IndustryProductInfoCollection
IndustryProductInfoComplete
IndustryProductInfoProcess
IndustryProductInfoQueues
IndustryProductInfoTracks
IndustryTrainController
Interface
InterfaceAlert
InterfaceObjective
IPICProcess
IPICQueue
IPICTrack
ITCTrainCommand
Junction
JunctionBase
JunctionBaseGameObject
JunctionPermitInfo
KUID
KUIDList
Library
LinkedData
LinkedList
LoadHelperInfo
LoadingReport
Locomotive
Log
LogScope
MapObject
Math
Menu
MeshObject
Message
ModuleScript
Navigate
NumberValueInt
OnlineAccess
OnlineGroup
PassengerStationInfo
Permit
ProductFilter
ProductQueue
PropertyBrowser
PropertyObject
PropertyValue
RadioButtonGroupHandler
RadioButtonListHandler
Requirement
ResourceRequirement
Router
Scenario
ScenarioBehavior
ScenarioStringTable
ScenarioSupport
SceneryWithTrack
Schedule
ScheduleHistoryRec
ShuntTrack
Signal
SignalBehaviour
Soup
SpecificVehiclesInfo
StationBehaviour
Str
StringTable
Timetable
TimetableState
Track
TrackLoadInfo
TrackMark
Trackside
Train
TrainHelperInfo
TrainTimetable
TrainTimetableItem
TrainUtil
Trainz
TrainzGameObject
Trigger
Turntable
Vehicle
VehicleDescriptor
VehicleHelperInfo
VehicleTypesInfo
VHIDriversInfo
VHISpecificVehiclesInfo
VHIVehicleTypesInfo
World
World1


AssetRef.h

00001


AiHornMsg Member List

This is the complete list of members for AiHornMsg, including all inherited members.
Execute(Train train, int px, int py, int pz) AiHornMsg [inline]


AITrainScope Member List

This is the complete list of members for AITrainScope, including all inherited members.


Asset Member List

This is the complete list of members for Asset, including all inherited members.
FindAsset(string kuidTableAssetName) | Asset |
GetConfigSoup(void) | Asset |
GetDependencyList(void) | Asset |
GetKUID(void) | Asset |
GetLocalisedName(void) | Asset |
GetName(void) | Asset | [inline]
GetStringTable(void) | Asset |
LookupKUIDTable(string kuidTableAssetName) | Asset |


AssetCheckListHandler Member List

This is the complete list of members for AssetCheckListHandler, including all inherited members.
GetAssetIndex(Asset asset) | AssetCheckListHandler |
GetAssetType(void) | AssetCheckListHandler | [inline]
GetConfigPrefix(void) | ConfigAssetHandler | [inline, private]
GetDescriptionHTML(void) | AssetCheckListHandler | [inline]
GetHostAsset(void) | ConfigAssetHandler | [inline, private]
GetProperties() | AssetCheckListHandler | [inline]
GetPropertyType(string propertyID) | AssetCheckListHandler | [inline]
GetSettingAsset(int index) | AssetCheckListHandler | [inline]
GetSettingAssets(bool checked) | AssetCheckListHandler | [inline]
GetStringTable(void) | ConfigAssetHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | AssetCheckListHandler |
Init(Asset asset, string newConfigPrefix) | AssetCheckListHandler | [inline]
SetProperties(Soup soup) | AssetCheckListHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | AssetCheckListHandler | [inline]


BaseIndustry Member List

This is the complete list of members for BaseIndustry, including all inherited members.
AddAssetToIndustryProductInfo(Asset asset, string queueName, string processName, bool isInput, bool showInViewDetails, bool showInSurveyorProperties) | BaseIndustry | [inline]
AddAssetToIndustryProductInfo(string assetName, string queueName, string processName, bool isInput, bool showInViewDetails, bool showInSurveyorProperties) | BaseIndustry | [inline]
AddAssetToIndustryProductInfo(Asset asset, string queueName, string processName, bool isInput, bool showInViewDetails) | BaseIndustry | [inline]
AddAssetToIndustryProductInfo(string assetName, string queueName, string processName, bool isInput, bool showInViewDetails) | BaseIndustry | [inline]
AddAssetToIndustryProductInfo(string assetName, string queueName, string processName, bool isInput) | BaseIndustry | [inline]
AddAssetToIndustryProductInfo(Asset asset, string queueName, string processName, bool isInput) | BaseIndustry | [inline]
AppendDriverDestinations(string[] destNames, string[] destTracks) | Industry | [inline, private]
AppendProductList(Asset[] productList) | BaseIndustry | [inline]
BaseIndustryMain(void) | BaseIndustry | [inline]
BeginLoad(LoadingReport report) | BaseIndustry | [inline]
BeginUnload(LoadingReport report) | BaseIndustry | [inline]
ClearProcess(string processName) | Industry | [private]
CreateLoadingReport(ProductQueue srcIndustryQueue, int amountLoad) | Industry | [inline, private]
CreateUnloadingReport(ProductQueue dstIndustryQueue, int amountToUnload) | Industry | [inline, private]
EndLoad(LoadingReport report) | BaseIndustry | [inline]
EndUnload(LoadingReport report) | BaseIndustry | [inline]
GetLoadTime(LoadingReport report) | BaseIndustry | [inline]
GetProcessDuration(string processName) | Industry | [private]
GetProcessEnabled(string processName) | Industry | [private]
GetProcessInput(string processName, ProductQueue queue, Asset product) | Industry | [private]
GetProcessIOAmount(string processName, bool wantInput, int ioIndex) | Industry | [private]
GetProcessIOProduct(string processName, bool wantInput, int ioIndex) | Industry | [private]
GetProcessIOQueue(string processName, bool wantInput, int ioIndex) | Industry | [private]
GetProcessNameList(void) | Industry | [private]
GetProcessOutput(string processName, ProductQueue queue, Asset product) | Industry | [private]
GetProcessStarted(string processName) | Industry | [private]
GetProductNameList(ProductQueue queue) | BaseIndustry |
GetProperties(void) | BaseIndustry | [inline]
GetRequirements(void) | Industry | [inline, private]
GetUnloadTime(LoadingReport report) | BaseIndustry | [inline]
HandleTrain(Train train, string loadCommand) | BaseIndustry | [inline]
HandleTrainLoadCommand(Train train) | BaseIndustry | [inline]
HandleTrainUnloadCommand(Train train) | BaseIndustry | [inline]
HasTrack(string track) | Industry | [private]
industryProductInfoCollection | BaseIndustry |
info | BaseIndustry |
Init(void) | BaseIndustry | [inline]
itc | BaseIndustry |
LOAD_COMMAND | Industry | [private]
m_trainLoadingSpeed | BaseIndustry |
NotifyProcessFinished(string processName) | BaseIndustry | [inline]
NotifyProcessStarted(string processName) | Industry | [inline, private]
PerformInnerEnterMoving(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
PerformInnerEnterStop(Vehicle vehicle) | BaseIndustry | [inline]
PerformMassStopped(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
PerformMassStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry |
PerformMovingLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
PerformProcessCancelled(string processName) | Industry | [private]
PerformProcessFinished(string processName) | Industry | [private]
PerformProcessInput(string processName) | Industry | [private]
PerformProcessOutput(string processName) | Industry | [private]
PerformProcessStarted(string processName) | Industry | [private]
PerformStopped(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
PerformStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
PerformStoppedNoTrigger(Vehicle vehicle) | BaseIndustry | [inline]
pipeName | BaseIndustry |
SetProcessDuration(string processName, float processDuration) | Industry | [private]
SetProcessEnabled(string processName, bool enabled) | Industry | [private]
SetProcessInput(string processName, ProductQueue queue, Asset product, int amount) | Industry | [private]
SetProcessOutput(string processName, ProductQueue queue, Asset product, int amount) | Industry | [private]
SetProperties(Soup soup) | BaseIndustry | [inline]
SetQueueInitialCount(ProductQueue queue, Asset asset, int newValue) | BaseIndustry | [inline]
ThreadEndPipeAnimation(Vehicle vehicle) | BaseIndustry | [inline]
ThreadPerformMassStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
ThreadPerformMovingLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
ThreadPerformStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
TriggerSupportsMassMovingLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
TriggerSupportsMovingLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline]
UNLOAD_COMMAND | Industry | [private]
usePipeAnimation | BaseIndustry |
ViewDetails(void) | BaseIndustry | [inline]


BaseIndustryInfo Member List

This is the complete list of members for BaseIndustryInfo, including all inherited members.
GetDescriptionHTML(void) | BaseIndustryInfo | [inline]
GetPrefix(void) | HTMLPropertyHandler | [private]
GetProperties(void) | HTMLPropertyHandler | [private]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyHandler | [private]
GetPropertyDescription(string propertyID) | BaseIndustryInfo | [inline]
GetPropertyElementList(string propertyID) | HTMLPropertyHandler | [private]
GetPropertyName(string propertyID) | BaseIndustryInfo | [inline]
GetPropertyType(string propertyID) | BaseIndustryInfo | [inline]
GetPropertyValue(string propertyID) | HTMLPropertyHandler | [private]
GetSavesProperties(void) | HTMLPropertyHandler | [private]
HREF(string propertyName) | HTMLPropertyHandler | [private]
Link(string propertyName) | HTMLPropertyHandler | [private]
Prop(string propertyName) | HTMLPropertyHandler | [private]
PropMatchesPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
PropStripPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
RefreshBrowser(Browser browser) | HTMLPropertyHandler | [private]
SetPrefix(string prefix) | HTMLPropertyHandler | [private]
SetProperties(Soup soup) | HTMLPropertyHandler | [private]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyHandler | [private]
SetPropertyValue(string propertyID, PropertyValue value) | BaseIndustryInfo | [inline]
SetSavesProperties(bool saveProperties) | HTMLPropertyHandler | [private]


BasePortal Member List

This is the complete list of members for BasePortal, including all inherited members.
AppendDriverDestinations(string[] destNames, string[] destTracks) | Industry | [inline, private]
AppendProductList(Asset[] productList) | Industry | [inline, private]
BeginLoad(LoadingReport report) | Industry | [private]
BeginUnload(LoadingReport report) | Industry | [private]
ClearProcess(string processName) | Industry | [private]
CreateLoadingReport(ProductQueue srcIndustryQueue, int amountLoad) | Industry | [inline, private]
CreateUnloadingReport(ProductQueue dstIndustryQueue, int amountToUnload) | Industry | [inline, private]
EndLoad(LoadingReport report) | Industry | [private]
EndUnload(LoadingReport report) | Industry | [private]
GetLoadTime(LoadingReport report) | Industry | [private]
GetProcessDuration(string processName) | Industry | [private]
GetProcessEnabled(string processName) | Industry | [private]
GetProcessInput(string processName, ProductQueue queue, Asset product) | Industry | [private]
GetProcessIOAmount(string processName, bool wantInput, int ioIndex) | Industry | [private]
GetProcessIOProduct(string processName, bool wantInput, int ioIndex) | Industry | [private]
GetProcessIOQueue(string processName, bool wantInput, int ioIndex) | Industry | [private]
GetProcessNameList(void) | Industry | [private]
GetProcessOutput(string processName, ProductQueue queue, Asset product) | Industry | [private]
GetProcessStarted(string processName) | Industry | [private]
GetRequirements(void) | Industry | [inline, private]
GetUnloadTime(LoadingReport report) | Industry | [private]
HandleTrain(Train train, string loadCommand) | Industry | [private]
HasTrack(string track) | Industry | [private]
LOAD_COMMAND | Industry | [private]
NotifyProcessFinished(string processName) | Industry | [inline, private]
NotifyProcessStarted(string processName) | Industry | [inline, private]
PerformProcessCancelled(string processName) | Industry | [private]
PerformProcessFinished(string processName) | Industry | [private]
PerformProcessInput(string processName) | Industry | [private]
PerformProcessOutput(string processName) | Industry | [private]
PerformProcessStarted(string processName) | Industry | [private]
SetProcessDuration(string processName, float processDuration) | Industry | [private]
SetProcessEnabled(string processName, bool enabled) | Industry | [private]
SetProcessInput(string processName, ProductQueue queue, Asset product, int amount) | Industry | [private]
SetProcessOutput(string processName, ProductQueue queue, Asset product, int amount) | Industry | [private]
UNLOAD_COMMAND | Industry | [private]


Bogey Member List

This is the complete list of members for Bogey, including all inherited members.
GetFXAttachment(string effectName) | MeshObject | [private]
GetMeshAnimationFrame(string p_meshName) | MeshObject | [private]
GetMeshAnimationFrameCount(string p_meshName) | MeshObject | [private]
HasMesh(string p_meshName) | MeshObject | [private]
Init(void) | MeshObject | [inline, private]
Init(Asset asset) | MeshObject | [private]
Init(Asset asset) | MeshObject | [inline, private]
SetFXAnimationState(string effectName, bool state) | MeshObject | [private]
SetFXAttachment(string effectName, Asset asset) | MeshObject | [private]
SetFXCoronaTexture(string effectName, Asset textureAsset) | MeshObject | [private]
SetFXNameText(string effectName, string text) | MeshObject | [private]
SetFXTextureReplacement(string effectName, Asset textureGroupAsset, int textureIndex) | MeshObject | [private]
SetMesh(string meshName, float fadeDuration) | MeshObject | [private]
SetMeshAnimationFrame(string p_meshName, float p_frame) | MeshObject | [private]
SetMeshAnimationFrame(string p_meshName, float p_frame, float interpTime) | MeshObject | [private]
SetMeshAnimationSpeed(string p_meshName, float p_speed) | MeshObject | [private]
SetMeshAnimationState(string p_meshName, bool p_state) | MeshObject | [private]
SetMeshVisible(string meshName, bool visible, float fadeDuration) | MeshObject | [private]
StartMeshAnimationLoop(string p_meshName) | MeshObject | [private]
StopMeshAnimation(string p_meshName) | MeshObject | [private]


Browser Member List

This is the complete list of members for Browser, including all inherited members.
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
BringToFront(void) | Browser
ClearMessages(string major, string minor) | GameObject | [private]
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
GetAsset(void) | Browser
GetElementProperty(string elementID, string propertyID) | Browser
GetId() | GameObject | [private]
GetName() | GameObject | [private]
GetWindowBottom(void) | Browser
GetWindowHeight(void) | Browser
GetWindowLeft(void) | Browser
GetWindowRight(void) | Browser
GetWindowTop(void) | Browser
GetWindowVisible(void) | Browser
GetWindowWidth(void) | Browser
LoadHTMLFile(Asset asset, string relativePath) | Browser
LoadHTMLFile(string localFilename) | Browser
LoadHTMLString(string htmlData) | Browser
LoadHTMLString(Asset asset, string htmlData) | Browser
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
ResetScrollBar(void) | Browser
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
SetCloseEnabled(bool enabled) | Browser
SetElementObjectProperty(string elementID, string propertyID, object value) | Browser
SetElementProperty(string elementID, string propertyID, string value) | Browser
SetParam(int paramID, string str) | Browser
SetScrollEnabled(bool enabled) | Browser
SetTrainzText(string id, string text) | Browser
SetWindowBottom(int bottom) | Browser
SetWindowGrow(int minWidth, int minHeight, int maxWidth, int maxHeight) | Browser
SetWindowHeight(int height) | Browser
SetWindowLeft(int left) | Browser
SetWindowPosition(int left, int top) | Browser
SetWindowRect(int left, int top, int right, int bottom) | Browser
SetWindowRight(int right) | Browser
SetWindowSize(int width, int height) | Browser
SetWindowStyle(int style) | Browser
SetWindowTop(int top) | Browser
SetWindowVisible(bool visible) | Browser
SetWindowWidth(int width) | Browser
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]


BrowserInterface Member List

This is the complete list of members for BrowserInterface, including all inherited members.
CreateBrowser(void) | BrowserInterface |
FadeScreen(GameObject runningThread, float red, float green, float blue, float alpha, float time) | BrowserInterface | [inline]
Quote(string a_str) | BrowserInterface |
SetOverlayColor(float red, float green, float blue, float alpha, float morphTime) | BrowserInterface |
SetSaveAllowed(bool saveAllowed) | BrowserInterface |


Buildable Member List

This is the complete list of members for Buildable, including all inherited members.
CancelBuild(void) | Buildable
EnableUserCancelBuild(bool enable) | Buildable
EnableUserStartBuild(bool enable) | Buildable
FindTriggerContainingNode(int nodeId, bool onlyInnerTrigger) | SceneryWithTrack | [private]
GetAttachedJunctions(void) | SceneryWithTrack | [private]
GetAttachedTrack(string trackName) | SceneryWithTrack | [private]
GetBuildingProgress(void) | Buildable
GetBuildingState(void) | Buildable
GetTriggerTrack(string triggerName) | SceneryWithTrack | [private]
InnerReEnter(int nodeId) | SceneryWithTrack | [private]
InnerReEnterTrain(Train train) | SceneryWithTrack | [inline, private]
IsTrainInTriggers(Train train, bool onlyCheckInnerRadius) | SceneryWithTrack | [private]
ReEnter(int nodeId) | SceneryWithTrack | [private]
SetBuildingPaused(bool paused) | Buildable
SetBuildingProgress(float progress) | Buildable
SetBuildingState(int state) | Buildable
StartBuild(void) | Buildable


Cabin Member List

This is the complete list of members for Cabin, including all inherited members.
Attach(GameObject obj) | Cabin | [inline]
FireAddCoal(void) | Cabin |
GetControls(void) | Cabin |
GetFXAttachment(string effectName) | MeshObject | [private]
GetMeshAnimationFrame(string p_meshName) | MeshObject | [private]
GetMeshAnimationFrameCount(string p_meshName) | MeshObject | [private]
GetNamedControl(string name) | Cabin |
GetParentObject(void) | Cabin |
HasMesh(string p_meshName) | MeshObject | [private]
Init(void) | Cabin | [inline]
MeshObject.Init(Asset asset) | MeshObject | [private]
IsActive(void) | Cabin |
SetCabLightIntensity(float intensity) | Cabin |
SetFXAnimationState(string effectName, bool state) | MeshObject | [private]
SetFXAttachment(string effectName, Asset asset) | MeshObject | [private]
SetFXCoronaTexture(string effectName, Asset textureAsset) | MeshObject | [private]
SetFXNameText(string effectName, string text) | MeshObject | [private]
SetFXTextureReplacement(string effectName, Asset textureGroupAsset, int textureIndex) | MeshObject | [private]
SetMesh(string meshName, float fadeDuration) | MeshObject | [private]
SetMeshAnimationFrame(string p_meshName, float p_frame) | MeshObject | [private]
SetMeshAnimationFrame(string p_meshName, float p_frame, float interpTime) | MeshObject | [private]
SetMeshAnimationSpeed(string p_meshName, float p_speed) | MeshObject | [private]
SetMeshAnimationState(string p_meshName, bool p_state) | MeshObject | [private]
SetMeshVisible(string meshName, bool visible, float fadeDuration) | MeshObject | [private]
StartMeshAnimationLoop(string p_meshName) | MeshObject | [private]
StopMeshAnimation(string p_meshName) | MeshObject | [private]
Update(void) | Cabin | [inline]
UserPressKey(string s) | Cabin | [inline]
UserSetControl(CabinControl control, float value) | Cabin | [inline]


CabinControl Member List

This is the complete list of members for CabinControl, including all inherited members.
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
ClearMessages(string major, string minor) | GameObject | [private]
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
GetId() | GameObject | [private]
GetMaximum(void) | CabinControl |
GetMinimum(void) | CabinControl |
GetName(void) | CabinControl |
GetValue(void) | CabinControl |
IsLocked(void) | CabinControl |
IsVisible(void) | CabinControl |
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
SetLocked(bool locked) | CabinControl |
SetNamedValue(string name, float value) | CabinControl |
SetText(string text) | CabinControl |
SetUserLimits(float min, float max) | CabinControl |
SetValue(float value) | CabinControl |
SetVisible(bool visible) | CabinControl |
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]


CabinControlSetting Member List

This is the complete list of members for CabinControlSetting, including all inherited members.
ctrl_name | CabinControlSetting
ctrl_value | CabinControlSetting


CheckBoxHandler Member List

This is the complete list of members for CheckBoxHandler, including all inherited members.
GetBoolDisplayValue(void) | GenericBoolHandler | [private]
GetBoolValue(void) | GenericBoolHandler | [inline, private]
GetDescriptionHTML(void) | CheckBoxHandler | [inline]
GetProperties() | GenericBoolHandler | [inline, private]
GetPropertyAttribute(string propertyID, string attribute) | GenericBoolHandler | [inline, private]
GetPropertyType(string propertyID) | GenericBoolHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | CheckBoxHandler | [inline]
SetBoolValue(bool newBoolValue) | GenericBoolHandler | [inline, private]
SetProperties(Soup soup) | GenericBoolHandler | [inline, private]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | GenericBoolHandler | [inline, private]
SetPropertyValue(string propertyID, PropertyValue value) | GenericBoolHandler | [inline, private]


CheckListGroupHandler Member List

This is the complete list of members for CheckListGroupHandler, including all inherited members.
AddHandler(HTMLPropertyHandler handler, string subPrefix) | CheckListGroupHandler | [inline]
GetConfigPrefix() | ConfigAssetGroupHandler | [inline, private]
GetDescriptionHTML(void) | CheckListGroupHandler | [inline]
GetHostAsset() | ConfigAssetGroupHandler | [inline, private]
GetProperties() | CheckListGroupHandler | [inline]
GetPropertyAttribute(string propertyID, string attribute) | ConfigAssetGroupHandler | [inline, private]
GetPropertyType(string propertyID) | CheckListGroupHandler | [inline]
GetStringTable(void) | ConfigAssetGroupHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | CheckListGroupHandler |
Init(Asset asset, string newConfigPrefix) | CheckListGroupHandler | [inline]
SetProperties(Soup soup) | CheckListGroupHandler | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | ConfigAssetGroupHandler | [inline, private]
SetPropertyValue(string propertyID, PropertyValue value) | CheckListGroupHandler | [inline]


CheckListPropertyHandler Member List

This is the complete list of members for CheckListPropertyHandler, including all inherited members.
AddItem(string itemName, bool setting) | CheckListPropertyHandler |
CountItems() | CheckListPropertyHandler |
GetConfigPrefix(void) | ConfigAssetHandler | [inline, private]
GetDescriptionHTML(void) | CheckListPropertyHandler | [inline]
GetHostAsset(void) | ConfigAssetHandler | [inline, private]
GetProperties() | CheckListPropertyHandler | [inline]
GetPropertyType(string propertyID) | CheckListPropertyHandler | [inline]
GetSetting(int index) | CheckListPropertyHandler |
GetSettingDisplayName(int index) | CheckListPropertyHandler |
GetSettingName(int index) | CheckListPropertyHandler |
GetSettingNames(void) | CheckListPropertyHandler | [inline]
GetSettingNames(bool checked) | CheckListPropertyHandler |
GetSettings(void) | CheckListPropertyHandler | [inline]
GetSettingsAsFlags(void) | CheckListPropertyHandler |
GetStringTable(void) | ConfigAssetHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | CheckListPropertyHandler |
Init(Asset asset, string newConfigPrefix) | CheckListPropertyHandler | [inline]
ItemExists(int index) | CheckListPropertyHandler | [inline]
ItemExists(string itemName) | CheckListPropertyHandler |
ItemExistsChecked(string itemName, bool checkState) | CheckListPropertyHandler |
SetAll(bool checked) | CheckListPropertyHandler |
SetItem(int itemIndex, bool itemChecked) | CheckListPropertyHandler |
SetProperties(Soup soup) | CheckListPropertyHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | CheckListPropertyHandler | [inline]


Command Member List

This is the complete list of members for Command, including all inherited members.
ca | Command
cb | Command
cc | Command
cd | Command
command | Command
custom | Command
major | Command
minor | Command
obj | Command


ConditionalScenarioBehavior Member List

This is the complete list of members for ConditionalScenarioBehavior, including all inherited members.
AppendDependencies(KUIDList io_dependencies) | ScenarioBehavior | [private]
COMPLETE | ScenarioBehavior | [private]
DOES_COMPLETE | ScenarioBehavior | [private]
ExecuteRule(void) | ConditionalScenarioBehavior |
GetChildBehaviors(void) | ScenarioBehavior | [private]
GetConditionResult(void) | ConditionalScenarioBehavior |
GetDescription(void) | ScenarioBehavior | [private]
GetParentBehavior(void) | ScenarioBehavior | [private]
GetProperties(void) | ScenarioBehavior | [private]
GetProperties(void) | ScenarioBehavior | [inline, private]
GetRequirements(void) | ScenarioBehavior | [inline, private]
GetStateFlags(void) | ScenarioBehavior | [inline, private]
Init(Asset p_self) | ConditionalScenarioBehavior | [inline]
IsComplete(void) | ScenarioBehavior | [private]
IsPaused(void) | ScenarioBehavior | [inline, private]
m_pollingBehavior | ConditionalScenarioBehavior |
m_pollingThreadRunning | ConditionalScenarioBehavior |
m_saveLoadRestart | ConditionalScenarioBehavior |
NONE | ScenarioBehavior | [private]
Pause(bool paused) | ConditionalScenarioBehavior | [inline]
PauseChildren(void) | ConditionalScenarioBehavior |
PAUSED | ScenarioBehavior | [private]
Reset(void) | ScenarioBehavior | [private]
ResetChildren(void) | ConditionalScenarioBehavior |
SetComplete(bool isComplete) | ScenarioBehavior | [private]
SetProperties(Soup soup) | ConditionalScenarioBehavior | [inline]
SetStateFlags(int flags, bool set) | ScenarioBehavior | [private]
ThreadPollCondition(void) | ConditionalScenarioBehavior |
UnpauseChildren(void) | ConditionalScenarioBehavior | [inline]
UpdateChildren(Message notUsed) | ConditionalScenarioBehavior |
WAS_COMPLETE | ScenarioBehavior | [private]
WasComplete(void) | ScenarioBehavior | [private]


ConfigAssetGroupHandler Member List

This is the complete list of members for ConfigAssetGroupHandler, including all inherited members.
AddHandler(HTMLPropertyHandler handler, string subPrefix) | HTMLPropertyGroup | [private]
FindHandler(string propertyID) | HTMLPropertyGroup | [private]
GetConfigPrefix() | ConfigAssetGroupHandler | [inline]
GetDescriptionHTML(void) | ConfigAssetGroupHandler | [inline]
GetHostAsset() | ConfigAssetGroupHandler | [inline]
GetProperties() | ConfigAssetGroupHandler | [inline]
GetPropertyAttribute(string propertyID, string attribute) | ConfigAssetGroupHandler | [inline]
GetPropertyDescription(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyDescription(string propertyID) | HTMLPropertyGroup | [inline, private]
GetPropertyElementList(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyElementList(string propertyID) | HTMLPropertyGroup | [inline, private]
GetPropertyName(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyName(string propertyID) | HTMLPropertyGroup | [inline, private]
GetPropertyType(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyType(string propertyID) | HTMLPropertyGroup | [inline, private]
GetPropertyValue(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyValue(string propertyID) | HTMLPropertyGroup | [inline, private]
GetStringTable(void) | ConfigAssetGroupHandler | [inline]
Init(Asset asset, string newConfigPrefix) | ConfigAssetGroupHandler |
LogHandlers(void) | HTMLPropertyGroup | [private]
RefreshBrowser(Browser browser) | HTMLPropertyGroup | [private]
RefreshBrowser(Browser browser) | HTMLPropertyGroup | [inline, private]
RemoveHandler(HTMLPropertyHandler handler) | HTMLPropertyGroup | [private]
SetPrefix(string prefix) | HTMLPropertyGroup | [private]
SetPrefix(string prefix) | HTMLPropertyGroup | [inline, private]
SetProperties(Soup soup) | ConfigAssetGroupHandler | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | ConfigAssetGroupHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | HTMLPropertyGroup | [private]
SetPropertyValue(string propertyID, PropertyValue value) | HTMLPropertyGroup | [inline, private]


ConfigAssetHandler Member List

This is the complete list of members for ConfigAssetHandler, including all inherited members.
GetConfigPrefix(void) | ConfigAssetHandler | [inline]
GetDescriptionHTML(void) | ConfigAssetHandler | [inline]
GetHostAsset(void) | ConfigAssetHandler | [inline]
GetPrefix(void) | HTMLPropertyHandler | [private]
GetProperties() | ConfigAssetHandler | [inline]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyHandler | [private]
GetPropertyDescription(string propertyID) | HTMLPropertyHandler | [private]
GetPropertyElementList(string propertyID) | HTMLPropertyHandler | [private]
GetPropertyName(string propertyID) | HTMLPropertyHandler | [private]
GetPropertyType(string propertyID) | HTMLPropertyHandler | [private]
GetPropertyValue(string propertyID) | HTMLPropertyHandler | [private]
GetSavesProperties(void) | HTMLPropertyHandler | [private]
GetStringTable(void) | ConfigAssetHandler | [inline]
HREF(string propertyName) | HTMLPropertyHandler | [private]
Init(Asset asset, string newConfigPrefix) | ConfigAssetHandler |
Link(string propertyName) | HTMLPropertyHandler | [private]
Prop(string propertyName) | HTMLPropertyHandler | [private]
PropMatchesPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
PropStripPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
RefreshBrowser(Browser browser) | HTMLPropertyHandler | [private]
SetPrefix(string prefix) | HTMLPropertyHandler | [private]
SetProperties(Soup soup) | ConfigAssetHandler | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyHandler | [private]
SetPropertyValue(string propertyID, PropertyValue value) | HTMLPropertyHandler | [private]
SetSavesProperties(bool saveProperties) | HTMLPropertyHandler | [private]


ConsistHelperInfo Member List

This is the complete list of members for ConsistHelperInfo, including all inherited members.
couplingMask ConsistHelperInfo
decouplingMask ConsistHelperInfo
GetDescriptionHTML(void) | ConsistHelperInfo | [inline]
GetPrefix(void) | HTMLPropertyHandler | [private]
GetProperties(void) | ConsistHelperInfo | [inline]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyHandler | [private]
GetPropertyDescription(string propertyID) | ConsistHelperInfo | [inline]
GetPropertyElementList(string propertyID) | ConsistHelperInfo | [inline]
GetPropertyName(string propertyID) | ConsistHelperInfo | [inline]
GetPropertyType(string propertyID) | ConsistHelperInfo | [inline]
GetPropertyValue(string propertyID) | ConsistHelperInfo | [inline]
GetSavesProperties(void) | HTMLPropertyHandler | [private]
handbrake ConsistHelperInfo
HREF(string propertyName) | HTMLPropertyHandler | [private]
Link(string propertyName) | HTMLPropertyHandler | [private]
Prop(string propertyName) | HTMLPropertyHandler | [private]
PropMatchesPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
PropStripPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
RefreshBrowser(Browser browser) | ConsistHelperInfo | [inline]
SetPrefix(string prefix) | HTMLPropertyHandler | [private]
SetProperties(Soup soup) | ConsistHelperInfo | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyHandler | [private]
SetPropertyValue(string propertyID, PropertyValue value) | ConsistHelperInfo | [inline]
SetSavesProperties(bool saveProperties) | HTMLPropertyHandler | [private]


ConsistListHelper Member List

This is the complete list of members for ConsistListHelper, including all inherited members.
AddHandler(HTMLPropertyHandler handler, string subPrefix) | HTMLPropertyGroup | [private]
FindHandler(string propertyID) | HTMLPropertyGroup | [private]
GetDescriptionHTML(void) | ConsistListHelper | [inline]
GetProperties(void) | ConsistListHelper | [inline]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyGroup | [private]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyGroup | [inline, private]
GetPropertyDescription(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyDescription(string propertyID) | HTMLPropertyGroup | [inline, private]
GetPropertyElementList(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyElementList(string propertyID) | HTMLPropertyGroup | [inline, private]
GetPropertyName(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyName(string propertyID) | HTMLPropertyGroup | [inline, private]
GetPropertyType(string propertyID) | ConsistListHelper | [inline]
GetPropertyValue(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyValue(string propertyID) | HTMLPropertyGroup | [inline, private]
LogHandlers(void) | HTMLPropertyGroup | [private]
RefreshBrowser(Browser browser) | HTMLPropertyGroup | [private]
RefreshBrowser(Browser browser) | HTMLPropertyGroup | [inline, private]
RemoveHandler(HTMLPropertyHandler handler) | HTMLPropertyGroup | [private]
SetPrefix(string prefix) | HTMLPropertyGroup | [private]
SetPrefix(string prefix) | HTMLPropertyGroup | [inline, private]
SetProperties(Soup soup) | ConsistListHelper | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyGroup | [private]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyGroup | [inline, private]
SetPropertyValue(string propertyID, PropertyValue value) | ConsistListHelper | [inline]


Constructors Member List

This is the complete list of members for Constructors, including all inherited members.
GetTrainzAsset(void) | Constructors
GetTrainzStrings(void) | Constructors
NewBrowser(void) | Constructors
NewDriverCommand(Asset commandAsset) | Constructors
NewDriverCommands(void) | Constructors
NewKUIDList(void) | Constructors
NewMenu(void) | Constructors
NewProductFilter(void) | Constructors
NewSoup(void) | Constructors


ControlSettingsManager Member List

This is the complete list of members for ControlSettingsManager, including all inherited members.
AddControl(string name, float value) | ControlSettingsManager | [inline]
controlSettings | ControlSettingsManager |
FindIndex(string nameTest) | ControlSettingsManager | [inline]
UpdateCabin(Cabin cabinToUpdate) | ControlSettingsManager | [inline]


Crossing Member List

This is the complete list of members for Crossing, including all inherited members.
CROSSING_STATE_CLOSED | Crossing |
CROSSING_STATE_CLOSING | Crossing |
CROSSING_STATE_OPEN | Crossing |
CROSSING_STATE_OPENING | Crossing |
FindTriggerContainingNode(int nodeId, bool onlyInnerTrigger) | SceneryWithTrack | [private]
GetAttachedJunctions(void) | SceneryWithTrack | [private]
GetAttachedTrack(string trackName) | SceneryWithTrack | [private]
GetCrossingAutomatic(void) | Crossing |
GetCrossingHasNearbyTrain(void) | Crossing |
GetCrossingState(void) | Crossing |
GetTriggerTrack(string triggerName) | SceneryWithTrack | [private]
InnerReEnter(int nodeId) | SceneryWithTrack | [private]
InnerReEnterTrain(Train train) | SceneryWithTrack | [inline, private]
IsTrainInTriggers(Train train, bool onlyCheckInnerRadius) | SceneryWithTrack | [private]
ReEnter(int nodeId) | SceneryWithTrack | [private]
SetCrossingAutomatic(bool automatic) | Crossing |
SetCrossingState(int crossingState) | Crossing |


CustomCommand Member List

This is the complete list of members for CustomCommand, including all inherited members.
Execute(Train train, int px, int py, int pz) CustomCommand [inline]


DefaultLocomotiveCabin Member List

This is the complete list of members for DefaultLocomotiveCabin, including all inherited members.
ampmeter_needle0 DefaultLocomotiveCabin
ampmeter_needle1 DefaultLocomotiveCabin
Attach(GameObject obj) | DefaultLocomotiveCabin | [inline]
brake_cylinder0_needle DefaultLocomotiveCabin
brake_cylinder1_needle DefaultLocomotiveCabin
brake_pipe_needle DefaultLocomotiveCabin
dynamic_brake_lever DefaultLocomotiveCabin
equaliser_needle DefaultLocomotiveCabin
FireAddCoal(void) | Cabin | [private]
flow_needle DefaultLocomotiveCabin
GetControls(void) | Cabin | [private]
GetNamedControl(string name) | Cabin | [private]
GetParentObject(void) | Cabin | [private]
GetPressureParam(string param) | DefaultLocomotiveCabin | [inline]
horn_rope DefaultLocomotiveCabin
Init(void) | DefaultLocomotiveCabin | [inline]
MeshObject.Init(Asset asset) | MeshObject | [private]
IsActive(void) | Cabin | [private]
light_switch DefaultLocomotiveCabin
loco DefaultLocomotiveCabin
loco_brake_lever DefaultLocomotiveCabin
main_reservoir_needle DefaultLocomotiveCabin
no3_pipe_needle DefaultLocomotiveCabin
pantograph_lever DefaultLocomotiveCabin
reverser_lever DefaultLocomotiveCabin
SetCabLightIntensity(float intensity) | Cabin | [private]
speedometer DefaultLocomotiveCabin
throttle_lever DefaultLocomotiveCabin
train_brake_lever DefaultLocomotiveCabin
train_lapbrake_lever DefaultLocomotiveCabin
Update(void) | DefaultLocomotiveCabin | [inline]
UserPressKey(string s) | DefaultLocomotiveCabin | [inline]
UserSetControl(CabinControl control, float value) | DefaultLocomotiveCabin | [inline]


DefaultSteamCabin Member List

This is the complete list of members for DefaultSteamCabin, including all inherited members.
AnimateFiremanShovelCoal(void) | DefaultSteamCabin |
AnimateFiremanWave(void) | DefaultSteamCabin |
Attach(GameObject obj) | DefaultSteamCabin | [inline]
blowdown_lever | DefaultSteamCabin |
blower_lever | DefaultSteamCabin |
boiler_needle | DefaultSteamCabin |
boiler_needle1 | DefaultSteamCabin |
brake_cylinder0_needle | DefaultSteamCabin |
brake_cylinder1_needle | DefaultSteamCabin |
brake_pipe_needle | DefaultSteamCabin |
CreateCabinSavedData(void) | DefaultSteamCabin |
equaliser_needle | DefaultSteamCabin |
fire_plates | DefaultSteamCabin |
FireAddCoal(void) | Cabin | [private]
firebox | DefaultSteamCabin |
FiremanShovelCoal(void) | DefaultSteamCabin |
FiremanWave(void) | DefaultSteamCabin |
flow_needle | DefaultSteamCabin |
GetControls(void) | Cabin | [private]
GetNamedControl(string name) | Cabin | [private]
GetParentObject(void) | Cabin | [private]
GetPressureParam(string param) | DefaultSteamCabin | [inline]
horn_rope | DefaultSteamCabin |
Init(void) | DefaultSteamCabin | [inline]
MeshObject.Init(Asset asset) | MeshObject | [private]
IsActive(void) | Cabin | [private]
left_sliding_window | DefaultSteamCabin |
left_window | DefaultSteamCabin |
light_switch | DefaultSteamCabin |
loco | DefaultSteamCabin |
loco_brake_lever | DefaultSteamCabin |
main_reservoir_needle | DefaultSteamCabin |
no3_pipe_needle | DefaultSteamCabin |
regulator_lever | DefaultSteamCabin |
reverser_lever | DefaultSteamCabin |
right_sliding_window | DefaultSteamCabin |
right_window | DefaultSteamCabin |
sanding_lever | DefaultSteamCabin |
seat0 | DefaultSteamCabin |
seat1 | DefaultSteamCabin |
SetCabLightIntensity(float intensity) | Cabin | [private]
speedometer | DefaultSteamCabin |
train_brake_lever | DefaultSteamCabin |
train_lapbrake_lever | DefaultSteamCabin |
Update(void) | DefaultSteamCabin | [inline]
UpdateCabinFromSavedData(CabinData cd) | DefaultSteamCabin |
UserPressKey(string s) | DefaultSteamCabin | [inline]
UserSetControl(CabinControl p_control, float p_value) | DefaultSteamCabin | [inline]
waterGlassLeft_dial | DefaultSteamCabin |
waterGlassRight_dial | DefaultSteamCabin |
waterInjector0 | DefaultSteamCabin |
waterInjector1 | DefaultSteamCabin |
whistle_lever | DefaultSteamCabin |


DefaultSteamCabinData Member List

This is the complete list of members for DefaultSteamCabinData, including all inherited members.
blowdown_lever_val | DefaultSteamCabinData
ctrlManager | DefaultSteamCabinData
fire_plates_val | DefaultSteamCabinData
fireboxDoorOpen | DefaultSteamCabinData
left_sliding_window_val | DefaultSteamCabinData
left_window_val | DefaultSteamCabinData
regulator_lever_val | DefaultSteamCabinData
right_sliding_window_val | DefaultSteamCabinData
right_window_val | DefaultSteamCabinData
sanding_lever_val | DefaultSteamCabinData
seat0_val | DefaultSteamCabinData
seat1_val | DefaultSteamCabinData
whistle_lever_val | DefaultSteamCabinData


DriverCharacter Member List

This is the complete list of members for DriverCharacter, including all inherited members.
AddDriverScheduleCommand(DriverScheduleCommand cmd) | DriverCharacter
DriverBeginIssueSchedule(void) | DriverCharacter | [inline]
DriverCompleteJunctions(void) | DriverCharacter | [inline]
DriverCoupleVehicle(Vehicle vehicle) | DriverCharacter | [inline]
DriverCustomCommand(CustomCommand cmd) | DriverCharacter | [inline]
DriverDriveForever(void) | DriverCharacter | [inline]
DriverIssueSchedule(void) | DriverCharacter
DriverSetAllowCoupling(bool allowCoupling, Train limitTrain) | DriverCharacter | [inline]
DriverTakeJunction(Junction junction, int direction) | DriverCharacter | [inline]
DriverThroughTrackMark(TrackMark trackMark) | DriverCharacter | [inline]
DriverTurnAround(void) | DriverCharacter | [inline]
DriverVisitScenery(string sceneryName) | DriverCharacter | [inline]
DriverVisitTrack(Track track) | DriverCharacter | [inline]
DriverVisitTrackMark(TrackMark trackMark) | DriverCharacter | [inline]
GetDriverCommandFilter(void) | DriverCharacter
GetDriverCommands(void) | DriverCharacter
GetLocalisedName(void) | DriverCharacter
GetLocation(void) | DriverCharacter
GetTrain(void) | DriverCharacter | [inline]
Init(Asset self) | DriverCharacter | [inline]
IsRunningCommand(void) | DriverCharacter | [inline]
IssueNextCommand(void) | DriverCharacter
NavigateThroughTrackside(Trackside trackside) | DriverCharacter
NavigateToIndustry(Industry industry, string attachedTrackName) | DriverCharacter
NavigateToTrackside(Trackside trackside) | DriverCharacter
NavigateToVehicle(Vehicle vehicle) | DriverCharacter
NavigateToVehicle(Vehicle vehicle, bool directionRelativeToVehicle) | DriverCharacter
NotifyUser(int msg) | DriverCharacter | [inline]
ReissueLastCommand(void) | DriverCharacter
SetDriverCommandFilter(KUID[] allowedCommands) | DriverCharacter
SetDriverCommands(DriverCommands driverCommands) | DriverCharacter
SetLocalisedName(string name) | DriverCharacter
SetLocation(GameObject location) | DriverCharacter
SetRunningCommands(bool enable) | DriverCharacter


DriverCommand Member List

This is the complete list of members for DriverCommand, including all inherited members.
AddCommandMenuItem(DriverCharacter driver, Menu menu) | DriverCommand |
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
ClearMessages(string major, string minor) | GameObject | [private]
CreateScheduleCommand(DriverCharacter driver, Soup soup) | DriverCommand |
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
GetAsset(void) | DriverCommand |
GetDriverCommands(Message commandMessage) | DriverCommand | [inline]
GetId() | GameObject | [private]
GetName() | GameObject | [private]
Init(Asset asset) | DriverCommand |
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]


DriverCommands Member List

This is the complete list of members for DriverCommands, including all inherited members.
AddDriverScheduleCommand(DriverScheduleCommand cmd) | DriverCommands |
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
AppendDependencies(KUIDList io_dependencies) | DriverCommands |
ClearDriverScheduleCommands(void) | DriverCommands |
ClearMessages(string major, string minor) | GameObject | [private]
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
GetDriverScheduleCommands(void) | DriverCommands |
GetDriverScheduleRepeat(void) | DriverCommands |
GetId() | GameObject | [private]
GetName() | GameObject | [private]
GetProperties(void) | DriverCommands |
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
ProceedToNextCommand(void) | DriverCommands |
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
SetDriverScheduleRepeat(bool repeat) | DriverCommands |
SetProperties(Soup soup) | DriverCommands |
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]


DriverScheduleCommand Member List

This is the complete list of members for DriverScheduleCommand, including all inherited members.
BeginExecute(DriverCharacter driver) | DriverScheduleCommand |
EndExecute(DriverCharacter driver) | DriverScheduleCommand |
FailExecute(DriverCharacter driver) | DriverScheduleCommand |
GetAsset(void) | DriverScheduleCommand | [inline]
GetDriverCharacter(void) | DriverScheduleCommand |
GetDriverCommand(void) | DriverScheduleCommand |
GetIcon(void) | DriverScheduleCommand |
GetProperties(void) | DriverScheduleCommand |
GetTooltip(void) | DriverScheduleCommand |
Init(DriverCharacter driver, DriverCommand parent) | DriverScheduleCommand |
SetDriverCharacter(DriverCharacter driver) | DriverScheduleCommand |
SetProperties(Soup soup) | DriverScheduleCommand |
UpdateExecute(DriverCharacter driver) | DriverScheduleCommand |


DriversInfo Member List

This is the complete list of members for DriversInfo, including all inherited members.
DoesMatch(Train train) | DriversInfo | [inline]
DoesMatchAnd(Train train) | DriversInfo | [inline]
DoesMatchAndExlcude(Train train) | DriversInfo | [inline]
GetDescriptionHTML(void) | SpecificVehiclesInfo | [inline, private]
GetProperties(void) | SpecificVehiclesInfo | [inline, private]
GetPropertyDescription(string propertyID) | SpecificVehiclesInfo | [inline, private]
GetPropertyElementList(string propertyID) | DriversInfo | [inline]
GetPropertyName(string propertyID) | SpecificVehiclesInfo | [inline, private]
GetPropertyType(string propertyID) | SpecificVehiclesInfo | [inline, private]
SetProperties(Soup soup) | SpecificVehiclesInfo | [inline, private]
SetPropertyValue(string propertyID, PropertyValue value) | SpecificVehiclesInfo | [inline, private]


EnumeratedAssetHandler Member List

This is the complete list of members for EnumeratedAssetHandler, including all inherited members.
GetConfigPrefix(void) | ConfigAssetHandler | [inline, private]
GetDescriptionHTML(void) | EnumeratedAssetHandler | [inline]
GetHostAsset(void) | ConfigAssetHandler | [inline, private]
GetProperties() | EnumeratedAssetHandler | [inline]
GetPropertyDescription(string propertyID) | EnumeratedAssetHandler | [inline]
GetPropertyElementList(string propertyID) | EnumeratedAssetHandler | [inline]
GetPropertyName(string propertyID) | EnumeratedAssetHandler | [inline]
GetPropertyType(string propertyID) | EnumeratedAssetHandler | [inline]
GetPropertyValue(string propertyID) | EnumeratedAssetHandler | [inline]
GetStringTable(void) | ConfigAssetHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | EnumeratedAssetHandler |
Init(Asset asset, string newConfigPrefix) | EnumeratedAssetHandler | [inline]
SetProperties(Soup soup) | EnumeratedAssetHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | EnumeratedAssetHandler | [inline]


EnumeratedGameObjectHandler Member List

This is the complete list of members for EnumeratedGameObjectHandler, including all inherited members.
GetConfigPrefix(void) | ConfigAssetHandler | [inline, private]
GetDescriptionHTML(void) | EnumeratedGameObjectHandler | [inline]
GetHostAsset(void) | ConfigAssetHandler | [inline, private]
GetProperties() | EnumeratedGameObjectHandler | [inline]
GetPropertyDescription(string propertyID) | EnumeratedGameObjectHandler | [inline]
GetPropertyElementList(string propertyID) | EnumeratedGameObjectHandler | [inline]
GetPropertyName(string propertyID) | EnumeratedGameObjectHandler | [inline]
GetPropertyType(string propertyID) | EnumeratedGameObjectHandler | [inline]
GetStringTable(void) | ConfigAssetHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | EnumeratedGameObjectHandler | [inline]
SetProperties(Soup soup) | EnumeratedGameObjectHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | EnumeratedGameObjectHandler | [inline]


EnumeratedMultiPropertyHandler Member List

This is the complete list of members for EnumeratedMultiPropertyHandler, including all inherited members.
GetDescriptionHTML(void) | EnumeratedMultiPropertyHandler | [inline]
GetProperties() | EnumeratedMultiPropertyHandler | [inline]
GetPropertyDescription(string propertyID) | EnumeratedMultiPropertyHandler | [inline]
GetPropertyElementList(string propertyID) | EnumeratedMultiPropertyHandler | [inline]
GetPropertyName(string propertyID) | EnumeratedMultiPropertyHandler | [inline]
GetPropertyType(string propertyID) | EnumeratedMultiPropertyHandler | [inline]
Init(Asset asset, string newConfigPrefix) | EnumeratedMultiPropertyHandler |
Init(Asset asset, string newConfigPrefix) | EnumeratedMultiPropertyHandler | [inline]
SetProperties(Soup soup) | EnumeratedMultiPropertyHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | EnumeratedMultiPropertyHandler | [inline]


EnumeratedPropertyHandler Member List

This is the complete list of members for EnumeratedPropertyHandler, including all inherited members.
GetConfigPrefix(void) | ConfigAssetHandler | [inline, private]
GetDescriptionHTML(void) | EnumeratedPropertyHandler | [inline]
GetHostAsset(void) | ConfigAssetHandler | [inline, private]
GetProperties() | EnumeratedPropertyHandler | [inline]
GetPropertyDescription(string propertyID) | EnumeratedPropertyHandler | [inline]
GetPropertyElementList(string propertyID) | EnumeratedPropertyHandler | [inline]
GetPropertyName(string propertyID) | EnumeratedPropertyHandler | [inline]
GetPropertyType(string propertyID) | EnumeratedPropertyHandler | [inline]
GetStringTable(void) | ConfigAssetHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | EnumeratedPropertyHandler |
Init(Asset asset, string newConfigPrefix) | EnumeratedPropertyHandler | [inline]
SetProperties(Soup soup) | EnumeratedPropertyHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | EnumeratedPropertyHandler | [inline]


Trainz Railroad Simulator 2006 User Activity Creation Guide Compound Index

A
DefaultSteamCabin IndustryProductInfoComplete MeshObject SignalBehaviour
AiHornMsg DefaultSteamCabinData IndustryProductInfoProcess Message Soup
AITrainScope DriverCharacter IndustryProductInfoQueues ModuleScript SpecificVehiclesInfo
Asset DriverCommand IndustryProductInfoTracks
N
StationBehaviour
AssetCheckListHandler DriverCommands IndustryTrainController Navigate Str
B
DriverScheduleCommand Interface NumberValueInt StringTable
BaseIndustry DriversInfo InterfaceAlert
O
T
BaseIndustryInfo
E
InterfaceObjective OnlineAccess Timetable
BasePortal EnumeratedAssetHandler IPICProcess OnlineGroup TimetableState
Bogey EnumeratedGameObjectHandler IPICQueue
P
Track
Browser EnumeratedMultiPropertyHandler IPICTrack PassengerStationInfo TrackLoadInfo
BrowserInterface EnumeratedPropertyHandler ITCTrainCommand Permit TrackMark
Buildable
F
J
ProductFilter Trackside
C
Flags Junction ProductQueue Train
Cabin
G
JunctionBase PropertyBrowser TrainHelperInfo
CabinControl GameObject JunctionBaseGameObject PropertyObject TrainTimetable
CabinControlSetting GenericBoolHandler JunctionPermitInfo PropertyValue TrainTimetableItem
CabinData GenericIndustry
K
R
TrainUtil
CheckBoxHandler GenericIntNumberHandler KUID RadioButtonGroupHandler Trainz
CheckListGroupHandler GenericListHandler KUIDList RadioButtonListHandler TrainzGameObject
CheckListPropertyHandler GenericPassengerStation
L
Requirement Trigger
Command GenericStringHandler Library ResourceRequirement Turntable
ConditionalScenarioBehavior GSObject LinkedData Router
V
ConfigAssetGroupHandler GSTrackSearch LinkedList
S
Vehicle
ConfigAssetHandler
H
LoadHelperInfo Scenario VehicleDescriptor
ConsistHelperInfo HTMLPropertyGroup LoadingReport ScenarioBehavior VehicleHelperInfo
ConsistListHelper HTMLPropertyHandler Locomotive ScenarioStringTable VehicleTypesInfo
Constructors HTMLWindow Log ScenarioSupport VHIDriversInfo
ControlSettingsManager
I
LogScope SceneryWithTrack VHISpecificVehiclesInfo
Crossing Industry
M
Schedule VHIVehicleTypesInfo
CustomCommand IndustryProcessInfo MapObject ScheduleHistoryRec
W
D
IndustryProductInfo Math ShuntTrack World


Flags Member List

This is the complete list of members for Flags, including all inherited members.
Test(int flags, int mask) | Flags
Test(int flags, int mask, int options) | Flags
TestAny(int flags, int mask) | Flags


GameObject Member List

This is the complete list of members for GameObject, including all inherited members.
AddHandler(GameObject target, string major, string minor, string handler) | GameObject
ClearMessages(string major, string minor) | GameObject
Exception(string reason) | GameObject
extension | GameObject
GetId() | GameObject
GetName() | GameObject
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject
SendMessage(GameObject dst, string major, string minor) | GameObject
Sleep(float seconds) | GameObject
Sniff(GameObject target, string major, string minor, bool state) | GameObject


GenericBoolHandler Member List

This is the complete list of members for GenericBoolHandler, including all inherited members.
GetBoolDisplayValue(void) | GenericBoolHandler |
GetBoolValue(void) | GenericBoolHandler | [inline]
GetConfigPrefix(void) | ConfigAssetHandler | [inline, private]
GetDescriptionHTML(void) | GenericBoolHandler | [inline]
GetHostAsset(void) | ConfigAssetHandler | [inline, private]
GetProperties() | GenericBoolHandler | [inline]
GetPropertyAttribute(string propertyID, string attribute) | GenericBoolHandler | [inline]
GetPropertyType(string propertyID) | GenericBoolHandler | [inline]
GetStringTable(void) | ConfigAssetHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | GenericBoolHandler | [inline]
SetBoolValue(bool newBoolValue) | GenericBoolHandler | [inline]
SetProperties(Soup soup) | GenericBoolHandler | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | GenericBoolHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | GenericBoolHandler | [inline]


GenericIndustry Member List

This is the complete list of members for GenericIndustry, including all inherited members.
AddAssetToIndustryProductInfo(string assetName, string queueName, string processName, bool isInput, bool showInViewDetails) | GenericIndustry | [inline]
AddAssetToIndustryProductInfo(string assetName, string queueName, string processName, bool isInput) | GenericIndustry | [inline]
AppendDriverDestinations(string[] destNames, string[] destTracks) | Industry | [inline, private]
AppendProductList(Asset[] productList) | GenericIndustry | [inline]
BeginLoad(LoadingReport report) | GenericIndustry | [inline]
BeginUnload(LoadingReport report) | GenericIndustry | [inline]
ClearProcess(string processName) | Industry | [private]
CreateLoadingReport(ProductQueue srcIndustryQueue, int amountLoad) | Industry | [inline, private]
CreateUnloadingReport(ProductQueue dstIndustryQueue, int amountToUnload) | Industry | [inline, private]
EndLoad(LoadingReport report) | GenericIndustry | [inline]
EndUnload(LoadingReport report) | GenericIndustry | [inline]
GenericIndustryMain(void) | GenericIndustry | [inline]
GetDescriptionHTML(void) | GenericIndustry | [inline]
GetLoadTime(LoadingReport report) | GenericIndustry | [inline]
GetProcessDuration(string processName) | Industry | [private]
GetProcessEnabled(string processName) | Industry | [private]
GetProcessInput(string processName, ProductQueue queue, Asset product) | Industry | [private]
GetProcessIOAmount(string processName, bool wantInput, int ioIndex) | Industry | [private]
GetProcessIOProduct(string processName, bool wantInput, int ioIndex) | Industry | [private]
GetProcessIOQueue(string processName, bool wantInput, int ioIndex) | Industry | [private]
GetProcessNameList(void) | Industry | [private]
GetProcessOutput(string processName, ProductQueue queue, Asset product) | Industry | [private]
GetProcessStarted(string processName) | Industry | [private]
GetPropertyDescription(string propertyID) | GenericIndustry | [inline]
GetPropertyName(string propertyID) | GenericIndustry | [inline]
GetPropertyType(string propertyID) | GenericIndustry | [inline]
GetRequirements(void) | Industry | [inline, private]
GetUnloadTime(LoadingReport report) | GenericIndustry | [inline]
HandleTrain(Train train, string loadCommand) | GenericIndustry | [inline]
HandleTrainLoadCommand(Train train) | GenericIndustry | [inline]
HandleTrainUnloadCommand(Train train) | GenericIndustry | [inline]
HasTrack(string track) | Industry | [private]
industryProductList | GenericIndustry |
info | GenericIndustry |
Init(void) | GenericIndustry | [inline]
itc | GenericIndustry |
LOAD_COMMAND | Industry | [private]
NotifyProcessFinished(string processName) | Industry | [inline, private]
NotifyProcessStarted(string processName) | Industry | [inline, private]
PerformInnerEnterMoving(Vehicle vehicle, string triggerName) | GenericIndustry | [inline]
PerformInnerEnterStop(Vehicle vehicle) | GenericIndustry | [inline]
PerformMovingLoad(Vehicle vehicle, string triggerName) | GenericIndustry | [inline]
PerformProcessCancelled(string processName) | Industry | [private]
PerformProcessFinished(string processName) | Industry | [private]
PerformProcessInput(string processName) | Industry | [private]
PerformProcessOutput(string processName) | Industry | [private]
PerformProcessStarted(string processName) | Industry | [private]
PerformStopped(Vehicle vehicle, string triggerName) | GenericIndustry | [inline]
PerformStoppedLoad(Vehicle vehicle, string triggerName) | GenericIndustry | [inline]
PerformStoppedNoTrigger(Vehicle vehicle) | GenericIndustry | [inline]
pipeName | GenericIndustry |
SetProcessDuration(string processName, float processDuration) | Industry | [private]
SetProcessEnabled(string processName, bool enabled) | Industry | [private]
SetProcessInput(string processName, ProductQueue queue, Asset product, int amount) | Industry | [private]
SetProcessOutput(string processName, ProductQueue queue, Asset product, int amount) | Industry | [private]
SetPropertyValue(string propertyID, int value) | GenericIndustry | [inline]
SetQueueInitialCount(ProductQueue queue, Asset asset, int newValue) | GenericIndustry | [inline]
ThreadEndPipeAnimation(Vehicle vehicle) | GenericIndustry | [inline]
TriggerSupportsMovingLoad(Vehicle vehicle, string triggerName) | GenericIndustry | [inline]
TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName) | GenericIndustry | [inline]
UNLOAD_COMMAND | Industry | [private]
usePipeAnimation | GenericIndustry |
ViewDetails(void) | GenericIndustry | [inline]


GenericIntNumberHandler Member List

This is the complete list of members for GenericIntNumberHandler, including all inherited members.
GetConfigPrefix(void) | ConfigAssetHandler | [inline, private]
GetDescriptionHTML(void) | GenericIntNumberHandler | [inline]
GetHostAsset(void) | ConfigAssetHandler | [inline, private]
GetProperties(void) | GenericIntNumberHandler | [inline]
GetPropertyDescription(string propertyID) | GenericIntNumberHandler | [inline]
GetPropertyName(string propertyID) | GenericIntNumberHandler | [inline]
GetPropertyType(string propertyID) | GenericIntNumberHandler | [inline]
GetPropertyValue(string propertyID) | GenericIntNumberHandler | [inline]
GetStringTable(void) | ConfigAssetHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | GenericIntNumberHandler | [inline]
SetProperties(Soup soup) | GenericIntNumberHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | GenericIntNumberHandler | [inline]


GenericListHandler Member List

This is the complete list of members for GenericListHandler, including all inherited members.
GetConfigPrefix() | ConfigAssetGroupHandler | [inline, private]
GetDescriptionHTML(void) | GenericListHandler | [inline]
GetHostAsset() | ConfigAssetGroupHandler | [inline, private]
GetProperties() | GenericListHandler | [inline]
GetPropertyAttribute(string propertyID, string attribute) | ConfigAssetGroupHandler | [inline, private]
GetPropertyDescription(string propertyID) | GenericListHandler | [inline]
GetPropertyElementList(string propertyID) | GenericListHandler |
GetPropertyElementList(string propertyID) | GenericListHandler | [inline]
GetPropertyName(string propertyID) | GenericListHandler | [inline]
GetPropertyType(string propertyID) | GenericListHandler | [inline]
GetStringTable(void) | ConfigAssetGroupHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | GenericListHandler |
Init(Asset asset, string newConfigPrefix) | GenericListHandler | [inline]
SetProperties(Soup soup) | GenericListHandler | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | ConfigAssetGroupHandler | [inline, private]
SetPropertyValue(string propertyID, PropertyValue value) | GenericListHandler | [inline]


GenericPassengerStation Member List

This is the complete list of members for GenericPassengerStation, including all inherited members.
ACTION_LOADING | GenericPassengerStation |
ACTION_NOTHING | GenericPassengerStation |
ACTION_UNLOADING | GenericPassengerStation |
AddAssetToIndustryProductInfo(Asset asset, string queueName, string processName, bool isInput, bool showInViewDetails, bool showInSurveyorProperties) | BaseIndustry | [inline, private]
AddAssetToIndustryProductInfo(string assetName, string queueName, string processName, bool isInput, bool showInViewDetails, bool showInSurveyorProperties) | BaseIndustry | [inline, private]
AddAssetToIndustryProductInfo(Asset asset, string queueName, string processName, bool isInput, bool showInViewDetails) | BaseIndustry | [inline, private]
AddAssetToIndustryProductInfo(string assetName, string queueName, string processName, bool isInput, bool showInViewDetails) | BaseIndustry | [inline, private]
AddAssetToIndustryProductInfo(string assetName, string queueName, string processName, bool isInput) | BaseIndustry | [inline, private]
AddAssetToIndustryProductInfo(Asset asset, string queueName, string processName, bool isInput) | BaseIndustry | [inline, private]
AppendProductList(Asset[] productList) | BaseIndustry | [inline, private]
BaseIndustryMain(void) | BaseIndustry | [inline, private]
BeginLoad(LoadingReport report) | BaseIndustry | [inline, private]
BeginUnload(LoadingReport report) | BaseIndustry | [inline, private]
EnablePassengerSpawn(bool enable) | GenericPassengerStation | [inline]
EndLoad(LoadingReport report) | BaseIndustry | [inline, private]
EndUnload(LoadingReport report) | BaseIndustry | [inline, private]
GetLoadTime(LoadingReport report) | BaseIndustry | [inline, private]
GetProductNameList(ProductQueue queue) | BaseIndustry | [private]
GetProperties(void) | BaseIndustry | [inline, private]
GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo) | GenericPassengerStation | [inline]
GetUnloadTime(LoadingReport report) | BaseIndustry | [inline, private]
HandleTrain(Train train, string loadCommand) | BaseIndustry | [inline, private]
HandleTrainLoadCommand(Train train) | BaseIndustry | [inline, private]
HandleTrainUnloadCommand(Train train) | BaseIndustry | [inline, private]
industryProductInfoCollection | BaseIndustry | [private]
info | BaseIndustry | [private]
Init(void) | BaseIndustry | [inline, private]
InitPassengerStation(int platformCount) | GenericPassengerStation | [inline]
itc | BaseIndustry | [private]
m_platformCount | GenericPassengerStation |
m_trainLoadingSpeed | BaseIndustry | [private]
NotifyProcessFinished(string processName) | BaseIndustry | [inline, private]
PerformInnerEnterMoving(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
PerformInnerEnterStop(Vehicle vehicle) | BaseIndustry | [inline, private]
PerformMassStopped(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
PerformMassStoppedLoad(Vehicle vehicle, string triggerName) | GenericPassengerStation | [inline]
PerformMovingLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
PerformProductLoadAndUnload(ProductQueue queue, Train train, int action, TrackLoadInfo info) | GenericPassengerStation | [inline]
PerformStopped(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
PerformStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
PerformStoppedNoTrigger(Vehicle vehicle) | BaseIndustry | [inline, private]
pipeName | BaseIndustry | [private]
psi | GenericPassengerStation |
SetProperties(Soup soup) | GenericPassengerStation | [inline]
SetQueueInitialCount(ProductQueue queue, Asset asset, int newValue) | BaseIndustry | [inline, private]
StationMain(void) | GenericPassengerStation | [inline]
ThreadEndPipeAnimation(Vehicle vehicle) | BaseIndustry | [inline, private]
ThreadPerformMassStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
ThreadPerformMovingLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
ThreadPerformStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
TriggerSupportsMassMovingLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
TriggerSupportsMovingLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName) | BaseIndustry | [inline, private]
UpdateStationParameters(void) | GenericPassengerStation |
usePipeAnimation | BaseIndustry | [private]
ViewDetails(void) | BaseIndustry | [inline, private]


GenericStringHandler Member List

This is the complete list of members for GenericStringHandler, including all inherited members.
GetConfigPrefix(void) | ConfigAssetHandler | [inline, private]
GetDescriptionHTML(void) | GenericStringHandler | [inline]
GetHostAsset(void) | ConfigAssetHandler | [inline, private]
GetProperties(void) | GenericStringHandler | [inline]
GetPropertyDescription(string propertyID) | GenericStringHandler | [inline]
GetPropertyName(string propertyID) | GenericStringHandler | [inline]
GetPropertyType(string propertyID) | GenericStringHandler | [inline]
GetPropertyValue(string propertyID) | GenericStringHandler | [inline]
GetStringCount(void) | GenericStringHandler | [inline]
GetStringDisplayValue(int valueIndex) | GenericStringHandler |
GetStringTable(void) | ConfigAssetHandler | [inline, private]
GetStringValue(int valueIndex) | GenericStringHandler |
Init(Asset asset, string newConfigPrefix) | GenericStringHandler | [inline]
Init(Asset asset, string newConfigPrefix, int newStringCount) | GenericStringHandler |
SetProperties(Soup soup) | GenericStringHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | GenericStringHandler | [inline]


GSTrackSearch Member List

This is the complete list of members for GSTrackSearch, including all inherited members.
GetDistance(void) | GSTrackSearch
GetFacingRelativeToSearchDirection(void) | GSTrackSearch
GetMapObject(void) | GSTrackSearch
SearchNext(void) | GSTrackSearch


HTMLPropertyGroup Member List

This is the complete list of members for HTMLPropertyGroup, including all inherited members.
AddHandler(HTMLPropertyHandler handler, string subPrefix) | HTMLPropertyGroup |
FindHandler(string propertyID) | HTMLPropertyGroup |
GetDescriptionHTML(void) | HTMLPropertyGroup |
GetDescriptionHTML(void) | HTMLPropertyGroup | [inline]
GetPrefix(void) | HTMLPropertyHandler | [private]
GetProperties(void) | HTMLPropertyGroup |
GetProperties(void) | HTMLPropertyGroup | [inline]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyGroup |
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyGroup | [inline]
GetPropertyDescription(string propertyID) | HTMLPropertyGroup |
GetPropertyDescription(string propertyID) | HTMLPropertyGroup | [inline]
GetPropertyElementList(string propertyID) | HTMLPropertyGroup |
GetPropertyElementList(string propertyID) | HTMLPropertyGroup | [inline]
GetPropertyName(string propertyID) | HTMLPropertyGroup |
GetPropertyName(string propertyID) | HTMLPropertyGroup | [inline]
GetPropertyType(string propertyID) | HTMLPropertyGroup |
GetPropertyType(string propertyID) | HTMLPropertyGroup | [inline]
GetPropertyValue(string propertyID) | HTMLPropertyGroup |
GetPropertyValue(string propertyID) | HTMLPropertyGroup | [inline]
GetSavesProperties(void) | HTMLPropertyHandler | [private]
HREF(string propertyName) | HTMLPropertyHandler | [private]
Link(string propertyName) | HTMLPropertyHandler | [private]
LogHandlers(void) | HTMLPropertyGroup |
Prop(string propertyName) | HTMLPropertyHandler | [private]
PropMatchesPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
PropStripPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
RefreshBrowser(Browser browser) | HTMLPropertyGroup |
RefreshBrowser(Browser browser) | HTMLPropertyGroup | [inline]
RemoveHandler(HTMLPropertyHandler handler) | HTMLPropertyGroup |
SetPrefix(string prefix) | HTMLPropertyGroup |
SetPrefix(string prefix) | HTMLPropertyGroup | [inline]
SetProperties(Soup soup) | HTMLPropertyGroup |
SetProperties(Soup soup) | HTMLPropertyGroup | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyGroup |
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyGroup | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | HTMLPropertyGroup |
SetPropertyValue(string propertyID, PropertyValue value) | HTMLPropertyGroup | [inline]
SetSavesProperties(bool saveProperties) | HTMLPropertyHandler | [private]


HTMLPropertyHandler Member List

This is the complete list of members for HTMLPropertyHandler, including all inherited members.
GetDescriptionHTML(void) | HTMLPropertyHandler
GetPrefix(void) | HTMLPropertyHandler
GetProperties(void) | HTMLPropertyHandler
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyHandler
GetPropertyDescription(string propertyID) | HTMLPropertyHandler
GetPropertyElementList(string propertyID) | HTMLPropertyHandler
GetPropertyName(string propertyID) | HTMLPropertyHandler
GetPropertyType(string propertyID) | HTMLPropertyHandler
GetPropertyValue(string propertyID) | HTMLPropertyHandler
GetSavesProperties(void) | HTMLPropertyHandler
HREF(string propertyName) | HTMLPropertyHandler
Link(string propertyName) | HTMLPropertyHandler
Prop(string propertyName) | HTMLPropertyHandler
PropMatchesPrefix(string propertyName, string prefix) | HTMLPropertyHandler
PropStripPrefix(string propertyName, string prefix) | HTMLPropertyHandler
RefreshBrowser(Browser browser) | HTMLPropertyHandler
SetPrefix(string prefix) | HTMLPropertyHandler
SetProperties(Soup soup) | HTMLPropertyHandler
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyHandler
SetPropertyValue(string propertyID, PropertyValue value) | HTMLPropertyHandler
SetSavesProperties(bool saveProperties) | HTMLPropertyHandler


HTMLWindow Member List

This is the complete list of members for HTMLWindow, including all inherited members.


Industry Member List

This is the complete list of members for Industry, including all inherited members.
AppendDriverDestinations(string[] destNames, string[] destTracks) | Industry | [inline]
AppendProductList(Asset[] productList) | Industry | [inline]
BeginLoad(LoadingReport report) | Industry
BeginUnload(LoadingReport report) | Industry
CancelBuild(void) | Buildable | [private]
ClearProcess(string processName) | Industry
CreateLoadingReport(ProductQueue srcIndustryQueue, int amountLoad) | Industry | [inline]
CreateUnloadingReport(ProductQueue dstIndustryQueue, int amountToUnload) | Industry | [inline]
EnableUserCancelBuild(bool enable) | Buildable | [private]
EnableUserStartBuild(bool enable) | Buildable | [private]
EndLoad(LoadingReport report) | Industry
EndUnload(LoadingReport report) | Industry
GetBuildingProgress(void) | Buildable | [private]
GetBuildingState(void) | Buildable | [private]
GetLoadTime(LoadingReport report) | Industry
GetProcessDuration(string processName) | Industry
GetProcessEnabled(string processName) | Industry
GetProcessInput(string processName, ProductQueue queue, Asset product) | Industry
GetProcessIOAmount(string processName, bool wantInput, int ioIndex) | Industry
GetProcessIOProduct(string processName, bool wantInput, int ioIndex) | Industry
GetProcessIOQueue(string processName, bool wantInput, int ioIndex) | Industry
GetProcessNameList(void) | Industry
GetProcessOutput(string processName, ProductQueue queue, Asset product) | Industry
GetProcessStarted(string processName) | Industry
GetRequirements(void) | Industry | [inline]
GetUnloadTime(LoadingReport report) | Industry
HandleTrain(Train train, string loadCommand) | Industry
HasTrack(string track) | Industry
LOAD_COMMAND Industry
NotifyProcessFinished(string processName) | Industry | [inline]
NotifyProcessStarted(string processName) | Industry | [inline]
PerformProcessCancelled(string processName) | Industry
PerformProcessFinished(string processName) | Industry
PerformProcessInput(string processName) | Industry
PerformProcessOutput(string processName) | Industry
PerformProcessStarted(string processName) | Industry
SetBuildingPaused(bool paused) | Buildable | [private]
SetBuildingProgress(float progress) | Buildable | [private]
SetBuildingState(int state) | Buildable | [private]
SetProcessDuration(string processName, float processDuration) | Industry
SetProcessEnabled(string processName, bool enabled) | Industry
SetProcessInput(string processName, ProductQueue queue, Asset product, int amount) | Industry
SetProcessOutput(string processName, ProductQueue queue, Asset product, int amount) | Industry
StartBuild(void) | Buildable | [private]
STATE_BUILDING | Buildable | [private]
STATE_COMPLETE | Buildable | [private]
STATE_POTENTIAL | Buildable | [private]


IndustryProcessInfo Member List

This is the complete list of members for IndustryProcessInfo, including all inherited members.
assets_consume IndustryProcessInfo
assets_produce IndustryProcessInfo
Init(void) IndustryProcessInfo [inline]


IndustryProductInfo Member List

This is the complete list of members for IndustryProductInfo, including all inherited members.
asset | IndustryProductInfo |
Init(void) | IndustryProductInfo | [inline]
isInput | IndustryProductInfo |
processName | IndustryProductInfo |
queue | IndustryProductInfo |
showInViewDetails | IndustryProductInfo |


IndustryProductInfoCollection Member List

This is the complete list of members for IndustryProductInfoCollection, including all inherited members.
m_industry | IndustryProductInfoCollection
m_processes | IndustryProductInfoCollection
m_queues | IndustryProductInfoCollection
m_tracks | IndustryProductInfoCollection


IndustryProductInfoComplete Member List

This is the complete list of members for IndustryProductInfoComplete, including all inherited members.
processes | IndustryProductInfoComplete
queues | IndustryProductInfoComplete
tracks | IndustryProductInfoComplete


IndustryProductInfoProcess Member List

This is the complete list of members for IndustryProductInfoProcess, including all inherited members.


IndustryProductInfoQueues Member List

This is the complete list of members for IndustryProductInfoQueues, including all inherited members.


IndustryProductInfoTracks Member List

This is the complete list of members for IndustryProductInfoTracks, including all inherited members.


IndustryTrainController Member List

This is the complete list of members for IndustryTrainController, including all inherited members.
AddTrain(Train train) | IndustryTrainController | [inline]
AddVehicle(Vehicle v, bool allowDuplication) | IndustryTrainController |
AddVehicleLock(Vehicle v) | IndustryTrainController | [inline]
ClearTrainCommand(Train train) | IndustryTrainController | [inline]
CountVehicles() | IndustryTrainController |
CountVehiclesNotAdded(Train train) | IndustryTrainController | [inline]
GetTrainCommand(Train train) | IndustryTrainController | [inline]
IsAlreadyAdded(Vehicle vehicle) | IndustryTrainController | [inline]
IsControllingTrain(Train train) | IndustryTrainController |
IsControllingVehicle(Vehicle vehicle) | IndustryTrainController | [inline]
IsLockedVehicle(Vehicle vehicle) | IndustryTrainController | [inline]
IsTrainCommand(Train train, string command) | IndustryTrainController | [inline]
IsTrainLocked(Train train) | IndustryTrainController | [inline]
m_trainCommands | IndustryTrainController |
RemoveAllUnlockedVehicles(Train train) | IndustryTrainController | [inline]
RemoveVehicle(Vehicle v) | IndustryTrainController |
RemoveVehicleLock(Vehicle v) | IndustryTrainController | [inline]
ReSendStoppedMessages(Industry industry) | IndustryTrainController |
SetTrainCommand(Train train, string command) | IndustryTrainController | [inline]
SetTrainSpeed(Train train, float speed) | IndustryTrainController | [inline]
SetVehicleSpeed(Vehicle v, float speed) | IndustryTrainController | [inline]
ShouldIgnoreVehicle(Vehicle vehicle) | IndustryTrainController | [inline]


Interface Member List

This is the complete list of members for Interface, including all inherited members.
AdjustScore(int delta) | Interface
ButtonBar_Element_Close | Interface
ButtonBar_Element_Find | Interface
ButtonBar_Element_Help | Interface
ButtonBar_Element_MetricImp | Interface
ButtonBar_Element_Pause | Interface
ButtonBar_Element_Performance | Interface
ButtonBar_Element_Save | Interface
Colour_Black | Interface
Colour_Blue | Interface
Colour_Cyan | Interface
Colour_Green | Interface
Colour_Red | Interface
Colour_White | Interface
Colour_Yellow | Interface
Exception(string message) | Interface
GetDecoupleMode(void) | Interface
GetDisplayHeight(void) | Interface
GetDisplayWidth(void) | Interface
GetElementProperty(string elementID, string propertyID) | Interface
GetInterfaceVisible(void) | Interface
GetMapView(void) | Interface
GetMessageWindowVisible(void) | Interface
GetMetricMode(void) | Interface
GetObjectiveBarVisible(void) | Interface
GetScore() | Interface
GetTimeStamp(void) | Interface
GetWaybillWindowVisible(void) | Interface
HasUnseenMessages(void) | Interface
HighlightButtonBarElement(int buttonIndex, bool state) | Interface
Log(string msg) | Interface
LogCallStack(string msg) | Interface
LogResult(string msg) | Interface
Print(string msg) | Interface
ResetResults() | Interface
SetAlert(string msg, string iconTexture, float duration, int colour) | Interface
SetDecoupleMode(bool enabled) | Interface
SetElementProperty(string elementID, string propertyID, string value) | Interface
SetHelperIconScale(float scale) | Interface
SetMapView(bool visible) | Interface
SetMessageWindowVisible(bool visible) | Interface
SetMetricMode(bool useMetric) | Interface
SetObjective(string msg, string iconTexture) | Interface
SetObjectiveBarVisible(bool visible) | Interface
SetObjectiveIcon(string iconTexture) | Interface
SetResults(string msg) | Interface
SetScore(string msg) | Interface
SetTooltip(Browser tooltip) | Interface
SetWaybillWindowVisible(bool visible) | Interface
ShowDriverButtonMenu(bool state) | Interface
ShowObjective(bool state) | Interface
ShowOnScreenHelp(bool show) | Interface
WarnObsolete(string warning) | Interface


InterfaceAlert Member List

This is the complete list of members for InterfaceAlert, including all inherited members.
alert | InterfaceAlert |
Alert(string alertEx) | InterfaceAlert | [inline]
colour | InterfaceAlert |
icon | InterfaceAlert |
log | InterfaceAlert |
score | InterfaceAlert |
time | InterfaceAlert |
wav | InterfaceAlert |


InterfaceObjective Member List

This is the complete list of members for InterfaceObjective, including all inherited members.
icon InterfaceObjective
log InterfaceObjective
objective InterfaceObjective
Objective(string objectiveEx) InterfaceObjective [inline]


IPICProcess Member List

This is the complete list of members for IPICProcess, including all inherited members.


IPICQueue Member List

This is the complete list of members for IPICQueue, including all inherited members.


IPICTrack Member List

This is the complete list of members for IPICTrack, including all inherited members.


ITCTrainCommand Member List

This is the complete list of members for ITCTrainCommand, including all inherited members.
command | ITCTrainCommand
train | ITCTrainCommand


Junction Member List

This is the complete list of members for Junction, including all inherited members.
AllowManualControl(bool allow) | JunctionBase | [private]
BeginTrackSearch(bool direction) | Trackside | [private]
DIRECTION_BACKWARD | JunctionBase | [private]
DIRECTION_FORWARD | JunctionBase | [private]
DIRECTION_LEFT | JunctionBase | [private]
DIRECTION_NONE | JunctionBase | [private]
DIRECTION_RIGHT | JunctionBase | [private]
GetDebugString(void) | JunctionBase | [inline, private]
GetDirection(void) | JunctionBase | [private]
GetDirectionToTrain(Train train) | JunctionBase | [private]
GetGameObject(void) | JunctionBase | [private]
GetManualControl() | JunctionBase | [private]
GetMapObject(void) | JunctionBase | [private]
GetSignalState(void) | Trackside | [private]
GetSignalStateEx(void) | Trackside | [private]
GetSpeedLimit(void) | Trackside | [private]
GetTrack(void) | Trackside | [private]
InnerReEnter(int nodeId) | Trackside | [private]
JunctionInnerReEnter(int nodeId) | JunctionBase | [private]
JunctionReEnter(int nodeId) | JunctionBase | [private]
ReEnter(int nodeId) | Trackside | [private]
RequestPermit(GameObject obj) | JunctionBase | [private]
Trackside.RequestTrackPermit(bool dir, GameObject owner) | Trackside | [private]
Trackside.RequestTrackPermit(bool dir) | Trackside | [inline, private]
JunctionBase.RequestTrackPermit(GameObject obj, int direction) | JunctionBase | [private]
SetDirection(int direction) | JunctionBase | [private]
SetSpeedLimit(float limit) | Trackside | [private]
SwitchForTrain(Train train, int dstDirection) | JunctionBase | [private]


JunctionBase Member List

This is the complete list of members for JunctionBase, including all inherited members.
AllowManualControl(bool allow) | JunctionBase |
DIRECTION_BACKWARD | JunctionBase |
DIRECTION_FORWARD | JunctionBase |
DIRECTION_LEFT | JunctionBase |
DIRECTION_NONE | JunctionBase |
DIRECTION_RIGHT | JunctionBase |
GetDebugString(void) | JunctionBase | [inline]
GetDirection(void) | JunctionBase |
GetDirectionToTrain(Train train) | JunctionBase |
GetGameObject(void) | JunctionBase |
GetManualControl() | JunctionBase |
GetMapObject(void) | JunctionBase |
JunctionInnerReEnter(int nodeId) | JunctionBase |
JunctionReEnter(int nodeId) | JunctionBase |
RequestPermit(GameObject obj) | JunctionBase |
RequestTrackPermit(GameObject obj, int direction) | JunctionBase |
SetDirection(int direction) | JunctionBase |
SwitchForTrain(Train train, int dstDirection) | JunctionBase |


JunctionBaseGameObject Member List

This is the complete list of members for JunctionBaseGameObject, including all inherited members.
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
AllowManualControl(bool allow) | JunctionBase | [private]
ClearMessages(string major, string minor) | GameObject | [private]
DIRECTION_BACKWARD | JunctionBase | [private]
DIRECTION_FORWARD | JunctionBase | [private]
DIRECTION_LEFT | JunctionBase | [private]
DIRECTION_NONE | JunctionBase | [private]
DIRECTION_RIGHT | JunctionBase | [private]
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
GetDebugString(void) | JunctionBase | [inline, private]
GetDirection(void) | JunctionBase | [private]
GetDirectionToTrain(Train train) | JunctionBase | [private]
GetGameObject(void) | JunctionBase | [private]
GetId() | GameObject | [private]
GetManualControl() | JunctionBase | [private]
GetMapObject(void) | JunctionBase | [private]
GetName() | GameObject | [private]
JunctionInnerReEnter(int nodeId) | JunctionBase | [private]
JunctionReEnter(int nodeId) | JunctionBase | [private]
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
RequestPermit(GameObject obj) | JunctionBase | [private]
RequestTrackPermit(GameObject obj, int direction) | JunctionBase | [private]
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
SetDirection(int direction) | JunctionBase | [private]
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]
SwitchForTrain(Train train, int dstDirection) | JunctionBase | [private]


JunctionPermitInfo Member List

This is the complete list of members for JunctionPermitInfo, including all inherited members.


KUID Member List

This is the complete list of members for KUID, including all inherited members.
GetHTMLString(void) | KUID
GetLogString(void) | KUID
GetName(void) | KUID


KUIDList Member List

This is the complete list of members for KUIDList, including all inherited members.
AddKUID(KUID kuid) | KUIDList
Clear(void) | KUIDList
Copy(KUIDList from) | KUIDList
CountKUIDs(void) | KUIDList
GetIndexedKUID(int index) | KUIDList
HasKUID(KUID kuid) | KUIDList
IsLocked(void) | KUIDList
RemoveKUID(KUID kuid) | KUIDList


Library Member List

This is the complete list of members for Library, including all inherited members.
GetAsset(void) | TrainzGameObject | [private]
GetOnlineAccess(void) | Library |
GetProperties(void) | Library |
Init(Asset asset) | TrainzGameObject | [private]
LibraryCall(string function, string[] stringParam, GSObject[] objectParam) | Library |
SetProperties(Soup soup) | Library |


LinkedData Member List

This is the complete list of members for LinkedData, including all inherited members.
gsobject | LinkedData
index | LinkedData
text | LinkedData


LinkedList Member List

This is the complete list of members for LinkedList, including all inherited members.


LoadHelperInfo Member List

This is the complete list of members for LoadHelperInfo, including all inherited members.
amount | LoadHelperInfo |
GetDescriptionHTML(void) | LoadHelperInfo | [inline]
GetPrefix(void) | HTMLPropertyHandler | [private]
GetProperties() | LoadHelperInfo | [inline]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyHandler | [private]
GetPropertyDescription(string propertyID) | LoadHelperInfo | [inline]
GetPropertyElementList(string propertyID) | LoadHelperInfo | [inline]
GetPropertyName(string propertyID) | LoadHelperInfo | [inline]
GetPropertyType(string propertyID) | LoadHelperInfo | [inline]
GetPropertyValue(string propertyID) | HTMLPropertyHandler | [private]
GetSavesProperties(void) | HTMLPropertyHandler | [private]
HREF(string propertyName) | HTMLPropertyHandler | [private]
Link(string propertyName) | HTMLPropertyHandler | [private]
productKUID | LoadHelperInfo |
Prop(string propertyName) | HTMLPropertyHandler | [private]
PropMatchesPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
PropStripPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
queueName | LoadHelperInfo |
RefreshBrowser(Browser browser) | HTMLPropertyHandler | [private]
SetPrefix(string prefix) | HTMLPropertyHandler | [private]
SetProperties(Soup soup) | LoadHelperInfo | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyHandler | [private]
SetPropertyValue(string propertyID, PropertyValue value) | LoadHelperInfo | [inline]
SetSavesProperties(bool saveProperties) | HTMLPropertyHandler | [private]


LoadingReport Member List

This is the complete list of members for LoadingReport, including all inherited members.
amount | LoadingReport
BOTTOM_SIDE | LoadingReport
Clear(void) | LoadingReport
desiredAmount | LoadingReport
dst | LoadingReport
dstQueue | LoadingReport
GetDstIndustry(void) | LoadingReport
GetDstVehicle(void) | LoadingReport
GetSrcIndustry(void) | LoadingReport
GetSrcVehicle(void) | LoadingReport
LEFT_SIDE | LoadingReport
RIGHT_SIDE | LoadingReport
sideFlags | LoadingReport
src | LoadingReport
srcQueue | LoadingReport
TOP_SIDE | LoadingReport


Locomotive Member List

This is the complete list of members for Locomotive, including all inherited members.
BeginLoad(LoadingReport report) | Vehicle | [inline, private]
BeginUnload(LoadingReport report) | Vehicle | [inline, private]
CanLoadProductFromQueue(ProductQueue queue) | Vehicle | [inline, private]
CanUnloadProductToQueue(ProductQueue queue) | Vehicle | [inline, private]
Couple(Vehicle other) | Vehicle | [private]
COUPLE_BACK | Vehicle | [private]
COUPLE_BOTH | Vehicle | [private]
COUPLE_FRONT | Vehicle | [private]
COUPLE_NONE | Vehicle | [private]
DIRECTION_BACKWARD | Vehicle | [private]
DIRECTION_FORWARD | Vehicle | [private]
DIRECTION_NONE | Vehicle | [private]
EndLoad(LoadingReport report) | Vehicle | [inline, private]
EndUnload(LoadingReport report) | Vehicle | [inline, private]
ENGINE_NONE | Vehicle | [private]
ENGINE_STANDARD | Vehicle | [private]
ENGINE_STEAM | Vehicle | [private]
GetAuxReservoirPressure(void) | Vehicle | [private]
GetBogeyList(void) | Vehicle | [private]
GetBrakeCylinderPressure(void) | Vehicle | [private]
GetBrakePipePressure(void) | Vehicle | [private]
GetCabinData(void) | Locomotive |
GetCabinSwayAmount(void) | Vehicle | [private]
GetCouplerBreakageEnabled(void) | Vehicle | [private]
GetCouplingDirection(Vehicle other) | Vehicle | [private]
GetCouplingStress(Vehicle toVehicle) | Vehicle | [private]
GetDefaultCabinSwayAmount(void) | Vehicle | [private]
GetDefaultMaximumCouplerCompressionStress(void) | Vehicle | [private]
GetDefaultMaximumCouplerExpansionStress(void) | Vehicle | [private]
GetDefaultMaximumCoupleVelocity(void) | Vehicle | [private]
GetDefaultMaximumTractiveEffort(void) | Vehicle | [private]
GetDescriptionHTML(void) | Vehicle | [inline, private]
GetDirectionRelativeToTrain(void) | Vehicle | [private]
GetEngineParam(string p_paramName) | Vehicle | [private]
GetEngineSetting(string p_settingName) | Locomotive |
GetEngineType(void) | Vehicle | [private]
GetFacingRelativeToTrain(void) | Vehicle | [inline, private]
GetLength(void) | Vehicle | [private]
GetLoadTime(LoadingReport report) | Vehicle | [inline, private]
GetMass(void) | Vehicle | [private]
GetMaximumCouplerCompressionStress(void) | Vehicle | [private]
GetMaximumCouplerExpansionStress(void) | Vehicle | [private]
GetMaximumCoupleVelocity(void) | Vehicle | [private]
GetMaximumTractiveEffort(void) | Vehicle | [private]
GetMyTrain(void) | Vehicle | [private]
GetProductRestriction(void) | Vehicle | [inline, private]
GetProperties(void) | Vehicle | [inline, private]
GetPropertyDescription(string p_propertyID) | Vehicle | [inline, private]
GetPropertyElementList(string propertyID) | Vehicle | [inline, private]
GetPropertyName(string propertyID) | Vehicle | [inline, private]
GetPropertyType(string propertyID) | Vehicle | [inline, private]
GetPropertyValue(string p_propertyID) | Vehicle | [inline, private]
GetRelationToTrack(Buildable obj, string trackName) | Vehicle | [private]
GetRunningNumber() | Vehicle | [private]
GetSandingTractionMultiplier(void) | Vehicle | [private]
GetTrackGradient(void) | Vehicle | [private]
GetUnloadTime(LoadingReport report) | Vehicle | [inline, private]
GetVehicleTypeFlags(void) | Vehicle | [private]
GetVelocity(void) | Vehicle | [private]
GetWheelslipTractionMultiplier(void) | Vehicle | [private]
Init(void) | Vehicle | [inline, private]
IsInTunnel(void) | Vehicle | [private]
IsOnBridge(void) | Vehicle | [private]
LinkPropertyValue(string propertyID) | Vehicle | [inline, private]
LoadProduct(LoadingReport report) | Vehicle | [private]
Reposition(TrackMark mark, bool direction) | Vehicle | [private]
Reposition(Vehicle other, int myCoupleDirection, int otherCoupleDirection) | Vehicle | [private]
Reposition(Train train, int myCoupleDirection, int otherCoupleDirection) | Vehicle | [private]
Reverse() | Vehicle | [private]
SetBrakePipeEfficiency(float efficiency) | Vehicle | [private]
SetBrokenBrakes(bool broken) | Vehicle | [private]
SetBrokenReverser(bool broken) | Locomotive |
SetBrokenThrottle(bool broken) | Locomotive |
SetCabinData(CabinData data) | Locomotive |
SetCabinSwayAmount(float amount) | Vehicle | [private]
SetCompressorEfficiency(float efficiency) | Locomotive |
SetCouplerBreakageEnabled(bool enabled) | Vehicle | [private]
SetCouplingMask(int couplingMask) | Vehicle | [private]
SetDecouplingMask(int couplingMask) | Vehicle | [private]
SetEngineSetting(string p_settingName, float p_value) | Locomotive |
SetHandBrake(bool applied) | Vehicle | [private]
SetHasDriver(bool hasDriver) | Locomotive |
SetHeadlightColor(float red, float green, float blue) | Vehicle | [private]
SetMaximumCouplerCompressionStress(float maxCouplerCompressionStress) | Vehicle | [private]
SetMaximumCouplerExpansionStress(float maxCouplerExpansionStress) | Vehicle | [private]
SetMaximumCoupleVelocity(float maxCoupleVelocity) | Vehicle | [private]
SetMaximumTractiveEffort(float maxTE) | Vehicle | [private]
SetPitchBasedOnSpeed(float multiplier) | Vehicle | [private]
SetPitchBasedOnTrack(bool pitchBasedOnTrack) | Vehicle | [private]
SetProductDisabled(void) | Vehicle | [inline, private]
SetProductRestriction(Asset product) | Vehicle | [inline, private]
SetProperties(Soup soup) | Vehicle | [inline, private]
SetPropertyValue(string p_propertyID, string p_value) | Vehicle | [inline, private]
SetPropertyValue(string propertyID, int value) | Vehicle | [inline, private]
SetPropertyValue(string propertyID, string value, int index) | Vehicle | [inline, private]
SetQueueInitialCount(ProductQueue queue, Asset asset, int newValue) | Vehicle | [inline, private]
SetRollBasedOnTrack(float multiplier) | Vehicle | [private]
SetRunningNumber(string rn) | Vehicle | [private]
SetSandingTractionMultiplier(float multiplier) | Vehicle | [private]
SetWheelslipTractionMultiplier(float multiplier) | Vehicle | [private]
TYPE_HAS_INTERIOR | Vehicle | [private]
TYPE_LOCOMOTIVE | Vehicle | [private]
TYPE_TENDER | Vehicle | [private]
Uncouple(Vehicle other) | Vehicle | [private]
Uncouple(int direction) | Vehicle | [private]
UnloadProduct(LoadingReport report) | Vehicle | [private]
UpdateViewDetails(Message msg) | Vehicle | [inline, private]
vehicleProductInfoCollection | Vehicle | [private]
ViewDetails(Message msg) | Vehicle | [inline, private]
ViewSchedule(Message msg) | Vehicle | [inline, private]


Log Member List

This is the complete list of members for Log, including all inherited members.


LogScope Member List

This is the complete list of members for LogScope, including all inherited members.
className | LogScope
functionName | LogScope
level | LogScope


MapObject Member List

This is the complete list of members for MapObject, including all inherited members.
GetFXAttachment(string effectName) | MeshObject | [private]
GetLocalisedName(void) | MapObject |
GetMeshAnimationFrame(string p_meshName) | MeshObject | [private]
GetMeshAnimationFrameCount(string p_meshName) | MeshObject | [private]
GetQueue(string queueName) | MapObject |
GetQueues(void) | MapObject |
HasMesh(string p_meshName) | MeshObject | [private]
Init(void) | MeshObject | [inline, private]
Init(Asset asset) | MeshObject | [private]
Init(Asset asset) | MeshObject | [inline, private]
PlaySoundScriptEvent(string soundName) | MapObject |
SetFXAnimationState(string effectName, bool state) | MeshObject | [private]
SetFXAttachment(string effectName, Asset asset) | MeshObject | [private]
SetFXCoronaTexture(string effectName, Asset textureAsset) | MeshObject | [private]
SetFXNameText(string effectName, string text) | MeshObject | [private]
SetFXTextureReplacement(string effectName, Asset textureGroupAsset, int textureIndex) | MeshObject | [private]
SetMesh(string meshName, float fadeDuration) | MeshObject | [private]
SetMeshAnimationFrame(string p_meshName, float p_frame) | MeshObject | [private]
SetMeshAnimationFrame(string p_meshName, float p_frame, float interpTime) | MeshObject | [private]
SetMeshAnimationSpeed(string p_meshName, float p_speed) | MeshObject | [private]
SetMeshAnimationState(string p_meshName, bool p_state) | MeshObject | [private]
SetMeshVisible(string meshName, bool visible, float fadeDuration) | MeshObject | [private]
StartMeshAnimationLoop(string p_meshName) | MeshObject | [private]
StopMeshAnimation(string p_meshName) | MeshObject | [private]
StopSoundScriptEvent(string soundName) | MapObject |


Math Member List

This is the complete list of members for Math, including all inherited members.
Abs(int p_v) | Math | [inline]
Fabs(float p_v) | Math | [inline]
Fmax(float a0, float a1) | Math | [inline]
Fmin(float a0, float a1) | Math | [inline]
Rand(float p_lower, float p_upper) | Math |
Rand(int p_lower, int p_upper) | Math |
Sqrt(float p_v) | Math |


Menu Member List

This is the complete list of members for Menu, including all inherited members.
AddItem(string name, GameObject dstObject, string major, string minor) | Menu |
AddSubmenu(string name, Menu submenu) | Menu |
CountItems(void) | Menu |
SubdivideItems(bool forceSorting) | Menu |
SubdivideItems(void) | Menu | [inline]


MeshObject Member List

This is the complete list of members for MeshObject, including all inherited members.
GetAsset(void) | TrainzGameObject | [private]
GetDescriptionHTML(void) | PropertyObject | [private]
GetFXAttachment(string effectName) | MeshObject |
GetMeshAnimationFrame(string p_meshName) | MeshObject |
GetMeshAnimationFrameCount(string p_meshName) | MeshObject |
GetProperties(void) | PropertyObject | [private]
GetPropertyDescription(string propertyID) | PropertyObject | [private]
GetPropertyElementList(string propertyID) | PropertyObject | [private]
GetPropertyHandler(void) | PropertyObject | [private]
GetPropertyName(string propertyID) | PropertyObject | [private]
GetPropertyType(string propertyID) | PropertyObject | [private]
GetPropertyValue(string propertyID) | PropertyObject | [private]
HasMesh(string p_meshName) | MeshObject |
Init(void) | MeshObject | [inline]
Init(Asset asset) | MeshObject |
Init(Asset asset) | MeshObject | [inline]
LinkPropertyValue(string propertyID) | PropertyObject | [private]
PropertyBrowserRefresh(Browser browser) | PropertyObject | [private]
SetFXAnimationState(string effectName, bool state) | MeshObject |
SetFXAttachment(string effectName, Asset asset) | MeshObject |
SetFXCoronaTexture(string effectName, Asset textureAsset) | MeshObject |
SetFXNameText(string effectName, string text) | MeshObject |
SetFXTextureReplacement(string effectName, Asset textureGroupAsset, int textureIndex) | MeshObject |
SetMesh(string meshName, float fadeDuration) | MeshObject |
SetMeshAnimationFrame(string p_meshName, float p_frame) | MeshObject |
SetMeshAnimationFrame(string p_meshName, float p_frame, float interpTime) | MeshObject |
SetMeshAnimationSpeed(string p_meshName, float p_speed) | MeshObject |
SetMeshAnimationState(string p_meshName, bool p_state) | MeshObject |
SetMeshVisible(string meshName, bool visible, float fadeDuration) | MeshObject |
SetProperties(Soup soup) | PropertyObject | [private]
SetPropertyHandler(HTMLPropertyHandler handler) | PropertyObject | [private]
SetPropertySelectedElementList(string propertyID, string[] elements) | PropertyObject | [private]
SetPropertyValue(string propertyID, string value, int index) | PropertyObject | [private]
SetPropertyValue(string propertyID, string value) | PropertyObject | [private]
SetPropertyValue(string propertyID, float value) | PropertyObject | [private]
SetPropertyValue(string propertyID, int value) | PropertyObject | [private]
StartMeshAnimationLoop(string p_meshName) | MeshObject |
StopMeshAnimation(string p_meshName) | MeshObject |


Message Member List

This is the complete list of members for Message, including all inherited members.
dst | Message
major | Message
minor | Message
src | Message


ModuleScript Member List

This is the complete list of members for ModuleScript, including all inherited members.
GetAsset(void) | TrainzGameObject | [private]
Init(Asset asset) | TrainzGameObject | [private]


Navigate Member List

This is the complete list of members for Navigate, including all inherited members.
defaultSignalBehaviour Navigate
defaultStationBehaviour Navigate
JUNCTION_ENTER Navigate
JUNCTION_INNERENTER Navigate
JUNCTION_INNERLEAVE Navigate
JUNCTION_LEAVE Navigate
JUNCTION_STOPPED Navigate
LockJunction(string junction, int direction, bool manualControl) | Navigate | [inline]
OnJunction(GameObject runningThread, Train train, string junctionName, int stage) | Navigate | [inline]
OnTrigger(GameObject runningThread, Train train, string triggerName, int stage) | Navigate | [inline]
SetSignal(string signal, int state, string reason) | Navigate | [inline]
Signal(GameObject runningThread, Train train, string signalName, string reason, string announce, float delay, string onAnnouncement, SignalBehaviour behaviour) | Navigate | [inline]
Station(GameObject runningThread, Train train, string stationName, string warningTrigger, string stationTrigger, string overrunTrigger, string backwardsTrigger, StationBehaviour behaviour, float waitMin, float waitMax) | Navigate | [inline]


NumberValueInt Member List

This is the complete list of members for NumberValueInt, including all inherited members.


OnlineAccess Member List

This is the complete list of members for OnlineAccess, including all inherited members.
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
ClearMessages(string major, string minor) | GameObject | [private]
CollectMessage(string o_sourceUsername, Soup o_data) | OnlineAccess |
CollectOfflineMessage(Soup o_data) | OnlineAccess |
Connect(void) | OnlineAccess |
CreateGroup(void) | OnlineAccess |
Disconnect(void) | OnlineAccess |
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
GetId() | GameObject | [private]
GetLocalData(string key, Soup data) | OnlineAccess |
GetName() | GameObject | [private]
GetStatus(void) | OnlineAccess |
GetUsername(void) | OnlineAccess |
MODE_AUTH_FAILED | OnlineAccess |
MODE_CONNECTING | OnlineAccess |
MODE_DENIED_LOCAL | OnlineAccess |
MODE_DISABLED | OnlineAccess |
MODE_FAILED | OnlineAccess |
MODE_INTERRUPTED | OnlineAccess |
MODE_OFFLINE | OnlineAccess |
MODE_ONLINE | OnlineAccess |
OpenGroup(string onlineGroupCookie) | OnlineAccess |
PostMessage(string destUsername, Soup data) | OnlineAccess |
GameObject.PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
PostOfflineMessage(Soup data) | OnlineAccess |
RESULT_CONNECTION_FAILED | OnlineAccess |
RESULT_DENIED_LOCAL | OnlineAccess |
RESULT_DENIED_REMOTE | OnlineAccess |
RESULT_FLOOD | OnlineAccess |
RESULT_NO_DATA | OnlineAccess |
RESULT_OK | OnlineAccess |
RESULT_OVERFLOW | OnlineAccess |
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
SetLocalData(string key, Soup data) | OnlineAccess |
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]


OnlineGroup Member List

This is the complete list of members for OnlineGroup, including all inherited members.
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
AddUser(string profilename) | OnlineGroup |
ClearMessages(string major, string minor) | GameObject | [private]
Connect(void) | OnlineGroup |
CountUsers(void) | OnlineGroup |
Disconnect(void) | OnlineGroup |
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
FindUser(string profilename) | OnlineGroup |
GetId() | GameObject | [private]
GetIndexedUser(int index) | OnlineGroup |
GetName() | GameObject | [private]
GetOnlineGroupCookie(void) | OnlineGroup |
GetStatus(void) | OnlineGroup |
GetUserStatus(int index) | OnlineGroup |
GetUserStatus(string profilename) | OnlineGroup | [inline]
HasUser(string profilename) | OnlineGroup | [inline]
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
RemoveUser(string profilename) | OnlineGroup |
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]
STATUS_CLOSED | OnlineGroup |
STATUS_CONNECTING | OnlineGroup |
STATUS_OFFLINE | OnlineGroup |
STATUS_OPEN | OnlineGroup |
USER_STATUS_INSIDE | OnlineGroup |
USER_STATUS_INVALID | OnlineGroup |
USER_STATUS_OFFLINE | OnlineGroup |
USER_STATUS_ONLINE | OnlineGroup |
USER_STATUS_UNKNOWN | OnlineGroup |


PassengerStationInfo Member List

This is the complete list of members for PassengerStationInfo, including all inherited members.
GetDescriptionHTML(void) | PassengerStationInfo |
GetDescriptionHTML(void) | PassengerStationInfo | [inline]
GetPrefix(void) | HTMLPropertyHandler | [private]
GetProperties(void) | PassengerStationInfo |
GetProperties(void) | PassengerStationInfo | [inline]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyHandler | [private]
GetPropertyDescription(string propertyID) | PassengerStationInfo |
GetPropertyDescription(string propertyID) | PassengerStationInfo | [inline]
GetPropertyElementList(string propertyID) | PassengerStationInfo |
GetPropertyElementList(string propertyID) | PassengerStationInfo | [inline]
GetPropertyName(string propertyID) | PassengerStationInfo |
GetPropertyName(string propertyID) | PassengerStationInfo | [inline]
GetPropertyType(string propertyID) | PassengerStationInfo |
GetPropertyType(string propertyID) | PassengerStationInfo | [inline]
GetPropertyValue(string propertyID) | PassengerStationInfo |
GetPropertyValue(string propertyID) | PassengerStationInfo | [inline]
GetSavesProperties(void) | HTMLPropertyHandler | [private]
HREF(string propertyName) | HTMLPropertyHandler | [private]
Link(string propertyName) | HTMLPropertyHandler | [private]
Prop(string propertyName) | HTMLPropertyHandler | [private]
PropMatchesPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
PropStripPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
RefreshBrowser(Browser browser) | HTMLPropertyHandler | [private]
SetPrefix(string prefix) | HTMLPropertyHandler | [private]
SetProperties(Soup soup) | PassengerStationInfo |
SetProperties(Soup soup) | PassengerStationInfo | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyHandler | [private]
SetPropertyValue(string propertyID, PropertyValue value) | PassengerStationInfo |
SetPropertyValue(string propertyID, PropertyValue value) | PassengerStationInfo | [inline]
SetSavesProperties(bool saveProperties) | HTMLPropertyHandler | [private]


Permit Member List

This is the complete list of members for Permit, including all inherited members.
GetDebugString(void) | Permit | [inline]
GetObject(void) | Permit | [inline]
GetObjectBase(void) | Permit |
GetState(void) | Permit |
HasSamePermissionsAs(Permit other) | Permit |
IsForSameObjectAs(Permit other) | Permit |
IsGranted(void) | Permit | [inline]
IsReleased(void) | Permit | [inline]
Release(void) | Permit |
SetOwnerObject(GameObject obj) | Permit |
STATE_GRANTED | Permit |
STATE_RELEASED | Permit |
STATE_REQUESTING | Permit |
WasGranted(void) | Permit | [inline]


ProductFilter Member List

This is the complete list of members for ProductFilter, including all inherited members.
AddProduct(Asset product) | ProductFilter
AddProductCategory(Asset productCategory) | ProductFilter
AddSoup(Soup soup) | ProductFilter
AppendFilter(ProductFilter filter) | ProductFilter
Clear(void) | ProductFilter
CopyFilter(ProductFilter filter) | ProductFilter
DoesAcceptProduct(Asset product) | ProductFilter
DoesAcceptProductCategory(Asset productCategory) | ProductFilter
GetAsSoup(void) | ProductFilter
GetProductCategories(void) | ProductFilter
GetProducts(void) | ProductFilter
IntersectFilter(ProductFilter filter) | ProductFilter
IsEmpty(void) | ProductFilter
IsLocked(void) | ProductFilter
RemoveProduct(Asset product) | ProductFilter
RemoveProductCategory(Asset productCategory) | ProductFilter


ProductQueue Member List

This is the complete list of members for ProductQueue, including all inherited members.
CountProductMatching(ProductFilter filter) | ProductQueue
CreateProduct(Asset product, int maximumToAdd) | ProductQueue
DestroyAllProducts(void) | ProductQueue
DestroyProductMatching(ProductFilter filter, int maximumToDestroy) | ProductQueue
GetProductCategory(void) | ProductQueue
GetProductFilter(void) | ProductQueue
GetProductList(void) | ProductQueue
GetQueueCount(void) | ProductQueue
GetQueueName(void) | ProductQueue
GetQueueSize(void) | ProductQueue
GetQueueSpace(void) | ProductQueue
SetProductFilter(ProductFilter filter) | ProductQueue
SetQueueSize(int queueSize) | ProductQueue
TransferProductFrom(ProductQueue fromQueue, ProductFilter matchingFilter, int maximumToTransfer, bool performTransfer) | ProductQueue


PropertyBrowser Member List

This is the complete list of members for PropertyBrowser, including all inherited members.


PropertyObject Member List

This is the complete list of members for PropertyObject, including all inherited members.
GetDescriptionHTML(void) | PropertyObject
GetProperties(void) | PropertyObject
GetPropertyDescription(string propertyID) | PropertyObject
GetPropertyElementList(string propertyID) | PropertyObject
GetPropertyHandler(void) | PropertyObject
GetPropertyName(string propertyID) | PropertyObject
GetPropertyType(string propertyID) | PropertyObject
GetPropertyValue(string propertyID) | PropertyObject
LinkPropertyValue(string propertyID) | PropertyObject
PropertyBrowserRefresh(Browser browser) | PropertyObject
SetProperties(Soup soup) | PropertyObject
SetPropertyHandler(HTMLPropertyHandler handler) | PropertyObject
SetPropertySelectedElementList(string propertyID, string[] elements) | PropertyObject
SetPropertyValue(string propertyID, string value, int index) | PropertyObject
SetPropertyValue(string propertyID, string value) | PropertyObject
SetPropertyValue(string propertyID, float value) | PropertyObject
SetPropertyValue(string propertyID, int value) | PropertyObject


PropertyValue Member List

This is the complete list of members for PropertyValue, including all inherited members.
AsBool(void) | PropertyValue
AsFloat(void) | PropertyValue
AsInt(void) | PropertyValue
AsString(void) | PropertyValue
BOOL_TYPE PropertyValue
FLOAT_TYPE PropertyValue
GetIndex(void) | PropertyValue
GetType(void) | PropertyValue
INDEX_TYPE PropertyValue
INT_TYPE PropertyValue
NULL_TYPE PropertyValue
Set(void) | PropertyValue
Set(int val) | PropertyValue
Set(float val) | PropertyValue
Set(string val) | PropertyValue
Set(string val, int index) | PropertyValue
Set(bool val) | PropertyValue


RadioButtonGroupHandler Member List

This is the complete list of members for RadioButtonGroupHandler, including all inherited members.
AddHandler(HTMLPropertyHandler handler, string subPrefix) | CheckListGroupHandler | [inline, private]
GetDescriptionHTML(void) | CheckListGroupHandler | [inline, private]
GetProperties() | RadioButtonGroupHandler | [inline]
GetPropertyType(string propertyID) | CheckListGroupHandler | [inline, private]
Init(Asset asset, string newConfigPrefix) | RadioButtonGroupHandler |
Init(Asset asset, string newConfigPrefix) | RadioButtonGroupHandler | [inline]
SetProperties(Soup soup) | RadioButtonGroupHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | RadioButtonGroupHandler | [inline]


RadioButtonListHandler Member List

This is the complete list of members for RadioButtonListHandler, including all inherited members.
AddItem(string itemName, bool setting) | RadioButtonListHandler |
AddItem(string itemName, bool setting) | RadioButtonListHandler | [inline]
CountItems() | CheckListPropertyHandler | [private]
GetDescriptionHTML(void) | RadioButtonListHandler | [inline]
GetProperties() | RadioButtonListHandler | [inline]
GetPropertyType(string propertyID) | CheckListPropertyHandler | [inline, private]
GetSetting(int index) | CheckListPropertyHandler | [private]
GetSettingDisplayName(int index) | CheckListPropertyHandler | [private]
GetSettingName(int index) | CheckListPropertyHandler | [private]
GetSettingNames(void) | CheckListPropertyHandler | [inline, private]
GetSettingNames(bool checked) | CheckListPropertyHandler | [private]
GetSettings(void) | CheckListPropertyHandler | [inline, private]
GetSettingsAsFlags(void) | CheckListPropertyHandler | [private]
Init(Asset asset, string newConfigPrefix) | RadioButtonListHandler |
Init(Asset asset, string newConfigPrefix) | RadioButtonListHandler | [inline]
ItemExists(int index) | CheckListPropertyHandler | [inline, private]
ItemExists(string itemName) | CheckListPropertyHandler | [private]
ItemExistsChecked(string itemName, bool checkState) | CheckListPropertyHandler | [private]
m_currentSelection | RadioButtonListHandler |
ResetButtons(void) | RadioButtonListHandler |
SetAll(bool checked) | CheckListPropertyHandler | [private]
SetItem(int itemIndex, bool itemChecked) | CheckListPropertyHandler | [private]
SetProperties(Soup soup) | RadioButtonListHandler | [inline]
SetPropertyValue(string propertyID, PropertyValue value) | RadioButtonListHandler | [inline]


Requirement Member List

This is the complete list of members for Requirement, including all inherited members.
cause Requirement


ResourceRequirement Member List

This is the complete list of members for ResourceRequirement, including all inherited members.
amount ResourceRequirement
cause | Requirement | [private]
dst ResourceRequirement
dstQueue ResourceRequirement
GetAmount(void) | ResourceRequirement
GetDst(void) | ResourceRequirement
GetDstQueue(void) | ResourceRequirement
GetResource(void) | ResourceRequirement


Router Member List

This is the complete list of members for Router, including all inherited members.
GetGameObject(int uniqueId) | Router
GetGameObject(string uniqueName) | Router
Info() | Router
MESSAGE_BROADCAST | Router
PostMessage(int srcNodeId, int dstNodeId, string major, string minor, float delay) | Router


Scenario Member List

This is the complete list of members for Scenario, including all inherited members.
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
ClearMessages(string major, string minor) | GameObject | [private]
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
GetId() | GameObject | [private]
GetName() | GameObject | [private]
Load(string data) | Scenario | [inline]
main(void) | Scenario | [inline]
Monitor() | Scenario | [inline]
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
Save() | Scenario | [inline]
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]
TrainBadCouple(int vehicleId) | Scenario | [inline]
TrainCollided(int trainId) | Scenario | [inline]
TrainDerailed(int trainId) | Scenario | [inline]
TrainOverAdvisorySpeed(int trainId) | Scenario | [inline]
TrainOverSpeed(int trainId) | Scenario | [inline]
TrainSpeedingFine() | Scenario | [inline]


ScenarioBehavior Member List

This is the complete list of members for ScenarioBehavior, including all inherited members.
AppendDependencies(KUIDList io_dependencies) | ScenarioBehavior |
COMPLETE | ScenarioBehavior |
DOES_COMPLETE | ScenarioBehavior |
GetAsset(void) | TrainzGameObject | [private]
GetChildBehaviors(void) | ScenarioBehavior |
GetDescription(void) | ScenarioBehavior |
GetDescriptionHTML(void) | PropertyObject | [private]
GetParentBehavior(void) | ScenarioBehavior |
GetProperties(void) | ScenarioBehavior |
GetProperties(void) | ScenarioBehavior | [inline]
GetPropertyDescription(string propertyID) | PropertyObject | [private]
GetPropertyElementList(string propertyID) | PropertyObject | [private]
GetPropertyHandler(void) | PropertyObject | [private]
GetPropertyName(string propertyID) | PropertyObject | [private]
GetPropertyType(string propertyID) | PropertyObject | [private]
GetPropertyValue(string propertyID) | PropertyObject | [private]
GetRequirements(void) | ScenarioBehavior | [inline]
GetStateFlags(void) | ScenarioBehavior | [inline]
Init(Asset asset) | TrainzGameObject | [private]
IsComplete(void) | ScenarioBehavior |
IsPaused(void) | ScenarioBehavior | [inline]
LinkPropertyValue(string propertyID) | PropertyObject | [private]
NONE | ScenarioBehavior |
Pause(bool pause) | ScenarioBehavior | [inline]
PAUSED | ScenarioBehavior |
PropertyBrowserRefresh(Browser browser) | PropertyObject | [private]
Reset(void) | ScenarioBehavior |
SetComplete(bool isComplete) | ScenarioBehavior |
SetProperties(Soup soup) | ScenarioBehavior |
SetProperties(Soup soup) | ScenarioBehavior | [inline]
SetPropertyHandler(HTMLPropertyHandler handler) | PropertyObject | [private]
SetPropertySelectedElementList(string propertyID, string[] elements) | PropertyObject | [private]
SetPropertyValue(string propertyID, string value, int index) | PropertyObject | [private]
SetPropertyValue(string propertyID, string value) | PropertyObject | [private]
SetPropertyValue(string propertyID, float value) | PropertyObject | [private]
SetPropertyValue(string propertyID, int value) | PropertyObject | [private]
SetStateFlags(int flags, bool set) | ScenarioBehavior |
WAS_COMPLETE | ScenarioBehavior |
WasComplete(void) | ScenarioBehavior |


ScenarioStringTable Member List

This is the complete list of members for ScenarioStringTable, including all inherited members.
Get() ScenarioStringTable


ScenarioSupport Member List

This is the complete list of members for ScenarioSupport, including all inherited members.
dccMode | ScenarioSupport
DoInstructions(void) | ScenarioSupport
ManageBrowser(void) | ScenarioSupport
SelectCabinDCC(Train train) | ScenarioSupport


SceneryWithTrack Member List

This is the complete list of members for SceneryWithTrack, including all inherited members.
FindTriggerContainingNode(int nodeId, bool onlyInnerTrigger) | SceneryWithTrack |
GetAttachedJunctions(void) | SceneryWithTrack |
GetAttachedTrack(string trackName) | SceneryWithTrack |
GetLocalisedName(void) | MapObject | [private]
GetQueue(string queueName) | MapObject | [private]
GetQueues(void) | MapObject | [private]
GetTriggerTrack(string triggerName) | SceneryWithTrack |
InnerReEnter(int nodeId) | SceneryWithTrack |
InnerReEnterTrain(Train train) | SceneryWithTrack | [inline]
IsTrainInTriggers(Train train, bool onlyCheckInnerRadius) | SceneryWithTrack |
PlaySoundScriptEvent(string soundName) | MapObject | [private]
ReEnter(int nodeId) | SceneryWithTrack |
StopSoundScriptEvent(string soundName) | MapObject | [private]


Schedule Member List

This is the complete list of members for Schedule, including all inherited members.
allowCoupling | Schedule |
Announce(string state) | Schedule |
CMD_ANNOUNCE | Schedule |
CMD_COMPLETE_JUNCTIONS | Schedule |
CMD_COUPLE_VEHICLE | Schedule |
CMD_CUSTOM | Schedule |
CMD_DELETE_TRAIN | Schedule |
CMD_DRIVE_FOREVER | Schedule |
CMD_DRIVE_THROUGH_TRACKMARK | Schedule |
CMD_ON_ANNOUNCEMENT | Schedule |
CMD_ON_TRIGGER | Schedule |
CMD_POST_MESSAGE | Schedule |
CMD_RESET_TIMETABLE | Schedule |
CMD_REVERSE_TRAIN | Schedule |
CMD_SET_SIGNAL | Schedule |
CMD_STOP_AT_SCENERY | Schedule |
CMD_STOP_AT_TRACKMARK | Schedule |
CMD_STOP_AT_TRIGGER | Schedule |
CMD_STOP_TRAIN | Schedule |
CMD_TAKE_JUNCTION | Schedule |
CMD_TAKE_TRACK_PERMIT | Schedule |
commands | Schedule |
CompleteJunctions() | Schedule |
CoupleVehicle(Vehicle vehicle) | Schedule | [inline]
Custom(CustomCommand custom, int px, int py, int pz) | Schedule |
Custom(CustomCommand custom) | Schedule |
DeleteTrain() | Schedule |
DriveForever(void) | Schedule | [inline]
DriveThroughTrackMark(TrackMark trackMark) | Schedule | [inline]
limitCouplingTo | Schedule |
notifyDriver | Schedule |
OnAnnounce(string state) | Schedule |
OnTrigger(string triggerName, bool enter) | Schedule |
PostMessage(int srcId, int dstId, string major, string minor, float time) | Schedule |
releasePermitsWhenComplete | Schedule |
Reset() | Schedule |
ResetTimetable() | Schedule |
ReverseTrain(void) | Schedule |
SetSignal(string signal, int state, string reason) | Schedule |
signalPassedAtDanger | Schedule |
StopAtScenery(string sceneryName) | Schedule | [inline]
StopAtTrackMark(TrackMark trackMark) | Schedule | [inline]
StopAtTrigger(string triggerName, float time) | Schedule |
StopTrain(float time) | Schedule |
TakeJunction(string junctionName, int direction) | Schedule |
TakeJunction(JunctionBase junction, int direction) | Schedule | [inline]
TakeTrackPermit(Track track) | Schedule |


ScheduleHistoryRec Member List

This is the complete list of members for ScheduleHistoryRec, including all inherited members.


ShuntTrack Member List

This is the complete list of members for ShuntTrack, including all inherited members.
name | ShuntTrack
trigger | ShuntTrack
vehicle | ShuntTrack


Signal Member List

This is the complete list of members for Signal, including all inherited members.
AUTOMATIC Signal
BeginTrackSearch(bool direction) | Trackside | [private]
EX_ADVANCE_CAUTION Signal
EX_ADVANCE_CAUTION_LEFT Signal
EX_ADVANCE_CAUTION_RIGHT Signal
EX_CAUTION Signal
EX_CAUTION_LEFT Signal
EX_CAUTION_RIGHT Signal
EX_MEDIUM Signal
EX_PROCEED Signal
EX_PROCEED_LEFT Signal
EX_PROCEED_RIGHT Signal
EX_SLOW Signal
EX_STOP Signal
EX_STOP_THEN_CONTINUE Signal
GetSignalLit(void) | Signal
GetSignalState(void) | Trackside | [private]
GetSignalStateEx(void) | Trackside | [private]
GetSpeedLimit(void) | Trackside | [private]
GetTrack(void) | Trackside | [private]
GREEN Signal
InnerReEnter(int nodeId) | Trackside | [private]
LightSignal(bool show) | Signal
RED Signal
ReEnter(int nodeId) | Trackside | [private]
RequestTrackPermit(bool dir, GameObject owner) | Trackside | [private]
RequestTrackPermit(bool dir) | Trackside | [inline, private]
SetSignalState(int state, string reason) | Signal
SetSignalStateEx(int state, string reason) | Signal
SetSpeedLimit(float limit) | Trackside | [private]


SignalBehaviour Member List

This is the complete list of members for SignalBehaviour, including all inherited members.
done SignalBehaviour
lockControlsOnRed SignalBehaviour
runred SignalBehaviour
SetDefaults() SignalBehaviour [inline]


Soup Member List

This is the complete list of members for Soup, including all inherited members.
Clear(void) | Soup |
Copy(Soup value) | Soup |
CountTags(void) | Soup |
GetIndexedTagName(int index) | Soup |
GetIndexForNamedTag(string name) | Soup |
GetNamedSoup(string name) | Soup |
GetNamedTag(string name) | Soup |
GetNamedTagAsBool(string name) | Soup | [inline]
GetNamedTagAsBool(string name, bool defaultValue) | Soup | [inline]
GetNamedTagAsFloat(string name) | Soup |
GetNamedTagAsInt(string name) | Soup |
GetNamedTagAsInt(string name, int defaultValue) | Soup |
GetNamedTagAsKUID(string name) | Soup |
IsLocked(void) | Soup |
RemoveNamedTag(string name) | Soup |
SetNamedSoup(string name, Soup value) | Soup |
SetNamedTag(string name, string value) | Soup |
SetNamedTag(string name, float value) | Soup |
SetNamedTag(string name, int value) | Soup |
SetNamedTag(string name, KUID value) | Soup |
SetNamedTag(string name, bool value) | Soup | [inline]


SpecificVehiclesInfo Member List

This is the complete list of members for SpecificVehiclesInfo, including all inherited members.
DoesMatch(Train train) | SpecificVehiclesInfo | [inline]
DoesMatchAnd(Train train) | SpecificVehiclesInfo | [inline]
DoesMatchAndExlcude(Train train) | SpecificVehiclesInfo | [inline]
GetDescriptionHTML(void) | SpecificVehiclesInfo | [inline]
GetPrefix(void) | HTMLPropertyHandler | [private]
GetProperties(void) | SpecificVehiclesInfo | [inline]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyHandler | [private]
GetPropertyDescription(string propertyID) | SpecificVehiclesInfo | [inline]
GetPropertyElementList(string propertyID) | SpecificVehiclesInfo | [inline]
GetPropertyName(string propertyID) | SpecificVehiclesInfo | [inline]
GetPropertyType(string propertyID) | SpecificVehiclesInfo | [inline]
GetPropertyValue(string propertyID) | HTMLPropertyHandler | [private]
GetSavesProperties(void) | HTMLPropertyHandler | [private]
HREF(string propertyName) | HTMLPropertyHandler | [private]
Link(string propertyName) | HTMLPropertyHandler | [private]
Prop(string propertyName) | HTMLPropertyHandler | [private]
PropMatchesPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
PropStripPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
RefreshBrowser(Browser browser) | HTMLPropertyHandler | [private]
SetPrefix(string prefix) | HTMLPropertyHandler | [private]
SetProperties(Soup soup) | SpecificVehiclesInfo | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyHandler | [private]
SetPropertyValue(string propertyID, PropertyValue value) | SpecificVehiclesInfo | [inline]
SetSavesProperties(bool saveProperties) | HTMLPropertyHandler | [private]


StationBehaviour Member List

This is the complete list of members for StationBehaviour, including all inherited members.
delay StationBehaviour
done StationBehaviour
major StationBehaviour
minor StationBehaviour
mwstopped StationBehaviour
overrun StationBehaviour
reverse StationBehaviour
SetDefaults() StationBehaviour [inline]


Str Member List

This is the complete list of members for Str, including all inherited members.
Left(string s, int i) | Str | [inline]
Mid(string s, int first, int count) | Str | [inline]
Right(string s, int i) | Str | [inline]
ToFloat(string s) | Str |
ToInt(string s) | Str |
Tokens(string s, string delimiters) | Str |
ToLower(string s) | Str |
ToUpper(string s) | Str |
TrimLeft(string s, string trim) | Str |
TrimRight(string s, string trim) | Str |
UnpackFloat(string s) | Str |
UnpackInt(string s) | Str |
UnpackString(string s) | Str |


StringTable Member List

This is the complete list of members for StringTable, including all inherited members.
ClearParams() | StringTable |
GetLanguage() | StringTable |
GetString(string str) | StringTable |
GetString0(string str) | StringTable | [inline]
GetString1(string str, string parm) | StringTable | [inline]
GetString10(string str, string parm0, string parm1, string parm2, string parm3, string parm4, string parm5, string parm6, string parm7, string parm8, string parm9) | StringTable | [inline]
GetString2(string str, string parm0, string parm1) | StringTable | [inline]
GetString3(string str, string parm0, string parm1, string parm2) | StringTable | [inline]
GetString4(string str, string parm0, string parm1, string parm2, string parm3) | StringTable | [inline]
GetString5(string str, string parm0, string parm1, string parm2, string parm3, string parm4) | StringTable | [inline]
GetString6(string str, string parm0, string parm1, string parm2, string parm3, string parm4, string parm5) | StringTable | [inline]
GetString7(string str, string parm0, string parm1, string parm2, string parm3, string parm4, string parm5, string parm6) | StringTable | [inline]
GetString8(string str, string parm0, string parm1, string parm2, string parm3, string parm4, string parm5, string parm6, string parm7) | StringTable | [inline]
GetString9(string str, string parm0, string parm1, string parm2, string parm3, string parm4, string parm5, string parm6, string parm7, string parm8) | StringTable | [inline]
SetParam(int param, string text) | StringTable |


Timetable Member List

This is the complete list of members for Timetable, including all inherited members.
Announce(string stateName, int srcId) | Timetable
OnAnnouncement(string stateName, int notifyId) | Timetable
OnAnnouncement(GameObject runningThread, string stateName) | Timetable
Reset() | Timetable
UnAnnounce(string stateName) | Timetable


TimetableState Member List

This is the complete list of members for TimetableState, including all inherited members.
observers | TimetableState
state | TimetableState
stateName | TimetableState


Track Member List

This is the complete list of members for Track, including all inherited members.
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
ClearMessages(string major, string minor) | GameObject | [private]
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
GetId() | GameObject | [private]
GetName() | GameObject | [private]
GetTrackPriorityNumber(void) | Track |
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
RequestPermit(GameObject obj, bool direction) | Track |
RequestPermit(GameObject obj) | Track |
RequestPermitForTrain(Train train) | Track |
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
SetTrackPriorityNumber(int i) | Track |
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]


TrackLoadInfo Member List

This is the complete list of members for TrackLoadInfo, including all inherited members.
platformIndex | TrackLoadInfo
trackName | TrackLoadInfo
trainLeftSide | TrackLoadInfo


TrackMark Member List

This is the complete list of members for TrackMark, including all inherited members.
BeginTrackSearch(bool direction) | Trackside | [private]
GetSignalState(void) | Trackside | [private]
GetSignalStateEx(void) | Trackside | [private]
GetSpeedLimit(void) | Trackside | [private]
GetTrack(void) | Trackside | [private]
InnerReEnter(int nodeId) | Trackside | [private]
ReEnter(int nodeId) | Trackside | [private]
RequestTrackPermit(bool dir, GameObject owner) | Trackside | [private]
RequestTrackPermit(bool dir) | Trackside | [inline, private]
SetSpeedLimit(float limit) | Trackside | [private]


Trackside Member List

This is the complete list of members for Trackside, including all inherited members.
BeginTrackSearch(bool direction) | Trackside |
GetLocalisedName(void) | MapObject | [private]
GetQueue(string queueName) | MapObject | [private]
GetQueues(void) | MapObject | [private]
GetSignalState(void) | Trackside |
GetSignalStateEx(void) | Trackside |
GetSpeedLimit(void) | Trackside |
GetTrack(void) | Trackside |
InnerReEnter(int nodeId) | Trackside |
PlaySoundScriptEvent(string soundName) | MapObject | [private]
ReEnter(int nodeId) | Trackside |
RequestTrackPermit(bool dir, GameObject owner) | Trackside |
RequestTrackPermit(bool dir) | Trackside | [inline]
SetSpeedLimit(float limit) | Trackside |
StopSoundScriptEvent(string soundName) | MapObject | [private]


Train Member List

This is the complete list of members for Train, including all inherited members.
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
AddVelocity(float vel) | Train |
ClearMessages(string major, string minor) | GameObject | [private]
ClearTrainTimetable(ScenarioBehavior rule) | Train |
CONTROL_AUTOMANUAL | Train |
CONTROL_AUTOPILOT | Train |
CONTROL_MANUAL | Train |
CONTROL_SCRIPT | Train |
DecTrainBusy(void) | Train |
Derail(void) | Train |
DYNAMIC_BRAKE_BRAKE | Train |
DYNAMIC_BRAKE_NEUTRAL | Train |
DYNAMIC_BRAKE_TRACTION | Train |
EnablePhysics(bool enable) | Train |
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
GetActiveDriver(void) | Train |
GetAdvisoryLimit(void) | Train |
GetAllowsUserControl(void) | Train |
GetAutopilotMode(void) | Train |
GetAutopilotStopJunctionBase(void) | Train |
GetAutopilotStopTrain(void) | Train |
GetAutopilotTargetSlowing(void) | Train |
GetDCCThrottle(void) | Train |
GetFrontmostLocomotive(void) | Train |
GetHeadlightState(void) | Train |
GetId() | GameObject | [private]
GetLastVisitedBuildable(void) | Train | [inline]
GetLastVisitedIndustry(void) | Train | [inline]
GetLastVisitedTrack(void) | Train | [inline]
GetMaximumCouplingStressVehicle(void) | Train |
GetName() | GameObject | [private]
GetPantographState(void) | Train |
GetPhysicsModel(void) | Train |
GetSmoothedVelocity(void) | Train |
GetSpeedLimit(void) | Train |
GetTrackmarkDirection(TrackMark mark) | Train |
GetTrainBrakes(void) | Train |
GetTrainDisplayName(void) | Train |
GetTrainPriorityNumber(void) | Train |
GetTrainTimetable(void) | Train |
GetVehicles(void) | Train |
GetVelocity(void) | Train |
HasReachedJunctionInnerRadius(JunctionBase jn) | Train | [inline]
HasTrainTimetable(void) | Train |
IncTrainBusy(void) | Train |
Init(void) | Train |
IsScheduleRunning() | Train |
IsScheduleWindowVisible(void) | Train | [inline]
IsStillInJunction(JunctionBase jn) | Train | [inline]
IsStopped() | Train |
IsTrainBusy(void) | Train |
IsViewDetailsVisible(void) | Train | [inline]
KPH_TO_MPS | Train |
MapObjectIsInFront(MapObject obj, float maxRange) | Train | [inline]
MPH_TO_KPH | Train |
MPH_TO_MPS | Train |
PHYSICS_DCC | Train |
PHYSICS_SIMULATION | Train |
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
ReleaseTrackPermits(Permit[] permits) | Train | [inline]
RESULT_BACKWARD | Train |
RESULT_FORWARD | Train |
RESULT_INSIDE | Train |
RESULT_NONE | Train |
RunSchedule(Schedule schedule, bool loop, float delay) | Train |
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
SetAdhesion(float adhesion) | Train | [inline]
SetAdvisoryLimit(float speed) | Train |
SetAutopilotMode(int controlMode) | Train |
SetAutopilotTarget(Buildable obj, string triggerName) | Train |
SetAutopilotTarget(Trackside obj) | Train |
SetAutopilotTarget(Track track) | Train |
SetAutopilotTarget(JunctionBase junction) | Train |
SetAutopilotTargetMinimumDistance(float distance) | Train |
SetAutopilotTargetMinimumSpeed(float speed) | Train |
SetBail(void) | Train |
SetCouplingMask(int mask) | Train |
SetDCCThrottle(float throttle) | Train |
SetDecouplingMask(int mask) | Train |
SetDynamicBrakeMode(int dynamicBrakeMode) | Train |
SetFloatingLimit(float delta, bool enable) | Train |
SetHandBrake(bool state) | Train |
SetHeadlightState(bool lightsOn) | Train |
SetLastVisitedBuildable(Buildable b) | Train | [inline]
SetManualThrottle(int throttleNotch) | Train |
SetPantographState(int state) | Train |
SetPhysicsMode(int physicsMode) | Train | [inline]
SetReverser(int reverserDirection) | Train |
SetTrainBrakes(float brakeMode) | Train |
SetTrainPriorityNumber(int priority) | Train |
SetTrainTimetable(TrainTimetable timetable) | Train |
SetVelocity(float vel) | Train |
ShowInConsistMenu(bool show) | Train |
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]
SoundHorn(void) | Train |
StopSchedule() | Train |
StopScheduleAndWait() | Train | [inline]
StopTrainGently(void) | Train |
TakePermitOnTrack(bool direction) | Train | [inline]
TestTrackPermit(Permit trackPermit, bool innerOnly) | Train |
timeTableInfo | Train |
ToggleScheduleWindow(void) | Train | [inline]
ToggleViewDetailsWindow(void) | Train | [inline]
TrackSearch(bool dir, float distance) | Train |
TracksideIsInFront(Trackside obj, float maxRange) | Train | [inline]
TRACTION_FORWARD | Train |
TRACTION_NEUTRAL | Train |
TRACTION_REVERSE | Train |
TRAIN_BRAKE_APPLICATION | Train |
TRAIN_BRAKE_EMERGENCY | Train |
TRAIN_BRAKE_HANDLE_OFF | Train |
TRAIN_BRAKE_INITIAL | Train |
TRAIN_BRAKE_LAP | Train |
TRAIN_BRAKE_RELEASE | Train |
Turnaround(void) | Train |
UpdateScheduleWindow(string vehicleName) | Train |
UpdateViewDetails(void) | Train | [inline]
UpdateViewDetails(Vehicle vehicle) | Train | [inline]
UpdateViewDetailsLocomotive(void) | Train |
ViewDetails(Vehicle vehicle) | Train | [inline]
WasRunScheduleSuccessful(void) | Train | [inline]


TrainHelperInfo Member List

This is the complete list of members for TrainHelperInfo, including all inherited members.
AddHandler(HTMLPropertyHandler handler, string subPrefix) | HTMLPropertyGroup | [private]
DoesFilterTrains(void) | TrainHelperInfo | [inline]
DoesMatch(Train train) | TrainHelperInfo |
FindHandler(string propertyID) | HTMLPropertyGroup | [private]
GetDescriptionHTML(void) | TrainHelperInfo | [inline]
GetProperties(void) | TrainHelperInfo | [inline]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyGroup | [private]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyGroup | [inline, private]
GetPropertyDescription(string propertyID) | TrainHelperInfo | [inline]
GetPropertyElementList(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyElementList(string propertyID) | HTMLPropertyGroup | [inline, private]
GetPropertyName(string propertyID) | TrainHelperInfo | [inline]
GetPropertyType(string propertyID) | TrainHelperInfo | [inline]
GetPropertyValue(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyValue(string propertyID) | HTMLPropertyGroup | [inline, private]
Init(void) | TrainHelperInfo | [inline]
LogHandlers(void) | HTMLPropertyGroup | [private]
RefreshBrowser(Browser browser) | HTMLPropertyGroup | [private]
RefreshBrowser(Browser browser) | HTMLPropertyGroup | [inline, private]
RemoveHandler(HTMLPropertyHandler handler) | HTMLPropertyGroup | [private]
SetPrefix(string prefix) | HTMLPropertyGroup | [private]
SetPrefix(string prefix) | HTMLPropertyGroup | [inline, private]
SetProperties(Soup soup) | TrainHelperInfo | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyGroup | [private]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyGroup | [inline, private]
SetPropertyValue(string propertyID, PropertyValue value) | TrainHelperInfo | [inline]


TrainTimetable Member List

This is the complete list of members for TrainTimetable, including all inherited members.
GetArrivedAtDestination(void) | TrainTimetable | [inline]
GetCurrentTimetable(int hintMaxDesired) | TrainTimetable | [inline]
GetCurrentTimetableItem(void) | TrainTimetable | [inline]
GetIsAtDestination(void) | TrainTimetable | [inline]
GetIsLate(void) | TrainTimetable | [inline]
GetTimetableRule(void) | TrainTimetable | [inline]
GetTrain(void) | TrainTimetable | [inline]


TrainTimetableItem Member List

This is the complete list of members for TrainTimetableItem, including all inherited members.
arrivalTime | TrainTimetableItem
arrivedAtDestination | TrainTimetableItem
arrivedLate | TrainTimetableItem
arriveEarly | TrainTimetableItem
command | TrainTimetableItem
departEarly | TrainTimetableItem
departOnTime | TrainTimetableItem
departureTime | TrainTimetableItem
destinationName | TrainTimetableItem
mode | TrainTimetableItem
MODE_INDUSTRY | TrainTimetableItem
MODE_TRACKMARK | TrainTimetableItem
msgEarlySent | TrainTimetableItem
msgLateSent | TrainTimetableItem
trackName | TrainTimetableItem


TrainUtil Member List

This is the complete list of members for TrainUtil, including all inherited members.
AlreadyThereStr(string[] strArray, string searchStr) | TrainUtil
AreInTrain(Train train, Vehicle[] vehicles) | TrainUtil
CompareStrLists(string[] strListOne, string[] strListTwo) | TrainUtil
CreateTrainFromSoup(Soup trainSoup, string trackMarkName, bool direction) | TrainUtil
DoCoupleUp(Train train, Train coupleTo) | TrainUtil
DoDecouple(Train train, int wagons) | TrainUtil
GetAfter(string propertyString, string searchChars) | TrainUtil
GetUpTo(string propertyString, string searchChars) | TrainUtil
HasPrefix(string searchStr, string prefixStr) | TrainUtil
HasSufix(string searchStr, string sufixStr) | TrainUtil
IsInTrain(Train train, Vehicle vehicle) | TrainUtil
IsInTrigger(GameObject runningThread, Vehicle vehicle, Trigger trigger) | TrainUtil
IsPartTrainInTrigger(GameObject runningThread, Train train, Trigger trigger) | TrainUtil
IsTrainInTrigger(GameObject runningThread, Train train, Trigger trigger) | TrainUtil
RandBool(void) | TrainUtil
RunTurnTable(GameObject runningThread, Train train, string turntable) | TrainUtil
StrSubst(string s, string remove, string replace) | TrainUtil
WaitUntilHas(Vehicle loco, ShuntTrack[] tracking) | TrainUtil


Trainz Member List

This is the complete list of members for Trainz, including all inherited members.


TrainzGameObject Member List

This is the complete list of members for TrainzGameObject, including all inherited members.
AddHandler(GameObject target, string major, string minor, string handler) | GameObject | [private]
ClearMessages(string major, string minor) | GameObject | [private]
Exception(string reason) | GameObject | [private]
extension | GameObject | [private]
GetAsset(void) | TrainzGameObject |
GetId() | GameObject | [private]
GetName() | GameObject | [private]
Init(Asset asset) | TrainzGameObject |
PostMessage(GameObject dst, string major, string minor, float seconds) | GameObject | [private]
SendMessage(GameObject dst, string major, string minor) | GameObject | [private]
Sleep(float seconds) | GameObject | [private]
Sniff(GameObject target, string major, string minor, bool state) | GameObject | [private]


Trigger Member List

This is the complete list of members for Trigger, including all inherited members.
BeginTrackSearch(bool direction) | Trackside | [private]
GetSignalState(void) | Trackside | [private]
GetSignalStateEx(void) | Trackside | [private]
GetSpeedLimit(void) | Trackside | [private]
GetTrack(void) | Trackside | [private]
InnerReEnter(int nodeId) | Trackside | [private]
ReEnter(int nodeId) | Trackside | [private]
RequestTrackPermit(bool dir, GameObject owner) | Trackside | [private]
RequestTrackPermit(bool dir) | Trackside | [inline, private]
SetSpeedLimit(float limit) | Trackside | [private]


Turntable Member List

This is the complete list of members for Turntable, including all inherited members.
CanMoveToNextStop(void) | Turntable |
CanMoveToPrevStop(void) | Turntable |
FindTriggerContainingNode(int nodeId, bool onlyInnerTrigger) | SceneryWithTrack | [private]
GetAttachedJunctions(void) | SceneryWithTrack | [private]
GetAttachedTrack(string trackName) | SceneryWithTrack | [private]
GetStopPosition(void) | Turntable |
GetTriggerTrack(string triggerName) | SceneryWithTrack | [private]
InnerReEnter(int nodeId) | SceneryWithTrack | [private]
InnerReEnterTrain(Train train) | SceneryWithTrack | [inline, private]
IsMoving(void) | Turntable |
IsTrainInTriggers(Train train, bool onlyCheckInnerRadius) | SceneryWithTrack | [private]
MoveToNextStop(void) | Turntable |
MoveToPrevStop(void) | Turntable |
MoveToStop(int stopIndex) | Turntable |
ReEnter(int nodeId) | SceneryWithTrack | [private]


Vehicle Member List

This is the complete list of members for Vehicle, including all inherited members.
BeginLoad(LoadingReport report) | Vehicle | [inline]
BeginTrackSearch(bool direction) | Trackside | [private]
BeginUnload(LoadingReport report) | Vehicle | [inline]
CanLoadProductFromQueue(ProductQueue queue) | Vehicle | [inline]
CanUnloadProductToQueue(ProductQueue queue) | Vehicle | [inline]
Couple(Vehicle other) | Vehicle |
COUPLE_BACK | Vehicle |
COUPLE_BOTH | Vehicle |
COUPLE_FRONT | Vehicle |
COUPLE_NONE | Vehicle |
DIRECTION_BACKWARD | Vehicle |
DIRECTION_FORWARD | Vehicle |
DIRECTION_NONE | Vehicle |
EndLoad(LoadingReport report) | Vehicle | [inline]
EndUnload(LoadingReport report) | Vehicle | [inline]
ENGINE_NONE | Vehicle |
ENGINE_STANDARD | Vehicle |
ENGINE_STEAM | Vehicle |
GetAuxReservoirPressure(void) | Vehicle |
GetBogeyList(void) | Vehicle |
GetBrakeCylinderPressure(void) | Vehicle |
GetBrakePipePressure(void) | Vehicle |
GetCabinSwayAmount(void) | Vehicle |
GetCouplerBreakageEnabled(void) | Vehicle |
GetCouplingDirection(Vehicle other) | Vehicle |
GetCouplingStress(Vehicle toVehicle) | Vehicle |
GetDefaultCabinSwayAmount(void) | Vehicle |
GetDefaultMaximumCouplerCompressionStress(void) | Vehicle |
GetDefaultMaximumCouplerExpansionStress(void) | Vehicle |
GetDefaultMaximumCoupleVelocity(void) | Vehicle |
GetDefaultMaximumTractiveEffort(void) | Vehicle |
GetDescriptionHTML(void) | Vehicle | [inline]
GetDirectionRelativeToTrain(void) | Vehicle |
GetEngineParam(string p_paramName) | Vehicle |
GetEngineType(void) | Vehicle |
GetFacingRelativeToTrain(void) | Vehicle | [inline]
GetLength(void) | Vehicle |
GetLoadTime(LoadingReport report) | Vehicle | [inline]
GetMass(void) | Vehicle |
GetMaximumCouplerCompressionStress(void) | Vehicle |
GetMaximumCouplerExpansionStress(void) | Vehicle |
GetMaximumCoupleVelocity(void) | Vehicle |
GetMaximumTractiveEffort(void) | Vehicle |
GetMyTrain(void) | Vehicle |
GetProductRestriction(void) | Vehicle | [inline]
GetProperties(void) | Vehicle | [inline]
GetPropertyDescription(string p_propertyID) | Vehicle | [inline]
GetPropertyElementList(string propertyID) | Vehicle | [inline]
GetPropertyName(string propertyID) | Vehicle | [inline]
GetPropertyType(string propertyID) | Vehicle | [inline]
GetPropertyValue(string p_propertyID) | Vehicle | [inline]
GetRelationToTrack(Buildable obj, string trackName) | Vehicle |
GetRunningNumber() | Vehicle |
GetSandingTractionMultiplier(void) | Vehicle |
GetSignalState(void) | Trackside | [private]
GetSignalStateEx(void) | Trackside | [private]
GetSpeedLimit(void) | Trackside | [private]
GetTrack(void) | Trackside | [private]
GetTrackGradient(void) | Vehicle |
GetUnloadTime(LoadingReport report) | Vehicle | [inline]
GetVehicleTypeFlags(void) | Vehicle |
GetVelocity(void) | Vehicle |
GetWheelslipTractionMultiplier(void) | Vehicle |
Init(void) | Vehicle | [inline]
InnerReEnter(int nodeId) | Trackside | [private]
IsInTunnel(void) | Vehicle |
IsOnBridge(void) | Vehicle |
LinkPropertyValue(string propertyID) | Vehicle | [inline]
LoadProduct(LoadingReport report) | Vehicle |
ReEnter(int nodeId) | Trackside | [private]
Reposition(TrackMark mark, bool direction) | Vehicle |
Reposition(Vehicle other, int myCoupleDirection, int otherCoupleDirection) | Vehicle |
Reposition(Train train, int myCoupleDirection, int otherCoupleDirection) | Vehicle |
RequestTrackPermit(bool dir, GameObject owner) | Trackside | [private]
RequestTrackPermit(bool dir) | Trackside | [inline, private]
Reverse() | Vehicle |
SetBrakePipeEfficiency(float efficiency) | Vehicle |
SetBrokenBrakes(bool broken) | Vehicle |
SetCabinSwayAmount(float amount) | Vehicle |
SetCouplerBreakageEnabled(bool enabled) | Vehicle |
SetCouplingMask(int couplingMask) | Vehicle |
SetDecouplingMask(int couplingMask) | Vehicle |
SetHandBrake(bool applied) | Vehicle |
SetHeadlightColor(float red, float green, float blue) | Vehicle |
SetMaximumCouplerCompressionStress(float maxCouplerCompressionStress) | Vehicle |
SetMaximumCouplerExpansionStress(float maxCouplerExpansionStress) | Vehicle |
SetMaximumCoupleVelocity(float maxCoupleVelocity) | Vehicle |
SetMaximumTractiveEffort(float maxTE) | Vehicle |
SetPitchBasedOnSpeed(float multiplier) | Vehicle |
SetPitchBasedOnTrack(bool pitchBasedOnTrack) | Vehicle |
SetProductDisabled(void) | Vehicle | [inline]
SetProductRestriction(Asset product) | Vehicle | [inline]
SetProperties(Soup soup) | Vehicle | [inline]
SetPropertyValue(string p_propertyID, string p_value) | Vehicle | [inline]
SetPropertyValue(string propertyID, int value) | Vehicle | [inline]
SetPropertyValue(string propertyID, string value, int index) | Vehicle | [inline]
SetQueueInitialCount(ProductQueue queue, Asset asset, int newValue) | Vehicle | [inline]
SetRollBasedOnTrack(float multiplier) | Vehicle |
SetRunningNumber(string rn) | Vehicle |
SetSandingTractionMultiplier(float multiplier) | Vehicle |
SetSpeedLimit(float limit) | Trackside | [private]
SetWheelslipTractionMultiplier(float multiplier) | Vehicle |
TYPE_HAS_INTERIOR | Vehicle |
TYPE_LOCOMOTIVE | Vehicle |
TYPE_TENDER | Vehicle |
Uncouple(Vehicle other) | Vehicle |
Uncouple(int direction) | Vehicle |
UnloadProduct(LoadingReport report) | Vehicle |
UpdateViewDetails(Message msg) | Vehicle | [inline]
vehicleProductInfoCollection | Vehicle |
ViewDetails(Message msg) | Vehicle | [inline]
ViewSchedule(Message msg) | Vehicle | [inline]


VehicleDescriptor Member List

This is the complete list of members for VehicleDescriptor, including all inherited members.
facing | VehicleDescriptor
load | VehicleDescriptor
number | VehicleDescriptor
runningNumber | VehicleDescriptor
vehicle | VehicleDescriptor


VehicleHelperInfo Member List

This is the complete list of members for VehicleHelperInfo, including all inherited members.
AddHandler(HTMLPropertyHandler handler, string subPrefix) | HTMLPropertyGroup | [private]
FindHandler(string propertyID) | HTMLPropertyGroup | [private]
GetDescriptionHTML(void) | VehicleHelperInfo | [inline]
GetProperties(void) | VehicleHelperInfo | [inline]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyGroup | [private]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyGroup | [inline, private]
GetPropertyDescription(string propertyID) | VehicleHelperInfo | [inline]
GetPropertyElementList(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyElementList(string propertyID) | HTMLPropertyGroup | [inline, private]
GetPropertyName(string propertyID) | VehicleHelperInfo | [inline]
GetPropertyType(string propertyID) | VehicleHelperInfo | [inline]
GetPropertyValue(string propertyID) | HTMLPropertyGroup | [private]
GetPropertyValue(string propertyID) | HTMLPropertyGroup | [inline, private]
LogHandlers(void) | HTMLPropertyGroup | [private]
RefreshBrowser(Browser browser) | HTMLPropertyGroup | [private]
RefreshBrowser(Browser browser) | HTMLPropertyGroup | [inline, private]
RemoveHandler(HTMLPropertyHandler handler) | HTMLPropertyGroup | [private]
SetPrefix(string prefix) | HTMLPropertyGroup | [private]
SetPrefix(string prefix) | HTMLPropertyGroup | [inline, private]
SetProperties(Soup soup) | VehicleHelperInfo | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyGroup | [private]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyGroup | [inline, private]
SetPropertyValue(string propertyID, PropertyValue value) | VehicleHelperInfo | [inline]


VehicleTypesInfo Member List

This is the complete list of members for VehicleTypesInfo, including all inherited members.
DoesMatch(Train train) | VehicleTypesInfo | [inline]
DoesMatchAnd(Train train) | VehicleTypesInfo | [inline]
DoesMatchAndExlcude(Train train) | VehicleTypesInfo | [inline]
GetDescriptionHTML(void) | SpecificVehiclesInfo | [inline, private]
GetProperties(void) | SpecificVehiclesInfo | [inline, private]
GetPropertyDescription(string propertyID) | SpecificVehiclesInfo | [inline, private]
GetPropertyElementList(string propertyID) | VehicleTypesInfo | [inline]
GetPropertyName(string propertyID) | SpecificVehiclesInfo | [inline, private]
GetPropertyType(string propertyID) | SpecificVehiclesInfo | [inline, private]
SetProperties(Soup soup) | SpecificVehiclesInfo | [inline, private]
SetPropertyValue(string propertyID, PropertyValue value) | SpecificVehiclesInfo | [inline, private]


VHIDriversInfo Member List

This is the complete list of members for VHIDriversInfo, including all inherited members.
GetDescriptionHTML(void) | VHISpecificVehiclesInfo | [inline, private]
GetProperties(void) | VHISpecificVehiclesInfo | [inline, private]
GetPropertyDescription(string propertyID) | VHISpecificVehiclesInfo | [inline, private]
GetPropertyElementList(string propertyID) | VHIDriversInfo | [inline]
GetPropertyName(string propertyID) | VHISpecificVehiclesInfo | [inline, private]
GetPropertyType(string propertyID) | VHISpecificVehiclesInfo | [inline, private]
SetProperties(Soup soup) | VHISpecificVehiclesInfo | [inline, private]
SetPropertyValue(string propertyID, PropertyValue value) | VHISpecificVehiclesInfo | [inline, private]


VHISpecificVehiclesInfo Member List

This is the complete list of members for VHISpecificVehiclesInfo, including all inherited members.
GetDescriptionHTML(void) | VHISpecificVehiclesInfo | [inline]
GetPrefix(void) | HTMLPropertyHandler | [private]
GetProperties(void) | VHISpecificVehiclesInfo | [inline]
GetPropertyAttribute(string propertyID, string attribute) | HTMLPropertyHandler | [private]
GetPropertyDescription(string propertyID) | VHISpecificVehiclesInfo | [inline]
GetPropertyElementList(string propertyID) | VHISpecificVehiclesInfo | [inline]
GetPropertyName(string propertyID) | VHISpecificVehiclesInfo | [inline]
GetPropertyType(string propertyID) | VHISpecificVehiclesInfo | [inline]
GetPropertyValue(string propertyID) | HTMLPropertyHandler | [private]
GetSavesProperties(void) | HTMLPropertyHandler | [private]
HREF(string propertyName) | HTMLPropertyHandler | [private]
Link(string propertyName) | HTMLPropertyHandler | [private]
Prop(string propertyName) | HTMLPropertyHandler | [private]
PropMatchesPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
PropStripPrefix(string propertyName, string prefix) | HTMLPropertyHandler | [private]
RefreshBrowser(Browser browser) | HTMLPropertyHandler | [private]
SetPrefix(string prefix) | HTMLPropertyHandler | [private]
SetProperties(Soup soup) | VHISpecificVehiclesInfo | [inline]
SetPropertyAttribute(string propertyID, string attribute, PropertyValue value) | HTMLPropertyHandler | [private]
SetPropertyValue(string propertyID, PropertyValue value) | VHISpecificVehiclesInfo | [inline]
SetSavesProperties(bool saveProperties) | HTMLPropertyHandler | [private]


VHIVehicleTypesInfo Member List

This is the complete list of members for VHIVehicleTypesInfo, including all inherited members.
GetDescriptionHTML(void) | VHISpecificVehiclesInfo | [inline, private]
GetProperties(void) | VHISpecificVehiclesInfo | [inline, private]
GetPropertyDescription(string propertyID) | VHISpecificVehiclesInfo | [inline, private]
GetPropertyElementList(string propertyID) | VHIVehicleTypesInfo | [inline]
GetPropertyName(string propertyID) | VHISpecificVehiclesInfo | [inline, private]
GetPropertyType(string propertyID) | VHISpecificVehiclesInfo | [inline, private]
SetProperties(Soup soup) | VHISpecificVehiclesInfo | [inline, private]
SetPropertyValue(string propertyID, PropertyValue value) | VHISpecificVehiclesInfo | [inline, private]


World1 Member List

This is the complete list of members for World1, including all inherited members.
CreateTrain(string consistName, string trackmarkName, bool facingDirection) | World1
SetDCCMode(bool useDCCMode) | World1
SetDerailLevel(int derailLevel) | World1


World Member List

This is the complete list of members for World, including all inherited members.
AddDriverCharacter(Asset driverCharacterAsset) | World |
AddDriverCommand(Asset driverCommandAsset) | World |
CAMERA_EXTERNAL | World |
CAMERA_INTERNAL | World |
CAMERA_LOCKED | World |
CAMERA_NORMAL | World |
CAMERA_ROAMING | World |
CAMERA_SWITCH_TRAINS | World |
CAMERA_SWITCH_VEHICLES | World |
CAMERA_SWITCH_VIEWS | World |
CAMERA_TRACKING | World |
CreateBehavior(KUID kuid, Soup initialProperties) | World |
CreateTrain(KUID[] consist, TrackMark mark, bool direction) | World |
CreateTrain(KUID[] consist, Buildable obj, string trackName, float position, bool direction) | World |
CreateTrain(KUID[] consist, string trackMarkName, bool direction) | World |
DeleteTrain(Train train) | World |
DeleteVehicle(Vehicle vehicle) | World |
DRIVER_MODULE | World |
EndScenario(float time) | World | [inline]
FindAsset(KUID kuid) | World |
FindDriverCommand(Asset driverCommandAsset) | World |
FindKUID(string name) | World |
GetAssetList(string kind) | World |
GetBehaviors(void) | World |
GetCurrentModule(void) | World |
GetDriverCharacterList(void) | World |
GetDriverCommandList(void) | World |
GetGameTime(void) | World |
GetIndustryList(void) | World |
GetJunctionList(void) | World |
GetLibrary(KUID kuid) | World |
GetSeconds(void) | World |
GetSignalList(void) | World |
GetSurveyorSavedConsist(string name) | World |
GetSurveyorSavedConsistList(void) | World |
GetTrackMarkList(void) | World |
GetTrainList(void) | World |
GetTrainzBuild(void) | World |
GetTrainzVersion(void) | World |
GetTriggerList(void) | World |
GetVehicleList(void) | World |
GetWeatherChangeability() | World |
GetWeatherType() | World |
LoadMap(KUID kuid) | World |
LoadMapTSO(Asset asset, string filename) | World |
NO_MODULE | World |
Play2DSound(string filename) | World | [inline]
Play2DSound(Asset asset, string filename) | World | [inline]
PlaySound(string filename, float volume, float minDistance, float maxDistance, GameObject target, string attachmentPoint) | World |
PlaySound(Asset asset, string filename, float volume, float minDistance, float maxDistance, GameObject target, string attachmentPoint) | World |
RemoveDriverCharacter(DriverCharacter driverCharacter) | World |
RemoveDriverCommand(DriverCommand command) | World |
SetCamera(Train focus, int cameraMode) | World |
SetCamera(Vehicle focus, int cameraMode) | World |
SetCamera(Junction focus) | World |
SetCamera(MapObject obj) | World |
SetCameraAngle(float yaw, float pitch, float radius) | World |
SetCameraAngle(int yaw, int pitch, float radius) | World | [inline]
SetCameraFlags(int cameraFlags) | World |
SetCameraMode(int cameraMode) | World |
SetGameTime(float time) | World |
SetGameTimeRate(int rate) | World |
SetTargetObserver(GameObject observer) | World |
SetWeather(int type, int changeability) | World |
SURVEYOR_MODULE | World |
TIME_DAY | World |
TIME_HOUR | World |
TIME_MINUTE | World |
TIME_RATE_1200X | World |
TIME_RATE_120X | World |
TIME_RATE_1440X | World |
TIME_RATE_16X | World |
TIME_RATE_1X | World |
TIME_RATE_240X | World |
TIME_RATE_2X | World |
TIME_RATE_32X | World |
TIME_RATE_360X | World |
TIME_RATE_480X | World |
TIME_RATE_4X | World |
TIME_RATE_60X | World |
TIME_RATE_720X | World |
TIME_RATE_8X | World |
TIME_RATE_960X | World |
TIME_SECOND | World |
UserSetCamera(GameObject target) | World |
UserSetCameraMode(int cameraMode) | World |
WEATHER_CHANGEABILITY_EXTREME | World |
WEATHER_CHANGEABILITY_NONE | World |
WEATHER_CHANGEABILITY_PERIODIC | World |
WEATHER_TYPE_CLEAR | World |
WEATHER_TYPE_CLOUDY | World |
WEATHER_TYPE_DRIZZLE | World |
WEATHER_TYPE_HEAVY_SNOW | World |
WEATHER_TYPE_LIGHT_SNOW | World |
WEATHER_TYPE_MEDIUM_SNOW | World |
WEATHER_TYPE_RAIN | World |
WEATHER_TYPE_STORMY | World |


Trainz Railroad Simulator 2006 User Activity Creation Guide File List

Here is a list of all documented files with brief descriptions:
AssetRef.h [code]
GSC.h [code]
Keywords.h [code]
Keywords2.h [code]
TrainzDoc.h [code]


GSC.h

00001
00035 \endcode
00036
00037   \note
00038       <i>C</i>-style block comments cannot be nested.
00039
00040  */
00041
00042


Trainz Railroad Simulator 2006 User Activity Creation Guide Class Hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:
  • AITrainScope
  • BrowserInterface
  • CabinControlSetting
  • CabinData
    • DefaultSteamCabinData
  • Command
  • Constructors
  • ControlSettingsManager
  • CustomCommand
    • AiHornMsg
  • DriverScheduleCommand
  • Flags
  • GSObject
    • Asset
    • GameObject
      • Browser
      • CabinControl
      • DriverCommand
      • DriverCommands
      • JunctionBaseGameObject
      • OnlineAccess
      • OnlineGroup
      • Scenario
      • Track
      • Train
      • TrainzGameObject
        • Library
        • MeshObject
          • Bogey
          • Cabin
            • DefaultLocomotiveCabin
            • DefaultSteamCabin
          • MapObject
            • SceneryWithTrack
              • Buildable
                • Industry
                  • BaseIndustry
                    • GenericPassengerStation
                  • BasePortal
                  • GenericIndustry
              • Crossing
              • Turntable
            • Trackside
              • Junction
              • Signal
              • TrackMark
              • Trigger
              • Vehicle
                • Locomotive
        • ModuleScript
          • DriverCharacter
        • ScenarioBehavior
          • ConditionalScenarioBehavior
    • HTMLPropertyHandler
      • BaseIndustryInfo
      • ConfigAssetHandler
        • AssetCheckListHandler
        • CheckListPropertyHandler
          • RadioButtonListHandler
        • EnumeratedAssetHandler
        • EnumeratedGameObjectHandler
        • EnumeratedPropertyHandler
          • EnumeratedMultiPropertyHandler
        • GenericBoolHandler
          • CheckBoxHandler
        • GenericIntNumberHandler
        • GenericStringHandler
      • ConsistHelperInfo
      • HTMLPropertyGroup
        • ConfigAssetGroupHandler
          • CheckListGroupHandler
            • RadioButtonGroupHandler
          • GenericListHandler
        • ConsistListHelper
        • TrainHelperInfo
        • VehicleHelperInfo
      • LoadHelperInfo
      • PassengerStationInfo
      • SpecificVehiclesInfo
        • DriversInfo
        • VehicleTypesInfo
      • VHISpecificVehiclesInfo
        • VHIDriversInfo
        • VHIVehicleTypesInfo
    • IndustryTrainController
    • KUID
    • KUIDList
    • LoadingReport
    • Menu
    • Permit
    • ProductFilter
    • ProductQueue
    • Soup
    • StringTable
    • TrainTimetable
  • GSTrackSearch
  • HTMLWindow
  • IndustryProcessInfo
  • IndustryProductInfo
  • IndustryProductInfoCollection
  • IndustryProductInfoComplete
  • IndustryProductInfoProcess
  • IndustryProductInfoQueues
  • IndustryProductInfoTracks
  • Interface
  • InterfaceAlert
  • InterfaceObjective
  • IPICProcess
  • IPICQueue
  • IPICTrack
  • ITCTrainCommand
  • JunctionBase
    • Junction
    • JunctionBaseGameObject
  • JunctionPermitInfo
  • LinkedData
  • LinkedList
  • Log
  • LogScope
  • Math
  • Message
  • Navigate
  • NumberValueInt
  • PropertyBrowser
  • PropertyObject
    • MeshObject
    • ScenarioBehavior
  • PropertyValue
  • Requirement
    • ResourceRequirement
  • Router
  • ScenarioStringTable
  • ScenarioSupport
  • Schedule
  • ScheduleHistoryRec
  • ShuntTrack
  • SignalBehaviour
  • StationBehaviour
  • Str
  • Timetable
  • TimetableState
  • TrackLoadInfo
  • TrainTimetableItem
  • TrainUtil
  • Trainz
  • VehicleDescriptor
  • World
  • World1


Keywords2.h

00001


Keywords.h

00001


Introduction

Introduction

This document is a mixed collection of reference material that should be of interest to TRS2006 3rd party content creators making scripted assets. It is not an artist's reference or guide (that is what the Content Creator's Guide if for), so the creation of meshes and animation etc. is not covered.

Knowledge and understanding of programming concepts is an almost essential prerequisite for almost everything presented in this reference. This is a technical reference, not a tutorial that holds your hand. We can't teach programming concepts - it is something the reader needs to acquire elsewhere.

The Auran Game Script (GS) compiler uses a syntax very similar to that of C/C++ and Java, so knowing either of these languages would be a big head start. Those who are not familiar with C/C++ or Java, but are familiar with another programming language such as Pascal, Modula-2 or Perl needn't feel totally left out as these are still languages with similar concepts and adapting to GS from them shouldn't be too difficult.

Bonus but not essential prerequisite knowledge includes an understanding of basic OO (object oriented) theory and concepts such as encapsulation, inheritance and polymorphism. In addition to that, an understanding the basic concepts of threads and callback functions will also be very advantageous.

Note:
The TRS2006 Session & Rules Guide contains plenty of useful information on how rules and objects work in the Trainz world and is recommended (but not compulsory) reading for anyone interested in making scripted assets.

The 4 major sections in this reference are:
  1. Auran Game Script Compiler
    About the language, syntax and features of the scripting language.

  2. Mini-browser HTML Reference
    Reference to HTML tags supported by the Trainz mini-browser.

  3. Class API Reference
    Detailed reference of all TRS2006 classes and methods offered to the script programmer.

  4. Asset Source
    The actual configuration and script source files used in various TRS2006 assets. This code is just placed here for the convenience of curious creators who are already familiar with Trainz scripts and want to learn more. This material is provided as-is and you are free to use it to construct your own assets.

The full content listing of this reference is:
  • Auran Game Script
    • The Language
      • Comments
      • Keywords
      • Identifiers
      • Constants
      • Types
      • Operators
      • Class Declaration
      • Function Declaration
      • Control Flow Statements
      • Grammar
    • The Compiler
    • Using Auran Game Script
    • Scripts in Trainz
  • Mini Browser HTML Reference
  • Class API Reference
    • Class API Reference
    • Class Hierarchy
    • Compound Members
  • Asset Source
    • Driver Commands
    • Industries
    • Interiors
    • Libraries
    • Rules
    • Vehicles


Trainz Railroad Simulator 2006 User Activity Creation Guide Modules

Here is a list of all modules:
  • Introduction
  • Auran Game Script
    • The Language
      • Comments
      • Keywords
        • break
        • case
        • continue
        • default
        • if, else
        • for
        • goto
        • null
        • return
        • switch
        • while
        • and
        • or
        • true
        • false
        • void
        • bool
        • int
        • float
        • string
        • object
        • class
        • static
        • include
        • public
        • native
        • final
        • thread
        • game
        • size
        • isclass
        • inherited
        • copy
        • new
        • me
        • cast
        • wait
        • on
        • define
      • Identifiers
      • Constants
      • Types
      • Operators
      • Class Declaration
      • Function Declaration
      • Control Flow Statements
      • Grammar
    • The Compiler
    • Using Auran GameScript
    • Scripts in Trainz
  • Mini-browser HTML Reference
  • Class API Reference
    • Class API Reference
    • Class Hierarchy
  • Asset Source
    • Driver Commands
      • Couple
      • Decouple
      • Drive Schedule
      • Drive To
      • Drive To Trackmark
      • Drive Via Trackmark
      • Load Product
      • Notify
      • Run Around
      • Unload Product
      • Wait For
    • Industries
      • Airport
      • Brick Station Large
      • Brick Station Medium
      • Brick Station Medium2
      • Brick Station Small
      • Coal Mine
      • Container Station
      • Forestry
      • Hyde Pulp Mill
      • Lumber Mill
      • Multiple Industry
      • Multiple Industry New
      • Oil Field
      • Oil Refinery
      • Portal
      • Power Station
      • Seaport
      • Small Station
      • Steam Filling Station
    • Interiors
      • Bigsteam
      • DD40
      • PB15
    • Libraries
      • Display HTML Pages
    • Rules
      • Cab Controls HUD
      • Consist Check
      • Control Type
      • Coupler Breakage HUD
      • Derailment Realism
      • Disabled HUD Icon Notification
      • Display Custom HUD
      • Display HTML
      • Display HTML Pages
      • Display Video
      • Driver Command
      • Driver Command Check
      • Driver Main Menu Options
      • Driver Setup
      • Enable/Disable Driver Commands
      • Enable/Disable HUD Icons
      • End Scenario
      • Flash HUD Icon
      • Flash HUD Panel
      • Message Popup
      • Minimap Options
      • Multiple Junction Alignment Check
      • Multiple Resource Check
      • Objective Clear
      • Objective New Rule
      • Objective Remove
      • Online Chat
      • Ordered List
      • Play Sound
      • Power Station
      • Progressive List
      • Random List
      • Reset List
      • Resource Check
      • Schedule Rule
      • Set Camera
      • Set Coupler Masks
      • Set Helper Icon Size
      • Set HTML Pages
      • Set Junctions
      • Show/Hide HUD Panel
      • Show/Hide Minimap
      • Simultaneous List
      • Startup Options
      • Time and Rate
      • Trigger Check
      • Trigger Rule
      • Variable Check
      • Variable Modify Continuous
      • Variable Modify
      • Variable Show
      • Vehicle Physics
      • Wait for Camera View Mode
      • Wait for Click on HUD Icon
      • Wait for Derailment
      • Wait for Driver On/Off Train
      • Wait for HTML Pages
      • Wait on Minimap Screen/Main Screen
      • Wait on Train Stop/Start
      • Wait on Waybill Screen/Main Screen
      • Weather
    • Vehicles
      • Coal Hopper
      • GATX Oil Tanker
      • Woodchip Gondola


TrainzDoc.h

00001